Commit e1190a42 by liimin

eslint

1 parent 027c59cd
Showing 66 changed files with 220 additions and 220 deletions
...@@ -3,7 +3,7 @@ var app = express() ...@@ -3,7 +3,7 @@ var app = express()
app.use(express.static('./dist')) app.use(express.static('./dist'))
app.get('/', function (req, res) { app.get('/', function(req, res) {
res.send('Hello Vue') res.send('Hello Vue')
}) })
......
import request from './request' import request from './request'
const path = 'fims.device.' const path = 'fims.device.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function editApi (data) { function editApi(data) {
data.method = `${path}edit` data.method = `${path}edit`
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}remove` data.method = `${path}remove`
return request(data) return request(data)
} }
...@@ -22,12 +22,12 @@ function removeApi (data) { ...@@ -22,12 +22,12 @@ function removeApi (data) {
// return request(data, 'post', noSignAttr) // return request(data, 'post', noSignAttr)
// } // }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
function isExistApi (data) { function isExistApi(data) {
data.method = `${path}detail` data.method = `${path}detail`
return request(data) return request(data)
} }
......
...@@ -2,17 +2,17 @@ import request from './request' ...@@ -2,17 +2,17 @@ import request from './request'
const path = 'fims.maintains.' const path = 'fims.maintains.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}delete` data.method = `${path}delete`
return request(data) return request(data)
} }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
......
...@@ -2,27 +2,27 @@ import request from './request' ...@@ -2,27 +2,27 @@ import request from './request'
const path = 'fims.order.' const path = 'fims.order.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}search` data.method = `${path}search`
return request(data) return request(data)
} }
function detailApi (data) { function detailApi(data) {
data.method = `${path}detail` data.method = `${path}detail`
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}delete` data.method = `${path}delete`
return request(data) return request(data)
} }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
function downloadApi (data) { function downloadApi(data) {
data.method = `${path}download` data.method = `${path}download`
return request(data) return request(data)
} }
......
...@@ -2,7 +2,7 @@ import request from './request' ...@@ -2,7 +2,7 @@ import request from './request'
const path = 'fims.material.' const path = 'fims.material.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
......
...@@ -2,12 +2,12 @@ import request from './request' ...@@ -2,12 +2,12 @@ import request from './request'
const path = 'fims.reportlog.' const path = 'fims.reportlog.'
function getLogsApi (data) { function getLogsApi(data) {
data.method = `${path}search` data.method = `${path}search`
return request(data) return request(data)
} }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
......
...@@ -6,21 +6,21 @@ const methods = { ...@@ -6,21 +6,21 @@ const methods = {
Edit: `${path}edit` Edit: `${path}edit`
} }
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function editApi (data) { function editApi(data) {
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}remove` data.method = `${path}remove`
return request(data) return request(data)
} }
function isExistApi (data) { function isExistApi(data) {
data.method = `${path}detail` data.method = `${path}detail`
return request(data) return request(data)
} }
......
import request from './request' import request from './request'
const path = 'fims.system.' const path = 'fims.system.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function reportApi (data) { function reportApi(data) {
data.method = `${path}report` data.method = `${path}report`
return request(data) return request(data)
} }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
......
...@@ -6,22 +6,22 @@ const methods = { ...@@ -6,22 +6,22 @@ const methods = {
Edit: `${path}edit` Edit: `${path}edit`
} }
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function editApi (data) { function editApi(data) {
// data.method = `${path}edit` // data.method = `${path}edit`
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}remove` data.method = `${path}remove`
return request(data) return request(data)
} }
function isExistApi (data) { function isExistApi(data) {
data.method = `${path}detail` data.method = `${path}detail`
return request(data) return request(data)
} }
......
...@@ -2,19 +2,19 @@ import Vue from 'vue' ...@@ -2,19 +2,19 @@ import Vue from 'vue'
export default new Vue({ export default new Vue({
methods: { methods: {
warningTips (message) { warningTips(message) {
this.$notify({ this.$notify({
type: 'warning', type: 'warning',
title: message title: message
}) })
}, },
okTips (message) { okTips(message) {
this.$notify({ this.$notify({
type: 'success', type: 'success',
title: message || '操作成功' title: message || '操作成功'
}) })
}, },
errorTips (message) { errorTips(message) {
this.$notify({ this.$notify({
type: 'error', type: 'error',
title: message || '操作失败' title: message || '操作失败'
......
...@@ -21,11 +21,11 @@ export default { ...@@ -21,11 +21,11 @@ export default {
mixins: [ mixins: [
scroll scroll
], ],
mounted () { mounted() {
// 增加滚动事件监听 // 增加滚动事件监听
this.addScrollListener() this.addScrollListener()
}, },
beforeDestroy () { beforeDestroy() {
// 移除滚动事件监听 // 移除滚动事件监听
this.removeScrollListener() this.removeScrollListener()
} }
......
...@@ -19,11 +19,11 @@ export default { ...@@ -19,11 +19,11 @@ export default {
mixins: [ mixins: [
scroll scroll
], ],
mounted () { mounted() {
// 增加滚动事件监听 // 增加滚动事件监听
this.addScrollListener() this.addScrollListener()
}, },
beforeDestroy () { beforeDestroy() {
// 移除滚动事件监听 // 移除滚动事件监听
this.removeScrollListener() this.removeScrollListener()
} }
......
...@@ -8,19 +8,19 @@ export default { ...@@ -8,19 +8,19 @@ export default {
default: () => ({}) default: () => ({})
} }
}, },
data () { data() {
return { return {
BS: null BS: null
} }
}, },
mounted () { mounted() {
this.scrollInit() this.scrollInit()
}, },
beforeDestroy () { beforeDestroy() {
this.scrollDestroy() this.scrollDestroy()
}, },
methods: { methods: {
scrollInit () { scrollInit() {
// 初始化 bs // 初始化 bs
this.BS = new BScroll(this.$refs.wrapper, Object.assign({ this.BS = new BScroll(this.$refs.wrapper, Object.assign({
mouseWheel: true, mouseWheel: true,
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
y: -y y: -y
})) }))
}, },
scrollDestroy () { scrollDestroy() {
// https://github.com/d2-projects/d2-admin/issues/75 // https://github.com/d2-projects/d2-admin/issues/75
try { try {
this.BS.destroy() this.BS.destroy()
...@@ -46,11 +46,11 @@ export default { ...@@ -46,11 +46,11 @@ export default {
} }
}, },
// 外部调用的方法 返回顶部 // 外部调用的方法 返回顶部
scrollToTop () { scrollToTop() {
if (this.BS) this.BS.scrollTo(0, 0, 300) if (this.BS) this.BS.scrollTo(0, 0, 300)
}, },
// 手动发出滚动事件 // 手动发出滚动事件
scroll () { scroll() {
if (this.BS) { if (this.BS) {
this.$emit('scroll', { this.$emit('scroll', {
x: -this.BS.x, x: -this.BS.x,
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
}, },
computed: { computed: {
// 始终返回渲染组件 // 始终返回渲染组件
component () { component() {
if (this.type === 'card' && !this.betterScroll) return d2ContainerCard if (this.type === 'card' && !this.betterScroll) return d2ContainerCard
if (this.type === 'card' && this.betterScroll) return d2ContainerCardBs if (this.type === 'card' && this.betterScroll) return d2ContainerCardBs
if (this.type === 'ghost' && !this.betterScroll) return d2ContainerGhost if (this.type === 'ghost' && !this.betterScroll) return d2ContainerGhost
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
} }
} }
}, },
render (h) { render(h) {
const slots = [ this.$slots.default ] const slots = [ this.$slots.default ]
if (this.$slots.header) slots.push(h('template', { slot: 'header' }, [ this.$slots.header ])) if (this.$slots.header) slots.push(h('template', { slot: 'header' }, [ this.$slots.header ]))
if (this.$slots.footer) slots.push(h('template', { slot: 'footer' }, [ this.$slots.footer ])) if (this.$slots.footer) slots.push(h('template', { slot: 'footer' }, [ this.$slots.footer ]))
...@@ -57,14 +57,14 @@ export default { ...@@ -57,14 +57,14 @@ export default {
}, },
methods: { methods: {
// 返回顶部 // 返回顶部
scrollToTop () { scrollToTop() {
this.$refs.component.scrollToTop() this.$refs.component.scrollToTop()
// 如果开启了 better scroll 还需要手动触发一遍 scroll 事件 // 如果开启了 better scroll 还需要手动触发一遍 scroll 事件
const bs = this.$refs.component.BS const bs = this.$refs.component.BS
if (bs) this.$refs.component.scroll() if (bs) this.$refs.component.scroll()
}, },
// 用法同原生方法 scrollBy // 用法同原生方法 scrollBy
scrollBy (x = 0, y = 0, time = 300) { scrollBy(x = 0, y = 0, time = 300) {
if (this.betterScroll) { if (this.betterScroll) {
const bs = this.$refs.component.BS const bs = this.$refs.component.BS
if (bs) { if (bs) {
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
} }
}, },
// 用法同原生方法 scrollTo // 用法同原生方法 scrollTo
scrollTo (x = 0, y = 0, time = 300) { scrollTo(x = 0, y = 0, time = 300) {
if (this.betterScroll) { if (this.betterScroll) {
const bs = this.$refs.component.BS const bs = this.$refs.component.BS
if (bs) { if (bs) {
...@@ -90,7 +90,7 @@ export default { ...@@ -90,7 +90,7 @@ export default {
} }
}, },
// 用法同原生方法 scrollTop // 用法同原生方法 scrollTop
scrollTop (top = 0, time = 300) { scrollTop(top = 0, time = 300) {
if (this.betterScroll) { if (this.betterScroll) {
const bs = this.$refs.component.BS const bs = this.$refs.component.BS
if (bs) { if (bs) {
......
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
} }
}, },
computed: { computed: {
icon () { icon() {
return `#d2-${this.name}` return `#d2-${this.name}`
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
export default { export default {
name: 'focus', name: 'focus',
inserted: function (el) { inserted: function(el) {
el.querySelector('input').focus() el.querySelector('input').focus()
} }
} }
...@@ -4,7 +4,7 @@ import util from '@/libs/util' ...@@ -4,7 +4,7 @@ import util from '@/libs/util'
Vue.use(VueI18n) Vue.use(VueI18n)
function loadLocaleMessages () { function loadLocaleMessages() {
const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i) const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i)
const messages = {} const messages = {}
locales.keys().forEach(key => { locales.keys().forEach(key => {
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
} }
}, },
methods: { methods: {
rowClick (event) { rowClick(event) {
let target = event.target let target = event.target
while (!target.dataset.value) { while (!target.dataset.value) {
target = target.parentNode target = target.parentNode
......
...@@ -26,18 +26,18 @@ export default { ...@@ -26,18 +26,18 @@ export default {
}, },
computed: { computed: {
flag: { flag: {
get () { get() {
if (this.visible) { if (this.visible) {
// 注册全局监听事件 [ 目前只考虑鼠标解除触发 ] // 注册全局监听事件 [ 目前只考虑鼠标解除触发 ]
window.addEventListener('mousedown', this.watchContextmenu) window.addEventListener('mousedown', this.watchContextmenu)
} }
return this.visible return this.visible
}, },
set (newVal) { set(newVal) {
this.$emit('update:visible', newVal) this.$emit('update:visible', newVal)
} }
}, },
style () { style() {
return { return {
left: this.x + 'px', left: this.x + 'px',
top: this.y + 'px', top: this.y + 'px',
...@@ -46,12 +46,12 @@ export default { ...@@ -46,12 +46,12 @@ export default {
} }
}, },
methods: { methods: {
watchContextmenu (event) { watchContextmenu(event) {
if (!this.$el.contains(event.target) || event.button !== 0) this.flag = false if (!this.$el.contains(event.target) || event.button !== 0) this.flag = false
window.removeEventListener('mousedown', this.watchContextmenu) window.removeEventListener('mousedown', this.watchContextmenu)
} }
}, },
mounted () { mounted() {
// 将菜单放置到body下 // 将菜单放置到body下
document.querySelector('body').appendChild(this.$el) document.querySelector('body').appendChild(this.$el)
} }
......
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
} }
}, },
methods: { methods: {
click () { click() {
this.onClick && this.onClick() this.onClick && this.onClick()
} }
} }
......
...@@ -12,7 +12,7 @@ import { mapState, mapActions } from 'vuex' ...@@ -12,7 +12,7 @@ import { mapState, mapActions } from 'vuex'
export default { export default {
name: 'd2-header-color', name: 'd2-header-color',
data () { data() {
return { return {
predefine: [ predefine: [
'#FF0000', '#008000', '#0000FF' '#FF0000', '#008000', '#0000FF'
...@@ -26,11 +26,11 @@ export default { ...@@ -26,11 +26,11 @@ export default {
}) })
}, },
watch: { watch: {
value (value) { value(value) {
this.set(value) this.set(value)
} }
}, },
mounted () { mounted() {
this.predefine = [...this.predefine, ...this.listTheme.map(theme => theme.color)] this.predefine = [...this.predefine, ...this.listTheme.map(theme => theme.color)]
}, },
methods: { methods: {
......
...@@ -7,20 +7,20 @@ import dayjs from 'dayjs' ...@@ -7,20 +7,20 @@ import dayjs from 'dayjs'
const sFormat = 'YYYY年MM月DD日' const sFormat = 'YYYY年MM月DD日'
export default { export default {
name: 'd2-header-datetime', name: 'd2-header-datetime',
data () { data() {
return { return {
timeInterval: null, timeInterval: null,
time: dayjs().format(sFormat) time: dayjs().format(sFormat)
} }
}, },
mounted () { mounted() {
// this.timeInterval = setInterval(() => this.refreshTime(), 1000); // this.timeInterval = setInterval(() => this.refreshTime(), 1000);
}, },
beforeDestroy () { beforeDestroy() {
clearInterval(this.timeInterval) clearInterval(this.timeInterval)
}, },
methods: { methods: {
refreshTime () { refreshTime() {
this.time = dayjs().format(sFormat) this.time = dayjs().format(sFormat)
} }
} }
......
...@@ -21,14 +21,14 @@ ...@@ -21,14 +21,14 @@
<script> <script>
export default { export default {
methods: { methods: {
onChangeLocale (command) { onChangeLocale(command) {
this.$i18n.locale = command this.$i18n.locale = command
let message = `当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]` let message = `当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`
if (!['TRAVIS', 'NETLIFY'].includes(process.env.VUE_APP_BUILD_MODE)) { if (!['TRAVIS', 'NETLIFY'].includes(process.env.VUE_APP_BUILD_MODE)) {
message = [ message = [
`当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`, `当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`,
`仅提供切换功能,没有配置具体的语言数据 `, '仅提供切换功能,没有配置具体的语言数据 ',
`文档参考:<a class="el-link el-link--primary is-underline" target="_blank" href="https://doc.d2admin.fairyever.com/zh/sys-locales/">《国际化 | D2Admin》</a>` '文档参考:<a class="el-link el-link--primary is-underline" target="_blank" href="https://doc.d2admin.fairyever.com/zh/sys-locales/">《国际化 | D2Admin》</a>'
].join('<br/>') ].join('<br/>')
} }
this.$notify({ this.$notify({
......
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
logLength: 'log/length', logLength: 'log/length',
logLengthError: 'log/lengthError' logLengthError: 'log/lengthError'
}), }),
tooltipContent () { tooltipContent() {
return this.logLength === 0 return this.logLength === 0
? '没有日志或异常' ? '没有日志或异常'
: `${this.logLength} 条日志${this.logLengthError > 0 : `${this.logLength} 条日志${this.logLengthError > 0
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
...mapMutations('d2admin/log', [ ...mapMutations('d2admin/log', [
'clean' 'clean'
]), ]),
handleClick () { handleClick() {
this.$router.push({ this.$router.push({
name: 'log' name: 'log'
}) })
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<script> <script>
export default { export default {
methods: { methods: {
handleClick () { handleClick() {
this.$emit('click') this.$emit('click')
} }
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import { mapState, mapMutations, mapActions } from 'vuex' import { mapState, mapMutations, mapActions } from 'vuex'
export default { export default {
name: 'd2-header-size', name: 'd2-header-size',
data () { data() {
return { return {
options: [ options: [
{ label: '大', value: 'default' }, { label: '大', value: 'default' },
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
...mapActions({ ...mapActions({
sizeSet: 'd2admin/size/set' sizeSet: 'd2admin/size/set'
}), }),
handleChange (value) { handleChange(value) {
this.sizeSet(value) this.sizeSet(value)
// this.$notify({ // this.$notify({
// title: '提示', // title: '提示',
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
// type: 'success' // type: 'success'
// }) // })
}, },
iconName (name) { iconName(name) {
return name === this.value ? 'dot-circle-o' : 'circle-o' return name === this.value ? 'dot-circle-o' : 'circle-o'
} }
} }
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
export default { export default {
name: 'd2-theme-list', name: 'd2-theme-list',
data () { data() {
return { return {
table: { table: {
showHeader: false, showHeader: false,
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
'set' 'set'
]), ]),
...mapActions('d2admin/color', { setColor: 'set' }), ...mapActions('d2admin/color', { setColor: 'set' }),
handleSelectTheme (row) { handleSelectTheme(row) {
const { name, color } = row const { name, color } = row
this.set(name) this.set(name)
this.setColor(color) this.setColor(color)
......
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
components: { components: {
'd2-theme-list': themeList 'd2-theme-list': themeList
}, },
data () { data() {
return { return {
dialogVisible: false dialogVisible: false
} }
......
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
components: { components: {
PersonalPanel PersonalPanel
}, },
mounted () { mounted() {
this.$event.$on('e-password-dialog', res => (this.passVisible = res)) this.$event.$on('e-password-dialog', res => (this.passVisible = res))
}, },
computed: { computed: {
......
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
mixins: [ mixins: [
menuMixin menuMixin
], ],
render (createElement) { render(createElement) {
return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' } }, [ return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' } }, [
createElement('el-menu', { createElement('el-menu', {
props: { collapse: this.asideCollapse, uniqueOpened: true, defaultActive: this.active }, props: { collapse: this.asideCollapse, uniqueOpened: true, defaultActive: this.active },
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
] : [] ] : []
]) ])
}, },
data () { data() {
return { return {
active: '', active: '',
asideHeight: 300, asideHeight: 300,
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
}, },
watch: { watch: {
// 折叠和展开菜单的时候销毁 better scroll // 折叠和展开菜单的时候销毁 better scroll
asideCollapse (val) { asideCollapse(val) {
this.scrollDestroy() this.scrollDestroy()
setTimeout(() => { setTimeout(() => {
this.scrollInit() this.scrollInit()
...@@ -46,20 +46,20 @@ export default { ...@@ -46,20 +46,20 @@ export default {
}, },
// 监听路由 控制侧边栏激活状态 // 监听路由 控制侧边栏激活状态
'$route.fullPath': { '$route.fullPath': {
handler (value) { handler(value) {
this.active = value this.active = value
}, },
immediate: true immediate: true
} }
}, },
mounted () { mounted() {
this.scrollInit() this.scrollInit()
}, },
beforeDestroy () { beforeDestroy() {
this.scrollDestroy() this.scrollDestroy()
}, },
methods: { methods: {
scrollInit () { scrollInit() {
this.BS = new BScroll(this.$el, { this.BS = new BScroll(this.$el, {
mouseWheel: true, mouseWheel: true,
click: true click: true
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
// } // }
}) })
}, },
scrollDestroy () { scrollDestroy() {
// https://github.com/d2-projects/d2-admin/issues/75 // https://github.com/d2-projects/d2-admin/issues/75
try { try {
this.BS.destroy() this.BS.destroy()
......
...@@ -2,7 +2,7 @@ import util from '@/libs/util.js' ...@@ -2,7 +2,7 @@ import util from '@/libs/util.js'
export default { export default {
methods: { methods: {
handleMenuSelect (index, indexPath) { handleMenuSelect(index, indexPath) {
if (/^d2-menu-empty-\d+$/.test(index) || index === undefined) { if (/^d2-menu-empty-\d+$/.test(index) || index === undefined) {
this.$message.warning('临时菜单') this.$message.warning('临时菜单')
} else if (/^https:\/\/|http:\/\//.test(index)) { } else if (/^https:\/\/|http:\/\//.test(index)) {
......
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
components: { components: {
'd2-panel-search-item': () => import('./components/panel-search-item/index.vue') 'd2-panel-search-item': () => import('./components/panel-search-item/index.vue')
}, },
data () { data() {
return { return {
searchText: '', searchText: '',
results: [] results: []
...@@ -75,7 +75,7 @@ export default { ...@@ -75,7 +75,7 @@ export default {
'pool' 'pool'
]), ]),
// 这份数据是展示在搜索面板下面的 // 这份数据是展示在搜索面板下面的
resultsList () { resultsList() {
return (this.results.length === 0 && this.searchText === '') ? this.pool.map(e => ({ return (this.results.length === 0 && this.searchText === '') ? this.pool.map(e => ({
value: e.fullTitle, value: e.fullTitle,
...e ...e
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
/** /**
* @description 过滤选项 这个方法在每次输入框的值发生变化时会触发 * @description 过滤选项 这个方法在每次输入框的值发生变化时会触发
*/ */
querySearch (queryString, callback) { querySearch(queryString, callback) {
var pool = this.pool var pool = this.pool
const results = this.query(queryString ? pool : [], queryString) const results = this.query(queryString ? pool : [], queryString)
this.results = results this.results = results
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
* @param {Object} pool 需要过滤的数据 * @param {Object} pool 需要过滤的数据
* @param {String} queryString 查询字符串 * @param {String} queryString 查询字符串
*/ */
query (pool, queryString) { query(pool, queryString) {
return new Fuse(pool, { return new Fuse(pool, {
shouldSort: true, shouldSort: true,
tokenize: true, tokenize: true,
...@@ -120,7 +120,7 @@ export default { ...@@ -120,7 +120,7 @@ export default {
/** /**
* @description 聚焦输入框 * @description 聚焦输入框
*/ */
focus () { focus() {
this.input = '' this.input = ''
setTimeout(() => { setTimeout(() => {
if (this.$refs.input) { if (this.$refs.input) {
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
/** /**
* @description 接收用户在列表中选择项目的事件 * @description 接收用户在列表中选择项目的事件
*/ */
handleResultsGroupItemClick (path) { handleResultsGroupItemClick(path) {
// 如果用户选择的就是当前页面 就直接关闭搜索面板 // 如果用户选择的就是当前页面 就直接关闭搜索面板
if (path === this.$route.path) { if (path === this.$route.path) {
this.handleEsc() this.handleEsc()
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
/** /**
* @description 接收用户在下拉菜单中选中事件 * @description 接收用户在下拉菜单中选中事件
*/ */
handleSelect ({ path }) { handleSelect({ path }) {
// 如果用户选择的就是当前页面 就直接关闭搜索面板 // 如果用户选择的就是当前页面 就直接关闭搜索面板
if (path === this.$route.path) { if (path === this.$route.path) {
this.handleEsc() this.handleEsc()
...@@ -160,7 +160,7 @@ export default { ...@@ -160,7 +160,7 @@ export default {
/** /**
* @augments 关闭输入框的下拉菜单 * @augments 关闭输入框的下拉菜单
*/ */
closeSuggestion () { closeSuggestion() {
if (this.$refs.input.activated) { if (this.$refs.input.activated) {
this.$refs.input.suggestions = [] this.$refs.input.suggestions = []
this.$refs.input.activated = false this.$refs.input.activated = false
...@@ -169,13 +169,13 @@ export default { ...@@ -169,13 +169,13 @@ export default {
/** /**
* @augments 接收用户点击空白区域的关闭 * @augments 接收用户点击空白区域的关闭
*/ */
handlePanelClick () { handlePanelClick() {
this.handleEsc() this.handleEsc()
}, },
/** /**
* @augments 接收用户触发的关闭 * @augments 接收用户触发的关闭
*/ */
handleEsc () { handleEsc() {
this.closeSuggestion() this.closeSuggestion()
this.$nextTick(() => { this.$nextTick(() => {
this.$emit('close') this.$emit('close')
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
user: Object user: Object
}, },
methods: { methods: {
handleClose () { handleClose() {
this.$event.$emit('e-pd-close') this.$event.$emit('e-pd-close')
} }
} }
......
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
D2Contextmenu: () => import('../contextmenu'), D2Contextmenu: () => import('../contextmenu'),
D2ContextmenuList: () => import('../contextmenu/components/contentmenuList') D2ContextmenuList: () => import('../contextmenu/components/contentmenuList')
}, },
data () { data() {
return { return {
contextmenuFlag: false, contextmenuFlag: false,
contentmenuX: 0, contentmenuX: 0,
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
/** /**
* @description 右键菜单功能点击 * @description 右键菜单功能点击
*/ */
handleContextmenu (event) { handleContextmenu(event) {
let target = event.target let target = event.target
// 解决 https://github.com/d2-projects/d2-admin/issues/54 // 解决 https://github.com/d2-projects/d2-admin/issues/54
let flag = false let flag = false
...@@ -120,13 +120,13 @@ export default { ...@@ -120,13 +120,13 @@ export default {
/** /**
* @description 右键菜单的row-click事件 * @description 右键菜单的row-click事件
*/ */
contextmenuClick (command) { contextmenuClick(command) {
this.handleControlItemClick(command, this.tagName) this.handleControlItemClick(command, this.tagName)
}, },
/** /**
* @description 接收点击关闭控制上选项的事件 * @description 接收点击关闭控制上选项的事件
*/ */
handleControlItemClick (command, tagName = null) { handleControlItemClick(command, tagName = null) {
if (tagName) { if (tagName) {
this.contextmenuFlag = false this.contextmenuFlag = false
} }
...@@ -154,7 +154,7 @@ export default { ...@@ -154,7 +154,7 @@ export default {
/** /**
* @description 接收点击 tab 标签的事件 * @description 接收点击 tab 标签的事件
*/ */
handleClick (tab, event) { handleClick(tab, event) {
// 找到点击的页面在 tag 列表里是哪个 // 找到点击的页面在 tag 列表里是哪个
const page = this.opened.find(page => page.fullPath === tab.name) const page = this.opened.find(page => page.fullPath === tab.name)
const { name, params, query } = page const { name, params, query } = page
...@@ -165,7 +165,7 @@ export default { ...@@ -165,7 +165,7 @@ export default {
/** /**
* @description 点击 tab 上的删除按钮触发这里 首页的删除按钮已经隐藏 因此这里不用判断是 index * @description 点击 tab 上的删除按钮触发这里 首页的删除按钮已经隐藏 因此这里不用判断是 index
*/ */
handleTabsEdit (tagName, action) { handleTabsEdit(tagName, action) {
if (action === 'remove') { if (action === 'remove') {
this.close({ this.close({
tagName tagName
......
...@@ -6,7 +6,7 @@ export default { ...@@ -6,7 +6,7 @@ export default {
components: { components: {
'd2-panel-search': () => import('../components/panel-search') 'd2-panel-search': () => import('../components/panel-search')
}, },
mounted () { mounted() {
// 绑定搜索功能快捷键 [ 打开 ] // 绑定搜索功能快捷键 [ 打开 ]
hotkeys(this.searchHotkey.open, event => { hotkeys(this.searchHotkey.open, event => {
event.preventDefault() event.preventDefault()
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
this.searchPanelClose() this.searchPanelClose()
}) })
}, },
beforeDestroy () { beforeDestroy() {
hotkeys.unbind(this.searchHotkey.open) hotkeys.unbind(this.searchHotkey.open)
hotkeys.unbind(this.searchHotkey.close) hotkeys.unbind(this.searchHotkey.close)
}, },
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
/** /**
* 接收点击搜索按钮 * 接收点击搜索按钮
*/ */
handleSearchClick () { handleSearchClick() {
this.searchToggle() this.searchToggle()
if (this.searchActive) { if (this.searchActive) {
setTimeout(() => { setTimeout(() => {
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
}, 500) }, 500)
} }
}, },
searchPanelOpen () { searchPanelOpen() {
if (!this.searchActive) { if (!this.searchActive) {
this.searchSet(true) this.searchSet(true)
setTimeout(() => { setTimeout(() => {
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
} }
}, },
// 关闭搜索面板 // 关闭搜索面板
searchPanelClose () { searchPanelClose() {
if (this.searchActive) { if (this.searchActive) {
this.searchSet(false) this.searchSet(false)
} }
......
...@@ -8,7 +8,7 @@ const cookies = {} ...@@ -8,7 +8,7 @@ const cookies = {}
* @param {String} value cookie value * @param {String} value cookie value
* @param {Object} setting cookie setting * @param {Object} setting cookie setting
*/ */
cookies.set = function (name = 'default', value = '', cookieSetting = {}) { cookies.set = function(name = 'default', value = '', cookieSetting = {}) {
let currentCookieSetting = { let currentCookieSetting = {
expires: 1 expires: 1
} }
...@@ -20,14 +20,14 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) { ...@@ -20,14 +20,14 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) {
* @description 拿到 cookie 值 * @description 拿到 cookie 值
* @param {String} name cookie name * @param {String} name cookie name
*/ */
cookies.get = function (name = 'default') { cookies.get = function(name = 'default') {
return Cookies.get(`tfims-${process.env.VUE_APP_VERSION}-${name}`) return Cookies.get(`tfims-${process.env.VUE_APP_VERSION}-${name}`)
} }
/** /**
* @description 拿到 cookie 全部的值 * @description 拿到 cookie 全部的值
*/ */
cookies.getAll = function () { cookies.getAll = function() {
return Cookies.get() return Cookies.get()
} }
...@@ -35,7 +35,7 @@ cookies.getAll = function () { ...@@ -35,7 +35,7 @@ cookies.getAll = function () {
* @description 删除 cookie * @description 删除 cookie
* @param {String} name cookie name * @param {String} name cookie name
*/ */
cookies.remove = function (name = 'default') { cookies.remove = function(name = 'default') {
return Cookies.remove(`tfims-${process.env.VUE_APP_VERSION}-${name}`) return Cookies.remove(`tfims-${process.env.VUE_APP_VERSION}-${name}`)
} }
......
...@@ -13,7 +13,7 @@ const util = { ...@@ -13,7 +13,7 @@ const util = {
* @description 更新标题 * @description 更新标题
* @param {String} title 标题 * @param {String} title 标题
*/ */
util.title = function (titleText) { util.title = function(titleText) {
const processTitle = process.env.VUE_APP_TITLE const processTitle = process.env.VUE_APP_TITLE
window.document.title = `${processTitle}${titleText ? ` | ${titleText}` : ''}` window.document.title = `${processTitle}${titleText ? ` | ${titleText}` : ''}`
} }
...@@ -22,7 +22,7 @@ util.title = function (titleText) { ...@@ -22,7 +22,7 @@ util.title = function (titleText) {
* @description 打开新页面 * @description 打开新页面
* @param {String} url 地址 * @param {String} url 地址
*/ */
util.open = function (url, target) { util.open = function(url, target) {
var a = document.createElement('a') var a = document.createElement('a')
a.setAttribute('href', url) a.setAttribute('href', url)
a.setAttribute('target', target || '_blank') a.setAttribute('target', target || '_blank')
...@@ -62,7 +62,7 @@ util.deepClone = (obj) => { ...@@ -62,7 +62,7 @@ util.deepClone = (obj) => {
* @param {Function} condition 回调函数,必须返回谓词,判断是否找到了。会传入(item, index, level)三个参数 * @param {Function} condition 回调函数,必须返回谓词,判断是否找到了。会传入(item, index, level)三个参数
* @param {String} children 子数组的key * @param {String} children 子数组的key
*/ */
util.deepFind = function (menus, id) { util.deepFind = function(menus, id) {
const cloneMenus = util.deepClone(menus) const cloneMenus = util.deepClone(menus)
for (let menu of cloneMenus) { for (let menu of cloneMenus) {
if (menu.id === id) { if (menu.id === id) {
...@@ -110,7 +110,7 @@ util.colorToRgb = (sColor, alpha) => { ...@@ -110,7 +110,7 @@ util.colorToRgb = (sColor, alpha) => {
* 重置form * 重置form
* 用法: util.resetForm.call(this,'formName') * 用法: util.resetForm.call(this,'formName')
*/ */
util.resetForm = function (formName) { util.resetForm = function(formName) {
this.$nextTick(() => { this.$nextTick(() => {
for (var key in this[formName]) { for (var key in this[formName]) {
if (this[formName].hasOwnProperty(key)) { if (this[formName].hasOwnProperty(key)) {
......
...@@ -4,7 +4,7 @@ const log = {} ...@@ -4,7 +4,7 @@ const log = {}
* @description 返回这个样式的颜色值 * @description 返回这个样式的颜色值
* @param {String} type 样式名称 [ primary | success | warning | danger | text ] * @param {String} type 样式名称 [ primary | success | warning | danger | text ]
*/ */
function typeColor (type = 'default') { function typeColor(type = 'default') {
let color = '' let color = ''
switch (type) { switch (type) {
case 'default': color = '#35495E'; break case 'default': color = '#35495E'; break
...@@ -23,7 +23,7 @@ function typeColor (type = 'default') { ...@@ -23,7 +23,7 @@ function typeColor (type = 'default') {
* @param {String} info info text * @param {String} info info text
* @param {String} type style * @param {String} type style
*/ */
log.capsule = function (title, info, type = 'primary') { log.capsule = function(title, info, type = 'primary') {
console.log( console.log(
`%c ${title} %c ${info} %c`, `%c ${title} %c ${info} %c`,
'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;', 'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;',
...@@ -35,7 +35,7 @@ log.capsule = function (title, info, type = 'primary') { ...@@ -35,7 +35,7 @@ log.capsule = function (title, info, type = 'primary') {
/** /**
* @description 打印彩色文字 * @description 打印彩色文字
*/ */
log.colorful = function (textArr) { log.colorful = function(textArr) {
console.log( console.log(
`%c${textArr.map(t => t.text || '').join('%c')}`, `%c${textArr.map(t => t.text || '').join('%c')}`,
...textArr.map(t => `color: ${typeColor(t.type)};`) ...textArr.map(t => `color: ${typeColor(t.type)};`)
...@@ -45,35 +45,35 @@ log.colorful = function (textArr) { ...@@ -45,35 +45,35 @@ log.colorful = function (textArr) {
/** /**
* @description 打印 default 样式的文字 * @description 打印 default 样式的文字
*/ */
log.default = function (text) { log.default = function(text) {
log.colorful([{ text }]) log.colorful([{ text }])
} }
/** /**
* @description 打印 primary 样式的文字 * @description 打印 primary 样式的文字
*/ */
log.primary = function (text) { log.primary = function(text) {
log.colorful([{ text, type: 'primary' }]) log.colorful([{ text, type: 'primary' }])
} }
/** /**
* @description 打印 success 样式的文字 * @description 打印 success 样式的文字
*/ */
log.success = function (text) { log.success = function(text) {
log.colorful([{ text, type: 'success' }]) log.colorful([{ text, type: 'success' }])
} }
/** /**
* @description 打印 warning 样式的文字 * @description 打印 warning 样式的文字
*/ */
log.warning = function (text) { log.warning = function(text) {
log.colorful([{ text, type: 'warning' }]) log.colorful([{ text, type: 'warning' }])
} }
/** /**
* @description 打印 danger 样式的文字 * @description 打印 danger 样式的文字
*/ */
log.danger = function (text) { log.danger = function(text) {
log.colorful([{ text, type: 'danger' }]) log.colorful([{ text, type: 'danger' }])
} }
......
...@@ -8,7 +8,7 @@ export default [ ...@@ -8,7 +8,7 @@ export default [
{ {
path: '/api/login', path: '/api/login',
method: 'post', method: 'post',
handle ({ body }) { handle({ body }) {
const user = userDB.find(e => e.username === body.username && e.password === body.password) const user = userDB.find(e => e.username === body.username && e.password === body.password)
if (user) { if (user) {
return { return {
......
export default function (Mock) { export default function(Mock) {
// http://cnine.me/note/FrontEnd/mock-lose-cookies-dbg.html // http://cnine.me/note/FrontEnd/mock-lose-cookies-dbg.html
Mock.XHR.prototype.__send = Mock.XHR.prototype.send Mock.XHR.prototype.__send = Mock.XHR.prototype.send
Mock.XHR.prototype.send = function () { Mock.XHR.prototype.send = function() {
if (this.custom.xhr) this.custom.xhr.withCredentials = this.withCredentials || false if (this.custom.xhr) this.custom.xhr.withCredentials = this.withCredentials || false
this.__send.apply(this, arguments) this.__send.apply(this, arguments)
} }
......
...@@ -12,14 +12,14 @@ import qs from 'qs' ...@@ -12,14 +12,14 @@ import qs from 'qs'
axios.defaults.withCredentials = true axios.defaults.withCredentials = true
const expiresMinute = 60 // 过期时间(分钟) const expiresMinute = 60 // 过期时间(分钟)
// 创建一个错误 // 创建一个错误
function errorCreate (msg) { function errorCreate(msg) {
const error = new Error(msg) const error = new Error(msg)
errorLog(error) errorLog(error)
throw error throw error
} }
// 记录和显示错误 // 记录和显示错误
function errorLog (error) { function errorLog(error) {
// 添加到日志 // 添加到日志
store.dispatch('d2admin/log/push', { store.dispatch('d2admin/log/push', {
message: '数据请求异常', message: '数据请求异常',
...@@ -51,7 +51,7 @@ const service = axios.create({ ...@@ -51,7 +51,7 @@ const service = axios.create({
// 请求拦截器 // 请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
config => { config => {
config.transformRequest = [function (data) { config.transformRequest = [function(data) {
return qs.stringify(data) return qs.stringify(data)
}] }]
return new Promise(async resolve => { return new Promise(async resolve => {
......
...@@ -19,7 +19,7 @@ import pluginLog from '@/plugin/log' ...@@ -19,7 +19,7 @@ import pluginLog from '@/plugin/log'
import pluginOpen from '@/plugin/open' import pluginOpen from '@/plugin/open'
export default { export default {
async install (Vue, options) { async install(Vue, options) {
// 设置为 false 以阻止 vue 在启动时生成生产提示 // 设置为 false 以阻止 vue 在启动时生成生产提示
// https://cn.vuejs.org/v2/api/#productionTip // https://cn.vuejs.org/v2/api/#productionTip
Vue.config.productionTip = false Vue.config.productionTip = false
......
...@@ -2,8 +2,8 @@ import store from '@/store' ...@@ -2,8 +2,8 @@ import store from '@/store'
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
install (Vue, options) { install(Vue, options) {
Vue.config.errorHandler = function (error, instance, info) { Vue.config.errorHandler = function(error, instance, info) {
Vue.nextTick(() => { Vue.nextTick(() => {
// store 追加 log // store 追加 log
store.dispatch('d2admin/log/push', { store.dispatch('d2admin/log/push', {
......
...@@ -2,11 +2,11 @@ import store from '@/store' ...@@ -2,11 +2,11 @@ import store from '@/store'
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
install (Vue, options) { install(Vue, options) {
// 快速打印 log // 快速打印 log
Vue.prototype.$log = { Vue.prototype.$log = {
...util.log, ...util.log,
push (data) { push(data) {
if (typeof data === 'string') { if (typeof data === 'string') {
// 如果传递来的数据是字符串 // 如果传递来的数据是字符串
// 赋值给 message 字段 // 赋值给 message 字段
......
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
install (Vue, options) { install(Vue, options) {
Vue.prototype.$open = util.open Vue.prototype.$open = util.open
} }
} }
...@@ -13,7 +13,7 @@ import util from '@/libs/util.js' ...@@ -13,7 +13,7 @@ import util from '@/libs/util.js'
import routes from './routes' import routes from './routes'
const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin
VueRouter.prototype.push = function push (location) { VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location) && originalPush.call(this, location).catch(err => err) return originalPush.call(this, location) && originalPush.call(this, location).catch(err => err)
} }
Vue.use(VueRouter) Vue.use(VueRouter)
...@@ -27,7 +27,7 @@ const router = new VueRouter({ ...@@ -27,7 +27,7 @@ const router = new VueRouter({
* 路由拦截 * 路由拦截
* 权限验证 * 权限验证
*/ */
router.beforeEach(async (to, from, next) => { router.beforeEach(async(to, from, next) => {
const source = store.state.d2admin.auth.source const source = store.state.d2admin.auth.source
// 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201 // 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
await store.dispatch('d2admin/page/isLoaded') await store.dispatch('d2admin/page/isLoaded')
......
...@@ -20,40 +20,40 @@ export default { ...@@ -20,40 +20,40 @@ export default {
* @description 返回当前登录用户权限资源 * @description 返回当前登录用户权限资源
* @param {Object} state state * @param {Object} state state
*/ */
source (state, dispatch) { source(state, dispatch) {
return state.source return state.source
}, },
/** /**
* @description 返回当前页面meta * @description 返回当前页面meta
* @param {Object} state state * @param {Object} state state
*/ */
meta (state, dispatch) { meta(state, dispatch) {
return state.meta return state.meta
}, },
/** /**
* @description 当前角色拥有的所有按钮 * @description 当前角色拥有的所有按钮
* @param {Object} state state * @param {Object} state state
*/ */
btns (state, dispatch) { btns(state, dispatch) {
return state.btns return state.btns
}, },
/** /**
* 返回当前页面的btn * 返回当前页面的btn
* @param {*} state * @param {*} state
*/ */
curBtns (state) { curBtns(state) {
return state.btns[state.meta.authId] return state.btns[state.meta.authId]
}, },
/** /**
* 返回当前页面的btn * 返回当前页面的btn
* @param {*} state * @param {*} state
*/ */
btnIdAll (state) { btnIdAll(state) {
return state.btnIdAll return state.btnIdAll
} }
}, },
actions: { actions: {
save2db ({ state, dispatch }) { save2db({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 设置数据 // 设置数据
dispatch('d2admin/db/set', { dispatch('d2admin/db/set', {
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
* @description 保存当前角色权限资源 * @description 保存当前角色权限资源
* @param {obj} source 需要保存的权限资源 * @param {obj} source 需要保存的权限资源
*/ */
set ({ state, commit, dispatch }, source) { set({ state, commit, dispatch }, source) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 检查这个主题在主题列表里是否存在 // 检查这个主题在主题列表里是否存在
state.source = source state.source = source
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
* @description 保存当前角色权限资源 * @description 保存当前角色权限资源
* @param {obj} source 需要保存的权限资源 * @param {obj} source 需要保存的权限资源
*/ */
setCurrentPageMeta ({ state, commit, dispatch }, meta) { setCurrentPageMeta({ state, commit, dispatch }, meta) {
return new Promise(async resolve => { return new Promise(async resolve => {
state.meta = meta state.meta = meta
// end // end
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
* @description 从持久化数据加载资源数据 * @description 从持久化数据加载资源数据
* @param {Object} context * @param {Object} context
*/ */
load ({ state, commit, dispatch }) { load({ state, commit, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
if (!state.source) { if (!state.source) {
state.source = await dispatch('d2admin/db/get', { state.source = await dispatch('d2admin/db/get', {
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
* 过滤并初始化路由与左侧菜单栏 * 过滤并初始化路由与左侧菜单栏
* @param {*} param0 * @param {*} param0
*/ */
init ({ state, commit, dispatch }) { init({ state, commit, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
try { try {
// 获取权限资源点 // 获取权限资源点
......
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
* @description 返回当前颜色值 * @description 返回当前颜色值
* @param {Object} state state * @param {Object} state state
*/ */
color (state, dispatch) { color(state, dispatch) {
return state.value return state.value
} }
}, },
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {String} color 尺寸 * @param {String} color 尺寸
*/ */
set ({ state, dispatch, commit }, color) { set({ state, dispatch, commit }, color) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 记录上个值 // 记录上个值
const old = state.value const old = state.value
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
* @description 从持久化数据读取颜色设置 * @description 从持久化数据读取颜色设置
* @param {Object} context * @param {Object} context
*/ */
load ({ state, dispatch, commit }) { load({ state, dispatch, commit }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 记录上个值 // 记录上个值
const old = state.value const old = state.value
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
resolve() resolve()
}) })
}, },
loadFromDB ({ state, dispatch, commit }) { loadFromDB({ state, dispatch, commit }) {
return new Promise(async resolve => { return new Promise(async resolve => {
const color = await dispatch('d2admin/db/get', { const color = await dispatch('d2admin/db/get', {
dbName: 'sys', dbName: 'sys',
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
* @param {Object} payload oldColor {String} 旧的颜色 * @param {Object} payload oldColor {String} 旧的颜色
* @param {Object} payload newColor {String} 新颜色 * @param {Object} payload newColor {String} 新颜色
*/ */
apply (state, { oldColor, newColor }) { apply(state, { oldColor, newColor }) {
var options = { var options = {
oldColors: [...forElementUI.getElementUISeries(oldColor)], oldColors: [...forElementUI.getElementUISeries(oldColor)],
newColors: [...forElementUI.getElementUISeries(newColor)] newColors: [...forElementUI.getElementUISeries(newColor)]
......
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
* @description 初始化监听 * @description 初始化监听
* @param {Object} context * @param {Object} context
*/ */
listen ({ commit }) { listen({ commit }) {
return new Promise(resolve => { return new Promise(resolve => {
if (screenfull.enabled) { if (screenfull.enabled) {
screenfull.on('change', () => { screenfull.on('change', () => {
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
* @description 切换全屏 * @description 切换全屏
* @param {Object} context * @param {Object} context
*/ */
toggle ({ commit }) { toggle({ commit }) {
return new Promise(resolve => { return new Promise(resolve => {
if (screenfull.isFullscreen) { if (screenfull.isFullscreen) {
screenfull.exit() screenfull.exit()
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Boolean} active active * @param {Boolean} active active
*/ */
set (state, active) { set(state, active) {
state.active = active state.active = active
} }
} }
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
* @description 切换灰度状态 * @description 切换灰度状态
* @param {Object} state state * @param {Object} state state
*/ */
toggle (state) { toggle(state) {
state.active = !state.active state.active = !state.active
}, },
/** /**
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Boolean} active active * @param {Boolean} active active
*/ */
set (state, active) { set(state, active) {
state.active = active state.active = active
} }
} }
......
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
* @description 显示版本信息 * @description 显示版本信息
* @param {Object} state state * @param {Object} state state
*/ */
versionShow () { versionShow() {
util.log.capsule(process.env.VUE_APP_TITLE, `v${process.env.VUE_APP_VERSION}`) util.log.capsule(process.env.VUE_APP_TITLE, `v${process.env.VUE_APP_VERSION}`)
console.log('广联赛讯 http://www.glsx.com.cn') console.log('广联赛讯 http://www.glsx.com.cn')
// console.log('D2 Crud https://github.com/d2-projects/d2-crud') // console.log('D2 Crud https://github.com/d2-projects/d2-crud')
......
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
* @description 切换激活状态 * @description 切换激活状态
* @param {Object} state state * @param {Object} state state
*/ */
toggle (state) { toggle(state) {
state.active = !state.active state.active = !state.active
}, },
/** /**
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Boolean} active active * @param {Boolean} active active
*/ */
set (state, active) { set(state, active) {
state.active = active state.active = active
}, },
/** /**
...@@ -34,9 +34,9 @@ export default { ...@@ -34,9 +34,9 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Array} menu menu * @param {Array} menu menu
*/ */
init (state, menu) { init(state, menu) {
const pool = [] const pool = []
const push = function (menu, titlePrefix = []) { const push = function(menu, titlePrefix = []) {
menu.forEach(m => { menu.forEach(m => {
if (m.children) { if (m.children) {
push(m.children, [ ...titlePrefix, m.title ]) push(m.children, [ ...titlePrefix, m.title ])
......
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Boolean} refresh 是否在设置之后刷新页面 * @param {Boolean} refresh 是否在设置之后刷新页面
*/ */
apply ({ state, commit }, refresh) { apply({ state, commit }, refresh) {
Vue.prototype.$ELEMENT.size = state.value Vue.prototype.$ELEMENT.size = state.value
if (refresh) { if (refresh) {
commit('d2admin/page/keepAliveClean', null, { root: true }) commit('d2admin/page/keepAliveClean', null, { root: true })
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
* @description 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198 * @description 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198
* @param {Object} context * @param {Object} context
*/ */
isLoaded ({ state }) { isLoaded({ state }) {
if (state.value) return Promise.resolve() if (state.value) return Promise.resolve()
return new Promise(resolve => { return new Promise(resolve => {
const timer = setInterval(() => { const timer = setInterval(() => {
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {String} size 尺寸 * @param {String} size 尺寸
*/ */
set ({ state, dispatch }, size) { set({ state, dispatch }, size) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.value = size state.value = size
...@@ -60,7 +60,7 @@ export default { ...@@ -60,7 +60,7 @@ export default {
* @description 从持久化数据读取尺寸设置 * @description 从持久化数据读取尺寸设置
* @param {Object} context * @param {Object} context
*/ */
load ({ state, dispatch }) { load({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.value = await dispatch('d2admin/db/get', { state.value = await dispatch('d2admin/db/get', {
......
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
* @description 返回当前的主题信息 不是一个名字 而是当前激活主题的所有数据 * @description 返回当前的主题信息 不是一个名字 而是当前激活主题的所有数据
* @param {Object} state state * @param {Object} state state
*/ */
activeSetting (state) { activeSetting(state) {
return state.list.find(theme => theme.name === state.activeName) return state.list.find(theme => theme.name === state.activeName)
} }
}, },
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
* @description 激活一个主题 * @description 激活一个主题
* @param {String} themeValue 需要激活的主题名称 * @param {String} themeValue 需要激活的主题名称
*/ */
set ({ state, commit, dispatch }, themeName) { set({ state, commit, dispatch }, themeName) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 检查这个主题在主题列表里是否存在 // 检查这个主题在主题列表里是否存在
state.activeName = state.list.find(e => e.name === themeName) ? themeName : state.list[0].name state.activeName = state.list.find(e => e.name === themeName) ? themeName : state.list[0].name
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
/** /**
* @description 从持久化数据加载主题设置 * @param {Object} context * @description 从持久化数据加载主题设置 * @param {Object} context
*/ */
load ({ state, commit, dispatch }) { load({ state, commit, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
let activeName = await dispatch('d2admin/db/get', { let activeName = await dispatch('d2admin/db/get', {
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
* @description 将 vuex 中的主题应用到 dom * @description 将 vuex 中的主题应用到 dom
* @param {Object} state state * @param {Object} state state
*/ */
dom (state) { dom(state) {
document.body.className = `theme-${state.activeName}` document.body.className = `theme-${state.activeName}`
} }
} }
......
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Boolean} active 新的状态 * @param {Boolean} active 新的状态
*/ */
set ({ state, dispatch }, active) { set({ state, dispatch }, active) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.active = active state.active = active
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
* 从数据库读取页面过渡动画设置 * 从数据库读取页面过渡动画设置
* @param {Object} context * @param {Object} context
*/ */
load ({ state, dispatch }) { load({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.active = await dispatch('d2admin/db/get', { state.active = await dispatch('d2admin/db/get', {
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
* @description 切换状态 * @description 切换状态
* @param {Object} state state * @param {Object} state state
*/ */
toggle (state) { toggle(state) {
state.active = !state.active state.active = !state.active
}, },
/** /**
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Boolean} active active * @param {Boolean} active active
*/ */
set (state, active) { set(state, active) {
state.active = active state.active = active
} }
} }
......
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
* @description 记录 UA * @description 记录 UA
* @param {Object} state state * @param {Object} state state
*/ */
get (state) { get(state) {
state.data = new UaParser().getResult() state.data = new UaParser().getResult()
} }
} }
......
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {*} info info * @param {*} info info
*/ */
set ({ state, dispatch }, info) { set({ state, dispatch }, info) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.info = info state.info = info
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
* @description 从数据库取用户数据 * @description 从数据库取用户数据
* @param {Object} context * @param {Object} context
*/ */
load ({ state, dispatch }) { load({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
// state.info = await dispatch('d2admin/db/get', { // state.info = await dispatch('d2admin/db/get', {
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
}) })
}, },
clear ({ state, dispatch }) { clear({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// await dispatch('d2admin/db/set', { // await dispatch('d2admin/db/set', {
// dbName: 'database', // dbName: 'database',
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<script> <script>
export default { export default {
name: 'page1', name: 'page1',
render: function (createElement) { render: function(createElement) {
return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' } return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' }
}, [ }, [
createElement('el-menu', { createElement('el-menu', {
......
...@@ -56,11 +56,11 @@ ...@@ -56,11 +56,11 @@
export default { export default {
name: 'page2', name: 'page2',
methods: { methods: {
handleClick (row) { handleClick(row) {
alert(JSON.stringify(row)) alert(JSON.stringify(row))
} }
}, },
data () { data() {
return { return {
testCache: '', testCache: '',
btn: { btn: {
......
...@@ -58,7 +58,7 @@ import { getListApi } from '@api/materialList' ...@@ -58,7 +58,7 @@ import { getListApi } from '@api/materialList'
import notice from '@/common/notice' import notice from '@/common/notice'
export default { export default {
name: 'fimsMaterialList', name: 'fimsMaterialList',
data () { data() {
return { return {
searchForm: { searchForm: {
keyWord: '' keyWord: ''
...@@ -95,24 +95,24 @@ export default { ...@@ -95,24 +95,24 @@ export default {
} }
}, },
mounted () { mounted() {
this.loadingGetList() this.loadingGetList()
}, },
methods: { methods: {
loadingGetList () { loadingGetList() {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams() {
return { return {
pageCount: this.pageSize, pageCount: this.pageSize,
pageSize: this.currentPage, pageSize: this.currentPage,
...this.searchForm ...this.searchForm
} }
}, },
getList () { getList() {
const params = this.getParams() const params = this.getParams()
getListApi(params).then(res => { getListApi(params).then(res => {
this.tableData = res.deviceList this.tableData = res.deviceList
...@@ -125,18 +125,18 @@ export default { ...@@ -125,18 +125,18 @@ export default {
}, },
/* 接口请求-end */ /* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch() {
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
......
...@@ -116,7 +116,7 @@ import { BaseData } from '@/common/constants' ...@@ -116,7 +116,7 @@ import { BaseData } from '@/common/constants'
import notice from '@/common/notice' import notice from '@/common/notice'
export default { export default {
name: 'FimsReportingLogs', name: 'FimsReportingLogs',
data () { data() {
return { return {
// 远程搜索-返回数组 // 远程搜索-返回数组
remoteOptionArr: { remoteOptionArr: {
...@@ -166,24 +166,24 @@ export default { ...@@ -166,24 +166,24 @@ export default {
}, },
watch: { watch: {
'searchForm.reportTime' (value) { 'searchForm.reportTime'(value) {
!value && this.loadingGetList() !value && this.loadingGetList()
} }
}, },
mounted () { mounted() {
this.loadingGetList() this.loadingGetList()
this.loadBaseData() this.loadBaseData()
}, },
methods: { methods: {
async loadBaseData () { async loadBaseData() {
const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY) const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
this.baseData.station = data this.baseData.station = data
}, },
// 防抖 // 防抖
debounce (fn, delay = 50) { debounce(fn, delay = 50) {
let timer = null let timer = null
return (...args) => { return (...args) => {
clearTimeout(timer) clearTimeout(timer)
...@@ -194,21 +194,21 @@ export default { ...@@ -194,21 +194,21 @@ export default {
}, },
// 远程搜索 // 远程搜索
remoteArr (value, attr) { remoteArr(value, attr) {
this.debounce(this.getRemote(attr, value), 50) this.debounce(this.getRemote(attr, value), 50)
}, },
// 清空远程搜索列表;表格数据刷新 // 清空远程搜索列表;表格数据刷新
remoteAndGetList (attr) { remoteAndGetList(attr) {
this.remoteOptionArr[attr] = [] this.remoteOptionArr[attr] = []
this.loadingGetList() this.loadingGetList()
}, },
loadingGetList () { loadingGetList() {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
}, },
getParams () { getParams() {
return Object.assign( return Object.assign(
{ {
pageCount: this.pageSize, pageCount: this.pageSize,
...@@ -217,7 +217,7 @@ export default { ...@@ -217,7 +217,7 @@ export default {
this.searchForm this.searchForm
) )
}, },
getRemote (attr, value) { getRemote(attr, value) {
let params = {} let params = {}
params[attr] = value params[attr] = value
delete params.pageCount delete params.pageCount
...@@ -226,7 +226,7 @@ export default { ...@@ -226,7 +226,7 @@ export default {
this.remoteOptionArr[attr] = new Set(res.loges.map(item => item[attr])) this.remoteOptionArr[attr] = new Set(res.loges.map(item => item[attr]))
}) })
}, },
getList () { getList() {
const params = this.getParams() const params = this.getParams()
params.startTime = params.reportTime ? params.reportTime[0] + ' ' + '00:00:00 ' : '' params.startTime = params.reportTime ? params.reportTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.reportTime ? params.reportTime[1] + ' ' + '23:59:59' : '' params.endTime = params.reportTime ? params.reportTime[1] + ' ' + '23:59:59' : ''
...@@ -243,7 +243,7 @@ export default { ...@@ -243,7 +243,7 @@ export default {
}) })
}, },
handleExport () { handleExport() {
const params = this.getParams() const params = this.getParams()
params.startTime = params.reportTime ? params.reportTime[0] + ' ' + '00:00:00 ' : '' params.startTime = params.reportTime ? params.reportTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.reportTime ? params.reportTime[1] + ' ' + '23:59:59' : '' params.endTime = params.reportTime ? params.reportTime[1] + ' ' + '23:59:59' : ''
...@@ -259,18 +259,18 @@ export default { ...@@ -259,18 +259,18 @@ export default {
}, },
// 搜索 // 搜索
handleSearch () { handleSearch() {
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
......
export default { export default {
beforeRouteEnter (to, from, next) { beforeRouteEnter(to, from, next) {
next(instance => instance.$router.replace(JSON.parse(from.params.route))) next(instance => instance.$router.replace(JSON.parse(from.params.route)))
}, },
render: h => h() render: h => h()
......
export default { export default {
beforeRouteEnter (to, from, next) { beforeRouteEnter(to, from, next) {
next(instance => instance.$router.replace(from.fullPath)) next(instance => instance.$router.replace(from.fullPath))
}, },
render: h => h() render: h => h()
......
...@@ -90,11 +90,11 @@ export default { ...@@ -90,11 +90,11 @@ export default {
} }
}, },
computed: { computed: {
dialogVisible () { dialogVisible() {
return this.isVisible return this.isVisible
} }
}, },
data () { data() {
return { return {
POST_DISABLED, POST_DISABLED,
company: [], company: [],
...@@ -186,12 +186,12 @@ export default { ...@@ -186,12 +186,12 @@ export default {
}, },
methods: { methods: {
...mapActions('d2admin/base', ['load']), ...mapActions('d2admin/base', ['load']),
handleClose () { handleClose() {
this.$refs.regForm.resetFields() this.$refs.regForm.resetFields()
this.$event.$emit('e-reg-dialog', false) this.$event.$emit('e-reg-dialog', false)
}, },
// 提交注册数据 // 提交注册数据
submit () { submit() {
this.$refs.regForm.validate(vaild => { this.$refs.regForm.validate(vaild => {
if (vaild) { if (vaild) {
var __p = this.regForm var __p = this.regForm
...@@ -201,21 +201,21 @@ export default { ...@@ -201,21 +201,21 @@ export default {
notice.okTips('注册信息已提交,请等待管理员审核') notice.okTips('注册信息已提交,请等待管理员审核')
this.handleClose() this.handleClose()
} else { } else {
notice.errorTips(`注册失败!`) notice.errorTips('注册失败!')
} }
}) })
} }
}) })
}, },
// 加载业务所需所有数据 // 加载业务所需所有数据
async fetchData () { async fetchData() {
const { station, post } = await this.load() const { station, post } = await this.load()
this.baseData.posts = post this.baseData.posts = post
this.baseData.stations = station this.baseData.stations = station
Object.freeze(this.baseData) Object.freeze(this.baseData)
} }
}, },
mounted () { mounted() {
this.fetchData() this.fetchData()
} }
} }
......
...@@ -90,7 +90,7 @@ export default { ...@@ -90,7 +90,7 @@ export default {
components: { components: {
DialogReg: () => import('./dialogReg') DialogReg: () => import('./dialogReg')
}, },
data () { data() {
return { return {
registerDialogVisible: false, registerDialogVisible: false,
timeInterval: null, timeInterval: null,
...@@ -118,20 +118,20 @@ export default { ...@@ -118,20 +118,20 @@ export default {
}) })
} }
}, },
mounted () { mounted() {
this.timeInterval = setInterval(() => this.refreshTime(), 1000) this.timeInterval = setInterval(() => this.refreshTime(), 1000)
this.$event.$on('e-reg-dialog', res => (this.registerDialogVisible = res)) this.$event.$on('e-reg-dialog', res => (this.registerDialogVisible = res))
}, },
beforeDestroy () { beforeDestroy() {
clearInterval(this.timeInterval) clearInterval(this.timeInterval)
}, },
methods: { methods: {
...mapActions('d2admin/account', ['login']), ...mapActions('d2admin/account', ['login']),
refreshTime () { refreshTime() {
this.time = dayjs().format('HH:mm:ss') this.time = dayjs().format('HH:mm:ss')
}, },
// 提交登录信息 // 提交登录信息
submit () { submit() {
// console.log(navigator.userAgent.toLocaleLowerCase()) // console.log(navigator.userAgent.toLocaleLowerCase())
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!