From 3a72a23bbe0228f04186574a00046082d0d347f8 Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Wed, 6 May 2020 17:33:13 +0800 Subject: [PATCH] =?UTF-8?q?uniapp-=E6=8F=90=E4=BA=A4=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=97=B6=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF=20uniapp-=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6=E7=BC=96=E8=BE=91=E6=95=B0=E9=87=8F=E5=90=8E=E6=9C=AA?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E9=87=8F=E7=BB=9F=E8=AE=A1=20uniapp?= =?UTF-8?q?-token=E5=A4=B1=E6=95=88=E6=9C=AA=E8=BF=9B=E8=A1=8C=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=99=BB=E5=BD=95=20uniapp-=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E7=89=A9=E6=B5=81-=E7=82=B9=E6=A0=87=E8=AF=86=E5=A4=AA?= =?UTF-8?q?=E5=A4=A7=20=E9=80=A0=E6=88=90=E9=83=A8=E5=88=86=E7=89=A9?= =?UTF-8?q?=E6=B5=81=E4=BF=A1=E6=81=AF=E8=A2=AB=E9=81=AE=E6=8C=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/login.js | 3 + libs/wechat.js | 4 +- manifest.json | 7 + pages/order/Logistics/index.vue | 706 +++++++++--------- pages/order/OrderDetails/index.vue | 2 - pages/order/OrderSubmission/index.vue | 4 +- pages/shop/ShoppingCart/index.vue | 990 +++++++++++++------------- pages/user/signIn/Sign/index.vue | 4 +- utils/index.js | 24 +- utils/request.js | 7 +- 10 files changed, 912 insertions(+), 839 deletions(-) diff --git a/libs/login.js b/libs/login.js index c4fcebc..7a1c75a 100644 --- a/libs/login.js +++ b/libs/login.js @@ -13,13 +13,16 @@ import { } from "@/utils"; export default function toLogin(push, backUrl) { + // console.log('需要重新登录') store.commit("LOGOUT"); // 如果没有授权,走登录的接口重新授权 // 授权获取失败会跳转到授权的接口 + // console.log(store.getters.isAuthorization, '是否有登陆权限') if (store.getters.isAuthorization) { login() return } + // console.log(store.getters.isAuthorizationPage, '判断是不是登录页面或者授权页面') // 判断当前是不是已经在登录页面或者授权页,防止二次跳转 if (store.getters.isAuthorizationPage || getCurrentPageUrl() == '/pages/user/Login/index') { return diff --git a/libs/wechat.js b/libs/wechat.js index d018c69..929aabb 100644 --- a/libs/wechat.js +++ b/libs/wechat.js @@ -39,7 +39,9 @@ export const weappPay = (option) => { }, fail: (error) => { console.log(error) - uni.showToast({ title: JSON.stringify(error), icon: 'none', duration: 5000 }); + if (error.errMsg == 'requestPayment:fail cancel') { + uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 }); + } reject(error) } }) diff --git a/manifest.json b/manifest.json index c0f8b75..c2e2a3d 100644 --- a/manifest.json +++ b/manifest.json @@ -75,6 +75,13 @@ } }, "ad" : {} + }, + "splashscreen" : { + "ios" : { + "iphone" : { + "portrait-896h@3x" : "/Users/piao/Downloads/意(1)/1242+2688.png" + } + } } } }, diff --git a/pages/order/Logistics/index.vue b/pages/order/Logistics/index.vue index 365889d..b6bf2ee 100644 --- a/pages/order/Logistics/index.vue +++ b/pages/order/Logistics/index.vue @@ -1,381 +1,397 @@ diff --git a/pages/order/OrderDetails/index.vue b/pages/order/OrderDetails/index.vue index 076459a..6eea309 100644 --- a/pages/order/OrderDetails/index.vue +++ b/pages/order/OrderDetails/index.vue @@ -542,8 +542,6 @@ export default { } }, goBack() { - const history = this.app.history, - last = history[history.length - 1] || {}; if (last.name === "MyOrder") return this.$yrouter.back(); else return this.$yrouter.replace({ diff --git a/pages/order/OrderSubmission/index.vue b/pages/order/OrderSubmission/index.vue index b151b14..41223ae 100644 --- a/pages/order/OrderSubmission/index.vue +++ b/pages/order/OrderSubmission/index.vue @@ -90,8 +90,8 @@ - 备注信息 - + 备注信息(150字以内) + diff --git a/pages/shop/ShoppingCart/index.vue b/pages/shop/ShoppingCart/index.vue index 970cd91..ac593a1 100644 --- a/pages/shop/ShoppingCart/index.vue +++ b/pages/shop/ShoppingCart/index.vue @@ -1,110 +1,135 @@ diff --git a/pages/user/signIn/Sign/index.vue b/pages/user/signIn/Sign/index.vue index 4907ca6..bcc879e 100644 --- a/pages/user/signIn/Sign/index.vue +++ b/pages/user/signIn/Sign/index.vue @@ -101,6 +101,7 @@ }; }, mounted: function() { + uni.showLoading({ title: "加载中", mask: true }); this.signUser(); this.signConfig(); this.getSignList(); @@ -129,6 +130,7 @@ postSignUser({ sign: 1 }).then(res => { + uni.hideLoading(); res.data.integral = parseInt(res.data.integral); var sumSginDay = res.data.sumSignDay; that.userInfo = res.data; @@ -180,4 +182,4 @@ } } }; - + diff --git a/utils/index.js b/utils/index.js index 547afb9..4c75202 100644 --- a/utils/index.js +++ b/utils/index.js @@ -113,16 +113,18 @@ export const copyClipboard = (data) => { export const replaceLogin = (msg) => { uni.hideLoading(); uni.showToast({ - title: msg, + title: '重新登录中...', icon: 'none', duration: 2000 }); // 这里代表已经失去登录状态以及401强制推出登录了 store.commit('LOGOUT') + console.log('如果是微信小程序,跳转到授权页', Vue.prototype.$deviceType, msg) if (Vue.prototype.$deviceType == 'routine') { // 如果是微信小程序,跳转到授权页 login({ fail: () => { + console.log('如果是微信小程序,跳转到授权页') replace({ path: '/pages/authorization/index', query: { @@ -174,6 +176,10 @@ export const authorize = (authorizeStr) => { resolve('获取授权成功') }, fail() { + switchTab({ + path: '/pages/home/index', + // query + }); reject('获取授权失败') } }) @@ -250,13 +256,14 @@ export const login = (option) => { export const handleGetUserInfo = () => { getUser().then(res => { + console.log('获取用户信息') store.dispatch('setUserInfo', res.data) var pages = getCurrentPages() //获取加载的页面 var currentPage = pages[pages.length - 1] //获取当前页面的对象 let url = "/pages/home/index" let query = {} - + console.log('currentPage') if (currentPage) { // 获取到最后一个页面 if ( @@ -276,16 +283,21 @@ export const handleGetUserInfo = () => { } } } + console.log(url) if (url == '/pages/home/index' || url == '/pages/shop/GoodsClass/index' || url == '/pages/shop/ShoppingCart/index' || url == '/pages/user/User/index') { switchTab({ path: `${url}`, query }); } else { - push({ - path: `${url}`, - query - }) + switchTab({ + path: '/pages/home/index', + // query + }); + // push({ + // path: `${url}`, + // query + // }) } }) } diff --git a/utils/request.js b/utils/request.js index 135aa21..78f837e 100644 --- a/utils/request.js +++ b/utils/request.js @@ -10,10 +10,12 @@ fly.config.baseURL = VUE_APP_API_URL fly.interceptors.response.use( response => { + console.log(response) // 定时刷新access-token return response; }, error => { + console.log(error) if (error.toString() == 'Error: Network Error') { toLogin(); return Promise.reject({ msg: "未登录", toLogin: true }); @@ -47,18 +49,15 @@ function baseRequest(options) { // 提示错误信息 return Promise.reject({ msg: "未登录", toLogin: true }); } -console.log(options) // 结构请求需要的参数 const { url, params, data, login, ...option } = options // 发起请求 return fly.request(url, params || data, { ...option - }).then(res => { - console.log(res) + }).then(res => { const data = res.data || {}; if (res.status !== 200) { - return Promise.reject({ msg: "请求失败", res, data }); } if ([410000, 410001, 410002].indexOf(data.status) !== -1) {