2023-01-11 16:33:13 +08:00
|
|
|
<template>
|
2023-01-12 10:03:25 +08:00
|
|
|
<view :loading="loading">
|
2023-01-11 16:33:13 +08:00
|
|
|
<view class="mine">
|
|
|
|
|
<view class="mine-header" @click="jump('basic')">
|
2023-08-11 11:03:31 +08:00
|
|
|
<image mode="aspectFill" class="mine-header-head" :src="userInfo.avatar" v-if="userInfo.avatar" />
|
|
|
|
|
<image mode="aspectFill" class="mine-header-head" src="/static/head.png" v-else />
|
2023-01-13 16:32:56 +08:00
|
|
|
<view class="mine-header-name hide-txt">
|
2023-07-03 20:29:24 +08:00
|
|
|
<view>{{ userInfo.nickname }}</view>
|
|
|
|
|
<view></view>
|
|
|
|
|
<view class="tag">{{ roleName }} </view>
|
2023-01-13 16:32:56 +08:00
|
|
|
</view>
|
2023-07-03 20:29:24 +08:00
|
|
|
<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>
|
2023-01-11 16:33:13 +08:00
|
|
|
</view>
|
2023-07-03 20:29:24 +08:00
|
|
|
<view class="mine-nav" v-if="userInfo.authorities === 'tourist'" @click="jump('upgrade')">
|
2023-01-11 16:33:13 +08:00
|
|
|
<image mode="aspectFill" class="mine-nav-icon" src="/static/server.png" />
|
2023-01-13 16:32:56 +08:00
|
|
|
<view class="mine-nav-label">角色升级</view>
|
|
|
|
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
2023-02-28 16:39:58 +08:00
|
|
|
</view>
|
2023-08-10 09:18:17 +08:00
|
|
|
<!-- <view class="mine-nav" @click="jump('audit')" v-if="userInfo.authorities === 'app_vip_user'">
|
2023-02-28 16:39:58 +08:00
|
|
|
<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>
|
2023-08-10 09:18:17 +08:00
|
|
|
</view> -->
|
2023-02-15 16:32:21 +08:00
|
|
|
|
2023-07-03 20:29:24 +08:00
|
|
|
<!-- <view class="mine-nav" @click="jump('user')" v-if="userInfo.authorities === 'app_vip_user'">
|
2023-02-09 08:50:01 +08:00
|
|
|
<image mode="aspectFill" class="mine-nav-icon" src="/static/subordinate.png" />
|
|
|
|
|
<view class="mine-nav-label">子用户列表</view>
|
2023-01-11 16:33:13 +08:00
|
|
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
2023-02-20 14:19:28 +08:00
|
|
|
</view> -->
|
2023-08-10 09:18:17 +08:00
|
|
|
<view
|
|
|
|
|
class="mine-nav"
|
|
|
|
|
@click="jump('scan')"
|
|
|
|
|
v-if="userInfo.authorities === 'app_vip_user' || userInfo.authorities === 'engineering_user'"
|
|
|
|
|
>
|
2023-02-23 08:44:46 +08:00
|
|
|
<image mode="aspectFill" class="mine-nav-icon" src="/static/scan.png" />
|
|
|
|
|
<view class="mine-nav-label">扫一扫</view>
|
|
|
|
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
|
|
|
|
</view>
|
2023-07-31 09:00:30 +08:00
|
|
|
<view class="mine-nav" @click="jump('engineering')">
|
2023-04-12 09:10:35 +08:00
|
|
|
<image mode="aspectFill" class="mine-nav-icon" src="/static/project.png" />
|
2023-08-10 09:18:17 +08:00
|
|
|
<view class="mine-nav-label">工程列表</view>
|
|
|
|
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
|
|
|
|
</view>
|
2023-08-11 11:03:31 +08:00
|
|
|
<view
|
|
|
|
|
class="mine-nav"
|
|
|
|
|
@click="jump('engineering/setting')"
|
|
|
|
|
v-if="userInfo.authorities === 'engineering_user'"
|
|
|
|
|
>
|
2023-08-10 09:18:17 +08:00
|
|
|
<image mode="aspectFill" class="mine-nav-icon" src="/static/like.png" />
|
|
|
|
|
<view class="mine-nav-label">关注工程配置</view>
|
2023-04-12 09:10:35 +08:00
|
|
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
|
|
|
|
</view>
|
2023-07-31 09:00:30 +08:00
|
|
|
<view class="mine-nav" @click="jump('project')">
|
2023-02-20 14:19:28 +08:00
|
|
|
<image mode="aspectFill" class="mine-nav-icon" src="/static/project.png" />
|
2023-08-10 09:18:17 +08:00
|
|
|
<view class="mine-nav-label">项目列表</view>
|
2023-02-15 16:32:21 +08:00
|
|
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
|
|
|
|
</view>
|
2023-08-02 09:10:45 +08:00
|
|
|
<!-- <view
|
2023-07-03 20:29:24 +08:00
|
|
|
class="mine-nav"
|
|
|
|
|
@click="jump('gateway')"
|
|
|
|
|
style="border-bottom: none; box-shadow: 0 4rpx 8rpx #e7e7e74c"
|
|
|
|
|
>
|
2023-02-07 17:59:54 +08:00
|
|
|
<image mode="aspectFill" class="mine-nav-icon" src="/static/gateway.png" />
|
|
|
|
|
<view class="mine-nav-label">网关列表</view>
|
2023-02-06 13:34:15 +08:00
|
|
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
2023-08-02 09:10:45 +08:00
|
|
|
</view> -->
|
2023-02-22 08:43:52 +08:00
|
|
|
<view class="mine-nav" @click="jump('setupMessage')">
|
2023-02-28 16:39:58 +08:00
|
|
|
<image mode="aspectFill" class="mine-nav-icon" src="/static/message4.png" />
|
2023-02-22 08:43:52 +08:00
|
|
|
<view class="mine-nav-label">消息配置</view>
|
|
|
|
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
|
|
|
|
</view>
|
2023-07-03 20:29:24 +08:00
|
|
|
<view class="mine-nav" @click="jump('setup')" style="border-bottom: none">
|
2023-01-11 16:33:13 +08:00
|
|
|
<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>
|
2023-01-13 16:32:56 +08:00
|
|
|
<uni-popup ref="inputDialog" type="dialog">
|
2023-07-03 20:29:24 +08:00
|
|
|
<uni-popup-dialog
|
|
|
|
|
ref="inputClose"
|
|
|
|
|
mode="input"
|
|
|
|
|
title="角色升级"
|
|
|
|
|
placeholder="请输入六位邀请码"
|
|
|
|
|
@confirm="upgrade"
|
|
|
|
|
></uni-popup-dialog>
|
2023-01-13 16:32:56 +08:00
|
|
|
</uni-popup>
|
2023-01-11 16:33:13 +08:00
|
|
|
</view>
|
2023-01-12 10:03:25 +08:00
|
|
|
</view>
|
2023-01-11 16:33:13 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2023-07-03 20:29:24 +08:00
|
|
|
import { roleUpdate } from '@/common/api/user'
|
2023-07-31 09:00:30 +08:00
|
|
|
import { transferDevice } from '@/common/api/device'
|
2023-08-11 11:03:31 +08:00
|
|
|
|
2023-01-11 16:33:13 +08:00
|
|
|
export default {
|
2023-07-03 20:29:24 +08:00
|
|
|
data() {
|
2023-01-11 16:33:13 +08:00
|
|
|
return {
|
2023-02-09 08:50:01 +08:00
|
|
|
loading: true,
|
2023-07-03 20:29:24 +08:00
|
|
|
userInfo: {},
|
2023-01-11 16:33:13 +08:00
|
|
|
}
|
|
|
|
|
},
|
2023-02-09 08:50:01 +08:00
|
|
|
computed: {
|
2023-07-03 20:29:24 +08:00
|
|
|
roleName() {
|
2023-02-09 08:50:01 +08:00
|
|
|
let roleName = ''
|
2023-07-03 20:29:24 +08:00
|
|
|
switch (this.userInfo.authorities) {
|
|
|
|
|
case 'tourist':
|
|
|
|
|
roleName = '游客'
|
2023-02-09 08:50:01 +08:00
|
|
|
break
|
2023-07-03 20:29:24 +08:00
|
|
|
case 'engineering_user':
|
|
|
|
|
roleName = '工程用户'
|
2023-02-09 08:50:01 +08:00
|
|
|
break
|
2023-07-03 20:29:24 +08:00
|
|
|
case 'app_vip_user':
|
|
|
|
|
roleName = 'VIP用户'
|
2023-02-28 16:39:58 +08:00
|
|
|
break
|
2023-07-31 09:00:30 +08:00
|
|
|
case 'market_user':
|
|
|
|
|
roleName = '营销用户'
|
|
|
|
|
break
|
|
|
|
|
case 'operation_manager':
|
|
|
|
|
roleName = '运维管理员'
|
|
|
|
|
break
|
2023-02-09 08:50:01 +08:00
|
|
|
}
|
|
|
|
|
return roleName
|
2023-07-03 20:29:24 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
this.init()
|
2023-02-09 08:50:01 +08:00
|
|
|
},
|
2023-01-11 16:33:13 +08:00
|
|
|
methods: {
|
2023-08-11 11:03:31 +08:00
|
|
|
init() {},
|
2023-07-03 20:29:24 +08:00
|
|
|
upgrade(code) {
|
|
|
|
|
console.log(code)
|
|
|
|
|
roleUpdate({
|
|
|
|
|
referralCode: code,
|
|
|
|
|
userId: this.userInfo.userIndex,
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
uni.removeStorage('engineering')
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '升级成功',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
})
|
2023-07-10 20:20:00 +08:00
|
|
|
// 重新登录
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
url: '/pages/user/login',
|
|
|
|
|
})
|
2023-01-13 16:32:56 +08:00
|
|
|
})
|
|
|
|
|
},
|
2023-07-03 20:29:24 +08:00
|
|
|
jump(type) {
|
2023-01-11 16:33:13 +08:00
|
|
|
switch (type) {
|
2023-02-23 08:44:46 +08:00
|
|
|
case 'scan':
|
|
|
|
|
uni.scanCode({
|
2023-07-31 09:00:30 +08:00
|
|
|
success: (res) => {
|
2023-07-03 20:29:24 +08:00
|
|
|
console.log('条码类型:' + res.scanType)
|
|
|
|
|
console.log('条码内容:' + res.result)
|
2023-07-31 09:00:30 +08:00
|
|
|
let content = JSON.parse(res.result)
|
|
|
|
|
switch (content.type) {
|
|
|
|
|
case 'transferDevice':
|
2023-08-10 09:18:17 +08:00
|
|
|
this.transferDevice(content.id.split(','))
|
2023-07-31 09:00:30 +08:00
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
2023-07-03 20:29:24 +08:00
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
break
|
2023-01-11 16:33:13 +08:00
|
|
|
case 'login':
|
|
|
|
|
uni.navigateTo({
|
2023-07-03 20:29:24 +08:00
|
|
|
url: `/pages/user/login`,
|
2023-01-11 16:33:13 +08:00
|
|
|
})
|
2023-07-03 20:29:24 +08:00
|
|
|
break
|
2023-02-07 17:59:54 +08:00
|
|
|
case 'gateway':
|
|
|
|
|
uni.navigateTo({
|
2023-07-03 20:29:24 +08:00
|
|
|
url: `/pages/gateway/list`,
|
2023-02-07 17:59:54 +08:00
|
|
|
})
|
2023-07-03 20:29:24 +08:00
|
|
|
break
|
2023-01-13 16:32:56 +08:00
|
|
|
case 'upgrade':
|
|
|
|
|
this.$refs.inputDialog.open()
|
2023-07-03 20:29:24 +08:00
|
|
|
break
|
2023-02-10 16:32:41 +08:00
|
|
|
case 'basic':
|
|
|
|
|
uni.navigateTo({
|
2023-07-03 20:29:24 +08:00
|
|
|
url: `/pages/user/basic`,
|
2023-02-10 16:32:41 +08:00
|
|
|
})
|
2023-07-03 20:29:24 +08:00
|
|
|
break
|
2023-02-20 14:19:28 +08:00
|
|
|
case 'project':
|
|
|
|
|
uni.navigateTo({
|
2023-07-03 20:29:24 +08:00
|
|
|
url: `/pages/project/list`,
|
2023-02-20 14:19:28 +08:00
|
|
|
})
|
2023-07-03 20:29:24 +08:00
|
|
|
break
|
|
|
|
|
case 'engineering':
|
2023-04-12 09:10:35 +08:00
|
|
|
uni.navigateTo({
|
2023-07-03 20:29:24 +08:00
|
|
|
url: `/pages/engineering/list`,
|
2023-04-12 09:10:35 +08:00
|
|
|
})
|
2023-07-03 20:29:24 +08:00
|
|
|
break
|
2023-08-10 09:18:17 +08:00
|
|
|
case 'engineering/setting':
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/engineering/setting`,
|
|
|
|
|
})
|
|
|
|
|
break
|
2023-01-11 16:33:13 +08:00
|
|
|
default:
|
|
|
|
|
uni.navigateTo({
|
2023-07-03 20:29:24 +08:00
|
|
|
url: `/pages/mine/${type}`,
|
2023-01-11 16:33:13 +08:00
|
|
|
})
|
2023-07-03 20:29:24 +08:00
|
|
|
break
|
2023-01-11 16:33:13 +08:00
|
|
|
}
|
2023-07-03 20:29:24 +08:00
|
|
|
},
|
2023-07-31 09:00:30 +08:00
|
|
|
transferDevice(id) {
|
|
|
|
|
transferDevice(id).then((res) => {
|
|
|
|
|
uni.navigateTo({ url: '/pages/mine/result?type=transferDevice&id=' + id })
|
|
|
|
|
})
|
|
|
|
|
},
|
2023-01-11 16:33:13 +08:00
|
|
|
},
|
2023-07-03 20:29:24 +08:00
|
|
|
onShow() {
|
2023-02-09 08:50:01 +08:00
|
|
|
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
2023-08-11 11:03:31 +08:00
|
|
|
this.loading = false
|
2023-01-11 16:33:13 +08:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.mine {
|
|
|
|
|
.mine-header {
|
|
|
|
|
padding: 200rpx 34rpx 34rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
background: $uni-theme-white;
|
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
|
box-shadow: 0 4rpx 8rpx #e7e7e74c;
|
|
|
|
|
|
|
|
|
|
.mine-header-head {
|
|
|
|
|
margin-right: 30rpx;
|
|
|
|
|
height: 128rpx;
|
|
|
|
|
width: 128rpx;
|
|
|
|
|
border-radius: $uni-theme-radius;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mine-header-name {
|
|
|
|
|
margin-right: 30rpx;
|
|
|
|
|
flex: 1;
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
color: #111;
|
|
|
|
|
font-weight: 700;
|
2023-01-13 16:32:56 +08:00
|
|
|
|
|
|
|
|
.tag {
|
2023-07-03 20:29:24 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2023-01-13 16:32:56 +08:00
|
|
|
margin-top: 10rpx;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: #aaa;
|
2023-07-03 20:29:24 +08:00
|
|
|
.engineering-button {
|
|
|
|
|
margin-left: 10rpx;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
padding: 5rpx 12rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
border-radius: 16rpx;
|
2023-08-03 14:51:36 +08:00
|
|
|
background: $uni-theme-color;
|
2023-07-03 20:29:24 +08:00
|
|
|
}
|
2023-01-13 16:32:56 +08:00
|
|
|
}
|
2023-01-11 16:33:13 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mine-nav {
|
2023-02-22 08:43:52 +08:00
|
|
|
padding: 34rpx;
|
2023-01-11 16:33:13 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
background: $uni-theme-white;
|
|
|
|
|
border-bottom: 1rpx solid #e8e8e8;
|
|
|
|
|
|
|
|
|
|
&-icon {
|
|
|
|
|
margin-right: 30rpx;
|
|
|
|
|
height: 44rpx;
|
|
|
|
|
width: 44rpx;
|
|
|
|
|
border-radius: $uni-theme-radius;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&-label {
|
|
|
|
|
margin-right: 30rpx;
|
|
|
|
|
flex: 1;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #111;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-03 20:29:24 +08:00
|
|
|
</style>
|