feat: 更新

This commit is contained in:
dengtongyu committed 2021-12-07 21:43:10 +08:00
1 parent 30057420df
commit 88e8518212
18 files changed
+5148 -3091

No files matched your search

+5 -5
View File
@@ -1,14 +1,14 @@
module.exports = { module.exports = {
root: true, root: true,
env: { env: {
node: true node: true,
}, },
extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"], extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"],
parserOptions: { parserOptions: {
parser: "babel-eslint" parser: "babel-eslint",
}, },
rules: { rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off", "no-console": process.env.VUE_APP_PROXY === 2 ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off" "no-debugger": process.env.VUE_APP_PROXY === 2 ? "warn" : "off",
} },
}; };
+1
View File
@@ -1,6 +1,7 @@
.DS_Store .DS_Store
node_modules node_modules
/dist /dist
package-lock.json
# local env files # local env files
.env.local .env.local
+12 -1
View File
@@ -1,3 +1,14 @@
module.exports = { module.exports = {
presets: ["@vue/cli-plugin-babel/preset"] presets: ["@vue/cli-plugin-babel/preset"],
plugins: [
[
"import",
{
libraryName: "vant",
libraryDirectory: "es",
style: true,
},
"vant",
],
],
}; };
+5066 -3024
View File
File diff suppressed because it is too large. Load diff
+6 -7
View File
@@ -10,26 +10,25 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.19.2", "axios": "^0.19.2",
"core-js": "^3.6.4", "vant": "^2.12.36",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.1.6", "vue-router": "^3.1.6",
"vuex": "^3.1.3" "vuex": "^3.1.3"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "~4.3.0", "@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.3.0", "@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.3.0", "@vue/cli-service": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.3.0",
"@vue/cli-service": "~4.3.0",
"@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.3",
"core-js": "^3.6.4",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.1", "eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"postcss-px-to-viewport": "^1.1.1", "postcss-px-to-viewport": "^1.1.1",
"postcss-write-svg": "^3.0.1", "postcss-write-svg": "^3.0.1",
"prettier": "^1.19.1",
"sass": "^1.26.3", "sass": "^1.26.3",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11" "vue-template-compiler": "^2.6.11"
+17
View File
@@ -0,0 +1,17 @@
module.exports = {
plugins: {
autoprefixer: {},
"postcss-write-svg": {
utf8: false,
},
"postcss-px-to-viewport": {
viewportWidth: 750, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
viewportHeight: 1334, // 视窗的高度,根据750设备的宽度来指定,一般指定1334,也可以不配置
unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除)
viewportUnit: "vw", // 指定需要转换成的视窗单位,建议使用vw
selectorBlackList: [".ignore", ".hairlines"], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名
minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值
mediaQuery: false, // 允许在媒体查询中转换`px`
},
},
};
+5 -5
View File
@@ -20,23 +20,23 @@ let proxyTable = {
"/zuul": { "/zuul": {
target: target, target: target,
changeOrigin: true, changeOrigin: true,
secure: false secure: false,
}, },
"/sjht": { "/sjht": {
target: target, target: target,
changeOrigin: true, changeOrigin: true,
secure: false secure: false,
}, },
"/media/": { "/media/": {
target: target, target: target,
changeOrigin: true, changeOrigin: true,
secure: false secure: false,
}, },
"/bzdb": { "/bzdb": {
target: target, target: target,
changeOrigin: true, changeOrigin: true,
secure: false secure: false,
} },
}; };
module.exports = proxyTable; module.exports = proxyTable;
+1 -1
View File
@@ -5,7 +5,7 @@ import config from "@/config";
const HOST = config.host("/zuul", "/mrxf"); const HOST = config.host("/zuul", "/mrxf");
// 来访总量统计列表 // 来访总量统计列表
const petitionReportTotal = param => { const petitionReportTotal = (param) => {
return ajax.post(`${HOST}/petitionReport/total`, param); return ajax.post(`${HOST}/petitionReport/total`, param);
}; };
+5
View File
@@ -0,0 +1,5 @@
import Vue from "vue";
import { Button } from "vant";
Vue.use(Button);
+2 -2
View File
@@ -106,8 +106,8 @@
export default { export default {
name: "HelloWorld", name: "HelloWorld",
props: { props: {
msg: String msg: String,
} },
}; };
</script> </script>
+1 -1
View File
@@ -20,5 +20,5 @@ module.exports = {
appName, appName,
YApi, YApi,
VUE_APP_PROXY, VUE_APP_PROXY,
host host,
}; };
+3 -3
View File
@@ -4,7 +4,7 @@ import axios from "axios";
const getHeader = function (options) { const getHeader = function (options) {
if (options === "form") { if (options === "form") {
return Object.assign({ return Object.assign({
"content-type": "application/x-www-form-urlencoded" "content-type": "application/x-www-form-urlencoded",
}); });
} else if (options === "file") { } else if (options === "file") {
return Object.assign({ "content-type": "multipart/form-data" }); return Object.assign({ "content-type": "multipart/form-data" });
@@ -22,7 +22,7 @@ const request = function(method, url, params, options) {
data: method === "post" ? params : {}, data: method === "post" ? params : {},
params: method === "get" ? params : {}, params: method === "get" ? params : {},
timeout: 120000, timeout: 120000,
responseType: "json" responseType: "json",
}) })
.then(function (response) { .then(function (response) {
let data = response.data || JSON.parse(response.request.responseText); let data = response.data || JSON.parse(response.request.responseText);
@@ -51,5 +51,5 @@ export default {
}, },
post: function (url, params, options) { post: function (url, params, options) {
return request("post", url, params, options); return request("post", url, params, options);
} },
}; };
+10 -10
View File
@@ -6,7 +6,7 @@ const cookieStorage = new CookieStorage();
const systemCode = config.systemCode; const systemCode = config.systemCode;
// 随机长度字符串 // 随机长度字符串
const randomString = len => { const randomString = (len) => {
len = len || 10; len = len || 10;
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var maxPos = chars.length; var maxPos = chars.length;
@@ -23,24 +23,24 @@ const _setItem = (key, data) => {
}; };
// 获取localStorage // 获取localStorage
const _getItem = key => { const _getItem = (key) => {
let data = localStorage.getItem(key); let data = localStorage.getItem(key);
if (data) data = JSON.parse(data); if (data) data = JSON.parse(data);
return data; return data;
}; };
// 删除localStorage // 删除localStorage
const _removeItem = key => { const _removeItem = (key) => {
localStorage.removeItem(key); localStorage.removeItem(key);
}; };
// 缓存用户信息 // 缓存用户信息
const setUserInfoCache = info => { const setUserInfoCache = (info) => {
let data = { let data = {
account: info.account, account: info.account,
avatar: info.avatar, avatar: info.avatar,
userId: info.userId, userId: info.userId,
userName: info.userName userName: info.userName,
}; };
_setItem("__UserInfo__", data); _setItem("__UserInfo__", data);
}; };
@@ -57,13 +57,13 @@ const removeUserInfoCache = () => {
}; };
// 缓存token // 缓存token
const setToken = value => { const setToken = (value) => {
let curDate = new Date(); let curDate = new Date();
let nextDate = new Date(curDate.getTime() + 24 * 60 * 60 * 1000); let nextDate = new Date(curDate.getTime() + 24 * 60 * 60 * 1000);
cookieStorage.setItem("Authorization", value, { cookieStorage.setItem("Authorization", value, {
domain: document.domain, domain: document.domain,
expires: nextDate expires: nextDate,
}); });
}; };
@@ -78,7 +78,7 @@ const removeToken = () => {
}; };
// 缓存用户权限 // 缓存用户权限
const setUserPowerCache = arr => { const setUserPowerCache = (arr) => {
let map = {}; let map = {};
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
let k = arr[i].powerCode; let k = arr[i].powerCode;
@@ -94,7 +94,7 @@ const getUserPowerCache = () => {
}; };
// 获取指定的用户权限 // 获取指定的用户权限
const getUserSomeonePowerCache = code => { const getUserSomeonePowerCache = (code) => {
let data = getUserPowerCache(); let data = getUserPowerCache();
let item = null; let item = null;
if (data) item = data[code]; if (data) item = data[code];
@@ -117,5 +117,5 @@ export {
setUserPowerCache, setUserPowerCache,
getUserPowerCache, getUserPowerCache,
removeUserPowerCache, removeUserPowerCache,
getUserSomeonePowerCache getUserSomeonePowerCache,
}; };
+2 -1
View File
@@ -2,11 +2,12 @@ import Vue from "vue";
import App from "./App.vue"; import App from "./App.vue";
import router from "./router"; import router from "./router";
import store from "./store"; import store from "./store";
import "./components.js";
Vue.config.productionTip = false; Vue.config.productionTip = false;
new Vue({ new Vue({
router, router,
store, store,
render: h => h(App) render: (h) => h(App),
}).$mount("#app"); }).$mount("#app");
+4 -4
View File
@@ -8,7 +8,7 @@ const routes = [
{ {
path: "/", path: "/",
name: "Home", name: "Home",
component: Home component: Home,
}, },
{ {
path: "/about", path: "/about",
@@ -17,12 +17,12 @@ const routes = [
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: () => component: () =>
import(/* webpackChunkName: "about" */ "../views/About.vue") import(/* webpackChunkName: "about" */ "../views/About.vue"),
} },
]; ];
const router = new VueRouter({ const router = new VueRouter({
routes routes,
}); });
export default router; export default router;
+1 -1
View File
@@ -7,5 +7,5 @@ export default new Vuex.Store({
state: {}, state: {},
mutations: {}, mutations: {},
actions: {}, actions: {},
modules: {} modules: {},
}); });
+2 -2
View File
@@ -12,7 +12,7 @@ import HelloWorld from "@/components/HelloWorld.vue";
export default { export default {
name: "Home", name: "Home",
components: { components: {
HelloWorld HelloWorld,
} },
}; };
</script> </script>
+5 -24
View File
@@ -1,7 +1,5 @@
const config = require("./src/config"); const config = require("./src/config");
const proxy = require("./proxy.config"); const proxy = require("./proxy.config");
const pxtoviewport = require("postcss-px-to-viewport");
const pxtowritesvg = require("postcss-write-svg");
module.exports = { module.exports = {
publicPath: "./", publicPath: "./",
@@ -21,30 +19,13 @@ module.exports = {
title: config.appName, title: config.appName,
// 在这个页面中包含的块,默认情况下会包含 // 在这个页面中包含的块,默认情况下会包含
// 提取出来的通用 chunk 和 vendor chunk。 // 提取出来的通用 chunk 和 vendor chunk。
chunks: ["chunk-vendors", "chunk-common", "index"] chunks: ["chunk-vendors", "chunk-common", "index"],
} },
}, },
devServer: { devServer: {
proxy: proxy proxy: proxy,
}, },
css: { css: {
loaderOptions: { loaderOptions: {},
postcss: { },
plugins: [
pxtowritesvg({
utf8: false
}),
pxtoviewport({
viewportWidth: 750, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
viewportHeight: 1334, // 视窗的高度,根据750设备的宽度来指定,一般指定1334,也可以不配置
unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数(很多时候无法整除)
viewportUnit: "vw", // 指定需要转换成的视窗单位,建议使用vw
selectorBlackList: [".ignore", ".hairlines"], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名
minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值
mediaQuery: false // 允许在媒体查询中转换`px`
})
]
}
}
}
}; };