|
|
@@ -6,18 +6,18 @@
|
|
|
:key="index"
|
|
|
>
|
|
|
<div v-if="routerObj.role === isManufacturer">
|
|
|
+ <!-- <div> -->
|
|
|
<div
|
|
|
- @click="showLink(index)"
|
|
|
- :class="{ selectStyle: isShowLink[index] }"
|
|
|
+ :class="{ selectStyle: routerObj.path === routerPath }"
|
|
|
@mouseenter="enterDiv(index)"
|
|
|
@mouseleave="leaveDiv(index)"
|
|
|
>
|
|
|
- <div class="first_level" @click="getNavTitle(routerObj)">
|
|
|
+ <div class="first_level">
|
|
|
<router-link :to="routerObj.path" tag="li" class="title">
|
|
|
<div
|
|
|
class="icon"
|
|
|
:style="{ backgroundImage: 'url(' + routerObj.img1 + ')' }"
|
|
|
- v-if="!isShowLink[index] && isHover[index]"
|
|
|
+ v-if="routerObj.path !== routerPath && isHover[index]"
|
|
|
></div>
|
|
|
<div
|
|
|
class="icon"
|
|
|
@@ -28,18 +28,17 @@
|
|
|
{{ routerObj.title }}
|
|
|
</p>
|
|
|
<div class="switch">
|
|
|
- <img src="../img/switch2.png" v-if="!isShowLink[index]" />
|
|
|
+ <img src="../img/switch2.png" v-if="routerObj.path !== routerPath" />
|
|
|
<img src="../img/switch1.png" v-else />
|
|
|
</div>
|
|
|
</router-link>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 模块的子路由 -->
|
|
|
- <div class="second_level" v-show="isShowLink[index]">
|
|
|
+ <div class="second_level" v-show="(routerObj.pathList || []).indexOf(routerPath) > -1">
|
|
|
<div
|
|
|
v-for="(list, index) in routerObj.list"
|
|
|
:key="index"
|
|
|
- @click="getNavTitle(routerObj, list)"
|
|
|
>
|
|
|
<router-link
|
|
|
:to="list.path"
|
|
|
@@ -55,6 +54,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { ROUTER } from '../config/router';
|
|
|
export default {
|
|
|
props: {
|
|
|
isManufacturer: {
|
|
|
@@ -64,72 +64,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- isShowLink: [true, true, false, false, false], // 五个大模块
|
|
|
isHover: [true, true, true, true, true],
|
|
|
- routerList: [
|
|
|
- {
|
|
|
- title: "数据管理", // 厂商数据管理
|
|
|
- path: "/uploadInfor", // 默认展示的路由
|
|
|
- img1: require("../img/edit-manage1.png"), // 没点击的背景图
|
|
|
- img2: require("../img/edit-manage2.png"), // 点击了的背景图
|
|
|
- role: "manufacturer", // 厂商和经销商都有权限
|
|
|
- list: [
|
|
|
- {
|
|
|
- title: "上传记录",
|
|
|
- path: "/uploadRecord",
|
|
|
- },
|
|
|
- {
|
|
|
- title: "链接上传", // 厂商的链接上传
|
|
|
- path: "/uploadLinks",
|
|
|
- },
|
|
|
- {
|
|
|
- title: "上传资料",
|
|
|
- path: "/uploadInfor",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- title: "数据管理", // 进销商数据管理
|
|
|
- path: "/inforList", // 默认展示的路由
|
|
|
- img1: require("../img/edit-manage1.png"), // 没点击的背景图
|
|
|
- img2: require("../img/edit-manage2.png"), // 点击了的背景图
|
|
|
- role: "distributor", // 厂商和经销商都有权限
|
|
|
- list: [
|
|
|
- {
|
|
|
- title: "资料下载",
|
|
|
- path: "/inforList",
|
|
|
- },
|
|
|
- {
|
|
|
- title: "传播反馈", // 经销商链接上传
|
|
|
- path: "/uploadLink",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- title: "账号管理", // 厂商的账号管理
|
|
|
- path: "/accountIndex",
|
|
|
- img1: require("../img/User-Settings1.png"),
|
|
|
- img2: require("../img/User-Settings2.png"),
|
|
|
- list: [],
|
|
|
- role: "manufacturer", // 厂商有权限
|
|
|
- },
|
|
|
- {
|
|
|
- title: "账号管理",
|
|
|
- path: "/accountManage",
|
|
|
- img1: require("../img/User-Settings1.png"),
|
|
|
- img2: require("../img/User-Settings2.png"),
|
|
|
- list: [],
|
|
|
- role: "distributor", // 经销商有权限
|
|
|
- },
|
|
|
- {
|
|
|
- title: "参数设置",
|
|
|
- path: "/parameterIndex",
|
|
|
- img1: require("../img/Setting1.png"),
|
|
|
- img2: require("../img/Setting2.png"),
|
|
|
- list: [],
|
|
|
- role: "manufacturer", // 只有厂商有权限
|
|
|
- },
|
|
|
- ],
|
|
|
+ routerList: ROUTER
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -137,38 +73,14 @@ export default {
|
|
|
return this.$route.path;
|
|
|
},
|
|
|
},
|
|
|
+ // watch: {
|
|
|
+ // routerPath: function(newpath, oldPath) {
|
|
|
+ // console.log(newpath, 'new');
|
|
|
+ // console.log(oldPath);
|
|
|
+ // console.log()
|
|
|
+ // }
|
|
|
+ // },
|
|
|
methods: {
|
|
|
- getNavTitle: function (navTitle, list) {
|
|
|
- // 点击路由的时候,修改导航栏、
|
|
|
- if (list) {
|
|
|
- const nav = [
|
|
|
- {
|
|
|
- title: navTitle.title,
|
|
|
- url: navTitle.path,
|
|
|
- },
|
|
|
- {
|
|
|
- title: list.title,
|
|
|
- url: list.path,
|
|
|
- },
|
|
|
- ];
|
|
|
- this.$emit("change_nav", nav);
|
|
|
- } else {
|
|
|
- const nav = [
|
|
|
- {
|
|
|
- title: navTitle.title,
|
|
|
- url: navTitle.path,
|
|
|
- },
|
|
|
- ];
|
|
|
- this.$emit("change_nav", nav);
|
|
|
- }
|
|
|
- },
|
|
|
- // 展开、关闭router栏
|
|
|
- showLink: function (i) {
|
|
|
- let flag = this.isShowLink[i];
|
|
|
- this.isShowLink = [false, false, false, false, false];
|
|
|
- this.isShowLink.splice(i, 1, !flag);
|
|
|
- },
|
|
|
- // 鼠标移入变白色背景
|
|
|
enterDiv: function (i) {
|
|
|
this.isHover.splice(i, 1, false);
|
|
|
},
|
|
|
@@ -246,11 +158,9 @@ export default {
|
|
|
height: 38px;
|
|
|
line-height: 38px;
|
|
|
text-align: center;
|
|
|
- p {
|
|
|
- &:hover {
|
|
|
- cursor: pointer;
|
|
|
- color: rgb(0, 86, 160);
|
|
|
- }
|
|
|
+ &:hover {
|
|
|
+ cursor: pointer;
|
|
|
+ color: rgb(0, 86, 160);
|
|
|
}
|
|
|
}
|
|
|
}
|