接口对接
This commit is contained in:
8
.prettierrc
Normal file
8
.prettierrc
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"tabWidth": 4,
|
||||
"printWidth": 120,
|
||||
"useTabs": false,
|
||||
"semi": false
|
||||
}
|
||||
12
App.vue
12
App.vue
@@ -8,7 +8,7 @@ import mqtt from 'mqtt/dist/mqtt.js'
|
||||
export default {
|
||||
methods: {
|
||||
connect () {
|
||||
MQTT_OPTIONS.clientId = uni.getStorageSync('cidAES')
|
||||
MQTT_OPTIONS.clientId = uni.getStorageSync('devCode')
|
||||
var that = this
|
||||
let client = mqtt.connect('ws://' + MQTT_IP, MQTT_OPTIONS)
|
||||
client.on('connect', function () {
|
||||
@@ -32,15 +32,15 @@ export default {
|
||||
},
|
||||
onLaunch: function () {
|
||||
// this.connect()
|
||||
let cidAES = uni.getStorageSync('cidAES') || 'nnvmhMk8626D8QHhJefm+W9rTAJWuBPRxcnRm4+9bWXdSLRIyTnTruoYfLxGK3Oy'
|
||||
uni.setStorageSync('cidAES', cidAES);
|
||||
if (!cidAES) {
|
||||
let devCode = uni.getStorageSync('devCode') || 'nnvmhMk8626D8QHhJefm+W9rTAJWuBPRxcnRm4+9bWXdSLRIyTnTruoYfLxGK3Oy'
|
||||
uni.setStorageSync('devCode', devCode);
|
||||
if (!devCode) {
|
||||
document.addEventListener('plusready', () => {
|
||||
// 页面加载时触发
|
||||
let pinf = plus.push.getClientInfo();
|
||||
let cid = pinf.clientid;//客户端标识
|
||||
cidAES = encrypt.Encrypt(cid, this.$config.key);
|
||||
uni.setStorageSync('cidAES', cidAES);
|
||||
devCode = encrypt.Encrypt(cid, this.$config.key);
|
||||
uni.setStorageSync('devCode', devCode);
|
||||
}, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import config from '../js/config';
|
||||
// 获取设备
|
||||
export function getDeviceList(params) {
|
||||
return request({
|
||||
url: '/EquipmentDelivery/queryEquipmentByProject',
|
||||
url: '/cs-device-boot/EquipmentDelivery/queryEquipmentByProject',
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import config from '../js/config';
|
||||
|
||||
export function addEngineering(params) {
|
||||
return request({
|
||||
url: '/engineering/addEngineering',
|
||||
url: '/cs-device-boot/engineering/addEngineering',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
@@ -15,7 +15,7 @@ export function addEngineering(params) {
|
||||
|
||||
export function auditEngineering(params) {
|
||||
return request({
|
||||
url: '/engineering/auditEngineering',
|
||||
url: '/cs-device-boot/engineering/auditEngineering',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
@@ -26,7 +26,7 @@ export function auditEngineering(params) {
|
||||
|
||||
export function queryEngineering(params) {
|
||||
return request({
|
||||
url: '/engineering/queryEngineering',
|
||||
url: '/cs-device-boot/engineering/queryEngineering',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
@@ -11,10 +11,10 @@ export function addFeedBack(params) {
|
||||
let data = JSON.parse(JSON.stringify(params));
|
||||
delete data.files
|
||||
return uni.uploadFile({
|
||||
url: config.domain + '/feedback/addFeedBack', //仅为示例,非真实的接口地址
|
||||
url: config.domain + '/cs-device-boot/feedback/addFeedBack', //仅为示例,非真实的接口地址
|
||||
files: files,
|
||||
header: {
|
||||
Authorization: '12',
|
||||
Authorization: uni.getStorageSync('access_token'),
|
||||
},
|
||||
formData: data,
|
||||
});
|
||||
@@ -27,7 +27,7 @@ export function addFeedBack(params) {
|
||||
*/
|
||||
export function queryFeedBackDetail(id) {
|
||||
return request({
|
||||
url: '/feedback/queryFeedBackDetail',
|
||||
url: '/cs-device-boot/feedback/queryFeedBackDetail',
|
||||
method: 'post',
|
||||
data: {
|
||||
id,
|
||||
@@ -38,7 +38,7 @@ export function queryFeedBackDetail(id) {
|
||||
// 问题列表
|
||||
export function queryFeedBackPage(params) {
|
||||
return request({
|
||||
url: '/feedback/queryFeedBackPage',
|
||||
url: '/cs-device-boot/feedback/queryFeedBackPage',
|
||||
method: 'post',
|
||||
data: {
|
||||
pageNum: 1,
|
||||
@@ -58,7 +58,7 @@ export function queryFeedBackPage(params) {
|
||||
*/
|
||||
export function AddFeedbackChat(params) {
|
||||
return request({
|
||||
url: '/feedbackChat/AddFeedbackChat',
|
||||
url: '/cs-device-boot/feedbackChat/AddFeedbackChat',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
@@ -77,7 +77,7 @@ export function AddFeedbackChat(params) {
|
||||
*/
|
||||
export function updateChatStatus(params) {
|
||||
return request({
|
||||
url: '/feedbackChat/updateChatStatus',
|
||||
url: '/cs-device-boot/feedbackChat/updateChatStatus',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import request from '../js/request';
|
||||
import config from '../js/config';
|
||||
import request from '../js/request'
|
||||
import config from '../js/config'
|
||||
|
||||
export function queryPersonSet() {
|
||||
return request({
|
||||
url: '/appinfo/queryPersonSet',
|
||||
method: 'post',
|
||||
data: {},
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
export function queryAppInfo(id) {
|
||||
@@ -16,5 +16,6 @@ export function queryAppInfo(id) {
|
||||
data: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ import config from '../js/config'
|
||||
|
||||
export function addAppProject(params, files) {
|
||||
return uni.uploadFile({
|
||||
url: config.domain + '/project/addAppProject', //仅为示例,非真实的接口地址
|
||||
url: config.domain + '/cs-device-boot/project/addAppProject', //仅为示例,非真实的接口地址
|
||||
files: files,
|
||||
header: {
|
||||
Authorization: '12',
|
||||
Authorization: uni.getStorageSync('access_token'),
|
||||
},
|
||||
formData: params,
|
||||
})
|
||||
@@ -14,7 +14,7 @@ export function addAppProject(params, files) {
|
||||
|
||||
export function getProjectList(params) {
|
||||
return request({
|
||||
url: '/project/queryProject',
|
||||
url: '/cs-device-boot/project/queryProject',
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
@@ -36,7 +36,7 @@ export function queryTopologyDiagramPage(params) {
|
||||
projectId: '',
|
||||
searchValue: '',
|
||||
},
|
||||
params
|
||||
params,
|
||||
),
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -67,14 +67,15 @@ export function addAppTopologyDiagram(params, filePath) {
|
||||
filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
Authorization: '12',
|
||||
Authorization: uni.getStorageSync('access_token'),
|
||||
},
|
||||
formData: Object.assign(
|
||||
{
|
||||
topologyDiagramName: '',
|
||||
projectId: '',
|
||||
},
|
||||
params
|
||||
params,
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ export function apiGetYms(params) {
|
||||
url: '/user-boot/appUser/authCode',
|
||||
data: {
|
||||
phone: params.phone,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
devCode: uni.getStorageSync('devCode'),
|
||||
type: params.type,
|
||||
},
|
||||
method: 'POST',
|
||||
@@ -23,12 +23,12 @@ export function apiGetYms(params) {
|
||||
* @returns
|
||||
*/
|
||||
export function apiLogin(params) {
|
||||
console.log(uni.getStorageSync('cidAES'))
|
||||
console.log(uni.getStorageSync('devCode'))
|
||||
return request({
|
||||
url: '/shiningCloud/user/login',
|
||||
data: {
|
||||
phone: params.phone,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
devCode: uni.getStorageSync('devCode'),
|
||||
key: params.key.trim(),
|
||||
type: params.type,
|
||||
},
|
||||
@@ -42,9 +42,9 @@ export function apiLogin(params) {
|
||||
* @returns
|
||||
*/
|
||||
export function apiYsmLogin(params) {
|
||||
uni.setStorageSync('token', 'Basic bmpjbmFwcDpuamNucHFz')
|
||||
uni.setStorageSync('access_token', 'Basic bmpjbmFwcDpuamNucHFz')
|
||||
return request({
|
||||
url: '/pas-auth/oauth/token',
|
||||
url: '/pqs-auth/oauth/token',
|
||||
data: {
|
||||
grant_type: 'sms_code',
|
||||
phone: params.phone,
|
||||
@@ -64,7 +64,7 @@ export function apiRegister(params) {
|
||||
url: '/user-boot/appUser/register',
|
||||
data: {
|
||||
phone: params.phone,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
devCode: uni.getStorageSync('devCode'),
|
||||
code: params.code.trim(),
|
||||
},
|
||||
method: 'POST',
|
||||
@@ -81,7 +81,7 @@ export function autoLogin(phone) {
|
||||
url: '/user-boot/appUser/autoLogin',
|
||||
data: {
|
||||
phone: phone,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
devCode: uni.getStorageSync('devCode'),
|
||||
},
|
||||
method: 'POST',
|
||||
})
|
||||
@@ -93,7 +93,7 @@ export function apiSetPsd(params) {
|
||||
url: '/shiningCloud/user/setPsd',
|
||||
data: {
|
||||
userId: uni.getStorageSync('userInfo').userId,
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
devCode: uni.getStorageSync('devCode'),
|
||||
password: params.password.trim(),
|
||||
},
|
||||
method: 'POST',
|
||||
@@ -107,7 +107,7 @@ export function apiReSetPsd(params) {
|
||||
data: {
|
||||
phone: params.phone,
|
||||
code: params.code.trim(),
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
devCode: uni.getStorageSync('devCode'),
|
||||
password: params.password.trim(),
|
||||
},
|
||||
method: 'POST',
|
||||
@@ -119,7 +119,7 @@ export function apiComfirmCode(params) {
|
||||
return request({
|
||||
url: '/shiningCloud/user/comfirmCode',
|
||||
data: {
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
devCode: uni.getStorageSync('devCode'),
|
||||
phone: params.phone,
|
||||
code: params.code.trim(),
|
||||
},
|
||||
@@ -132,7 +132,7 @@ export function apiRebindPhone(params) {
|
||||
return request({
|
||||
url: '/shiningCloud/user/rebindPhone',
|
||||
data: {
|
||||
devCode: uni.getStorageSync('cidAES'),
|
||||
devCode: uni.getStorageSync('devCode'),
|
||||
userId: uni.getStorageSync('userInfo').userId,
|
||||
phoneNew: params.phone,
|
||||
code: params.code.trim(),
|
||||
@@ -140,3 +140,16 @@ export function apiRebindPhone(params) {
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
// 角色升级
|
||||
export function roleUpdate({ userId, referralCode }) {
|
||||
return request({
|
||||
url: '/user-boot/appRole/roleUpdate',
|
||||
method: 'post',
|
||||
data: {
|
||||
devCode: uni.getStorageSync('devCode'),
|
||||
referralCode,
|
||||
userId,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
export default {
|
||||
config: 'config', // 全剧配置
|
||||
userInfo: 'userInfo', // 用户信息
|
||||
engineering: 'engineering', // 工程信息
|
||||
access_token: 'access_token', // token
|
||||
refresh_token: 'refresh_token', // 刷新token
|
||||
}
|
||||
@@ -25,7 +25,7 @@ export default (options = {}) => {
|
||||
header: {
|
||||
// 'Content-Type': 'application/json;charset=UTF-8',
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Authorization: uni.getStorageSync('token'),
|
||||
Authorization: uni.getStorageSync('access_token'),
|
||||
...options.header,
|
||||
},
|
||||
method: options.method || 'GET',
|
||||
@@ -63,17 +63,22 @@ export default (options = {}) => {
|
||||
* @param {Number} code 错误码
|
||||
*/
|
||||
function errHandler(res) {
|
||||
switch (res.resultCode) {
|
||||
switch (res.code) {
|
||||
case '401':
|
||||
// #ifdef MP
|
||||
uni.removeStorageSync('Cookie')
|
||||
uni.clearStorageSync()
|
||||
// #endif
|
||||
uni.reLaunch({ url: '/pages/user/login' })
|
||||
break
|
||||
case 'A0202':
|
||||
// #ifdef MP
|
||||
uni.clearStorageSync()
|
||||
// #endif
|
||||
uni.reLaunch({ url: '/pages/user/login' })
|
||||
break
|
||||
default:
|
||||
uni.showToast({
|
||||
title: res.message || res.msg || '服务端未知错误',
|
||||
title: res.message || res.msg || '网络异常,请稍后再试',
|
||||
duration: 2000,
|
||||
icon: 'none',
|
||||
})
|
||||
|
||||
@@ -298,19 +298,19 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/gc/new",
|
||||
"path": "pages/engineering/new",
|
||||
"style": {
|
||||
"navigationBarTitleText": "新增工程"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/gc/list",
|
||||
"path": "pages/engineering/list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工程列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/gc/detail",
|
||||
"path": "pages/engineering/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工程详情"
|
||||
}
|
||||
|
||||
@@ -217,8 +217,8 @@ export default {
|
||||
},
|
||||
init () {
|
||||
let userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
console.log(userInfo.role);
|
||||
switch (userInfo.role) {
|
||||
console.log(userInfo.authorities);
|
||||
switch (userInfo.authorities) {
|
||||
case 1:
|
||||
this.content.splice(0, 1)
|
||||
this.content.splice(0, 0, {
|
||||
|
||||
@@ -119,8 +119,8 @@ export default {
|
||||
},
|
||||
init () {
|
||||
let userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
console.log(userInfo.role);
|
||||
switch (userInfo.role) {
|
||||
console.log(userInfo.authorities);
|
||||
switch (userInfo.authorities) {
|
||||
case 1:
|
||||
this.content.splice(0, 0, {
|
||||
iconPath: '/static/version.png',
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<view class="detail">
|
||||
<view class="header">
|
||||
<view class="header-title"
|
||||
>{{ gc.name }}
|
||||
>{{ engineering.name }}
|
||||
<!-- <view class="header-title-extra">用能</view> -->
|
||||
</view>
|
||||
<view class="header-des-mini mb10">{{ gc.provinceName + gc.cityName }} {{ gc.createTime }}</view>
|
||||
<view class="header-des">{{ gc.description }} </view>
|
||||
<view class="header-des-mini mb10">{{ engineering.provinceName + engineering.cityName }} {{ engineering.createTime }}</view>
|
||||
<view class="header-des">{{ engineering.description }} </view>
|
||||
</view>
|
||||
<view class="nav">
|
||||
<view
|
||||
@@ -70,7 +70,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
gc: '',
|
||||
engineering: '',
|
||||
navMenuList: [
|
||||
{
|
||||
text: '项目',
|
||||
@@ -128,20 +128,20 @@ export default {
|
||||
})
|
||||
},
|
||||
init() {
|
||||
this.store = this.DataSource('/project/queryProject')
|
||||
this.store.params.engineeringId = this.gc.id
|
||||
this.store = this.DataSource('/cs-device-boot/project/queryProject')
|
||||
this.store.params.engineeringId = this.engineering.id
|
||||
this.store.reload()
|
||||
},
|
||||
},
|
||||
onLoad(option) {
|
||||
this.gc = JSON.parse(option.gc)
|
||||
this.engineering = JSON.parse(option.engineering)
|
||||
let userInfo = uni.getStorageSync('userInfo')
|
||||
if (userInfo.role == '3') {
|
||||
if (userInfo.authorities == '3') {
|
||||
this.content.push({
|
||||
iconPath: '/static/transfer.png',
|
||||
text: '移交',
|
||||
})
|
||||
} else if (userInfo.role == '4') {
|
||||
} else if (userInfo.authorities == '4') {
|
||||
this.content.push({
|
||||
iconPath: '/static/share.png',
|
||||
text: '分享',
|
||||
@@ -157,7 +157,7 @@ export default {
|
||||
.exec()
|
||||
}, 1000)
|
||||
this.init()
|
||||
// uni.setNavigationBarTitle({ title: this.gc })
|
||||
// uni.setNavigationBarTitle({ title: this.engineering })
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -6,7 +6,7 @@
|
||||
:fixed="true"
|
||||
status-bar
|
||||
left-icon="left"
|
||||
:rightIcon="userInfo.role == '2' ? '' : 'plusempty'"
|
||||
:rightIcon="userInfo.authorities == '2' ? '' : 'plusempty'"
|
||||
background-color="#fff"
|
||||
color="#111"
|
||||
title="工程管理"
|
||||
@@ -14,7 +14,13 @@
|
||||
@clickRight="add"
|
||||
/>
|
||||
<view class="message">
|
||||
<uni-card :title="item.name" :extra="item.projectType" @click="jump(item)" v-for="(item, index) in store.data" :key="index">
|
||||
<uni-card
|
||||
:title="item.name"
|
||||
:extra="item.projectType"
|
||||
@click="jump(item)"
|
||||
v-for="(item, index) in store.data"
|
||||
:key="index"
|
||||
>
|
||||
<view class="term-list-bottom">
|
||||
<view class="term-list-bottom-item">
|
||||
<view>区域</view>
|
||||
@@ -44,16 +50,22 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.store = this.DataSource('/engineering/queryEngineeringPage')
|
||||
this.store = this.DataSource('/cs-device-boot/engineering/queryEngineeringPage')
|
||||
this.store.params.userId = uni.getStorageSync('userInfo').id
|
||||
this.store.reload()
|
||||
this.store.firstCallBack = (res) => {
|
||||
let engineering = uni.getStorageSync('engineering')
|
||||
if (!engineering) {
|
||||
uni.setStorageSync('engineering',this.store.data[0])
|
||||
}
|
||||
}
|
||||
},
|
||||
back() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
add() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/gc/new`,
|
||||
url: `/pages/engineering/new`,
|
||||
})
|
||||
},
|
||||
upgrade(code) {
|
||||
@@ -63,9 +75,9 @@ export default {
|
||||
icon: 'none',
|
||||
})
|
||||
},
|
||||
jump(gc) {
|
||||
jump(engineering) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/gc/detail?gc=${JSON.stringify(gc)}`,
|
||||
url: `/pages/engineering/detail?engineering=${JSON.stringify(engineering)}`,
|
||||
})
|
||||
},
|
||||
},
|
||||
@@ -29,7 +29,7 @@
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import { addEngineering } from '../../common/api/gc'
|
||||
import { addEngineering } from '../../common/api/engineering'
|
||||
import area from '../../common/js/area.json'
|
||||
export default {
|
||||
data() {
|
||||
@@ -15,7 +15,7 @@
|
||||
<text class="ml20">版本号:v1.0.0</text>
|
||||
</view>
|
||||
<view class="title mb20 m340">设备列表
|
||||
<view class="footer-btn" v-if="userInfo.role != '2' && userInfo.role != '5'" @click="newDevice">注册设备
|
||||
<view class="footer-btn" v-if="userInfo.authorities != '2' && userInfo.authorities != '5'" @click="newDevice">注册设备
|
||||
</view>
|
||||
</view>
|
||||
<uni-card :title="'设备' + item" :sub-title="'XXX项目1'" extra="用能" v-for="item in 2" :key="item"
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<template>
|
||||
<Cn-page :loading='loading'>
|
||||
<view slot='body'>
|
||||
<view class='index' :class="{ 'device': userInfo.role == '5' || userInfo.role == '2' }">
|
||||
<view class='index' :class="{ 'device': userInfo.authorities == '5' || userInfo.authorities == '2' }">
|
||||
<uni-card title="监测网关" sub-title="监测" @click="look" thumbnail="/static/gateway.png"
|
||||
:padding="userInfo.role == '5' || userInfo.role == '2' ? 0 : '10px'">
|
||||
<view class="footer" v-if="userInfo.role != 5 && userInfo.role != 2">
|
||||
:padding="userInfo.authorities == '5' || userInfo.authorities == '2' ? 0 : '10px'">
|
||||
<view class="footer" v-if="userInfo.authorities != 5 && userInfo.authorities != 2">
|
||||
<text style="flex:1"> </text>
|
||||
<view class="footer-btn" @click.stop="newDevice">注册设备</view>
|
||||
<view class="footer-btn ml20">查看</view>
|
||||
</view>
|
||||
</uni-card>
|
||||
<uni-card title="用能网关" sub-title="用能" @click="look" thumbnail="/static/gateway.png"
|
||||
:padding="userInfo.role == '5' || userInfo.role == '2' ? 0 : '10px'">
|
||||
<view class="footer" v-if="userInfo.role != 5 && userInfo.role != 2">
|
||||
:padding="userInfo.authorities == '5' || userInfo.authorities == '2' ? 0 : '10px'">
|
||||
<view class="footer" v-if="userInfo.authorities != 5 && userInfo.authorities != 2">
|
||||
<text style="flex:1"> </text>
|
||||
<view class="footer-btn" @click.stop="newDevice">注册设备</view>
|
||||
<view class="footer-btn ml20">查看</view>
|
||||
|
||||
283
pages/index/comp/device.vue
Normal file
283
pages/index/comp/device.vue
Normal file
@@ -0,0 +1,283 @@
|
||||
<template>
|
||||
<view class="device">
|
||||
<view class="nav">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.engineeringName }" @click="openDrawer"
|
||||
>{{ select.engineeringName || '工程' }}
|
||||
</view>
|
||||
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectList" range-key="text" v-if="engineeringList.length">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }"
|
||||
>{{ select.projectName || '项目' }}
|
||||
</view>
|
||||
</picker>
|
||||
<!-- <picker @change="projectTypeChange" :value="select.projectTypeIndex" :range="projectType" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectType }"
|
||||
>{{ select.projectType || '类型' }}
|
||||
</view>
|
||||
</picker> -->
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: minHeight }">
|
||||
<uni-card
|
||||
:title="item.equipmentName"
|
||||
:sub-title="item.projectName"
|
||||
:extra="item.projectType"
|
||||
padding="0"
|
||||
v-for="(item, index) in deviceListFilter"
|
||||
:key="index"
|
||||
@click="jump(item)"
|
||||
thumbnail="/static/device.png"
|
||||
>
|
||||
<!-- <text>{{ item.project }} {{ item.type }}</text> -->
|
||||
</uni-card>
|
||||
<Cn-empty v-if="store.empty || deviceListFilter.length == 0"></Cn-empty>
|
||||
<uni-load-more
|
||||
v-if="deviceListFilter && deviceListFilter.length > 0"
|
||||
:status="store.status"
|
||||
></uni-load-more>
|
||||
</view>
|
||||
<uni-drawer ref="showRight" mode="right" :mask-click="false" :width="375">
|
||||
<uni-indexed-list
|
||||
:options="engineeringListFilter"
|
||||
:showSelect="false"
|
||||
@click="closeDrawer"
|
||||
></uni-indexed-list>
|
||||
</uni-drawer>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { getProjectList } from '@/common/api/project'
|
||||
import { queryDictData } from '@/common/api/dictionary'
|
||||
import { queryEngineering } from '@/common/api/engineering.js'
|
||||
import { pinyin } from 'pinyin-pro'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
store: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
select: {
|
||||
projectName: '',
|
||||
projectNameIndex: 0,
|
||||
projectType: '',
|
||||
projectTypeIndex: 0,
|
||||
engineeringName: '',
|
||||
engineeringId: '',
|
||||
},
|
||||
navHeight: 0,
|
||||
minHeight: '',
|
||||
engineeringList: [],
|
||||
projectList: [],
|
||||
projectType: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
engineeringListFilter() {
|
||||
let result = []
|
||||
this.engineeringList.forEach((item) => {
|
||||
let arr = pinyin(item.name[0], { toneType: 'none', type: 'array' })
|
||||
let letter = arr[0][0].toUpperCase()
|
||||
console.log(letter)
|
||||
let index = result.findIndex((item) => item.letter === letter)
|
||||
if (index === -1) {
|
||||
result.push({
|
||||
letter,
|
||||
data: [item.name],
|
||||
})
|
||||
} else {
|
||||
result[index].data.push(item.name)
|
||||
}
|
||||
})
|
||||
return result
|
||||
},
|
||||
deviceListFilter() {
|
||||
return this.store.data.filter((item) => {
|
||||
if (this.select.projectName && this.select.projectType) {
|
||||
return item.project === this.select.projectName && item.type === this.select.projectType
|
||||
} else if (this.select.projectName) {
|
||||
return item.projectId === this.projectList[this.select.projectNameIndex].id
|
||||
} else if (this.select.projectType) {
|
||||
return item.projectType === this.projectType[this.select.projectTypeIndex].id
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
// 获取nav高度
|
||||
uni.createSelectorQuery()
|
||||
.select('.nav')
|
||||
.boundingClientRect((rect) => {
|
||||
this.navHeight = rect.height
|
||||
// #ifdef H5
|
||||
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)'
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)'
|
||||
// #endif
|
||||
})
|
||||
.exec()
|
||||
}, 1000)
|
||||
},
|
||||
methods: {
|
||||
async init(){
|
||||
let engineering = uni.getStorageSync('engineering')
|
||||
let res = await queryEngineering()
|
||||
this.engineeringList = res.data
|
||||
if (this.engineeringList.length === 0) {
|
||||
return
|
||||
}
|
||||
if (!engineering) {
|
||||
uni.setStorageSync('engineering', res.data[0])
|
||||
this.select.engineeringName = res.data[0].name
|
||||
this.select.engineeringId = res.data[0].id
|
||||
} else {
|
||||
this.select.engineeringName = engineering.name
|
||||
this.select.engineeringId = engineering.id
|
||||
}
|
||||
this.getProjectList()
|
||||
this.getDeviceList()
|
||||
},
|
||||
getDeviceList() {
|
||||
this.store.params.pageSize = 999
|
||||
this.store.params.engineerId = this.select.engineeringId
|
||||
this.store.reload()
|
||||
this.store.firstCallBack = () => {
|
||||
console.log(this.store)
|
||||
}
|
||||
},
|
||||
getProjectList() {
|
||||
getProjectList({
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
engineeringId: this.select.engineeringId,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
let arr = [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: '-1',
|
||||
},
|
||||
...res.data.records.map((item) => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.id,
|
||||
...item,
|
||||
}
|
||||
}),
|
||||
]
|
||||
this.projectList = arr
|
||||
})
|
||||
},
|
||||
queryDictData() {
|
||||
queryDictData('项目类型').then((res) => {
|
||||
this.projectType = [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: '',
|
||||
},
|
||||
...res.data.map((item) => {
|
||||
return {
|
||||
text: item.anotherName,
|
||||
value: item.id,
|
||||
}
|
||||
}),
|
||||
]
|
||||
})
|
||||
},
|
||||
closeDrawer(e) {
|
||||
console.log(e)
|
||||
this.engineeringList.forEach((item) => {
|
||||
if (item.name === e.item.name) {
|
||||
uni.setStorageSync('engineering', item)
|
||||
this.select.engineeringName = item.name
|
||||
this.select.engineeringId = item.id
|
||||
}
|
||||
})
|
||||
this.getDeviceList()
|
||||
this.getProjectList()
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
this.$refs.showRight.close()
|
||||
},
|
||||
openDrawer(item) {
|
||||
if (this.engineeringList.length === 0) {
|
||||
uni.showToast({
|
||||
title: '暂无工程',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
} else if (this.engineeringList.length === 1) {
|
||||
uni.showToast({
|
||||
title: '暂无其他工程',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$refs.showRight.open()
|
||||
},
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
projectTypeChange(e) {
|
||||
this.select.projectTypeIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectType = ''
|
||||
return
|
||||
}
|
||||
this.select.projectType = this.projectType[e.detail.value].text
|
||||
},
|
||||
projectNameChange(e) {
|
||||
console.log(e)
|
||||
this.select.projectNameIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectName = ''
|
||||
return
|
||||
}
|
||||
this.select.projectName = this.projectList[e.detail.value].text
|
||||
},
|
||||
registerDevice() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请选择设备类型',
|
||||
confirmText: '直连装置',
|
||||
cancelText: '网关接入',
|
||||
cancelColor: '#007aff',
|
||||
success: ({ confirm, cancel }) => {
|
||||
if (confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new',
|
||||
})
|
||||
} else if (cancel) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/list',
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
registerGateway() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/new',
|
||||
})
|
||||
},
|
||||
navMenuClick(index) {
|
||||
this.navMenuActive = index
|
||||
},
|
||||
jump(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail',
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
@@ -21,179 +21,20 @@
|
||||
<Cn-grid-item src="/static/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item>
|
||||
</Cn-grid>
|
||||
</view>
|
||||
<view class="nav">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.engineeringName }" @click="showDrawer"
|
||||
>{{ select.engineeringName || '工程' }}
|
||||
</view>
|
||||
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectListFilter" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">{{ select.projectName || '项目' }} </view>
|
||||
</picker>
|
||||
<picker @change="projectTypeChange" :value="select.projectTypeIndex" :range="projectType" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectType }">{{ select.projectType || '类型' }} </view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: minHeight }">
|
||||
<uni-card
|
||||
:title="item.equipmentName"
|
||||
:sub-title="item.projectName"
|
||||
:extra="item.projectType"
|
||||
padding="0"
|
||||
v-for="(item, index) in deviceListFilter"
|
||||
:key="index"
|
||||
@click="jump(item)"
|
||||
thumbnail="/static/device.png"
|
||||
>
|
||||
<!-- <text>{{ item.project }} {{ item.type }}</text> -->
|
||||
</uni-card>
|
||||
<Cn-empty v-if="store.empty || deviceListFilter.length == 0"></Cn-empty>
|
||||
<uni-load-more v-if="deviceListFilter && deviceListFilter.length > 0" :status="store.status"></uni-load-more>
|
||||
</view>
|
||||
<uni-drawer ref="showRight" mode="right" :mask-click="false" :width="375">
|
||||
<uni-indexed-list :options="gcListFilter" :showSelect="false" @click="closeDrawer"></uni-indexed-list>
|
||||
</uni-drawer>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { pinyin } from 'pinyin-pro'
|
||||
|
||||
export default {
|
||||
name: 'IndexGongCheng',
|
||||
props: {
|
||||
store: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
projectList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
projectType: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
gcList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
userInfo: {},
|
||||
select: {
|
||||
projectName: '',
|
||||
projectNameIndex: 0,
|
||||
projectType: '',
|
||||
projectTypeIndex: 0,
|
||||
engineeringName: '',
|
||||
},
|
||||
navHeight: 0,
|
||||
minHeight: '',
|
||||
deviceList: [
|
||||
{
|
||||
name: '设备APF-1',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-2',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-3',
|
||||
des: '设备描述2',
|
||||
type: '用能',
|
||||
project: 'XXX项目2',
|
||||
},
|
||||
{
|
||||
name: '设备DVR-1',
|
||||
des: '设备描述3',
|
||||
type: '监测',
|
||||
project: 'XXX项目3',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
gcListFilter() {
|
||||
let result = []
|
||||
this.gcList.forEach((item) => {
|
||||
let arr = pinyin(item.name[0], { toneType: 'none', type: 'array' })
|
||||
let letter = arr[0][0].toUpperCase()
|
||||
console.log(letter)
|
||||
let index = result.findIndex((item) => item.letter === letter)
|
||||
if (index === -1) {
|
||||
result.push({
|
||||
letter,
|
||||
data: [item.name],
|
||||
})
|
||||
} else {
|
||||
result[index].data.push(item.name)
|
||||
}
|
||||
})
|
||||
return result
|
||||
},
|
||||
deviceListFilter() {
|
||||
let arr = this.store.data
|
||||
if (this.select.projectName) {
|
||||
arr = arr.filter((item) => item.projectName === this.select.projectName)
|
||||
}
|
||||
if (this.select.projectType) {
|
||||
arr = arr.filter((item) => item.projectType === this.select.projectType)
|
||||
}
|
||||
if (this.select.engineeringName) {
|
||||
arr = arr.filter((item) => item.engineeringName === this.select.engineeringName)
|
||||
}
|
||||
return arr
|
||||
},
|
||||
projectListFilter() {
|
||||
return this.projectList.filter((item) => {
|
||||
if (this.select.engineeringName) {
|
||||
return item.engineeringName === this.select.engineeringName || item.value == -1
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
showDrawer() {
|
||||
this.$refs.showRight.open()
|
||||
},
|
||||
closeDrawer(e) {
|
||||
console.log(e)
|
||||
this.select.engineeringName = e.item.name
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
this.$refs.showRight.close()
|
||||
},
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
projectTypeChange(e) {
|
||||
this.select.projectTypeIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectType = ''
|
||||
return
|
||||
}
|
||||
this.select.projectType = this.projectType[e.detail.value].text
|
||||
},
|
||||
projectNameChange(e) {
|
||||
console.log(e)
|
||||
// 重置type
|
||||
this.select.projectType = ''
|
||||
this.select.projectTypeIndex = 0
|
||||
|
||||
this.select.projectNameIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectName = ''
|
||||
return
|
||||
}
|
||||
this.select.projectName = this.projectList[e.detail.value].text
|
||||
},
|
||||
registerDevice() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
@@ -219,34 +60,11 @@ export default {
|
||||
url: '/pages/gateway/new',
|
||||
})
|
||||
},
|
||||
navMenuClick(index) {
|
||||
this.navMenuActive = index
|
||||
},
|
||||
jump(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail',
|
||||
})
|
||||
},
|
||||
init() {},
|
||||
},
|
||||
mounted() {
|
||||
this.userInfo = uni.getStorageSync('userInfo')
|
||||
setTimeout(() => {
|
||||
this.init()
|
||||
// 获取nav高度
|
||||
uni.createSelectorQuery()
|
||||
.select('.nav')
|
||||
.boundingClientRect((rect) => {
|
||||
this.navHeight = rect.height
|
||||
// #ifdef H5
|
||||
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)'
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)'
|
||||
// #endif
|
||||
})
|
||||
.exec()
|
||||
}, 1000)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -14,208 +14,11 @@
|
||||
<div class="header-item-label">离线设备</div>
|
||||
</div>
|
||||
</div>
|
||||
<view class="nav">
|
||||
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectList" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">{{
|
||||
select.projectName || '项目' }} </view>
|
||||
</picker>
|
||||
<picker @change="projectTypeChange" :value="select.projectTypeIndex" :range="projectType" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectType }">{{
|
||||
select.projectType || '类型' }} </view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: minHeight }">
|
||||
<uni-card :title="item.name" :sub-title="item.project" :extra="item.type" padding="0"
|
||||
v-for="(item, index) in deviceListFilter" :key="index" @click="jump(item)" thumbnail="/static/device.png">
|
||||
<!-- <text>{{ item.project }} {{ item.type }}</text> -->
|
||||
</uni-card>
|
||||
<uni-load-more status="nomore"></uni-load-more>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
userInfo: {},
|
||||
select: {
|
||||
projectName: '',
|
||||
projectNameIndex: 0,
|
||||
projectType: '',
|
||||
projectTypeIndex: 0
|
||||
},
|
||||
projectType: [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
text: '监测',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
text: '环境',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
text: '安防',
|
||||
value: 4
|
||||
},
|
||||
{
|
||||
text: '其他',
|
||||
value: 5
|
||||
}
|
||||
],
|
||||
projectList: [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: 'XXX项目1',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: 'XXX项目2',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
text: 'XXX项目3',
|
||||
value: 1
|
||||
},
|
||||
|
||||
],
|
||||
navHeight: 0,
|
||||
minHeight: '',
|
||||
deviceList: [
|
||||
{
|
||||
name: '设备APF-1',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-2',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-3',
|
||||
des: '设备描述2',
|
||||
type: '用能',
|
||||
project: 'XXX项目2'
|
||||
},
|
||||
{
|
||||
name: '设备DVR-1',
|
||||
des: '设备描述3',
|
||||
type: '监测',
|
||||
project: 'XXX项目3'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
deviceListFilter () {
|
||||
return this.deviceList.filter(item => {
|
||||
if (this.select.projectName) {
|
||||
return item.project === this.select.projectName
|
||||
} else if (this.select.projectType) {
|
||||
return item.type === this.select.projectType
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
projectTypeChange (e) {
|
||||
// 重置name
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
|
||||
this.select.projectTypeIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectType = ''
|
||||
return
|
||||
}
|
||||
this.select.projectType = this.projectType[e.detail.value].text
|
||||
|
||||
|
||||
},
|
||||
projectNameChange (e) {
|
||||
console.log(e);
|
||||
// 重置type
|
||||
this.select.projectType = ''
|
||||
this.select.projectTypeIndex = 0
|
||||
|
||||
this.select.projectNameIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectName = ''
|
||||
return
|
||||
}
|
||||
this.select.projectName = this.projectList[e.detail.value].text
|
||||
},
|
||||
registerDevice () {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请选择设备类型',
|
||||
confirmText: '直连装置',
|
||||
cancelText: '网关接入',
|
||||
cancelColor: '#007aff',
|
||||
success: ({ confirm, cancel }) => {
|
||||
if (confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new'
|
||||
})
|
||||
} else if (cancel) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/list'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
registerGateway () {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/new'
|
||||
})
|
||||
},
|
||||
navMenuClick (index) {
|
||||
this.navMenuActive = index
|
||||
},
|
||||
jump (item) {
|
||||
if (item.name.indexOf('APF') > -1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail'
|
||||
})
|
||||
} else if (item.name.indexOf('DVR') > -1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/DVR/detail'
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
setTimeout(() => {
|
||||
// 获取nav高度
|
||||
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => {
|
||||
this.navHeight = rect.height
|
||||
// #ifdef H5
|
||||
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)'
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)'
|
||||
// #endif
|
||||
}).exec()
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='scss'></style>
|
||||
<style lang="scss"></style>
|
||||
|
||||
@@ -14,221 +14,9 @@
|
||||
<div class="header-item-label">离线设备</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <view style="padding:20rpx 20rpx 0">
|
||||
<Cn-grid title="常用功能">
|
||||
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
|
||||
<Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item>
|
||||
</Cn-grid>
|
||||
</view> -->
|
||||
<view class="nav">
|
||||
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectList" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">{{ select.projectName || '项目' }} </view>
|
||||
</picker>
|
||||
<picker @change="projectTypeChange" :value="select.projectTypeIndex" :range="projectType" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectType }">{{ select.projectType || '类型' }} </view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: minHeight }">
|
||||
<uni-card
|
||||
:title="item.name"
|
||||
:sub-title="item.project"
|
||||
:extra="item.type"
|
||||
padding="0"
|
||||
v-for="(item, index) in deviceListFilter"
|
||||
:key="index"
|
||||
@click="jump(item)"
|
||||
thumbnail="/static/device.png"
|
||||
>
|
||||
<!-- <text>{{ item.project }} {{ item.type }}</text> -->
|
||||
</uni-card>
|
||||
<uni-load-more status="nomore"></uni-load-more>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
select: {
|
||||
projectName: '',
|
||||
projectNameIndex: 0,
|
||||
projectType: '',
|
||||
projectTypeIndex: 0,
|
||||
},
|
||||
projectType: [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: '监测',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
text: '环境',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: '安防',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
text: '其他',
|
||||
value: 5,
|
||||
},
|
||||
],
|
||||
projectList: [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目1',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目2',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目3',
|
||||
value: 1,
|
||||
},
|
||||
],
|
||||
navHeight: 0,
|
||||
minHeight: '',
|
||||
deviceList: [
|
||||
{
|
||||
name: '设备APF-1',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-2',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-3',
|
||||
des: '设备描述2',
|
||||
type: '用能',
|
||||
project: 'XXX项目2',
|
||||
},
|
||||
{
|
||||
name: '设备DVR-1',
|
||||
des: '设备描述3',
|
||||
type: '监测',
|
||||
project: 'XXX项目3',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
deviceListFilter() {
|
||||
return this.deviceList.filter((item) => {
|
||||
if (this.select.projectName) {
|
||||
return item.project === this.select.projectName
|
||||
} else if (this.select.projectType) {
|
||||
return item.type === this.select.projectType
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
projectTypeChange(e) {
|
||||
// 重置name
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
|
||||
this.select.projectTypeIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectType = ''
|
||||
return
|
||||
}
|
||||
this.select.projectType = this.projectType[e.detail.value].text
|
||||
},
|
||||
projectNameChange(e) {
|
||||
console.log(e)
|
||||
// 重置type
|
||||
this.select.projectType = ''
|
||||
this.select.projectTypeIndex = 0
|
||||
|
||||
this.select.projectNameIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectName = ''
|
||||
return
|
||||
}
|
||||
this.select.projectName = this.projectList[e.detail.value].text
|
||||
},
|
||||
registerDevice() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请选择设备类型',
|
||||
confirmText: '直连装置',
|
||||
cancelText: '网关接入',
|
||||
cancelColor: '#007aff',
|
||||
success: ({ confirm, cancel }) => {
|
||||
if (confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new',
|
||||
})
|
||||
} else if (cancel) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/list',
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
registerGateway() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/new',
|
||||
})
|
||||
},
|
||||
navMenuClick(index) {
|
||||
this.navMenuActive = index
|
||||
},
|
||||
jump(item) {
|
||||
if (item.name.indexOf('APF') > -1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail',
|
||||
})
|
||||
} else if (item.name.indexOf('DVR') > -1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/DVR/detail',
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
// 获取nav高度
|
||||
uni.createSelectorQuery()
|
||||
.select('.nav')
|
||||
.boundingClientRect((rect) => {
|
||||
this.navHeight = rect.height
|
||||
// #ifdef H5
|
||||
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)'
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)'
|
||||
// #endif
|
||||
})
|
||||
.exec()
|
||||
}, 1000)
|
||||
},
|
||||
}
|
||||
export default {}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
|
||||
@@ -21,96 +21,19 @@
|
||||
<Cn-grid-item src="/static/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item>
|
||||
</Cn-grid>
|
||||
</view>
|
||||
<view class="nav">
|
||||
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectList" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">{{ select.projectName || '项目' }} </view>
|
||||
</picker>
|
||||
<picker @change="projectTypeChange" :value="select.projectTypeIndex" :range="projectType" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectType }">{{ select.projectType || '类型' }} </view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: minHeight }">
|
||||
<uni-card
|
||||
:title="item.equipmentName"
|
||||
:sub-title="item.projectName"
|
||||
:extra="item.projectType"
|
||||
padding="0"
|
||||
v-for="(item, index) in deviceListFilter"
|
||||
:key="index"
|
||||
@click="jump(item)"
|
||||
thumbnail="/static/device.png"
|
||||
>
|
||||
<!-- <text>{{ item.project }} {{ item.type }}</text> -->
|
||||
</uni-card>
|
||||
<Cn-empty v-if="store.empty || deviceListFilter.length == 0"></Cn-empty>
|
||||
<uni-load-more v-if="deviceListFilter && deviceListFilter.length > 0" :status="store.status"></uni-load-more>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
store: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
projectList: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
projectType: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
select: {
|
||||
projectName: '',
|
||||
projectNameIndex: 0,
|
||||
projectType: '',
|
||||
projectTypeIndex: 0,
|
||||
},
|
||||
navHeight: 0,
|
||||
minHeight: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
deviceListFilter() {
|
||||
return this.store.data.filter((item) => {
|
||||
if (this.select.projectName && this.select.projectType) {
|
||||
return item.project === this.select.projectName && item.type === this.select.projectType;
|
||||
} else if (this.select.projectName) {
|
||||
return item.projectId === this.projectList[this.select.projectNameIndex].id;
|
||||
} else if (this.select.projectType) {
|
||||
return item.projectType === this.projectType[this.select.projectTypeIndex].id;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({ url: '/pages/home/feedback' });
|
||||
},
|
||||
projectTypeChange(e) {
|
||||
this.select.projectTypeIndex = e.detail.value;
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectType = '';
|
||||
return;
|
||||
}
|
||||
this.select.projectType = this.projectType[e.detail.value].text;
|
||||
},
|
||||
projectNameChange(e) {
|
||||
console.log(e);
|
||||
this.select.projectNameIndex = e.detail.value;
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectName = '';
|
||||
return;
|
||||
}
|
||||
this.select.projectName = this.projectList[e.detail.value].text;
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
registerDevice() {
|
||||
uni.showModal({
|
||||
@@ -123,46 +46,26 @@ export default {
|
||||
if (confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new',
|
||||
});
|
||||
})
|
||||
} else if (cancel) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/list',
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
})
|
||||
},
|
||||
registerGateway() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/new',
|
||||
});
|
||||
},
|
||||
navMenuClick(index) {
|
||||
this.navMenuActive = index;
|
||||
})
|
||||
},
|
||||
jump(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail',
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
// 获取nav高度
|
||||
uni.createSelectorQuery()
|
||||
.select('.nav')
|
||||
.boundingClientRect((rect) => {
|
||||
this.navHeight = rect.height;
|
||||
// #ifdef H5
|
||||
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)';
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)';
|
||||
// #endif
|
||||
})
|
||||
.exec();
|
||||
}, 1000);
|
||||
},
|
||||
};
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
|
||||
@@ -1,234 +0,0 @@
|
||||
<template>
|
||||
<view class="index-zhuyonghu">
|
||||
<div class="header">
|
||||
<div class="header-item">
|
||||
<div class="header-item-value">3</div>
|
||||
<div class="header-item-label">正常设备</div>
|
||||
</div>
|
||||
<div class="header-item">
|
||||
<div class="header-item-value">1</div>
|
||||
<div class="header-item-label">报警设备</div>
|
||||
</div>
|
||||
<div class="header-item">
|
||||
<div class="header-item-value">0</div>
|
||||
<div class="header-item-label">离线设备</div>
|
||||
</div>
|
||||
</div>
|
||||
<view style="padding: 20rpx 20rpx 0">
|
||||
<Cn-grid title="常用功能">
|
||||
<Cn-grid-item src="/static/feedback2.png" text="提交反馈" @click="submitFeedBack"></Cn-grid-item>
|
||||
</Cn-grid>
|
||||
</view>
|
||||
<view class="nav">
|
||||
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectList" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">{{ select.projectName || '项目' }} </view>
|
||||
</picker>
|
||||
<picker @change="projectTypeChange" :value="select.projectTypeIndex" :range="projectType" range-key="text">
|
||||
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectType }">{{ select.projectType || '类型' }} </view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="content device" :style="{ minHeight: minHeight }">
|
||||
<uni-card
|
||||
:title="item.name"
|
||||
:sub-title="item.project"
|
||||
:extra="item.type"
|
||||
padding="0"
|
||||
v-for="(item, index) in deviceListFilter"
|
||||
:key="index"
|
||||
@click="jump(item)"
|
||||
thumbnail="/static/device.png"
|
||||
>
|
||||
<!-- <text>{{ item.project }} {{ item.type }}</text> -->
|
||||
</uni-card>
|
||||
<uni-load-more status="nomore"></uni-load-more>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
userInfo: {},
|
||||
select: {
|
||||
projectName: '',
|
||||
projectNameIndex: 0,
|
||||
projectType: '',
|
||||
projectTypeIndex: 0,
|
||||
},
|
||||
projectType: [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: '监测',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
text: '环境',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: '安防',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
text: '其他',
|
||||
value: 5,
|
||||
},
|
||||
],
|
||||
projectList: [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目1',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目2',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: 'XXX项目3',
|
||||
value: 1,
|
||||
},
|
||||
],
|
||||
navHeight: 0,
|
||||
minHeight: '',
|
||||
deviceList: [
|
||||
{
|
||||
name: '设备APF-1',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-2',
|
||||
des: '设备描述1',
|
||||
type: '监测',
|
||||
project: 'XXX项目1',
|
||||
},
|
||||
{
|
||||
name: '设备APF-3',
|
||||
des: '设备描述2',
|
||||
type: '用能',
|
||||
project: 'XXX项目2',
|
||||
},
|
||||
{
|
||||
name: '设备DVR-1',
|
||||
des: '设备描述3',
|
||||
type: '监测',
|
||||
project: 'XXX项目3',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
deviceListFilter() {
|
||||
return this.deviceList.filter((item) => {
|
||||
if (this.select.projectName) {
|
||||
return item.project === this.select.projectName
|
||||
} else if (this.select.projectType) {
|
||||
return item.type === this.select.projectType
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
projectTypeChange(e) {
|
||||
// 重置name
|
||||
this.select.projectName = ''
|
||||
this.select.projectNameIndex = 0
|
||||
|
||||
this.select.projectTypeIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectType = ''
|
||||
return
|
||||
}
|
||||
this.select.projectType = this.projectType[e.detail.value].text
|
||||
},
|
||||
projectNameChange(e) {
|
||||
console.log(e)
|
||||
// 重置type
|
||||
this.select.projectType = ''
|
||||
this.select.projectTypeIndex = 0
|
||||
|
||||
this.select.projectNameIndex = e.detail.value
|
||||
if (e.detail.value === 0) {
|
||||
this.select.projectName = ''
|
||||
return
|
||||
}
|
||||
this.select.projectName = this.projectList[e.detail.value].text
|
||||
},
|
||||
registerDevice() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请选择设备类型',
|
||||
confirmText: '直连装置',
|
||||
cancelText: '网关接入',
|
||||
cancelColor: '#007aff',
|
||||
success: ({ confirm, cancel }) => {
|
||||
if (confirm) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new',
|
||||
})
|
||||
} else if (cancel) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/list',
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
registerGateway() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/gateway/new',
|
||||
})
|
||||
},
|
||||
navMenuClick(index) {
|
||||
this.navMenuActive = index
|
||||
},
|
||||
jump(item) {
|
||||
if (item.name.indexOf('APF') > -1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/APF/detail',
|
||||
})
|
||||
} else if (item.name.indexOf('DVR') > -1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/DVR/detail',
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
// 获取nav高度
|
||||
uni.createSelectorQuery()
|
||||
.select('.nav')
|
||||
.boundingClientRect((rect) => {
|
||||
this.navHeight = rect.height
|
||||
// #ifdef H5
|
||||
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)'
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)'
|
||||
// #endif
|
||||
})
|
||||
.exec()
|
||||
}, 1000)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
@@ -3,23 +3,15 @@
|
||||
<view slot="body">
|
||||
<view class="index">
|
||||
<!-- 运维 -->
|
||||
<YunWei v-if="userInfo.role == 1" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<YunWei v-if="userInfo.authorities === 'operation_manager'" />
|
||||
<!-- 专职 -->
|
||||
<ZhuanZhi v-if="userInfo.role == 2" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<ZhuanZhi v-if="userInfo.authorities === 'market_user'" />
|
||||
<!-- 工程 -->
|
||||
<GongCheng
|
||||
v-if="userInfo.role == 3"
|
||||
:store="store"
|
||||
:gcList="gcList"
|
||||
:projectList="projectList"
|
||||
:projectType="projectType"
|
||||
/>
|
||||
<GongCheng v-if="userInfo.authorities === 'engineering_user'" />
|
||||
<!-- 主用户 -->
|
||||
<ZhuYongHu v-if="userInfo.role == 4" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<!-- 子用户 -->
|
||||
<ZiYongHu v-if="userInfo.role == 5" :store="store" :projectList="projectList" :projectType="projectType" />
|
||||
<YouKe v-if="userInfo.role == 6"> </YouKe>
|
||||
<uni-fab ref="fab" direction="vertical" horizontal="right" vertical="bottom" :content="content" @trigger="trigger" />
|
||||
<ZhuYongHu v-if="userInfo.authorities === 'app_vip_user'" />
|
||||
<YouKe v-if="userInfo.authorities === 'tourist'"> </YouKe>
|
||||
<Device ref="device" :store="store" />
|
||||
</view>
|
||||
</view>
|
||||
</Cn-page>
|
||||
@@ -28,13 +20,10 @@
|
||||
import YunWei from './comp/indexYunWei.vue'
|
||||
import GongCheng from './comp/indexGongCheng.vue'
|
||||
import ZhuYongHu from './comp/indexZhuYongHu.vue'
|
||||
import ZiYongHu from './comp/indexZiYongHu.vue'
|
||||
import ZhuanZhi from './comp/indexZhuanZhi.vue'
|
||||
import YouKe from './comp/indexYouKe.vue'
|
||||
import Device from './comp/device.vue'
|
||||
import list from '../../common/js/list'
|
||||
import { getProjectList } from '../../common/api/project'
|
||||
import { queryDictData } from '../../common/api/dictionary'
|
||||
import { queryEngineering } from '@/common/api/gc.js'
|
||||
|
||||
export default {
|
||||
mixins: [list],
|
||||
@@ -42,78 +31,16 @@ export default {
|
||||
YunWei,
|
||||
GongCheng,
|
||||
ZhuYongHu,
|
||||
ZiYongHu,
|
||||
ZhuanZhi,
|
||||
YouKe,
|
||||
Device,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
userInfo: {
|
||||
role: 4,
|
||||
},
|
||||
projectList: [],
|
||||
gcList: [],
|
||||
projectType: [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: '监测',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: '用能',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
text: '环境',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: '安防',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
text: '其他',
|
||||
value: 5,
|
||||
},
|
||||
],
|
||||
loading: false,
|
||||
userInfo: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
content() {
|
||||
let arr = [1, 3, 4]
|
||||
let content = [
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '运维管理',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '专职管理',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '工程',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '主用户',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '子用户',
|
||||
},
|
||||
{
|
||||
iconPath: '/static/mine3.png',
|
||||
text: '游客',
|
||||
},
|
||||
]
|
||||
return content
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
send() {
|
||||
uni.createPushMessage({
|
||||
@@ -127,145 +54,26 @@ export default {
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
trigger(e) {
|
||||
if (e.index === 500) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/device/new',
|
||||
})
|
||||
} else {
|
||||
this.userInfo.role = e.index + 1
|
||||
uni.setStorageSync('userInfo', {
|
||||
role: e.index + 1,
|
||||
id: 1,
|
||||
})
|
||||
let roleName = ''
|
||||
switch (e.index + 1) {
|
||||
case 1:
|
||||
roleName = '运维管理'
|
||||
uni.removeTabBarBadge({
|
||||
index: 1,
|
||||
})
|
||||
break
|
||||
case 2:
|
||||
roleName = '专职管理'
|
||||
uni.removeTabBarBadge({
|
||||
index: 1,
|
||||
})
|
||||
break
|
||||
case 3:
|
||||
roleName = '工程'
|
||||
uni.removeTabBarBadge({
|
||||
index: 1,
|
||||
})
|
||||
break
|
||||
case 4:
|
||||
roleName = '主用户'
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6',
|
||||
})
|
||||
break
|
||||
case 5:
|
||||
roleName = '子用户'
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6',
|
||||
})
|
||||
break
|
||||
case 6:
|
||||
roleName = '游客'
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6',
|
||||
})
|
||||
break
|
||||
}
|
||||
this.$util.toast(roleName + '角色切换成功')
|
||||
}
|
||||
this.$refs.fab.close()
|
||||
},
|
||||
init() {
|
||||
this.store = this.DataSource('/EquipmentDelivery/queryEquipmentByProject')
|
||||
this.store.reload()
|
||||
this.store.firstCallBack = () => {
|
||||
this.loading = false
|
||||
console.log(this.store)
|
||||
}
|
||||
},
|
||||
getProjectList() {
|
||||
getProjectList({
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
let arr = [
|
||||
{
|
||||
text: '全部项目',
|
||||
value: '-1',
|
||||
},
|
||||
...res.data.records.map((item) => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.id,
|
||||
...item,
|
||||
}
|
||||
}),
|
||||
]
|
||||
arr.forEach((item) => {
|
||||
if (this.projectList.findIndex((item2) => item2.value == item.value) === -1) {
|
||||
this.projectList.push(item)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
getGcList() {
|
||||
queryEngineering().then((res) => {
|
||||
this.gcList = res.data
|
||||
})
|
||||
},
|
||||
queryDictData() {
|
||||
queryDictData('项目类型').then((res) => {
|
||||
this.projectType = [
|
||||
{
|
||||
text: '全部类型',
|
||||
value: '',
|
||||
},
|
||||
...res.data.map((item) => {
|
||||
return {
|
||||
text: item.anotherName,
|
||||
value: item.id,
|
||||
}
|
||||
}),
|
||||
]
|
||||
})
|
||||
loadingChange(e) {
|
||||
this.loading = e
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
this.init()
|
||||
this.store = this.DataSource('/cs-device-boot/EquipmentDelivery/queryEquipmentByProject')
|
||||
},
|
||||
onShow() {
|
||||
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
||||
if (!this.userInfo) {
|
||||
this.userInfo = {
|
||||
role: 4,
|
||||
id: 1,
|
||||
}
|
||||
uni.setStorageSync('userInfo', {
|
||||
role: 4,
|
||||
id: 1,
|
||||
})
|
||||
}
|
||||
if (this.userInfo.role == 4 || this.userInfo.role == 5 || this.userInfo.role == 6) {
|
||||
if (
|
||||
this.userInfo.authorities === 'app_vip_user' ||
|
||||
this.userInfo.authorities == 5 ||
|
||||
this.userInfo.authorities === 'tourist'
|
||||
) {
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: '6',
|
||||
})
|
||||
}
|
||||
this.getProjectList()
|
||||
if (this.userInfo.role == 3) {
|
||||
this.getGcList()
|
||||
}
|
||||
this.$refs.device && this.$refs.device.init()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -6,24 +6,42 @@
|
||||
<view class="message-nav-label">系统</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="message-nav" @click="jump('feedback')">
|
||||
<view class="message-nav" @click="jump('feedback')" v-if="userInfo.authorities === 'app_vip_user'">
|
||||
<image mode="aspectFill" class="message-nav-icon" src="/static/feedback.png" />
|
||||
<view class="message-nav-label">反馈</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="message-nav" @click="jump('report')" v-if="userInfo.role == '4' || userInfo.role == '5'|| userInfo.role == '6'">
|
||||
<view
|
||||
class="message-nav"
|
||||
@click="jump('report')"
|
||||
v-if="
|
||||
userInfo.authorities == '4' || userInfo.authorities == '5' || userInfo.authorities == 'tourist'
|
||||
"
|
||||
>
|
||||
<image mode="aspectFill" class="message-nav-icon" src="/static/report.png" />
|
||||
<view class="message-nav-label">稳态越限</view>
|
||||
<uni-badge text="3"></uni-badge>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="message-nav" @click="jump('incident')" v-if="userInfo.role == '4' || userInfo.role == '5'|| userInfo.role == '6'">
|
||||
<view
|
||||
class="message-nav"
|
||||
@click="jump('incident')"
|
||||
v-if="
|
||||
userInfo.authorities == '4' || userInfo.authorities == '5' || userInfo.authorities == 'tourist'
|
||||
"
|
||||
>
|
||||
<image mode="aspectFill" class="message-nav-icon" src="/static/incident.png" />
|
||||
<view class="message-nav-label">暂态事件</view>
|
||||
<uni-badge text="2"></uni-badge>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="message-nav" @click="jump('term')" v-if="userInfo.role == '4' || userInfo.role == '5'|| userInfo.role == '6'">
|
||||
<view
|
||||
class="message-nav"
|
||||
@click="jump('term')"
|
||||
v-if="
|
||||
userInfo.authorities == '4' || userInfo.authorities == '5' || userInfo.authorities == 'tourist'
|
||||
"
|
||||
>
|
||||
<image mode="aspectFill" class="message-nav-icon" src="/static/term.png" />
|
||||
<view class="message-nav-label">终端状态</view>
|
||||
<uni-badge text="1"></uni-badge>
|
||||
@@ -35,47 +53,47 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
userInfo: {}
|
||||
userInfo: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
init() {
|
||||
this.userInfo = uni.getStorageSync('userInfo')
|
||||
},
|
||||
upgrade (code) {
|
||||
console.log(code);
|
||||
upgrade(code) {
|
||||
console.log(code)
|
||||
uni.showToast({
|
||||
title: '升级成功',
|
||||
icon: 'none'
|
||||
icon: 'none',
|
||||
})
|
||||
},
|
||||
jump (type) {
|
||||
jump(type) {
|
||||
switch (type) {
|
||||
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
|
||||
default:
|
||||
uni.navigateTo({
|
||||
url: `/pages/message/${type}`
|
||||
url: `/pages/message/${type}`,
|
||||
})
|
||||
break;
|
||||
}
|
||||
break
|
||||
}
|
||||
},
|
||||
onShow () {
|
||||
},
|
||||
onShow() {
|
||||
this.init()
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
upgrade(code) {
|
||||
console.log(code)
|
||||
roleUpdate({
|
||||
referralCode: code,
|
||||
userId: this.userInfo.userIndex,
|
||||
}).then((res) => {
|
||||
uni.removeStorage('engineering')
|
||||
uni.showToast({
|
||||
title: '升级成功',
|
||||
icon: 'none'
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.store = this.DataSource('/feedback/queryFeedBackPage')
|
||||
this.store = this.DataSource('/cs-device-boot/feedback/queryFeedBackPage')
|
||||
this.store.params.userId = uni.getStorageSync('userInfo').id
|
||||
this.store.reload()
|
||||
},
|
||||
|
||||
@@ -191,7 +191,7 @@ export default {
|
||||
})
|
||||
},
|
||||
init() {
|
||||
this.store = this.DataSource('/EquipmentDelivery/queryEquipmentByProject')
|
||||
this.store = this.DataSource('/cs-device-boot/EquipmentDelivery/queryEquipmentByProject')
|
||||
this.store.params.projectId = this.project.id
|
||||
this.store.reload()
|
||||
|
||||
@@ -212,12 +212,12 @@ export default {
|
||||
},
|
||||
onLoad(option) {
|
||||
let userInfo = uni.getStorageSync('userInfo')
|
||||
if (userInfo.role == '3') {
|
||||
if (userInfo.authorities == '3') {
|
||||
this.content.push({
|
||||
iconPath: '/static/transfer.png',
|
||||
text: '移交',
|
||||
})
|
||||
} else if (userInfo.role == '4') {
|
||||
} else if (userInfo.authorities == '4') {
|
||||
this.content.push({
|
||||
iconPath: '/static/share.png',
|
||||
text: '分享',
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:fixed="true"
|
||||
status-bar
|
||||
left-icon="left"
|
||||
:rightIcon="userInfo.role == '2' ? '' : 'plusempty'"
|
||||
:rightIcon="userInfo.authorities == '2' ? '' : 'plusempty'"
|
||||
background-color="#fff"
|
||||
color="#111"
|
||||
title="项目管理"
|
||||
@@ -44,7 +44,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.store = this.DataSource('/project/queryProject')
|
||||
this.store = this.DataSource('/cs-device-boot/project/queryProject')
|
||||
this.store.params.engineeringId = uni.getStorageSync('engineering')?.id
|
||||
this.store.reload()
|
||||
},
|
||||
back() {
|
||||
@@ -76,8 +77,6 @@ export default {
|
||||
|
||||
<style lang="scss">
|
||||
.message {
|
||||
padding-top: 20rpx;
|
||||
|
||||
.message-header {
|
||||
padding: 200rpx 34rpx 34rpx;
|
||||
display: flex;
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<script>
|
||||
import { pinyin } from 'pinyin-pro'
|
||||
import { addAppProject } from '../../common/api/project'
|
||||
import { queryEngineering } from '@/common/api/gc.js'
|
||||
import { queryEngineering } from '@/common/api/engineering.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -143,7 +143,12 @@ export default {
|
||||
smsCode: this.yzmForm.code,
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
uni.setStorageSync('userInfo', res.data)
|
||||
uni.setStorageSync('access_token', res.data.token_type + ' ' + res.data.access_token)
|
||||
uni.setStorageSync('refresh_token', res.data.refresh_token)
|
||||
let strings = res.data.access_token.split('.') //截取token,获取载体
|
||||
var userInfo = JSON.parse(decodeURIComponent(escape(window.atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
|
||||
userInfo.authorities = userInfo.authorities[0]
|
||||
uni.setStorageSync('userInfo', userInfo)
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user