|
@@ -15,6 +15,28 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
console.log(17171717171717);
|
|
|
+ const kipAccessToken = uni.getStorageSync('kipAccessToken');
|
|
|
+ if (!kipAccessToken) {
|
|
|
+ /* if (!openid) {
|
|
|
+ // 当进入其他页面时,需要先打开路由展示
|
|
|
+ this.isInit = true;
|
|
|
+ // 前往授权页面
|
|
|
+ this.$router.replace({
|
|
|
+ path: '/openWx',
|
|
|
+ query: query,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ } */
|
|
|
+ // 初始化微信
|
|
|
+ initWxJsSdkConfig(['chooseWXPay', 'scanQRCode', 'checkJsApi']);
|
|
|
+ // 如果用户不选择登录,则不走登录逻辑
|
|
|
+ this.isInit = true;
|
|
|
+ this.$router.replace({
|
|
|
+ path: '/login',
|
|
|
+ query: query,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
getCode() {
|
|
@@ -22,13 +44,13 @@ export default {
|
|
|
const local = window.location.origin;
|
|
|
// return
|
|
|
if (code == null || code === '') {
|
|
|
- const componentAppid = 'wxd830fe4d1e04988e'
|
|
|
+ // const componentAppid = 'wxd830fe4d1e04988e'
|
|
|
window.location.href =
|
|
|
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
|
|
|
// window.APPID +
|
|
|
`wx907c27f16841a919` +
|
|
|
'&redirect_uri=' +
|
|
|
- encodeURIComponent('https://dev-tparking.kerryonvip.com') +
|
|
|
+ encodeURIComponent(local) +
|
|
|
`&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect`;
|
|
|
} else {
|
|
|
this.getOpenId(code); //把code传给后台获取用户信息
|