From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/mp/components/wx-reply/components/TabVideo.vue |  128 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 128 insertions(+), 0 deletions(-)

diff --git a/src/views/mp/components/wx-reply/components/TabVideo.vue b/src/views/mp/components/wx-reply/components/TabVideo.vue
new file mode 100644
index 0000000..adb8fa3
--- /dev/null
+++ b/src/views/mp/components/wx-reply/components/TabVideo.vue
@@ -0,0 +1,128 @@
+<template>
+  <div>
+    <el-row>
+      <el-input v-model="reply.title" class="input-margin-bottom" placeholder="璇疯緭鍏ユ爣棰�" />
+      <el-input class="input-margin-bottom" v-model="reply.description" placeholder="璇疯緭鍏ユ弿杩�" />
+      <el-row class="ope-row" justify="center">
+        <WxVideoPlayer v-if="reply.url" :url="reply.url" />
+      </el-row>
+      <el-col>
+        <el-row style="text-align: center" align="middle">
+          <!-- 閫夋嫨绱犳潗 -->
+          <el-col :span="12">
+            <el-button type="success" @click="showDialog = true">
+              绱犳潗搴撻�夋嫨 <Icon icon="ep:circle-check" />
+            </el-button>
+            <el-dialog
+              title="閫夋嫨瑙嗛"
+              v-model="showDialog"
+              width="90%"
+              append-to-body
+              destroy-on-close
+            >
+              <WxMaterialSelect
+                type="video"
+                :account-id="reply.accountId"
+                @select-material="selectMaterial"
+              />
+            </el-dialog>
+          </el-col>
+          <!-- 鏂囦欢涓婁紶 -->
+          <el-col :span="12">
+            <el-upload
+              :action="UPLOAD_URL"
+              :headers="HEADERS"
+              multiple
+              :limit="1"
+              :file-list="fileList"
+              :data="uploadData"
+              :before-upload="beforeVideoUpload"
+              :on-success="onUploadSuccess"
+            >
+              <el-button type="primary">鏂板缓瑙嗛 <Icon icon="ep:upload" /></el-button>
+            </el-upload>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script lang="ts" setup>
+import WxVideoPlayer from '@/views/mp/components/wx-video-play'
+import WxMaterialSelect from '@/views/mp/components/wx-material-select'
+import type { UploadRawFile } from 'element-plus'
+import { UploadType, useBeforeUpload } from '@/views/mp/hooks/useUpload'
+import { getAccessToken } from '@/utils/auth'
+import { Reply } from './types'
+
+const message = useMessage()
+
+const UPLOAD_URL = import.meta.env.VITE_BASE_URL + '/admin-api/mp/material/upload-temporary'
+const HEADERS = { Authorization: 'Bearer ' + getAccessToken() }
+
+const props = defineProps<{
+  modelValue: Reply
+}>()
+const emit = defineEmits<{
+  (e: 'update:modelValue', v: Reply)
+}>()
+const reply = computed<Reply>({
+  get: () => props.modelValue,
+  set: (val) => emit('update:modelValue', val)
+})
+
+const showDialog = ref(false)
+const fileList = ref([])
+const uploadData = reactive({
+  accountId: reply.value.accountId,
+  type: 'video',
+  title: '',
+  introduction: ''
+})
+
+const beforeVideoUpload = (rawFile: UploadRawFile) => useBeforeUpload(UploadType.Video, 10)(rawFile)
+
+const onUploadSuccess = (res: any) => {
+  if (res.code !== 0) {
+    message.error('涓婁紶鍑洪敊锛�' + res.msg)
+    return false
+  }
+
+  // 娓呯┖涓婁紶鏃剁殑鍚勭鏁版嵁
+  fileList.value = []
+  uploadData.title = ''
+  uploadData.introduction = ''
+
+  selectMaterial(res.data)
+}
+
+/** 閫夋嫨绱犳潗鍚庤缃� */
+const selectMaterial = (item: any) => {
+  showDialog.value = false
+
+  reply.value.mediaId = item.mediaId
+  reply.value.url = item.url
+  reply.value.name = item.name
+
+  // title銆乮ntroduction锛氫粠 item 鍒� tempObjItem锛屽洜涓虹礌鏉愰噷鏈� title銆乮ntroduction
+  if (item.title) {
+    reply.value.title = item.title || ''
+  }
+  if (item.introduction) {
+    reply.value.description = item.introduction || ''
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.input-margin-bottom {
+  margin-bottom: 2%;
+}
+
+.ope-row {
+  width: 100%;
+  padding-top: 10px;
+  text-align: center;
+}
+</style>

--
Gitblit v1.8.0