Commit a45ee0d4 authored by 罗超's avatar 罗超

初始化项目

parent 1ed0205b
Pipeline #85 canceled with stages
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
/dist
/src-bex/www
/src-capacitor
/src-cordova
/.quasar
/node_modules
module.exports = {
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
// This option interrupts the configuration hierarchy at this file
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
root: true,
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports
},
env: {
browser: true
},
// Rules order is important, please avoid shuffling them
extends: [
// Base ESLint recommended rules
// 'eslint:recommended',
// Uncomment any of the lines below to choose desired strictness,
// but leave only one uncommented!
// See https://eslint.vuejs.org/rules/#available-rules
'plugin:vue/essential', // Priority A: Essential (Error Prevention)
// 'plugin:vue/strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
// 'plugin:vue/recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
'standard'
],
plugins: [
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file
// required to lint *.vue files
'vue',
],
globals: {
ga: true, // Google Analytics
cordova: true,
__statics: true,
process: true,
Capacitor: true,
chrome: true
},
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow paren-less arrow functions
'arrow-parens': 'off',
'one-var': 'off',
'import/first': 'off',
'import/named': 'error',
'import/namespace': 'error',
'import/default': 'error',
'import/export': 'error',
'import/extensions': 'off',
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': 'off',
'prefer-promise-reject-errors': 'off',
// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}
.DS_Store
.thumbs.db
node_modules
# Quasar core related directories
.quasar
/dist
# Cordova related directories and files
/src-cordova/node_modules
/src-cordova/platforms
/src-cordova/plugins
/src-cordova/www
# Capacitor related directories and files
/src-capacitor/www
/src-capacitor/node_modules
# BEX related directories and files
/src-bex/www
/src-bex/js/core
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
yarn.lock
package-lock.json
.vscode/
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
plugins: [
// to edit target browsers: use "browserslist" field in package.json
require('autoprefixer')
]
}
module.exports = {
presets: [
'@quasar/babel-preset-app'
]
}
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"src/*": [
"src/*"
],
"app/*": [
"*"
],
"components/*": [
"src/components/*"
],
"layouts/*": [
"src/layouts/*"
],
"pages/*": [
"src/pages/*"
],
"assets/*": [
"src/assets/*"
],
"boot/*": [
"src/boot/*"
],
"vue$": [
"node_modules/vue/dist/vue.esm.js"
]
}
},
"exclude": [
"dist",
".quasar",
"node_modules"
]
}
\ No newline at end of file
{
"name": "minister",
"version": "0.0.1",
"description": "jiahe japen school system",
"productName": "甲鹤教育集团",
"author": "alex",
"private": true,
"scripts": {
"lint": "eslint --ext .js,.vue ./",
"test": "echo \"No test specified\" && exit 0"
},
"dependencies": {
"@quasar/extras": "^1.0.0",
"@riophae/vue-treeselect": "^0.4.0",
"ali-oss": "^6.12.0",
"axios": "^0.18.1",
"co": "^4.6.0",
"core-js": "^3.6.5",
"cos-js-sdk-v5": "^1.1.5",
"element-ui": "^2.14.1",
"html2canvas": "^1.0.0-rc.7",
"js-md5": "^0.7.3",
"lockr": "^0.8.5",
"mavon-editor": "^2.9.1",
"quasar": "^1.0.0",
"relation-graph": "^1.0.8",
"v-viewer": "^1.5.1",
"vue-i18n": "^8.0.0",
"vue-inline-svg": "^2.0.0"
},
"devDependencies": {
"@quasar/app": "^2.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.1.2"
},
"browserslist": [
"ie >= 11",
"last 10 Chrome versions",
"last 10 Firefox versions",
"last 4 Edge versions",
"last 7 Safari versions",
"last 8 Android versions",
"last 8 ChromeAndroid versions",
"last 8 FirefoxAndroid versions",
"last 10 iOS versions",
"last 5 Opera versions"
],
"engines": {
"node": ">= 10.18.1",
"npm": ">= 6.13.4",
"yarn": ">= 1.21.1"
}
}
/*
* This file runs in a Node context (it's NOT transpiled by Babel), so use only
* the ES6 features that are supported by your Node version. https://node.green/
*/
// Configuration for your app
// https://quasar.dev/quasar-cli/quasar-conf-js
/* eslint-env node */
module.exports = function (ctx) {
return {
// https://quasar.dev/quasar-cli/supporting-ts
supportTS: false,
// https://quasar.dev/quasar-cli/prefetch-feature
// preFetch: true,
// app boot file (/src/boot)
// --> boot files are part of "main.js"
// https://quasar.dev/quasar-cli/boot-files
boot: [
'i18n',
'axios',
'permission',
'inline-svg'
],
// https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css
css: [
'app.sass'
],
// https://github.com/quasarframework/quasar/tree/dev/extras
extras: [
// 'ionicons-v4',
// 'mdi-v5',
// 'fontawesome-v5',
// 'eva-icons',
// 'themify',
// 'line-awesome',
// 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both!
'roboto-font', // optional, you are not bound to it
'material-icons' // optional, you are not bound to it
],
// Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build
build: {
vueRouterMode: 'hash', // available values: 'hash', 'history'
env: ctx.dev ? {
API: 'http://192.168.1.13:8085/api'
} : {
API: 'http://eduapi.oytour.com/api'
},
// transpile: false,
// Add dependencies for transpiling with Babel (Array of string/regex)
// (from node_modules, which are by default not transpiled).
// Applies only if "transpile" is set to true.
// transpileDependencies: [],
// rtl: false, // https://quasar.dev/options/rtl-support
// preloadChunks: true,
// showProgress: false,
// gzip: true,
// analyze: true,
// Options below are automatically set depending on the env, set them if you want to override
// extractCSS: false,
// https://quasar.dev/quasar-cli/handling-webpack
extendWebpack(cfg) {
// cfg.module.rules.push({
// enforce: 'pre',
// test: /\.(js|vue)$/,
// loader: 'eslint-loader',
// exclude: /node_modules/
// })
}
},
// Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer
devServer: {
https: false,
port: 8181,
open: true // opens browser window automatically
},
// https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework
framework: {
iconSet: 'material-icons', // Quasar icon set
lang: 'en-us', // Quasar language pack
config: {},
// Possible values for "importStrategy":
// * 'auto' - (DEFAULT) Auto-import needed Quasar components & directives
// * 'all' - Manually specify what to import
importStrategy: 'auto',
// For special cases outside of where "auto" importStrategy can have an impact
// (like functional components as one of the examples),
// you can manually specify Quasar components/directives to be available everywhere:
//
components: [
'QLayout',
'QHeader',
'QDrawer',
'QPageContainer',
'QPage',
'QToolbar',
'QToolbarTitle',
'QBtn',
'QIcon',
'QList',
'QItem',
'QItemSection',
'QItemLabel',
'QTabs',
'QRouteTab',
'QAvatar',
'QBtnDropdown',
'QFooter',
'QMenu',
'QCarousel',
'QCarouselControl',
'QCarouselSlide',
'QInput',
'QDate',
'QPopupProxy',
'QBanner',
'QSeparator',
'QChip',
'QTab',
'QSelect',
'QVideo',
'QImg',
'QResizeObserver',
'QMarkupTable',
'QForm',
'QTable',
'QTh',
'QTr',
'QTd',
'QCard',
'QCheckbox',
'QTree',
'QOptionGroup',
'QRadio',
'QBtnGroup'
],
// directives: [],
// Quasar plugins
plugins: [
'Meta',
'Notify',
'Dialog',
'LoadingBar'
]
},
// animations: 'all', // --- includes all animations
// https://quasar.dev/options/animations
animations: [],
// https://quasar.dev/quasar-cli/developing-ssr/configuring-ssr
ssr: {
pwa: false
},
// https://quasar.dev/quasar-cli/developing-pwa/configuring-pwa
pwa: {
workboxPluginMode: 'GenerateSW', // 'GenerateSW' or 'InjectManifest'
workboxOptions: {}, // only for GenerateSW
manifest: {
name: 'com.viitto.confuius',
short_name: 'com.viitto.confuius',
description: 'jiahe japen school system',
display: 'standalone',
orientation: 'portrait',
background_color: '#ffffff',
theme_color: '#027be3',
icons: [{
src: 'icons/icon-128x128.png',
sizes: '128x128',
type: 'image/png'
},
{
src: 'icons/icon-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'icons/icon-256x256.png',
sizes: '256x256',
type: 'image/png'
},
{
src: 'icons/icon-384x384.png',
sizes: '384x384',
type: 'image/png'
},
{
src: 'icons/icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
}
},
// Full list of options: https://quasar.dev/quasar-cli/developing-cordova-apps/configuring-cordova
cordova: {
// noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing
},
// Full list of options: https://quasar.dev/quasar-cli/developing-capacitor-apps/configuring-capacitor
capacitor: {
hideSplashscreen: true
},
// Full list of options: https://quasar.dev/quasar-cli/developing-electron-apps/configuring-electron
electron: {
bundler: 'packager', // 'packager' or 'builder'
packager: {
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options
// OS X / Mac App Store
// appBundleId: '',
// appCategoryType: '',
// osxSign: '',
// protocol: 'myapp://path',
// Windows only
// win32metadata: { ... }
},
builder: {
// https://www.electron.build/configuration/configuration
appId: 'confucius'
},
// More info: https://quasar.dev/quasar-cli/developing-electron-apps/node-integration
nodeIntegration: true,
extendWebpack( /* cfg */ ) {
// do something with Electron main process Webpack cfg
// chainWebpack also available besides this extendWebpack
}
}
}
}
<template>
<div id="q-app">
<router-view />
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
@import url('~assets/css/font.css');
@import url('//at.alicdn.com/t/font_2077629_fnioszx4oyw.css');
html,
body,
#q-app {
min-height: 100vh;
min-width: 100%;
-webkit-font-smoothing: antialiased;
font-family: -apple-system,BlinkMacSystemFont,'pingfang','Microsoft YaHei',"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
color: #3f4254;
}
</style>
/**
登录数据访问层,用户接口不能通过页面直接调用,先注入Store全局管理
*/
import request from '../utils/request'
export function login({ Account, Password }) {
// headers: {
// 'Content-Type': 'application/json;charset=UTF-8'
// }, 申明Headers信息,不包含token ,token通过注入添加
return request({
url: '/login/login',
method: "post",
// header,
data: {
Account,
Password,
AccountType: 1
}
});
}
export function getInfo(token) {
return request({
url: '/user/info',
method: 'get',
data: {}
})
}
export function logout() {
return request({
url: '/logout',
method: 'post',
data: {}
})
}
\ No newline at end of file
import request from '../utils/request'
/**
* 获取学校分页列表
*
*/
export function TestApi(cmdStr,data) {
return request({
url: cmdStr,
method: 'post',
data
})
}
\ No newline at end of file
import request from '../../utils/request'
/**
* 重置用户密码信息
*/
export function resetPassword(data) {
//参数信息AccountType AccountId
return request({
url: '/user/ResetUserPassword',
method: 'post',
data
})
}
/**
* 获取员工列表
* @param {查询参数} data
*/
export function queryEmployee(data)
{
return request({
url: '/user/GetEmployeeList',
method: 'post',
data
})
}
/**
* 修改离职信息
* @param {查询参数} data
*/
export function UpdateEmployeeLeave(data)
{
return request({
url: '/User/UpdateEmployeeLeaveTime',
method: 'post',
data
})
}
/**
* 修改部门
* @param {查询参数} data
*/
export function UpdateEmployeeDept(data)
{
return request({
url: '/User/UpdateEmployeeDept',
method: 'post',
data
})
}
/**
* 修改岗位
* @param {查询参数} data
*/
export function UpdateEmployeePost(data)
{
return request({
url: '/User/UpdateEmployeePost',
method: 'post',
data
})
}
/**
* 重置密码
* @param {查询参数} data
*/
export function BatchResetUserPassword(data)
{
return request({
url: '/User/BatchResetUserPassword',
method: 'post',
data
})
}
/**
* 获取部门Id
*/
export function getEmployeeAddrBook(data)
{
return request({
url: '/User/GetEmployeeAddrBook',
method: 'post',
data
})
}
/* @font-face {
font-family: 'pingfang';
src: url('../font/PingFang2.ttf');
} */
@font-face {
font-family: 'pingfang';
src: url('../font/PingFangMedium.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'pingfang-b';
src: url('../font/PingFangBold.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
.pingfang-b{
font-family: 'pingfang-b';
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="67.407623mm"
height="62.908276mm"
viewBox="0 0 238.84591 222.90334"
id="svg3570"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="quasar-logo-full.svg">
<defs
id="defs3572" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.979899"
inkscape:cx="-39.753589"
inkscape:cy="27.706388"
inkscape:document-units="px"
inkscape:current-layer="g4895-4-4"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1056"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata3575">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-277.71988,-312.33911)">
<g
id="g4895-4-4"
transform="translate(1419.0442,398.9018)">
<g
transform="translate(-29.620665,-4)"
id="g4579-2-20">
<g
id="g4445-2-0"
transform="translate(12.499948,7.809312)">
<g
inkscape:export-ydpi="44.860481"
inkscape:export-xdpi="44.860481"
inkscape:export-filename="/home/emanuele/Desktop/logo1.png"
transform="translate(-712.85583,-503.26814)"
id="g4561-6-7-0">
<g
transform="translate(16.233481,0)"
style="font-style:normal;font-weight:normal;font-size:50.25774765px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#263238;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="flowRoot4513-6-6-08">
<path
d="m -402.73125,631.46823 q -0.6125,0.0438 -1.3125,0.0875 -0.65625,0 -1.4,0 l -9.31875,0 q -12.81875,0 -12.81875,-8.44375 l 0,-13.475 q 0,-8.26875 12.6,-8.26875 l 9.75625,0 q 12.6,0 12.6,8.26875 l 0,13.475 q 0,5.03125 -4.4625,7.04375 l 3.10625,2.14375 q 1.35625,0.83125 1.35625,1.70625 0,0.875 -0.7,1.3125 -0.65625,0.48125 -1.88125,0.48125 -0.30625,0 -0.7875,-0.13125 -0.4375,-0.0875 -1.05,-0.48125 l -5.6875,-3.71875 z m 5.38125,-21.74375 q 0,-4.76875 -7.9625,-4.76875 l -9.58125,0 q -7.9625,0 -7.9625,4.76875 l 0,13.3875 q 0,4.94375 8.3125,4.94375 l 8.88125,0 q 8.3125,0 8.3125,-4.94375 l 0,-13.3875 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.75px;font-family:'Neuropol X';-inkscape-font-specification:'Neuropol X';text-align:start;letter-spacing:5px;word-spacing:0px;text-anchor:start;fill:#263238;fill-opacity:1"
id="path3428" />
<path
d="m -368.0585,631.64323 q -11.2875,0 -11.2875,-6.9125 l 0,-12.73125 q 0,-1.8375 2.31875,-1.8375 2.31875,0 2.31875,1.8375 l 0,12.775 q 0,3.325 6.475,3.325 l 8.3125,0 q 6.475,0 6.475,-3.325 l 0,-12.775 q 0,-1.8375 2.31875,-1.8375 2.3625,0 2.3625,1.8375 l 0,12.73125 q 0,6.9125 -11.2875,6.9125 l -8.00625,0 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.75px;font-family:'Neuropol X';-inkscape-font-specification:'Neuropol X';text-align:start;letter-spacing:5px;word-spacing:0px;text-anchor:start;fill:#263238;fill-opacity:1"
id="path3430" />
<path
d="m -327.2833,631.64323 q -9.3625,0 -9.3625,-5.81875 l 0,-2.49375 q 0,-5.775 9.3625,-5.775 l 18.59375,0 0,-0.65625 q 0,-3.0625 -5.38125,-3.0625 l -6.16875,0 q -2.1875,0 -2.1875,-1.70625 0,-1.75 2.1875,-1.75 l 6.16875,0 q 9.93125,0 9.93125,6.51875 l 0,8.575 q 0,6.16875 -9.5375,6.16875 l -13.60625,0 z m 13.34375,-3.4125 q 5.25,0 5.25,-2.8875 l 0,-4.76875 -18.24375,0 q -5.11875,0 -5.11875,2.66875 l 0,2.275 q 0,2.7125 5.11875,2.7125 l 12.99375,0 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.75px;font-family:'Neuropol X';-inkscape-font-specification:'Neuropol X';text-align:start;letter-spacing:5px;word-spacing:0px;text-anchor:start;fill:#263238;fill-opacity:1"
id="path3432" />
<path
d="m -262.77031,626.74323 q 0,4.9 -9.975,4.9 l -17.0625,0 q -2.1875,0 -2.1875,-1.70625 0,-1.70625 2.1875,-1.70625 l 17.0625,0 q 5.38125,0 5.38125,-1.4875 l 0,-2.45 q 0,-1.4875 -5.38125,-1.4875 l -9.0125,0 q -9.975,0 -9.975,-4.76875 l 0,-2.05625 q 0,-5.6 10.28125,-5.6 l 5.99375,0 q 2.23125,0 2.23125,1.75 0,0.875 -0.6125,1.3125 -0.56875,0.39375 -1.61875,0.39375 l -5.99375,0 q -5.73125,0 -5.73125,2.14375 l 0,1.925 q 0,1.79375 5.6875,1.79375 l 9.0125,0 q 9.7125,0 9.7125,4.4625 l 0,2.58125 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.75px;font-family:'Neuropol X';-inkscape-font-specification:'Neuropol X';text-align:start;letter-spacing:5px;word-spacing:0px;text-anchor:start;fill:#263238;fill-opacity:1"
id="path3434" />
<path
d="m -241.91709,631.64323 q -9.3625,0 -9.3625,-5.81875 l 0,-2.49375 q 0,-5.775 9.3625,-5.775 l 18.59375,0 0,-0.65625 q 0,-3.0625 -5.38125,-3.0625 l -6.16875,0 q -2.1875,0 -2.1875,-1.70625 0,-1.75 2.1875,-1.75 l 6.16875,0 q 9.93125,0 9.93125,6.51875 l 0,8.575 q 0,6.16875 -9.5375,6.16875 l -13.60625,0 z m 13.34375,-3.4125 q 5.25,0 5.25,-2.8875 l 0,-4.76875 -18.24375,0 q -5.11875,0 -5.11875,2.66875 l 0,2.275 q 0,2.7125 5.11875,2.7125 l 12.99375,0 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.75px;font-family:'Neuropol X';-inkscape-font-specification:'Neuropol X';text-align:start;letter-spacing:5px;word-spacing:0px;text-anchor:start;fill:#263238;fill-opacity:1"
id="path3436" />
<path
d="m -205.62285,617.33698 q 0,-6.95625 11.2875,-6.95625 l 3.36875,0 q 2.23125,0 2.23125,1.79375 0,1.79375 -2.23125,1.79375 l -3.54375,0 q -6.475,0 -6.475,3.28125 l 0,12.775 q 0,1.8375 -2.31875,1.8375 -2.31875,0 -2.31875,-1.8375 l 0,-12.6875 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:43.75px;font-family:'Neuropol X';-inkscape-font-specification:'Neuropol X';text-align:start;letter-spacing:5px;word-spacing:0px;text-anchor:start;fill:#263238;fill-opacity:1"
id="path3438" />
</g>
</g>
</g>
</g>
<g
id="g5443-0-1-5-1-9"
transform="matrix(0.55595317,0,0,0.55595317,-521.93484,-328.66104)"
inkscape:export-filename="/home/emanuele/Desktop/logo1.png"
inkscape:export-xdpi="44.860481"
inkscape:export-ydpi="44.860481">
<g
inkscape:export-ydpi="3.4165223"
inkscape:export-xdpi="3.4165223"
transform="matrix(0.09527033,0,0,0.09527033,-1695.2716,706.62921)"
id="g8856-6-1-1-9-0-1-9">
<circle
r="1485"
cy="-1361.2571"
cx="8317.3574"
id="circle8858-1-3-7-6-5-3-0"
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:50;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-xdpi="10.031387"
inkscape:export-ydpi="10.031387" />
<path
inkscape:export-ydpi="10.031387"
inkscape:export-xdpi="10.031387"
style="opacity:1;fill:#263238;fill-opacity:1;stroke:none;stroke-width:10;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 8560.3823,-1361.3029 a 242.947,242.947 0 0 1 -242.947,242.948 242.947,242.947 0 0 1 -242.947,-242.948 242.947,242.947 0 0 1 242.947,-242.946 242.947,242.947 0 0 1 242.947,242.946 z"
id="path8860-5-4-8-2-9-0-9"
inkscape:connector-curvature="0" />
<path
id="path8862-5-5-9-1-3-6-3"
d="m 9395.8755,-1984.028 a 1245.372,1245.372 0 0 0 -190.8415,-249.4971 l -280.8618,162.1556 c -87.542,-74.7796 -187.0349,-132.0588 -293.2407,-169.9527 -95.8868,97.1766 -172.0602,205.7604 -226.9672,323.8487 312.6411,-21.2772 635.5313,91.8725 935.2898,326.0721 l 176.7612,-102.0532 a 1245.372,1245.372 0 0 0 -120.1398,-290.5734 z"
clip-path="none"
mask="none"
style="fill:#1976d2;fill-opacity:1"
inkscape:connector-curvature="0"
inkscape:transform-center-x="-514.04855"
inkscape:transform-center-y="-444.04649" />
<path
inkscape:transform-center-y="265.80217"
inkscape:transform-center-x="-689.63727"
inkscape:connector-curvature="0"
style="fill:#42a5f5;fill-opacity:1"
mask="none"
clip-path="none"
d="m 9395.9474,-738.70387 a 1245.372,1245.372 0 0 0 120.6501,-290.02213 l -280.8618,-162.1557 c 20.99,-113.2034 20.8488,-228.0063 0.563,-338.9302 -132.1008,-34.4521 -264.2238,-46.1283 -393.9448,-34.635 174.7471,260.1165 238.2017,596.32248 185.2582,973.02076 l 176.7612,102.05309 a 1245.372,1245.372 0 0 0 191.5741,-249.33082 z"
id="path8864-4-8-1-2-4-4-4" />
<path
id="path8866-7-5-5-0-6-4-7"
d="m 8317.501,-115.97954 a 1245.372,1245.372 0 0 0 311.4916,-40.52501 l 0,-324.31131 c 108.5321,-38.42382 207.8837,-95.94755 293.8037,-168.97752 -36.214,-131.6287 -92.1636,-251.88868 -166.9776,-358.48372 -137.894,281.39369 -397.3296,504.44998 -750.0316,646.9487 l 0,204.10623 a 1245.372,1245.372 0 0 0 311.7139,41.24263 z"
clip-path="none"
mask="none"
style="fill:#1976d2;fill-opacity:1"
inkscape:connector-curvature="0"
inkscape:transform-center-x="-117.49007"
inkscape:transform-center-y="639.34029" />
<path
inkscape:transform-center-y="444.04652"
inkscape:transform-center-x="514.04857"
inkscape:connector-curvature="0"
style="fill:#42a5f5;fill-opacity:1"
mask="none"
clip-path="none"
d="m 7238.9827,-738.57936 a 1245.372,1245.372 0 0 0 190.8415,249.49714 l 280.8618,-162.15566 c 87.5421,74.77965 187.0349,132.05879 293.2407,169.95271 95.8868,-97.17659 172.0602,-205.76036 226.9672,-323.8487 -312.6411,21.27714 -635.5313,-91.87254 -935.2898,-326.07203 l -176.7612,102.0531 a 1245.372,1245.372 0 0 0 120.1398,290.57344 z"
id="path8868-6-7-4-7-2-7-3" />
<path
id="path8870-5-3-9-3-5-5-1"
d="m 7238.9108,-1983.9035 a 1245.372,1245.372 0 0 0 -120.6501,290.0221 l 280.8618,162.1557 c -20.99,113.2035 -20.8488,228.0063 -0.563,338.9302 132.1008,34.4521 264.2238,46.1283 393.9448,34.635 -174.7471,-260.1165 -238.2017,-596.3225 -185.2582,-973.0207 l -176.7612,-102.0532 a 1245.372,1245.372 0 0 0 -191.5741,249.3309 z"
clip-path="none"
mask="none"
style="fill:#1976d2;fill-opacity:1"
inkscape:connector-curvature="0"
inkscape:transform-center-x="689.63729"
inkscape:transform-center-y="-265.80221" />
<path
inkscape:transform-center-y="-639.34032"
inkscape:transform-center-x="117.49005"
inkscape:connector-curvature="0"
style="fill:#42a5f5;fill-opacity:1"
mask="none"
clip-path="none"
d="m 8317.3572,-2606.6279 a 1245.372,1245.372 0 0 0 -311.4915,40.525 l -1e-4,324.3113 c -108.5321,38.4239 -207.8837,95.9476 -293.8037,168.9776 36.214,131.6287 92.1637,251.8886 166.9776,358.4837 137.894,-281.3937 397.3296,-504.45 750.0316,-646.9487 l 1e-4,-204.1063 a 1245.372,1245.372 0 0 0 -311.714,-41.2426 z"
id="path8872-6-3-2-1-3-3-7" />
</g>
</g>
</g>
</g>
</svg>
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Erpindex from '../utils/erpindex'
import axios from 'axios'
import 'vue-easytable/libs/themes-base/index.css'
import {VTable,VPagination} from 'vue-easytable'
import 'viewerjs/dist/viewer.css'
import Viewer from 'v-viewer' //权限编码JS
Vue.http = Vue.prototype.$http = axios
// 时间扩展格式化
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds() //秒
};
if (/(y+)/.test(fmt)){ //根据y的长度来截取年
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for (var k in o){
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
}
return fmt;
};
Vue.use(ElementUI)
Vue.use(Erpindex)
Vue.use(Viewer);
Vue.component(VTable.name, VTable)
Vue.component(VPagination.name, VPagination)
Vue.prototype.$axios = axios
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import messages from 'src/i18n'
import '../../public/static/UE/ueditor.config.js'
import '../../public/static/UE/ueditor.all.js'
import '../../public/static/UE/lang/zh-cn/zh-cn.js'
import '../../public/static/UE/ueditor.parse.min.js'
Vue.use(VueI18n)
const i18n = new VueI18n({
locale: 'zh-CN',
// fallbackLocale: 'en-us',
messages:{
'zh-CN': require('../i18n/zh-cn/index'), // 中文语言包
}
})
export default ({ app }) => {
// Set i18n instance on app
app.i18n = i18n
}
export { i18n }
import Vue from "vue";
import { InlineSvgPlugin } from "vue-inline-svg";
Vue.use(InlineSvgPlugin);
import router from "../router/index";
import store from "../store/index";
import { LoadingBar, Notify } from "quasar";
import { getAuth } from "../utils/auth"; // 验权
LoadingBar.setDefaults({
color: "primary",
size: "5px",
position: "bottom"
});
let loadAsyncRouter = false;
const whiteList = ["/login", "/"]; // 不重定向白名单
router.beforeEach((to, from, next) => {
localStorage.setItem("routerBefore", from.path);
LoadingBar.start();
/** 请求头包含授权信息 并且 页面必须授权 直接进入 */
if (getAuth()) {
//debugger;
// if (to.path === "/login" || to.path === "/") {
// next({
// path: "/index"
// });
// LoadingBar.stop();
// } else {
// if (!loadAsyncRouter) {
// // 判断当前用户是否获取权限
// loadAsyncRouter = true;
// if (store.getters.allAuth) {
// store.dispatch("GenerateRoutes", store.getters.allAuth).then(() => {
// // 根据auths权限生成可访问的路由表
// //router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
// if (to.path === "/404") {
// next({
// path: to.redirectedFrom || "/",
// replace: true
// });
// } else {
// next({
// ...to,
// replace: true
// });
// LoadingBar.stop();
// }
// });
// } else {
// store
// .dispatch("getAuth")
// .then(auths => {
// // 拉取user_info
// store.dispatch("GenerateRoutes", auths).then(() => {
// // 根据auths权限生成可访问的路由表
// router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
// if (to.path === "/404") {
// next({
// path: to.redirectedFrom || "/",
// replace: true
// });
// LoadingBar.stop();
// } else {
// next({
// ...to,
// replace: true
// });
// LoadingBar.stop();
// }
// });
// })
// .catch(err => {
// loadAsyncRouter = false;
// store.dispatch("LogOut").then(() => {
// Notify.create({
// icon: "error",
// color: "negative",
// message: err.msg || "获取用户信息失败",
// position: "top"
// });
// next({
// path: "/"
// });
// });
// });
// }
// } else {
// next();
// }
// next();
// }
next();
} else {
if (whiteList.indexOf(to.path) !== -1) {
next();
} else {
next(`/login?redirect=${to.path}`); // 否则全部重定向到登录页
LoadingBar.stop();
}
}
});
router.afterEach(() => {
LoadingBar.stop(); // 结束Progress
});
router.onError(error => {
const pattern = /Loading chunk (\d)+ failed/g;
const isChunkLoadFailed = error.message.match(pattern);
const targetPath = router.history.pending.fullPath;
if (isChunkLoadFailed) {
router.replace(targetPath);
}
});
\ No newline at end of file
<template>
<q-item
clickable
tag="a"
target="_blank"
:href="link"
>
<q-item-section
v-if="icon"
avatar
>
<q-icon :name="icon" />
</q-item-section>
<q-item-section>
<q-item-label>{{ title }}</q-item-label>
<q-item-label caption>
{{ caption }}
</q-item-label>
</q-item-section>
</q-item>
</template>
<script>
export default {
name: 'EssentialLink',
props: {
title: {
type: String,
required: true
},
caption: {
type: String,
default: ''
},
link: {
type: String,
default: '#'
},
icon: {
type: String,
default: ''
}
}
}
</script>
// app global css in Sass form
// Quasar Sass (& SCSS) Variables
// --------------------------------------------------
// To customize the look and feel of this app, you can override
// the Sass/SCSS variables found in Quasar's source Sass/SCSS files.
// Check documentation for full list of Quasar variables
// Your own variables (that are declared here) and Quasar's own
// ones will be available out of the box in your .vue/.scss/.sass files
// It's highly recommended to change the default colors
// to match your app's branding.
// Tip: Use the "Theme Builder" on Quasar's documentation website.3fc4ff
$primary : #2961fe
$secondary : #1bc5bd
$accent : #232125
$dark : #111
$positive : #21ba45
$negative : #f5576c
$info : #31CCEC
$warning : #F2C037
$infobg : #eeeeee
$infotwo : #1296db
\ No newline at end of file
// This is just an example,
// so you can safely delete all default props below
export default {
failed: 'Action failed',
success: 'Action was successful'
}
import enUS from './en-us'
export default {
'en-us': enUS
}
// This is just an example,
// so you can safely delete all default props below
export default {
failed: 'Action failed',
success: 'Action was successful'
}
<!DOCTYPE html>
<html>
<head>
<title><%= productName %></title>
<meta charset="utf-8">
<meta name="description" content="<%= productDescription %>">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>">
<link rel="icon" type="image/png" sizes="128x128" href="icons/favicon-128x128.png">
<link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png">
<link rel="icon" type="image/ico" href="favicon.ico">
</head>
<body>
<!-- DO NOT touch the following DIV -->
<div id="q-app"></div>
</body>
</html>
<template>
<q-layout view="lHh Lpr lFf">
<!--<q-header elevated>
<q-toolbar>
<q-btn
flat
dense
round
icon="menu"
aria-label="Menu"
@click="leftDrawerOpen = !leftDrawerOpen"
/>
<q-toolbar-title>
Quasar App
</q-toolbar-title>
<div>Quasar v{{ $q.version }}</div>
</q-toolbar>
</q-header>
<q-drawer
v-model="leftDrawerOpen"
show-if-above
bordered
content-class="bg-grey-1"
>
<q-list>
<q-item-label
header
class="text-grey-8"
>
Essential Links
</q-item-label>
<EssentialLink
v-for="link in essentialLinks"
:key="link.title"
v-bind="link"
/>
</q-list>
</q-drawer>-->
<q-page-container>
<router-view />
</q-page-container>
</q-layout>
</template>
<script>
import EssentialLink from 'components/EssentialLink.vue'
const linksData = [
{
title: 'Docs',
caption: 'quasar.dev',
icon: 'school',
link: 'https://quasar.dev'
},
{
title: 'Github',
caption: 'github.com/quasarframework',
icon: 'code',
link: 'https://github.com/quasarframework'
},
{
title: 'Discord Chat Channel',
caption: 'chat.quasar.dev',
icon: 'chat',
link: 'https://chat.quasar.dev'
},
{
title: 'Forum',
caption: 'forum.quasar.dev',
icon: 'record_voice_over',
link: 'https://forum.quasar.dev'
},
{
title: 'Twitter',
caption: '@quasarframework',
icon: 'rss_feed',
link: 'https://twitter.quasar.dev'
},
{
title: 'Facebook',
caption: '@QuasarFramework',
icon: 'public',
link: 'https://facebook.quasar.dev'
},
{
title: 'Quasar Awesome',
caption: 'Community Quasar projects',
icon: 'favorite',
link: 'https://awesome.quasar.dev'
}
];
export default {
name: 'MainLayout',
components: { EssentialLink },
data () {
return {
leftDrawerOpen: false,
essentialLinks: linksData
}
}
}
</script>
<template>
<div class="fullscreen bg-blue text-white text-center q-pa-md flex flex-center">
<div>
<div style="font-size: 30vh">
404
</div>
<div class="text-h2" style="opacity:.4">
Oops. Nothing here...
</div>
<q-btn
class="q-mt-xl"
color="white"
text-color="blue"
unelevated
to="/"
label="Go Home"
no-caps
/>
</div>
</div>
</template>
<script>
export default {
name: 'Error404'
}
</script>
<template>
<div class="jiahe">
<div class="jnavs absolute-top-left">
<div class="row items-center full-height">
<div class="col">
<img style="height:61px" src="../assets/images/logo.png" />
</div>
<div class="col">
<q-tabs
v-model="tab"
class="text-dark"
active-color="dark"
align="justify"
narrow-indicator
dense
>
<q-tab name="home" label="甲鹤教育" content-class="items-nav" />
<q-tab name="japan" label="日语培训" content-class="items-nav" />
<q-tab name="liuxue" label="留学服务" content-class="items-nav" />
<q-tab name="jiuye" label="就业服务" content-class="items-nav" />
<q-tab name="news" label="媒体中心" content-class="items-nav" />
<q-tab name="about" label="关于我们" content-class="items-nav" />
<q-tab name="join" label="加入我们" content-class="items-nav" />
</q-tabs>
</div>
</div>
</div>
<div class="relative-position banner-box">
<div class="absolute-top-left fit bg-dark">
<q-carousel
v-model="slide"
swipeable
animated
navigation-position="right"
navigation
height="100%"
infinite
>
<q-carousel-slide name="first" img-src="../assets/images/banner.png"/>
</q-carousel>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'PageIndex',
data() {
return {
slide:"first",
tab:"home"
}
},
}
</script>
<style>
.jiahe{
height:100vh
}
.jiahe .banner-box{
width:100%;padding-top:57.39%
}
.jiahe .jnavs{
margin-top:61px;
height: 61px;
z-index: 1;
left:58px;
right: 58px;
}
.jiahe .jnavs .items-nav .q-tab__label{
font-size: 16px !important;
font-family: 'pingfang-b' !important;
}
</style>
\ No newline at end of file
<template>
<div class="CMD">
<table class="cmdTable">
<thead>
<tr>
<td colspan="2">
&nbsp;&nbsp;请求参数
</td>
</tr>
<tr>
<td class="tdLeft">
命令:
</td>
<td class="tdRight">
<textarea :rows="1" :cols="50" v-model="ActionStr" placeholder="请输入命令"></textarea>
</td>
</tr>
<tr>
<td class="tdLeft">
参数列表:
</td>
<td class="tdRight">
<table class="parameterList">
<tr v-for="(item,index) in parameterList">
<td>
参数名:
</td>
<td>
<input type="text" v-model="item.Name" />
</td>
<td>
参数值:
</td>
<td>
<input type="text" v-model="item.Value" />
</td>
<td>
<a style="cursor:pointer;color:blue;" @click="AddParameter()">新增</a>&nbsp;
<a v-if="index!=0" style="cursor:pointer;color:red;" @click="DeleteParameter(index)">删除</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<input type="button" @click="Test()" value="执行" />
</td>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;&nbsp;返回结果
</td>
</tr>
<tr>
<td class="tdLeft">
请求命令:
</td>
<td class="tdRight">
{{ActionStr}}
</td>
</tr>
<tr>
<td class="tdLeft">
请求参数:
</td>
<td class="tdRight">
{{ShowMsg}}
</td>
</tr>
<tr>
<td class="tdLeft">
返回结果:
</td>
<td class="tdRight">
{{Result}}
</td>
</tr>
</tbody>
</table>
</div>
</template>
<script>
import {
TestApi
} from '../api/testapi'
export default {
meta: {
title: '测试 - 麦子教育系统',
},
data() {
return {
ActionStr: "",
parameterList: [{
Name: "",
Value: ""
}],
ShowMsg: "",
Result: "",
};
},
created() {
},
mounted() {
},
watch: {
$route: {
handler: function (route) {
this.redirect = route.query && route.query.redirect
},
immediate: true
}
},
methods: {
//新增参数
AddParameter() {
this.parameterList.push({
Name: "",
Value: ""
});
},
//删除参数
DeleteParameter(index) {
this.parameterList.splice(index, 1);
},
ClearMsg(str) {
//去掉空格
var result = str.replace(/\ +/g, "");
//去掉回车
result = result.replace(/[\r\n]/g, "");
return result;
},
Test() {
this.Result = "";
this.ShowMsg = "";
if (this.ActionStr && this.ActionStr != '') {
var data = {};
var tempStr = "";
if (this.parameterList && this.parameterList.length > 0) {
this.parameterList.forEach(item => {
if (item.Name && item.Name != '') {
tempStr += ',' + '"' + item.Name + '":"' + item.Value + '"';
}
})
}
if (tempStr && tempStr != '') {
tempStr = "{" + tempStr.substring(1, tempStr.length) + "}";
data = JSON.parse(tempStr);
}
var tempMsg = {
Msg: data
};
this.ShowMsg = JSON.parse(JSON.stringify(tempMsg));
TestApi(this.ActionStr, data).then(res => {
this.Result = JSON.stringify(res);
})
}
}
},
};
</script>
<style scoped>
.CMD {
background: #f5f6f7;
}
.CMD .cmdTable {
width: 100%;
max-width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
.CMD .cmdTable tr td {
border: 1px solid rgba(0, 0, 0, 0.12);
line-height: 35px;
min-height: 35px;
}
.CMD .tdLeft {
width: 15%;
font-size: 14px;
font-weight: 400;
text-align: right;
padding-right: 20px;
}
.CMD .tdRight {
width: 70%;
font-size: 14px;
font-weight: 400;
}
.CMD .parameterList {
border: none;
border-collapse: collapse;
}
.CMD .parameterList tr td {
border: none;
border-collapse: collapse;
}
</style>
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
Vue.use(VueRouter)
/*
* If not building with SSR mode, you can
* directly export the Router instantiation;
*
* The function below can be async too; either use
* async/await or return a Promise which resolves
* with the Router instance.
*/
// export default function (/* { store, ssrContext } */) {
// const Router = new VueRouter({
// scrollBehavior: () => ({ x: 0, y: 0 }),
// routes,
// // Leave these as they are and change in quasar.conf.js instead!
// // quasar.conf.js -> build -> vueRouterMode
// // quasar.conf.js -> build -> publicPath
// mode: process.env.VUE_ROUTER_MODE,
// base: process.env.VUE_ROUTER_BASE
// })
// return Router
// }
export default new VueRouter({
scrollBehavior: () => ({
x: 0,
y: 0
}),
routes,
// Leave these as they are and change in quasar.conf.js instead!
// quasar.conf.js -> build -> vueRouterMode
// quasar.conf.js -> build -> publicPath
mode: process.env.VUE_ROUTER_MODE,
base: process.env.VUE_ROUTER_BASE
})
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err);
};
const routes = [
{
path: '/',
component: () => import('layouts/MainLayout.vue'),
children: [
{ path: '', component: () => import('pages/Index.vue') }
]
},
// Always leave this as last one,
// but you can also remove it
{
path: '*',
component: () => import('pages/Error404.vue')
}
]
export default routes
const getters = {
userInfo: state => state.user.userInfo,
logo: state => {
// if (state.app.name) {
// return state.app.name
// }
// return require('../assets/images/logo.png')
return ""
},
name: state => {
if (state.app.name) {
return state.app.name
}
return '甲鹤日语'
},
// 权限
allAuth: state => state.user.allAuth,
}
export default getters
\ No newline at end of file
import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import permission from './modules/permission'
import app from './modules/app'
import getters from './getters'
Vue.use(Vuex)
// export default function( /* { ssrContext } */ ) {
// const Store = new Vuex.Store({
// modules: {
// // example
// user,
// permission
// },
// getters,
// // enable strict mode (adds overhead!)
// // for dev mode only
// })
// return Store
// }
const store = new Vuex.Store({
modules: {
user,
permission,
app
},
getters,
strict: process.env.DEV
})
export default store
\ No newline at end of file
export function someAction (/* context */) {
}
export function someGetter (/* state */) {
}
import state from './state'
import * as getters from './getters'
import * as mutations from './mutations'
import * as actions from './actions'
export default {
namespaced: true,
getters,
mutations,
actions,
state
}
export function someMutation (/* state */) {
}
export default function () {
return {
//
}
}
import Lockr from 'lockr'
/** 记录 侧边索引 */
const app = {
state: {
logo: '',
name: '',
currentNavs: 0
},
mutations: {
SET_APPLOGO: (state, logo) => {
state.logo = logo
},
SET_APPNAME: (state, name) => {
state.name = name
},
SET_CURRENTNAVS: (state, nav) => {
state.currentNavs = nav
}
},
actions: {
// 登录
SystemLogoAndName({
commit
}, { GroupName, GroupLogo }) {
commit('SET_APPNAME', GroupName)
commit('SET_APPLOGO', GroupLogo)
Lockr.set('systemLogo', GroupName)
Lockr.set('systemName', GroupLogo)
},
SystemNavsChange({ commit }, nav) {
commit('SET_CURRENTNAVS', nav)
}
}
}
export default app
\ No newline at end of file
import Vue from 'vue'
/**
*
* @param {*} router
* @param {*} authInfo
*/
function checkAuth(router, authInfo) {
// 判断当前路由在权限数组中是否存在
if (router.meta) {
const metaInfo = router.meta
if (!metaInfo.requiresAuth) {
return true
} else {
if (metaInfo.index == 0) {
return !!authInfo[metaInfo.type]
} else if (metaInfo.index == 1) {
if (authInfo[metaInfo.type]) {
return !!authInfo[metaInfo.type][metaInfo.subType]
}
return false
} else {
var typeAuth = authInfo[metaInfo.type]
for (let index = 0; index < metaInfo.subType.length; index++) {
const field = metaInfo.subType[index]
typeAuth = typeAuth[field]
if (typeAuth && metaInfo.subType.length - 1 == index) {
return true
} else if (!typeAuth) {
return false
}
}
}
}
}
return true
}
/**
*
* @param {*} routers
* @param {*} authInfo
*/
const filterAsyncRouter = function(routers, authInfo) {
const res = []
routers.forEach(router => {
const tmp = {
...router
}
if (checkAuth(tmp, authInfo)) {
if (tmp.children) {
tmp.children = filterAsyncRouter(tmp.children, authInfo)
}
res.push(tmp)
}
})
return res
}
const permission = {
state: {
addRouters: []
},
mutations: {
SET_ROUTERS: (state, routers) => {
state.addRouters = routers
}
},
actions: {
GenerateRoutes({
commit
}, data) {
return new Promise(resolve => {
// TODO 实现权限验证
resolve()
})
}
}
}
export default permission
\ No newline at end of file
import { login, logout } from "../../api/login";
// import { adminUsersRead } from "../../api/personCenter/personCenter";
import { addAuth, removeAuth } from "../../utils/auth";
import Lockr from "lockr";
const user = {
state: {
userInfo: null, // 用户信息
//TODO 用户权限
allAuth: ['/home', '/school/manager'],
actionList:[]
},
mutations: {
SET_USERINFO: (state, userInfo) => {
state.userInfo = userInfo;
},
SET_ALLAUTH: (state, allAuth) => {
state.allAuth = allAuth
}
//TODO 用户权限
},
actions: {
// 登录
Login({ commit }, userInfo) {
userInfo.Account = userInfo.Account.trim();
return new Promise((resolve, reject) => {
login(userInfo)
.then(data => {
let r = data.Data
let token = r.Token
delete r.Token
Lockr.set("Token", token);
Lockr.set("loginUserInfo", r);
//Lockr.set("authList", data.auth);
addAuth(token);
commit("SET_USERINFO", r);
// commit('SET_ALLAUTH', data.auth)
// TODO 完成登录 读取权限
resolve(data);
})
.catch(error => {
reject(error);
});
});
},
// 获取权限
getAuth({ commit }) {
return new Promise((resolve, reject) => {
//TODO 处理权限方法
});
},
// 获取用户信息
GetUserInfo({ commit, state }) {
return new Promise((resolve, reject) => {
// adminUsersRead()
// .then(response => {
// let r = response.Data
// delete r.Token
// commit("SET_USERINFO", r);
// resolve(response);
// })
// .catch(error => {
// reject(error);
// });
});
},
// 登出
LogOut({ commit }) {
return new Promise((resolve, reject) => {
// logout()
// .then(() => {
// /** flush 清空localStorage .rm('authKey') 按照key清除 */
// })
// .catch(error => {
// reject(error);
// });
removeAuth();
resolve();
});
}
}
};
export default user;
\ No newline at end of file
// THIS FEATURE-FLAG FILE IS AUTOGENERATED,
// REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING
import "quasar/dist/types/feature-flag";
declare module "quasar/dist/types/feature-flag" {
interface QuasarFeatureFlags {
store: true;
}
}
import axios from 'axios'
import cache from './cache'
import Lockr from 'lockr'
import store from '../store'
/** 移除授权信息 */
export function removeAuth() {
return new Promise((resolve, reject) => {
cache.rmAxiosCache()
//store.commit('SET_ALLAUTH', null)
delete axios.defaults.headers['Token']
resolve(true)
})
}
/** 注入授权信息 */
export function addAuth(adminToken) {
return new Promise((resolve, reject) => {
axios.defaults.headers['Token'] = adminToken
resolve(true)
})
}
/** 获取授权信息 */
export function getAuth() {
if (Lockr.get('Token') && !axios.defaults.headers['Token']) {
cache.updateAxiosCache()
}
if (axios.defaults.headers['Token']) {
return true
}
return false
}
\ No newline at end of file
import store from '../store'
import Lockr from 'lockr'
import axios from 'axios'
const cache = {
/**
* 载入全部登陆信息
*/
loadingCache: function() {
if (Lockr.get('Token') && !axios.defaults.headers['Token']) {
/** 将用户信息放入缓存 */
const userInfo = Lockr.get('loginUserInfo')
if (userInfo) {
store.commit('SET_USERINFO', userInfo)
}
}
store.commit('SET_APPNAME', Lockr.get('systemName'))
store.commit('SET_APPLOGO', Lockr.get('systemLogo'))
store.dispatch('SystemLogoAndName')
},
/**
* 请求和更新登录缓存
*/
updateAxiosCache: function() {
axios.defaults.headers['Token'] = Lockr.get('Token')
//TODO 更新用户信息
store.dispatch('GetUserInfo')
},
/**
* 移除登录信息
* @param {*}
*/
rmAxiosCache: function() {
Lockr.rm('Token')
Lockr.rm('loginUserInfo')
}
}
export default cache
\ No newline at end of file
import md5 from 'js-md5'
import co from 'co'
import MsgBus from '../utils/msgBus'
export default {
data: {
loginUser: {},
apiurl: ''
},
install(Vue, options) {
Vue.prototype.MsgBus = MsgBus;
//消息成功提示
Vue.prototype.Success = function (msg) {
this.$message({
message: msg,
duration: 2000,
type: "success"
});
},
//错误提示
Vue.prototype.Error = function (msg) {
this.$message({
message: msg,
duration: 2000,
type: "error"
});
},
//一般提示
Vue.prototype.Info = function (msg) {
this.$message({
message: msg,
duration: 2000,
type: "info"
});
},
//警告提示
Vue.prototype.Warning = function (msg) {
this.$message({
message: msg,
duration: 2000,
type: "warning"
});
},
//Confirm
Vue.prototype.Confirm = function (msg, callback) {
this.$confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
if (typeof callback === 'function') {
callback();
}
})
.catch(() => {
this.Info("已取消操作");
});
},
Vue.prototype.random_string = function (len) {
len = len || 32;
var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
var maxPos = chars.length;
var pwd = '';
for (let i = 0; i < len; i++) {
pwd += chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
},
Vue.prototype.md5 = md5;
//ERP本地缓存
Vue.prototype.getLocalStorage = function () {
var localStorageData = window.localStorage["loginUserInfo"];
if (localStorageData !== undefined && localStorageData != 'undefined') {
return JSON.parse(localStorageData).data;
} else {
return null;
}
},
//域名管理对象
Vue.prototype.domainManager = function () {
let domainUrl = 'http://192.168.1.13:8083';
let locationName = window.location.hostname;
if (locationName.indexOf('testerp.oytour') !== -1) {
domainUrl = "http://testapi.oytour.com";
} else if (locationName.indexOf('oytour') !== -1) {
domainUrl = "http://reborn.oytour.com";
}
var obj = {
//主地址
DomainUrl: domainUrl,
//常用提交数据URL
PostUrl: domainUrl + "/api/common/post",
//上传文件URL
UploadFileUrl: domainUrl + '/api/File/post',
//本站模板文件下载地址
LocalTemplateFileDownLoadUrl: domainUrl,
//本站文件流下载地址
LocalFileStreamDownLoadUrl: domainUrl + "/api/file/GetFileFromWebApi",
};
return obj;
},
//ERP系统文件下载
Vue.prototype.GetErpLocalFile = function (cmd, msg, fileName, successCall) {
var apiurl = this.domainManager().LocalFileStreamDownLoadUrl;
var timestamp = (new Date()).valueOf();
var token = "";
var key = "";
var tokenData = {};
var localStorage = window.localStorage["loginUserInfo"];
if (localStorage !== undefined && localStorage != 'undefined') {
tokenData = JSON.parse(localStorage);
}
token = tokenData.data.ErpToken;
var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
var postData = {
"msg": msg,
"cmd": cmd,
"timestamp": timestamp,
"token": token,
"sign": md5Str,
"groupId": tokenData.data.Group_Id,
"requestFrom": 6
}
this.$http.post(apiurl, postData, {
responseType: 'arraybuffer'
}).then((res) => {
let blob = new Blob([res.data], {
type: "application/vnd.ms-excel"
})
let url = URL.createObjectURL(blob);
let link = document.createElement('a');
link.href = url;
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
successCall(res);
}).catch(function (res) {});
},
//HTTP提交数据
Vue.prototype.apipost = function (cmd, msg, successCall, faildCall, isOnline) {
if (msg == null || msg == "") {
msg = {}
}
var token = "";
var key = "";
var tokenData = {};
var localStorage = window.localStorage["loginUserInfo"];
if (localStorage !== undefined && localStorage != 'undefined') {
tokenData = JSON.parse(localStorage);
}
token = tokenData.data.ErpToken;
var timestamp = (new Date()).valueOf();
var apiurl = this.domainManager().PostUrl;
this.apiurl = apiurl;
var branchId = tokenData.data.School_Id;
var departmentId = 1;
var departmentName = 1;
var groupName = tokenData.data.GroupName;
var branchName = tokenData.data.SchoolName;
var uName = tokenData.data.AccountName;
var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
var postData = {
"msg": msg,
"cmd": cmd,
"timestamp": timestamp,
"token": token,
"sign": md5Str,
"branchId": branchId, //公司id
"departmentId": departmentId, //部门id
"groupName": groupName, //集团名称
"branchName": branchName, //公司名称
"departmentName": departmentName, //部门名称
"uName": uName //用户名称
}
this.$http.post(apiurl, postData, {
headers: {
'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path
}
})
.then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
this.$router.push({
path: '/login'
});
} else if (res.resultCode == 10005) {
this.$router.go(-1);
} else {
successCall(res);
}
}, faildCall)
},
//价钱格式化,三位数逗号分隔,保留两位小数 duanjun
Vue.prototype.moneyFormat = function (value) {
let nStr = Number(value).toFixed(2)
nStr += '';
let x = nStr.split('.');
let x1 = x[0];
let x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
},
//验证只能输入整数【负数:isMinus传true】
Vue.prototype.checkInteger = function (item, filed, isMinus) {
var value = "" + item[filed]; //转字符串
var t = value.charAt(0);
value = value.replace(this.$commonUtils.Regex.isInteger, "");
//是否允许负数
if (isMinus && t == '-') {
value = '-' + value;
}
item[filed] = value;
},
//验证只能输入2位小数【负数:isMinus传true】
Vue.prototype.checkPrice = function (item, filed, isMinus) {
var value = "" + item[filed]; //转字符串
var t = value.charAt(0);
value = value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
value = value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
value = value
.replace(".", "$#$")
.replace(/\./g, "")
.replace("$#$", ".");
value = value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
//如果第一位是负号,则允许添加 如果不允许添加负号 可以把这块注释掉
//是否允许负数
if (isMinus && t == '-') {
value = '-' + value;
}
item[filed] = value;
},
Vue.prototype.QjGroupId = function (msg) {
let GroupId = 2;
return GroupId;
},
Vue.prototype.orderBy = function (source, orders, type) {
if (
source instanceof Array &&
orders instanceof Array &&
orders.length > 0
) {
var ordersc = orders.concat([]);
var sorttype = type || "asc";
var results = [];
var totalSum = {};
function grouporder(source, orders, totalSum) {
source.sort(function (a, b) {
var convertA = a[orders[0]];
var convertB = b[orders[0]];
if (typeof convertA == "string" && typeof convertB == "string") {
if (sorttype.toUpperCase() == "ASC") {
return convertA.localeCompare(convertB);
} else {
return convertB.localeCompare(convertA);
}
} else {
if (sorttype.toUpperCase() == "ASC") {
return convertA - convertB;
} else {
return convertB - convertA;
}
}
});
var groupmap = new Map();
source.forEach(item => {
if (groupmap.has(item[orders[0]])) {
groupmap.get(item[orders[0]]).push(item);
} else {
groupmap.set(item[orders[0]], []);
groupmap.get(item[orders[0]]).push(item);
}
});
orders.shift();
for (let [key, val] of groupmap) {
totalSum[key] = {};
totalSum[key].name = key;
totalSum[key].value = val.length;
if (orders.length == 0) {
results = results.concat(val);
} else {
totalSum[key].children = {};
var orderscopy = orders.concat([]);
grouporder(val, orderscopy, totalSum[key].children);
}
}
}
grouporder(source, ordersc, totalSum);
return {
results: results,
totalSum: totalSum
};
} else {
return source;
}
},
//PDF预览
Vue.prototype.previewPDF = function (url) {
window.open(url);
}
}
}
/**
* 工具处理类
*/
export function parseTime(time, cFormat) {
if (arguments.length === 0) {
return null
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if (('' + time).length === 10) time = parseInt(time) * 1000
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
export function formatTime(time, option) {
time = +time * 1000
const d = new Date(time)
const now = Date.now()
const diff = (now - d) / 1000
if (diff < 30) {
return '刚刚'
} else if (diff < 3600) {
// less 1 hour
return Math.ceil(diff / 60) + '分钟前'
} else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前'
} else if (diff < 3600 * 24 * 2) {
return '1天前'
}
if (option) {
return parseTime(time, option)
} else {
return (
d.getMonth() +
1 +
'月' +
d.getDate() +
'日' +
d.getHours() +
'时' +
d.getMinutes() +
'分'
)
}
}
export function isExternal(path) {
return /^(https?:|mailto:|tel:)/.test(path)
}
/** 压缩文件
* quality压缩百分比 0.3
*/
export function compressImage(file, quality, callback) {
// quality 设置为0.3
quality = quality || 0.3
const reader = new FileReader()
reader.onload = function(event) {
var result = event.target.result
if (file.size > 204800 && file.type !== 'image/gif' && quality < 1) { // 大于200Kb
const img = new Image()
img.src = result
img.onload = function() {
// 如果图片大于四百万像素,计算压缩比并将大小压至400万以下
var width = img.width
var height = img.height
var ratio
if ((ratio = width * height / 4000000) > 1) {
ratio = Math.sqrt(ratio)
width /= ratio
height /= ratio
} else {
ratio = 1
}
var canvas = document.createElement('canvas')
canvas.width = width
canvas.height = height
// 铺底色
var ctx = canvas.getContext('2d')
ctx.fillStyle = '#fff'
ctx.fillRect(0, 0, canvas.width, canvas.height)
// 如果图片像素大于100万则使用瓦片绘制
var count
if ((count = width * height / 1000000) > 1) {
count = ~~(Math.sqrt(count) + 1)
// 计算要分成多少块瓦片
// 计算每块瓦片的宽和高
var nw = ~~(width / count)
var nh = ~~(height / count)
var tCanvas = document.createElement('canvas')
tCanvas.width = nw
tCanvas.height = nh
for (var i = 0; i < count; i++) {
for (var j = 0; j < count; j++) {
var tctx = tCanvas.getContext('2d')
tctx.drawImage(img, i * nw * ratio, j * nh * ratio, nw * ratio, nh * ratio, 0, 0, nw, nh)
ctx.drawImage(tCanvas, i * nw, j * nh, nw, nh)
}
}
tCanvas.width = tCanvas.height = 0
} else {
ctx.drawImage(img, 0, 0, width, height)
}
// 进行最小压缩
var ndata = canvas.toDataURL('image/jpeg', quality)
canvas.width = canvas.height = 0
callback(ndata)
}
} else { // 小于200K不需要压缩 直接返回
callback(result)
}
}
reader.readAsDataURL(file)
}
/** 根据date URL 创建blob 用于上传 */
export function createBlob(result) {
var arr = result.split(',')
var mime = arr[0].match(/:(.*?)/)[1]
var bstr = atob(arr[1])
var n = bstr.length
var u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new Blob([u8arr], {
type: mime
})
}
/** 获取file大小的名称 */
export function fileSize(size) {
var size_int = size
if (typeof size === 'string' && size.constructor == String) {
size_int = parseInt(size)
}
var formatSize
if (parseInt(size_int / 1024 / 1024) > 0) {
formatSize = (size_int / 1024 / 1024).toFixed(2) + 'MB'
} else if (parseInt(size_int / 1024) > 0) {
formatSize = (size_int / 1024).toFixed(2) + 'kB'
} else {
formatSize = size_int + 'Byte'
}
return formatSize
}
/** 获取最大 z-index 的值 */
import {
PopupManager
} from 'element-ui/lib/utils/popup'
export function getMaxIndex() {
return PopupManager.nextZIndex()
}
/** 深拷贝 */
export function objDeepCopy(source) {
if (typeof source === 'object') {
var sourceCopy = source instanceof Array ? [] : {}
for (var item in source) {
if (!source[item]) {
sourceCopy[item] = source[item]
} else {
sourceCopy[item] = typeof source[item] === 'object' ? objDeepCopy(source[item]) : source[item]
}
}
return sourceCopy
}
return source
}
/** 获取文件类型图标 */
export function getFileTypeIcon(file) {
if (file.type.indexOf('image') !== -1) {
return require('@/assets/img/file_img.png')
} else if (file.type.indexOf('audio') !== -1 || file.type.indexOf('video') !== -1) {
return require('@/assets/img/file_video.png')
} else {
var index = file.name.lastIndexOf('.')
var ext = file.name.substr(index + 1)
if (arrayContain(['xlsx', 'xls', 'XLSX', 'XLS'], ext)) {
return require('@/assets/img/file_excle.png')
} else if (arrayContain(['doc', 'docx', 'DOC', 'DOCX'], ext)) {
return require('@/assets/img/file_word.png')
} else if (arrayContain(['rar', 'zip'], ext)) {
return require('@/assets/img/file_zip.png')
} else if (ext === 'pdf') {
return require('@/assets/img/file_pdf.png')
} else if (ext === 'ppt' || ext === 'pptx') {
return require('@/assets/img/file_ppt.png')
} else if (arrayContain(['txt', 'text'], ext)) {
return require('@/assets/img/file_txt.png')
}
}
return require('@/assets/img/file_unknown.png')
}
export function getFileTypeIconWithSuffix(ext) {
if (arrayContain(['jpg', 'png', 'gif'], ext)) {
return require('@/assets/img/file_img.png')
} else if (arrayContain(['mp4', 'mp3', 'avi'], ext)) {
return require('@/assets/img/file_excle.png')
} else if (arrayContain(['xlsx', 'xls', 'XLSX', 'XLS'], ext)) {
return require('@/assets/img/file_excle.png')
} else if (arrayContain(['doc', 'docx', 'DOC', 'DOCX'], ext)) {
return require('@/assets/img/file_word.png')
} else if (arrayContain(['rar', 'zip'], ext)) {
return require('@/assets/img/file_zip.png')
} else if (ext === 'pdf') {
return require('@/assets/img/file_pdf.png')
} else if (ext === 'ppt' || ext === 'pptx') {
return require('@/assets/img/file_ppt.png')
} else if (arrayContain(['txt', 'text'], ext)) {
return require('@/assets/img/file_txt.png')
}
return require('@/assets/img/file_unknown.png')
}
function arrayContain(array, string) {
return array.some((item) => {
return item === string
})
}
/** 判断输入的是number */
export function regexIsNumber(nubmer) {
var regex = /^[0-9]+.?[0-9]*/
if (!regex.test(nubmer)) {
return false
}
return true
}
/** 判断输入的是crm数字 数字的整数部分须少于12位,小数部分须少于4位*/
export function regexIsCRMNumber(nubmer) {
var regex = /^([-+]?\d{1,12})(\.\d{0,4})?$/
if (!regex.test(nubmer)) {
return false
}
return true
}
/** 判断输入的是货币 货币的整数部分须少于10位,小数部分须少于2位*/
export function regexIsCRMMoneyNumber(nubmer) {
var regex = /^([-+]?\d{1,10})(\.\d{0,2})?$/
if (!regex.test(nubmer)) {
return false
}
return true
}
/** 判断输入的是电话*/
export function regexIsCRMMobile(mobile) {
var regex = /^(\+?0?\d{2,4}\-?)?\d{6,11}$/
if (!regex.test(mobile)) {
return false
}
return true
}
/** 判断输入的是邮箱*/
export function regexIsCRMEmail(email) {
var regex = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/
if (!regex.test(email)) {
return false
}
return true
}
/**
* 时间操作
* @param
*/
/** 时间戳转date*/
import moment from 'moment'
export function getDateFromTimestamp(time) {
var times = 0
if (time.length === 13) {
times = parseInt(time)
} else {
times = parseInt(time) * 1000
}
return new Date(times) // 如果date为13位不需要乘1000
}
/**
*
* @param {*} timestamp 时间戳
* @param {*} format 格式化
*/
export function timestampToFormatTime(timestamp, format) {
if (timestamp && timestamp.toString().length >= 10) {
return moment(getDateFromTimestamp(timestamp.toString())).format(format)
}
return ''
}
/**
*
* @param {*} format 格式化字符串
*/
export function formatTimeToTimestamp(format) {
if (format && format.length > 0) {
var timeValue = moment(format)
.valueOf()
.toString()
return timeValue.length > 10 ? timeValue.substr(0, 10) : timeValue
}
return ''
}
/** image 下载 */
/**
*
* @param {*} data url
* @param {*} filename 名称
*/
export function downloadImage(data, filename) {
var httpindex = data.indexOf('http')
if (httpindex === 0) {
const image = new Image()
// 解决跨域 canvas 污染问题
image.setAttribute('crossOrigin', 'anonymous')
image.onload = function() {
const canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
const context = canvas.getContext('2d')
context.drawImage(image, 0, 0, image.width, image.height)
const dataURL = canvas.toDataURL('image/png')
// 生成一个 a 标签
const a = document.createElement('a')
// 创建一个点击事件
const event = new MouseEvent('click')
// 将 a 的 download 属性设置为我们想要下载的图片的名称,若 name 不存在则使用'图片'作为默认名称
a.download = filename || '图片'
// 将生成的 URL 设置为 a.href 属性
var blob = dataURLtoBlob(dataURL)
a.href = URL.createObjectURL(blob)
// 触发 a 的点击事件
a.dispatchEvent(event)
}
image.src = data
} else {
// 生成一个 a 标签
const a = document.createElement('a')
// 创建一个点击事件
const event = new MouseEvent('click')
// 将 a 的 download 属性设置为我们想要下载的图片的名称,若 name 不存在则使用'图片'作为默认名称
a.download = filename || '图片'
// 将生成的 URL 设置为 a.href 属性
a.href = data
// 触发 a 的点击事件
a.dispatchEvent(event)
}
}
/**
* path 和 name
*/
export function downloadFile(data) {
var a = document.createElement('a')
a.href = data.path
a.download = data.name ? data.name : '文件'
a.target = '_black'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
}
export function dataURLtoBlob(dataurl) {
// eslint-disable-next-line one-var
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new Blob([u8arr], {
type: mime
})
}
export function getBase64Image(img) {
var canvas = document.createElement('canvas')
canvas.width = img.width
canvas.height = img.height
var ctx = canvas.getContext('2d')
ctx.drawImage(img, 0, 0, img.width, img.height)
var ext = img.src.substring(img.src.lastIndexOf('.') + 1).toLowerCase()
var dataURL = canvas.toDataURL('image/' + ext)
return dataURL
}
// 获取绑定参数
export function guid() {
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
}
return (S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4())
}
/**
* 金额格式化 增加千分符
* @param {*} val
*/
export function moneyFormat(val) {
if (!val) return '0.00'
const i = Math.floor(val)
const d = val.split('.')[1] || '00'
return i.toLocaleString('en-US') + '.' + d
}
/**
* 下载excel
*/
export function downloadExcelWithResData(res) {
let fileName = res.headers['content-disposition'].split('filename=')[1]
if (!fileName) {
fileName = res.headers['content-disposition'].split('UTF-8\'\'')[1]
}
fileName = fileName ? fileName.replace(/\"/g, '') : 'file.xlsx'
fileName = decodeURI(fileName) || ''
downloadFileWithBuffer(res.data, fileName, 'application/vnd.ms-excel;charset=utf-8')
}
export function downloadFileWithBuffer(data, name, type) {
var blob = new Blob([data], {
type: type || ''
})
var downloadElement = document.createElement('a')
var href = window.URL.createObjectURL(blob) // 创建下载的链接
downloadElement.href = href
downloadElement.download = name // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click() // 点击下载
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
}
//ERP本地缓存
export function getLocalStorage(){
var localStorageData = window.localStorage["userInfo"];
if (localStorageData !== undefined && localStorageData != 'undefined') {
return JSON.parse(localStorageData);
} else {
return null;
}
}
import Vue from 'vue'
export default new Vue;
\ No newline at end of file
import axios from "axios";
import {
removeAuth
} from "../utils/auth";
import qs from "qs";
import {
Dialog,
Notify
} from 'quasar'
var showLoginMessageBox = false;
axios.defaults.headers["Content-Type"] = "application/json;charset=UTF-8"; //application/x-www-form-urlencoded;charset=UTF-8
const service = axios.create({
baseURL: process.env.API,
timeout: 15000
});
// request拦截器
service.interceptors.request.use(
config => {
if (config.headers["responseType"] == "arraybuffer") {
config.responseType = "arraybuffer";
}
const flag =
config.headers["Content-Type"] &&
config.headers["Content-Type"].indexOf("application/json") !== -1;
if (!flag) {
const mult =
config.headers["Content-Type"] &&
config.headers["Content-Type"].indexOf("multipart/form-data") !== -1;
if (mult) {
config.data = config.data;
} else {
config.data = qs.stringify(config.data);
}
} else {
config.data = {
"Msg": config.data
}
}
return config;
},
error => {
//TODO 新增网络请求异常处理业务
return Promise.reject(error);
}
);
// response 拦截器
service.interceptors.response.use(
response => {
const res = response.data;
// TODO 确定后台的CODE码
if (response.status === 200 && response.config.responseType === "arraybuffer") {
// 文件类型特殊处理
return response;
} else if (res.Code != 1) {
// TODO 确定后台的CODE码
if (res.Code == 10000) {
if (!showLoginMessageBox) {
showLoginMessageBox = true;
Dialog.create({
title: "登出",
message: "抱歉,你的账户信息已失效,你需要重新登录使用",
persistent: true
}).onOk(() => {
removeAuth()
.then(() => {
location.reload(); // 为了重新实例化vue-router对象 避免bug
})
.catch(() => {
location.reload();
});
});
}
} else {
if (res.Message) {
Notify.create({
icon: "error",
color: "negative",
message: res.Message,
position: "top"
});
}
}
return Promise.reject(res);
} else {
return res;
}
},
error => {
Notify.create({
icon: "error",
color: "negative",
message: "网络请求失败,请稍候再试",
position: "top"
});
return Promise.reject(error);
}
);
export default service;
/**
* 类型判断工具
*/
export function isString(obj) {
return Object.prototype.toString.call(obj) === '[object String]'
}
export function isObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
export function isArray(obj) {
return Object.prototype.toString.call(obj) === '[object Array]'
}
\ No newline at end of file
/**
* 验证工具类
*/
/* 合法uri*/
export function validateURL(textval) {
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return urlregex.test(textval)
}
/* 小写字母*/
export function validateLowerCase(str) {
const reg = /^[a-z]+$/
return reg.test(str)
}
/* 大写字母*/
export function validateUpperCase(str) {
const reg = /^[A-Z]+$/
return reg.test(str)
}
/* 大小写字母*/
export function validatAlphabets(str) {
const reg = /^[A-Za-z]+$/
return reg.test(str)
}
\ No newline at end of file
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