feat(banner管理页面): 搜索栏新增单选“国家”选项

This commit is contained in:
hzj 2026-01-28 16:54:40 +08:00
parent 64fc0a927f
commit 8594170ba4

View File

@ -1,6 +1,8 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索栏 -->
<div class="filter-container"> <div class="filter-container">
<!-- 系统 -->
<el-select <el-select
v-model="listQuery.sysOrigin" v-model="listQuery.sysOrigin"
placeholder="系统" placeholder="系统"
@ -21,6 +23,7 @@
</el-option> </el-option>
</el-select> </el-select>
<!-- 平台 -->
<el-select <el-select
v-model="listQuery.platform" v-model="listQuery.platform"
style="width: 120px" style="width: 120px"
@ -35,6 +38,7 @@
/> />
</el-select> </el-select>
<!-- 状态 -->
<el-select <el-select
v-model="listQuery.showcase" v-model="listQuery.showcase"
placeholder="状态" placeholder="状态"
@ -46,6 +50,8 @@
<el-option label="下架" :value="2" /> <el-option label="下架" :value="2" />
<el-option label="过期" :value="3" /> <el-option label="过期" :value="3" />
</el-select> </el-select>
<!-- 区域 -->
<el-select <el-select
v-model="listQuery.region" v-model="listQuery.region"
v-loading="loading" v-loading="loading"
@ -62,6 +68,33 @@
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
<!-- 国家 -->
<el-select
v-model="listQuery.countryCode"
v-loading="loadingCountry"
placeholder="国家"
style="width: 200px"
class="filter-item"
collapse-tags
@change="changeCountry"
>
<el-option
v-for="item in countryList"
:key="item.id"
:label="item.country.aliasName || item.country.enName"
:value="item.country.alphaTwo"
>
<span style="float: left;">
<img :src="item.country.nationalFlag" width="30"
/></span>
<span style="float: left;margin-left:10px">{{
item.country.aliasName || item.country.enName
}}</span>
</el-option>
</el-select>
<!-- 搜索按钮 -->
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
@ -70,6 +103,8 @@
> >
搜索 搜索
</el-button> </el-button>
<!-- 新增按钮 -->
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
@ -79,6 +114,8 @@
新增 新增
</el-button> </el-button>
</div> </div>
<!-- 表单 -->
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="list" :data="list"
@ -87,6 +124,7 @@
highlight-current-row highlight-current-row
@cell-mouse-enter="handleMouseEnter" @cell-mouse-enter="handleMouseEnter"
> >
<!-- 封面 -->
<el-table-column label="封面" align="center" width="400"> <el-table-column label="封面" align="center" width="400">
<template slot-scope="scope"> <template slot-scope="scope">
<el-image <el-image
@ -97,6 +135,8 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<!-- 小图 -->
<el-table-column label="小图" align="center" width="150"> <el-table-column label="小图" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-image <el-image
@ -111,6 +151,8 @@
</el-image> </el-image>
</template> </template>
</el-table-column> </el-table-column>
<!-- alert图 -->
<el-table-column label="alert图" align="center" width="150"> <el-table-column label="alert图" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-image <el-image
@ -125,12 +167,18 @@
</el-image> </el-image>
</template> </template>
</el-table-column> </el-table-column>
<!-- 类型 -->
<el-table-column prop="type" label="类型" align="center" /> <el-table-column prop="type" label="类型" align="center" />
<!-- 展示位 -->
<el-table-column <el-table-column
prop="displayPositionNames" prop="displayPositionNames"
label="展示位" label="展示位"
align="center" align="center"
/> />
<!-- 系统 -->
<el-table-column label="归属系统" align="center"> <el-table-column label="归属系统" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<sys-origin-icon <sys-origin-icon
@ -139,8 +187,14 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<!-- 区域 -->
<el-table-column prop="regionNameStr" label="区域" align="center" /> <el-table-column prop="regionNameStr" label="区域" align="center" />
<!-- 排序 -->
<el-table-column prop="sort" label="排序" align="center" /> <el-table-column prop="sort" label="排序" align="center" />
<!-- 内容 -->
<el-table-column prop="content" label="内容" align="center"> <el-table-column prop="content" label="内容" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover placement="top-start" trigger="hover"> <el-popover placement="top-start" trigger="hover">
@ -155,6 +209,8 @@
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<!-- 状态 -->
<el-table-column label="状态" align="center"> <el-table-column label="状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
@ -180,6 +236,8 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<!-- 操作按钮列表 -->
<el-table-column fixed="right" label="操作" align="center" width="200"> <el-table-column fixed="right" label="操作" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click.native="handleUpdate()">修改</el-button> <el-button type="text" @click.native="handleUpdate()">修改</el-button>
@ -190,6 +248,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页组件 -->
<pagination <pagination
v-show="total > 0" v-show="total > 0"
:total="total" :total="total"
@ -198,6 +257,7 @@
@pagination="renderData" @pagination="renderData"
/> />
<!-- 编辑组件 -->
<form-edit <form-edit
v-if="formEditVisible" v-if="formEditVisible"
:row="thatRow" :row="thatRow"
@ -209,12 +269,15 @@
</template> </template>
<script> <script>
import { bannerTable, deleteBanner } from "@/api/banner";
import Pagination from "@/components/Pagination";
import { appPlatforms, sysOriginPlatforms } from "@/constant/origin";
import FormEdit from "./form-edit.vue";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { appPlatforms, sysOriginPlatforms } from "@/constant/origin";
import { bannerTable, deleteBanner } from "@/api/banner";
import { regionConfigTable } from "@/api/sys"; import { regionConfigTable } from "@/api/sys";
import { listPayOpenCountry } from "@/api/sys-pay";
import Pagination from "@/components/Pagination";
import FormEdit from "./form-edit.vue";
export default { export default {
components: { Pagination, FormEdit }, components: { Pagination, FormEdit },
@ -239,11 +302,16 @@ export default {
showcase: 1, showcase: 1,
sysOrigin: "HALAR", sysOrigin: "HALAR",
platform: "Android", platform: "Android",
region: "" region: "",
countryCode: ""
}, },
formEditVisible: false, formEditVisible: false,
textOptTitle: "", textOptTitle: "",
listLoading: true listLoading: true,
selectedCountry: {},
countryList: [],
loadingCountry: false
}; };
}, },
computed: { computed: {
@ -258,6 +326,8 @@ export default {
that.listQuery.sysOrigin = querySystem.value; that.listQuery.sysOrigin = querySystem.value;
this.listRegion(); this.listRegion();
that.renderData(); that.renderData();
this.loadOpenCountry();
}, },
methods: { methods: {
renderData(isClean) { renderData(isClean) {
@ -304,6 +374,38 @@ export default {
this.userDeatilsDrawer = true; this.userDeatilsDrawer = true;
this.thatSelectedUserId = row.id; this.thatSelectedUserId = row.id;
}, },
//
changeCountry(val) {
const that = this;
console.log("val", val);
that.selectedCountry = this.countryList.filter(
item => item.country.alphaTwo === val
)[0];
that.listQuery.countryCode = this.selectedCountry.country.alphaTwo;
this.renderData();
},
//
loadOpenCountry() {
const that = this;
that.loadingCountry = true;
listPayOpenCountry()
.then(res => {
that.loadingCountry = false;
that.countryList = res.body || [];
that.selectedCountry = that.countryList[0] || {};
that.listQuery.countryCode = that.selectedCountry.country.alphaTwo;
that.renderData();
})
.catch(er => {
that.loadingCountry = false;
console.error(er);
});
},
// //
handlDel(row) { handlDel(row) {
this.$confirm("确认删除吗?", "提示", { this.$confirm("确认删除吗?", "提示", {