flx:去重app图标
This commit is contained in:
parent
14e32965f2
commit
ac112ab4b3
19
main.js
19
main.js
@ -239,11 +239,28 @@ export function createApp() {
|
||||
}
|
||||
return fmt
|
||||
}
|
||||
|
||||
function recursiveSearchFn(dataList, resultList = []) {
|
||||
dataList.forEach(item => {
|
||||
if (item.appShow == 1) {
|
||||
// return item;
|
||||
item.operation = true;
|
||||
resultList.push(item);
|
||||
}
|
||||
if (Array.isArray(item.menuList) && item.menuList.length > 0) {
|
||||
return recursiveSearchFn(item.menuList, resultList);
|
||||
}
|
||||
});
|
||||
return resultList;
|
||||
};
|
||||
app.config.globalProperties.$recursiveSearchFn = recursiveSearchFn;
|
||||
|
||||
function recursiveSearch(dataList, appPath) {
|
||||
return dataList.find(item => {
|
||||
// console.log(item.path, appPath, item.menuName)
|
||||
if (item.path == appPath) {
|
||||
const path = item.path ? item.path : item.modulePath;
|
||||
if (path == appPath) {
|
||||
|
||||
return item;
|
||||
}
|
||||
if (Array.isArray(item.menuList) && item.menuList.length > 0) {
|
||||
|
||||
@ -316,7 +316,7 @@
|
||||
success(result) {
|
||||
if (result.success) {
|
||||
that.haveModuleList = result.result.moduleList.filter(
|
||||
(item) => item.moduleType == 2 && item.pcShow != 2
|
||||
(item) => (item.moduleType == 2 || item.moduleType == 10) && item.pcShow != 2
|
||||
);
|
||||
uni.setStorageSync("haveModuleList", that.haveModuleList);
|
||||
// alert("获取模块列表成功");
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
<!-- <view class="moudleTitle"> ·已有产品·</view> -->
|
||||
<view class="moudleBox">
|
||||
<view @click.stop="goMoudleFn(item)" v-for="(item, index) in list" :key="index">
|
||||
<view class="moudleItem" v-if="item.operation && item.moduleType == 2 && item.appShow == 1">
|
||||
<view class="moudleItem" v-if="item.operation && (item.moduleType == 2 || item.moduleType == 10) && item.appShow == 1">
|
||||
<view class="inner" :class="{'inner_active': !commonModuleIdFlag(item)}">
|
||||
<!-- <view class="imgBox" v-if="iconType == 1">
|
||||
<image class="img" :src="'/static/moudleImg/' + item.moduleIcon + '.png'"></image>
|
||||
@ -189,16 +189,24 @@
|
||||
});
|
||||
console.log("all111", all);
|
||||
console.log("all222", that.haveModuleList);
|
||||
// const newList = that.$recursiveSearchFn(all);
|
||||
that.list = all.filter(item => {
|
||||
if(that.haveModuleList.length > 0) {
|
||||
const res = that.$recursiveSearch(that.haveModuleList, item.path)
|
||||
return res ? true :false
|
||||
if (that.haveModuleList.length > 0) {
|
||||
const path = item.path ? item.path : item.modulePath;
|
||||
const res = that.$recursiveSearch(that.haveModuleList, path)
|
||||
return res ? true : false
|
||||
}
|
||||
|
||||
// console.log(5555555, res);
|
||||
// debugger
|
||||
return res;
|
||||
});
|
||||
}).reduce((prev,item) => {
|
||||
const findIndex = prev.findIndex(ele => ele.plugin == item.plugin);
|
||||
if(findIndex == -1) {
|
||||
prev.push(item);
|
||||
}
|
||||
return prev
|
||||
}, []);
|
||||
console.log(that.list);
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -644,7 +652,7 @@
|
||||
commonModuleIdFlag() {
|
||||
return (row) => {
|
||||
const findIndex = this.commonModuleIdsList.findIndex(item => item.moduleId == row.moduleId);
|
||||
// console.log(findIndex, row.moduleId, this.commonModuleIdsList)
|
||||
console.log(findIndex, row.moduleId, this.commonModuleIdsList)
|
||||
return findIndex > -1 ? false : true
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,8 @@
|
||||
<!-- <view class="moudleTitle"> ·已有产品·</view> -->
|
||||
<view class="moudleBox">
|
||||
<view @click="goMoudleFn(item)" v-for="(item, index) in list" :key="index">
|
||||
<view class="moudleItem" v-if="item.operation && item.moduleType == 2 && item.appShow == 1">
|
||||
<view class="moudleItem"
|
||||
v-if="item.operation && (item.moduleType == 2 || item.moduleType == 10) && item.appShow == 1">
|
||||
<view class="inner" v-if="COMPANY=='sanjiang'">
|
||||
<!-- <view class="imgBox" v-if="iconType == 1">
|
||||
<image class="img" :src="'/static/moudleImg/' + item.moduleIcon + '.png'"></image>
|
||||
@ -546,6 +547,7 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getAllModule(arr) {
|
||||
console.log('获取的模块', arr)
|
||||
|
||||
@ -574,9 +576,13 @@
|
||||
});
|
||||
console.log("all111", all);
|
||||
console.log(all, that.haveModuleList)
|
||||
|
||||
// const newList = that.$recursiveSearchFn(all);
|
||||
// console.log(111, newList)
|
||||
that.list = all.filter(item => {
|
||||
if (that.haveModuleList.length > 0) {
|
||||
const res = that.$recursiveSearch(that.haveModuleList, item.path)
|
||||
const path = item.path ? item.path : item.modulePath;
|
||||
const res = that.$recursiveSearch(that.haveModuleList, path)
|
||||
return res ? true : false
|
||||
}
|
||||
|
||||
@ -584,8 +590,14 @@
|
||||
// console.log(5555555, res);
|
||||
// debugger
|
||||
return res;
|
||||
});
|
||||
console.log(that.list)
|
||||
}).reduce((prev, item) => {
|
||||
const findIndex = prev.findIndex(ele => ele.plugin == item.plugin);
|
||||
if (findIndex == -1) {
|
||||
prev.push(item);
|
||||
}
|
||||
return prev
|
||||
}, []);
|
||||
console.log("我是", that.list)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
<view class="moudleTitle"> ·已有产品·</view>
|
||||
<view class="moudleBox">
|
||||
<view class="moudleItem" @click="goMoudleFn(item)" v-for="(item, index) in list" :key="index"
|
||||
v-if="item.operation && item.moduleType == 2 && item.appShow == 1">
|
||||
v-if="item.operation && (item.moduleType == 2 || item.moduleType == 10) && item.appShow == 1">
|
||||
<view class="inner" v-if="COMPANY=='sanjiang'">
|
||||
<!-- <view class="imgBox" v-if="iconType == 1">
|
||||
<image class="img" :src="'/static/moudleImg/' + item.moduleIcon + '.png'"></image>
|
||||
|
||||
@ -69,7 +69,7 @@
|
||||
<view class="moudleBox">
|
||||
<view v-for="(item, index) in list" :key="index"
|
||||
>
|
||||
<view class="moudleItem" @click="goMoudleFn(item)" v-if="item.operation && item.moduleType == 2 && item.appShow == 1">
|
||||
<view class="moudleItem" @click="goMoudleFn(item)" v-if="item.operation && (item.moduleType == 2 ||item.moduleType == 10) && item.appShow == 1">
|
||||
<view class="inner" v-if="COMPANY=='sanjiang'">
|
||||
<!-- <view class="imgBox" v-if="iconType == 1">
|
||||
<image class="img" :src="'/static/moudleImg/' + item.moduleIcon + '.png'"></image>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user