开屏设置 - 增加多语言

This commit is contained in:
2025-09-29 15:57:00 +08:00
parent dd1c53e14b
commit 7ba01b87f5

View File

@@ -36,7 +36,31 @@
<!-- 表格 -->
<el-table :data="tableData" border style="width: 100%; margin-top: 25px">
<el-table-column align="center" prop="id" label="资源位ID" />
<el-table-column align="center" prop="name" label="活动名称" />
<el-table-column prop="name"
align="center"
label="活动名称-华语区">
<template v-slot="scope">{{ getJsonField(scope.row.name, 'zh') }}</template>
</el-table-column>
<el-table-column prop="name"
align="center"
label="活动名称-英语区">
<template v-slot="scope">{{ getJsonField(scope.row.name, 'en') }}</template>
</el-table-column>
<el-table-column prop="name"
align="center"
label="活动名称-阿语区">
<template v-slot="scope">{{ getJsonField(scope.row.name, 'ar') }}</template>
</el-table-column>
<el-table-column prop="name"
align="center"
label="活动名称-土耳其区">
<template v-slot="scope">{{ getJsonField(scope.row.name, 'tr') }}</template>
</el-table-column>
<el-table-column prop="name"
align="center"
label="活动名称-葡萄牙语区">
<template v-slot="scope">{{ getJsonField(scope.row.name, 'pt') }}</template>
</el-table-column>
<el-table-column align="center" prop="partitionId" label="地区">
<template v-slot="scope">
<span>{{ getPartitionInfo(scope.row.partitionId) }}</span>
@@ -147,20 +171,7 @@
/>
<!-- 编辑弹窗 -->
<el-dialog v-model="editDialog" title="开屏配置" width="50%" center>
<div style="margin-bottom: 25px">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
>活动名称</span
>
<el-input
v-model="resource.name"
style="width: 75%"
class="input"
placeholder="请输入活动名称"
></el-input>
</div>
<div style="margin-bottom: 25px; margin-top: 70px">
<div style="margin-bottom: 25px;">
<span
style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label"
@@ -179,6 +190,46 @@
></el-option>
</el-select>
</div>
<!-- 活动名称-华语 -->
<div style="margin-bottom: 25px; margin-top: 10px; display: flex">
<span style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label">活动名称-华语</span>
<el-input v-model="resource.nickZh"
placeholder=""
class="input"></el-input>
</div>
<!-- 活动名称-英语 -->
<div style="margin-bottom: 25px; margin-top: 10px; display: flex">
<span style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label">活动名称-英语</span>
<el-input v-model="resource.nickEn"
placeholder=""
class="input"></el-input>
</div>
<!-- 活动名称-阿语 -->
<div style="margin-bottom: 25px; margin-top: 10px; display: flex">
<span style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label">活动名称-阿语</span>
<el-input v-model="resource.nickAr"
placeholder=""
class="input"></el-input>
</div>
<!-- 活动名称-土耳其 -->
<div style="margin-bottom: 25px; margin-top: 10px; display: flex">
<span style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label">活动名称-土耳其</span>
<el-input v-model="resource.nickTr"
placeholder=""
class="input"></el-input>
</div>
<!-- 活动名称-葡萄牙语 -->
<div style="margin-bottom: 25px; margin-top: 10px; display: flex">
<span style="display: inline-block; margin-right: 20px"
class="col-sm-2 control-label">活动名称-葡萄牙语</span>
<el-input v-model="resource.nickPt"
placeholder=""
class="input"></el-input>
</div>
<div style="margin-bottom: 25px">
<span
style="display: inline-block; margin-right: 20px"
@@ -419,6 +470,11 @@ export default {
seqNo: 0,
ruleValue: {},
partitionId: null,
nickZh: "",
nickEn: "",
nickAr: "",
nickTr: "",
nickPt: "",
},
imageUrl: "",
partitionInfos: [],
@@ -521,6 +577,13 @@ export default {
this.resource.endTime = null;
this.resource.seqNo = 0;
this.resource.ruleValue = {};
this.resource.nickZh = "";
this.resource.nickEn = "";
this.resource.nickAr = "";
this.resource.nickTr = "";
this.resource.nickPt = "";
for (let i = 0, len = this.rules.length; i < len; i++) {
let rule = this.rules[i];
this.resource.ruleValue[rule.ruleCode] = "";
@@ -538,6 +601,13 @@ export default {
this.resource.startTime = row.startTime;
this.resource.endTime = row.endTime;
this.resource.seqNo = row.seqNo;
this.resource.nickZh = JSON.parse(row.name).zh;
this.resource.nickEn = JSON.parse(row.name).en;
this.resource.nickAr = JSON.parse(row.name).ar;
this.resource.nickTr = JSON.parse(row.name).tr;
this.resource.nickPt = JSON.parse(row.name).pt;
let ruleValue = row.ruleValue;
for (let i = 0, len = this.rules.length; i < len; i++) {
let ruleCode = this.rules[i].ruleCode;
@@ -577,9 +647,16 @@ export default {
if (now >= new Date(startTime) && now <= new Date(endTime)) {
isEnabled = 1;
}
let resourceName = JSON.stringify({
zh: this.resource.nickZh,
en: this.resource.nickEn,
ar: this.resource.nickAr,
tr: this.resource.nickTr,
pt: this.resource.nickPt,
});
saveResource({
id: this.resource.id,
name: this.resource.name,
name: resourceName,
icon: this.resource.icon,
type: 2,
skipType: this.resource.skipType,
@@ -623,6 +700,17 @@ export default {
}
return partitions[0].desc;
},
// 解析json字段
getJsonField (jsonStr, field) {
try {
if (!jsonStr) return '';
const obj = JSON.parse(jsonStr);
return obj?.[field] || '';
} catch (e) {
console.error('JSON 解析失败:', jsonStr);
return '';
}
},
},
};
</script>