|
@@ -1,47 +1,52 @@
|
|
|
<template>
|
|
|
<div id="app">
|
|
|
- <header class="mui-bar mui-bar-nav">
|
|
|
- <a herf="" class="mui-pull-left close color4fc5f7">取消</a>
|
|
|
- <h1 class="mui-title">管理常用服务</h1>
|
|
|
- <a class="mui-pull-right mui-btn mui-btn-primary">完成</a>
|
|
|
- </header>
|
|
|
+ <!-- <header class="mui-bar mui-bar-nav">
|
|
|
+ <a herf="" class="mui-pull-left close color4fc5f7">取消</a>
|
|
|
+ <h1 class="mui-title">管理常用服务</h1>
|
|
|
+ <a class="mui-pull-right mui-btn mui-btn-primary">完成</a>
|
|
|
+ </header> -->
|
|
|
+
|
|
|
+ <common ref="common" @asynCallBack="asynCallBack"></common>
|
|
|
+ <top-header :pageTitle="pageTitle" :rightLink="rightLink" :doRightLink="doRightLink"></top-header>
|
|
|
+
|
|
|
|
|
|
<div class="mui-content vongi-icons">
|
|
|
<div class="vongi-all">
|
|
|
- <h4 class="vongi-center">您可以将常用的应用添加到主页</h4>
|
|
|
- <ul class="mui-table-view mui-grid-view mui-grid-9">
|
|
|
- <li class="mui-table-view-cell mui-media mui-col-xs-3">
|
|
|
- <a href="#">
|
|
|
- <img src="~$project/assets/img/icon_jiankangzheng.png" />
|
|
|
- <div class="mui-media-body">健康证</div>
|
|
|
- </a>
|
|
|
- <span class="mui-icon mui-icon-closeempty vongi-close"></span>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
+ <h4 class="vongi-center">您可以将常用的应用添加到主页</h4>
|
|
|
+ <ul class="mui-table-view mui-grid-view mui-grid-9">
|
|
|
+ <li draggable="true" v-for="(item,index) in menu_list" class="mui-table-view-cell mui-media mui-col-xs-3">
|
|
|
+ <!-- <router-link :to="{name:item.iconRoute,query:item.iconParam}"> -->
|
|
|
+ <img :src="requirePic(item.iconPic)" />
|
|
|
+ <div class="mui-media-body" v-text="item.iconName"></div>
|
|
|
+ <!-- </router-link> -->
|
|
|
+ <span @click="del(item.id,index)" class="mui-icon mui-icon-closeempty vongi-close"></span>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
<div class="vongi-all">
|
|
|
<h2>全部服务</h2>
|
|
|
- <div v-for="(iten,indey) in fun_list">
|
|
|
+ <div v-if="iten.cun_num" v-for="(iten,indey) in allFunList">
|
|
|
<h4 v-text="iten.name"></h4>
|
|
|
<ul class="mui-table-view mui-grid-view mui-grid-9">
|
|
|
- <li class="mui-table-view-cell mui-media mui-col-xs-3">
|
|
|
- <a>
|
|
|
- <img src="~$project/assets/img/icon_jiankangzheng.png" />
|
|
|
- <div class="mui-media-body">健康证</div>
|
|
|
- </a>
|
|
|
- <span class="mui-icon mui-icon-plusempty vongi-add"></span>
|
|
|
+ <li v-show="item.is_show" v-for="(item,index) in iten.list" :class="'mui-table-view-cell mui-media mui-col-xs-3 '+(item.iconRoute?'':'kfz')">
|
|
|
+ <!-- <router-link :to="{name:item.iconRoute,query:item.iconParam}"> -->
|
|
|
+ <img :src="requirePic(item.iconPic)" />
|
|
|
+ <div class="mui-media-body" v-text="item.iconName"></div>
|
|
|
+ <!-- </router-link> -->
|
|
|
+ <span @click="add(indey,index)" class="mui-icon mui-icon-plusempty vongi-add"></span>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<loading :visible="isLoading"></loading>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import Common from '$project/components/Common.vue'
|
|
|
+ import * as API_User from '$project/apis/user'
|
|
|
+ import Common from '$project/components/Common.vue'
|
|
|
import Loading from '$project/components/Loading.vue'
|
|
|
import TopHeader from '$project/components/TopHeader.vue'
|
|
|
import NavMenu from '@/components/NavMenu.vue'
|
|
@@ -50,7 +55,7 @@ import Common from '$project/components/Common.vue'
|
|
|
mapMutations
|
|
|
} from 'vuex'
|
|
|
export default {
|
|
|
- name: 'MasterAllFun',
|
|
|
+ name: 'MasterEditFun',
|
|
|
components: {
|
|
|
Common,
|
|
|
Loading,
|
|
@@ -61,26 +66,113 @@ import Common from '$project/components/Common.vue'
|
|
|
return {
|
|
|
isLoading: false,
|
|
|
|
|
|
- pageTitle: '全部应用',
|
|
|
+ pageTitle: '管理常用服务',
|
|
|
+
|
|
|
+ rightLink: {
|
|
|
+ show: true,
|
|
|
+ icon: 'mui-btn mui-btn-primary',
|
|
|
+ style: 'width: 55px;height: 25px;margin-top:5px;margin-right: 0px;line-height: 5px;color: #fff;font-size:16px;',
|
|
|
+ title: '完成'
|
|
|
+ },
|
|
|
+
|
|
|
+ allFunList: [],
|
|
|
+ menuList: [],
|
|
|
+ idList: [],
|
|
|
}
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.resetIdList();
|
|
|
+ },
|
|
|
methods: {
|
|
|
//引入图片
|
|
|
requirePic(file) {
|
|
|
- if (file) {
|
|
|
- if (file.indexOf('http') == 0) {
|
|
|
- return file;
|
|
|
- } else {
|
|
|
- return require('$project/assets/img/' + file);
|
|
|
- }
|
|
|
- }
|
|
|
+ if (file) {
|
|
|
+ if (file.indexOf('http') == 0) {
|
|
|
+ return file;
|
|
|
+ } else {
|
|
|
+ return require('$project/assets/img/' + file);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取所有的功能列表包括常用功能
|
|
|
+ getAllFunList() {
|
|
|
+ this.isLoading = true;
|
|
|
+ API_User.getAllFunList().then(response => {
|
|
|
+ this.isLoading = false;
|
|
|
+ this.allFunList = this.resetAllFunList(response.allIcon);
|
|
|
+ }).catch(error => {
|
|
|
+ mui.toast(error);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //重置数组
|
|
|
+ resetAllFunList(list) {
|
|
|
+ for (var i = 0; i < list.length; i++) {
|
|
|
+ for (var j = 0; j < list[i]['list'].length; j++) {
|
|
|
+ var num = 0;
|
|
|
+ if (this.idList.indexOf(list[i]['list'][j]['id']) > -1) {
|
|
|
+ list[i]['list'][j]['is_show'] = 0;
|
|
|
+ } else {
|
|
|
+ list[i]['list'][j]['is_show'] = 1;
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ list[i]['cun_num'] = num;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ },
|
|
|
+ resetIdList() {
|
|
|
+ var list = [];
|
|
|
+ for (var i = 0; i < this.menu_list.length; i++) {
|
|
|
+ list.push(this.menu_list[i]['id']);
|
|
|
+ }
|
|
|
+ this.idList = list;
|
|
|
+ },
|
|
|
+ //添加图标
|
|
|
+ add(indy, index) {
|
|
|
+ this.menu_list.push(this.allFunList[indy]['list'][index])
|
|
|
+ this.allFunList[indy]['list'][index]['is_show'] = 0;
|
|
|
+ this.allFunList[indy]['cun_num']--;
|
|
|
+ },
|
|
|
+ //减少图标
|
|
|
+ del(id, index) {
|
|
|
+
|
|
|
+ for (var i = 0; i < this.menu_list.length; i++) {
|
|
|
+ if (this.menu_list[i]['id'] == id) {
|
|
|
+ this.menu_list.splice(i, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var allFunList = this.allFunList;
|
|
|
+ for (var i = 0; i < allFunList.length; i++) {
|
|
|
+ var item = allFunList[i];
|
|
|
+ for (var j = 0; j < item['list'].length; j++) {
|
|
|
+ if (item['list'][j]['id'] == id) {
|
|
|
+ item['list'][j]['is_show'] = 1;
|
|
|
+ item['cun_num']++;
|
|
|
+ this.$set(this.allFunList, i, item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //保存常用图片
|
|
|
+ doRightLink() {
|
|
|
+ this.isLoading = true;
|
|
|
+ this.resetIdList();
|
|
|
+ API_User.saveFun(this.idList.join(',')).then(response => {
|
|
|
+ this.isLoading = false;
|
|
|
+ mui.toast('保存成功');
|
|
|
+ this.$router.go(-1);
|
|
|
+ }).catch(error => {
|
|
|
+ mui.toast(error);
|
|
|
+ })
|
|
|
},
|
|
|
asynCallBack() {
|
|
|
|
|
|
},
|
|
|
},
|
|
|
- mounted() {},
|
|
|
+ mounted() {
|
|
|
+ this.getAllFunList()
|
|
|
+ },
|
|
|
destroyed() {
|
|
|
|
|
|
},
|
|
@@ -90,7 +182,7 @@ import Common from '$project/components/Common.vue'
|
|
|
token: 'token',
|
|
|
person_data: 'person_data',
|
|
|
person_popedom: 'person_popedom',
|
|
|
- fun_list: 'fun_list'
|
|
|
+ menu_list: 'menu_list'
|
|
|
})
|
|
|
}
|
|
|
}
|