From bd5e8f1aea9dcff3b6e1e3680dd1e67b1c48e95c Mon Sep 17 00:00:00 2001 From: stivepeim Date: Fri, 19 Mar 2021 18:26:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=85=E5=AE=B9=20=091.=20?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=AD=89=E7=BA=A7=E8=83=8C=E6=99=AF=E5=9B=BE?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=A0=A1=E9=AA=8C=20=092.=20=E5=BD=93?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=8D=E5=88=B0=E4=BC=9A=E5=91=98=E7=AD=89?= =?UTF-8?q?=E7=BA=A7=E6=98=AF=EF=BC=8C=E6=8C=89=E6=97=A0=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E7=AD=89=E7=BA=A7=E5=B1=95=E7=A4=BA=20=093.=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=95=86=E5=9F=8E=E9=A6=96=E9=A1=B5=E5=86=97=E4=BD=99?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=9C=A8index=E4=B8=AD=E7=9A=84=E5=BC=95?= =?UTF-8?q?=E7=94=A8=20=094.=20=E6=8D=A2=E7=BB=91=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E4=BA=BA=E6=97=B6=EF=BC=8C=E8=AE=A1=E7=AE=97=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=8E=A8=E5=B9=BF=E4=BA=BA=E7=9A=84=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=20=095.=20pc=E5=90=8E=E5=8F=B0=E6=B8=85?= =?UTF-8?q?=E9=99=A4=E6=8E=A8=E5=B9=BF=E4=BA=BA=E6=97=B6=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=8E=A8=E5=B9=BF=E4=BA=BA=E6=95=B0=E9=87=8F=20=096.?= =?UTF-8?q?=20=E4=BF=9D=E8=AF=81=E7=A0=8D=E4=BB=B7=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E4=B8=BA0.01=20=097.=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=A0=E9=99=A4=E6=97=B6=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6=E5=85=B3=E8=81=94=E5=88=A0=E9=99=A4=20=098.=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=95=86=E5=93=81=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20=099.=20=E8=BF=90=E8=B4=B9=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E2=80=94=E2=80=94=E6=8C=87=E5=AE=9A=E5=8C=85=E9=82=AE=EF=BC=8C?= =?UTF-8?q?=E5=8C=85=E9=82=AE=E6=95=B0=E9=87=8F=E7=B1=BB=E5=9E=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=0910.=20=E7=AD=BE=E5=88=B0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=0911.=20=E4=BF=AE=E5=A4=8D=E6=88=91?= =?UTF-8?q?=E7=9A=84=E4=BC=98=E6=83=A0=E5=88=B8=E5=8F=AA=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?20=E6=9D=A1=E7=9A=84=E9=97=AE=E9=A2=98=20=0912.=20=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E5=88=97=E8=A1=A8=E4=BF=AE=E5=A4=8D=20=0913.=20?= =?UTF-8?q?=E6=8B=BC=E5=9B=A2=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D=20=0914.=20PC=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=EF=BC=8C=E8=B4=A6=E6=88=B7=E8=AF=A6=E6=83=85=EF=BC=8C=E6=8C=81?= =?UTF-8?q?=E6=9C=89=E4=BC=98=E6=83=A0=E5=88=B8=E5=88=97=E8=A1=A8=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20=0915.=20=E6=94=AF=E4=BB=98=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=BF=AE=E5=A4=8D=20=0916.=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=BF=87=E6=9C=9F=E4=BC=98=E6=83=A0=E5=88=B8=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E9=87=8D=E5=A4=8D=E9=A2=86=E5=8F=96=20=0917.=20?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=82=AE=E8=B4=B9=E5=88=87=E6=8D=A2=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E9=87=8D=E5=A4=8D=E8=AE=A1=E7=AE=97=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20=0918.=20=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=9C=A8?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E5=8C=85=E9=82=AE=E5=8C=BA=E5=9F=9F=E5=86=85?= =?UTF-8?q?=20=E5=BF=85=E9=A1=BB=E6=BB=A1=E8=B6=B3=E4=BB=B6=E6=95=B0=20+?= =?UTF-8?q?=20=E9=87=91=E9=A2=9D=20=E6=89=8D=E8=83=BD=E5=8C=85=E9=82=AE=20?= =?UTF-8?q?=0919.=20=E6=94=AF=E4=BB=98=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=88=87?= =?UTF-8?q?=E6=8D=A2tab=EF=BC=8C=E9=87=91=E9=A2=9D=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=20=0920.=20=E7=89=A9?= =?UTF-8?q?=E6=B5=81=E6=A8=A1=E6=9D=BF=E6=96=B0=E5=A2=9E=E3=80=81=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E2=80=94=E2=80=94=E4=BF=AE=E5=A4=8D=20=0921.=20?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E7=BA=BF=E4=B8=8B=E9=82=AE=E8=B4=B9=E7=9A=84?= =?UTF-8?q?=E5=BD=B1=E5=93=8D=20=0922.=20=E8=AE=A2=E5=8D=95=E8=BF=90?= =?UTF-8?q?=E8=B4=B9=E8=AE=A1=E7=AE=97=E9=87=8D=E5=86=99=20=0923.=20?= =?UTF-8?q?=E4=B8=8B=E5=8D=95=E9=A1=B5=E9=9D=A2=E5=88=B0=E5=BA=97=E8=87=AA?= =?UTF-8?q?=E6=8F=90=E5=90=88=E8=AE=A1=E9=87=91=E9=A2=9D=E4=B8=8D=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E8=AE=A1=E7=AE=97=E5=95=86=E5=93=81=E9=82=AE=E8=B4=B9?= =?UTF-8?q?=20=0924.=20=E6=96=B0=E4=BA=BA=E5=88=B8=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E9=83=A8=E5=88=86=E4=BD=BF=E7=94=A8=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=B8=BA=E7=A9=BA=E2=80=94=E2=80=94=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 24 + .hbuilderx/launch.json | 11 + App.vue | 108 +- api/api.js | 12 +- api/public.js | 26 +- api/user.js | 2 +- components/Authorize.vue | 2 +- components/countDown/index.vue | 30 +- components/couponListWindow/index.vue | 2 +- components/couponWindow/index.vue | 2 +- components/login_mobile/index.vue | 239 ++ components/login_mobile/routine_phone.vue | 163 + components/tabNav.vue | 2 +- libs/login.js | 66 +- libs/routine.js | 20 +- libs/wechat.js | 85 +- main.js | 2 +- pages.json | 7 + pages/activity/goods_bargain/index.vue | 21 +- .../activity/goods_bargain_details/index.vue | 119 +- .../goods_combination_details/index.vue | 186 +- .../goods_combination_status/index.vue | 63 +- pages/activity/goods_seckill/index.vue | 17 +- .../activity/goods_seckill_details/index.vue | 43 +- pages/auth/index.vue | 1 - pages/goods_cate/goods_cate.vue | 11 +- pages/goods_details/index.vue | 73 +- pages/goods_list/index.vue | 35 +- pages/index/components/a_seckill.vue | 78 +- pages/index/components/b_combination.vue | 50 +- pages/index/components/c_bargain.vue | 90 +- pages/index/index.vue | 3628 ++++++++--------- pages/order_addcart/order_addcart.vue | 45 +- pages/order_addcart/order_addcart01.vue | 804 ---- pages/order_addcart/order_addcart11.vue | 1083 ----- pages/order_details/index.vue | 14 +- pages/order_pay_status/index.vue | 18 +- pages/user/index.vue | 81 +- pages/users/commission_rank/index.vue | 19 +- pages/users/goods_comment_con/index.vue | 18 +- pages/users/goods_comment_list/index.vue | 4 +- pages/users/goods_details_store/index.vue | 2 +- pages/users/goods_logistics/index.vue | 63 +- pages/users/goods_return/index.vue | 19 +- pages/users/login/index.vue | 407 +- pages/users/login/index2.vue | 372 -- pages/users/order_confirm/index.vue | 19 +- pages/users/order_list/index.vue | 8 +- pages/users/promoter-list/index.vue | 8 +- pages/users/promoter-order/index.vue | 8 +- pages/users/promoter_rank/index.vue | 24 +- pages/users/static/home.png | Bin 0 -> 4361 bytes pages/users/static/left.png | Bin 0 -> 2419 bytes pages/users/static/wechat_login.png | Bin 0 -> 17435 bytes pages/users/user_address/index.vue | 19 +- pages/users/user_address/index001.vue | 537 --- pages/users/user_address_list/index.vue | 18 +- pages/users/user_bill/index.vue | 11 +- pages/users/user_cash/index.vue | 19 +- pages/users/user_coupon/index.vue | 22 +- pages/users/user_get_coupon/index.vue | 24 +- pages/users/user_goods_collection/index.vue | 11 +- pages/users/user_info/index.vue | 30 +- pages/users/user_integral/index.vue | 19 +- pages/users/user_money/index.vue | 21 +- pages/users/user_payment/index.vue | 20 +- pages/users/user_phone/index.vue | 128 +- pages/users/user_pwd_edit/index.vue | 18 +- pages/users/user_return_list/index.vue | 18 +- pages/users/user_sgin/index.vue | 23 +- pages/users/user_sgin_list/index.vue | 18 +- pages/users/user_spread_code/index.vue | 18 +- pages/users/user_spread_money/index.vue | 10 +- pages/users/user_spread_user/index.vue | 41 +- pages/users/user_vip/index.vue | 6 +- pages/users/user_vip/index01.vue | 480 --- pages/users/wechat_login/index.vue | 269 +- static/css/style.scss | 5 +- static/images/barg002.png | Bin 25191 -> 24804 bytes static/images/bargainBg.jpg | Bin 32457 -> 29248 bytes static/images/canbj.png | Bin 28524 -> 7956 bytes static/images/empty-box.png | Bin 26170 -> 9763 bytes static/images/kjbj.png | Bin 0 -> 1526 bytes static/images/logo2.png | Bin 24056 -> 9996 bytes static/images/noAddress.png | Bin 23548 -> 9383 bytes static/images/noCart.png | Bin 11158 -> 10565 bytes static/images/noCoupon.png | Bin 25213 -> 10641 bytes static/images/noNews.png | Bin 20651 -> 9215 bytes static/images/noOrder.png | Bin 20212 -> 8773 bytes static/images/noSearch.png | Bin 13251 -> 12334 bytes static/images/noShopper.png | Bin 11049 -> 10333 bytes static/images/posterbackgd.png | Bin 20310 -> 10139 bytes static/images/pth.png | Bin 0 -> 3891 bytes static/images/score.png | Bin 13325 -> 5124 bytes static/images/seckillTitle.png | Bin 2709 -> 3306 bytes static/images/sign02.png | Bin 1505 -> 0 bytes static/images/spike-icon-001.png | Bin 2621 -> 0 bytes static/images/spike-icon-002.gif | Bin 9851 -> 0 bytes static/images/user_bg.png | Bin 19407 -> 17106 bytes static/images/value.jpg | Bin 22382 -> 19770 bytes static/images/writeOff.jpg | Bin 10429 -> 5260 bytes static/images/xsms.png | Bin 0 -> 13007 bytes store/getters.js | 13 +- store/modules/app.js | 7 +- utils/index.js | 85 +- utils/util.js | 19 +- utils/validate.js | 24 +- 107 files changed, 4181 insertions(+), 5986 deletions(-) create mode 100644 .gitignore create mode 100644 .hbuilderx/launch.json create mode 100644 components/login_mobile/index.vue create mode 100644 components/login_mobile/routine_phone.vue delete mode 100644 pages/order_addcart/order_addcart01.vue delete mode 100644 pages/order_addcart/order_addcart11.vue delete mode 100644 pages/users/login/index2.vue create mode 100644 pages/users/static/home.png create mode 100644 pages/users/static/left.png create mode 100644 pages/users/static/wechat_login.png delete mode 100644 pages/users/user_address/index001.vue delete mode 100644 pages/users/user_vip/index01.vue create mode 100644 static/images/kjbj.png create mode 100644 static/images/pth.png delete mode 100644 static/images/sign02.png delete mode 100644 static/images/spike-icon-001.png delete mode 100644 static/images/spike-icon-002.gif create mode 100644 static/images/xsms.png diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..95cfff78 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.DS_Store +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +build.sh +.idea +unpackage \ No newline at end of file diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json new file mode 100644 index 00000000..501e01c8 --- /dev/null +++ b/.hbuilderx/launch.json @@ -0,0 +1,11 @@ +{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 + "version": "0.0", + "configurations": [{ + "type": "uniCloud", + "default": { + "launchtype": "remote" + } + } + ] +} diff --git a/App.vue b/App.vue index bd076f53..8497b2a6 100644 --- a/App.vue +++ b/App.vue @@ -1,13 +1,8 @@ - diff --git a/components/couponListWindow/index.vue b/components/couponListWindow/index.vue index 0d7d3792..a7fa2cf7 100644 --- a/components/couponListWindow/index.vue +++ b/components/couponListWindow/index.vue @@ -5,7 +5,7 @@ - {{item.money}} + {{item.money?Number(item.money):''}} 满{{item.minPrice}}元可用 diff --git a/components/couponWindow/index.vue b/components/couponWindow/index.vue index b0428035..d30efa09 100644 --- a/components/couponWindow/index.vue +++ b/components/couponWindow/index.vue @@ -3,7 +3,7 @@ - {{item.money}} + {{ item.money?Number(item.money):'' }} 购物买{{item.minPrice}}减{{item.money}} 领取后{{item.day}}天内可用 diff --git a/components/login_mobile/index.vue b/components/login_mobile/index.vue new file mode 100644 index 00000000..b78d26a6 --- /dev/null +++ b/components/login_mobile/index.vue @@ -0,0 +1,239 @@ + + + + + diff --git a/components/login_mobile/routine_phone.vue b/components/login_mobile/routine_phone.vue new file mode 100644 index 00000000..4d5b8800 --- /dev/null +++ b/components/login_mobile/routine_phone.vue @@ -0,0 +1,163 @@ + + + + diff --git a/components/tabNav.vue b/components/tabNav.vue index 6ba2d8e2..0518488d 100644 --- a/components/tabNav.vue +++ b/components/tabNav.vue @@ -83,7 +83,7 @@ index:index } this.parentEmit(obj) - // this.$parent.currentTab = index //设置swiper的第几页 + this.$parent.currentTab = index //设置swiper的第几页 }, // 导航子类点击 childTab(tabClick,index){ diff --git a/libs/login.js b/libs/login.js index 0a47d335..3979b9a6 100644 --- a/libs/login.js +++ b/libs/login.js @@ -1,5 +1,6 @@ import store from "../store"; import Cache from '../utils/cache'; +import { Debounce } from '@/utils/validate.js' // #ifdef H5 || APP-PLUS import { isWeixin } from "../utils"; import auth from './wechat'; @@ -10,31 +11,74 @@ import { LOGIN_STATUS, USER_INFO, EXPIRES_TIME, STATE_R_KEY} from './../config/c function prePage(){ let pages = getCurrentPages(); let prePage = pages[pages.length - 1]; + // #ifndef APP-PLUS return prePage.route; + // #endif + // #ifdef APP-PLUS + return prePage.$page.fullPath; + // #endif } -export function toLogin(push, pathLogin) { +export const toLogin = Debounce(_toLogin,800) + +export function _toLogin(push, pathLogin) { store.commit("LOGOUT"); let path = prePage(); // #ifdef H5 - path = location.href; + // path = location.href; + path = location.pathname + location.search; // #endif if(!pathLogin) pathLogin = '/page/users/login/index' Cache.set('login_back_url',path); - // #ifdef H5 || APP-PLUS + // #ifdef H5 if (isWeixin()) { - auth.oAuth(); - } else { - if (path !== pathLogin) { - push ? uni.navigateTo({ - url:'/pages/users/login/index' - }) : uni.reLaunch({ - url: '/pages/users/login/index' - }); + // auth.oAuth(); + let urlData = location.pathname + location.search + if (urlData.indexOf('?') !== -1) { + urlData += '&go_longin=1'; + } else { + urlData += '?go_longin=1'; } + console.log('ppppp',Cache.has('snsapiKey')) + if (Cache.has('snsapiKey')) { + uni.navigateTo({ + url: '/pages/users/wechat_login/index', + }); + } + // if (!Cache.has('snsapiKey')) { + + // auth.oAuth('snsapi_base', urlData); + // } else { + // uni.navigateTo({ + // url: '/pages/users/wechat_login/index', + // }); + // } + } else { + uni.navigateTo({ + url: '/pages/users/login/index' + }) + // if (path !== pathLogin) { + // push ? uni.navigateTo({ + // url:'/pages/users/login/index' + // }) : uni.reLaunch({ + // url: '/pages/users/login/index' + // }); + // } } // #endif + + // #ifdef MP + uni.navigateTo({ + url: '/pages/users/wechat_login/index' + }) + // #endif + + // #ifdef APP-PLUS + uni.navigateTo({ + url: '/pages/users/login/index' + }) + // #endif } diff --git a/libs/routine.js b/libs/routine.js index 6845f375..17a1b36a 100644 --- a/libs/routine.js +++ b/libs/routine.js @@ -3,7 +3,6 @@ import { checkLogin } from './login'; import { login } from '../api/public'; import Cache from '../utils/cache'; import { STATE_R_KEY, USER_INFO, EXPIRES_TIME, LOGIN_STATUS} from './../config/cache'; - class Routine { @@ -65,9 +64,6 @@ class Routine async getCode(){ let provider = await this.getProvider(); return new Promise((resolve,reject)=>{ - if(Cache.has(STATE_R_KEY)){ - return resolve(Cache.get(STATE_R_KEY)); - } uni.login({ provider:provider, success(res) { @@ -122,14 +118,18 @@ class Routine authUserInfo(code,data) { + console.log('code:',code); + console.log('data:',data); return new Promise((resolve, reject)=>{ login(code,data).then(res=>{ - // let time = res.data.expiresTime - Cache.time(); - store.commit('UPDATE_USERINFO', res.data.user); - store.commit('LOGIN', {token:res.data.token}); - store.commit('SETUID', res.data.user.uid); - // Cache.set(EXPIRES_TIME,res.data.expiresTime,time); - Cache.set(USER_INFO,res.data.user); + if(res.data.type==='login'){ + // let time = res.data.expiresTime - Cache.time(); + store.commit('UPDATE_USERINFO', res.data.user); + store.commit('LOGIN', {token:res.data.token}); + store.commit('SETUID', res.data.user.uid); + // Cache.set(EXPIRES_TIME,res.data.expiresTime,time); + Cache.set(USER_INFO,res.data.user); + } return resolve(res); }).catch(res=>{ return reject(res); diff --git a/libs/wechat.js b/libs/wechat.js index 6f31182c..9c802d11 100644 --- a/libs/wechat.js +++ b/libs/wechat.js @@ -153,12 +153,37 @@ class AuthWechat { /** * 自动去授权 */ - oAuth() { - if (uni.getStorageSync(WX_AUTH) && store.state.app.token) return; + oAuth(snsapiBase,url) { + if (uni.getStorageSync(WX_AUTH) && store.state.app.token && snsapiBase == 'snsapi_base') return; const { code } = parseQuery(); - if (!code) return this.toAuth(); + if (!code || code == uni.getStorageSync('snsapiCode')){ + return this.toAuth(snsapiBase,url); + }else{ + if(Cache.has('snsapiKey')) + return this.auth(code).catch(error=>{ + uni.showToast({ + title:error, + icon:'none' + }) + }) + } + // if (uni.getStorageSync(WX_AUTH) && store.state.app.token) return; + // const { + // code + // } = parseQuery(); + // if (!code){ + // return this.toAuth(snsapiBase,url); + // }else{ + // if(Cache.has('snsapiKey')) + // return this.auth(code).catch(error=>{ + // uni.showToast({ + // title:error, + // icon:'none' + // }) + // }) + // } } clearAuthStatus() { @@ -188,7 +213,7 @@ class AuthWechat { Cache.clear(STATE_KEY); // Cache.clear('spread'); loginType && Cache.clear(LOGINTYPE); - resolve(); + resolve(data); }) .catch(reject); }); @@ -198,32 +223,42 @@ class AuthWechat { * 获取跳转授权后的地址 * @param {Object} appId */ - getAuthUrl(appId) { - const redirect_uri = encodeURIComponent( - `${location.origin}/pages/auth/index?back_url=` + - encodeURIComponent( - encodeURIComponent( - uni.getStorageSync(BACK_URL) ? - uni.getStorageSync(BACK_URL) : - location.pathname + location.search - ) - ) - ); - uni.removeStorageSync(BACK_URL); - const state = encodeURIComponent( - ("" + Math.random()).split(".")[1] + "authorizestate" - ); - uni.setStorageSync(STATE_KEY, state); - return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`; - } - + getAuthUrl(appId,snsapiBase,backUrl) { + let url = `${location.origin}${backUrl}` + if(url.indexOf('?') == -1){ + url = url+'?' + }else{ + url = url+'&' + } + const redirect_uri = encodeURIComponent( + `${url}scope=${snsapiBase}&back_url=` + + encodeURIComponent( + encodeURIComponent( + uni.getStorageSync(BACK_URL) ? + uni.getStorageSync(BACK_URL) : + location.pathname + location.search + ) + ) + ); + uni.removeStorageSync(BACK_URL); + const state = encodeURIComponent( + ("" + Math.random()).split(".")[1] + "authorizestate" + ); + uni.setStorageSync(STATE_KEY, state); + if(snsapiBase==='snsapi_base'){ + return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=${state}#wechat_redirect`; + }else{ + return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`; + } + } + /** * 跳转自动登录 */ - toAuth() { + toAuth(snsapiBase,backUrl) { let that = this; this.wechat().then(wx => { - location.href = this.getAuthUrl(that.initConfig.appId); + location.href = this.getAuthUrl(that.initConfig.appId,snsapiBase,backUrl); }) } diff --git a/main.js b/main.js index 9ba62985..3b64b321 100644 --- a/main.js +++ b/main.js @@ -46,7 +46,7 @@ if (vconsole !== undefined && vconsole === md5Crmeb) { let vConsole = new VConsole(); } -Auth.isWeixin() && Auth.oAuth(); +// Auth.isWeixin() && Auth.oAuth(); // #endif diff --git a/pages.json b/pages.json index 5efad8e9..6a65473b 100644 --- a/pages.json +++ b/pages.json @@ -360,6 +360,13 @@ "style": { "navigationBarTitleText": "商品评价" } + }, + { + "path": "wechat_login/index", + "style": { + "navigationBarTitleText": "账户登录", + "navigationStyle": "custom" + } } ] }, diff --git a/pages/activity/goods_bargain/index.vue b/pages/activity/goods_bargain/index.vue index 4fe12efb..3bb8071a 100644 --- a/pages/activity/goods_bargain/index.vue +++ b/pages/activity/goods_bargain/index.vue @@ -1,7 +1,9 @@ - + + + + + diff --git a/pages/order_addcart/order_addcart.vue b/pages/order_addcart/order_addcart.vue index 5e956dfe..1fa71c85 100644 --- a/pages/order_addcart/order_addcart.vue +++ b/pages/order_addcart/order_addcart.vue @@ -113,13 +113,19 @@ - + - - diff --git a/pages/order_addcart/order_addcart11.vue b/pages/order_addcart/order_addcart11.vue deleted file mode 100644 index 09974a7f..00000000 --- a/pages/order_addcart/order_addcart11.vue +++ /dev/null @@ -1,1083 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/order_details/index.vue b/pages/order_details/index.vue index 5ecf3040..8bf99718 100644 --- a/pages/order_details/index.vue +++ b/pages/order_details/index.vue @@ -226,7 +226,7 @@ - + @@ -658,7 +658,8 @@ isAuto: false, //没有授权的不会自动授权 isShowAuth: false, //是否隐藏授权 id: 0, //订单id - uniId: '' + uniId: '', + utils: this.$util, }; }, computed: mapGetters(['isLogin', 'chatUrl']), @@ -676,13 +677,7 @@ this.getOrderInfo(); this.getUserInfo(); } else { - // #ifdef H5 || APP-PLUS toLogin(); - // #endif - // #ifdef MP - this.isAuto = true; - this.$set(this, 'isShowAuth', true); - // #endif } }, onHide: function() { @@ -835,7 +830,6 @@ newCartInfo.push(item.info); }); that.$set(that, 'cartInfo', newCartInfo); - console.log(that.cartInfo) if (res.data.refundStatus != 0) { that.isGoodsReturn = true; }; @@ -961,7 +955,7 @@ */ delOrder: function() { let that = this; - orderDel(this.order_id).then(res => { + orderDel(this.id).then(res => { return that.$util.Tips({ title: '删除成功', icon: 'success' diff --git a/pages/order_pay_status/index.vue b/pages/order_pay_status/index.vue index 116c094c..a142d0d0 100644 --- a/pages/order_pay_status/index.vue +++ b/pages/order_pay_status/index.vue @@ -47,7 +47,7 @@ - + @@ -88,6 +88,16 @@ }; }, computed: mapGetters(['isLogin']), + watch:{ + isLogin:{ + handler:function(newV,oldV){ + if(newV){ + this.getOrderPayInfo(); + } + }, + deep:true + } + }, onLoad: function(options) { if (!options.order_id) return this.$util.Tips({ title: '缺少参数无法查看订单支付状态' @@ -101,13 +111,7 @@ if (this.isLogin) { this.getOrderPayInfo(); } else { - // #ifdef H5 || APP-PLUS toLogin(); - // #endif - // #ifdef MP - this.isAuto = true; - this.$set(this, 'isShowAuth', true); - // #endif } }, methods: { diff --git a/pages/user/index.vue b/pages/user/index.vue index c020ea17..98c4b77f 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -12,6 +12,11 @@ 请点击授权 + + + 请点击授权 + + {{userInfo.nickname}} @@ -20,7 +25,7 @@ - ID:{{userInfo.uid}} + {{userInfo.phone}} @@ -71,9 +76,7 @@ indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff"> - - - + @@ -92,7 +95,7 @@ - + 联系客服 @@ -101,7 +104,7 @@