服务内容配置
This commit is contained in:
@@ -21,9 +21,8 @@
|
||||
<view class="canneng-index-title mb20">当前工程设备统计</view>
|
||||
<view class="header">
|
||||
<view class="header-item" @click="jump('nowEngineering')">
|
||||
<view class="header-item-value">{{
|
||||
devCount.currentOnLineDevCount + devCount.currentOffLineDevCount || 0
|
||||
}}
|
||||
<view class="header-item-value"
|
||||
>{{ devCount.currentOnLineDevCount + devCount.currentOffLineDevCount || 0 }}
|
||||
</view>
|
||||
<view class="header-item-label">设备总数</view>
|
||||
</view>
|
||||
@@ -38,10 +37,23 @@
|
||||
</view>
|
||||
<view class="canneng-index-title mt20">常用功能</view>
|
||||
<view style="padding: 20rpx 20rpx 0">
|
||||
<Cn-grid title="">
|
||||
<Cn-grid title="" :auto-fill="false">
|
||||
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice(4)"></Cn-grid-item>
|
||||
<Cn-grid-item src="/static/device2.png" text="功能调试" @click="registerDevice(2)"></Cn-grid-item>
|
||||
<Cn-grid-item src="/static/device2.png" text="出厂调试" @click="registerDevice(3)"></Cn-grid-item>
|
||||
<Cn-grid-item
|
||||
src="/static/device2.png"
|
||||
text="功能调试"
|
||||
@click="registerDevice(2)"
|
||||
v-if="config.feature"
|
||||
></Cn-grid-item>
|
||||
<Cn-grid-item
|
||||
src="/static/device2.png"
|
||||
text="出厂调试"
|
||||
@click="registerDevice(3)"
|
||||
v-if="config.factory"
|
||||
></Cn-grid-item>
|
||||
<Cn-grid-item background="#fff" v-if="!config.feature"></Cn-grid-item>
|
||||
<Cn-grid-item background="#fff" v-if="!config.factory"></Cn-grid-item>
|
||||
<Cn-grid-item background="#fff"></Cn-grid-item>
|
||||
<!-- <Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> -->
|
||||
<!-- <Cn-grid-item src="/static/feedback2.png" text="问题反馈" @click="submitFeedBack"></Cn-grid-item>-->
|
||||
</Cn-grid>
|
||||
@@ -52,7 +64,11 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
loading: true,
|
||||
config: {
|
||||
feature: true,
|
||||
factory: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@@ -61,9 +77,17 @@ export default {
|
||||
default: {},
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
console.log('工程init')
|
||||
let serverConfig = uni.getStorageSync(this.$cacheKey.serverConfig)
|
||||
serverConfig && (this.config = serverConfig)
|
||||
},
|
||||
submitFeedBack() {
|
||||
uni.navigateTo({url: '/pages/home/feedback'})
|
||||
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||
},
|
||||
registerDevice(type) {
|
||||
uni.showModal({
|
||||
@@ -72,7 +96,7 @@ export default {
|
||||
confirmText: '直连设备',
|
||||
cancelText: '网关接入',
|
||||
cancelColor: '#007aff',
|
||||
success: ({confirm, cancel}) => {
|
||||
success: ({ confirm, cancel }) => {
|
||||
if (confirm) {
|
||||
if (this.devCount.engineeringListLength > 0) {
|
||||
uni.navigateTo({
|
||||
@@ -80,10 +104,9 @@ export default {
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/engineering/new?from=index&type=' + type
|
||||
url: '/pages/engineering/new?from=index&type=' + type,
|
||||
})
|
||||
}
|
||||
|
||||
} else if (cancel) {
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/gateway/list',
|
||||
@@ -100,8 +123,7 @@ export default {
|
||||
},
|
||||
jump(type) {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages/device/list?type=' + type
|
||||
url: '/pages/device/list?type=' + type,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<!-- 专职 -->
|
||||
<ZhuanZhi :devCount="devCount" v-if="userInfo.authorities === 'market_user'" />
|
||||
<!-- 工程 -->
|
||||
<GongCheng :devCount="devCount" v-if="userInfo.authorities === 'engineering_user'" />
|
||||
<GongCheng ref="gongCheng" :devCount="devCount" v-if="userInfo.authorities === 'engineering_user'" />
|
||||
<!-- 主用户 -->
|
||||
<ZhuYongHu :devCount="devCount" v-if="userInfo.authorities === 'app_vip_user'" />
|
||||
<YouKe :devCount="devCount" v-if="userInfo.authorities === 'tourist'"></YouKe>
|
||||
@@ -146,6 +146,7 @@ export default {
|
||||
if (!this.select.engineeringId) return
|
||||
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
|
||||
clearInterval(this.timer)
|
||||
return
|
||||
}
|
||||
getDevCount(this.select.engineeringId).then((res) => {
|
||||
// Object.assign(this.devCount, res.data)
|
||||
@@ -221,6 +222,8 @@ export default {
|
||||
})
|
||||
} else {
|
||||
this.init()
|
||||
console.log(this.$refs.gongCheng);
|
||||
this.$refs.gongCheng?.init()
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<view class="mine-nav-label">关注工程配置</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
</view>
|
||||
<view class="mine-nav" @click="jump('setupServer')">
|
||||
<view class="mine-nav" @click="jump('serverSetting')" v-if="userInfo.authorities === 'engineering_user'">
|
||||
<image mode="aspectFill" class="mine-nav-icon" src="/static/server2.png" />
|
||||
<view class="mine-nav-label">服务内容配置</view>
|
||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||
|
||||
123
pages/mine/serverSetting.vue
Normal file
123
pages/mine/serverSetting.vue
Normal file
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<Cn-page :loading="loading">
|
||||
<view class="mine" slot="body">
|
||||
<view class="mine-nav" style="margin-top: 20rpx">
|
||||
<view class="mine-nav-label">功能调试</view>
|
||||
<switch
|
||||
style="transform: scale(0.8)"
|
||||
color="#376cf3"
|
||||
@change="change('feature')"
|
||||
:checked="config.feature"
|
||||
/>
|
||||
</view>
|
||||
<view class="mine-nav" style="border-bottom: none">
|
||||
<view class="mine-nav-label">出厂调试</view>
|
||||
<switch
|
||||
style="transform: scale(0.8)"
|
||||
color="#376cf3"
|
||||
@change="change('factory')"
|
||||
:checked="config.factory"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</Cn-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
config: {
|
||||
feature: true,
|
||||
factory: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
let serverConfig = uni.getStorageSync(this.$cacheKey.serverConfig)
|
||||
serverConfig && (this.config = serverConfig)
|
||||
this.loading = false
|
||||
},
|
||||
change(type) {
|
||||
this.config[type] = !this.config[type]
|
||||
let str = ''
|
||||
switch (type) {
|
||||
case 'feature':
|
||||
str = '功能调试'
|
||||
break
|
||||
case 'factory':
|
||||
str = '出厂调试'
|
||||
break
|
||||
}
|
||||
this.$util.toast(`${str}首页入口${this.config[type] ? '开启' : '关闭'}`, 2500)
|
||||
uni.setStorage({
|
||||
key: this.$cacheKey.serverConfig,
|
||||
data: this.config,
|
||||
})
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
this.init()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.mine {
|
||||
.title {
|
||||
padding: 0 20rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
.mine-nav {
|
||||
padding: 34rpx;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user