提交 92c3237d 编写于 作者: yma16's avatar yma16

fix:打包路径修改myblog_static

上级 17ecc436
......@@ -57,10 +57,10 @@ const devWebpackConfig = merge(baseWebpackConfig, {
template: 'index.html',
inject: true
}),
// copy custom static assets
// copy custom myblog_static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
from: path.resolve(__dirname, '../myblog_static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
......
......@@ -48,7 +48,7 @@ const webpackConfig = merge(baseWebpackConfig, {
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
......@@ -112,10 +112,10 @@ const webpackConfig = merge(baseWebpackConfig, {
minChunks: 3
}),
// copy custom static assets
// copy custom myblog_static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
from: path.resolve(__dirname, '../myblog_static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
......
......@@ -7,7 +7,7 @@ const path = require("path");
module.exports = {
dev: {
// Paths
assetsSubDirectory: "static",
assetsSubDirectory: "myblog_static",
assetsPublicPath: "/",
proxyTable: {
"/api/": {
......@@ -78,8 +78,8 @@ module.exports = {
// https://webpack.js.org/configuration/devtool/#production
devtool: "#source-map",
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Gzip off by default as many popular myblog_static hosts such as
// Surge or Netlify already gzip all myblog_static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
......
......@@ -6,16 +6,16 @@
<title>yma16前端日记</title>
<link
rel="shortcut icon"
href="./static/utils/fx_background/image/logo.ico"
href="myblog_static/utils/fx_background/image/logo.ico"
/>
<!-- up -->
<script src="./static/utils/fx_background/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="./static/utils/fx_background/css/core.css" />
<script src="myblog_static/utils/fx_background/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="myblog_static/utils/fx_background/css/core.css" />
<!-- 我的阿里图标库 -->
<script src="http://at.alicdn.com/t/font_1957918_9kt1mmflyr8.js"></script>
<style>
body {
background: url(./static/utils/fx_background/image/background.png);
background: url(myblog_static/utils/fx_background/image/background.png);
background-size: cover;
background-repeat: no-repeat;
overflow: hidden;
......
......@@ -248,7 +248,7 @@
q.setAttribute("className", "t"), q.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>", d = q.getElementsByTagName("*"), e = q.getElementsByTagName("a")[0]; if (!d || !d.length || !e) return {};
g = c.createElement("select"), h = g.appendChild(c.createElement("option")), i = q.getElementsByTagName("input")[0], b = { leadingWhitespace: q.firstChild.nodeType === 3, tbody: !q.getElementsByTagName("tbody").length, htmlSerialize: !!q.getElementsByTagName("link").length, style: /top/.test(e.getAttribute("style")), hrefNormalized: e.getAttribute("href") === "/a", opacity: /^0.55/.test(e.style.opacity), cssFloat: !!e.style.cssFloat, checkOn: i.value === "on", optSelected: h.selected, getSetAttribute: q.className !== "t", enctype: !!c.createElement("form").enctype, html5Clone: c.createElement("nav").cloneNode(!0).outerHTML !== "<:nav></:nav>", submitBubbles: !0, changeBubbles: !0, focusinBubbles: !1, deleteExpando: !0, noCloneEvent: !0, inlineBlockNeedsLayout: !1, shrinkWrapBlocks: !1, reliableMarginRight: !0 }, i.checked = !0, b.noCloneChecked = i.cloneNode(!0).checked, g.disabled = !0, b.optDisabled = !h.disabled; try { delete q.test } catch (s) { b.deleteExpando = !1 }!q.addEventListener && q.attachEvent && q.fireEvent && (q.attachEvent("onclick", function() { b.noCloneEvent = !1 }), q.cloneNode(!0).fireEvent("onclick")), i = c.createElement("input"), i.value = "t", i.setAttribute("type", "radio"), b.radioValue = i.value === "t", i.setAttribute("checked", "checked"), q.appendChild(i), k = c.createDocumentFragment(), k.appendChild(q.lastChild), b.checkClone = k.cloneNode(!0).cloneNode(!0).lastChild.checked, b.appendChecked = i.checked, k.removeChild(i), k.appendChild(q), q.innerHTML = "", a.getComputedStyle && (j = c.createElement("div"), j.style.width = "0", j.style.marginRight = "0", q.style.width = "2px", q.appendChild(j), b.reliableMarginRight = (parseInt((a.getComputedStyle(j, null) || { marginRight: 0 }).marginRight, 10) || 0) === 0); if (q.attachEvent)
for (o in { submit: 1, change: 1, focusin: 1 }) n = "on" + o, p = n in q, p || (q.setAttribute(n, "return;"), p = typeof q[n] == "function"), b[o + "Bubbles"] = p;
k.removeChild(q), k = g = h = j = q = i = null, f(function() { var a, d, e, g, h, i, j, k, m, n, o, r = c.getElementsByTagName("body")[0];!r || (j = 1, k = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;", m = "visibility:hidden;border:0;", n = "style='" + k + "border:5px solid #000;padding:0;'", o = "<div " + n + "><div></div></div>" + "<table " + n + " cellpadding='0' cellspacing='0'>" + "<tr><td></td></tr></table>", a = c.createElement("div"), a.style.cssText = m + "width:0;height:0;position:static;top:0;margin-top:" + j + "px", r.insertBefore(a, r.firstChild), q = c.createElement("div"), a.appendChild(q), q.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>", l = q.getElementsByTagName("td"), p = l[0].offsetHeight === 0, l[0].style.display = "", l[1].style.display = "none", b.reliableHiddenOffsets = p && l[0].offsetHeight === 0, q.innerHTML = "", q.style.width = q.style.paddingLeft = "1px", f.boxModel = b.boxModel = q.offsetWidth === 2, typeof q.style.zoom != "undefined" && (q.style.display = "inline", q.style.zoom = 1, b.inlineBlockNeedsLayout = q.offsetWidth === 2, q.style.display = "", q.innerHTML = "<div style='width:4px;'></div>", b.shrinkWrapBlocks = q.offsetWidth !== 2), q.style.cssText = k + m, q.innerHTML = o, d = q.firstChild, e = d.firstChild, h = d.nextSibling.firstChild.firstChild, i = { doesNotAddBorder: e.offsetTop !== 5, doesAddBorderForTableAndCells: h.offsetTop === 5 }, e.style.position = "fixed", e.style.top = "20px", i.fixedPosition = e.offsetTop === 20 || e.offsetTop === 15, e.style.position = e.style.top = "", d.style.overflow = "hidden", d.style.position = "relative", i.subtractsBorderForOverflowNotVisible = e.offsetTop === -5, i.doesNotIncludeMarginInBodyOffset = r.offsetTop !== j, r.removeChild(a), q = a = null, f.extend(b, i)) }); return b }();
k.removeChild(q), k = g = h = j = q = i = null, f(function() { var a, d, e, g, h, i, j, k, m, n, o, r = c.getElementsByTagName("body")[0];!r || (j = 1, k = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;", m = "visibility:hidden;border:0;", n = "style='" + k + "border:5px solid #000;padding:0;'", o = "<div " + n + "><div></div></div>" + "<table " + n + " cellpadding='0' cellspacing='0'>" + "<tr><td></td></tr></table>", a = c.createElement("div"), a.style.cssText = m + "width:0;height:0;position:myblog_static;top:0;margin-top:" + j + "px", r.insertBefore(a, r.firstChild), q = c.createElement("div"), a.appendChild(q), q.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>", l = q.getElementsByTagName("td"), p = l[0].offsetHeight === 0, l[0].style.display = "", l[1].style.display = "none", b.reliableHiddenOffsets = p && l[0].offsetHeight === 0, q.innerHTML = "", q.style.width = q.style.paddingLeft = "1px", f.boxModel = b.boxModel = q.offsetWidth === 2, typeof q.style.zoom != "undefined" && (q.style.display = "inline", q.style.zoom = 1, b.inlineBlockNeedsLayout = q.offsetWidth === 2, q.style.display = "", q.innerHTML = "<div style='width:4px;'></div>", b.shrinkWrapBlocks = q.offsetWidth !== 2), q.style.cssText = k + m, q.innerHTML = o, d = q.firstChild, e = d.firstChild, h = d.nextSibling.firstChild.firstChild, i = { doesNotAddBorder: e.offsetTop !== 5, doesAddBorderForTableAndCells: h.offsetTop === 5 }, e.style.position = "fixed", e.style.top = "20px", i.fixedPosition = e.offsetTop === 20 || e.offsetTop === 15, e.style.position = e.style.top = "", d.style.overflow = "hidden", d.style.position = "relative", i.subtractsBorderForOverflowNotVisible = e.offsetTop === -5, i.doesNotIncludeMarginInBodyOffset = r.offsetTop !== j, r.removeChild(a), q = a = null, f.extend(b, i)) }); return b }();
var j = /^(?:\{.*\}|\[.*\])$/,
k = /([A-Z])/g;
f.extend({ cache: {}, uuid: 0, expando: "jQuery" + (f.fn.jquery + Math.random()).replace(/\D/g, ""), noData: { embed: !0, object: "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", applet: !0 }, hasData: function(a) { a = a.nodeType ? f.cache[a[f.expando]] : a[f.expando]; return !!a && !m(a) }, data: function(a, c, d, e) { if (!!f.acceptData(a)) { var g, h, i, j = f.expando,
......@@ -835,4 +835,4 @@
c[d](a.call(this, b, c[d]())) }); if (f.isWindow(e)) { var g = e.document.documentElement["client" + c],
h = e.document.body; return e.document.compatMode === "CSS1Compat" && g || h && h["client" + c] || g } if (e.nodeType === 9) return Math.max(e.documentElement["client" + c], e.body["scroll" + c], e.documentElement["scroll" + c], e.body["offset" + c], e.documentElement["offset" + c]); if (a === b) { var i = f.css(e, d),
j = parseFloat(i); return f.isNumeric(j) ? j : i } return this.css(d, typeof a == "string" ? a : a + "px") } }), a.jQuery = a.$ = f, typeof define == "function" && define.amd && define.amd.jQuery && define("jquery", [], function() { return f })
})(window);
\ No newline at end of file
})(window);
......@@ -26,10 +26,10 @@
<el-submenu index="1-1">
<template slot="title">yma16</template>
<el-menu-item index="1-1-1">stay hungry</el-menu-item>
<a @click="toecharts">
<a @click="jumpToEcharts">
<el-menu-item index="1-1-2">echarts</el-menu-item>
</a>
<a @click="toadmin">
<a @click="jumpToAdmin">
<el-menu-item index="1-1-3">superuser</el-menu-item>
</a>
</el-submenu>
......@@ -58,7 +58,7 @@
<el-submenu index="3">
<template slot="title">
<i class="el-icon-chat-line-round" :click="onlinewebsocket"></i
<i class="el-icon-chat-line-round" :click="onlineWebsocket"></i
>线上聊天</template
>
</el-submenu>
......@@ -125,163 +125,157 @@
</el-footer>
</el-container>
</el-container>
<!-- <img src="./assets/logo.png"> -->
</div>
</template>
<script>
import axios from "axios";
export default {
name: "App",
data() {
name: 'App',
data () {
return {
authSlogan: "yma16",
authSlogan: 'yma16',
chat_flag: false,
msg: "yma16",
msg: 'yma16',
navigate_flag: true,
value: new Date(),
baseurl: "/api/",
// baseurl: 'http://yongma16.xyz/',
src: "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
url: "/image/logo/logo.jpg",
baseUrl: '/api/',
src: 'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg',
url: '/image/logo/logo.jpg',
srcList: [
"https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg",
"https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg",
'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
],
headerData: ["从现在开始,种一棵树", "从现在开始,种一棵树"],
readCount: 0,
};
headerData: ['从现在开始,种一棵树', '从现在开始,种一棵树'],
readCount: 0
}
},
mounted() {
this.addReadCountFun();
this.readCountFun();
mounted () {
this.addReadCountFun()
this.readCountFun()
},
methods: {
jumpIpDns: function () {
try {
window.open("https://beian.miit.gov.cn");
window.open('https://beian.miit.gov.cn')
} catch (r) {
window.location.href = "https://beian.miit.gov.cn";
throw Error(r);
window.location.href = 'https://beian.miit.gov.cn'
throw Error(r)
}
},
addReadCountFun: function () {
console.log("addfun");
let clientip = "未知";
const that = this
let clientIp = '未知'
try {
console.log("ip待定");
console.log('ip待定')
} catch (e) {
console.log(e);
console.log(e)
}
console.log("最终ip", clientip);
axios
.post(this.baseurl + "count/add/", {
ip: clientip,
that.$axios
.post(this.baseUrl + 'count/add/', {
ip: clientIp
})
.then((res) => {
console.log(res);
console.log(res)
})
.catch((e) => {
console.log(e);
});
throw Error(e)
})
},
readCountFun: function () {
let that = this;
axios
.get(that.baseurl + "count/get/")
let that = this
that.$axios
.get(that.baseUrl + 'count/get/')
.then((res) => {
console.log(res, "count");
this.readCount = res.data.num;
this.readCount = res.data.num
})
.catch((error) => {
console.log(error);
});
console.log(error)
})
},
changeNavigate: function () {
this.navigate_flag = !this.navigate_flag; // 取反
this.navigate_flag = !this.navigate_flag // 取反
},
handleOpen(key, keyPath) {
console.log(key, keyPath);
if (key === "3") {
console.log("打开3号");
this.chat_flag = true;
this.onlinewebsocket(); // 调用跳转
handleOpen (key, keyPath) {
console.log(key, keyPath)
if (key === '3') {
console.log('打开3号')
this.chat_flag = true
this.onlineWebsocket() // 调用跳转
}
if (key === "2-1") {
this.chat_flag = false;
this.loginAction(); // 调用跳转
if (key === '2-1') {
this.chat_flag = false
this.loginAction() // 调用跳转
}
if (key === "2-2") {
this.chat_flag = false;
this.registerAction(); // 调用跳转
if (key === '2-2') {
this.chat_flag = false
this.registerAction() // 调用跳转
}
},
handleClose(key, keyPath) {
console.log(key, keyPath);
console.log("关闭");
if (key === "3") {
this.chat_flag = false;
handleClose (key, keyPath) {
console.info(key, keyPath)
if (key === '3') {
this.chat_flag = false
}
},
jumpRouter: function (params) {
this.$router
.push({
name: `${params}`,
name: `${params}`
})
.catch((error) => {
console.log(error);
});
console.log(error)
})
},
onlinewebsocket: function () {
onlineWebsocket: function () {
// console.log(this.$router);
this.$router
.push({
path: "/onlinewebsocket",
path: '/onlinewebsocket'
})
.catch((error) => {
console.log(error);
});
throw Error(error)
})
},
toecharts: function () {
jumpToEcharts: function () {
// console.log(this.$router);
this.$router
.push({
path: "/bilicom",
path: '/bilicom'
})
.catch((error) => {
console.log(error);
});
console.log(error)
})
},
toadmin: function () {
jumpToAdmin: function () {
this.$router
.push({
path: "/mavoneditor",
path: '/mavoneditor'
})
.catch((error) => {
console.log(error);
});
console.log(error)
})
},
loginAction: function () {
this.$router
.push({
path: "/login",
path: '/login'
})
.catch((error) => {
console.log(error);
});
console.log(error)
})
},
registerAction: function () {
this.$router
.push({
path: "/register",
path: '/register'
})
.catch((error) => {
console.log(error);
});
},
},
};
console.log(error)
})
}
}
}
</script>
<style>
......@@ -293,7 +287,7 @@ body,
padding: 0%;
border: 0px;
height: 100%;
/* background: url(../static/utils/fx_background/image/gg.jpg) center top no-repeat; */
/* background: url(../myblog_static/utils/fx_background/image/gg.jpg) center top no-repeat; */
/* background: url(/image/snow/gg.jpg) center top no-repeat; */
}
......@@ -352,7 +346,7 @@ body {
/* background-color: #e9eef3; */
text-align: left;
opacity: 1;
/* background: url(../static/utils/fx_background/image/gg.jpg) center top no-repeat; */
/* background: url(../myblog_static/utils/fx_background/image/gg.jpg) center top no-repeat; */
margin: 0;
padding: 0;
}
......
......@@ -148,7 +148,7 @@
<!-- <el-card class="weather_class2"
cellpadding="1px"
shadow="always"
style="position: static; margin-top: 2%"
style="position: myblog_static; margin-top: 2%"
>
</el-card> -->
......
......@@ -38,7 +38,7 @@ export default {
// scene.add(cube);
const gltfLoader = new GLTFLoader()
gltfLoader.load(
'/static/utils/fx_background/model/glb/snow.glb',
'/myblog_static/utils/fx_background/model/glb/snow.glb',
function (gltf) {
console.log(gltf)
scene.add(gltf.scene)
......
......@@ -705,7 +705,7 @@ export default {
}
.input_chat1 {
/* position: static; */
/* position: myblog_static; */
margin-top: 5%;
text-align: letf;
line-height: 50px;
......@@ -713,7 +713,7 @@ export default {
}
.input_chat2 {
/* position: static; */
/* position: myblog_static; */
margin-top: 5%;
text-align: letf;
line-height: 50px;
......@@ -859,7 +859,7 @@ export default {
}
.input_chat2 {
/* position: static; */
/* position: myblog_static; */
margin-top: 5%;
width: 100%;
text-align: letf;
......
"use strict";
'use strict'
import Vue from 'vue';
import axios from "axios";
import Vue from 'vue'
import axios from 'axios'
// Full config: https://github.com/axios/axios#request-config
// axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
......@@ -12,50 +12,50 @@ let config = {
// baseURL: process.env.baseURL || process.env.apiUrl || ""
// timeout: 60 * 1000, // Timeout
// withCredentials: true, // Check cross-site Access-Control
};
}
const _axios = axios.create(config);
const _axios = axios.create(config)
_axios.interceptors.request.use(
function(config) {
function (config) {
// Do something before request is sent
return config;
return config
},
function(error) {
function (error) {
// Do something with request error
return Promise.reject(error);
return Promise.reject(error)
}
);
)
// Add a response interceptor
_axios.interceptors.response.use(
function(response) {
function (response) {
// Do something with response data
return response;
return response
},
function(error) {
function (error) {
// Do something with response error
return Promise.reject(error);
return Promise.reject(error)
}
);
)
Plugin.install = function(Vue, options) {
Vue.axios = _axios;
window.axios = _axios;
Plugin.install = function (Vue, options) {
Vue.axios = _axios
window.axios = _axios
Object.defineProperties(Vue.prototype, {
axios: {
get() {
return _axios;
get () {
return _axios
}
},
$axios: {
get() {
return _axios;
get () {
return _axios
}
},
});
};
}
})
}
Vue.use(Plugin)
export default Plugin;
export default Plugin
......@@ -4,7 +4,7 @@ import Nprogress from 'nprogress'
import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth'
import { isEmpty } from '@/utils'
import VueRouter from "vue-router"
import VueRouter from 'vue-router'
// import Router from 'vue-router'
import store from '@/store'
// store
......@@ -20,148 +20,147 @@ import Loading from '@/components/Loading'
import GrilShow from '@/components/GrilShow'
import Csslearn from '@/components/Csslearn'
Vue.use(VueRouter)
const defaultRoutes = [{
const defaultRoutes = [
{
path: '/',
name: 'Article',
component: Article
},
{
},
{
path: '/login',
name: 'Login',
component: Login
},
{
},
{
path: '/register',
name: 'Register',
component: Register
},
{
},
{
path: '/home',
name: 'Home',
component: Home
},
{
},
{
path: '/onlinewebsocket',
name: 'Onlinewebsocket',
component: Onlinewebsocket
},
{
},
{
path: '/bilicom',
name: 'Bilicom',
component: Bilicom
},
{
},
{
path: '/mavoneditor',
name: 'Mavoneditor',
component: Mavoneditor
},
{
},
{
path: '/loading',
name: 'loading',
component: Loading
},
{
},
{
path: '/gril',
name: 'grilshow',
component: GrilShow
},
{
},
{
path: '/css',
name: 'css',
component: Csslearn
}
// {
// path: '/register',
// name: 'Register',
// component: () =>
// import ('../components/Register.vue')
// },
// {
// path: '/home',
// name: 'Home',
// component: () =>
// import ('../components/Home.vue')
// },
// {
// path: '/onlinewebsocket',
// name: 'Onlinewebsocket',
// component: () =>
// import ('../components/Onlinewebsocket.vue')
// },
// {
// path: '/mavoneditor',
// name: 'Mavoneditor',
// component: () =>
// import ('../components/Mavoneditor.vue')
// },
// {
// path: '/bilicom',
// name: 'Bilicom',
// component: () =>
// import ('../components/Bilicom.vue')
// }
}
// {
// path: '/register',
// name: 'Register',
// component: () =>
// import ('../components/Register.vue')
// },
// {
// path: '/home',
// name: 'Home',
// component: () =>
// import ('../components/Home.vue')
// },
// {
// path: '/onlinewebsocket',
// name: 'Onlinewebsocket',
// component: () =>
// import ('../components/Onlinewebsocket.vue')
// },
// {
// path: '/mavoneditor',
// name: 'Mavoneditor',
// component: () =>
// import ('../components/Mavoneditor.vue')
// },
// {
// path: '/bilicom',
// name: 'Bilicom',
// component: () =>
// import ('../components/Bilicom.vue')
// }
]
let routes = [...defaultRoutes,
// ...modulesRoutes,
// ...errorRoutes,
// ...dashboardRouters
];
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch((err) => err);
};
let routes = [
...defaultRoutes
// ...modulesRoutes,
// ...errorRoutes,
// ...dashboardRouters
]
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
return originalPush.call(this, location).catch((err) => err)
}
const router = new VueRouter({
routes
});
routes
})
const whiteList = ["/login"];
const whiteList = ['/login']
router.beforeEach(async (to, from, next) => {
// Nprogress.start()
// next()
// let hasToken = getToken()
next()
console.log('localStorage', localStorage)
let name = localStorage.getItem("yma16siteUserInfoName")
let pwd = localStorage.getItem("yma16siteUserInfoPwd")
let hasToken = {
name: name,
password: pwd
// Nprogress.start()
// next()
// let hasToken = getToken()
next()
console.log('localStorage', localStorage)
let name = localStorage.getItem('yma16siteUserInfoName')
let pwd = localStorage.getItem('yma16siteUserInfoPwd')
let hasToken = {
name: name,
password: pwd
}
console.log('hasToken', hasToken)
console.log('store.state 初始化', store.state)
if (hasToken.name && hasToken.password) {
console.log('store.state.user 存在', store.state.user)
if (isEmpty(store.state.user.userInfo)) {
// 空的 modules下的user
console.log('路由的登录认证')
// 用户自主登录
await store.dispatch('user/loginUserInfo', hasToken)
// await store.dispatch('user/loginUserInfo', hasToken)
next()
} else {
next()
}
console.log('hasToken', hasToken)
console.log('store.state 初始化', store.state)
if (hasToken.name&&hasToken.password) {
console.log('store.state.user 存在', store.state.user)
if (isEmpty(store.state.user.userInfo)) {
// 空的 modules下的user
console.log('路由的登录认证')
// 用户自主登录
await store.dispatch('user/loginUserInfo', hasToken)
// await store.dispatch('user/loginUserInfo', hasToken)
next()
} else {
next()
}
} else {
if (whiteList.indexOf(to.path) !== -1) {
console.log('store.state', store.state)
next()
} else {
if (whiteList.indexOf(to.path) !== -1) {
console.log('store.state', store.state)
next()
} else {
console.log('store.state 通过', store.state)
next()
// next({ path: '/login' }) // 否则全部重定向到登录页
// Nprogress.done();
}
console.log('store.state 通过', store.state)
next()
// next({ path: '/login' }) // 否则全部重定向到登录页
// Nprogress.done();
}
});
}
})
router.afterEach((to, from) => {
Nprogress.done()
Nprogress.done()
})
export default router;
\ No newline at end of file
export default router
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册