[游戏管理]36字花字典-来自游戏配置扩展
This commit is contained in:
16
web/src/lang/backend/en/game/ziHuaDictionary.ts
Normal file
16
web/src/lang/backend/en/game/ziHuaDictionary.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export default {
|
||||
title: '36 Zi Hua dictionary',
|
||||
desc: 'Maintain the display names and grouping of the 36 entries. Changes affect player selection display, related filters/statistics, and admin mapping references. Please review before saving.',
|
||||
no: 'No.',
|
||||
name: 'Name',
|
||||
category: 'Category',
|
||||
btn_save: 'Save',
|
||||
category_label: {
|
||||
zodiac: 'Zodiac',
|
||||
beast: 'Beast',
|
||||
fowl: 'Fowl',
|
||||
vermin: 'Vermin',
|
||||
divine: 'Divine',
|
||||
},
|
||||
}
|
||||
|
||||
16
web/src/lang/backend/zh-cn/game/ziHuaDictionary.ts
Normal file
16
web/src/lang/backend/zh-cn/game/ziHuaDictionary.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export default {
|
||||
title: '36字花字典',
|
||||
desc: '用于维护 36 字花的展示名称与归类。修改后会影响前台选号展示、相关筛选统计及后台对照信息,请确认无误后再保存。',
|
||||
no: '编号',
|
||||
name: '名称',
|
||||
category: '类型',
|
||||
btn_save: '保存',
|
||||
category_label: {
|
||||
zodiac: '生肖',
|
||||
beast: '猛兽',
|
||||
fowl: '飞禽',
|
||||
vermin: '虫蛇',
|
||||
divine: '神兽',
|
||||
},
|
||||
}
|
||||
|
||||
102
web/src/views/backend/game/ziHuaDictionary/index.vue
Normal file
102
web/src/views/backend/game/ziHuaDictionary/index.vue
Normal file
@@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<div class="default-main ba-table-box zi-hua-dict-page">
|
||||
<el-alert type="info" :closable="false" show-icon>
|
||||
{{ t('game.ziHuaDictionary.desc') }}
|
||||
</el-alert>
|
||||
|
||||
<div class="toolbar">
|
||||
<el-button type="primary" :loading="saving" :disabled="loading" @click="onSave">
|
||||
{{ t('game.ziHuaDictionary.btn_save') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="loading" border stripe :data="items" row-key="no" max-height="640">
|
||||
<el-table-column prop="no" :label="t('game.ziHuaDictionary.no')" width="72" align="center" />
|
||||
<el-table-column :label="t('game.ziHuaDictionary.name')" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.name" maxlength="32" show-word-limit />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('game.ziHuaDictionary.category')" min-width="160">
|
||||
<template #default="{ row }">
|
||||
<el-select v-model="row.category" style="width: 100%">
|
||||
<el-option v-for="c in categories" :key="c" :label="categoryLabel(c)" :value="c" />
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import createAxios from '/@/utils/axios'
|
||||
import { auth } from '/@/utils/common'
|
||||
|
||||
defineOptions({
|
||||
name: 'game/ziHuaDictionary',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
type Item = { no: number; name: string; category: string }
|
||||
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
const items = ref<Item[]>([])
|
||||
const categories = ref<string[]>(['zodiac', 'beast', 'fowl', 'vermin', 'divine'])
|
||||
|
||||
function categoryLabel(cat: string): string {
|
||||
return t('game.ziHuaDictionary.category_label.' + cat)
|
||||
}
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await createAxios({
|
||||
url: '/admin/game.ZiHuaDictionary/index',
|
||||
method: 'get',
|
||||
})
|
||||
if (res.code === 1 && res.data) {
|
||||
const list = res.data.items as Item[]
|
||||
items.value = Array.isArray(list) ? list : []
|
||||
if (Array.isArray(res.data.categories) && res.data.categories.length) {
|
||||
categories.value = res.data.categories as string[]
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onSave() {
|
||||
if (!auth('save')) {
|
||||
return
|
||||
}
|
||||
saving.value = true
|
||||
try {
|
||||
await createAxios({
|
||||
url: '/admin/game.ZiHuaDictionary/save',
|
||||
method: 'post',
|
||||
data: { items: items.value },
|
||||
showSuccessMessage: true,
|
||||
})
|
||||
await load()
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void load()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.zi-hua-dict-page {
|
||||
.toolbar {
|
||||
margin: 12px 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user