2020-10-13 20:05:29 +08:00
|
|
|
Tea.context(function () {
|
|
|
|
|
this.STEP_INTRO = "intro"
|
|
|
|
|
this.STEP_API = "api"
|
|
|
|
|
this.STEP_DB = "db"
|
|
|
|
|
this.STEP_ADMIN = "admin"
|
|
|
|
|
this.STEP_FINISH = "finish"
|
|
|
|
|
|
|
|
|
|
this.step = this.STEP_INTRO
|
|
|
|
|
|
2021-11-01 21:09:52 +08:00
|
|
|
this.$delay(function () {
|
|
|
|
|
this.loadStatusText()
|
|
|
|
|
})
|
|
|
|
|
|
2020-10-13 20:05:29 +08:00
|
|
|
// 介绍
|
|
|
|
|
this.goIntroNext = function () {
|
|
|
|
|
this.step = this.STEP_API
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// API节点
|
|
|
|
|
this.apiNodeInfo = {}
|
|
|
|
|
this.apiNodeMode = "new"
|
|
|
|
|
this.newAPINodePort = "8001"
|
|
|
|
|
this.apiRequesting = false
|
|
|
|
|
|
2020-11-24 08:47:35 +08:00
|
|
|
this.apiHostInput = false // 是否手工输入
|
|
|
|
|
|
2020-10-13 20:05:29 +08:00
|
|
|
this.apiSubmit = function () {
|
|
|
|
|
this.apiRequesting = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.apiDone = function () {
|
|
|
|
|
this.apiRequesting = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.apiSuccess = function (resp) {
|
|
|
|
|
this.step = this.STEP_DB
|
|
|
|
|
this.apiNodeInfo = resp.data.apiNode
|
|
|
|
|
|
|
|
|
|
if (this.apiNodeMode == "new") {
|
|
|
|
|
this.$delay(function () {
|
|
|
|
|
this.$refs.dbHost.focus()
|
|
|
|
|
}, 200)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.goBackIntro = function () {
|
|
|
|
|
this.step = this.STEP_INTRO
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-24 08:47:35 +08:00
|
|
|
this.inputAPIHost = function () {
|
|
|
|
|
this.apiHostInput = true
|
|
|
|
|
this.$delay(function () {
|
|
|
|
|
this.$refs.newHostRef.focus()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-13 20:05:29 +08:00
|
|
|
// 数据库
|
|
|
|
|
this.dbInfo = {}
|
|
|
|
|
this.dbRequesting = false
|
|
|
|
|
this.dbSubmit = function () {
|
|
|
|
|
this.dbRequesting = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.dbSuccess = function (resp) {
|
|
|
|
|
this.step = this.STEP_ADMIN
|
|
|
|
|
this.dbInfo = resp.data.db
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.dbDone = function () {
|
|
|
|
|
this.dbRequesting = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.goBackAPI = function () {
|
|
|
|
|
this.step = this.STEP_API
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.goDBNext = function () {
|
|
|
|
|
this.step = this.STEP_ADMIN
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 管理员
|
|
|
|
|
this.goBackDB = function () {
|
|
|
|
|
this.step = this.STEP_DB
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.adminInfo = {}
|
|
|
|
|
this.adminPassword = ""
|
|
|
|
|
this.adminPassword2 = ""
|
|
|
|
|
this.adminPasswordVisible = false
|
|
|
|
|
|
|
|
|
|
this.showAdminPassword = function () {
|
|
|
|
|
this.adminPasswordVisible = !this.adminPasswordVisible
|
|
|
|
|
|
|
|
|
|
// TODO 切换密码显示的时候应该focus输入框
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.adminSuccess = function (resp) {
|
|
|
|
|
this.step = this.STEP_FINISH
|
|
|
|
|
this.adminInfo = resp.data.admin
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 结束
|
|
|
|
|
this.goBackAdmin = function () {
|
|
|
|
|
this.step = this.STEP_ADMIN
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.isInstalling = false
|
|
|
|
|
this.finishSubmit = function () {
|
|
|
|
|
this.isInstalling = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.finishDone = function () {
|
|
|
|
|
this.isInstalling = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.finishSuccess = function () {
|
2021-04-18 15:41:47 +08:00
|
|
|
teaweb.success("html:恭喜你!安装完成!<br/>请记住你创建的管理员账号,现在跳转到登录界面。", function () {
|
|
|
|
|
window.location = "/"
|
|
|
|
|
})
|
2020-10-13 20:05:29 +08:00
|
|
|
}
|
2021-11-01 21:09:52 +08:00
|
|
|
|
|
|
|
|
this.statusText = ""
|
|
|
|
|
this.loadStatusText = function () {
|
|
|
|
|
if (!this.isInstalling) {
|
|
|
|
|
this.statusText = ""
|
|
|
|
|
this.$delay(function () {
|
|
|
|
|
this.loadStatusText()
|
|
|
|
|
}, 1000)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.$post(".status")
|
|
|
|
|
.success(function (resp) {
|
|
|
|
|
this.statusText = resp.data.statusText
|
|
|
|
|
})
|
|
|
|
|
.done(function () {
|
|
|
|
|
this.$delay(function () {
|
|
|
|
|
this.loadStatusText()
|
|
|
|
|
}, 1000)
|
|
|
|
|
})
|
|
|
|
|
}
|
2020-10-13 20:05:29 +08:00
|
|
|
})
|