From d76bab4b7180068fda14549b693683a0b93e22c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lemon=E6=A9=AA?= <17633066053@163.com> Date: Tue, 17 Aug 2021 11:53:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=B7=B3=E8=BD=AC=E9=83=A8=E5=88=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81.=E6=96=B0=E5=A2=9E=E5=85=A8=E5=B1=80=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E7=BC=96=E8=AF=91=E8=B7=B3=E8=BD=AC=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 19 ++----------------- manifest.json | 4 ++-- pages/mine/address/addressManage.vue | 5 ++--- pages/mine/deposit/operation.vue | 5 ++--- pages/mine/set/setUp.vue | 4 +--- pages/order/invoice/invoiceDetail.vue | 18 +++++++++++++++--- pages/passport/codeLogin.vue | 2 +- pages/passport/wechatMPLogin.vue | 16 +++++++++++----- pages/product/shopPage.vue | 5 ++--- pages/tabbar/user/my.vue | 2 +- utils/filters.js | 21 +++++++++++++++++++++ utils/request.js | 8 ++++++++ 12 files changed, 68 insertions(+), 41 deletions(-) diff --git a/main.js b/main.js index 379e1a1..6b9df77 100644 --- a/main.js +++ b/main.js @@ -11,25 +11,11 @@ let btn = Vue.component("airBtn", airBtn); //全局注册 document.body.appendChild(new btn().$mount().$el); // #endif - - Object.keys(filters).forEach((key) => { Vue.filter(key, filters[key]); }); -const msg = (title, duration = 1500, mask = false, icon = "none") => { - //统一提示方便全局修改 - if (Boolean(title) === false) { - return; - } - uni.showToast({ - title, - duration, - mask, - icon, - }); -}; -// 引入vuex +// 引入Vuex Vue.prototype.$store = store; Vue.use(uView); Vue.config.productionTip = false; @@ -37,8 +23,7 @@ Vue.config.productionTip = false; Vue.prototype.$mainColor = "#ff3c2a"; // 高亮主题色 Vue.prototype.$lightColor = "#ff6b35"; -// 可直接 this.$api调用 -Vue.prototype.$api = { msg }; + App.mpType = "app"; diff --git a/manifest.json b/manifest.json index d69ffb3..ea03417 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "lili商城", "appid" : "__UNI__C100675", "description" : "", - "versionName" : "4.0.28", - "versionCode" : 4000028, + "versionName" : "4.0.29", + "versionCode" : 4000029, "transformPx" : false, "app-plus" : { "compatible" : { diff --git a/pages/mine/address/addressManage.vue b/pages/mine/address/addressManage.vue index 6bfd8ad..d7fe58f 100644 --- a/pages/mine/address/addressManage.vue +++ b/pages/mine/address/addressManage.vue @@ -81,6 +81,7 @@ export default { * 进入页面检测当前账户是否登录 */ onShow() { + let that = this if (this.$options.filters.isLogin("auth")) { this.getAddressList(); } else { @@ -90,9 +91,7 @@ export default { confirmColor: this.$lightColor, success: function (res) { if (res.confirm) { - uni.navigateTo({ - url: "/pages/passport/login", - }); + that.$options.filters.navigateToLogin(); } else if (res.cancel) { uni.navigateBack(); } diff --git a/pages/mine/deposit/operation.vue b/pages/mine/deposit/operation.vue index 7aff032..e9c8dff 100644 --- a/pages/mine/deposit/operation.vue +++ b/pages/mine/deposit/operation.vue @@ -36,9 +36,8 @@ export default { duration: 3000, title: "请先登录!", }); - uni.redirectTo({ - url: "/pages/passport/login", - }); + + this.$options.filters.navigateToLogin("redirectTo"); } }, methods: { diff --git a/pages/mine/set/setUp.vue b/pages/mine/set/setUp.vue index dda62d9..f73cae9 100644 --- a/pages/mine/set/setUp.vue +++ b/pages/mine/set/setUp.vue @@ -59,9 +59,7 @@ export default { storage.setAccessToken(""); storage.setRefreshToken(""); storage.setUserInfo({}); - uni.redirectTo({ - url: "/pages/passport/login", - }); + this.$options.filters.navigateToLogin("redirectTo"); }, /** diff --git a/pages/order/invoice/invoiceDetail.vue b/pages/order/invoice/invoiceDetail.vue index d941785..759e03f 100644 --- a/pages/order/invoice/invoiceDetail.vue +++ b/pages/order/invoice/invoiceDetail.vue @@ -79,7 +79,11 @@ export default { }, }); } else { - this.$api.msg("暂无发票可预览"); + uni.showToast({ + title: "暂无发票可预览", + duration: 2000, + icon: "none", + }); } }, download() { @@ -95,7 +99,11 @@ export default { uni.saveFile({ tempFilePath: tempFilePath, success: function (res) { - _this.$api.msg("发票已下载到" + res.savedFilePath); + uni.showToast({ + title: "发票已下载到" + res.savedFilePath, + duration: 2000, + icon: "none", + }); }, }); } @@ -103,7 +111,11 @@ export default { }); }); } else { - this.$api.msg("暂无发票可下载"); + uni.showToast({ + title: "暂无发票可下载", + duration: 2000, + icon: "none", + }); } }, }, diff --git a/pages/passport/codeLogin.vue b/pages/passport/codeLogin.vue index a4b3893..691d755 100644 --- a/pages/passport/codeLogin.vue +++ b/pages/passport/codeLogin.vue @@ -7,7 +7,7 @@
- + {{ tips }}
diff --git a/pages/passport/wechatMPLogin.vue b/pages/passport/wechatMPLogin.vue index bfbb51e..348132b 100644 --- a/pages/passport/wechatMPLogin.vue +++ b/pages/passport/wechatMPLogin.vue @@ -20,7 +20,7 @@ - +
暂不登录
@@ -75,9 +75,9 @@ export default { back() { whetherNavigate("wx"); }, - backToHome(){ + backToHome() { uni.switchTab({ - url: `/pages/tabbar/home/index` + url: `/pages/tabbar/home/index`, }); }, //获取用户信息 @@ -236,7 +236,7 @@ text.shop { .btn-auth { width: 92%; margin: 0 auto 40rpx; - // border-radius: 100px; + border-radius: 100px; animation: mymove 5s infinite; -webkit-animation: mymove 5s infinite; /*Safari and Chrome*/ animation-direction: alternate; /*轮流反向播放动画。*/ @@ -247,8 +247,14 @@ text.shop { -webkit-animation-timing-function: ease-in-out; /*动画的速度曲线*/ } .btn-callback { + text-align: center; + font-size: 30rpx; + border: 1rpx solid #ededed; + height: 90rpx; + line-height: 90rpx; + border-radius: 100px; width: 92%; - margin: 0 auto 100rpx; + margin: 0 auto; } .btns { diff --git a/pages/product/shopPage.vue b/pages/product/shopPage.vue index 1d76353..beae1a5 100644 --- a/pages/product/shopPage.vue +++ b/pages/product/shopPage.vue @@ -321,9 +321,8 @@ export default { duration: 3000, title: "请先登录!", }); - uni.redirectTo({ - url: "/pages/passport/login", - }); + + this.$options.filters.navigateToLogin("redirectTo"); return false; } receiveCoupons(item.id).then((res) => { diff --git a/pages/tabbar/user/my.vue b/pages/tabbar/user/my.vue index 1055bef..ce2cb3f 100644 --- a/pages/tabbar/user/my.vue +++ b/pages/tabbar/user/my.vue @@ -129,7 +129,7 @@ export default { userDetail() { this.userInfo.id ? this.navigateTo("/pages/mine/set/personMsg") - : this.navigateTo("/pages/passport/login"); + : this.$options.filters.navigateToLogin();; }, async getUserOrderNum() { uni.stopPullDownRefresh(); diff --git a/utils/filters.js b/utils/filters.js index daa53c5..ea0454c 100644 --- a/utils/filters.js +++ b/utils/filters.js @@ -117,6 +117,27 @@ export function getPages(val) { return val ? currentPage : url; } +/** + * 跳转到登录页面 + */ +export function navigateToLogin(type = "navigateTo") { + /** + * 此处进行条件编译判断 + * 微信小程序跳转到微信小程序登录页面 + * H5/App跳转到普通登录页面 + */ + // #ifdef MP-WEIXIN + uni[type]({ + url: "/pages/passport/wechatMPLogin", + }); + // #endif + // #ifndef MP-WEIXIN + uni[type]({ + url: "/pages/passport/login", + }); + // #endif +} + /** * 服务状态列表 */ diff --git a/utils/request.js b/utils/request.js index a2ddaa9..e459504 100644 --- a/utils/request.js +++ b/utils/request.js @@ -77,9 +77,17 @@ function cleanStorage() { storage.setUuid(""); storage.setUserInfo({}); + // #ifdef MP-WEIXIN + uni.navigateTo({ + url: "/pages/passport/wechatMPLogin", + }); + // #endif + + // #ifndef MP-WEIXIN uni.navigateTo({ url: "/pages/passport/login", }); + // #endif } let http = new Request();