接口对接
This commit is contained in:
@@ -4,25 +4,29 @@
|
||||
<view class="mine-header" @click="jump('basic')">
|
||||
<image mode="aspectFill" class="mine-header-head" src="/static/head.png" />
|
||||
<view class="mine-header-name hide-txt">
|
||||
<view>灿能物联</view>
|
||||
<view class="tag">{{ roleName }}</view>
|
||||
<view>{{ userInfo.nickname }}</view>
|
||||
<view></view>
|
||||
<view class="tag">{{ roleName }} </view>
|
||||
</view>
|
||||
<image src="/static/erweima.png" style="height: 50rpx;width: 50rpx;border-radius:12rpx"
|
||||
mode="scaleToFill" />
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
<image
|
||||
src="/static/erweima.png"
|
||||
style="height: 50rpx; width: 50rpx; border-radius: 12rpx"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
<uni-icons type="forward" color="#aaa" size="16"></uni-icons>
|
||||
</view>
|
||||
<view class="mine-nav" v-if="userInfo.role == 6" @click="jump('upgrade')">
|
||||
<view class="mine-nav" v-if="userInfo.authorities === 'tourist'" @click="jump('upgrade')">
|
||||
<image mode="aspectFill" class="mine-nav-icon" src="/static/server.png" />
|
||||
<view class="mine-nav-label">角色升级</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="mine-nav" @click="jump('audit')" v-if="userInfo.role == 4">
|
||||
<view class="mine-nav" @click="jump('audit')" v-if="userInfo.authorities === 'app_vip_user'">
|
||||
<image mode="aspectFill" class="mine-nav-icon" src="/static/server.png" />
|
||||
<view class="mine-nav-label">角色审核</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
|
||||
<!-- <view class="mine-nav" @click="jump('user')" v-if="userInfo.role == 4">
|
||||
<!-- <view class="mine-nav" @click="jump('user')" v-if="userInfo.authorities === 'app_vip_user'">
|
||||
<image mode="aspectFill" class="mine-nav-icon" src="/static/subordinate.png" />
|
||||
<view class="mine-nav-label">子用户列表</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
@@ -32,21 +36,35 @@
|
||||
<view class="mine-nav-label">扫一扫</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="mine-nav" @click="jump('gc')"
|
||||
v-if=" userInfo.role == 3 ">
|
||||
<view class="mine-nav" @click="jump('engineering')" v-if="userInfo.authorities === 'engineering_user'">
|
||||
<image mode="aspectFill" class="mine-nav-icon" src="/static/project.png" />
|
||||
<view class="mine-nav-label">工程管理</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="mine-nav" @click="jump('project')"
|
||||
v-if="userInfo.role == 4 || userInfo.role == 3 || userInfo.role == 2">
|
||||
<view
|
||||
class="mine-nav"
|
||||
@click="jump('project')"
|
||||
v-if="
|
||||
userInfo.authorities === 'app_vip_user' ||
|
||||
userInfo.authorities === 'engineering_user' ||
|
||||
userInfo.authorities === 'market_user'
|
||||
"
|
||||
>
|
||||
<image mode="aspectFill" class="mine-nav-icon" src="/static/project.png" />
|
||||
<view class="mine-nav-label">项目管理</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="mine-nav" @click="jump('gateway')"
|
||||
v-if="userInfo.role == 4 || userInfo.role == 3 || userInfo.role == 5 || userInfo.role == 2"
|
||||
style="border-bottom: none; box-shadow: 0 4rpx 8rpx #e7e7e74c;">
|
||||
<view
|
||||
class="mine-nav"
|
||||
@click="jump('gateway')"
|
||||
v-if="
|
||||
userInfo.authorities === 'app_vip_user' ||
|
||||
userInfo.authorities === 'engineering_user' ||
|
||||
userInfo.authorities == 5 ||
|
||||
userInfo.authorities === 'market_user'
|
||||
"
|
||||
style="border-bottom: none; box-shadow: 0 4rpx 8rpx #e7e7e74c"
|
||||
>
|
||||
<image mode="aspectFill" class="mine-nav-icon" src="/static/gateway.png" />
|
||||
<view class="mine-nav-label">网关列表</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
@@ -56,114 +74,119 @@
|
||||
<view class="mine-nav-label">消息配置</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="mine-nav" @click="jump('setup')" style="border-bottom: none; ">
|
||||
<view class="mine-nav" @click="jump('setup')" style="border-bottom: none">
|
||||
<image mode="aspectFill" class="mine-nav-icon" src="/static/setup.png" />
|
||||
<view class="mine-nav-label">设置</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<uni-popup ref="inputDialog" type="dialog">
|
||||
<uni-popup-dialog ref="inputClose" mode="input" title="角色升级" placeholder="请输入六位邀请码"
|
||||
@confirm="upgrade"></uni-popup-dialog>
|
||||
<uni-popup-dialog
|
||||
ref="inputClose"
|
||||
mode="input"
|
||||
title="角色升级"
|
||||
placeholder="请输入六位邀请码"
|
||||
@confirm="upgrade"
|
||||
></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { roleUpdate } from '@/common/api/user'
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
userInfo: {}
|
||||
userInfo: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
roleName () {
|
||||
roleName() {
|
||||
let roleName = ''
|
||||
switch (this.userInfo.role) {
|
||||
case 1:
|
||||
roleName = '运维管理'
|
||||
break
|
||||
case 2:
|
||||
roleName = '专职管理'
|
||||
break
|
||||
case 3:
|
||||
roleName = '工程'
|
||||
break
|
||||
case 4:
|
||||
roleName = '普通用户'
|
||||
break
|
||||
case 5:
|
||||
roleName = '普通用户'
|
||||
break
|
||||
case 6:
|
||||
switch (this.userInfo.authorities) {
|
||||
case 'tourist':
|
||||
roleName = '游客'
|
||||
break
|
||||
case 'engineering_user':
|
||||
roleName = '工程用户'
|
||||
break
|
||||
case 'app_vip_user':
|
||||
roleName = 'VIP用户'
|
||||
break
|
||||
}
|
||||
return roleName
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
init() {
|
||||
this.loading = false
|
||||
},
|
||||
upgrade (code) {
|
||||
console.log(code);
|
||||
uni.showToast({
|
||||
title: '升级成功',
|
||||
icon: 'none'
|
||||
upgrade(code) {
|
||||
console.log(code)
|
||||
roleUpdate({
|
||||
referralCode: code,
|
||||
userId: this.userInfo.userIndex,
|
||||
}).then((res) => {
|
||||
uni.removeStorage('engineering')
|
||||
uni.showToast({
|
||||
title: '升级成功',
|
||||
icon: 'none',
|
||||
})
|
||||
})
|
||||
},
|
||||
jump (type) {
|
||||
jump(type) {
|
||||
switch (type) {
|
||||
case 'scan':
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
console.log('条码类型:' + res.scanType);
|
||||
console.log('条码内容:' + res.result);
|
||||
}
|
||||
});
|
||||
break;
|
||||
console.log('条码类型:' + res.scanType)
|
||||
console.log('条码内容:' + res.result)
|
||||
},
|
||||
})
|
||||
break
|
||||
case 'login':
|
||||
uni.navigateTo({
|
||||
url: `/pages/user/login`
|
||||
url: `/pages/user/login`,
|
||||
})
|
||||
break;
|
||||
break
|
||||
case 'gateway':
|
||||
uni.navigateTo({
|
||||
url: `/pages/gateway/list`
|
||||
url: `/pages/gateway/list`,
|
||||
})
|
||||
break;
|
||||
break
|
||||
case 'upgrade':
|
||||
this.$refs.inputDialog.open()
|
||||
break;
|
||||
break
|
||||
case 'basic':
|
||||
uni.navigateTo({
|
||||
url: `/pages/user/basic`
|
||||
url: `/pages/user/basic`,
|
||||
})
|
||||
break;
|
||||
break
|
||||
case 'project':
|
||||
uni.navigateTo({
|
||||
url: `/pages/project/list`
|
||||
url: `/pages/project/list`,
|
||||
})
|
||||
break;
|
||||
case 'gc':
|
||||
break
|
||||
case 'engineering':
|
||||
uni.navigateTo({
|
||||
url: `/pages/gc/list`
|
||||
url: `/pages/engineering/list`,
|
||||
})
|
||||
break;
|
||||
break
|
||||
default:
|
||||
uni.navigateTo({
|
||||
url: `/pages/mine/${type}`
|
||||
url: `/pages/mine/${type}`,
|
||||
})
|
||||
break;
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
onShow () {
|
||||
onShow() {
|
||||
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
console.log(this.userInfo)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -194,9 +217,20 @@ export default {
|
||||
font-weight: 700;
|
||||
|
||||
.tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #aaa;
|
||||
.engineering-button {
|
||||
margin-left: 10rpx;
|
||||
font-size: 24rpx;
|
||||
padding: 5rpx 12rpx;
|
||||
color: #fff;
|
||||
font-weight: 400;
|
||||
border-radius: 16rpx;
|
||||
background: $uni-theme-blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,4 +258,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user