This commit is contained in:
nyoung 2024-08-23 23:34:35 +08:00
parent c38b92364c
commit e7eaf35c1d
3 changed files with 21 additions and 20 deletions

View File

@ -1,6 +1,5 @@
<template> <template>
<view class="bottoms"> <view class="bottoms">
<view class="box" :class="{active: aindex == 1}" @click="getgogo(1)" v-if="role == 'user' "> <view class="box" :class="{active: aindex == 1}" @click="getgogo(1)" v-if="role == 'user' ">
<view class="imgs"> <view class="imgs">
<image mode="aspectFit" src="@/static/icons/tabbar/home.png" v-show="aindex != 1"></image> <image mode="aspectFit" src="@/static/icons/tabbar/home.png" v-show="aindex != 1"></image>
@ -79,7 +78,7 @@
} }
}, },
props: { props: {
msg: String msg: String|Number
}, },
onLoad() { onLoad() {
console.log('tabbag', uni.getStorageSync('identity')); console.log('tabbag', uni.getStorageSync('identity'));
@ -207,8 +206,6 @@
}) })
} }
} }
} }
@ -240,7 +237,7 @@
justify-content: center; justify-content: center;
font-size: 12px; font-size: 12px;
color: #929292; color: #929292;
&.active { &.active {
color: #327DFB; color: #327DFB;
} }
@ -273,4 +270,4 @@
color: white; color: white;
font-size: 2px; font-size: 2px;
} }
</style> </style>

View File

@ -315,9 +315,11 @@
if (this.sfindex == 'user') { if (this.sfindex == 'user') {
getInfo().then((res) => { getInfo().then((res) => {
let userJson = {} let userJson = {}
userJson.userId = res.data.user.userId userJson.userId = res.data.user.id
uni.setStorageSync('userInfo', res.data.user) let userInfo = res.data.user.info
uni.setStorageSync('userId', res.data.user.userId) userInfo.id = res.data.user.id
uni.setStorageSync('userInfo', userInfo)
uni.setStorageSync('userId', res.data.user.id)
uni.setStorageSync('role', res.data.roles) uni.setStorageSync('role', res.data.roles)
this.goselect() this.goselect()
}) })
@ -328,10 +330,11 @@
method: 'get', method: 'get',
}).then((res) => { }).then((res) => {
let userJson = {} let userJson = {}
userJson.userId = res.data.user.userId userJson.userId = res.data.user.id
uni.setStorageSync('userInfo', res.data.user) uni.setStorageSync('userInfo', res.data.user)
uni.setStorageSync('role', res.data.roles) let roles = res.data.role.map(item=>{item.name})
uni.setStorageSync('userId', res.data.user.userId) uni.setStorageSync('role', roles)
uni.setStorageSync('userId', res.data.user.id)
this.goselect() this.goselect()
}) })
} }

View File

@ -20,9 +20,9 @@
<view class="c-title" v-if="!userinfo" @click="gologin">立即登录</view> <view class="c-title" v-if="!userinfo" @click="gologin">立即登录</view>
<view class="c-title" v-else> <view class="c-title" v-else>
<view style="display: flex; align-items: center;"> <view style="display: flex; align-items: center;">
<text>{{userinfo.info.nickname || '用户昵称'}}</text> <text>{{ userinfo.nickname || '用户昵称'}}</text>
</view> </view>
<text style="font-size: 14px;font-weight: normal;color: #88b4fb">{{userinfo.info.phonenumber || '未填写手机号码'}}</text> <text style="font-size: 14px;font-weight: normal;color: #88b4fb">{{userinfo.phonenumber || '未填写手机号码'}}</text>
</view> </view>
</view> </view>
@ -43,9 +43,9 @@
<view class="back-button" @click="goHuanche">去还车</view> <view class="back-button" @click="goHuanche">去还车</view>
</view> </view>
<view class="bai-box"> <view class="bai-box" v-if="role === 'user'">
<view class="b-title">我的订单</view> <view class="b-title">我的订单</view>
<image class="sanjiao" src="../../static/my/sanjiao.png"> <image class="sanjiao" src="../../static/my/sanjiao.png"/>
<view class="sige"> <view class="sige">
<view class="s-box" @click="goorder(2)"> <view class="s-box" @click="goorder(2)">
<view class="simg"> <view class="simg">
@ -76,7 +76,7 @@
</view> </view>
<view class="dai-box"> <view class="dai-box">
<view class="vinput" @click="goAssess()"> <view class="vinput" @click="goAssess()" v-if="role === 'user'">
<view class="dix"> <view class="dix">
<view class="d-img"> <view class="d-img">
<image src="../../static/my/编组 18@2x.png" mode=""></image> <image src="../../static/my/编组 18@2x.png" mode=""></image>
@ -87,7 +87,7 @@
<uni-icons type="right" size="20" color="#000000"></uni-icons> <uni-icons type="right" size="20" color="#000000"></uni-icons>
</view> </view>
</view> </view>
<view class="vinput" @click="gogogog()"> <view class="vinput" @click="gogogog()" v-if="role === 'user'">
<view class="dix"> <view class="dix">
<view class="d-img"> <view class="d-img">
<image src="../../static/my/编组 19@2x.png" mode=""></image> <image src="../../static/my/编组 19@2x.png" mode=""></image>
@ -109,7 +109,7 @@
<uni-icons type="right" size="20" color="#000000"></uni-icons> <uni-icons type="right" size="20" color="#000000"></uni-icons>
</view> </view>
</view> </view>
<view class="vinput" @click="gosj()"> <view class="vinput" @click="gosj()" v-if="role === 'user'">
<view class="dix"> <view class="dix">
<view class="d-img"> <view class="d-img">
<image src="../../static/my/编组 20@2x.png" mode=""></image> <image src="../../static/my/编组 20@2x.png" mode=""></image>
@ -165,6 +165,7 @@
export default { export default {
data() { data() {
return { return {
role: 'user',
show: false, show: false,
title: '修改昵称', title: '修改昵称',
indicatorDots: false, indicatorDots: false,
@ -187,7 +188,7 @@
} }
}, },
mounted() { mounted() {
this.role = uni.getStorageSync('identity');
}, },
onShow() { onShow() {
console.log('what?', uni.getStorageSync('userInfo')); console.log('what?', uni.getStorageSync('userInfo'));