服务内容配置
This commit is contained in:
@@ -6,4 +6,5 @@ export default {
|
|||||||
refresh_token: 'refresh_token', // 刷新token
|
refresh_token: 'refresh_token', // 刷新token
|
||||||
dictData: 'dictData', // 字典数据
|
dictData: 'dictData', // 字典数据
|
||||||
messageCount: 'messageCount', // 消息数量
|
messageCount: 'messageCount', // 消息数量
|
||||||
|
serverConfig: 'serverConfig', // 服务内容配置
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="grid-nav">
|
<view class="grid-nav">
|
||||||
<view class="grid-nav-title" v-if="title">{{ title }}</view>
|
<view class="grid-nav-title" v-if="title">{{ title }}</view>
|
||||||
@@ -6,30 +5,41 @@
|
|||||||
<slot />
|
<slot />
|
||||||
<Cn-grid-item background="#fff" v-for="item in seat" :key="item"></Cn-grid-item>
|
<Cn-grid-item background="#fff" v-for="item in seat" :key="item"></Cn-grid-item>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: ["title"],
|
props: {
|
||||||
data () {
|
title: {
|
||||||
return {
|
type: String,
|
||||||
seat: [] // 占位
|
default: '',
|
||||||
};
|
},
|
||||||
|
autoFill: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted () {
|
data() {
|
||||||
console.warn(this.$slots.default.length);
|
return {
|
||||||
let num = this.$slots.default.length;
|
seat: [], // 占位
|
||||||
let yushu = num % 4;
|
}
|
||||||
if (yushu > 0) {
|
},
|
||||||
for (let i = 0; i < 4 - yushu; i++) {
|
mounted() {
|
||||||
this.seat.push(i);
|
if (this.autoFill) {
|
||||||
|
console.warn(this.$slots.default.length)
|
||||||
|
let num = this.$slots.default.length
|
||||||
|
let yushu = num % 4
|
||||||
|
if (yushu > 0) {
|
||||||
|
for (let i = 0; i < 4 - yushu; i++) {
|
||||||
|
this.seat.push(i)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {}
|
components: {},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss'>
|
<style lang="scss">
|
||||||
.grid-nav {
|
.grid-nav {
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -51,4 +61,4 @@ export default {
|
|||||||
grid-gap: 2rpx;
|
grid-gap: 2rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -357,6 +357,12 @@
|
|||||||
"navigationBarTitleText": "关注工程配置"
|
"navigationBarTitleText": "关注工程配置"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/mine/serverSetting",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "服务内容配置"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/user/erweima",
|
"path": "pages/user/erweima",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@@ -21,9 +21,8 @@
|
|||||||
<view class="canneng-index-title mb20">当前工程设备统计</view>
|
<view class="canneng-index-title mb20">当前工程设备统计</view>
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="header-item" @click="jump('nowEngineering')">
|
<view class="header-item" @click="jump('nowEngineering')">
|
||||||
<view class="header-item-value">{{
|
<view class="header-item-value"
|
||||||
devCount.currentOnLineDevCount + devCount.currentOffLineDevCount || 0
|
>{{ devCount.currentOnLineDevCount + devCount.currentOffLineDevCount || 0 }}
|
||||||
}}
|
|
||||||
</view>
|
</view>
|
||||||
<view class="header-item-label">设备总数</view>
|
<view class="header-item-label">设备总数</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -38,10 +37,23 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="canneng-index-title mt20">常用功能</view>
|
<view class="canneng-index-title mt20">常用功能</view>
|
||||||
<view style="padding: 20rpx 20rpx 0">
|
<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(4)"></Cn-grid-item>
|
||||||
<Cn-grid-item src="/static/device2.png" text="功能调试" @click="registerDevice(2)"></Cn-grid-item>
|
<Cn-grid-item
|
||||||
<Cn-grid-item src="/static/device2.png" text="出厂调试" @click="registerDevice(3)"></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/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item> -->
|
||||||
<!-- <Cn-grid-item src="/static/feedback2.png" text="问题反馈" @click="submitFeedBack"></Cn-grid-item>-->
|
<!-- <Cn-grid-item src="/static/feedback2.png" text="问题反馈" @click="submitFeedBack"></Cn-grid-item>-->
|
||||||
</Cn-grid>
|
</Cn-grid>
|
||||||
@@ -52,7 +64,11 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: true,
|
||||||
|
config: {
|
||||||
|
feature: true,
|
||||||
|
factory: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@@ -61,9 +77,17 @@ export default {
|
|||||||
default: {},
|
default: {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
init() {
|
||||||
|
console.log('工程init')
|
||||||
|
let serverConfig = uni.getStorageSync(this.$cacheKey.serverConfig)
|
||||||
|
serverConfig && (this.config = serverConfig)
|
||||||
|
},
|
||||||
submitFeedBack() {
|
submitFeedBack() {
|
||||||
uni.navigateTo({url: '/pages/home/feedback'})
|
uni.navigateTo({ url: '/pages/home/feedback' })
|
||||||
},
|
},
|
||||||
registerDevice(type) {
|
registerDevice(type) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -72,7 +96,7 @@ export default {
|
|||||||
confirmText: '直连设备',
|
confirmText: '直连设备',
|
||||||
cancelText: '网关接入',
|
cancelText: '网关接入',
|
||||||
cancelColor: '#007aff',
|
cancelColor: '#007aff',
|
||||||
success: ({confirm, cancel}) => {
|
success: ({ confirm, cancel }) => {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
if (this.devCount.engineeringListLength > 0) {
|
if (this.devCount.engineeringListLength > 0) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@@ -80,10 +104,9 @@ export default {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/engineering/new?from=index&type=' + type
|
url: '/pages/engineering/new?from=index&type=' + type,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (cancel) {
|
} else if (cancel) {
|
||||||
// uni.navigateTo({
|
// uni.navigateTo({
|
||||||
// url: '/pages/gateway/list',
|
// url: '/pages/gateway/list',
|
||||||
@@ -100,8 +123,7 @@ export default {
|
|||||||
},
|
},
|
||||||
jump(type) {
|
jump(type) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:
|
url: '/pages/device/list?type=' + type,
|
||||||
'/pages/device/list?type=' + type
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<!-- 专职 -->
|
<!-- 专职 -->
|
||||||
<ZhuanZhi :devCount="devCount" v-if="userInfo.authorities === 'market_user'" />
|
<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'" />
|
<ZhuYongHu :devCount="devCount" v-if="userInfo.authorities === 'app_vip_user'" />
|
||||||
<YouKe :devCount="devCount" v-if="userInfo.authorities === 'tourist'"></YouKe>
|
<YouKe :devCount="devCount" v-if="userInfo.authorities === 'tourist'"></YouKe>
|
||||||
@@ -146,6 +146,7 @@ export default {
|
|||||||
if (!this.select.engineeringId) return
|
if (!this.select.engineeringId) return
|
||||||
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
|
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
getDevCount(this.select.engineeringId).then((res) => {
|
getDevCount(this.select.engineeringId).then((res) => {
|
||||||
// Object.assign(this.devCount, res.data)
|
// Object.assign(this.devCount, res.data)
|
||||||
@@ -221,6 +222,8 @@ export default {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.init()
|
this.init()
|
||||||
|
console.log(this.$refs.gongCheng);
|
||||||
|
this.$refs.gongCheng?.init()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
<view class="mine-nav-label">关注工程配置</view>
|
<view class="mine-nav-label">关注工程配置</view>
|
||||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
||||||
</view>
|
</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" />
|
<image mode="aspectFill" class="mine-nav-icon" src="/static/server2.png" />
|
||||||
<view class="mine-nav-label">服务内容配置</view>
|
<view class="mine-nav-label">服务内容配置</view>
|
||||||
<uni-icons type="forward" color="#aaa" size="20"></uni-icons>
|
<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