zhangjq
2026-02-07 81846734e6ee1bf7da9acbbd5871e277b8a0ccd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<template>
  <div class="copywriting-review-page">
    <!-- 页面标题 -->
    <div class="page-header">
      <h2>文案审核</h2>
    </div>
 
    <!-- 文案内容显示区域 -->
    <div class="content-section">
      <div class="section-title">
        <span>待审核文案</span>
      </div>
      <div class="content-display">
        <div class="content-text" v-if="copywritingContent" v-html="copywritingContent"></div>
        <div class="empty-content" v-else>
          <a-empty description="暂无文案内容" />
        </div>
      </div>
    </div>
 
    <!-- 横线分隔符 -->
    <a-divider />
 
    <!-- 审核表单区域 -->
    <div class="review-form-section">
      <a-form :model="reviewForm" layout="vertical" @finish="handleSubmit">
        <!-- 推荐平台输入框 -->
        <a-form-item label="推荐平台" name="recommendedPlatform">
          <a-input v-model:value="reviewForm.recommendedPlatform" placeholder="请输入推荐发布的平台" allow-clear />
        </a-form-item>
 
        <!-- 审核意见文本框 -->
        <a-form-item label="审核意见" name="reviewOpinion">
          <a-textarea v-model:value="reviewForm.reviewOpinion" placeholder="请输入审核意见" :rows="4" show-count :maxlength="500" />
        </a-form-item>
 
        <!-- 按钮区域 -->
        <a-form-item>
          <div class="action-buttons" style="align-items: center; justify-content: center;  ">
            <a-button type="primary" danger @click="handleReject" :loading="loading.reject" style="margin-right: 12px"> 驳回 </a-button>
            <a-button type="primary" @click="handleApprove" :loading="loading.approve"> 通过 </a-button>
          </div>
        </a-form-item>
      </a-form>
    </div>
  </div>
</template>
 
