Spaces:
Paused
Paused
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"> | |
| <meta http-equiv="Pragma" content="no-cache"> | |
| <meta http-equiv="Expires" content="0"> | |
| <title>配置说明</title> | |
| <style> | |
| body { | |
| margin: 0px; | |
| padding: 0px; | |
| } | |
| .systemprompt { | |
| margin: 2vw 2vw; | |
| width: 92vw; | |
| height: 90vh; | |
| } | |
| </style> | |
| <script src="js/vue.js"></script> | |
| <script src="js/axios.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="app"> | |
| <form onsubmit="event.preventDefault();" style="text-align: center; margin-top: 2vw;"> | |
| <div style="display:none"> | |
| <label>botwxid:</label> | |
| <input readonly type="text" v-model="botwxid"> | |
| <label>roomwxid:</label> | |
| <input readonly type="text" v-model="roomwxid"> | |
| </div> | |
| <div style=" display: flex; justify-content: space-between; padding: 0px 2vw;">提示词:<input | |
| type="submit" value="保存" @click="saveConfig"></div> | |
| <textarea class="systemprompt" v-model="systemprompt"></textarea><br><br> | |
| </form> | |
| </div> | |
| <script> | |
| function getQueryVariable(variable) { | |
| var query = window.location.search.substring(1); | |
| var vars = query.split("&"); | |
| for (var i = 0; i < vars.length; i++) { | |
| var pair = vars[i].split("="); | |
| if (pair[0] == variable) { | |
| return pair[1]; | |
| } | |
| } | |
| return (false); | |
| } | |
| // 创建一个新的Vue实例,并将其挂载到 id 为 app 的元素上 | |
| var app = new Vue({ | |
| el: '#app', // 指定挂载的元素 | |
| data: { | |
| botwxid: getQueryVariable('botwxid'), | |
| roomwxid: getQueryVariable('roomwxid'), | |
| systemprompt: '', | |
| }, | |
| mounted() { | |
| var apiUrl = `/api/getConfig?botwxid=${this.botwxid}&roomwxid=${this.roomwxid}`; | |
| axios.get(apiUrl).then(res => { | |
| var data = res.data.data | |
| Object.assign(this, data) | |
| }) | |
| }, | |
| methods: { | |
| saveConfig: function () { | |
| console.log(1111) | |
| axios.post('/api/saveConfig', { | |
| botwxid: this.botwxid, | |
| roomwxid: this.roomwxid, | |
| systemprompt: this.systemprompt | |
| }).then(res => { | |
| if (res.data.code == 200) { | |
| alert('保存成功') | |
| } | |
| }) | |
| } | |
| } | |
| }) | |
| ; | |
| </script> | |
| </body> | |
| </html> |