Commit adb233f3 by 潘建波

暂时去除登录星云效果

1 parent db60e2e7
No preview for this file type
...@@ -6,36 +6,36 @@ ...@@ -6,36 +6,36 @@
<script> <script>
export default { export default {
data() { data() {
return { return {};
}
}, },
created(){ created() {
let menus = JSON.parse(localStorage.getItem('menu')) let menus = JSON.parse(localStorage.getItem("menu"));
if(menus) { if (menus) {
this.$store.dispatch('GetMenuRole',menus).then(res => {}) this.$store.dispatch("GetMenuRole", menus).then(res => {});
}
let token = localStorage.getItem("atoken");
if (!token) {
this.$router.push("/login");
} }
}, },
mounted(){ mounted() {
window.videoEquitTableHeight = document.body.clientHeight - 142 + 'px'; window.videoEquitTableHeight = document.body.clientHeight - 142 + "px";
window.opsTableHeight = document.body.clientHeight - 260 + 'px'; window.opsTableHeight = document.body.clientHeight - 260 + "px";
if(document.body.clientWidth>1366){ if (document.body.clientWidth > 1366) {
window.oneSearchTableHeight = document.body.clientHeight - 250 + 'px'; window.oneSearchTableHeight = document.body.clientHeight - 250 + "px";
window.twoSearchTableHeight = document.body.clientHeight - 280 + 'px'; window.twoSearchTableHeight = document.body.clientHeight - 280 + "px";
} else {
}else { window.oneSearchTableHeight = document.body.clientHeight - 280 + "px";
window.oneSearchTableHeight = document.body.clientHeight - 280 + 'px'; window.twoSearchTableHeight = document.body.clientHeight - 315 + "px";
window.twoSearchTableHeight = document.body.clientHeight - 315 + 'px';
} }
} }
} };
</script> </script>
<style lang="scss"> <style lang="scss">
#app { #app {
height: 100%; height: 100%;
font-family:MicrosoftYaHeiUI; font-family: MicrosoftYaHeiUI;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
......
import axios from 'axios' import axios from "axios";
import store from '../store/index.js' import store from "../store/index.js";
import router from "../router/index";
// 创建 axios 实例 // 创建 axios 实例
let service = axios.create({ let service = axios.create({
// headers: {'Content-Type': 'application/json'}, // headers: {'Content-Type': 'application/json'},
timeout: 60000 timeout: 60000
}) });
// 添加请求拦截器 // 添加请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
(config) => { config => {
if (store.state.users.atoken) { // 判断是否存在token,如果存在的话,则每个http header都加上token let token = localStorage.getItem("atoken");
config.headers.authorization = store.state.users.atoken; if (token) {
// 判断是否存在token,如果存在的话,则每个http header都加上token
config.headers.authorization = token;
} else {
router.push("/login");
} }
if (config.method == 'get') { if (config.method == "get") {
config.params = { config.params = {
_t: Date.parse(new Date()) / 1000, _t: Date.parse(new Date()) / 1000,
...config.params ...config.params
};
} }
} return config;
return config
}, },
(error) => { error => {
// 请求错误处理 // 请求错误处理
return Promise.reject(error) return Promise.reject(error);
} }
) );
// 添加响应拦截器 // 添加响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
(response) => { response => {
let { data } = response let { data } = response;
return data return data;
}, },
(error) => { error => {
console.log(error) console.log(error);
return Promise.reject(error) return Promise.reject(error);
} }
) );
/** /**
* 创建统一封装过的 axios 实例 * 创建统一封装过的 axios 实例
* @return {AxiosInstance} * @return {AxiosInstance}
*/ */
export default function() { export default function() {
return service return service;
} }
...@@ -18,10 +18,10 @@ Vue.prototype.$echarts = echarts; ...@@ -18,10 +18,10 @@ Vue.prototype.$echarts = echarts;
Vue.prototype.$moment = moment; Vue.prototype.$moment = moment;
Vue.prototype.$buildCode = buildCode; Vue.prototype.$buildCode = buildCode;
Vue.prototype.oParse = new XML.ObjTree(); Vue.prototype.oParse = new XML.ObjTree();
Vue.prototype.axios=axios; Vue.prototype.axios = axios;
import VueParticles from 'vue-particles' // import VueParticles from "vue-particles";
Vue.use(VueParticles) // Vue.use(VueParticles);
Vue.use(api); Vue.use(api);
Vue.use(ElementUI, { size: "small", zIndex: 3000 }); Vue.use(ElementUI, { size: "small", zIndex: 3000 });
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
</template> </template>
<script> <script>
import types from "../../store/types.js";
// import HelloWorld from "@/components/HelloWorld.vue"; // import HelloWorld from "@/components/HelloWorld.vue";
import menus from "./menu"; import menus from "./menu";
export default { export default {
...@@ -110,11 +111,10 @@ export default { ...@@ -110,11 +111,10 @@ export default {
this.curdate = `${Y}/${M}/${D} ${h}:${m}:${s} ${wtext}`; this.curdate = `${Y}/${M}/${D} ${h}:${m}:${s} ${wtext}`;
}, },
logout() { logout() {
localStorage.removeItem("atkoen");
localStorage.removeItem("menu"); localStorage.removeItem("menu");
localStorage.removeItem("curmenu"); localStorage.removeItem("curmenu");
this.$store.commit(types.ATOKEN, ""); this.$store.commit(types.ATOKEN, "");
localStorage.removeItem("atkoen"); localStorage.removeItem("atoken");
this.$router.push("/login"); this.$router.push("/login");
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!