1
0
mirror of https://gitee.com/bitdance-team/chrome-extension synced 2025-10-08 00:45:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

Merge remote-tracking branch 'origin/feat-sst' into develop

This commit is contained in:
2022-02-12 00:47:54 +08:00
49 changed files with 211 additions and 544 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,43 @@
new Vue({
el: '#app',
data() {
return {
username: "",
password: ""
}
},
methods: {
login() {
if (!this.username || !this.password) {
alert('账号和密码不能为空!')
return
}
axios.post("https://qcmma8.app.cloudendpoint.cn/api/auth/login", {
username: this.username,
password: this.password
}).then(res => {
window.close()
}).catch(err => {
if (err.response && err.response.data)
alert(err.response.data.msg)
else alert("请求失败!")
})
},
register() {
if (!this.username || !this.password) {
alert('账号和密码不能为空!')
return
}
axios.post("https://qcmma8.app.cloudendpoint.cn/api/auth/register", {
username: this.username,
password: this.password
}).then(res => {
window.close()
}).catch(err => {
if (err.response && err.response.data)
alert(err.response.data.msg)
else alert("请求失败!")
})
}
}
})

View File

@@ -0,0 +1,17 @@
chrome.storage.sync.get('sessionid', function ({ sessionid }) {
if (!sessionid) {
sessionid = uuid.v4()
console.log(sessionid)
chrome.storage.sync.set({
'sessionid': sessionid
});
}
axios.defaults.headers.common['x-tt-session-v2'] = sessionid
if (typeof sessionCb === 'function') {
sessionCb()
}
})

View File

@@ -0,0 +1,42 @@
let app = new Vue({
data() {
return {
todos: [],
todoForm: "",
}
},
methods: {
loadTodos () {
axios.get("https://qcmma8.app.cloudendpoint.cn/api/memos?pageSize=100").then(res => {
this.todos = res.data.content
})
},
createTodo () {
if (!this.toDoForm.trim()) {
alert('内容不能为空')
return
}
axios.post("https://qcmma8.app.cloudendpoint.cn/api/memos", { content: this.toDoForm }).then(() => {
alert('添加成功!')
this.loadTodos()
this.toDoForm = ""
})
},
removeTodo(id) {
axios.delete(`https://qcmma8.app.cloudendpoint.cn/api/memos/${id}`, {
content: this.toDoForm
}).then(() => {
alert('删除成功!')
this.loadTodos()
})
},
},
mounted () {
this.loadTodos()
}
})
function sessionCb() {
app.$mount('#app')
}