2017-03-05 04:20:22 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
/* global jQuery, _, Vue, axios */
|
|
|
|
|
|
|
|
jQuery(document).ready(function ($) {
|
|
|
|
new Vue({ // eslint-disable-line no-new
|
|
|
|
el: 'main',
|
|
|
|
data: {
|
|
|
|
loading: false,
|
|
|
|
state: 'welcome',
|
|
|
|
syscheck: {
|
|
|
|
ok: false,
|
|
|
|
error: ''
|
|
|
|
},
|
|
|
|
conf: {
|
|
|
|
title: 'Wiki',
|
2017-03-06 03:22:21 +00:00
|
|
|
host: '',
|
|
|
|
port: 80,
|
|
|
|
lang: 'en',
|
|
|
|
db: 'mongodb://localhost:27017/wiki'
|
2017-03-05 04:20:22 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2017-03-06 03:22:21 +00:00
|
|
|
proceedToWelcome: function (ev) {
|
|
|
|
this.state = 'welcome'
|
|
|
|
this.loading = false
|
|
|
|
},
|
2017-03-05 04:20:22 +00:00
|
|
|
proceedToSyscheck: function (ev) {
|
|
|
|
let self = this
|
|
|
|
this.state = 'syscheck'
|
|
|
|
this.loading = true
|
|
|
|
|
|
|
|
_.delay(() => {
|
|
|
|
axios.post('/syscheck').then(resp => {
|
|
|
|
if (resp.data.ok === true) {
|
|
|
|
self.syscheck.ok = true
|
|
|
|
} else {
|
|
|
|
self.syscheck.ok = false
|
|
|
|
self.syscheck.error = resp.data.error
|
|
|
|
}
|
|
|
|
self.loading = false
|
|
|
|
}).catch(err => {
|
|
|
|
window.alert(err.message)
|
|
|
|
})
|
|
|
|
}, 1000)
|
|
|
|
},
|
|
|
|
proceedToGeneral: function (ev) {
|
|
|
|
this.state = 'general'
|
2017-03-06 03:22:21 +00:00
|
|
|
this.loading = false
|
|
|
|
},
|
|
|
|
proceedToDb: function (ev) {
|
|
|
|
this.state = 'db'
|
|
|
|
this.loading = false
|
2017-03-05 04:20:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|