| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { CommonUtils } from '../../utils/common' |
| | | import { getMenuList, setMenuList } from '../../utils/menuListApp' |
| | | export default { |
| | | data() { |
| | | return { |
| | | menuListRowName: 'tab2', |
| | | updateCount: 0, |
| | | menuListName: 'tab2', |
| | | canEdit: false, |
| | | serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API', |
| | | itemData: [{ |
| | |
| | | this.getHiddenItem() |
| | | }, |
| | | methods: { |
| | | getHiddenItem() { |
| | | let itemCache = uni.getStorageSync('HTab2ItemData') || '' |
| | | console.log('itemCache: ', itemCache); |
| | | if (itemCache !== '') { |
| | | this.itemData = itemCache |
| | | } |
| | | async getHiddenItem() { |
| | | let data = await getMenuList({ |
| | | menuName: this.menuListName |
| | | }) |
| | | Array.from(data).forEach(e => { |
| | | this.itemData[e["HIndex"]].hidden = !CommonUtils.stringToBoolean(e["HShowMode"]) |
| | | }) |
| | | }, |
| | | switchHidden(index) { |
| | | this.updateCount ++; |
| | | this.itemData[index].hidden = !this.itemData[index].hidden |
| | | }, |
| | | switchIconsModeHandler() { |
| | | this.canEdit = !this.canEdit |
| | | if (this.canEdit == false) { |
| | | if(this.canEdit == false && this.updateCount > 0) { |
| | | this.$nextTick(() => { |
| | | uni.setStorageSync("HTab2ItemData", this.itemData) |
| | | // uni.setStorageSync("HIndexItemData", this.itemData) |
| | | setMenuList({ |
| | | menuName: this.menuListName, |
| | | payload: this.itemData |
| | | }) |
| | | |
| | | this.updateCount = 0 |
| | | }) |
| | | } |
| | | this.$forceUpdate() |