|
@@ -44,8 +44,8 @@
|
|
|
<view class="two_1" v-for="(item, index) in menuList" :key="index" @click="toCommon(item.route)">
|
|
|
<view class="title">{{item.title}}</view>
|
|
|
<view class="title">
|
|
|
- <text v-if="user._id&&item.title=='我的积分'">{{user.integral||0}}分</text>
|
|
|
- <text v-if="user._id&&item.title=='客服电话'">{{user.phone||'123-345-6780'}}</text>
|
|
|
+ <text v-if="user.id&&item.title=='我的积分'">{{user.integral||0}}分</text>
|
|
|
+ <text v-if="item.title=='客服电话'">{{serviceContaceInfo.phone||''}}</text>
|
|
|
<text class="iconfont icon-dayufuhao"></text>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -63,6 +63,8 @@
|
|
|
},
|
|
|
// 用户信息
|
|
|
user: {},
|
|
|
+ // 客服信息
|
|
|
+ serviceContaceInfo: {},
|
|
|
// 图标菜单
|
|
|
orderList: [{
|
|
|
icon: 'icon-daifukuan',
|
|
@@ -122,23 +124,36 @@
|
|
|
],
|
|
|
};
|
|
|
},
|
|
|
- onShow: function() {
|
|
|
+ onShow: async function() {
|
|
|
const that = this;
|
|
|
- that.watchLogin();
|
|
|
+ // 查询其他信息
|
|
|
+ await that.searchOther();
|
|
|
+ // 监听用户登录
|
|
|
+ await that.watchLogin();
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
watchLogin() {
|
|
|
const that = this;
|
|
|
uni.getStorage({
|
|
|
key: 'token',
|
|
|
- success: (res) => {
|
|
|
+ success: async (res) => {
|
|
|
let user = that.$jwt(res.data);
|
|
|
- console.log(user);
|
|
|
- if (user) that.$set(that, `user`, user);
|
|
|
+ const arr = await that.$api(`/user/${user.id}`, 'GET');
|
|
|
+ if (arr.errcode == '0') that.$set(that, `user`, arr.data);
|
|
|
},
|
|
|
fail: (err) => {}
|
|
|
})
|
|
|
},
|
|
|
+ // 查询其他信息
|
|
|
+ async searchOther() {
|
|
|
+ const that = this;
|
|
|
+ let res;
|
|
|
+ res = await that.$api(`/serviceContace`, 'GET');
|
|
|
+ if (res.errcode == '0' && res.total > 0) {
|
|
|
+ that.$set(that, `serviceContaceInfo`, res.data[0])
|
|
|
+ }
|
|
|
+ },
|
|
|
toPath(e) {
|
|
|
if (e && e.route) uni.redirectTo({
|
|
|
url: `/${e.route}`
|