diff --git a/templates/auto_pt/status.html b/templates/auto_pt/status.html index 2069fbf..1a95474 100644 --- a/templates/auto_pt/status.html +++ b/templates/auto_pt/status.html @@ -97,7 +97,7 @@ placeholder="请输入站点名称或者网址搜索"> - 添加 + 添加 @@ -489,39 +489,44 @@ - + + + + + + + + + + placeholder="选择注册日期时间"> - - - - - - - + - - - + + - + - + @@ -765,7 +770,119 @@ }); }) }, + getSiteList() { + /** + * 获取要添加的站点列表 + * @type {null} + */ + let id = this.addMySiteForm.site + if (this.addMySiteForm.id == 0) { + id = 0 + } + + axios.get( + "{% url 'get_site_list' %}" + '?id=' + id + ).then(res => { + console.log('获取数据列表成功', res.data) + {#console.log(typeof res.data.data)#} + if (res.data.code === 0) { + {#this.ptData = res.data.data#} + this.site_list = res.data.data.site_list + } else { + this.$message({ + type: 'warning', + message: res.data.msg + }); + } + }).catch(res => { + console.log('获取数据列表失败', res) + this.$message({ + type: 'warning', + message: '获取数据列表失败!' + res + }); + }) + }, + editMySite(formName) { + /** + * 修改站点信息 + * @type {null} + */ + this.$refs[formName].validate((valid) => { + if (valid) { + const options = { + method: 'POST', + headers: {'content-type': 'application/json;charset=utf-8'}, + data: this.addMySiteForm, + url: "{% url 'edit_my_site' %}" + } + + axios(options).then(res => { + console.log('获取数据列表成功', res.data) + {#console.log(typeof res.data.data)#} + if (res.data.code === 0) { + {#this.ptData = res.data.data#} + {#this.site_list = res.data.data.site_list#} + this.addMySiteForm = { + id: 0, + site: null, + sign_in: true, + hr: false, + search: true, + user_id: '', + passkey: '', + time_join: '2023-01-01 12:00:00', + user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52', + cookie: '' + } + this.showAddMySite = false + this.getData() + this.$message({ + type: 'success', + message: res.data.msg + }); + } else { + this.$message({ + type: 'warning', + message: res.data.msg + }); + } + }).catch(res => { + console.log('获取数据列表失败', res) + this.$message({ + type: 'warning', + message: '获取数据列表失败!' + res + }); + }) + } else { + this.$message({ + type: 'warning', + message: '数据验证失败!请认真填写' + }); + return false; + } + }); + }, editSite(id) { + /** + * 打开编辑页面 + * @type {null} + */ + if (id == 0) { + this.addMySiteForm = { + id: 0, + site: null, + sign_in: true, + hr: false, + search: true, + user_id: '', + passkey: '', + time_join: new Date(), + user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52', + cookie: '' + } + this.showAddMySite = true + return + } axios.get( "{% url 'edit_my_site' %}" + '?id=' + id ).then(res => { @@ -849,79 +966,6 @@ message: '获取数据列表失败!' + res }); }) - }, - getSiteList(id) { - if (null == id) { - id = 0 - } - axios.get( - "{% url 'get_site_list' %}" + '?id=' + id - ).then(res => { - console.log('获取数据列表成功', res.data) - {#console.log(typeof res.data.data)#} - if (res.data.code === 0) { - {#this.ptData = res.data.data#} - this.site_list = res.data.data.site_list - } else { - this.$message({ - type: 'warning', - message: res.data.msg - }); - } - }).catch(res => { - console.log('获取数据列表失败', res) - this.$message({ - type: 'warning', - message: '获取数据列表失败!' + res - }); - }) - }, - editMySite(formName) { - this.$refs[formName].validate((valid) => { - if (valid) { - const options = { - method: 'POST', - headers: {'content-type': 'application/json;charset=utf-8'}, - data: this.addMySiteForm, - url: "{% url 'edit_my_site' %}" - } - - axios(options).then(res => { - console.log('获取数据列表成功', res.data) - {#console.log(typeof res.data.data)#} - if (res.data.code === 0) { - {#this.ptData = res.data.data#} - {#this.site_list = res.data.data.site_list#} - this.addMySiteForm = {} - this.showAddMySite = false - this.getData() - this.$message({ - type: 'success', - message: res.data.msg - }); - } else { - this.$message({ - type: 'warning', - message: res.data.msg - }); - } - }).catch(res => { - console.log('获取数据列表失败', res) - this.$message({ - type: 'warning', - message: '获取数据列表失败!' + res - }); - }) - } else { - this.$message({ - type: 'warning', - message: '数据验证失败!请认真填写' - }); - return false; - } - }); - - }, showAllIncrementHistory($event) { console.log($event)