You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.3 KiB

  1. 'use strict'
  2. /* global jQuery, _, Vue, axios */
  3. jQuery(document).ready(function ($) {
  4. new Vue({ // eslint-disable-line no-new
  5. el: 'main',
  6. data: {
  7. loading: false,
  8. state: 'welcome',
  9. syscheck: {
  10. ok: false,
  11. error: ''
  12. },
  13. conf: {
  14. title: 'Wiki',
  15. host: '',
  16. port: 80,
  17. lang: 'en',
  18. db: 'mongodb://localhost:27017/wiki'
  19. }
  20. },
  21. methods: {
  22. proceedToWelcome: function (ev) {
  23. this.state = 'welcome'
  24. this.loading = false
  25. },
  26. proceedToSyscheck: function (ev) {
  27. let self = this
  28. this.state = 'syscheck'
  29. this.loading = true
  30. _.delay(() => {
  31. axios.post('/syscheck').then(resp => {
  32. if (resp.data.ok === true) {
  33. self.syscheck.ok = true
  34. } else {
  35. self.syscheck.ok = false
  36. self.syscheck.error = resp.data.error
  37. }
  38. self.loading = false
  39. }).catch(err => {
  40. window.alert(err.message)
  41. })
  42. }, 1000)
  43. },
  44. proceedToGeneral: function (ev) {
  45. this.state = 'general'
  46. this.loading = false
  47. },
  48. proceedToDb: function (ev) {
  49. this.state = 'db'
  50. this.loading = false
  51. }
  52. }
  53. })
  54. })