Commit ba8defe2 authored by 高铭波's avatar 高铭波

Merge branch 'dev'

parents eca1422d a77df364
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
// 授权用户信息 // 授权用户信息
authUserInfo: "", authUserInfo: "",
logout: false,
navHeight: 0, //导航栏高度 navHeight: 0, //导航栏高度
rpxScreenHeight: 0, // 照相视框高度 rpxScreenHeight: 0, // 照相视框高度
safeHeight: 0, // 安全高度 safeHeight: 0, // 安全高度
...@@ -153,6 +153,7 @@ export default { ...@@ -153,6 +153,7 @@ export default {
wxAppNo: that.globalData.wxAppNo, // 自营平台小程序 wxAppNo: that.globalData.wxAppNo, // 自营平台小程序
}; };
let result = await that.$u.api.loginWechatAuth(params); let result = await that.$u.api.loginWechatAuth(params);
console.log("result", result)
if ( if (
result && result &&
result.code == 200 && result.code == 200 &&
...@@ -173,23 +174,24 @@ export default { ...@@ -173,23 +174,24 @@ export default {
} }
}); });
}, },
setUserData(userInfo) { setUserData(userInfo, that) {
let self = that ? that : this
if (userInfo && userInfo.token) { if (userInfo && userInfo.token) {
// 如果已经登录则直接获取相关信息 // 如果已经登录则直接获取相关信息
this.$u.vuex("vuex_token", userInfo.token); self.$u.vuex("vuex_token", userInfo.token);
this.$u.vuex("vuex_user", userInfo); self.$u.vuex("vuex_user", userInfo);
this.$u.vuex("vuex_wx_uid", userInfo.wxopenid); self.$u.vuex("vuex_wx_uid", userInfo.wxopenid);
this.track('auth_login', { this.track('auth_login', {
auth_token: userInfo.token, auth_token: userInfo.token,
auth_user: userInfo, auth_user: userInfo,
auth_wx_uid: userInfo.wxopenid auth_wx_uid: userInfo.wxopenid
}); });
} else { } else {
this.$u.vuex("vuex_token", ""); self.$u.vuex("vuex_token", "");
this.$u.vuex("vuex_user", null); self.$u.vuex("vuex_user", null);
this.$u.vuex("vuex_wx_uid", ""); self.$u.vuex("vuex_wx_uid", "");
} }
this.$u.vuex("vuex_settled", null); self.$u.vuex("vuex_settled", null);
}, },
/* 版本更新 */ /* 版本更新 */
......
...@@ -32,21 +32,20 @@ ...@@ -32,21 +32,20 @@
</u-cell-group> </u-cell-group>
</view> </view>
</view> </view>
<u-modal v-model="show" :content="content" show-cancel-button @confirm="logout"></u-modal>
</view> </view>
</template> </template>
<script> <script>
const app = getApp(); const app = getApp();
import takePhoto from '@/components/take/index.vue'
export default { export default {
components: {
'take-photo': takePhoto
},
data() { data() {
return { return {
qnPath: process.uniEnv.qn_base_url, qnPath: process.uniEnv.qn_base_url,
serviceTel: '18124099271', serviceTel: '18124099271',
showSuperButton: false showSuperButton: false,
show: false,
content: '是否确认退出该账户?'
} }
}, },
computed: { computed: {
...@@ -169,15 +168,22 @@ ...@@ -169,15 +168,22 @@
}, },
handleClickTel() { handleClickTel() {
if(this.vuex_token && this.settled && this.mobile) { if(this.vuex_token && this.settled && this.mobile) {
this.show = true
return false return false
} }
this.$u.route({url: "pages/login/index"}) this.$u.route({url: "pages/login/index"})
}, },
logout() {
app.setUserData({}, this)
app.globalData.logout = true
},
handleSuperButton() {
this.$u.route({url: 'pages/mine/superLogin/index'})
},
async allowLogin() { async allowLogin() {
let res = await this.$u.api.allowLogin() let res = await this.$u.api.allowLogin()
console.log(res)
if (res && res.code == 200 && res.data) { if (res && res.code == 200 && res.data) {
this.showSuperButton = res.data.data this.showSuperButton = res.data.data === true
} }
}, },
...@@ -292,4 +298,7 @@ ...@@ -292,4 +298,7 @@
} }
} }
.logout {
padding: 20rpx;
}
</style> </style>
...@@ -81,7 +81,12 @@ export default { ...@@ -81,7 +81,12 @@ export default {
title: '授权中..', title: '授权中..',
mask: true mask: true
}); });
if (getApp().globalData.logout) {
uni.hideLoading()
that.setLoginStatus()
} else {
that.authLogin() that.authLogin()
}
}, },
fail: function (res) { fail: function (res) {
uni.showModal({ uni.showModal({
...@@ -112,7 +117,7 @@ export default { ...@@ -112,7 +117,7 @@ export default {
}).then(res => { }).then(res => {
uni.hideLoading(); uni.hideLoading();
if (res && res.code == 200 && res.data && res.data.token) { if (res && res.code == 200 && res.data && res.data.token) {
that.setUserData(res.data) app.setUserData(res.data, that)
that.goBackPage() that.goBackPage()
} else { } else {
that.setLoginStatus() that.setLoginStatus()
...@@ -145,7 +150,8 @@ export default { ...@@ -145,7 +150,8 @@ export default {
}).then(res => { }).then(res => {
uni.hideLoading() uni.hideLoading()
if (res) { if (res) {
that.setUserData(res.data) app.setUserData(res.data, that)
app.getBaseInfo(that)
that.goBackPage() that.goBackPage()
} else { } else {
uni.showToast({ uni.showToast({
...@@ -198,26 +204,8 @@ export default { ...@@ -198,26 +204,8 @@ export default {
} }
}, },
setUserData(userInfo) {
if (userInfo && userInfo.token) {
// 如果已经登录则直接获取相关信息
this.$u.vuex('vuex_token',userInfo.token);
this.$u.vuex('vuex_user', userInfo);
this.$u.vuex('vuex_wx_uid', userInfo.wxopenid);
app.track('auth_login', {
auth_token: userInfo.token,
auth_user: userInfo,
auth_wx_uid: userInfo.wxopenid
});
} else {
this.$u.vuex('vuex_token', '');
this.$u.vuex('vuex_user', null);
this.$u.vuex('vuex_wx_uid', '');
}
this.$u.vuex('vuex_settled', null);
},
setLoginStatus(authed = true) { setLoginStatus(authed = true) {
getApp().globalData.logout = false
if (authed) { if (authed) {
this.needAuth = false this.needAuth = false
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment