diff --git a/auth.json b/auth.json
new file mode 100644
index 0000000..f3038e2
--- /dev/null
+++ b/auth.json
@@ -0,0 +1,10 @@
+{
+ "description": "昆船随行垛机检测系统",
+ "type": -1,
+ "rights": "duojiSystem",
+ "children": [{
+ "description": "历史监控",
+ "type": 2,
+ "rights": "history"
+ }]
+}
diff --git a/public/index.html b/public/index.html
index c4c824a..fcb9862 100644
--- a/public/index.html
+++ b/public/index.html
@@ -6,12 +6,12 @@
-
垛机监控系统
+ 昆船随行式垛机监测系统
diff --git a/src/App.vue b/src/App.vue
index bcfbd85..c03d2b8 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -4,6 +4,39 @@
+
+
\ No newline at end of file
diff --git a/src/views/login.vue b/src/views/login.vue
index e2a3ebe..85d958f 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -19,7 +19,7 @@
- 垛机监控系统
+ 昆船随行式垛机监测系统
@@ -76,7 +76,69 @@ export default {
}
}
},
- mounted() {}
+ beforeRouteEnter(to, from, next) {
+ if (location.search) {
+ let action = window.location.search.substring(
+ window.location.search.indexOf("=") + 1
+ );
+ if (action === "logout") {
+ localStorage.clear();
+ sessionStorage.clear();
+ }
+ next();
+ } else {
+ if (localStorage.getItem("userInfo")) {
+ next(vm => {
+ let permissionList = JSON.parse(
+ localStorage.getItem("userInfo")
+ ).permissionList;
+ let router = vm.$router.options.routes[0].children;
+ if (
+ !location.search &&
+ !permissionList.some(item => item.type === 2)
+ ) {
+ vm.$message.info("没权限", 1, () => {
+ vm.$api({
+ url: "/app/userCenter",
+ method: "GET"
+ }).then(res => {
+ window.open(
+ res.url + "?redirect=" + location.origin,
+ "_self"
+ );
+ });
+ });
+ return;
+ }
+ for (let item of router) {
+ if (
+ permissionList.some(a => {
+ if (a.rights === item.name && a.type === 2)
+ return true;
+ })
+ ) {
+ vm.$router.push({ name: item.name });
+ return;
+ }
+ }
+ });
+ } else {
+ if (!location.search) {
+ next(vm => {
+ vm.$api({
+ url: "/app/userCenter",
+ method: "GET"
+ }).then(res => {
+ window.open(
+ res.url + "?redirect=" + location.origin,
+ "_self"
+ );
+ });
+ });
+ }
+ }
+ }
+ }
};