feat: 初始化
This commit is contained in:
commit
d726e4b532
27 files changed
+817
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
> 1%
|
||||||
|
last 2 versions
|
||||||
|
not dead
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"],
|
||||||
|
parserOptions: {
|
||||||
|
parser: "babel-eslint",
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"no-console": process.env.VUE_APP_PROXY === 2 ? "warn" : "off",
|
||||||
|
"no-debugger": process.env.VUE_APP_PROXY === 2 ? "warn" : "off",
|
||||||
|
},
|
||||||
|
};
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/dist
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# template-h5
|
||||||
|
|
||||||
|
## Project setup
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and hot-reloads for development
|
||||||
|
```
|
||||||
|
npm run serve
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and minifies for production
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Lints and fixes files
|
||||||
|
```
|
||||||
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customize configuration
|
||||||
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: ["@vue/cli-plugin-babel/preset"],
|
||||||
|
plugins: [
|
||||||
|
[
|
||||||
|
"import",
|
||||||
|
{
|
||||||
|
libraryName: "vant",
|
||||||
|
libraryDirectory: "es",
|
||||||
|
style: true,
|
||||||
|
},
|
||||||
|
"vant",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"name": "template-h5",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"serve:test": "cross-env VUE_APP_PROXY=1 vue-cli-service serve",
|
||||||
|
"serve:prod": "cross-env VUE_APP_PROXY=2 vue-cli-service serve",
|
||||||
|
"build": "vue-cli-service build",
|
||||||
|
"lint": "vue-cli-service lint"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.19.2",
|
||||||
|
"vant": "^2.12.36",
|
||||||
|
"vue": "^2.6.11",
|
||||||
|
"vue-router": "^3.1.6",
|
||||||
|
"vuex": "^3.1.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vue/cli-plugin-babel": "~4.5.0",
|
||||||
|
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||||
|
"@vue/cli-service": "~4.5.0",
|
||||||
|
"@vue/eslint-config-prettier": "^6.0.0",
|
||||||
|
"babel-eslint": "^10.1.0",
|
||||||
|
"babel-plugin-import": "^1.13.3",
|
||||||
|
"core-js": "^3.6.4",
|
||||||
|
"cross-env": "^7.0.2",
|
||||||
|
"eslint": "^6.7.2",
|
||||||
|
"eslint-plugin-prettier": "^3.1.1",
|
||||||
|
"eslint-plugin-vue": "^6.2.2",
|
||||||
|
"postcss-px-to-viewport": "^1.1.1",
|
||||||
|
"postcss-write-svg": "^3.0.1",
|
||||||
|
"sass": "^1.26.3",
|
||||||
|
"sass-loader": "^8.0.2",
|
||||||
|
"vue-template-compiler": "^2.6.11"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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`
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
// 代理环境,1测试环境,2生产环境
|
||||||
|
const VUE_APP_PROXY = process.env.VUE_APP_PROXY
|
||||||
|
? parseInt(process.env.VUE_APP_PROXY)
|
||||||
|
: 1;
|
||||||
|
|
||||||
|
let target = "";
|
||||||
|
|
||||||
|
switch (VUE_APP_PROXY) {
|
||||||
|
case 1:
|
||||||
|
target = "http://test.haloapp.vip";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
target = "http://haloapp.vip";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
target = "http://test.haloapp.vip";
|
||||||
|
}
|
||||||
|
|
||||||
|
let proxyTable = {
|
||||||
|
"/zuul": {
|
||||||
|
target: target,
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
},
|
||||||
|
"/sjht": {
|
||||||
|
target: target,
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
},
|
||||||
|
"/media/": {
|
||||||
|
target: target,
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
},
|
||||||
|
"/bzdb": {
|
||||||
|
target: target,
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = proxyTable;
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
|
||||||
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||||
|
</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<!-- built files will be auto injected -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
<template>
|
||||||
|
<div id="app">
|
||||||
|
<div id="nav">
|
||||||
|
<router-link to="/">Home</router-link> |
|
||||||
|
<router-link to="/about">About</router-link>
|
||||||
|
</div>
|
||||||
|
<router-view />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import "@/styles";
|
||||||
|
|
||||||
|
#nav {
|
||||||
|
padding: 30px;
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #2c3e50;
|
||||||
|
|
||||||
|
&.router-link-exact-active {
|
||||||
|
color: #42b983;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import ajax from "@/lib/ajax";
|
||||||
|
import config from "@/config";
|
||||||
|
|
||||||
|
// host
|
||||||
|
const HOST = config.host("/zuul", "/mrxf");
|
||||||
|
|
||||||
|
// 来访总量统计列表
|
||||||
|
const petitionReportTotal = (param) => {
|
||||||
|
return ajax.post(`${HOST}/petitionReport/total`, param);
|
||||||
|
};
|
||||||
|
|
||||||
|
export { petitionReportTotal };
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
import Vue from "vue";
|
||||||
|
|
||||||
|
import { Button } from "vant";
|
||||||
|
|
||||||
|
Vue.use(Button);
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
<template>
|
||||||
|
<div class="hello">
|
||||||
|
<h1 class="border-1px">{{ msg }}</h1>
|
||||||
|
<p>
|
||||||
|
For a guide and recipes on how to configure / customize this project,<br />
|
||||||
|
check out the
|
||||||
|
<a href="https://cli.vuejs.org" target="_blank" rel="noopener"
|
||||||
|
>vue-cli documentation</a
|
||||||
|
>.
|
||||||
|
</p>
|
||||||
|
<h3>Installed CLI Plugins</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>babel</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>router</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>vuex</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>eslint</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h3>Essential Links</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="https://forum.vuejs.org" target="_blank" rel="noopener"
|
||||||
|
>Forum</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="https://chat.vuejs.org" target="_blank" rel="noopener"
|
||||||
|
>Community Chat</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener"
|
||||||
|
>Twitter</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h3>Ecosystem</h3>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="https://router.vuejs.org" target="_blank" rel="noopener"
|
||||||
|
>vue-router</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="https://github.com/vuejs/vue-devtools#vue-devtools"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>vue-devtools</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener"
|
||||||
|
>vue-loader</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="https://github.com/vuejs/awesome-vue"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
>awesome-vue</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "HelloWorld",
|
||||||
|
props: {
|
||||||
|
msg: String,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
|
<style scoped lang="scss">
|
||||||
|
h3 {
|
||||||
|
margin: 40px 0 0;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 10px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #42b983;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// 应用的名称
|
||||||
|
const appName = "每日信访动态报送";
|
||||||
|
|
||||||
|
// 是否启用YApi
|
||||||
|
const YApi = false;
|
||||||
|
|
||||||
|
// 代理环境,1测试环境,2生产环境
|
||||||
|
const VUE_APP_PROXY = process.env.VUE_APP_PROXY
|
||||||
|
? parseInt(process.env.VUE_APP_PROXY)
|
||||||
|
: 1;
|
||||||
|
|
||||||
|
const host = (PASSID, GATEWAY) => {
|
||||||
|
// host
|
||||||
|
const HOST = YApi ? `/mock/73/${GATEWAY}` : `${PASSID}${GATEWAY}`;
|
||||||
|
|
||||||
|
return HOST;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
appName,
|
||||||
|
YApi,
|
||||||
|
VUE_APP_PROXY,
|
||||||
|
host,
|
||||||
|
};
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
// 添加公共请求头
|
||||||
|
const getHeader = function (options) {
|
||||||
|
if (options === "form") {
|
||||||
|
return Object.assign({
|
||||||
|
"content-type": "application/x-www-form-urlencoded",
|
||||||
|
});
|
||||||
|
} else if (options === "file") {
|
||||||
|
return Object.assign({ "content-type": "multipart/form-data" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const request = function (method, url, params, options) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
axios
|
||||||
|
.request({
|
||||||
|
headers: getHeader(options),
|
||||||
|
url: url,
|
||||||
|
method: method,
|
||||||
|
withCredentials: true,
|
||||||
|
data: method === "post" ? params : {},
|
||||||
|
params: method === "get" ? params : {},
|
||||||
|
timeout: 120000,
|
||||||
|
responseType: "json",
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
let data = response.data || JSON.parse(response.request.responseText);
|
||||||
|
resolve(data);
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
if (typeof error.response === "undefined") {
|
||||||
|
if (
|
||||||
|
location.hostname == "127.0.0.1" ||
|
||||||
|
location.hostname == "localhost"
|
||||||
|
) {
|
||||||
|
reject(error);
|
||||||
|
} else {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
get: function (url, params, options) {
|
||||||
|
return request("get", url, params, options);
|
||||||
|
},
|
||||||
|
post: function (url, params, options) {
|
||||||
|
return request("post", url, params, options);
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import XLSX from 'xlsx';
|
||||||
|
|
||||||
|
function auto_width(ws, data){
|
||||||
|
/*set worksheet max width per col*/
|
||||||
|
const colWidth = data.map(row => row.map(val => {
|
||||||
|
/*if null/undefined*/
|
||||||
|
if (val == null) {
|
||||||
|
return {'wch': 10};
|
||||||
|
}
|
||||||
|
/*if chinese*/
|
||||||
|
else if (val.toString().charCodeAt(0) > 255) {
|
||||||
|
return {'wch': val.toString().length * 2};
|
||||||
|
} else {
|
||||||
|
return {'wch': val.toString().length};
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
/*start in the first row*/
|
||||||
|
let result = colWidth[0];
|
||||||
|
for (let i = 1; i < colWidth.length; i++) {
|
||||||
|
for (let j = 0; j < colWidth[i].length; j++) {
|
||||||
|
if (result[j]['wch'] < colWidth[i][j]['wch']) {
|
||||||
|
result[j]['wch'] = colWidth[i][j]['wch'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ws['!cols'] = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function json_to_array(key, jsonData){
|
||||||
|
return jsonData.map(v => key.map(j => { return v[j] }));
|
||||||
|
}
|
||||||
|
|
||||||
|
// fix data,return string
|
||||||
|
function fixdata(data) {
|
||||||
|
let o = ''
|
||||||
|
let l = 0
|
||||||
|
const w = 10240
|
||||||
|
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)))
|
||||||
|
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)))
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// get head from excel file,return array
|
||||||
|
function get_header_row(sheet) {
|
||||||
|
const headers = []
|
||||||
|
const range = XLSX.utils.decode_range(sheet['!ref'])
|
||||||
|
let C
|
||||||
|
const R = range.s.r /* start in the first row */
|
||||||
|
for (C = range.s.c; C <= range.e.c; ++C) { /* walk every column in the range */
|
||||||
|
var cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })] /* find the cell in the first row */
|
||||||
|
var hdr = 'UNKNOWN ' + C // <-- replace with your desired default
|
||||||
|
if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
|
||||||
|
headers.push(hdr)
|
||||||
|
}
|
||||||
|
return headers
|
||||||
|
}
|
||||||
|
|
||||||
|
// export const export_table_to_excel= (id, filename) => {
|
||||||
|
// const table = document.getElementById(id);
|
||||||
|
// const wb = XLSX.utils.table_to_book(table);
|
||||||
|
// XLSX.writeFile(wb, filename);
|
||||||
|
|
||||||
|
// /* the second way */
|
||||||
|
// // const table = document.getElementById(id);
|
||||||
|
// // const wb = XLSX.utils.book_new();
|
||||||
|
// // const ws = XLSX.utils.table_to_sheet(table);
|
||||||
|
// // XLSX.utils.book_append_sheet(wb, ws, filename);
|
||||||
|
// // XLSX.writeFile(wb, filename);
|
||||||
|
// }
|
||||||
|
export const export_table_to_excel= (table, filename) => {
|
||||||
|
if(!table) return;
|
||||||
|
const wb = XLSX.utils.table_to_book(table);
|
||||||
|
XLSX.writeFile(wb, filename)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const export_json_to_excel = ({data, key, title, filename, autoWidth}) => {
|
||||||
|
const wb = XLSX.utils.book_new();
|
||||||
|
data.unshift(title);
|
||||||
|
const ws = XLSX.utils.json_to_sheet(data, {header: key, skipHeader: true});
|
||||||
|
if(autoWidth){
|
||||||
|
const arr = json_to_array(key, data);
|
||||||
|
auto_width(ws, arr);
|
||||||
|
}
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, filename);
|
||||||
|
XLSX.writeFile(wb, filename + '.xlsx');
|
||||||
|
}
|
||||||
|
|
||||||
|
export const export_array_to_excel = ({key, data, title, filename, autoWidth}) => {
|
||||||
|
const wb = XLSX.utils.book_new();
|
||||||
|
const arr = json_to_array(key, data);
|
||||||
|
arr.unshift(title);
|
||||||
|
const ws = XLSX.utils.aoa_to_sheet(arr);
|
||||||
|
if(autoWidth){
|
||||||
|
auto_width(ws, arr);
|
||||||
|
}
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, filename);
|
||||||
|
XLSX.writeFile(wb, filename + '.xlsx');
|
||||||
|
}
|
||||||
|
|
||||||
|
export const read = (data, type) => {
|
||||||
|
/* if type == 'base64' must fix data first */
|
||||||
|
// const fixedData = fixdata(data)
|
||||||
|
// const workbook = XLSX.read(btoa(fixedData), { type: 'base64' })
|
||||||
|
const workbook = XLSX.read(data, { type: type });
|
||||||
|
const firstSheetName = workbook.SheetNames[0];
|
||||||
|
const worksheet = workbook.Sheets[firstSheetName];
|
||||||
|
const header = get_header_row(worksheet);
|
||||||
|
const results = XLSX.utils.sheet_to_json(worksheet);
|
||||||
|
return {header, results};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
export_table_to_excel,
|
||||||
|
export_array_to_excel,
|
||||||
|
export_json_to_excel,
|
||||||
|
read
|
||||||
|
}
|
||||||
+121
@@ -0,0 +1,121 @@
|
|||||||
|
import { CookieStorage } from "cookie-storage";
|
||||||
|
import config from "@/config";
|
||||||
|
|
||||||
|
const cookieStorage = new CookieStorage();
|
||||||
|
|
||||||
|
const systemCode = config.systemCode;
|
||||||
|
|
||||||
|
// 随机长度字符串
|
||||||
|
const randomString = (len) => {
|
||||||
|
len = len || 10;
|
||||||
|
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
var maxPos = chars.length;
|
||||||
|
var str = "";
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
str += chars.charAt(Math.floor(Math.random() * maxPos));
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 设置localStorage
|
||||||
|
const _setItem = (key, data) => {
|
||||||
|
localStorage.setItem(key, JSON.stringify(data));
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取localStorage
|
||||||
|
const _getItem = (key) => {
|
||||||
|
let data = localStorage.getItem(key);
|
||||||
|
if (data) data = JSON.parse(data);
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除localStorage
|
||||||
|
const _removeItem = (key) => {
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 缓存用户信息
|
||||||
|
const setUserInfoCache = (info) => {
|
||||||
|
let data = {
|
||||||
|
account: info.account,
|
||||||
|
avatar: info.avatar,
|
||||||
|
userId: info.userId,
|
||||||
|
userName: info.userName,
|
||||||
|
};
|
||||||
|
_setItem("__UserInfo__", data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取缓存的用户信息
|
||||||
|
const getUserInfoCache = () => {
|
||||||
|
let data = _getItem("__UserInfo__");
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除用户信息
|
||||||
|
const removeUserInfoCache = () => {
|
||||||
|
_removeItem("__UserInfo__");
|
||||||
|
};
|
||||||
|
|
||||||
|
// 缓存token
|
||||||
|
const setToken = (value) => {
|
||||||
|
let curDate = new Date();
|
||||||
|
let nextDate = new Date(curDate.getTime() + 24 * 60 * 60 * 1000);
|
||||||
|
|
||||||
|
cookieStorage.setItem("Authorization", value, {
|
||||||
|
domain: document.domain,
|
||||||
|
expires: nextDate,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取token
|
||||||
|
const getToken = () => {
|
||||||
|
return cookieStorage.getItem("Authorization");
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除token
|
||||||
|
const removeToken = () => {
|
||||||
|
cookieStorage.removeItem("Authorization");
|
||||||
|
};
|
||||||
|
|
||||||
|
// 缓存用户权限
|
||||||
|
const setUserPowerCache = (arr) => {
|
||||||
|
let map = {};
|
||||||
|
for (let i = 0; i < arr.length; i++) {
|
||||||
|
let k = arr[i].powerCode;
|
||||||
|
map[k] = arr[i];
|
||||||
|
}
|
||||||
|
_setItem(`__UserPower_${systemCode}__`, map);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取缓存的用户权限
|
||||||
|
const getUserPowerCache = () => {
|
||||||
|
let data = _getItem(`__UserPower_${systemCode}__`);
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取指定的用户权限
|
||||||
|
const getUserSomeonePowerCache = (code) => {
|
||||||
|
let data = getUserPowerCache();
|
||||||
|
let item = null;
|
||||||
|
if (data) item = data[code];
|
||||||
|
return item;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除用户权限
|
||||||
|
const removeUserPowerCache = () => {
|
||||||
|
_removeItem(`__UserPower_${systemCode}__`);
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
randomString,
|
||||||
|
setUserInfoCache,
|
||||||
|
getUserInfoCache,
|
||||||
|
removeUserInfoCache,
|
||||||
|
setToken,
|
||||||
|
getToken,
|
||||||
|
removeToken,
|
||||||
|
setUserPowerCache,
|
||||||
|
getUserPowerCache,
|
||||||
|
removeUserPowerCache,
|
||||||
|
getUserSomeonePowerCache,
|
||||||
|
};
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
import Vue from "vue";
|
||||||
|
import App from "./App.vue";
|
||||||
|
import router from "./router";
|
||||||
|
import store from "./store";
|
||||||
|
import "./components.js";
|
||||||
|
|
||||||
|
Vue.config.productionTip = false;
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
router,
|
||||||
|
store,
|
||||||
|
render: (h) => h(App),
|
||||||
|
}).$mount("#app");
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import Vue from "vue";
|
||||||
|
import VueRouter from "vue-router";
|
||||||
|
import Home from "../views/Home.vue";
|
||||||
|
|
||||||
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
|
const routes = [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
name: "Home",
|
||||||
|
component: Home,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/about",
|
||||||
|
name: "About",
|
||||||
|
// route level code-splitting
|
||||||
|
// this generates a separate chunk (about.[hash].js) for this route
|
||||||
|
// which is lazy-loaded when the route is visited.
|
||||||
|
component: () =>
|
||||||
|
import(/* webpackChunkName: "about" */ "../views/About.vue"),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const router = new VueRouter({
|
||||||
|
routes,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import Vue from "vue";
|
||||||
|
import Vuex from "vuex";
|
||||||
|
|
||||||
|
Vue.use(Vuex);
|
||||||
|
|
||||||
|
export default new Vuex.Store({
|
||||||
|
state: {},
|
||||||
|
mutations: {},
|
||||||
|
actions: {},
|
||||||
|
modules: {},
|
||||||
|
});
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
html,body,#app {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
h1,h2,h3,h4,h5,p,dl,dt,dd,ol,ul,li {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0
|
||||||
|
}
|
||||||
|
#app {
|
||||||
|
font-family: "Helvetica","Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
color: #2c3e50;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@svg 1px-border {
|
||||||
|
height: 2px;
|
||||||
|
@rect {
|
||||||
|
fill: var(--color, black);
|
||||||
|
width: 100%;
|
||||||
|
height: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.border-1px {
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-image: svg(1px-border param(--color #00b1ff)) 2 2 stretch;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
@import "./global.scss";
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<div class="about">
|
||||||
|
<h1>This is an about page</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<template>
|
||||||
|
<div class="home">
|
||||||
|
<img alt="Vue logo" src="../assets/logo.png" />
|
||||||
|
<HelloWorld msg="Welcome to Your Vue.js App" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// @ is an alias to /src
|
||||||
|
import HelloWorld from "@/components/HelloWorld.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Home",
|
||||||
|
components: {
|
||||||
|
HelloWorld,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
const config = require("./src/config");
|
||||||
|
const proxy = require("./proxy.config");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
publicPath: "./",
|
||||||
|
outputDir: "dist",
|
||||||
|
assetsDir: "static",
|
||||||
|
indexPath: "index.html",
|
||||||
|
pages: {
|
||||||
|
index: {
|
||||||
|
// page 的入口
|
||||||
|
entry: "src/main.js",
|
||||||
|
// 模板来源
|
||||||
|
template: "public/index.html",
|
||||||
|
// 在 dist/index.html 的输出
|
||||||
|
filename: "index.html",
|
||||||
|
// 当使用 title 选项时,
|
||||||
|
// template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
|
title: config.appName,
|
||||||
|
// 在这个页面中包含的块,默认情况下会包含
|
||||||
|
// 提取出来的通用 chunk 和 vendor chunk。
|
||||||
|
chunks: ["chunk-vendors", "chunk-common", "index"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
devServer: {
|
||||||
|
proxy: proxy,
|
||||||
|
},
|
||||||
|
css: {
|
||||||
|
loaderOptions: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
Reference in new issue
Block a user