|
|
|
@ -2,8 +2,8 @@
|
|
|
|
<view class="container">
|
|
|
|
<view class="container">
|
|
|
|
<view class="user-header">
|
|
|
|
<view class="user-header">
|
|
|
|
<view class="user-info" @click="loginOrJump('/pages/profile/profile')">
|
|
|
|
<view class="user-info" @click="loginOrJump('/pages/profile/profile')">
|
|
|
|
<u-avatar size="80" :src="avatar"></u-avatar>
|
|
|
|
<u-avatar size="80" :src="userInfo.avatar"></u-avatar>
|
|
|
|
<text class="nick-name">{{ nickName }}</text>
|
|
|
|
<text class="nick-name">{{ hasLogin ? userInfo.nickname || '游客' : '点击登录' }}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
@ -19,8 +19,8 @@
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="order-status-box">
|
|
|
|
<view class="order-status-box">
|
|
|
|
<u-grid :border="false" :col="orderStatusList.length"
|
|
|
|
<u-grid :border="false" :col="orderStatusList.length">
|
|
|
|
><u-grid-item v-for="(item, index) in orderStatusList" :key="index">
|
|
|
|
<u-grid-item v-for="(item, index) in orderStatusList" :key="index">
|
|
|
|
<u-icon :name="item.icon" :size="32"></u-icon>
|
|
|
|
<u-icon :name="item.icon" :size="32"></u-icon>
|
|
|
|
<text class="grid-title">{{ item.title }}</text>
|
|
|
|
<text class="grid-title">{{ item.title }}</text>
|
|
|
|
</u-grid-item>
|
|
|
|
</u-grid-item>
|
|
|
|
@ -48,10 +48,9 @@
|
|
|
|
<u-cell class="fun-item" :border="false" icon="map" title="收货地址" @click="loginOrJump('/pages/address/list')" isLink></u-cell>
|
|
|
|
<u-cell class="fun-item" :border="false" icon="map" title="收货地址" @click="loginOrJump('/pages/address/list')" isLink></u-cell>
|
|
|
|
</u-cell-group>
|
|
|
|
</u-cell-group>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="logout-btn">
|
|
|
|
<view v-if="hasLogin" class="logout-btn">
|
|
|
|
<u-button type="error" color="#ea322b" text="确定"></u-button>
|
|
|
|
<u-button type="error" color="#ea322b" text="退出登录" @click="logout"></u-button>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,8 +58,6 @@
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
avatar: '',
|
|
|
|
|
|
|
|
nickName: '点击登录',
|
|
|
|
|
|
|
|
orderStatusList: [
|
|
|
|
orderStatusList: [
|
|
|
|
{ icon: 'rmb-circle', title: '待支付' },
|
|
|
|
{ icon: 'rmb-circle', title: '待支付' },
|
|
|
|
{ icon: 'car', title: '代发货' },
|
|
|
|
{ icon: 'car', title: '代发货' },
|
|
|
|
@ -77,12 +74,33 @@ export default {
|
|
|
|
onLoad() {},
|
|
|
|
onLoad() {},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
loginOrJump(pageUrl) {
|
|
|
|
loginOrJump(pageUrl) {
|
|
|
|
// TODO 判断是否已经登录逻辑
|
|
|
|
if (!this.hasLogin) {
|
|
|
|
if (!uni.getStorageSync('token')) {
|
|
|
|
|
|
|
|
uni.$u.route('/pages/login/login')
|
|
|
|
uni.$u.route('/pages/login/login')
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
uni.$u.route(pageUrl)
|
|
|
|
uni.$u.route(pageUrl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
logout() {
|
|
|
|
|
|
|
|
uni.showModal({
|
|
|
|
|
|
|
|
title: '提示',
|
|
|
|
|
|
|
|
content: '您确定要退出登录吗',
|
|
|
|
|
|
|
|
success: res => {
|
|
|
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
|
|
|
console.log('用户点击确定')
|
|
|
|
|
|
|
|
this.$store.commit('logout')
|
|
|
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
|
|
|
|
console.log('用户点击取消')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
|
|
userInfo() {
|
|
|
|
|
|
|
|
return this.$store.state.userInfo
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
hasLogin() {
|
|
|
|
|
|
|
|
return this.$store.getters.hasLogin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|