<script lang="ts" name="copywriting-review" setup>
  import { reactive, onMounted, ref } from 'vue';
  import { useRoute, useRouter } from 'vue-router';
  import { message, Modal } from 'ant-design-vue';
  import { reviewCopywriting, queryById } from '../Copywriting.api';
  import { useUserStore } from '/@/store/modules/user';
 
  // 路由实例
  const route = useRoute();
  const router = useRouter();
 
  // 文案ID
  const copywritingId = route.query.id as string;
 
  // 文案详情数据
  const copywritingDetail = ref<any>(null);
  const copywritingContent = ref<string>('');
 
  // 审核表单数据
  const reviewForm = reactive({
    recommendedPlatform: '',
    reviewOpinion: '',
  });
 
  // 加载状态
  const loading = reactive({
    reject: false,
    approve: false,
    detail: false,
  });
 
  /**
   * 获取文案详情
   */
  const getCopywritingDetail = async () => {
    if (!copywritingId) {
      message.error('未获取到文案ID,请返回列表页重新选择');
      return;
    }
 
    loading.detail = true;
    try {
      const result = await queryById({ id: copywritingId });
      copywritingDetail.value = result;
 
      // 根据实际返回的数据结构设置文案内容
      // 这里假设返回的数据中有content字段,如果没有请根据实际字段调整
      if (result && result.content) {
        copywritingContent.value = result.content;
      } else if (result && result.text) {
        copywritingContent.value = result.text;
      } else {
        // 如果接口没有返回具体内容,使用模拟数据
        copywritingContent.value = `文案标题:${result.title || '待审核文案'}
 
语义词:${result.semanticWord?.word || '未指定'}
签约排名:${result.semanticWord?.ranking || '未指定'}
 
文案内容:${result.description || result.remark || '暂无具体文案内容'}
 
请认真审核以上内容,并在下方填写审核意见。`;
      }
    } catch (error) {
      console.error('获取文案详情失败:', error);
      message.error('获取文案详情失败,请稍后重试');
      // 如果接口调用失败,使用模拟数据
      copywritingContent.value = `文案标题:待审核文案
 
语义词:未指定
签约排名:未指定
 
这是一段需要审核的文案内容,来自接口数据。文案内容可以包含各种信息,比如产品描述、营销文案、新闻稿等。审核人员需要仔细阅读并给出专业的审核意见。
 
文案审核要点:
1. 内容是否符合法律法规
2. 语言表达是否准确清晰
3. 是否有敏感词汇
4. 是否符合品牌调性
5. 是否有语法错误或错别字
 
请认真审核以上内容,并在下方填写审核意见。`;
    } finally {
      loading.detail = false;
    }
  };
 
  // 生命周期
  onMounted(() => {
    getCopywritingDetail();
  });
 
  // 提交处理
  const handleSubmit = (values: any) => {
    console.log('表单数据:', values);
  };
 
  // 驳回处理
  const handleReject = () => {
    if (!reviewForm.reviewOpinion.trim()) {
      message.warning('请填写审核意见');
      return;
    }
 
    loading.reject = true;
 
    Modal.confirm({
      title: '确认驳回',
      content: '确定要驳回该文案吗?',
      onOk: () => {
        // 调用驳回接口
        const params = {
          id: copywritingId,
          status: 4, // 4:驳回
          auditer: '', // 审核人员(可以从用户信息获取)
          remark: reviewForm.reviewOpinion,
          platform: reviewForm.recommendedPlatform,
        };
 
        reviewCopywriting(params, {
          successMessageMode: 'none' // 禁用默认成功消息
        })
          .then(() => {
            loading.reject = false;
            message.success('文案已驳回');
            // 审核完成后返回列表页
            setTimeout(() => {
              router.push('/copywritingReview/copywritingList');
            }, 1500);
          })
          .catch((error) => {
            loading.reject = false;
            message.error('驳回失败:' + (error.message || '网络错误'));
          });
      },
      onCancel: () => {
        loading.reject = false;
      },
    });
  };
 
  // 通过处理
  const handleApprove = () => {
    loading.approve = true;
 
    Modal.confirm({
      title: '确认通过',
      content: '确定要通过该文案吗?',
      onOk: () => {
        // 调用通过接口
        const userStore = useUserStore();
        const userInfo = userStore.getUserInfo;
        const userId = userInfo?.id || userInfo?.username || 'unknown';
        const params = {
          id: copywritingId,
          status: 3, // 3:通过
          auditer: userId, // 审核人员(可以从用户信息获取)
          remark: reviewForm.reviewOpinion,
          platform: reviewForm.recommendedPlatform,
        };
 
        reviewCopywriting(params, {
          successMessageMode: 'none' // 禁用默认成功消息
        })
          .then(() => {
            loading.approve = false;
            message.success('文案已通过');
            // 审核完成后返回列表页
            setTimeout(() => {
              router.push('/copywritingReview/copywritingList');
            }, 1500);
          })
          .catch((error) => {
            loading.approve = false;
            message.error('通过失败:' + (error.message || '网络错误'));
          });
      },
      onCancel: () => {
        loading.approve = false;
      },
    });
  };
</script>
 
<style lang="less" scoped>
  .copywriting-review-page {
    padding: 24px;
    background: #fff;
    min-height: calc(100vh - 48px);
 
    .page-header {
      margin-bottom: 24px;
 
      h2 {
        margin: 0;
        font-size: 20px;
        font-weight: 600;
        color: #262626;
      }
    }
 
    .content-section {
      margin-bottom: 24px;
 
      .section-title {
        margin-bottom: 16px;
 
        span {
          font-size: 16px;
          font-weight: 500;
          color: #262626;
        }
      }
 
      .content-display {
        border: 1px solid #d9d9d9;
        border-radius: 6px;
        padding: 16px;
        background: #fafafa;
        min-height: 120px;
 
        .content-text {
          white-space: pre-wrap;
          line-height: 1.6;
          color: #595959;
        }
 
        .empty-content {
          display: flex;
          align-items: center;
          justify-content: center;
          height: 120px;
        }
      }
    }
 
    .review-form-section {
      .action-buttons {
        display: flex;
        justify-content: flex-start;
      }
    }
  }
 
  // 响应式设计
  @media (max-width: 768px) {
    .copywriting-review-page {
      padding: 16px;
 
      .page-header h2 {
        font-size: 18px;
      }
 
      .content-section .content-display {
        padding: 12px;
      }
    }
  }
</style>