From 2f08c5ef2e3ff256dc91301f94c2fe68199977e4 Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Sat, 11 Oct 2025 10:23:05 +0800 Subject: [PATCH] 1 --- App.vue | 2 + mixins/myMixins.js | 2 + pages.json | 10 ++ pages/index/index.vue | 16 ++- pages/login/login.vue | 6 + pages/login/phoneLogin.vue | 190 ++++++++++++++++++++++++++++++++ static/js/CommonFunction.js | 4 + store/modules/user.js | 4 +- subPackages/webPage/webPage.vue | 9 ++ 9 files changed, 237 insertions(+), 6 deletions(-) create mode 100644 pages/login/phoneLogin.vue diff --git a/App.vue b/App.vue index 6a0b248..3e2ed1e 100644 --- a/App.vue +++ b/App.vue @@ -5,6 +5,7 @@ console.log('App Launch') // 1审核 默认进审核 + // #ifdef MP-WEIXIN uni.setStorageSync('SHFlag', false) this.Post({id:2388},'/api/multimedia/detail').then(res => { if (res && res.data) { @@ -16,6 +17,7 @@ uni.setStorageSync('SHFlag', false) } }); + // #endif }, onShow: function() { console.log('App Show') diff --git a/mixins/myMixins.js b/mixins/myMixins.js index aa61b53..04a1e4f 100644 --- a/mixins/myMixins.js +++ b/mixins/myMixins.js @@ -11,12 +11,14 @@ export const myMixins ={ if(option && option.wechat_qrcode){ uni.setStorageSync('wechat_qrcode',option.wechat_qrcode) } + // #ifdef MP-WEIXIN // 分享 uni.showShareMenu({ withShareTicket: true, //设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击 menus: ["shareAppMessage", "shareTimeline"] }) + // #endif }, // 分享到朋友圈 onShareTimeline() { diff --git a/pages.json b/pages.json index 3a2b688..cd504f8 100644 --- a/pages.json +++ b/pages.json @@ -38,6 +38,16 @@ "navigationBarTitleText": "登录" } } + // #ifdef H5 + , + { + "path": "pages/login/phoneLogin", + "style": { + "navigationBarTitleText": "登录" + } + } + // #endif + ], "subPackages": [{ "root": "subPackages", diff --git a/pages/index/index.vue b/pages/index/index.vue index e21fd48..d6635f7 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -163,6 +163,7 @@ initSHFlag () { let _this = this // 先查一遍 + // #ifdef MP-WEIXIN try { _this.SHFlag = uni.getStorageSync('SHFlag')?true: false } catch (e) { @@ -177,6 +178,11 @@ } console.log(_this.SHFlag) },500) + // #endif + + // #ifdef H5 + _this.SHFlag = false + // #endif }, initRectInfo () { @@ -261,13 +267,13 @@ } // 金刚区 - this.navList = res.data.nav_menu + this.navList = res.data.nav_menu || [] // 推荐广告 - this.recommendNav = res.data.recommend_data + this.recommendNav = res.data.recommend_data || [] // 下面板块 - this.moduleList = res.data.func_data + this.moduleList = res.data.func_data || [] }) // 头部banner @@ -276,7 +282,7 @@ position: 0, },"/api/adv/getAdv").then(res => { if (res) { - this.topBanner = res.data + this.topBanner = res.data || [] } }); @@ -286,7 +292,7 @@ position: 1, },"/api/adv/getAdv").then(res => { if (res) { - this.smallBanner = res.data + this.smallBanner = res.data || [] } }); diff --git a/pages/login/login.vue b/pages/login/login.vue index 549692a..26a2f5c 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -31,12 +31,18 @@ export default { }; }, onLoad(options) { + // #ifdef H5 + window.location.replace("/pages/login/phoneLogin") + // #endif + + // #ifdef MP-WEIXIN // 只需授权手机号 if (options.needAuth === '1') { setTimeout(() => { this.$refs.popup.open('bottom'); }, 400); } + // #endif }, methods: { // 处理手机号授权 diff --git a/pages/login/phoneLogin.vue b/pages/login/phoneLogin.vue new file mode 100644 index 0000000..1a9b7f6 --- /dev/null +++ b/pages/login/phoneLogin.vue @@ -0,0 +1,190 @@ + + + + + \ No newline at end of file diff --git a/static/js/CommonFunction.js b/static/js/CommonFunction.js index f8ee524..5b9cf15 100644 --- a/static/js/CommonFunction.js +++ b/static/js/CommonFunction.js @@ -256,6 +256,10 @@ Vue.prototype.getMaxCoupon = async function (param) { // H5小程序跳转外部链接 Vue.prototype.gotoWebUrl = url => { + uni.navigateTo({ + url: '/subPackages/webPage/webPage?url=' + encodeURIComponent(url) + }) + // #ifdef MP-WEIXIN uni.navigateTo({ url: '/subPackages/webPage/webPage?url=' + encodeURIComponent(url) diff --git a/store/modules/user.js b/store/modules/user.js index 921a975..7dc4264 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -55,7 +55,9 @@ export default { // #endif // #ifdef H5 - + uni.navigateTo({ + url: '/pages/login/phoneLogin' + }) // #endif }, //订单数据 diff --git a/subPackages/webPage/webPage.vue b/subPackages/webPage/webPage.vue index 7dbd8ac..5718ecf 100644 --- a/subPackages/webPage/webPage.vue +++ b/subPackages/webPage/webPage.vue @@ -10,9 +10,18 @@ } }, onLoad(option) { + // #ifdef H5 + if (option.url) { + let url = decodeURIComponent(option.url) + window.location.replace(url) + } + // #endif + + // #ifdef MP-WEIXIN if (option.url) { this.url = decodeURIComponent(option.url) } + // #endif } }