Commit c28c8274 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化登录

parent 44ef027f
...@@ -11,6 +11,7 @@ import storage from "@/utils/js/Storage"; ...@@ -11,6 +11,7 @@ import storage from "@/utils/js/Storage";
// 请求超时时间 // 请求超时时间
axios.defaults.timeout = 60 * 1000; axios.defaults.timeout = 60 * 1000;
axios.defaults.withCredentials = true;
// 设置统一服务器地址 // 设置统一服务器地址
// axios.defaults.baseURL = process.env.VUE_APP_API_BASE_URL; // axios.defaults.baseURL = process.env.VUE_APP_API_BASE_URL;
......
export default {
getItem: function (sKey) {
return (
decodeURIComponent(
document.cookie.replace(
new RegExp(
"(?:(?:^|.*;)\\s*" +
encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") +
"\\s*\\=\\s*([^;]*).*$)|^.*$"
),
"$1"
)
) || null
);
},
setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) {
return false;
}
var sExpires = "";
if (vEnd) {
switch (vEnd.constructor) {
case Number:
sExpires =
vEnd === Infinity
? "; expires=Fri, 31 Dec 9999 23:59:59 GMT"
: "; max-age=" + vEnd;
break;
case String:
sExpires = "; expires=" + vEnd;
break;
case Date:
sExpires = "; expires=" + vEnd.toUTCString();
break;
}
}
document.cookie =
encodeURIComponent(sKey) +
"=" +
encodeURIComponent(sValue) +
sExpires +
(sDomain ? "; domain=" + sDomain : "") +
(sPath ? "; path=" + sPath : "") +
(bSecure ? "; secure" : "");
return true;
},
removeItem: function (sKey, sPath, sDomain) {
if (!sKey || !this.hasItem(sKey)) {
return false;
}
document.cookie =
encodeURIComponent(sKey) +
"=; expires=Thu, 01 Jan 1970 00:00:00 GMT" +
(sDomain ? "; domain=" + sDomain : "") +
(sPath ? "; path=" + sPath : "");
return true;
},
hasItem: function (sKey) {
return new RegExp(
"(?:^|;\\s*)" +
encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") +
"\\s*\\="
).test(document.cookie);
},
keys: /* optional method: you can safely remove it! */ function () {
var aKeys = document.cookie
.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "")
.split(/\s*(?:\=[^;]*)?;\s*/);
for (var nIdx = 0; nIdx < aKeys.length; nIdx++) {
aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]);
}
return aKeys;
},
};
...@@ -394,8 +394,7 @@ export default { ...@@ -394,8 +394,7 @@ export default {
// 加时间戳印记用于刷新gif // 加时间戳印记用于刷新gif
let mark = new Date().getTime(); let mark = new Date().getTime();
// this.form.mark = mark; // this.form.mark = mark;
this.imgCode = this.imgCode = this.api + "/zwfw/securitycode/createCode" + `?t=${mark}`;
this.api + "/zwfw/securitycode/createCode" + `?mark=${mark}`;
}, },
handleSubmit() { handleSubmit() {
this.$refs.form.validate(async (valid) => { this.$refs.form.validate(async (valid) => {
......
...@@ -9,12 +9,13 @@ module.exports = defineConfig({ ...@@ -9,12 +9,13 @@ module.exports = defineConfig({
}, },
devServer: { devServer: {
proxy: { proxy: {
"/api": { "/zwfw": {
target: process.env.VUE_APP_API_BASE_URL, target: process.env.VUE_APP_API_BASE_URL,
changeOrigin: true, changeOrigin: true,
pathRewrite: { // pathRewrite: {
"^/api": "", // "^/api": "",
}, // },
cookieDomainRewrite: "localhost",
}, },
"/file": { "/file": {
target: process.env.VUE_APP_API_BASE_URL, target: process.env.VUE_APP_API_BASE_URL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment