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
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="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>
@ -37,7 +40,6 @@ import deviceApi from '../../js/device_api';
const rootPage = '/subpackage/device'
const tabArr = [
{id: 1, 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`},
@ -57,7 +59,6 @@ const tabArr = [
// {id: 17, 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`},
];
import { mapState } from 'vuex'
export default {
@ -69,7 +70,6 @@ export default {
storeList: state => state.device.storeList,
curStoreInfo: state => state.device.curStoreInfo,
}),
getTop(){
return (lineHeight)=>{
// #ifdef MP-WEIXIN
@ -80,12 +80,27 @@ export default {
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(){
return {
tabArr,
deviceInfo:""
}
tabArr: [],
deviceInfo:"",
hardwareTypeList: [],
}
},
async onLoad(){
try{
@ -93,6 +108,7 @@ export default {
let _brandInfo = await this.$store.dispatch('getBrandInfo');
await this.$store.dispatch('getStoreList');
this.updateAC();
await this.getHardwareTypeList();
util.hideLoad();
}catch(err){
util.hideLoad();
@ -100,9 +116,28 @@ export default {
},
onShow() {
this.updateAC()//
this.updateAC() //
},
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(){
let that = this
uni.setClipboardData({

Loading…
Cancel
Save