From 796d09f1edb2d5366516a78a42efec3c5efc0482 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期四, 12 六月 2025 17:05:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 manager/src/views/activity/index.vue |  188 ++++++++++++++++++++---------------------------
 1 files changed, 80 insertions(+), 108 deletions(-)

diff --git a/manager/src/views/activity/index.vue b/manager/src/views/activity/index.vue
index 31cd43b..b1f49f2 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,10 +128,10 @@
             <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"
@@ -188,7 +188,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 +199,7 @@
                     :value="item.value"
                     :key="item.id"
                   >
-                    {{ item.value }}
+                    {{ item.label }}
                   </Option>
                 </Select>
               </FormItem>
@@ -226,12 +226,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 +264,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 +292,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>
@@ -372,27 +361,6 @@
   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();
-              }
-            }
-          }
-        ]
-      },
-
       loading: false,
       membersLoading: false,
       submitLoading: false,
@@ -415,8 +383,8 @@
 
       // 娲诲姩绫诲瀷閫夐」
       typeSelect: [
-        { id: 1, value: '绾夸笂' },
-        { id: 2, value: '绾夸笅' }
+        { id: 1, value: 'online',label:'绾夸笂' },
+        { id: 2, value: 'offline',label:'绾夸笅' }
       ],
 
       // 灏侀潰绫诲瀷閫夐」
@@ -444,7 +412,7 @@
         endTime: '',
         recommend: false,
         limitUserNum: 0,
-        activityLocation: ''
+        activityLocation: '',
       },
 
       // 琛ㄥ崟楠岃瘉瑙勫垯
@@ -466,6 +434,9 @@
         ],
         cover: [
           { required: true, message: '璇疯緭鍏ュ皝闈㈠唴瀹�', trigger: 'blur' }
+        ],
+        coverType: [
+          { required: true, message: '璇烽�夋嫨灏侀潰绫诲瀷', trigger: 'blur' }
         ],
         limitUserNum: [
           { required: true, type: 'number', message: '璇疯緭鍏ヤ汉鏁伴檺鍒�', trigger: 'blur' },
@@ -497,7 +468,11 @@
           title: '娲诲姩绫诲瀷',
           key: 'activityType',
           width: 100,
-          align: 'center'
+          align: 'center',
+          render: (h, params) => {
+            return h('Tag', {
+            }, params.row.activityType === 'online' ? '绾夸笂' : '绾夸笅')
+          }
         },
         {
           title: '鎺ㄨ崘',
@@ -513,27 +488,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 +543,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: '浜烘暟闄愬埗',
@@ -653,8 +647,7 @@
   methods: {
     // 鑾峰彇瀵屾枃鏈紪杈戝櫒鐨勫唴瀹�
     getReason(content) {
-      this.videoDownForm.reason = content
-      console.log(content)
+      this.activityFrom.activityContent = content
     },
     // 鍒濆鍖栨暟鎹�
     init() {
@@ -674,8 +667,6 @@
             statusLoading: false
           }))
           this.total = res.total
-        } else {
-          this.$Message.error(res.msg || '鑾峰彇娲诲姩鍒楄〃澶辫触')
         }
       }).catch(() => {
         this.loading = false
@@ -724,7 +715,7 @@
     openAdd() {
       this.modelTitle = '鏂板娲诲姩'
       this.modelShow = true
-      this.coverType = ''
+      this.coverType = '杈撳叆鏂囧瓧灏侀潰'
       this.file = null
       this.$refs.form.resetFields()
       this.activityFrom.id = ''
@@ -736,7 +727,6 @@
       this.modelShow = true
       this.$nextTick(() => {
         this.$refs.form.resetFields()
-
         // 濉厖琛ㄥ崟鏁版嵁
         this.activityFrom = {
           id: row.id,
@@ -762,9 +752,9 @@
           limitUserNum: row.limitUserNum,
           activityLocation: row.activityLocation
         }
-
+        this.$refs.editor.setContent(this.activityFrom.activityLocation)
         // 璁剧疆灏侀潰绫诲瀷
-        this.coverType = row.coverType === '鏂囧瓧' ? '杈撳叆鏂囧瓧灏侀潰' : '閫夋嫨鏂囦欢灏侀潰'
+        this.coverType = row.coverType === 'text' ? '杈撳叆鏂囧瓧灏侀潰' : '閫夋嫨鏂囦欢灏侀潰'
       })
     },
 
@@ -773,11 +763,16 @@
       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 +788,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 +795,6 @@
               this.$Message.success(res.msg)
               this.modelClose()
               this.getActivityList()
-            } else {
-              this.$Message.error(res.msg || '鎿嶄綔澶辫触')
             }
           }).catch(() => {
             this.submitLoading = false
@@ -825,8 +813,6 @@
             if (res.code === 200) {
               this.$Message.success(res.msg)
               this.getActivityList()
-            } else {
-              this.$Message.error(res.msg || '鍒犻櫎澶辫触')
             }
           })
         }
@@ -871,8 +857,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 +866,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 +899,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 +966,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 +974,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 +999,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'
     },
 
     // 鏍煎紡鍖栨棩鏈�

--
Gitblit v1.8.0