优化代码
This commit is contained in:
@@ -29,7 +29,8 @@
|
||||
background: item.gender == 1 ? '#59D8DB' : '#F3876F',
|
||||
}"
|
||||
>
|
||||
{{ item.gender == 1 ? "男" : "女" }}
|
||||
{{ item.gender == 1 ?t('man') : t('woman') }}
|
||||
<!-- gj男女 -->
|
||||
</div>
|
||||
<div class="Country">{{ item.country }}</div>
|
||||
</div>
|
||||
@@ -48,7 +49,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="chatNotDeta" v-if="list.length === 0">
|
||||
<div class="chatNotDeta-text">您还没有主播,快去添加吧!</div>
|
||||
<div class="chatNotDeta-text">{{ t('YouDonHaveALiveStreamerYetHurryUpAndAddOne') }}</div>
|
||||
<!-- gj您还没有主播,快去添加吧! -->
|
||||
</div>
|
||||
</div>
|
||||
</el-splitter-panel>
|
||||
@@ -58,8 +60,10 @@
|
||||
<div class="add-anchor-library">
|
||||
<div class="title">
|
||||
<img class="titleimg" src="@/assets/embellish.png" alt="" />
|
||||
<div v-if="!anchormodifystate">添加我的主播</div>
|
||||
<div v-if="anchormodifystate">修改我的主播</div>
|
||||
<div v-if="!anchormodifystate">{{ t('AddMyStreamer') }}</div>
|
||||
<!-- gj添加主播 -->
|
||||
<div v-if="anchormodifystate">{{ t('ModifyMyStreamer') }}</div>
|
||||
<!-- gj修改主播 -->
|
||||
<img class="titleimg" src="@/assets/embellish.png" alt="" />
|
||||
</div>
|
||||
<div class="add-anchor-library-content">
|
||||
@@ -69,7 +73,7 @@
|
||||
@blur="blur()"
|
||||
v-model="anchorName"
|
||||
size="large"
|
||||
placeholder="请输入主播名称"
|
||||
:placeholder="t('PleaseEnterTheNameOfTheHost')"
|
||||
/>
|
||||
</div>
|
||||
<div class="country">
|
||||
@@ -78,12 +82,13 @@
|
||||
v-model="countryvalue"
|
||||
filterable
|
||||
:options="country"
|
||||
placeholder="请选择国家"
|
||||
:placeholder="t('PleaseSelectACountry')"
|
||||
size="large"
|
||||
style="vertical-align: middle"
|
||||
class="select"
|
||||
/>
|
||||
</div>
|
||||
<!-- gj选择国家 -->
|
||||
<div class="gender">
|
||||
<!-- 性别 -->
|
||||
<el-select-v2
|
||||
@@ -91,14 +96,15 @@
|
||||
filterable
|
||||
:options="genderOptions"
|
||||
size="large"
|
||||
placeholder="请选择性别"
|
||||
:placeholder="t('PleaseSelectACountry')"
|
||||
style="vertical-align: middle"
|
||||
class="select"
|
||||
/>
|
||||
<!-- gj男女 -->
|
||||
</div>
|
||||
<div class="Confirm" @click="Confirm()">确认</div>
|
||||
<div class="Reset" @click="Reset()">重置</div>
|
||||
<div class="Reset" v-if="anchormodifystate" @click="cancel()">取消</div>
|
||||
<div class="Confirm" @click="Confirm()">{{ t('Confirm') }}</div>
|
||||
<div class="Reset" @click="Reset()">{{ t('Reset') }}</div>
|
||||
<div class="Reset" v-if="anchormodifystate" @click="cancel()">{{ t('Cancel') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -110,15 +116,19 @@
|
||||
center
|
||||
class="center-dialog"
|
||||
v-model="centerDialogVisible"
|
||||
title="提示"
|
||||
:title="t('Hint')"
|
||||
width="200"
|
||||
align-center
|
||||
>
|
||||
<span>确认删除该主播?</span>
|
||||
<!-- gj提示 -->
|
||||
<span>{{ t('ConfirmTheDeletionOfThisStreamer') }}</span>
|
||||
<!-- gj确认删除此主播 -->
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="centerDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="deleteAnchor()"> 确认 </el-button>
|
||||
<el-button @click="centerDialogVisible = false">{{ t('Cancel') }}</el-button>
|
||||
<!-- gj取消 -->
|
||||
<el-button type="primary" @click="deleteAnchor()"> {{ t('Confirm') }}</el-button>
|
||||
<!-- gj确认 -->
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -143,11 +153,16 @@ import { getCountryNamesArray } from "../../utils/countryUtil";
|
||||
import { ElLoading } from "element-plus";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { setStorage, getStorage, getPromiseStorage } from "@/utils/storage.js";
|
||||
//
|
||||
import { useI18n } from 'vue-i18n'
|
||||
const { t } = useI18n()
|
||||
window['$t'] = t
|
||||
//
|
||||
const country = ref([]);
|
||||
country.value = getCountryNamesArray(); //国家条目
|
||||
const genderOptions = [
|
||||
{ value: 1, label: "男" },
|
||||
{ value: 2, label: "女" },
|
||||
{ value: 1, label: t('man') },
|
||||
{ value: 2, label: t('woman') },
|
||||
]; // 性别选项
|
||||
const gendervalue = ref(null); // 性别值
|
||||
const countryvalue = ref(null); //国家
|
||||
@@ -158,7 +173,6 @@ const AnchorProfilePicture = ref(null); // 主播头像
|
||||
const centerDialogVisible = ref(false); // 确认删除弹窗
|
||||
const anchormodifystate = ref(false); // 编辑
|
||||
const anchormodifystateId = ref(null); // 主播头像
|
||||
|
||||
// 获取主播列表
|
||||
function AnchorList() {
|
||||
getAnchorList({ id: user.value.id })
|
||||
@@ -197,7 +211,8 @@ const deleteAnchor = () => {
|
||||
delAnchor({ id: deleteAnchorID.value })
|
||||
.then((res) => {
|
||||
centerDialogVisible.value = false;
|
||||
ElMessage.success("删除成功");
|
||||
ElMessage.success(t('DeletedSuccessfully'));
|
||||
// gj删除成功
|
||||
AnchorList();
|
||||
})
|
||||
.catch((err) => {});
|
||||
@@ -211,15 +226,18 @@ function load() {}
|
||||
// 确认添加或修改主播
|
||||
function Confirm() {
|
||||
if (anchorName.value == null || anchorName.value == "") {
|
||||
ElMessage.error("请输入主播名称");
|
||||
ElMessage.error(t('PleaseEnterTheNameOfTheHost'));
|
||||
// gj请输入主播名称
|
||||
return;
|
||||
}
|
||||
if (gendervalue.value == null) {
|
||||
ElMessage.error("请选择性别");
|
||||
ElMessage.error(t('PleaseSelectGender'));
|
||||
// gj请选择性别
|
||||
return;
|
||||
}
|
||||
if (countryvalue.value == null) {
|
||||
ElMessage.error("请选择国家");
|
||||
ElMessage.error(t('PleaseSelectACountry'));
|
||||
//gj请选择国家
|
||||
return;
|
||||
}
|
||||
//修改主播还是添加
|
||||
@@ -234,7 +252,8 @@ function Confirm() {
|
||||
createUserId: user.value.id,
|
||||
})
|
||||
.then((res) => {
|
||||
ElMessage.success("修改成功");
|
||||
ElMessage.success(t('ModificationSuccessful'));
|
||||
// gj修改成功
|
||||
cancel();
|
||||
AnchorList();
|
||||
})
|
||||
@@ -251,7 +270,7 @@ function Confirm() {
|
||||
createUserId: user.value.id,
|
||||
})
|
||||
.then((res) => {
|
||||
ElMessage.success("添加成功");
|
||||
ElMessage.success(t('AddedSuccessfully'));
|
||||
AnchorList();
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -268,12 +287,14 @@ function Reset() {
|
||||
//输入框失去焦点
|
||||
function blur() {
|
||||
if (anchorName.value == null || anchorName.value == "") {
|
||||
ElMessage.error("请输入主播名称");
|
||||
ElMessage.error(t('PleaseEnterTheNameOfTheHost'));
|
||||
// gj请输入主播名称
|
||||
return;
|
||||
}
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: "查询主播中....",
|
||||
text: t('CheckTheStreamerAt'),
|
||||
// gj正在检查主播
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
});
|
||||
getAnchorAvatar({ name: anchorName.value })
|
||||
|
||||
Reference in New Issue
Block a user