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

Merge branch 'dev'

parents eca1422d a77df364
......@@ -41,7 +41,7 @@ export default {
// 授权用户信息
authUserInfo: "",
logout: false,
navHeight: 0, //导航栏高度
rpxScreenHeight: 0, // 照相视框高度
safeHeight: 0, // 安全高度
......@@ -153,6 +153,7 @@ export default {
wxAppNo: that.globalData.wxAppNo, // 自营平台小程序
};
let result = await that.$u.api.loginWechatAuth(params);
console.log("result", result)
if (
result &&
result.code == 200 &&
......@@ -173,23 +174,24 @@ export default {
}
});
},
setUserData(userInfo) {
setUserData(userInfo, that) {
let self = that ? that : this
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);
self.$u.vuex("vuex_token", userInfo.token);
self.$u.vuex("vuex_user", userInfo);
self.$u.vuex("vuex_wx_uid", userInfo.wxopenid);
this.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", "");
self.$u.vuex("vuex_token", "");
self.$u.vuex("vuex_user", null);
self.$u.vuex("vuex_wx_uid", "");
}
this.$u.vuex("vuex_settled", null);
self.$u.vuex("vuex_settled", null);
},
/* 版本更新 */
......
......@@ -32,21 +32,20 @@
</u-cell-group>
</view>
</view>
<u-modal v-model="show" :content="content" show-cancel-button @confirm="logout"></u-modal>
</view>
</template>
<script>
const app = getApp();
import takePhoto from '@/components/take/index.vue'
export default {
components: {
'take-photo': takePhoto
},
data() {
return {
qnPath: process.uniEnv.qn_base_url,
serviceTel: '18124099271',
showSuperButton: false
showSuperButton: false,
show: false,
content: '是否确认退出该账户?'
}
},
computed: {
......@@ -169,15 +168,22 @@
},
handleClickTel() {
if(this.vuex_token && this.settled && this.mobile) {
this.show = true
return false
}
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() {
let res = await this.$u.api.allowLogin()
console.log(res)
if (res && res.code == 200 && res.data) {
this.showSuperButton = res.data.data
this.showSuperButton = res.data.data === true
}
},
......@@ -292,4 +298,7 @@
}
}
.logout {
padding: 20rpx;
}
</style>
......@@ -81,7 +81,12 @@ export default {
title: '授权中..',
mask: true
});
if (getApp().globalData.logout) {
uni.hideLoading()
that.setLoginStatus()
} else {
that.authLogin()
}
},
fail: function (res) {
uni.showModal({
......@@ -112,7 +117,7 @@ export default {
}).then(res => {
uni.hideLoading();
if (res && res.code == 200 && res.data && res.data.token) {
that.setUserData(res.data)
app.setUserData(res.data, that)
that.goBackPage()
} else {
that.setLoginStatus()
......@@ -145,7 +150,8 @@ export default {
}).then(res => {
uni.hideLoading()
if (res) {
that.setUserData(res.data)
app.setUserData(res.data, that)
app.getBaseInfo(that)
that.goBackPage()
} else {
uni.showToast({
......@@ -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) {
getApp().globalData.logout = false
if (authed) {
this.needAuth = false
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