Browse Source

add device tab author

tags/v1.1.30
刘嘉炜 3 years ago
parent
commit
43b401e211
  1. 4
      src/subpackage/device/js/device_api.js
  2. 57
      src/subpackage/device/pages/index/index.vue

4
src/subpackage/device/js/device_api.js

@ -58,6 +58,10 @@ export const DEVICE_API = {
// 20211015 // 20211015
orderRefund:`${ORIGIN}/admin/stadium/order/refund`, // 订场/次卡退款 orderRefund:`${ORIGIN}/admin/stadium/order/refund`, // 订场/次卡退款
// 【ID1000841】 20220516 小程序-商家助手菜单入口权限优化
hardwareTypeList:`${ORIGIN}/admin/stadium/hardwareType/list`, // 设备权限列表
} }

57
src/subpackage/device/pages/index/index.vue

@ -20,10 +20,13 @@
<view class="ic-section"> <view class="ic-section">
<view class="is-list"> <view class="is-list">
<view class="il-item" v-for="(e,i) in tabArr" :key="i" @click="routeTo(e)">
<view><image mode="aspectFit" :src="getImgPath(e.id) || ''"></image></view>
<view>{{e.name || ''}}</view>
</view>
<block v-for="(e,i) in tabArr" :key="i">
<view class="il-item" @click="routeTo(e)" v-if="isShowHardwareTab(e)">
<view><image mode="aspectFit" :src="getImgPath(e.id) || ''"></image></view>
<view>{{e.name || ''}}</view>
</view>
</block>
</view> </view>
</view> </view>
</view> </view>
@ -37,7 +40,6 @@ import deviceApi from '../../js/device_api';
const rootPage = '/subpackage/device' const rootPage = '/subpackage/device'
const tabArr = [ const tabArr = [
{id: 1, name: '照明', path: `/pages/switch_manage/switch_manage`}, {id: 1, name: '照明', path: `/pages/switch_manage/switch_manage`},
{id: 2, name: '空调', path: `/pages/switch_manage/switch_manage`}, {id: 2, name: '空调', path: `/pages/switch_manage/switch_manage`},
{id: 3, name: '风扇', path: `/pages/switch_manage/switch_manage`}, {id: 3, name: '风扇', path: `/pages/switch_manage/switch_manage`},
@ -57,7 +59,6 @@ const tabArr = [
// {id: 17, name: '', path: `/pages/switch_manage/switch_manage`}, // {id: 17, name: '', path: `/pages/switch_manage/switch_manage`},
{id: 18, name: '路由器', path: `/pages/switch_manage/switch_manage`}, {id: 18, name: '路由器', path: `/pages/switch_manage/switch_manage`},
{id: 19, name: '物联卡', path: `/pages/switch_manage/switch_manage`}, {id: 19, name: '物联卡', path: `/pages/switch_manage/switch_manage`},
]; ];
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
@ -69,7 +70,6 @@ export default {
storeList: state => state.device.storeList, storeList: state => state.device.storeList,
curStoreInfo: state => state.device.curStoreInfo, curStoreInfo: state => state.device.curStoreInfo,
}), }),
getTop(){ getTop(){
return (lineHeight)=>{ return (lineHeight)=>{
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
@ -80,12 +80,27 @@ export default {
return top return top
} }
}, },
//
showHardwareIdLs(){
let { hardwareTypeList } = this;
let _ls = hardwareTypeList || [];
let _fls = _ls.filter(ele=>ele.stadium_has);
let _idLs = _fls.map(el => el.mini_local_menu_id);
return _idLs || [];
},
},
watch: {
curStoreInfo(nw, od){
console.warn(od.id, nw.id);
this.getHardwareTypeList();
}
}, },
data(){ data(){
return { return {
tabArr,
deviceInfo:""
}
tabArr: [],
deviceInfo:"",
hardwareTypeList: [],
}
}, },
async onLoad(){ async onLoad(){
try{ try{
@ -93,6 +108,7 @@ export default {
let _brandInfo = await this.$store.dispatch('getBrandInfo'); let _brandInfo = await this.$store.dispatch('getBrandInfo');
await this.$store.dispatch('getStoreList'); await this.$store.dispatch('getStoreList');
this.updateAC(); this.updateAC();
await this.getHardwareTypeList();
util.hideLoad(); util.hideLoad();
}catch(err){ }catch(err){
util.hideLoad(); util.hideLoad();
@ -100,9 +116,28 @@ export default {
}, },
onShow() { onShow() {
this.updateAC()//
this.updateAC() //
}, },
methods: { methods: {
isShowHardwareTab(e){
let { showHardwareIdLs } = this;
if(!showHardwareIdLs || !showHardwareIdLs.length)return false;
return showHardwareIdLs.includes(e.id);
},
getHardwareTypeList(){
let { curStoreInfo } = this;
this.tabArr = [];
return deviceServer.get({
url: deviceApi.hardwareTypeList,
data: { stadium_id: curStoreInfo.id },
failMsg: '加载设备类型列表失败!'
})
.then(res=>{
let _ls = res || [];
if(_ls&&_ls.length)this.tabArr = tabArr;
return this.hardwareTypeList = _ls || [];
})
},
copyDeviceID(){ copyDeviceID(){
let that = this let that = this
uni.setClipboardData({ uni.setClipboardData({

Loading…
Cancel
Save