From 711ec54f97443534608e6a174ba35412683dc408 Mon Sep 17 00:00:00 2001 From: 406803045 <406803045@qq.com> Date: Sat, 15 Jun 2019 12:54:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- .env.production | 7 +- .env.staging | 9 +- src/api/coupon.js | 15 --- src/api/user.js | 73 ++--------- src/assets/css/index.scss | 54 +------- src/assets/images/account/s-conpon@2x.png | Bin 311 -> 0 bytes .../images/account/s-ticket-qrcode@2x.png | Bin 246 -> 0 bytes src/assets/images/account/s-ticket@2x.png | Bin 213 -> 0 bytes src/assets/images/arrow-left.png | Bin 838 -> 0 bytes .../images/coupon/s-coupon-detail-down@2x.png | Bin 389 -> 0 bytes .../images/coupon/s-coupon-detail-up@2x.png | Bin 378 -> 0 bytes .../images/coupon/s-coupon-empty@2x.png | Bin 2414 -> 0 bytes src/assets/images/coupon/s-coupon-item@2x.png | Bin 5782 -> 0 bytes src/config/env.development.js | 13 +- src/config/env.production.js | 13 +- src/config/env.staging.js | 11 +- src/filters/filter.js | 45 +------ src/filters/index.js | 6 - src/main.js | 3 +- src/permission.js | 19 +-- src/router/index.js | 23 +--- src/store/modules/user.js | 31 ++--- src/utils/cache.js | 40 ++---- src/utils/get-page-title.js | 2 +- src/utils/package.js | 124 ------------------ src/utils/request.js | 3 +- vue.config.js | 12 +- 28 files changed, 79 insertions(+), 428 deletions(-) delete mode 100644 src/api/coupon.js delete mode 100644 src/assets/images/account/s-conpon@2x.png delete mode 100644 src/assets/images/account/s-ticket-qrcode@2x.png delete mode 100644 src/assets/images/account/s-ticket@2x.png delete mode 100644 src/assets/images/arrow-left.png delete mode 100644 src/assets/images/coupon/s-coupon-detail-down@2x.png delete mode 100644 src/assets/images/coupon/s-coupon-detail-up@2x.png delete mode 100644 src/assets/images/coupon/s-coupon-empty@2x.png delete mode 100644 src/assets/images/coupon/s-coupon-item@2x.png delete mode 100644 src/utils/package.js diff --git a/.env.development b/.env.development index 887ece9..8739bbb 100644 --- a/.env.development +++ b/.env.development @@ -4,7 +4,5 @@ VUE_APP_ENV = 'development' #base url BASE_URL = 'https://www.xxx.com/' #appid -VUE_APP_WECHAT_APPID='wxc6086549532e9a60' -# base api -VUE_APP_BASE_API = '/dev-api' +VUE_APP_WECHAT_APPID='12345678' VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/.env.production b/.env.production index 5a83263..331fdd1 100644 --- a/.env.production +++ b/.env.production @@ -2,9 +2,8 @@ NODE_ENV='production' # must start with VUE_APP_ VUE_APP_ENV = 'production' #base url -BASE_URL = https://www.top1buyer.com/ +BASE_URL = 'https://www.xxx.com/' #appid -VUE_APP_WECHAT_APPID='wx6bb2125514b4c1ff' -# base api -VUE_APP_BASE_API = '/prod-api' +VUE_APP_WECHAT_APPID='1234567890' + diff --git a/.env.staging b/.env.staging index 1d8a5fc..f57840b 100644 --- a/.env.staging +++ b/.env.staging @@ -2,10 +2,7 @@ NODE_ENV='production' # must start with VUE_APP_ VUE_APP_ENV = 'staging' #base url -BASE_URL = https://www.top1buyer.com/ +BASE_URL = 'https://www.xxx.com/' #appid - -VUE_APP_WECHAT_APPID='wx6bb2125514b4c1ff' -# base api -VUE_APP_BASE_API = '/stage-api' - +VUE_APP_WECHAT_APPID='12345678' + diff --git a/src/api/coupon.js b/src/api/coupon.js deleted file mode 100644 index 8d813ae..0000000 --- a/src/api/coupon.js +++ /dev/null @@ -1,15 +0,0 @@ -import qs from 'qs' -import request from '@/utils/request' -import { api } from '@/config' -// 签名 -import _bale from '@/utils/package' -// api - -// 查询我的优惠券 -export function getCouponList(params) { - return request({ - url: '/coupon/selectMyCoupon', - method: 'post', - data: qs.stringify(_bale('selectMyCoupon', params)) - }) -} diff --git a/src/api/user.js b/src/api/user.js index f4a41b8..abbf06b 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -1,25 +1,15 @@ import qs from 'qs' import request from '@/utils/request' -// 签名 -import _bale from '@/utils/package' -// api -// 登录 -export function login(params) { - return request({ - url: '/wechat/login.do', - method: 'post', - data: qs.stringify(_bale('login', params)) - }) -} + /** * 登录接口请求token与userinfo - * @param params + * @param params {code: code} */ export function loginByCode(params) { return request({ url: '/wechat/auth2', method: 'post', - data: qs.stringify(_bale('auth2', params)) + data: qs.stringify(params) }) } /** @@ -30,54 +20,19 @@ export function getUserInfo(params) { return request({ url: '/user/get_user', method: 'post', - data: qs.stringify(_bale('get_user', params)) + data: qs.stringify(params) }) } /** - * 公众号会员中心 - * @param params + * 默认请求url import { api } from '@/config' 的 base_api + /wechat/auth2 + * 请求common_api打头的参照如下示例: + * import { api } from '@/config' + * export function loginByCode(params) { + * return request({ + * url:api.common_api+ '/wechat/auth2', + * method: 'post', + * data: qs.stringify(params) + * }) + * } */ -export function getAccountInfo(params) { - return request({ - url: '/wechat/selectVipUserInfo', - method: 'post', - data: qs.stringify(_bale('selectVipUserInfo', params)) - }) -} - -/** - * 发送手机验证码 - * @param params - */ -export function sendCode(params) { - return request({ - url: '/wechat/send_phone_code', - method: 'post', - data: qs.stringify(_bale('send_phone_code', params)) - }) -} - -/** - * 微信公众号添加手机号 - * @param params - */ -export function bindPhoneNumber(params) { - return request({ - url: '/wechat/addPhoneNumber', - method: 'post', - data: qs.stringify(_bale('addPhoneNumber', params)) - }) -} - -/** - * 获取门禁二维码值 - * @param params - */ -export function getDoorKey(params) { - return request({ - url: '/user/getDoorKey', - method: 'post', - data: qs.stringify(_bale('getDoorKey', params)) - }) -} diff --git a/src/assets/css/index.scss b/src/assets/css/index.scss index de54bc7..20151ae 100644 --- a/src/assets/css/index.scss +++ b/src/assets/css/index.scss @@ -1,5 +1,6 @@ @import './variables.scss'; @import './mixin.scss'; + body, div, span, @@ -40,6 +41,7 @@ figcaption { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; + &:hover { outline: none; } @@ -115,54 +117,4 @@ div:focus { } // main-container global css -.app-container { -} -.van-hairline--top-bottom::after { - border-width: 0 !important; -} -.van-cell { - line-height: 30px !important; - .van-cell__title { - font-size: 15px; - color: #333333; - font-weight: 500; - } - .van-cell__left-icon, - .van-cell__right-icon { - line-height: 30px; - color: #999999; - } - &:not(:last-child)::after { - left: 0 !important; - } -} -//模态框 -.modal-popup { - width: 100%; - height: 100%; - max-width: 10rem; - min-width: 10rem; -} -.my-header { - position: relative; - width: 100%; - background: #fff; - border-bottom:1px solid #E9E9E9; - .back-icon { - position: absolute; - width: 44px; - height: 44px; - box-sizing: border-box; - background: url('../../assets/images/arrow-left.png') no-repeat center - center; - background-size: 70% 70%; - } - .header-title { - font-size: 17px; - font-weight: 600; - height: 44px; - line-height: 44px; - text-align: center; - - } -} +.app-container {} diff --git a/src/assets/images/account/s-conpon@2x.png b/src/assets/images/account/s-conpon@2x.png deleted file mode 100644 index ea475e24a9c4c918baf9b8ae622929d6c091d86b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 311 zcmeAS@N?(olHy`uVBq!ia0vp^IzTMP!VDyrN<5qbq!a^uLR{Sod}e~dtXZ>wG=zjO zAZ!`lU`3!}u96_XV1^fFU;2WiiVwDkO%BTeithGwaSYKopKNf9jYl#pk(t|5EKZ|? zZOMT{OgtG46FD9lu(gHwBz|k<%n4#lNHdD4V4Y!`y)oj^s-+2O;zt^V8+`m0bT0{8 z8^mA~x!@h!%tI<$vkU{0nI@d%5shQHw36dfn?%P_R#CRu93lI%6g>=`MJBzvav^ec zm@YrBbC51W;3lqB69u(m8nn*r<9e8xI^tf`_#9c)B5Hj^NU626 ohfP@AFVdQ&MBb@04$qt9smFU diff --git a/src/assets/images/account/s-ticket-qrcode@2x.png b/src/assets/images/account/s-ticket-qrcode@2x.png deleted file mode 100644 index 423d926f2dddc5d62a657bafecac114e7cde76e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 246 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDB3?!H8JlO)IBm#UwT-^(NGJzl?BP$~VNP?Ll zM)em3E1(+ok|4ie2EW5)cPx9}olANJ6l(KyaSX9Iot&T`JLPaAgL0EChf3F!DIp0$ zeqLU$3OHHW*wSXSFfub=elVfH%*?FGQ$t#MHcy|!5j{l?_7yos46_0md3e?cEWV)Q z&bgX#szaZ~)-78^)&zD7b+D*L#Ky!llyFXPn##}`P*qu}X|sBw9^+}YHC|p`%N8z7 hbjZ5Urni!TLHV+Ao>a%R2%w7?JYD@<);T3K0RV|zPg4K@ diff --git a/src/assets/images/account/s-ticket@2x.png b/src/assets/images/account/s-ticket@2x.png deleted file mode 100644 index d415c006d39859f35fe4eb3bdd3a7d3aac04fd7b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^IzX((!VDyR4O2pZlxToYh^u>n&x{!}W}+H+R5upK&Z$df0-fmdfvk6sR& zm|vkIbDl}rcEbx(4<7S4Ao4;unT>7Z78Ayl=Z4Fcsu~Fhh4HdBDexqkPVn`VIFzRF wFoi4h@rFqz<@~OR%1@Ro;}Lgb-y+J!5I*5Raa41p6wp!zPgg&ebxsLQ06*A)kmqaTg; z^(g&d>XP5_g_9*vys7_*n?T9)(>n?muHaYTXwr-Ec9e4RNV~Mtd}VO(|C@f{XWxE) z9UXhs_GIgijb0B9t&-{zR7lfja$qp@KCni{ibY^E%b8OPor&X4n8K3hU8VH0cS*gb z@hqQ9N$ob%za*Y`zj(=Vwa8^tE=rx?_I&St{?FPa*EKz7_*@b?v3a3!9?#9%Nnau^ z$xqe^K9#|`gu6%S7L$j$glqEXvvTep5(z_;NE>`(VoX*(CZ~|VVz9~a07p_vlaFDY$F9>0-`6bcDLx_N_LJ|=^Pf)*l(?AO zK4oh#6?tEp9%y@C#de8tl9S+s*^^E!-@1JM`$?zTTXjMiCv$lG+^iGX_~Ch*o1=pv z3!|!_>SAZVryFWi52Q3*&}>ui)|hiEJSnyO#HCN6+m6@N?_)~UpRm)9aj6l9hBm`8 z{+pYfBlh_?zL;X1(Dy>X>ZnMIUnFC3N_)&T%|G?;C;0IK6>EmyDl08~9<=!i6Jx65 z5;YDDV~wqj4l@^6G&C4F6*4j|{iK(jIr-w>ukC)an@ap1J~P(ln^JAxa@+Xr+z)L( zce@nEY&uqUcj1oaGjI2;d-^uffBhjbhh0vYtV^V)OmpBm^(E}_Q@IcN<~b5M?OWJ_ znq=Y6P`FMzRW1(Yfx#UaI(>DIkU>FgijR?lbCz`*gZ@RKKa<7!Y(zJZ$d`X$;XVI zd?r@13Kv->A7`EaN)vPFaUCa zG>|-h{ydNb0*LtO)29zyp1KC8i?1ZeFZe$L@2OW(GjFJzYm0CUk$I|-50v@i>Ealo zaenXRy?l(00_-0=bNp&d)GaNwoSHpc7T#O2<@N=kvs0z!x+!ISWT{~K$YQm&La92f zEHB)z{pGjm_3!f1o*(en{h?LDW2SM-^+TOYPe{m8b%jg#Fdap4T@ zgsby@CKTT*;P6}9d0Ov$$80_R&i4=Q_N-kNpfJzLFk(U4RZ*Kqaw)HbpQL)qca$2} z_N0e8o4c$zFVcUQfiwA!XxcQjzQlv;k65%C|7nysZczU~(x5LfZ#f%~ZSKGLmHC~( ziwUhI?7tsM{R#WEwDo29pG3t!3y#0uylwj0tRGL-J(G}^->Y9_9{1#Qe%+-1ABER^ Wa;=M&&h-I?1B0ilpUXO@geCxGsk2M~ diff --git a/src/assets/images/coupon/s-coupon-detail-up@2x.png b/src/assets/images/coupon/s-coupon-detail-up@2x.png deleted file mode 100644 index 7ac7e28bfdfd04e60e30555fef4f39f5c23dd84b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 378 zcmeAS@N?(olHy`uVBq!ia0vp^Iv~u#3?$#IayJ4}>H$6>uI>ds7cN{ld-m)ZFaR-=K49VKEyQpQQrl_PLGCJS`gDd`>?im}4Sd@CXI8 zaIbe1vt!*Z@TezQU@_lepTyQzZL>rfM8(=Hd>aHG`8comAk&c~#@_L1a==50j->BG z9iJ8lJhT-!YIW{%8felG3J|!1u zFYHo0<$qWF850&yJ{zLWw~vR7;bVhjmwzqa4`2u|c)I$ztaD0e F0sy|Qk@Wxo diff --git a/src/assets/images/coupon/s-coupon-empty@2x.png b/src/assets/images/coupon/s-coupon-empty@2x.png deleted file mode 100644 index fe74de1e09ba0d535126f6095ae85bb8f4b04cd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2414 zcma);`6CmI1ICve8CGsXIT~YfLNH*$$g6=UXqY2 z$1F$G8X?z^xfW@6q5yPFj)yzkb(dw-CSq9B|u zUsaG61Q<(C1hiQO2S>{fn=5jb{hl57eq`ZE1(O8n{{c#mn63l!!<5F3J_=f$IhOQ1 z`FTliC(c7%_77g}c7TFBd|yp(f7^Zr$?a`)=d-vki3wYO~k;Mo%MS;lEowMTUqK2v6;MOu^ zoP@uyk0NsjW{@;w!k|*m-U1b&Ts(U6aI>6_zihc3evogWSt<_#+#Y}iTgMfRyVgmD z&MX7^B}%~SYse|(-0fpajI8O0u>~sR%WgkDNw_>Pl^fY1NeJo?lvBqYyNn&%xEh6` zCyy!Q>uPCW;;{JBG*#*T4b$4&e+MDKZkNI`B8DI@`l$YiS;Ays2L(wd7DkdcV3Ims z8<|h6`6~i$Zb2G?K7T(yKueR?bVSnVc`?_>>KYza`fvY^uWm4O8ipb8;7wM#=v!i* z6RkWs@0Y((qHXXU6C<8YCLiQo4yCfC47FU;V_d{trCQZM1vAcvGm40jxp^OE zF=PHTb?s8;%VOVNN>i6po}7S0_h&*bM)Db0`b`?}jOG~AsFww54~uB3Mzl|^yjQl3 zotLYUP!uoWKl}~Hfmw!XP5H_}Z5ZLqCf#BwW1(;(9F(9>8?9oOmFaO;M&mr^aK#vM z`W!6f+%6V>EMSXwND{s-Te24{uAEZ~TN1l$KFYulSg@79xoJB8 z{NAvA1cyiIWl_ma^$*p+sDxv0ZhP9Vv&E3T-v z=jg+j?%|rhKSsXE7okU;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xS3*K3)QWeCF_hz5azgv38p*-|te|IqJ;V!3~zFY0X#?+=t(II68 zYGV5xZQ{-+5d;;#wpwDcyw&F>TJ1fmUcIQjWoYbX1L)J2X7$yt3HMmZyxq<=AclMT zlowCr{L>e1teadtfkNoKXbrZimO(iou$ByLo~hf=c3g^)<7Gk+N<`MKj5@%h&Tv** zTp)bNaQw>bUp4wQkNnCd&*aVa%#6GWB9ZaXc8g6)r1*BVKgV{iNYsR$0P*6lrnQvP z?SGx^Dsc6r*fC67x;M@c=nGEzMSb)MrQ0{(Fs=?HuiMKiFiH(|9wB&DtYiTKHDmhn z+UB7IFUJl8K8KUnMRVhC{ps`j59Rke U7$Xqpw*UYD07*qoM6N<$f`M#L?EnA( diff --git a/src/config/env.development.js b/src/config/env.development.js index f53ebf8..5937d0e 100644 --- a/src/config/env.development.js +++ b/src/config/env.development.js @@ -1,12 +1,9 @@ // 本地 module.exports = { - title: '蚁小宝', - baseUrl:'http://localhost:9018', + title: '微信网页授权demo', + baseUrl: 'http://localhost:9018', api: { - base_api: 'https://test.top1buyer.com/wx', - common_api: 'https://test.top1buyer.com/wx' - }, - // package appid,appSecret - APPID: 'Pc690487e95992c395633866b', - APPSECRET: '01d552de9b864547b7e67d44568caeb9' + base_api: 'https://www.xxx.com/', + common_api: 'https://www.xxx.com/common' + } } diff --git a/src/config/env.production.js b/src/config/env.production.js index 794d45e..1f66bd7 100644 --- a/src/config/env.production.js +++ b/src/config/env.production.js @@ -1,12 +1,9 @@ // 正式 module.exports = { - title: '蚁小宝', - baseUrl:'http://localhost:9018', + title: '微信网页授权demo', + baseUrl: 'http://localhost:9018', api: { - base_api: 'https://xxx.xxx.com/admin', - common_api: 'https://xxx.xxx.com/common' - }, - // package appid,appSecret - APPID: 'Pc690487e95992c395633866b', - APPSECRET: '01d552de9b864547b7e67d44568caeb9' + base_api: 'https://www.xxx.com/', + common_api: 'https://www.xxx.com/common' + } } diff --git a/src/config/env.staging.js b/src/config/env.staging.js index c2ba975..ef52568 100644 --- a/src/config/env.staging.js +++ b/src/config/env.staging.js @@ -1,11 +1,8 @@ module.exports = { - title: '蚁小宝', + title: '微信网页授权demo', baseUrl: 'https://test.top1buyer.com', api: { - base_api: 'https://test.top1buyer.com/wx', - common_api: 'https://test.top1buyer.com/wx' - }, - // package appid,appSecret - APPID: 'Pc690487e95992c395633866b', - APPSECRET: '01d552de9b864547b7e67d44568caeb9' + base_api: 'https://www.xxx.com/', + common_api: 'https://www.xxx.com/common' + } } diff --git a/src/filters/filter.js b/src/filters/filter.js index 508fda6..e6583a9 100644 --- a/src/filters/filter.js +++ b/src/filters/filter.js @@ -8,10 +8,7 @@ export function formatDate(time, fmt) { } const date = new Date(time) if (/(y+)/.test(fmt)) { - fmt = fmt.replace( - RegExp.$1, - (date.getFullYear() + '').substr(4 - RegExp.$1.length) - ) + fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)) } const o = { 'M+': date.getMonth() + 1, @@ -23,10 +20,7 @@ export function formatDate(time, fmt) { for (const k in o) { if (new RegExp(`(${k})`).test(fmt)) { const str = o[k] + '' - fmt = fmt.replace( - RegExp.$1, - RegExp.$1.length === 1 ? str : padLeftZero(str) - ) + fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : padLeftZero(str)) } } return fmt @@ -43,38 +37,3 @@ export function encodeUnicode(str) { } return '\\u' + res.join('\\u') } - -// 解码 -export function decodeUnicode(str) { - if (str === undefined || '') { - return - } - str = str.replace(/\\/g, '%') - return unescape(str) -} -/* - * 格式化金钱 - */ -export function formatMoney(value) { - return Number(value).toFixed(2) -} -export function formatCentMoney(value) { - if (value === undefined || '') { - return - } - return Number(value / 100).toFixed(2) -} -// 昵称解码 -export function formatName(nickname) { - if (!nickname) return '' - return decodeURIComponent(nickname) -} -// 折扣转换 -export function formatPercent(percent_off) { - if (!percent_off) return '' - if (percent_off == 1) { - return '原价' - } - // 解决精度丢失问题 - return Math.round(percent_off * 100) / 10 -} diff --git a/src/filters/index.js b/src/filters/index.js index 534ccbf..22808c8 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -4,9 +4,3 @@ import * as filter from './filter' Object.keys(filter).forEach(k => Vue.filter(k, filter[k])) Vue.prototype.$formatDate = Vue.filter('formatDate') -Vue.prototype.$encodeUnicode = Vue.filter('encodeUnicode') -Vue.prototype.$decodeUnicode = Vue.filter('decodeUnicode') -Vue.prototype.$formatMoney = Vue.filter('formatMoney') -Vue.prototype.$formatCentMoney = Vue.filter('formatCentMoney') -Vue.prototype.$formatName = Vue.filter('formatName') -Vue.prototype.$formatPercent = Vue.filter('formatPercent') diff --git a/src/main.js b/src/main.js index 9b39ec6..edfcc8d 100644 --- a/src/main.js +++ b/src/main.js @@ -10,10 +10,11 @@ import '@/filters' // filters import '@/utils/directives' // directives import '@/permission' // permission control import wechatAuth from './plugins/wechatAuth' // 微信登录插件 - +// 设置appid Vue.use(wechatAuth, { appid: process.env.VUE_APP_WECHAT_APPID }) +// 手机端调试工具 import VCconsole from 'vconsole' Vue.use(VCconsole) Vue.config.productionTip = false diff --git a/src/permission.js b/src/permission.js index 2ea698f..0a50ee1 100644 --- a/src/permission.js +++ b/src/permission.js @@ -5,11 +5,10 @@ import wechatAuth from './plugins/wechatAuth' // 微信登录插件 const qs = require('qs') router.beforeEach((to, from, next) => { - // store.dispatch('user/fedLogOut').then(() => { - // }) const loginStatus = Number(store.getters.loginStatus) console.log('loginStatus=' + loginStatus) console.log('token=' + store.getters.token) + // 页面标题 document.title = getPageTitle(to.meta.title) if (loginStatus === 0) { // 微信未授权登录跳转到授权登录页面 @@ -24,33 +23,35 @@ router.beforeEach((to, from, next) => { } else { loginUrl = url } - // alert(loginUrl) + // 设置微信授权回调地址 wechatAuth.redirect_uri = loginUrl // 无论拒绝还是授权都设置成1 store.dispatch('user/setLoginStatus', 1) + // 跳转到微信授权页面 window.location.href = wechatAuth.authUrl } else if (loginStatus === 1) { - // 微信已经授权回调获取code + // 用户已授权,获取code try { + // 通过回调链接设置code status wechatAuth.returnFromWechat(to.fullPath) } catch (err) { + // 失败,设置状态未登录,刷新页面 store.dispatch('user/setLoginStatus', 0) location.reload() - // next() } // 同意授权 to.fullPath 携带code参数,拒绝授权没有code参数 - // alert(to.fullPath) - // 重新赋值,不然获取不到code const code = wechatAuth.code - // alert(code) if (code) { + // 拿到code 访问服务端的登录接口 store .dispatch('user/loginWechatAuth', code) .then(res => { + // 成功设置已登录状态 store.dispatch('user/setLoginStatus', 2) next() }) .catch(() => { + // 失败,设置状态未登录,刷新页面 store.dispatch('user/setLoginStatus', 0) location.reload() }) @@ -59,7 +60,7 @@ router.beforeEach((to, from, next) => { location.reload() } } else { - // alert(to.fullPath) + // 已登录直接进入 next() } }) diff --git a/src/router/index.js b/src/router/index.js index b301ade..b4d1c9e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -5,26 +5,9 @@ Vue.use(Router) export const constantRoutes = [ { path: '/', - redirect: '/account' - }, - { - path: '/account', - name: 'account', - component: () => import('@/views/account/index'), - meta: { - title: '个人中心', - keepAlive: false - } - }, - { - path: '/coupon', - name: 'coupon', - component: () => import('@/views/account/coupon'), - meta: { - title: '优惠券', - keepAlive: false - } + redirect: '/home' }, + { path: '/home', name: 'home', @@ -38,7 +21,7 @@ export const constantRoutes = [ const createRouter = () => new Router({ mode: 'history', // require service support - base: '/antpublic', + base: '/app/', scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 3c247e6..26395b0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,4 +1,3 @@ -import { login } from '@/api/user' import { loginByCode } from '@/api/user' import { saveToken, @@ -30,27 +29,15 @@ const mutations = { } const actions = { - loginUrl({ commit }, path) { - // const url = baseUrl + path - return new Promise((resolve, reject) => { - login({ redirectUri: path }) - .then(response => { - resolve(response) - }) - .catch(error => { - reject(error) - }) - }) - }, - // 登录相关 - loginWechatAuth({ commit, state }, code) { + // 登录相关,通过code获取token和用户信息 + loginWechatAuth({ commit }, code) { const data = { code: code } return new Promise((resolve, reject) => { loginByCode(data) .then(res => { - console.log(res) + // 存用户信息,token commit('SET_USERINFO', saveUserInfo(res.data.user)) commit('SET_TOKEN', saveToken(res.data.token)) resolve(res) @@ -61,20 +48,18 @@ const actions = { }) }, // 设置状态 - setLoginStatus({ commit, state }, query) { + setLoginStatus({ commit }, query) { if (query === 0 || query === 1) { - // 上线打开注释,本地调试注释掉 + // 上线打开注释,本地调试注释掉,保持信息最新 removeToken() removeUserInfo() } + // 设置不同的登录状态 commit('SET_LOGIN_STATUS', saveLoginStatus(query)) }, - // 保存用户个人信息 - setUserInfo({ commit, state }, query) { - commit('SET_USERINFO', saveUserInfo(query)) - }, // 登出 - fedLogOut({ commit, state }, query) { + fedLogOut() { + // 删除token,用户信息,登陆状态 removeToken() removeUserInfo() removeLoginStatus() diff --git a/src/utils/cache.js b/src/utils/cache.js index 72ee85b..1a42c26 100644 --- a/src/utils/cache.js +++ b/src/utils/cache.js @@ -1,66 +1,46 @@ import cookies from 'js-cookie' import storage from 'good-storage' - const LoginStatusKey = 'Login-Status' // 登录态 0未授权未登录 1授权未登录 2 登陆成功 const TokenKey = 'Access-Token' // token const UserInfoKey = 'User-Info' // 用户信息 {} {...} - +// 获取登录状态 export function loadLoginStatus() { return cookies.get(LoginStatusKey) || 0 - // var arr - // var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)') - // if ((arr = document.cookie.match(reg))) return unescape(arr[2]) - // else return null } - -// export function saveLoginStatus(status) { -// cookies.set(LoginStatusKey, status, { expires: 7 }) -// return status -// } - +// 保持登录状态 export function saveLoginStatus(status) { - // storage.set(LoginStatusKey, status) - var date = new Date() - date.setTime(date.getTime() + 5 * 60 * 1000) // 设置date为当前时间+5分 - document.cookie = LoginStatusKey + '=' + status + '; expires=' + date.toGMTString() // 将date赋值给expires - // var exp = new Date() - // exp.setTime(exp.getTime() + 5 * 60 * 1000) - // document.cookie = LoginStatusKey + '=' + escape(status) + ';expires=' + exp.toGMTString() + cookies.set(LoginStatusKey, status, { expires: 7 }) return status } - +// 删除登录状态 export function removeLoginStatus() { - // var exp = new Date() - // exp.setTime(exp.getTime() - 1) - // var cval = saveLoginStatus(LoginStatusKey) - // if (cval != null) document.cookie = LoginStatusKey + '=' + cval + ';expires=' + exp.toGMTString() cookies.remove(LoginStatusKey) return '' } - +// 获取token export function loadToken() { return storage.get(TokenKey, '') } - +// 保存token export function saveToken(token) { storage.set(TokenKey, token) return token } - +// 删除token export function removeToken() { storage.remove(TokenKey) return '' } - +// 获取用户信息 export function loadUserInfo() { return storage.get(UserInfoKey, {}) } - +// 保存用户信息 export function saveUserInfo(userInfo) { storage.set(UserInfoKey, userInfo) return userInfo } - +// 删除用户信息 export function removeUserInfo() { storage.remove(UserInfoKey) return {} diff --git a/src/utils/get-page-title.js b/src/utils/get-page-title.js index 122e5b6..4d0a141 100644 --- a/src/utils/get-page-title.js +++ b/src/utils/get-page-title.js @@ -1,4 +1,4 @@ -const title = '蚁小宝' +const title = '微信网页授权demo' export default function getPageTitle(pageTitle) { if (pageTitle) { return `${pageTitle} - ${title}` diff --git a/src/utils/package.js b/src/utils/package.js deleted file mode 100644 index 5016d9c..0000000 --- a/src/utils/package.js +++ /dev/null @@ -1,124 +0,0 @@ -/* - * @Author: sunnie.Song - * @Date: 2019-05-27 10:01:46 - * @Description: 接口签名说明文档 - */ - -import { APPID, APPSECRET } from '../config/index' -import CryptoJS from 'crypto-js' -/** - *对排序后的key值取值并生成 - */ -function objKeySort(obj) { - // 将obj中的所有key取出放入数组中,并按照ASCII排序 返回排序后的数组 - var newKey = Object.keys(obj).sort() - - var sortString = '' - // 将obj转化为排序后的键值对使用'key=value&key=value'方式转为字符串 - for (var i = 0; i < newKey.length; i++) { - sortString = sortString + newKey[i] + '=' + obj[newKey[i]] + '&' - } - // 返回字符串去除最有一个'&' - return sortString.substring(0, sortString.length - 1) -} -/* 参数编码序列*/ -function serializeParams(obj) { - const arr = [] - // key的vaule为空的时候,删除该key - const params = Object.assign({}, obj) - for (const key in params) { - if (!params[key]) { - delete params[key] - } - } - Object.keys(params).forEach(key => { - let value = params[key] - // 如果值为undefined,置空 - if (typeof value === 'undefined') { - value = '' - } - // 对于需要编码的文本(比如说中文)我们要进行编码 - arr.push([key, encodeURIComponent(value)].join('=')) - }) - return arr.join('&') -} -function isChineseChar(str) { - var reg = /[\u4E00-\u9FA5\uF900-\uFA2D]|[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/ - - return reg.test(str) -} -function encodeParams(obj) { - // const arr = [] - // key的vaule为空的时候,删除该key - const params = Object.assign({}, obj) - // for (const key in params) { - // if (!params[key]) { - // delete params[key] - // } - // } - Object.keys(params).forEach(key => { - let value = params[key] - // 如果值为undefined,置空 - if (typeof value === 'undefined') { - value = '' - } - // 如果有汉子 - if (isChineseChar(value)) { - params[key] = encodeURIComponent(value) - } else { - params[key] = value - } - }) - return params -} -/** - * 将参数打包 - * apiName: 接口名称 - * param: 参数obj 可选 - * isReturnStr: Boolean 可选 post是否返回string - */ - -function baleParams(apiName, param, isReturnStr) { - // 获取系统当前时间戳(精确到毫秒13位) //1511257250001 - var timestamp = new Date().valueOf() - /** - * appId : 10010 系统账号 (参与签名) - * appSecret :10011 系统账号密码(参与签名) - * apiName :接口名称(参与签名) - * params : 接口参数json格式 (参与签名,没有则不参与) - */ - - const paramObj = { - appId: APPID, - appSecret: APPSECRET, - apiName: apiName, - timeStamp: timestamp - } - // 参数 - if (param !== undefined) { - // 将参数转为json字符串 - const encode = encodeParams(param) - paramObj.params = JSON.stringify(encode) - } - // 参数按ASCII排序,返回使用'=','&'拼接的字符串 - const sort = objKeySort(paramObj) - // 将排序好的字符串使用MD5签名,并返回大写字符串 - // const sign = MD5.hexMD5(sort).toLocaleUpperCase() - var sign = CryptoJS.MD5(sort) - .toString(CryptoJS.enc.Hex) - .toLocaleUpperCase() - // 将appid, apiname, 时间戳 ,签名 重新作为参数传给服务器 - let parameters = { - appId: paramObj.appId, - timeStamp: timestamp, - apiName: apiName, - sign: sign, - params: paramObj.params - } - // 是否序列表 - if (isReturnStr === true) { - parameters = serializeParams(parameters) - } - return parameters -} -export default baleParams diff --git a/src/utils/request.js b/src/utils/request.js index b23b48d..7b61fbe 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -20,7 +20,7 @@ service.interceptors.request.use( }) } if (store.getters.token) { - config.headers['ukey'] = store.getters.token + config.headers['token'] = store.getters.token } return config }, @@ -35,6 +35,7 @@ service.interceptors.response.use( response => { Toast.clear() const res = response.data + // 这里注意修改成你访问的服务端接口规则 if (res.status && res.status !== 200) { Toast({ message: res.info diff --git a/vue.config.js b/vue.config.js index 345edf2..90f60a9 100644 --- a/vue.config.js +++ b/vue.config.js @@ -11,8 +11,7 @@ const externals = { 'vue-router': 'VueRouter', vuex: 'Vuex', vant: 'vant', - axios: 'axios', - 'crypto-js': 'CryptoJS' + axios: 'axios' } // cdn const cdn = { @@ -30,15 +29,13 @@ const cdn = { 'https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.6/vue-router.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/vuex/3.1.1/vuex.min.js', - 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js', 'https://cdn.jsdelivr.net/npm/vant@beta/lib/vant.min.js' ] } } module.exports = { - publicPath: process.env.NODE_ENV === 'production' ? '/antpublic/' : '/', + publicPath: process.env.NODE_ENV === 'development' ? '/' : '/app/', // 需要根据环境设置,不然会报错 outputDir: 'dist', - // outputDir: '../../../phpStudy/PHPTutorial/WWW/antpublic', assetsDir: 'static', lintOnSave: process.env.NODE_ENV === 'development', productionSourceMap: false, @@ -57,7 +54,6 @@ module.exports = { // externals里的模块不打包 Object.assign(config, { name: defaultSettings.title, - // entry: ['@babel/polyfill', './src/main.js'], externals: externals, optimization: { minimize: false // 换行 @@ -104,9 +100,7 @@ module.exports = { config // https://webpack.js.org/configuration/devtool/#development - .when(process.env.NODE_ENV === 'development', config => - config.devtool('cheap-source-map') - ) + .when(process.env.NODE_ENV === 'development', config => config.devtool('cheap-source-map')) config.when(process.env.NODE_ENV !== 'development', config => { config