Quellcode durchsuchen

正品联盟资料库版本正式v2.0

yuwenjun vor 3 Jahren
Ursprung
Commit
0e4a50881d

+ 1 - 0
src/styles/index.scss

@@ -266,6 +266,7 @@ aside {
 }
 
 .file-upload-box {
+  height: 40px;
   .hidden {
     .el-upload {
       display: none;

+ 2 - 2
src/views/authentic/authuser/userList.vue

@@ -20,9 +20,9 @@
         @change="getList"
       >
         <el-option label="全部" value="" />
-        <el-option label="已绑定" :value="2" />
+        <el-option label="已绑定" :value="1" />
         <el-option label="未绑定" :value="0" />
-        <el-option label="已过期" :value="1" />
+        <el-option label="已过期" :value="2" />
       </el-select>
       <el-button type="primary" icon="el-icon-search" @click="getList">查询</el-button>
       <el-button icon="el-icon-thumb" type="primary" @click="handleMakeGenerate">生成邀请码</el-button>

+ 2 - 2
src/views/authentic/doc/articleList.vue

@@ -21,8 +21,8 @@
       >
         <el-option label="全部" value="" />
         <el-option label="待审核" :value="2" />
-        <el-option label="审核通过" :value="0" />
-        <el-option label="审核未通过" :value="1" />
+        <el-option label="审核通过" :value="1" />
+        <el-option label="审核未通过" :value="0" />
       </el-select>
       <span>上线状态:</span>
       <el-select

+ 62 - 17
src/views/authentic/doc/fileList.vue

@@ -21,8 +21,8 @@
       >
         <el-option label="全部" value="" />
         <el-option label="待审核" :value="2" />
-        <el-option label="审核通过" :value="0" />
-        <el-option label="审核未通过" :value="1" />
+        <el-option label="审核通过" :value="1" />
+        <el-option label="审核未通过" :value="0" />
       </el-select>
       <span>上线状态:</span>
       <el-select
@@ -118,12 +118,13 @@
       :close-on-click-modal="false"
       :close-on-press-escape="false"
       @closed="dialogColosed"
+      @close="beforeDialogClose"
     >
       <el-form ref="formRef" :model="dialogData" label-width="110px" :rules="dialogFormRules">
         <el-form-item label="标题:" prop="fileTitle">
           <el-input v-model="dialogData.fileTitle" maxlength="50" show-word-limit />
         </el-form-item>
-        <el-form-item label="上传文件:" prop="fileUrl" style="margin-bottom:0">
+        <el-form-item label="上传文件:" prop="filePreviewUrl" style="margin-bottom:0">
           <div class="file-upload-box">
             <!-- 上传文件组件 -->
             <el-upload
@@ -136,11 +137,12 @@
               :on-success="fileUploadSuccess"
               :on-change="fileUploadChange"
               :on-remove="fileUploadRemove"
+              :before-upload="beforeUpload"
               :file-list="fileList"
             >
               <el-button size="mini" type="primary" style="width:100%">上传文件</el-button>
             </el-upload>
-            <el-input v-model="dialogData.fileUrl" type="hidden" class="hiddenInput" />
+            <el-input v-model="dialogData.filePreviewUrl" type="hidden" class="hiddenInput" />
           </div>
         </el-form-item>
       </el-form>
@@ -177,7 +179,8 @@ export default {
       dialogVisible: false, // 是否显示dialog
       dialogTitle: '添加文件', // dialog标题
       hasFile: false, // 是否上传了文件
-      uploadFileUrl: '', // 上传文件成功后的url
+      previewUrl: '', // 上传文件成功后的url
+      downloadUrl: '',
       chooseNewFile: false, // 是否选择了新的图片上传
       listQuery: {
         authUserId: '', // 供应商用户id
@@ -194,12 +197,15 @@ export default {
         authUserId: '',
         fileTitle: '',
         fileId: '',
-        fileUrl: ''
+        // fileUrl: '',
+        fileName: '',
+        filePreviewUrl: '',
+        fileDownloadUrl: ''
       },
       // dialog表单数据校验规则
       dialogFormRules: {
         fileTitle: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
-        fileUrl: [{ required: true, message: '链接不能为空', trigger: 'change' }]
+        filePreviewUrl: [{ required: true, message: '文件不能为空', trigger: 'change' }]
       },
       list: []
     }
@@ -236,6 +242,11 @@ export default {
     },
     // 点击保存按钮
     handleSave() {
+      if (!this.dialogData.fileTitle || !this.dialogData.filePreviewUrl) {
+        this.$refs.formRef.validateField('fileTitle')
+        this.$refs.formRef.validateField('filePreviewUrl')
+        return
+      }
       // 对标题字段进行规则校验
       console.log(this.dialogData)
       this.$refs.formRef.validateField('fileTitle', (error) => {
@@ -250,9 +261,11 @@ export default {
       this.$refs.formRef.validate(valide => {
         if (!valide) return
         this.dialogData.authUserId = this.authUserId
-        if (this.uploadFileUrl) {
-          this.dialogData.fileUrl = this.uploadFileUrl
+        if (this.previewUrl && this.downloadUrl) {
+          this.dialogData.filePreviewUrl = this.previewUrl
+          this.dialogData.fileDownloadUrl = this.downloadUrl
         }
+        console.log(this.dialogData)
         console.log('保存')
         saveFile(this.dialogData)
           .then(res => {
@@ -292,18 +305,21 @@ export default {
       this.dialogTitle = type === 'add' ? '添加文件' : '修改文件'
       this.$refs?.formRef?.resetFields()
       this.dialogVisible = true
-      this.setDialogData(row)
+      if (type !== 'add') {
+        this.setDialogData(row)
+      }
     },
     // 设置表单初始值
     setDialogData(row) {
+      console.log(row)
       if (!row) return
       for (const key in this.dialogData) {
         if (Object.hasOwnProperty.call(this.dialogData, key)) {
           this.dialogData[key] = row[key]
         }
       }
-      if (this.dialogData.fileUrl) {
-        this.fileList = [{ name: `删除当前文件后可上传新文件`, url: row.fileUrl }]
+      if (this.dialogData.filePreviewUrl) {
+        this.fileList = [{ name: row.fileName, url: row.filePreviewUrl }]
         this.hasFile = true
       }
     },
@@ -312,30 +328,59 @@ export default {
       this.dialogData.authUserId = ''
       this.dialogData.fileTitle = ''
       this.dialogData.fileId = ''
-      this.dialogData.fileUrl = ''
-      this.uploadFileUrl = ''
+      this.dialogData.filePreviewUrl = ''
+      this.dialogData.fileDownloadUrl = ''
+      this.dialogData.fileName = ''
+      this.previewUrl = ''
+      this.downloadUrl = ''
       this.chooseNewFile = false
       this.hasFile = false
       this.fileList = []
+      this.submitLoading = false
+      console.log(this.dialogData)
+    },
+    // 对话框关闭前的回调
+    beforeDialogClose() {
+      console.log('对话框关闭')
+      // this.$refs.formRef.clearValidate()
+      // 停止上传文件
+      this.$refs.formRef.resetFields()
+      this.$refs.uploadFileRef.abort()
     },
     // 上传文件成功
     fileUploadSuccess(response) {
       // this.dialogData.fileUrl = response.fileUrl
-      this.uploadFileUrl = response.fileUrl
+      this.previewUrl = response.previewUrl
+      this.downloadUrl = response.downloadUrl
+      this.dialogData.fileName = response.fileName
       this.save()
       console.log(response)
     },
     // 上传文件成功,选择文件,上传文件失败的回调
     fileUploadChange(file, fileList) {
       this.hasFile = fileList.length > 0
-      this.dialogData.fileUrl = '-'
+      this.dialogData.filePreviewUrl = '-'
+      this.dialogData.fileDownloadUrl = '-'
       this.chooseNewFile = true
     },
     // 移除文件
     fileUploadRemove(file, fileList) {
-      this.dialogData.fileUrl = ''
+      this.dialogData.filePreviewUrl = ''
+      this.dialogData.fileDownloadUrl = ''
       this.hasFile = fileList.length > 0
     },
+    beforeUpload(file, fileList) {
+      const flag = file.size <= 100 * 1024 * 1204
+      if (!flag) {
+        this.$message({
+          message: '文件大小超过100MB,请重新选择!',
+          duration: 1000,
+          type: 'warning'
+        })
+        this.fileList = []
+      }
+      return flag
+    },
     // 状态改变
     handleChangeStatus(item) {
       this.listLoading = true

+ 13 - 0
src/views/authentic/doc/imageEdit.vue

@@ -18,6 +18,7 @@
             :file-list="imageList"
             :on-remove="handleRemove"
             :on-success="handleUploadSuccess"
+            :before-upload="beforeUpload"
           >
             <i class="el-icon-picture-outline" />
             <div slot="tip" class="el-upload__tip" style="color:#999"><span style="color:red">*</span>最多只能上传8张图片</div>
@@ -132,6 +133,18 @@ export default {
       this.imageArr.splice(pop, 1)
       this.count = fileList.length
     },
+    beforeUpload(file, fileList) {
+      const flag = file.size <= 5 * 1024 * 1204
+      if (!flag) {
+        this.$message({
+          message: '文件大小超过5MB,请重新选择!',
+          duration: 1000,
+          type: 'warning'
+        })
+        this.fileList = []
+      }
+      return flag
+    },
     // 根据图片id获取图片
     searchFileUrl(fileList = [], file) {
       return fileList.filter(v => v.uid === file.uid)[0]?.url

+ 3 - 3
src/views/authentic/doc/imageList.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <!-- 搜索区域 -->
     <div class="filter-container">
-      <span>文章标题:</span>
+      <span>图片标题:</span>
       <el-input
         v-model="listQuery.imageTitle"
         placeholder="图片标题"
@@ -21,8 +21,8 @@
       >
         <el-option label="全部" value="" />
         <el-option label="待审核" :value="2" />
-        <el-option label="审核通过" :value="0" />
-        <el-option label="审核未通过" :value="1" />
+        <el-option label="审核通过" :value="1" />
+        <el-option label="审核未通过" :value="0" />
       </el-select>
       <span>上线状态:</span>
       <el-select

+ 63 - 33
src/views/authentic/doc/videoList.vue

@@ -21,8 +21,8 @@
       >
         <el-option label="全部" value="" />
         <el-option label="待审核" :value="2" />
-        <el-option label="审核通过" :value="0" />
-        <el-option label="审核未通过" :value="1" />
+        <el-option label="审核通过" :value="1" />
+        <el-option label="审核未通过" :value="0" />
       </el-select>
       <span>上线状态:</span>
       <el-select
@@ -117,33 +117,35 @@
       width="40%"
       :close-on-click-modal="false"
       :close-on-press-escape="false"
+      @close="beforeDialogClose"
       @closed="dialogColosed"
     >
       <el-form ref="formRef" :model="dialogData" label-width="110px" :rules="dialogFormRules">
         <el-form-item label="标题:" prop="videoTitle">
           <el-input v-model="dialogData.videoTitle" maxlength="50" show-word-limit />
         </el-form-item>
-        <el-form-item ref="formVideoUrlRef" label="视频链接:" prop="videoUrl">
-          <div class="clearfix video-upload-box" :class="{hasBottom:hasVideo}">
-            <el-input v-model="dialogData.videoUrl" style="width:80%" class="fl" :disabled="hasVideo" />
+        <el-form-item ref="formVideoUrlRef" label="上传视频:" prop="videoPreviewUrl">
+
+          <div class="file-upload-box" style="height:40px;">
+            <!-- 上传文件组件 -->
             <el-upload
               ref="uploadRef"
-              class="upload-demo fr"
               accept=".mp4"
-              :limit="1"
+              :class="{hidden:hasVideo}"
               :auto-upload="false"
-              :show-file-list="true"
               :headers="headers"
               :action="action"
-              :file-list="fileList"
               :on-success="handleUploadSuccess"
               :on-change="handleUploadChange"
               :on-remove="handleFileRemove"
+              :before-upload="beforeUpload"
+              :file-list="fileList"
             >
-              <el-button :disabled="hasVideo" type="primary" style="width:100%">选择视频</el-button>
+              <el-button size="mini" type="primary" style="width:100%">上传视频</el-button>
             </el-upload>
+            <el-input v-model="dialogData.videoPreviewUrl" type="hidden" class="hiddenInput" />
           </div>
-          <span style="color:#999;font-size:12px">如果没有链接,可以点击右侧的上传视频,视频大小不能超过<i style="color:red">*50MB*</i></span>
+          <span style="color:#999;font-size:12px">视频大小不能超过<i style="color:red">*50MB*</i></span>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -181,7 +183,8 @@ export default {
       hasVideo: false, // 是否上传了视频
       chooseNewVideo: false, // 是否重新选择了视频
       fileList: [], // 上传的视频列表
-      uploadVideoUrl: '', // 上传视频成功的url
+      previewUrl: '', // 上传视频成功的url
+      downloadUrl: '',
       listQuery: {
         authUserId: '', // 供应商用户id
         listType: 1, // 列表类型:1视频列表,2视频审核列表
@@ -195,13 +198,16 @@ export default {
       dialogData: {
         videoId: '',
         authUserId: '',
+        videoName: '',
         videoTitle: '',
-        videoUrl: ''
+        // videoUrl: '',
+        videoPreviewUrl: '',
+        videoDownloadUrl: ''
       },
       // dialog中表单字段校验规则
       dialogFormRules: {
         videoTitle: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
-        videoUrl: [{ required: true, message: '链接不能为空', trigger: ['change', 'blur'] }]
+        videoPreviewUrl: [{ required: true, message: '链接不能为空', trigger: ['change', 'blur'] }]
       },
       list: []
     }
@@ -236,12 +242,13 @@ export default {
           this.listLoading = false
         })
     },
-    // 初始化预览图片列表
-    initPreviewList(list) {
-      list.forEach(item => this.srcList.push(item.articleCover))
-    },
     // 提交
     handleSubmit() {
+      if (!this.dialogData.videoPreviewUrl) {
+        this.$refs.formRef.validateField('videoTitle')
+        this.$refs.formRef.validateField('videoPreviewUrl')
+        return
+      }
       // 对标题字段进行规则校验
       this.$refs.formRef.validateField('videoTitle', (error) => {
         if (!error) {
@@ -258,7 +265,7 @@ export default {
            *      5.修改时,重新选择了视频  --上传视频后再提交
            */
           this.submitLoading = true;
-          (this.dialogData.videoUrl && (!this.hasVideo || (this.hasVideo && !this.chooseNewVideo))) ? this.save() : this.$refs.uploadRef.submit()
+          (this.dialogData.videoPreviewUrl && (!this.hasVideo || (this.hasVideo && !this.chooseNewVideo))) ? this.save() : this.$refs.uploadRef.submit()
         }
       })
     },
@@ -268,8 +275,9 @@ export default {
         if (!valide) return
         this.dialogData.authUserId = this.authUserId
         // uploadVideoUrl不为空,就代表重新上传了视频,需要为表单中的videoUrl重新赋值,新增时该值也不为空
-        if (this.uploadVideoUrl) {
-          this.dialogData.videoUrl = this.uploadVideoUrl
+        if (this.previewUrl && this.downloadUrl) {
+          this.dialogData.videoPreviewUrl = this.previewUrl
+          this.dialogData.videoDownloadUrl = this.downloadUrl
         }
         saveVideo(this.dialogData)
           .then(res => {
@@ -296,8 +304,8 @@ export default {
           this.dialogData[key] = row[key]
         }
       }
-      if (this.dialogData.videoUrl) {
-        this.fileList.push({ name: `删除当前视频后可上传新视频`, url: row.videoUrl })
+      if (this.dialogData.videoPreviewUrl) {
+        this.fileList.push({ name: row.videoName, url: row.videoPreviewUrl })
         this.hasVideo = true
       }
     },
@@ -323,7 +331,6 @@ export default {
       this.dialogTitle = type === 'add' ? '添加视频' : '修改视频'
       this.setDialogData(row)
       this.dialogVisible = true
-      this.$refs?.formRef?.clearValidate()
     },
     // 对话框关闭的回调
     dialogColosed() {
@@ -332,15 +339,26 @@ export default {
       this.dialogData.videoId = ''
       this.dialogData.authUserId = ''
       this.dialogData.videoTitle = ''
-      this.dialogData.videoUrl = ''
+      this.dialogData.videoPreviewUrl = ''
+      this.dialogData.videoDownloadUrl = ''
       this.chooseNewVideo = false
-      this.uploadVideoUrl = ''
+      this.downloadUrl = ''
+      this.previewUrl = ''
+      this.submitLoading = false
+    },
+    // 对话框关闭前的回调
+    beforeDialogClose() {
+      this.$refs.formRef.resetFields()
+      // 停止上传文件
+      this.$refs.uploadRef.abort()
     },
     // 视频上传成功
     handleUploadSuccess(response, file, fileList) {
       console.log(response)
       // this.dialogData.videoUrl = response.fileUrl
-      this.uploadVideoUrl = response.fileUrl
+      this.previewUrl = response.previewUrl
+      this.downloadUrl = response.downloadUrl
+      this.dialogData.videoName = response.fileName
       this.save()
     },
     // 选添加文件、上传成功和上传失败时都会被调用
@@ -348,20 +366,32 @@ export default {
       console.log(file)
       this.chooseNewVideo = true
       this.hasVideo = fileList.length > 0
-      this.dialogData.videoUrl = '-'
+      this.dialogData.videoPreviewUrl = '-'
+      this.dialogData.videoDownloadUrl = '-'
     },
     // 移除视频
     handleFileRemove(file, fileList) {
       this.hasVideo = fileList.length > 0
-      this.dialogData.videoUrl = ''
+      this.dialogData.videoPreviewUrl = ''
+      this.dialogData.videoDownloadUrl = ''
+      this.submitLoading = false
+    },
+    // 上传视频前判断文件大小
+    beforeUpload(file, fileList) {
+      const flag = file.size <= 100 * 1024 * 1204
+      if (!flag) {
+        this.$message({
+          message: '文件大小超过100MB,请重新选择!',
+          duration: 1000,
+          type: 'warning'
+        })
+        this.fileList = []
+      }
+      return flag
     },
     // 状态改变
     handleChangeStatus(item) {
       this.listLoading = true
-      // const params = {
-      //   authId: item.authId,
-      //   status: item.status ? 1 : 0
-      // }
       console.log(item)
       const params = {
         videoId: item.videoId,

+ 14 - 11
src/views/authentic/feedback/detail.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <div class="form">
       <h2>反馈处理</h2>
-      <el-form label-width="100px" :rules="formRules" :model="formData">
+      <el-form ref="formRef" label-width="100px" :rules="formRules" :model="formData">
         <el-form-item label="机构名称:">
           {{ feedbackData.clubName }}
         </el-form-item>
@@ -48,17 +48,20 @@ export default {
   methods: {
     // 提交处理信息
     submit() {
-      handleFeedback({ feedbackId: this.feedbackId, handleResult: this.formData.handleResult })
-        .then(res => {
-          if (res.code !== 0) return
-          this.$message({
-            message: res.data,
-            duration: 500,
-            type: 'success'
+      this.$refs.formRef.validate(valid => {
+        if (!valid) return
+        handleFeedback({ feedbackId: this.feedbackId, handleResult: this.formData.handleResult })
+          .then(res => {
+            if (res.code !== 0) return
+            this.$message({
+              message: res.data,
+              duration: 500,
+              type: 'success'
+            })
+            this.$store.dispatch('tagsView/delView', this.$route)
+            this.$router.back()
           })
-          this.$store.dispatch('tagsView/delView', this.$route)
-          this.$router.back()
-        })
+      })
     },
     // 获取反馈信息
     getDetail() {

+ 2 - 1
src/views/authentic/review/doc/fileList.vue

@@ -199,8 +199,9 @@ export default {
     },
     // 显示审核dialog对话框
     handleShowDialog(row) {
+      console.log('------')
       console.log(row)
-      this.current.currentfileUrl = row.fileUrl
+      this.current.currentfileUrl = row.filePreviewUrl
       this.current.fileTitle = row.fileTitle
       this.dialogData.fileId = row.fileId
       this.dialogVisible = true

+ 1 - 1
src/views/authentic/review/doc/imageList.vue

@@ -5,7 +5,7 @@
       <span>图片标题:</span>
       <el-input
         v-model="listQuery.imageTitle"
-        placeholder="文章标题"
+        placeholder="图片标题"
         style="width: 200px"
         class="filter-item"
         @keyup.enter.native="getList"

+ 2 - 2
src/views/authentic/review/doc/videoList.vue

@@ -5,7 +5,7 @@
       <span>视频名称:</span>
       <el-input
         v-model="listQuery.videoTitle"
-        placeholder="文章标题"
+        placeholder="视频名称"
         style="width: 200px"
         class="filter-item"
         @keyup.enter.native="getList"
@@ -202,7 +202,7 @@ export default {
     // 显示审核对话框
     handleShowDialog(row) {
       console.log(row)
-      this.current.currentVideoUrl = row.videoUrl
+      this.current.currentVideoUrl = row.videoPreviewUrl
       this.current.videoTitle = row.videoTitle
       this.dialogData.videoId = row.videoId
       this.dialogVisible = true

+ 2 - 0
vue.config.js

@@ -61,6 +61,8 @@ module.exports = {
       }
     ])
 
+    config.output.filename('[name].[hash].js').end()
+
     // when there are many pages, it will cause too many meaningless requests
     config.plugins.delete('prefetch')