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);
this.track('auth_login', {
auth_token: userInfo.token,
auth_user: userInfo,
auth_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);
},
/* 版本更新 */
......
......@@ -15,7 +15,7 @@
<text>{{telTip}}</text>
<u-icon class="tel-arrow-icon" name="arrow-up-fill"></u-icon>
</view>
</view>
</view>
<view v-if="showSuperButton" class="super-button"><u-button@click="handleSuperButton">切换用户</u-button></view>
</view>
......@@ -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
serviceTel: '18124099271',
showSuperButton: false,
show: false,
content: '是否确认退出该账户?'
}
},
computed: {
......@@ -55,58 +54,58 @@
},
avatar() {
return this.vuex_settled && this.vuex_settled.avatar
},
name() {
return (this.settled && this.settled.nickname) || (this.vuex_user && (this.vuex_user.name || this.vuex_user.loginName))
},
name() {
return (this.settled && this.settled.nickname) || (this.vuex_user && (this.vuex_user.name || this.vuex_user.loginName))
},
mobile() {
return (this.settled && this.settled.mobile) || (this.vuex_user && this.vuex_user.mobile)
},
items() {
return [
{
return [
{
pathName: 'wallet',
title: '我的钱包',
value: '',
icon: 'qianbao.png',
imageStyle: 'width:34rpx;height:32rpx'
},
{
{
pathName: 'deposit',
title: '配件押金',
value: '',
icon: 'yajin.png',
imageStyle: 'width:32rpx;height:32rpx'
},
{
{
pathName: 'contract',
title: '我的合同',
value: '',
icon: 'hetong.png',
imageStyle: 'width:34rpx;height:32rpx'
},
{
{
pathName: 'cert',
title: '我的证件',
value: '',
icon: 'zhengjian.png',
imageStyle: 'width:36rpx;height:28rpx'
},
{
{
pathName: 'address',
title: '收货地址',
value: '',
icon: 'wddizhi.png',
imageStyle: 'width:32rpx;height:32rpx'
},
{
{
pathName: 'warehouse',
title: '我的仓库',
value: '',
icon: 'cangku.png',
imageStyle: 'width:36rpx;height:32rpx'
},
{
{
pathName: 'customer',
title: '联系客服',
value: this.serviceTel,
......@@ -126,9 +125,9 @@
},
placeholderImage() {
return this.qnPath + 'touxiang.png'
},
headImageStyle() {
return this.avatar ? 'width:136rpx; height:136rpx;border-radius:68rpx' : 'width:144rpx; height:144rpx;border-radius:72rpx'
},
headImageStyle() {
return this.avatar ? 'width:136rpx; height:136rpx;border-radius:68rpx' : 'width:144rpx; height:144rpx;border-radius:72rpx'
},
headSize() {
return this.avatar ? 136 : 144
......@@ -136,15 +135,15 @@
},
onLoad() {
app.trackPage('我的首页')
if(this.vuex_token ) {
if (!this.showSuperButton) {
this.allowLogin()
}
if (!this.settled) {
this.getData()
}
}
if(this.vuex_token ) {
if (!this.showSuperButton) {
this.allowLogin()
}
if (!this.settled) {
this.getData()
}
}
},
methods: {
......@@ -159,7 +158,7 @@
})
} else {
this.$u.route({url: "pages/login/index"})
}
}
},
handleClickName() {
if(this.vuex_token && this.settled) {
......@@ -169,20 +168,27 @@
},
handleClickTel() {
if(this.vuex_token && this.settled && this.mobile) {
this.show = true
return false
}
this.$u.route({url: "pages/login/index"})
},
async allowLogin() {
},
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
}
},
handleSuperButton() {
this.$u.route({url: 'pages/mine/superLogin/index'})
this.showSuperButton = res.data.data === true
}
},
handleSuperButton() {
this.$u.route({url: 'pages/mine/superLogin/index'})
}
}
}
......@@ -205,11 +211,11 @@
color: #FFFFFF;
font-weight: bold;
font-size: 40rpx;
padding-left: 30rpx;
padding-left: 30rpx;
}
.mine-content {
position: relative;
.mine-content {
position: relative;
.header-view {
padding: 30rpx 30rpx 80rpx 30rpx;
display: flex;
......@@ -220,8 +226,8 @@
height: 144rpx;
background-color: #FFFFFF;
border-radius: 72rpx;
display: flex;
align-items: center;
display: flex;
align-items: center;
justify-content: center;
}
......@@ -259,9 +265,9 @@
margin-left: 6rpx;
}
}
}
.super-button {
margin-left: 20rpx;
}
.super-button {
margin-left: 20rpx;
}
}
......@@ -292,4 +298,7 @@
}
}
</style>
.logout {
padding: 20rpx;
}
</style>
......@@ -81,7 +81,12 @@ export default {
title: '授权中..',
mask: true
});
that.authLogin()
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