feat(app启动页): 删去无用的活动类型,调整代码结构

This commit is contained in:
hzj 2025-12-18 18:38:48 +08:00
parent a874362f33
commit 1d3c6b3c93
3 changed files with 167 additions and 126 deletions

View File

@ -1,12 +1,7 @@
/** /**
* App启动页活动类型 * App启动页活动类型
*/ */
const appStartPagePlanTypes = [ const appStartPagePlanTypes = [{ value: "KING_GAMES", name: "游戏王" }];
{ value: "WEEK_STAR", name: "周星" },
{ value: "WEEK_CP", name: "每周CP" },
{ value: "WEEK_KING", name: "每周国王/King" },
{ value: "NON_FIXED_ACTIVITY", name: "非固定活动" }
];
/** /**
* 抽奖游戏类型 * 抽奖游戏类型

View File

@ -9,14 +9,20 @@
> >
<div v-loading="submitLoading"> <div v-loading="submitLoading">
<div class="form-contetn"> <div class="form-contetn">
<el-form ref="form" :model="form" :rules="rules" label-width="110px" style="margin-right: 50px;"> <el-form
ref="form"
:model="form"
:rules="rules"
label-width="110px"
style="margin-right: 50px;"
>
<!-- 封面 -->
<el-form-item label="封面" prop="cover"> <el-form-item label="封面" prop="cover">
<el-form-item prop="cover" class="upload"> <el-form-item prop="cover" class="upload">
<el-upload <el-upload
:disabled="coverUploadLoading" :disabled="coverUploadLoading"
:file-list="coverFileList" :file-list="coverFileList"
:class="{'upload-but-hide': !isShowCoverUpload}" :class="{ 'upload-but-hide': !isShowCoverUpload }"
action="" action=""
list-type="picture-card" list-type="picture-card"
:http-request="uploadCover" :http-request="uploadCover"
@ -24,10 +30,16 @@
:on-remove="handleCoverFileRemove" :on-remove="handleCoverFileRemove"
accept="image/*" accept="image/*"
> >
<i slot="default" v-loading="coverUploadLoading" class="el-icon-plus" /> <i
slot="default"
v-loading="coverUploadLoading"
class="el-icon-plus"
/>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-form-item> </el-form-item>
<!-- 系统 -->
<el-form-item label="系统" prop="sysOrigin"> <el-form-item label="系统" prop="sysOrigin">
<el-select <el-select
v-model="form.sysOrigin" v-model="form.sysOrigin"
@ -41,11 +53,17 @@
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
> >
<span style="float: left;"> <sys-origin-icon :icon="item.value" :desc="item.value" /></span> <span style="float: left;">
<span style="float: left;margin-left:10px">{{ item.label }}</span> <sys-origin-icon :icon="item.value" :desc="item.value"
/></span>
<span style="float: left;margin-left:10px">{{
item.label
}}</span>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 类型 -->
<el-form-item label="类型" prop="type"> <el-form-item label="类型" prop="type">
<el-select <el-select
v-model="form.type" v-model="form.type"
@ -64,6 +82,8 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 过期时间 -->
<el-form-item label="过期时间" prop="expireTime"> <el-form-item label="过期时间" prop="expireTime">
<el-date-picker <el-date-picker
v-model="form.expireTime" v-model="form.expireTime"
@ -83,11 +103,10 @@
</div> </div>
</template> </template>
<script> <script>
import { updateData, addData } from "@/api/start-page";
import { updateData, addData } from '@/api/start-page' import { sysOriginPlatforms } from "@/constant/origin";
import { sysOriginPlatforms } from '@/constant/origin' import { getElementUiUploadFile } from "@/utils";
import { getElementUiUploadFile } from '@/utils' import { appStartPagePlanTypes } from "@/constant/type";
import { appStartPagePlanTypes } from '@/constant/type'
export default { export default {
props: { props: {
row: { row: {
@ -96,18 +115,20 @@ export default {
} }
}, },
data() { data() {
const commonRules = [{ required: true, message: '必填字段', trigger: 'blur' }] const commonRules = [
{ required: true, message: "必填字段", trigger: "blur" }
];
return { return {
appStartPagePlanTypes, appStartPagePlanTypes,
coverUploadLoading: false, coverUploadLoading: false,
coverFileList: [], coverFileList: [],
sysOriginPlatforms, sysOriginPlatforms,
form: { form: {
id: '', id: "",
cover: '', cover: "",
type: '', type: "",
sysOrigin: '', sysOrigin: "",
expireTime: '' expireTime: ""
}, },
submitLoading: false, submitLoading: false,
uploadLoading: false, uploadLoading: false,
@ -117,87 +138,94 @@ export default {
sysOrigin: commonRules, sysOrigin: commonRules,
expireTime: commonRules expireTime: commonRules
} }
} };
}, },
computed: { computed: {
textOptTitle() { textOptTitle() {
return this.row && this.row.id ? '修改' : '新增' return this.row && this.row.id ? "修改" : "新增";
}, },
isShowCoverUpload() { isShowCoverUpload() {
return !this.form.cover return !this.form.cover;
} }
}, },
watch: { watch: {
row: { row: {
handler(val) { handler(val) {
if (!val) { if (!val) {
return return;
} }
const form = Object.assign({}, val) const form = Object.assign({}, val);
this.coverFileList = getElementUiUploadFile(form.cover) this.coverFileList = getElementUiUploadFile(form.cover);
this.form = Object.assign(this.form, form) this.form = Object.assign(this.form, form);
}, },
immediate: true immediate: true
} }
}, },
methods: { methods: {
uploadCover(file) { uploadCover(file) {
const that = this const that = this;
that.coverUploadLoading = true that.coverUploadLoading = true;
that.$simpleUploadFlie(file, that.$application.fileBucket.startPage).then(res => { that
that.coverUploadLoading = false .$simpleUploadFlie(file, that.$application.fileBucket.startPage)
that.form.cover = that.$getAccessImgUrl(res.name) .then(res => {
}).catch(er => { that.coverUploadLoading = false;
that.coverUploadLoading = false that.form.cover = that.$getAccessImgUrl(res.name);
}) })
.catch(er => {
that.coverUploadLoading = false;
});
}, },
handleCoverFileRemove(file, fileList) { handleCoverFileRemove(file, fileList) {
this.form.cover = '' this.form.cover = "";
this.coverUploadLoading = false this.coverUploadLoading = false;
}, },
handleClose() { handleClose() {
this.$emit('close') this.$emit("close");
}, },
submitForm() { submitForm() {
const that = this const that = this;
that.$refs.form.validate(valid => { that.$refs.form.validate(valid => {
if (!valid) { if (!valid) {
console.error('error submit!!') console.error("error submit!!");
return return;
} }
const submitForm = Object.assign({}, that.form) const submitForm = Object.assign({}, that.form);
that.submitLoading = true that.submitLoading = true;
if (submitForm.id) { if (submitForm.id) {
updateData(submitForm).then(res => { updateData(submitForm)
that.submitLoading = false .then(res => {
that.$emit('success', res) that.submitLoading = false;
}).catch(er => { that.$emit("success", res);
that.submitLoading = false })
that.$emit('fial', er) .catch(er => {
}) that.submitLoading = false;
return that.$emit("fial", er);
});
return;
} }
addData(submitForm).then(res => { addData(submitForm)
that.submitLoading = false .then(res => {
that.$emit('success', res) that.submitLoading = false;
}).catch(er => { that.$emit("success", res);
that.submitLoading = false })
console.error(er) .catch(er => {
that.$emit('fial', er) that.submitLoading = false;
}) console.error(er);
}) that.$emit("fial", er);
});
});
} }
} }
} };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.form-contetn { .form-contetn {
max-height: 550px; max-height: 550px;
overflow: auto; overflow: auto;
} }
.form-autocomplete { .form-autocomplete {
li { li {
line-height: normal; line-height: normal;
padding: 7px; padding: 7px;

View File

@ -1,7 +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="系统"
@ -15,11 +16,14 @@
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
> >
<span style="float: left;"> <sys-origin-icon :icon="item.value" :desc="item.value" /></span> <span style="float: left;">
<sys-origin-icon :icon="item.value" :desc="item.value"
/></span>
<span style="float: left;margin-left:10px">{{ item.label }}</span> <span style="float: left;margin-left:10px">{{ item.label }}</span>
</el-option> </el-option>
</el-select> </el-select>
<!-- 状态选择框 -->
<el-select <el-select
v-model="listQuery.showcase" v-model="listQuery.showcase"
placeholder="状态" placeholder="状态"
@ -31,6 +35,7 @@
<el-option label="过期" :value="0" /> <el-option label="过期" :value="0" />
</el-select> </el-select>
<!-- 活动类型选择框 -->
<el-select <el-select
v-model="listQuery.type" v-model="listQuery.type"
placeholder="活动类型" placeholder="活动类型"
@ -47,6 +52,9 @@
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
</el-option> </el-option>
</el-select> </el-select>
<!-- 操作按钮 -->
<!-- 搜索 按钮 -->
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
@ -55,6 +63,7 @@
> >
搜索 搜索
</el-button> </el-button>
<!-- 新增 按钮 -->
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
@ -64,6 +73,8 @@
新增 新增
</el-button> </el-button>
</div> </div>
<!-- 表单 -->
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="list" :data="list"
@ -75,7 +86,10 @@
<el-table-column prop="id" label="ID" align="center" /> <el-table-column prop="id" label="ID" 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 :icon="scope.row.sysOrigin" :desc="scope.row.sysOrigin" /> <sys-origin-icon
:icon="scope.row.sysOrigin"
:desc="scope.row.sysOrigin"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="活动类型" align="center"> <el-table-column label="活动类型" align="center">
@ -108,11 +122,14 @@
<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>
<el-button type="text" @click.native="handlDel(scope.row)">删除</el-button> <el-button type="text" @click.native="handlDel(scope.row)"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页模块 -->
<pagination <pagination
v-show="total > 0" v-show="total > 0"
:total="total" :total="total"
@ -121,6 +138,7 @@
@pagination="renderData" @pagination="renderData"
/> />
<!-- 新增修改弹窗 -->
<form-edit <form-edit
v-if="formEditVisible" v-if="formEditVisible"
:row="thatRow" :row="thatRow"
@ -131,15 +149,15 @@
</template> </template>
<script> <script>
import { pageData, deleteData } from '@/api/start-page' import { pageData, deleteData } from "@/api/start-page";
import Pagination from '@/components/Pagination' import Pagination from "@/components/Pagination";
import { sysOriginPlatforms } from '@/constant/origin' import { sysOriginPlatforms } from "@/constant/origin";
import { appStartPagePlanTypes } from '@/constant/type' import { appStartPagePlanTypes } from "@/constant/type";
import FormEdit from './form-edit.vue' import FormEdit from "./form-edit.vue";
import { mapGetters } from 'vuex' import { mapGetters } from "vuex";
export default { export default {
name: 'StartPage', name: "StartPage",
components: { Pagination, FormEdit }, components: { Pagination, FormEdit },
data() { data() {
return { return {
@ -147,7 +165,7 @@ export default {
sysOriginPlatforms, sysOriginPlatforms,
appStartPagePlanTypes, appStartPagePlanTypes,
txtVal: 0, txtVal: 0,
activeGiftId: '', activeGiftId: "",
pushTextHistoryLoading: false, pushTextHistoryLoading: false,
pushTextHistoryVisible: false, pushTextHistoryVisible: false,
pushTextHistory: [], pushTextHistory: [],
@ -158,89 +176,89 @@ export default {
cursor: 1, cursor: 1,
limit: 20, limit: 20,
showcase: 1, showcase: 1,
sysOrigin: 'TIM_CHAT', sysOrigin: "TIM_CHAT",
type: '' type: "KING_GAMES"
}, },
formEditVisible: false, formEditVisible: false,
textOptTitle: '', textOptTitle: "",
listLoading: true listLoading: true
} };
}, },
computed: { computed: {
...mapGetters(['permissionsSysOriginPlatforms']) ...mapGetters(["permissionsSysOriginPlatforms"])
}, },
created() { created() {
const that = this const that = this;
const querySystem = this.permissionsSysOriginPlatforms[0] const querySystem = this.permissionsSysOriginPlatforms[0];
if (!querySystem) { if (!querySystem) {
return return;
} }
that.listQuery.sysOrigin = querySystem.value that.listQuery.sysOrigin = querySystem.value;
that.renderData() that.renderData();
}, },
methods: { methods: {
renderData(isClean) { renderData(isClean) {
const that = this const that = this;
if (isClean === true) { if (isClean === true) {
this.listQuery.cursor = 1 this.listQuery.cursor = 1;
this.listQuery.list = [] this.listQuery.list = [];
} }
that.listLoading = true that.listLoading = true;
pageData(that.listQuery).then(res => { pageData(that.listQuery).then(res => {
const { body } = res const { body } = res;
that.total = body.total || 0 that.total = body.total || 0;
that.list = body.records that.list = body.records;
that.listLoading = false that.listLoading = false;
}) });
}, },
handleSearch() { handleSearch() {
this.renderData(true) this.renderData(true);
}, },
renderDataSuccess() { renderDataSuccess() {
this.$message({ this.$message({
message: 'Successful', message: "Successful",
type: 'success' type: "success"
}) });
this.renderData() this.renderData();
}, },
queryUserDetails(row) { queryUserDetails(row) {
this.userDeatilsDrawer = true this.userDeatilsDrawer = true;
this.thatSelectedUserId = row.id this.thatSelectedUserId = row.id;
}, },
// //
handlDel(row) { handlDel(row) {
this.$confirm('确认删除吗?【不可恢复】', '提示', { this.$confirm("确认删除吗?【不可恢复】", "提示", {
type: 'warning' type: "warning"
}).then(() => {
this.listLoading = true
deleteData(row.id).then((res) => {
this.listLoading = false
this.$message({
message: '删除成功',
type: 'success'
})
this.renderData()
})
}).catch(() => {
}) })
.then(() => {
this.listLoading = true;
deleteData(row.id).then(res => {
this.listLoading = false;
this.$message({
message: "删除成功",
type: "success"
});
this.renderData();
});
})
.catch(() => {});
}, },
handleCreate() { handleCreate() {
this.thatRow = null this.thatRow = null;
this.formEditVisible = true this.formEditVisible = true;
}, },
handleUpdate() { handleUpdate() {
this.formEditVisible = true this.formEditVisible = true;
}, },
handleMouseEnter(row) { handleMouseEnter(row) {
this.thatRow = row this.thatRow = row;
}, },
formEditSuccess() { formEditSuccess() {
this.formEditVisible = false this.formEditVisible = false;
this.renderData() this.renderData();
} }
} }
} };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.popover-content { .popover-content {