From da39dc76573ae9829c0594a701636f0caf8f048b Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期五, 27 六月 2025 10:18:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
manager/src/views/activity/index.vue | 325 ++++++++++++++++++++++++++++++++++++------------------
1 files changed, 217 insertions(+), 108 deletions(-)
diff --git a/manager/src/views/activity/index.vue b/manager/src/views/activity/index.vue
index 31cd43b..26a2c42 100644
--- a/manager/src/views/activity/index.vue
+++ b/manager/src/views/activity/index.vue
@@ -34,7 +34,7 @@
:value="item.value"
:key="item.id"
>
- {{ item.value }}
+ {{ item.label }}
</Option>
</Select>
</FormItem>
@@ -91,7 +91,7 @@
<template slot-scope="{ row }" slot="url">
<div class="media-container">
<!-- 鍥剧墖绫诲瀷 -->
- <template v-if="row.coverType === '鍥剧墖'">
+ <template v-if="row.coverType === 'image'">
<img
:src="row.url"
alt="娲诲姩灏侀潰"
@@ -100,7 +100,7 @@
>
</template>
<!-- 瑙嗛绫诲瀷 -->
- <template v-else-if="row.coverType === '瑙嗛'">
+ <template v-else-if="row.coverType === 'video'">
<video
:src="row.url"
class="video-player"
@@ -128,11 +128,16 @@
<Button
type="primary"
size="small"
- @click="changeStatus(row, row.status === '宸插彂甯�' ? '涓嬫灦' : '鍙戝竷')"
+ @click="changeStatus(row, row.publish ? '涓嬫灦' : '鍙戝竷')"
:loading="row.statusLoading"
>
- {{ row.status === '宸插彂甯�' ? '涓嬫灦' : '鍙戝竷' }}
+ {{ row.publish ? '涓嬫灦' : '鍙戝竷' }}
</Button>
+ <Button
+ type="info"
+ size="small"
+ @click="detail(row)"
+ >璇︽儏</Button>
<Button
type="info"
size="small"
@@ -188,7 +193,7 @@
</FormItem>
</Col>
<Col span="12">
- <FormItem label="娲诲姩绫诲瀷" prop="activityType">
+ <FormItem label="娲诲姩绫诲瀷" prop="activityType" :label-width="100">
<Select
v-model="activityFrom.activityType"
placeholder="璇烽�夋嫨娲诲姩绫诲瀷"
@@ -199,7 +204,7 @@
:value="item.value"
:key="item.id"
>
- {{ item.value }}
+ {{ item.label }}
</Option>
</Select>
</FormItem>
@@ -226,12 +231,11 @@
></DatePicker>
</FormItem>
</Col>
- <Col span="24">
- <FormItem label="灏侀潰绫诲瀷" prop="coverType">
+ <Col span="12">
+ <FormItem label="灏侀潰绫诲瀷" prop="coverType" :labelWidth="100">
<Select
v-model="coverType"
placeholder="璇烽�夋嫨灏侀潰绫诲瀷"
- clearable
@on-change="handleCoverTypeChange"
>
<Option
@@ -265,15 +269,15 @@
accept="image/*,video/*"
>
<Button icon="ios-cloud-upload-outline">涓婁紶灏侀潰鏂囦欢</Button>
-
<div class="upload-tip">鏀寔鍥剧墖鎴栬棰戞枃浠讹紝鏈�澶�20MB</div>
</Upload>
- <div v-if="file" class="upload-file-info">c
+ <div v-if="file" class="upload-file-info">
宸查�夋枃浠�: {{ file.name }}
<Button type="text" @click="handleRemove">鍒犻櫎</Button>
</div>
</FormItem>
</Col>
+ <!-- 杩欎袱涓〃鍗曢」鍦ㄥ悓涓�Row鍐咃紝浼氭樉绀哄湪鍚屼竴琛� -->
<Col span="12">
<FormItem label="浜烘暟闄愬埗" prop="limitUserNum">
<InputNumber
@@ -293,18 +297,8 @@
</FormItem>
</Col>
<Col span="24">
- <Form :model="videoDownForm" :rules="videoDownRule" ref="videoDownForm">
-<!-- <FormItem label="涓嬫灦鍘熷洜锛�" :labelWidth="100" prop="activityContent">-->
-<!-- <editor ref="editor" @input="getReason" />-->
-<!-- </FormItem>-->
- </Form>
- <FormItem label="娲诲姩鍐呭" prop="activityContent">
- <Input
- v-model="activityFrom.activityContent"
- type="textarea"
- :rows="4"
- placeholder="璇疯緭鍏ユ椿鍔ㄨ缁嗗唴瀹�"
- />
+ <FormItem label="娲诲姩鍐呭锛�" prop="activityContent">
+ <editor ref="editor" @input="getReason" />
</FormItem>
</Col>
</Row>
@@ -347,6 +341,82 @@
</Row>
</Modal>
+ <Modal
+ v-model="infoModelShow"
+ :title="modelTitle"
+ @on-cancel="infoModelClose"
+ width="800"
+ :mask-closable="false"
+ >
+ <div class="detail-container">
+ <Row :gutter="16">
+ <Col span="12">
+ <div class="detail-item">
+ <label>娲诲姩鍚嶇О锛�</label>
+ <span>{{ activityInfo.activityName || '-' }}</span>
+ </div>
+ </Col>
+ <Col span="12">
+ <div class="detail-item">
+ <label>娲诲姩绫诲瀷锛�</label>
+ <span>{{activityInfo.activityType === 'online' ? '绾夸笂':'绾夸笅'}}</span>
+ </div>
+ </Col>
+ <Col span="12">
+ <div class="detail-item">
+ <label>鎶ュ悕鏃堕棿娈碉細</label>
+ <span>{{ activityInfo.reportStartTime }} - {{ activityInfo.reportEndTime }}</span>
+ </div>
+ </Col>
+ <Col span="12">
+ <div class="detail-item">
+ <label>娲诲姩鏃堕棿娈碉細</label>
+ <span>{{ activityInfo.startTime }} - {{ activityInfo.endTime }}</span>
+ </div>
+ </Col>
+
+ <Col span="24" v-if="coverType === '杈撳叆鏂囧瓧灏侀潰'">
+ <div class="detail-item">
+ <label>灏侀潰鏂囧瓧锛�</label>
+ <span>{{ activityInfo.cover || '-' }}</span>
+ </div>
+ </Col>
+ <Col span="24" v-if="coverType === '閫夋嫨鏂囦欢灏侀潰'">
+ <div class="detail-item">
+ <label>涓婁紶灏侀潰锛�</label>
+ <span>{{ activityInfo.cover }}</span>
+ </div>
+ </Col>
+ <Col span="12">
+ <div class="detail-item">
+ <label>浜烘暟闄愬埗锛�</label>
+ <span>{{ activityInfo.limitUserNum || '鏃犻檺鍒�' }}</span>
+ </div>
+ </Col>
+ <Col span="12">
+ <div class="detail-item">
+ <label>娲诲姩鍦扮偣锛�</label>
+ <span>{{ activityInfo.activityLocation || '-' }}</span>
+ </div>
+ </Col>
+ <Col span="24">
+ <div class="detail-item">
+ <label>娲诲姩鍐呭锛�</label>
+ <div
+ class="activity-content"
+ v-html="activityInfo.activityContent || '鏃犲唴瀹�'"
+ ></div>
+ </div>
+ </Col>
+ </Row>
+ </div>
+
+ <div slot="footer">
+ <Button @click="infoModelClose">鍏抽棴</Button>
+ </div>
+ </Modal>
+
+
<!-- 鍥剧墖棰勮妯℃�佹 -->
<Modal v-model="previewVisible" title="鍥剧墖棰勮" footer-hide>
<img :src="previewImageUrl" style="width: 100%">
@@ -372,26 +442,7 @@
components: {Editor},
data() {
return {
- videoDownForm :{
- id: '',
- reason: ''
- },
- videoDownRule: {
- reason: [
- {
- require: true,
- message: '璇疯緭鍏ユ椿鍔ㄥ唴瀹�',
- trigger: 'blur',
- validator: (rule, value, callback) => {
- if (value === null || value === '') {
- callback(new Error('璇疯緭鍏ユ椿鍔ㄥ唴瀹�'));
- } else {
- callback();
- }
- }
- }
- ]
- },
+ infoModelShow:false,
loading: false,
membersLoading: false,
@@ -415,8 +466,8 @@
// 娲诲姩绫诲瀷閫夐」
typeSelect: [
- { id: 1, value: '绾夸笂' },
- { id: 2, value: '绾夸笅' }
+ { id: 1, value: 'online',label:'绾夸笂' },
+ { id: 2, value: 'offline',label:'绾夸笅' }
],
// 灏侀潰绫诲瀷閫夐」
@@ -444,7 +495,25 @@
endTime: '',
recommend: false,
limitUserNum: 0,
- activityLocation: ''
+ activityLocation: '',
+ },
+ activityInfo: {
+ id: '',
+ activityName: '',
+ activityType: '',
+ reportTime: [],
+ time: [],
+ activityContent: '',
+ cover: '',
+ coverType: '',
+ status: '',
+ reportStartTime: '',
+ reportEndTime: '',
+ startTime: '',
+ endTime: '',
+ recommend: false,
+ limitUserNum: 0,
+ activityLocation: '',
},
// 琛ㄥ崟楠岃瘉瑙勫垯
@@ -466,6 +535,9 @@
],
cover: [
{ required: true, message: '璇疯緭鍏ュ皝闈㈠唴瀹�', trigger: 'blur' }
+ ],
+ coverType: [
+ { required: true, message: '璇烽�夋嫨灏侀潰绫诲瀷', trigger: 'blur' }
],
limitUserNum: [
{ required: true, type: 'number', message: '璇疯緭鍏ヤ汉鏁伴檺鍒�', trigger: 'blur' },
@@ -497,7 +569,11 @@
title: '娲诲姩绫诲瀷',
key: 'activityType',
width: 100,
- align: 'center'
+ align: 'center',
+ render: (h, params) => {
+ return h('Tag', {
+ }, params.row.activityType === 'online' ? '绾夸笂' : '绾夸笅')
+ }
},
{
title: '鎺ㄨ崘',
@@ -513,27 +589,37 @@
}
},
{
- title: '鐘舵��',
- key: 'status',
+ title: '鍙戝竷',
+ key: 'publish',
width: 100,
align: 'center',
render: (h, params) => {
return h('Tag', {
props: {
- color: params.row.status === '宸插彂甯�' ? 'blue' : 'orange'
+ color: params.row.publish ? 'green' : 'default'
}
- }, params.row.status)
+ }, params.row.publish ? '宸插彂甯�' : '鏈彂甯�')
}
},
{
- title: '鎶ュ悕鏃堕棿娈�',
- key: 'reportTimeRange',
- width: 300,
+ title: '鐘舵��',
+ key: 'status',
+ width: 100,
+ align: 'center',
render: (h, params) => {
- return h('div', [
- h('div', `寮�濮�: ${this.formatDate(params.row.reportStartTime)}`),
- h('div', `缁撴潫: ${this.formatDate(params.row.reportEndTime)}`)
- ])
+ const status = params.row.status;
+ const statusMap = {
+ 'noStart': { text: '鏈紑濮�', color: 'default' },
+ 'report': { text: '鎶ュ悕涓�', color: 'green' },
+ 'inProgress':{ text:'杩涜涓�',color:'cyan'},
+ 'end': { text: '宸茬粨鏉�', color: 'red' }
+ };
+ const currentStatus = statusMap[status] || { text: status, color: 'default' };
+ return h('Tag', {
+ props: {
+ color: currentStatus.color
+ }
+ }, currentStatus.text);
}
},
{
@@ -558,7 +644,16 @@
title: '灏侀潰绫诲瀷',
key: 'coverType',
width: 100,
- align: 'center'
+ align: 'center',
+ render: (h, params) => {
+ const typeMap = {
+ text: '鏂囨湰',
+ video: '瑙嗛',
+ image: '鍥剧墖'
+ };
+ const text = typeMap[params.row.coverType] || params.row.coverType;
+ return h('span', text);
+ }
},
{
title: '浜烘暟闄愬埗',
@@ -651,10 +746,14 @@
this.init()
},
methods: {
+ detail(row){
+ this.modelTitle = '娲诲姩璇︽儏'
+ this.infoModelShow = true
+ this.activityInfo = row
+ },
// 鑾峰彇瀵屾枃鏈紪杈戝櫒鐨勫唴瀹�
getReason(content) {
- this.videoDownForm.reason = content
- console.log(content)
+ this.activityFrom.activityContent = content
},
// 鍒濆鍖栨暟鎹�
init() {
@@ -674,8 +773,6 @@
statusLoading: false
}))
this.total = res.total
- } else {
- this.$Message.error(res.msg || '鑾峰彇娲诲姩鍒楄〃澶辫触')
}
}).catch(() => {
this.loading = false
@@ -724,7 +821,7 @@
openAdd() {
this.modelTitle = '鏂板娲诲姩'
this.modelShow = true
- this.coverType = ''
+ this.coverType = '杈撳叆鏂囧瓧灏侀潰'
this.file = null
this.$refs.form.resetFields()
this.activityFrom.id = ''
@@ -736,7 +833,6 @@
this.modelShow = true
this.$nextTick(() => {
this.$refs.form.resetFields()
-
// 濉厖琛ㄥ崟鏁版嵁
this.activityFrom = {
id: row.id,
@@ -762,22 +858,29 @@
limitUserNum: row.limitUserNum,
activityLocation: row.activityLocation
}
-
+ this.$refs.editor.setContent(this.activityFrom.activityLocation)
// 璁剧疆灏侀潰绫诲瀷
- this.coverType = row.coverType === '鏂囧瓧' ? '杈撳叆鏂囧瓧灏侀潰' : '閫夋嫨鏂囦欢灏侀潰'
+ this.coverType = row.coverType === 'text' ? '杈撳叆鏂囧瓧灏侀潰' : '閫夋嫨鏂囦欢灏侀潰'
})
},
-
+ infoModelClose(){
+ this.infoModelShow = false
+ },
// 鍏抽棴妯℃�佹
modelClose() {
this.modelShow = false
this.file = null
this.submitLoading = false
+ this.handleRemove();
this.$refs.form.resetFields()
},
// 淇濆瓨鎴栨洿鏂版椿鍔�
saveOrUpdate() {
+ // 璁剧疆灏侀潰绫诲瀷
+ this.activityFrom.coverType = this.coverType === '杈撳叆鏂囧瓧灏侀潰' ? '鏂囧瓧' :
+ this.file ? this.getFileCategory(this.file.type) :
+ this.activityFrom.coverType
this.$refs.form.validate(valid => {
if (valid) {
this.submitLoading = true
@@ -793,11 +896,6 @@
this.activityFrom.endTime = this.formatDate(this.activityFrom.time[1], 'YYYY-MM-DD HH:mm:ss')
}
- // 璁剧疆灏侀潰绫诲瀷
- this.activityFrom.coverType = this.coverType === '杈撳叆鏂囧瓧灏侀潰' ? '鏂囧瓧' :
- this.file ? this.getFileCategory(this.file.type) :
- this.activityFrom.coverType
-
const api = this.activityFrom.id ? editActivity : addActivity
api(this.activityFrom).then(res => {
this.submitLoading = false
@@ -805,8 +903,6 @@
this.$Message.success(res.msg)
this.modelClose()
this.getActivityList()
- } else {
- this.$Message.error(res.msg || '鎿嶄綔澶辫触')
}
}).catch(() => {
this.submitLoading = false
@@ -825,8 +921,6 @@
if (res.code === 200) {
this.$Message.success(res.msg)
this.getActivityList()
- } else {
- this.$Message.error(res.msg || '鍒犻櫎澶辫触')
}
})
}
@@ -871,8 +965,6 @@
if (res.code === 200) {
this.$Message.success(res.msg)
row.recommend = recommend
- } else {
- this.$Message.error(res.msg || '鎿嶄綔澶辫触')
}
}).catch(() => {
row.recommendLoading = false
@@ -882,18 +974,16 @@
// 鏀瑰彉娲诲姩鐘舵��
changeStatus(row, action) {
row.statusLoading = true
- const status = action === '鍙戝竷' ? '宸插彂甯�' : '宸蹭笅鏋�'
+ const publish = action === '鍙戝竷'
activityChangeStatus({
id: row.id,
- status: status
+ publish: publish
}).then(res => {
row.statusLoading = false
if (res.code === 200) {
this.$Message.success(res.msg)
- row.status = status
- } else {
- this.$Message.error(res.msg || '鎿嶄綔澶辫触')
+ row.publish = publish
}
}).catch(() => {
row.statusLoading = false
@@ -917,8 +1007,6 @@
if (res.code === 200) {
this.membersList = res.data
this.memberTotal = res.total
- } else {
- this.$Message.error(res.msg || '鑾峰彇鎶ュ悕浜哄憳澶辫触')
}
}).catch(() => {
this.membersLoading = false
@@ -986,8 +1074,6 @@
if (res.code === 200) {
this.activityFrom.cover = res.data.fileKey
this.$Message.success('涓婁紶鎴愬姛')
- } else {
- this.$Message.error(res.msg || '涓婁紶澶辫触')
}
}).catch(() => {
this.submitLoading = false
@@ -996,24 +1082,18 @@
// 鍒犻櫎鏂囦欢
handleRemove() {
+ //鐐瑰嚮鍏抽棴绐楀彛鏃剁‘淇濇枃浠跺凡琚竻闄�
+ if(this.file === null){
+ return;
+ }
if (!this.activityFrom.cover) {
this.file = null
return
}
-
- this.$Modal.confirm({
- title: '纭鍒犻櫎',
- content: '纭畾瑕佸垹闄ゅ凡涓婁紶鐨勬枃浠跺悧?',
- onOk: () => {
- delByKey(this.activityFrom.cover).then(res => {
- if (res.code === 200) {
- this.$Message.success(res.msg)
- this.file = null
- this.activityFrom.cover = ''
- } else {
- this.$Message.error(res.msg || '鍒犻櫎澶辫触')
- }
- })
+ delByKey(this.activityFrom.cover).then(res => {
+ if (res.code === 200) {
+ this.file = null
+ this.activityFrom.cover = ''
}
})
},
@@ -1027,14 +1107,14 @@
// 鑾峰彇鏂囦欢鍒嗙被
getFileCategory(mimeType) {
const typeMap = {
- 'image': '鍥剧墖',
- 'video': '瑙嗛',
- 'audio': '闊抽',
- 'application': '鏂囨。'
+ 'image': 'image',
+ 'video': 'video',
+ 'audio': 'audio',
+ 'application': 'application'
}
const typePrefix = mimeType.split('/')[0]
- return typeMap[typePrefix] || '鏈煡'
+ return typeMap[typePrefix] || 'unknown'
},
// 鏍煎紡鍖栨棩鏈�
@@ -1211,4 +1291,33 @@
margin-top: 4px;
}
}
+.detail-container {
+ padding: 16px;
+}
+
+.detail-item {
+ margin-bottom: 18px;
+ line-height: 1.5;
+
+ label {
+ display: inline-block;
+ width: 100px;
+ color: #666;
+ font-weight: bold;
+ vertical-align: top;
+ }
+
+ span {
+ display: inline-block;
+ width: calc(100% - 110px);
+ }
+}
+
+.activity-content {
+ border: 1px solid #dcdee2;
+ border-radius: 4px;
+ padding: 12px;
+ min-height: 100px;
+ margin-top: 8px;
+}
</style>
--
Gitblit v1.8.0