Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

Commit

Permalink
YoCool-v1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
A-kirami committed May 14, 2021
1 parent 1b6dbab commit 0d948ec
Show file tree
Hide file tree
Showing 49 changed files with 2,894 additions and 212 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Develop
CoolLite/
1 change: 1 addition & 0 deletions PrincessAdventure/static/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.gz
13 changes: 13 additions & 0 deletions PrincessAdventure/static/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 开发注意事项

默认配置下,此目录下的文件会被 gzip 压缩缓存。修改源文件不会立刻反映在浏览器中。开发时请在配置文件中将 `web-gzp` 值设置为 `0`

或者使用下面的命令删除所有缓存

```shell
# 查看所有 .gz 文件
find . -name "*.gz" -type f

# 删除所有 .gz 文件
find . -name "*.gz" -type f -delete
```
57 changes: 57 additions & 0 deletions PrincessAdventure/static/admin/groups.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
var vm = new Vue({
el: '#app',
data: {
groupData: [],
},
mounted() {
this.refresh();
},
methods: {
refresh: function (event) {
var thisvue = this;
axios.post(api_path, {
action: 'get_data',
csrf_token: csrf_token,
}).then(function (res) {
if (res.data.code == 0) {
thisvue.groupData = res.data.data;
} else {
thisvue.$alert(res.data.message, '加载数据错误');
}
}).catch(function (error) {
thisvue.$alert(error, '加载数据错误');
});
},
delete_group: function (scope) {
var thisvue = this;
thisvue.$confirm('是否删除' + scope.row.group_name, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'danger'
}).then(() => {
axios.post(api_path, {
action: 'drop_group',
csrf_token: csrf_token,
group_id: scope.row.group_id,
}).then(function (res) {
if (res.data.code == 0) {
thisvue.$message({
message: '删除成功',
type: 'success',
});
} else {
thisvue.$message.error('删除失败' + res.data.message);
}
}).catch(function (error) {
thisvue.$message.error(error);
});
}).catch(() => {
thisvue.$message({
type: 'info',
message: '已取消删除'
});
});
},
},
delimiters: ['[[', ']]'],
})
45 changes: 45 additions & 0 deletions PrincessAdventure/static/admin/pool-setting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var vm = new Vue({
el: '#app',
data: {
settings: null,
},
mounted() {
var thisvue = this;
axios.get(api_path).then(function (res) {
if (res.data.code == 0) {
thisvue.settings = res.data.settings;
} else {
alert(res.data.message, '加载数据错误');
}
}).catch(function (error) {
alert(error, '加载数据错误');
});
},
methods: {
addpool: function () {
let newname = "奖池" + (Object.keys(this.settings.pool).length+1);
this.$set(this.settings.pool, newname, {
prop: 0,
prop_last: 0,
prefix: "★★★",
pool: ["请输入内容"],
});
},
update: function () {
var thisvue = this;
axios.put(api_path, {
setting: thisvue.settings,
csrf_token: csrf_token,
}).then(function (res) {
if (res.data.code == 0) {
alert('设置成功,重启后生效');
} else {
alert('设置失败:' + res.data.message);
}
}).catch(function (error) {
alert(error);
});
},
},
delimiters: ['[[', ']]'],
})
90 changes: 90 additions & 0 deletions PrincessAdventure/static/admin/setting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
var vm = new Vue({
el: '#app',
data: {
setting: {},
activeNames: [],
bossSetting: false,
domain: '',
domainApply: false,
applyName: '',
loading: false,
},
mounted() {
var thisvue = this;
axios.get(api_path).then(function (res) {
if (res.data.code == 0) {
thisvue.setting = res.data.settings;
} else {
alert(res.data.message);
}
}).catch(function (error) {
alert(error);
});
},
methods: {
update: function (event) {
this.setting.web_mode_hint = false;
axios.put(
api_path,
{
setting: this.setting,
csrf_token: csrf_token,
},
).then(function (res) {
if (res.data.code == 0) {
alert('设置成功,重启机器人后生效');
} else {
alert('设置失败:' + res.data.message);
}
}).catch(function (error) {
alert(error);
});
},
sendApply: function (api) {
if (this.domain === '') {
alert('请选择后缀');
return;
}
if (/^[0-9a-z]{1,16}$/.test(this.applyName)) {
;
} else {
alert('只能包含字母、数字');
return;
}
var thisvue = this;
this.loading = true;
axios.get(
api + '?name=' + thisvue.applyName + thisvue.domain
).then(function (res) {
thisvue.domainApply = false;
if (res.data.code == 0) {
alert('申请成功,请等待1分钟左右解析生效');
thisvue.setting.public_address = thisvue.setting.public_address.replace(/\/\/([^:\/]+)/, '//' + thisvue.applyName + thisvue.domain);
thisvue.update(null);
} else if (res.data.code == 1) {
alert('申请失败,此域已被占用');
} else {
alert('申请失败,' + res.data.message);
}
thisvue.loading = false;
}).catch(function (error) {
thisvue.loading = false;
alert(error);
});
},
switch_levels: function (area) {
if (this.setting.boss[area].length < 5) {
this.setting.boss[area].push([0, 0, 0, 0, 0]);
} else {
this.setting.boss[area] = this.setting.boss[area].slice(0, -2);
}
},
comfirm_change_clan_mode: function (event) {
this.$alert('修改模式后,公会战数据会重置。请不要在公会战期间修改!', '警告', {
confirmButtonText: '知道了',
type: 'warning',
});
},
},
delimiters: ['[[', ']]'],
})
134 changes: 134 additions & 0 deletions PrincessAdventure/static/admin/users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
var vm = new Vue({
el: '#app',
data: {
isLoading: true,
moreLoading: false,
userData: [],
querys: {
page: 1,
page_size: 50,
qqid: null,
clan_group_id: null,
authority_group: null,
},
query_input: {
qqid: null,
clan_group_id: null,
authority_group: null,
},
has_more: true,
authtype: [{
value: 100,
label: '成员',
}, {
value: 10,
label: '公会战管理员',
}, {
value: 1,
label: '主人',
}],
},
mounted() {
this.load_more();
},
methods: {
datestr: function (ts) {
if (ts == 0) {
return null;
}
var nd = new Date();
nd.setTime(ts * 1000);
return nd.toLocaleString('chinese', { hour12: false, timeZone: 'asia/shanghai' });
},
search: function (event) {
Object.assign(this.querys, this.query_input);
this.querys.page = 1;
this.isLoading = true;
this.userData = [];
this.load_more();
},
load_more: function (event) {
this.moreLoading = true;
var thisvue = this;
axios.post(api_path, {
action: 'get_data',
querys: thisvue.querys,
csrf_token: csrf_token,
}).then(function (res) {
if (res.data.code == 0) {
thisvue.userData.push(...res.data.data);
thisvue.isLoading = false;
thisvue.moreLoading = false;
if (res.data.data.length < thisvue.querys.page_size) {
thisvue.has_more = false;
} else {
thisvue.querys.page += 1;
}
} else {
thisvue.$alert(res.data.message, '加载数据错误');
}
}).catch(function (error) {
thisvue.$alert(error, '加载数据错误');
});
},
modify: function (scope) {
var thisvue = this;
axios.post(api_path, {
action: 'modify_user',
csrf_token: csrf_token,
data: {
qqid: scope.row.qqid,
authority_group: scope.row.authority_group,
},
}).then(function (res) {
if (res.data.code == 0) {
thisvue.$message({
message: '修改成功',
type: 'success',
});
} else {
thisvue.$message.error('修改失败' + res.data.message);
}
}).catch(function (error) {
thisvue.$message.error(error);
});
},
delete_user: function (scope) {
var thisvue = this;
thisvue.$confirm('是否删除' + scope.row.nickname, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'danger'
}).then(() => {
axios.post(api_path, {
action: 'delete_user',
csrf_token: csrf_token,
data: {
qqid: scope.row.qqid,
},
}).then(function (res) {
if (res.data.code == 0) {
thisvue.$message({
message: '删除成功',
type: 'success',
});
} else {
thisvue.$message.error('删除失败' + res.data.message);
}
}).catch(function (error) {
thisvue.$message.error(error);
});
}).catch(() => {
thisvue.$message({
type: 'info',
message: '已取消删除'
});
});




},
},
delimiters: ['[[', ']]'],
})
Binary file added PrincessAdventure/static/chara_marks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0d948ec

Please sign in to comment.