Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
1249993110 committed Jun 12, 2024
1 parent de22f2a commit 13b99a2
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/views/FileBrowser/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const src = ref('');
getAppSettings()
.then((data) => {
const hostname = import.meta.env.DEV ? import.meta.env.VITE_APP_API_DOMAIN : location.hostname;
src.value = `//${hostname}:${data.fileBrowserPort}`;
src.value = data.fileBrowserUrl.replace('{hostname}', hostname);
})
.catch((error) => {});
</script>
Expand Down
79 changes: 60 additions & 19 deletions src/views/GlobalSettings/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<el-card>
<el-scrollbar always>
<div style="margin-right: 16px">
<el-form :model="formModel" :rules="rules" ref="formRef" label-width="180px">
<el-form :model="formModel" :rules="rules" ref="formRef" label-width="250px">
<!-- <el-form-item label="是否启用">
<el-switch v-model="formModel.isEnabled" />
</el-form-item> -->
Expand All @@ -19,18 +19,33 @@
<el-form-item label="聊天消息错误提示" prop="handleChatMessageError">
<el-input v-model="formModel.handleChatMessageError" />
</el-form-item>
<el-form-item label="是否启用僵尸击杀奖励" prop="isEnabled">
<el-form-item label="传送前是否检查玩家周围是否有僵尸" prop="teleZombieCheck">
<el-switch v-model="formModel.teleZombieCheck" />
</el-form-item>
<el-form-item label="禁止传送提示" prop="teleDisableTip">
<el-input v-model="formModel.teleDisableTip" />
</el-form-item>
<el-form-item label="是否启用僵尸击杀奖励">
<el-switch v-model="formModel.killZombieTrigger.isEnabled" />
</el-form-item>
<el-form-item class="label" :label="`执行指令\n(每行一条)`" prop="executeCommands">
<el-form-item class="label" :label="`执行指令\n(每行一条)`">
<el-input v-model="textareaValue1" type="textarea" :rows="5"></el-input>
</el-form-item>
<el-form-item label="是否启用死亡惩罚" prop="isEnabled">
<el-form-item label="是否启用死亡惩罚">
<el-switch v-model="formModel.deathTrigger.isEnabled" />
</el-form-item>
<el-form-item class="label" :label="`执行指令\n(每行一条)`" prop="executeCommands">
<el-form-item class="label" :label="`执行指令\n(每行一条)`">
<el-input v-model="textareaValue2" type="textarea" :rows="5"></el-input>
</el-form-item>
<el-form-item label="是否启用自动重启">
<el-switch v-model="formModel.autoRestart.isEnabled" />
</el-form-item>
<el-form-item label="自动重启时间">
<el-time-select v-model="autoRestartTime" style="width: 240px" start="00:00" step="00:30" end="23:59" placeholder="选择时间" />
</el-form-item>
<el-form-item class="label" :label="`自动重启提示\n(每行一条)`">
<el-input v-model="textareaValue3" type="textarea" :rows="5"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="save">保存</el-button>
</el-form-item>
Expand All @@ -50,38 +65,64 @@ export default {
<script setup>
import * as api from '~/api/settings.js';
const autoRestartTime = computed({
get() {
return formModel.autoRestart.restartHour.toString().padStart(2, '0') + ':' + formModel.autoRestart.restartMinute.toString().padStart(2, '0');
},
set(value) {
const split = value.split(':');
formModel.autoRestart.restartHour = parseInt(split[0]);
formModel.autoRestart.restartMinute = parseInt(split[1]);
},
});
const formModel = reactive({
serverName: '',
chatCommandPrefix: '',
chatCommandSeparator: '',
handleChatMessageError: '',
teleZombieCheck: false,
teleDisableTip: '',
killZombieTrigger: {
isEnabled: false,
executeCommands: [],
},
deathTrigger: {
isEnabled: false,
executeCommands: [],
}
},
autoRestart: {
isEnabled: false,
restartHour: 0,
restartMinute: 0,
messages: [],
},
});
const textareaValue1 = computed({
get() {
return formModel.killZombieTrigger.executeCommands.join('\n');
},
set(value) {
formModel.killZombieTrigger.executeCommands = value.split('\n').filter(item => item.trim() !== '');
}
get() {
return formModel.killZombieTrigger.executeCommands.join('\n');
},
set(value) {
formModel.killZombieTrigger.executeCommands = value.split('\n').filter((item) => item.trim() !== '');
},
});
const textareaValue2 = computed({
get() {
return formModel.deathTrigger.executeCommands.join('\n');
},
set(value) {
formModel.deathTrigger.executeCommands = value.split('\n').filter(item => item.trim() !== '');
}
get() {
return formModel.deathTrigger.executeCommands.join('\n');
},
set(value) {
formModel.deathTrigger.executeCommands = value.split('\n').filter((item) => item.trim() !== '');
},
});
const textareaValue3 = computed({
get() {
return formModel.autoRestart.messages.join('\n');
},
set(value) {
formModel.autoRestart.messages = value.split('\n').filter((item) => item.trim() !== '');
},
});
const formRef = ref();
const rules = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const submit = async () => {
if (isAdd.value) {
await api.addPointsInfo(formModel);
} else {
await api.updatePointsInfo(formModel.id, formModel);
await api.updatePointsInfo(formModel.playerId, formModel);
}
ElMessage.success('保存成功');
Expand Down
2 changes: 1 addition & 1 deletion src/views/PointsSystem/Management/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const handleUpdate = (row) => {
const handleDelete = async (row) => {
try {
await myconfirm('确定删除选中内容吗?');
await api.deletePointsInfoById(row.id);
await api.deletePointsInfoById(row.playerId);
getData();
} catch {}
};
Expand Down

0 comments on commit 13b99a2

Please sign in to comment.