diff --git a/App.vue b/App.vue index 709d17e..a3755b7 100644 --- a/App.vue +++ b/App.vue @@ -22,4 +22,25 @@ } /* 每个页面公共css */ + + /* #ifdef H5 */ + h1, h2, h3, h4, h5, h6 { + font-size: inherit; + font-weight: inherit; + } + ol, ul, menu { + list-style: none; + } + ul, ol { + list-style: none; + margin: 0; + padding: 0; + } + .page { + min-height: calc(100vh - 50px) !important; + } + uni-page-head .uni-page-head { + box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08); + } + /* #endif */ diff --git a/components/h5-signature/h5-signature.vue b/components/h5-signature/h5-signature.vue new file mode 100644 index 0000000..fe4f9a3 --- /dev/null +++ b/components/h5-signature/h5-signature.vue @@ -0,0 +1,303 @@ + + + + + diff --git a/config/env.js b/config/env.js index cd7e26d..392e842 100644 --- a/config/env.js +++ b/config/env.js @@ -10,7 +10,22 @@ const envConf = { // 正式版-正式环境 release: { BASE_URL: 'https://cytx.csybhelp.com', + }, + // H5 环境 + h5: { + BASE_URL: '/pro-api', } } -export default envConf[uni.getAccountInfoSync().miniProgram.envVersion || 'develop']; // 可在此处手 -// export default envConf['develop']; + +function getEnvConfig() { + // #ifdef H5 + return envConf['h5'] + // #endif + // #ifdef MP-WEIXIN + return envConf[uni.getAccountInfoSync().miniProgram.envVersion || 'develop'] + // #endif + // eslint-disable-next-line no-unreachable + return envConf['develop'] +} + +export default getEnvConfig() diff --git a/manifest.json b/manifest.json index f8a1740..195044a 100644 --- a/manifest.json +++ b/manifest.json @@ -60,5 +60,13 @@ "uniStatistics" : { "enable" : false }, + "h5" : { + "title" : "肠愈同行", + "router" : { + "mode" : "history", + "base" : "/" + }, + "devServer" : {} + }, "vueVersion" : "3" } diff --git a/pages.json b/pages.json index 4bb6d6e..9fd2993 100644 --- a/pages.json +++ b/pages.json @@ -11,20 +11,20 @@ { "path": "pages/index/index", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "肠愈同行" } }, { "path": "pages/profile/profile", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "我的" } }, { "path": "pages/content/content", "style": { "navigationStyle": "default", - "navigationBarTitleText": "" + "navigationBarTitleText": "详情" } }, { diff --git a/pages/content/content.vue b/pages/content/content.vue index 53402eb..0db35da 100644 --- a/pages/content/content.vue +++ b/pages/content/content.vue @@ -1,7 +1,7 @@ @@ -68,6 +72,9 @@ const guardianIdCard = ref('') const guardianRelation = ref('') const signImageUrl = ref('') const submitting = ref(false) +// #ifdef H5 +const showH5Sign = ref(false) +// #endif const onSignatureResult = (data) => { if (data.url) signImageUrl.value = data.url @@ -75,17 +82,20 @@ const onSignatureResult = (data) => { onLoad((options) => { signType.value = options.type || 'privacy' - // 回显上次填写的数据 if (options.amount) incomeAmount.value = decodeURIComponent(options.amount) if (options.guardianName) guardianName.value = decodeURIComponent(options.guardianName) if (options.guardianIdCard) guardianIdCard.value = decodeURIComponent(options.guardianIdCard) if (options.guardianRelation) guardianRelation.value = decodeURIComponent(options.guardianRelation) + // #ifdef MP-WEIXIN uni.$on('signatureResult', onSignatureResult) + // #endif loadContent() }) onBeforeUnmount(() => { + // #ifdef MP-WEIXIN uni.$off('signatureResult', onSignatureResult) + // #endif }) const loadContent = async () => { @@ -97,9 +107,21 @@ const loadContent = async () => { } catch (e) {} } -const goSignature = () => { +const openSignature = () => { + // #ifdef MP-WEIXIN uni.navigateTo({ url: '/pages/sign/signature' }) + // #endif + // #ifdef H5 + showH5Sign.value = true + // #endif +} + +// #ifdef H5 +const onH5SignConfirm = (data) => { + showH5Sign.value = false + if (data.url) signImageUrl.value = data.url } +// #endif const confirmSign = async () => { if (!signImageUrl.value) { diff --git a/pages/sign/signature.vue b/pages/sign/signature.vue index 1899bfb..08c7e2d 100644 --- a/pages/sign/signature.vue +++ b/pages/sign/signature.vue @@ -3,6 +3,7 @@ 请在此处手写签名 + 请横屏书写 @@ -181,6 +182,10 @@ const handleSave = () => { pointer-events: none; white-space: nowrap; z-index: 0; + display: flex; + flex-direction: column; + align-items: center; + gap: 16rpx; text { font-size: 48rpx; @@ -188,6 +193,11 @@ const handleSave = () => { font-weight: 300; letter-spacing: 16rpx; } + + .hint-sub { + font-size: 28rpx; + letter-spacing: 8rpx; + } } .sign-canvas { diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..33e1cbe --- /dev/null +++ b/vite.config.js @@ -0,0 +1,15 @@ +import { defineConfig } from 'vite' +import uni from '@dcloudio/vite-plugin-uni' + +export default defineConfig({ + plugins: [uni()], + server: { + proxy: { + '/pro-api': { + target: 'http://192.168.3.66:8361', + changeOrigin: true, + rewrite: (path) => path.replace(/^\/pro-api/, '') + } + } + } +})