房间内角标入口 - 入口名称新增多语言

This commit is contained in:
2025-07-04 14:16:23 +08:00
parent 07b291fe57
commit 952270a147

View File

@@ -24,7 +24,19 @@
<!-- 表格 -->
<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 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 align="center" prop="partitionId" label="地区">
<template v-slot="scope">
<span>{{ getPartitionInfo(scope.row.partitionId) }}</span>
@@ -80,10 +92,26 @@
<!-- 编辑弹窗 -->
<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="请输入入口名称"
<span style="display: inline-block; margin-right: 20px" class="col-sm-2 control-label">入口名称-华语</span>
<el-input v-model="resource.seriesNameZh" style="width: 75%" class="input" placeholder="请输入入口名称"
:disabled="resource.skipType == 1"></el-input>
</div>
<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.seriesNameEn" style="width: 75%" class="input" placeholder="请输入入口名称"
:disabled="resource.skipType == 1"></el-input>
</div>
<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.seriesNameAr" style="width: 75%" class="input" placeholder="请输入入口名称"
:disabled="resource.skipType == 1"></el-input>
</div>
<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.seriesNameTr" style="width: 75%" class="input" placeholder="请输入入口名称"
:disabled="resource.skipType == 1"></el-input>
</div>
<div style="margin-bottom: 25px;margin-top: 70px;">
<span style="display: inline-block; margin-right: 20px" class="col-sm-2 control-label">选择地区</span>
<el-select v-model="resource.partitionId" style="width: 75%" placeholder="请选择">
@@ -237,6 +265,10 @@ export default {
seqNo: 0,
ruleValue: {},
partitionId: null,
seriesNameZh:'',
seriesNameEn:'',
seriesNameAr:'',
seriesNameTr:'',
},
imageUrl: '',
partitionInfos: [],
@@ -358,6 +390,10 @@ export default {
this.resource.endTime = null;
this.resource.seqNo = 0;
this.resource.ruleValue = {};
this.resource.seriesNameZh = '';
this.resource.seriesNameEn = '';
this.resource.seriesNameAr = '';
this.resource.seriesNameTr = '';
for (let i = 0, len = this.rules.length; i < len; i++) {
let rule = this.rules[i];
this.resource.ruleValue[rule.ruleCode] = '';
@@ -377,6 +413,12 @@ export default {
this.resource.startTime = row.startTime;
this.resource.endTime = row.endTime;
this.resource.seqNo = row.seqNo;
if (row.name) {
this.resource.seriesNameZh = JSON.parse(row.name).zh;
this.resource.seriesNameEn = JSON.parse(row.name).en;
this.resource.seriesNameAr = JSON.parse(row.name).ar;
this.resource.seriesNameTr = JSON.parse(row.name).tr;
}
let ruleValue = row.ruleValue;
for (let i = 0, len = this.rules.length; i < len; i++) {
let ruleCode = this.rules[i].ruleCode;
@@ -409,6 +451,12 @@ export default {
});
return;
}
this.resource.name = JSON.stringify({
zh: this.resource.seriesNameZh,
en: this.resource.seriesNameEn,
ar: this.resource.seriesNameAr,
tr: this.resource.seriesNameTr,
});
saveResource({
id: this.resource.id,
code: this.resource.code,
@@ -456,6 +504,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>