初始化
parent
aa2e460715
commit
32b397b6ed
|
@ -0,0 +1,35 @@
|
||||||
|
const {run} = require('runjs')
|
||||||
|
const chalk = require('chalk')
|
||||||
|
const config = require('../vue.config.js')
|
||||||
|
const rawArgv = process.argv.slice(2)
|
||||||
|
const args = rawArgv.join(' ')
|
||||||
|
|
||||||
|
if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
|
||||||
|
const report = rawArgv.includes('--report')
|
||||||
|
|
||||||
|
run(`vue-cli-service build ${args}`)
|
||||||
|
|
||||||
|
const port = 9526
|
||||||
|
const publicPath = config.publicPath
|
||||||
|
|
||||||
|
var connect = require('connect')
|
||||||
|
var serveStatic = require('serve-static')
|
||||||
|
const app = connect()
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
publicPath,
|
||||||
|
serveStatic('./dist', {
|
||||||
|
index: ['index.html', '/']
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
app.listen(port, function () {
|
||||||
|
console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`))
|
||||||
|
if (report) {
|
||||||
|
console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
run(`vue-cli-service build ${args}`)
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import SvgIcon from '@/components/SvgIcon' // svg component
|
||||||
|
|
||||||
|
// register globally
|
||||||
|
Vue.component('svg-icon', SvgIcon)
|
||||||
|
|
||||||
|
const req = require.context('./svg', false, /\.svg$/)
|
||||||
|
const requireAll = requireContext => requireContext.keys().map(requireContext)
|
||||||
|
requireAll(req)
|
|
@ -0,0 +1,51 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import store from '@/store'
|
||||||
|
import DataDict from '@/utils/dict'
|
||||||
|
import {getDicts as getDicts} from '@/api/system/dict/data'
|
||||||
|
|
||||||
|
function searchDictByKey(dict, key) {
|
||||||
|
if (key == null && key == "") {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
for (let i = 0; i < dict.length; i++) {
|
||||||
|
if (dict[i].key == key) {
|
||||||
|
return dict[i].value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function install() {
|
||||||
|
Vue.use(DataDict, {
|
||||||
|
metas: {
|
||||||
|
'*': {
|
||||||
|
labelField: 'dictLabel',
|
||||||
|
valueField: 'dictValue',
|
||||||
|
request(dictMeta) {
|
||||||
|
const storeDict = searchDictByKey(store.getters.dict, dictMeta.type)
|
||||||
|
if (storeDict) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
resolve(storeDict)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
getDicts(dictMeta.type).then(res => {
|
||||||
|
store.dispatch('dict/setDict', {key: dictMeta.type, value: res.data})
|
||||||
|
resolve(res.data)
|
||||||
|
}).catch(error => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
install,
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
export {default as AppMain} from './AppMain'
|
||||||
|
export {default as Navbar} from './Navbar'
|
||||||
|
export {default as Settings} from './Settings'
|
||||||
|
export {default as Sidebar} from './Sidebar/index.vue'
|
||||||
|
export {default as TagsView} from './TagsView/index.vue'
|
|
@ -0,0 +1,20 @@
|
||||||
|
import tab from './tab'
|
||||||
|
import auth from './auth'
|
||||||
|
import cache from './cache'
|
||||||
|
import modal from './modal'
|
||||||
|
import download from './download'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
install(Vue) {
|
||||||
|
// 页签操作
|
||||||
|
Vue.prototype.$tab = tab
|
||||||
|
// 认证对象
|
||||||
|
Vue.prototype.$auth = auth
|
||||||
|
// 缓存对象
|
||||||
|
Vue.prototype.$cache = cache
|
||||||
|
// 模态框对象
|
||||||
|
Vue.prototype.$modal = modal
|
||||||
|
// 下载文件
|
||||||
|
Vue.prototype.$download = download
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue