mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 14:10:27 +08:00
优化
This commit is contained in:
parent
3fecc4f64b
commit
8fbe09c133
@ -11,7 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/composition-api": "^1.0.0-rc.5",
|
"@vue/composition-api": "^1.0.0-rc.5",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"cl-admin": "^1.5.1",
|
"cl-admin": "^1.5.3",
|
||||||
"cl-admin-crud": "^1.6.4",
|
"cl-admin-crud": "^1.6.4",
|
||||||
"cl-admin-theme": "^0.0.5",
|
"cl-admin-theme": "^0.0.5",
|
||||||
"clipboard": "^2.0.7",
|
"clipboard": "^2.0.7",
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapMutations, mapGetters } from "vuex";
|
import { mapMutations } from "vuex";
|
||||||
import { firstMenu } from "@/cool/modules/base/utils";
|
import { firstMenu } from "../../utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "cl-menu-topbar",
|
name: "cl-menu-topbar",
|
||||||
@ -28,10 +28,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(["menuGroup"]),
|
|
||||||
|
|
||||||
list() {
|
list() {
|
||||||
return this.menuGroup.filter(e => e.isShow);
|
return this.$store.getters.menuGroup.filter(e => e.isShow);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.menuGroup.forEach((e, i) => {
|
this.list.forEach((e, i) => {
|
||||||
deep(e, i);
|
deep(e, i);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -67,7 +65,8 @@ export default {
|
|||||||
onSelect(index) {
|
onSelect(index) {
|
||||||
this.SET_MENU_LIST(index);
|
this.SET_MENU_LIST(index);
|
||||||
|
|
||||||
const url = firstMenu(this.menuGroup[index].children);
|
// 获取第一个菜单地址
|
||||||
|
const url = firstMenu(this.list[index].children);
|
||||||
this.$router.push(url);
|
this.$router.push(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ export default {
|
|||||||
// 监听消息
|
// 监听消息
|
||||||
onMessage(msg) {
|
onMessage(msg) {
|
||||||
// 回调
|
// 回调
|
||||||
this.$emit("message", this.visible);
|
this.$emit("message", msg);
|
||||||
|
|
||||||
// 消息通知
|
// 消息通知
|
||||||
this.notification(msg);
|
this.notification(msg);
|
||||||
|
@ -134,7 +134,6 @@ export default {
|
|||||||
size: 20,
|
size: 20,
|
||||||
total: 0
|
total: 0
|
||||||
},
|
},
|
||||||
player: {},
|
|
||||||
voice: {
|
voice: {
|
||||||
url: "",
|
url: "",
|
||||||
timer: null
|
timer: null
|
||||||
|
@ -98,7 +98,8 @@
|
|||||||
title="图片预览"
|
title="图片预览"
|
||||||
:visible.sync="preview.visible"
|
:visible.sync="preview.visible"
|
||||||
:props="{
|
:props="{
|
||||||
width: previewWidth
|
width: previewWidth,
|
||||||
|
'append-to-body': true
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<img width="100%" :src="preview.url" alt="" />
|
<img width="100%" :src="preview.url" alt="" />
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import { Message } from "element-ui";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import { isDev } from "@/config/env";
|
import { isDev } from "@/config/env";
|
||||||
import { href, storage } from "cl-admin/utils";
|
import { href, storage } from "cl-admin/utils";
|
||||||
@ -120,8 +121,11 @@ axios.interceptors.response.use(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 403:
|
case 403:
|
||||||
console.error(`${config.url} 无权限访问!!`);
|
if (isDev) {
|
||||||
href("/403");
|
Message.error(`${config.url} 无权限访问!!`);
|
||||||
|
} else {
|
||||||
|
href("/403");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 404:
|
case 404:
|
||||||
@ -135,7 +139,7 @@ axios.interceptors.response.use(
|
|||||||
|
|
||||||
case 502:
|
case 502:
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
return Promise.reject("服务异常!!");
|
Message.error(`${config.url} 服务异常!!`);
|
||||||
} else {
|
} else {
|
||||||
href("/502");
|
href("/502");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user