This commit is contained in:
unknown
2026-02-04 20:27:13 +08:00
commit 3b042d1dad
9410 changed files with 1488147 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
Tea.context(function () {
this.ip = ""
this.result = {
isDone: false
}
// 如果数据还没有从后端传入window.TEA.ACTION.data则设置默认值
if (typeof this.maxMindCityExists === "undefined") {
this.maxMindCityExists = false
}
if (typeof this.maxMindASNExists === "undefined") {
this.maxMindASNExists = false
}
if (typeof this.usingMaxMind === "undefined") {
this.usingMaxMind = false
}
if (typeof this.usingEmbeddedMaxMind === "undefined") {
this.usingEmbeddedMaxMind = false
}
this.$delay(function () {
if (this.$refs.focus) {
this.$refs.focus.focus()
}
// 确保表单使用AJAX提交
var form = this.$el.querySelector('form')
if (form) {
form.addEventListener('submit', function (e) {
e.preventDefault()
e.stopPropagation()
// 使用TeaGo的AJAX提交
Tea.runActionOn(form)
})
}
})
// 如果数据还没有从后端传入,则通过 AJAX 获取(作为后备方案)
if (this.maxMindCityExists === false && this.maxMindASNExists === false && this.usingMaxMind === false) {
this.$get("/settings/ip-library/library/test")
.success(function (resp) {
this.maxMindCityExists = resp.data.maxMindCityExists || false
this.maxMindASNExists = resp.data.maxMindASNExists || false
this.usingMaxMind = resp.data.usingMaxMind || false
this.usingEmbeddedMaxMind = resp.data.usingEmbeddedMaxMind || false
})
}
this.success = function (resp) {
if (!resp || !resp.data) {
return
}
this.result = resp.data.result || {
isDone: true,
isOk: false
}
this.maxMindCityExists = resp.data.maxMindCityExists || false
this.maxMindASNExists = resp.data.maxMindASNExists || false
this.usingMaxMind = resp.data.usingMaxMind || false
this.usingEmbeddedMaxMind = resp.data.usingEmbeddedMaxMind || false
// 滚动到结果区域
this.$nextTick(function () {
if (this.$refs.resultBox) {
this.$refs.resultBox.scrollIntoView({ behavior: 'smooth', block: 'start' })
}
})
}
})