From 964031adb95e7ddbf4db0674db91aeb79984cc10 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Wed, 18 Jun 2025 18:49:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=99=BB=E5=BD=95):=20=E5=AE=9E=E7=8E=B0H?= =?UTF-8?q?5=E5=92=8C=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E7=9A=84=E5=8F=8C=E5=B9=B3=E5=8F=B0=E7=99=BB=E5=BD=95=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加H5平台的微信授权登录流程 - 分离H5和小程序的登录逻辑到不同commit方法 - 更新登录API接口配置支持多平台 - 添加微信验证文件和配置参数 - 调整导航栏组件在微信平台的显示 - 修复登录状态检查逻辑 --- MP_verify_wfZF8R25IxLLUUXi.txt | 1 + api/model/login.js | 9 ++ components/base/navbar.vue | 9 ++ config.js | 7 +- manifest.json | 5 + pages/index/center.vue | 4 +- pages_order/auth/wxLogin.vue | 303 ++++++++++++++++++++++++----------------- pages_order/mine/help.vue | 4 +- store/store.js | 16 +++ 9 files changed, 229 insertions(+), 129 deletions(-) create mode 100644 MP_verify_wfZF8R25IxLLUUXi.txt diff --git a/MP_verify_wfZF8R25IxLLUUXi.txt b/MP_verify_wfZF8R25IxLLUUXi.txt new file mode 100644 index 0000000..9f1de61 --- /dev/null +++ b/MP_verify_wfZF8R25IxLLUUXi.txt @@ -0,0 +1 @@ +wfZF8R25IxLLUUXi \ No newline at end of file diff --git a/api/model/login.js b/api/model/login.js index 952162b..86d5a67 100644 --- a/api/model/login.js +++ b/api/model/login.js @@ -5,8 +5,17 @@ const api = { // 微信登录接口 wxLogin: { + + // #ifdef H5 + url: '/login/wxLogin', + method: 'POST', + // #endif + + // #ifdef MP-WEIXIN url: '/login/login', method: 'GET', + // #endif + limit : 500, showLoading : true, }, diff --git a/components/base/navbar.vue b/components/base/navbar.vue index 7a99e31..1da6b37 100644 --- a/components/base/navbar.vue +++ b/components/base/navbar.vue @@ -1,6 +1,11 @@ @@ -76,6 +82,9 @@ } }, created() { + if(typeof document != 'undefined'){ + document.title = this.title + } }, beforeDestroy() { }, diff --git a/config.js b/config.js index d828d63..58bc17f 100644 --- a/config.js +++ b/config.js @@ -14,10 +14,14 @@ const type = 'prod' const config = { dev: { baseUrl: 'http://augcl.natapp1.cc/massage-admin/massage', + // redirect : 'http://h5.xzaiyp.top', + redirect : 'https://wwwh5.yurangongfang.com', }, prod: { baseUrl: 'https://www.yurangongfang.com/massage-admin/massage', - } + // baseUrl: 'https://www.yurangongfang.com/massage-admin/massage', + redirect : 'https://wwwh5.yurangongfang.com', + }, } @@ -40,6 +44,7 @@ const defaultConfig = { }, //商户号 mchId : '1712378227', + appId : 'wxb1c123a63736f789', } diff --git a/manifest.json b/manifest.json index cbc1ffa..56c1ff2 100644 --- a/manifest.json +++ b/manifest.json @@ -87,6 +87,8 @@ }, "devServer" : { "https" : false, + "port" : 8002, + "disableHostCheck" : true, "proxy" : { "/ws/geocoder/v1/" : { "target" : "https://apis.map.qq.com", @@ -97,6 +99,9 @@ "changeOrigin" : true } } + }, + "router" : { + "mode" : "hash" } } } diff --git a/pages/index/center.vue b/pages/index/center.vue index 6402d22..3fdabd7 100644 --- a/pages/index/center.vue +++ b/pages/index/center.vue @@ -180,7 +180,7 @@ } }, onShow() { - if(this.isLogin){ + if(uni.getStorageSync('token')){ this.$store.commit('getUserInfo') this.$store.commit('getUserCenterInfo') this.$store.commit('getRiceInfo') @@ -311,7 +311,7 @@ } .member { - width: calc(100vw - 13rpx*2); + width: calc(724rpx); position: absolute; bottom: 0; left: 13rpx; diff --git a/pages_order/auth/wxLogin.vue b/pages_order/auth/wxLogin.vue index 830d2c2..684a82e 100644 --- a/pages_order/auth/wxLogin.vue +++ b/pages_order/auth/wxLogin.vue @@ -6,9 +6,8 @@ {{ configList.config_app_name }} - - - + - + - + 已同意 《注册协议》、隐私协议 - + @@ -45,138 +36,202 @@ - + + .flex { + display: flex; + align-items: center; + } + \ No newline at end of file diff --git a/pages_order/mine/help.vue b/pages_order/mine/help.vue index 4345572..046372f 100644 --- a/pages_order/mine/help.vue +++ b/pages_order/mine/help.vue @@ -21,8 +21,8 @@ - + diff --git a/store/store.js b/store/store.js index 8d5fae3..9fb10a0 100644 --- a/store/store.js +++ b/store/store.js @@ -1,6 +1,7 @@ import Vue from 'vue' import Vuex from 'vuex' + Vue.use(Vuex); //vue的插件机制 import api from '@/api/api.js' @@ -62,6 +63,21 @@ const store = new Vuex.Store({ // }) }, login(state, config) { + // #ifdef MP-WEIXIN + this.commit('wxLogin', config) + // #endif + // #ifdef H5 + this.commit('h5Login', config) + // #endif + }, + h5Login(state, config){ + Vue.set(state, 'userInfo', config.userInfo) + uni.setStorageSync('token', config.token) + uni.reLaunch({ + url: '/pages/index/index' + }) + }, + wxLogin(state, config){ uni.showLoading({ title: '登录中...' })