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启动页活动类型
*/
const appStartPagePlanTypes = [
{ value: "WEEK_STAR", name: "周星" },
{ value: "WEEK_CP", name: "每周CP" },
{ value: "WEEK_KING", name: "每周国王/King" },
{ value: "NON_FIXED_ACTIVITY", name: "非固定活动" }
];
const appStartPagePlanTypes = [{ value: "KING_GAMES", name: "游戏王" }];
/**
* 抽奖游戏类型

View File

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

View File

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