瀏覽代碼

认证通资料库上线

yuwenjun1997 2 年之前
父節點
當前提交
6fdec449a7

+ 12 - 11
.env.development

@@ -4,14 +4,14 @@ NODE_ENV = development
 ENV = 'development'
 
 # 测试地址 API接口
-# VUE_APP_BASE_API = 'https://zplma-b.caimei365.com'
+VUE_APP_BASE_API = 'https://zplma-b.caimei365.com'
 # VUE_APP_BASE_API = 'http://192.168.2.68:8012'
-VUE_APP_BASE_API = 'http://192.168.2.67:8012'
+# VUE_APP_BASE_API = 'http://192.168.2.67:8012'
 
 # 文件上传 API接口地址
-# VUE_APP_UPLOAD_API='https://zplma-b.caimei365.com'
+VUE_APP_UPLOAD_API='https://zplma-b.caimei365.com'
 # VUE_APP_UPLOAD_API='http://192.168.2.68:8012'
-VUE_APP_UPLOAD_API='http://192.168.2.67:8012'
+# VUE_APP_UPLOAD_API='http://192.168.2.67:8012'
 
 
 # 二维码生成链接location
@@ -22,17 +22,18 @@ VUE_APP_SOCKET_SERVER = 'wss://zplma-b.caimei365.com/websocket?sessionSource=zpl
 # VUE_APP_SOCKET_SERVER = 'ws://192.168.2.68:8012/websocket?sessionSource=zplm_admin'
 
 # 网站地址
-VUE_APP_LOCAL = 'http://192.168.2.92:9527'
-# VUE_APP_LOCAL = 'http://zplm-b.caimei365.com'
+# VUE_APP_LOCAL = 'http://192.168.2.92:9527'
+VUE_APP_LOCAL = 'http://zplm-b.caimei365.com'
 
 # 认证通页面
-VUE_APP_WWW_HOST = 'https://192.168.2.92:8888'
-# VUE_APP_WWW_HOST = 'https://zp-b.caimei365.com'
+# VUE_APP_WWW_HOST = 'https://192.168.2.92:8888'
+VUE_APP_WWW_HOST = 'https://zp-b.caimei365.com'
 
 # 支付
-VUE_APP_PAY_LOCAL = 'http://192.168.2.67:18014'
-# VUE_APP_PAY_LOCAL = 'http://zplm-b.caimei365.com'
+# VUE_APP_PAY_LOCAL = 'http://192.168.2.67:18014'
+VUE_APP_PAY_LOCAL = 'http://zplm-b.caimei365.com'
 
 # 文件上传路径
-VUE_APP_UPLOAD_DIR = 'dev/authFile/'
+# VUE_APP_UPLOAD_DIR = 'dev/authFile/'
+VUE_APP_UPLOAD_DIR = 'beta/authFile/'
 

+ 1 - 1
.env.staging

@@ -16,7 +16,7 @@ VUE_APP_BASE_SERVER = 'https://www-b.caimei365.com'
 VUE_APP_SOCKET_SERVER = 'wss://zplma-b.caimei365.com/websocket?sessionSource=zplm_admin'
 
 # 支付
-VUE_APP_PAY_LOCAL = https://core-b.caimei365.com
+VUE_APP_PAY_LOCAL = 'https://core-b.caimei365.com'
 
 # 网站地址
 VUE_APP_LOCAL = 'https://zplm-b.caimei365.com'

+ 1 - 1
src/views/admin/supplier/edit.vue

@@ -4,7 +4,7 @@
       <el-form-item label="供应商名称:" prop="shopName">
         <el-input v-model="formData.shopName" placeholder="请输入供应商名称" maxlength="50" show-word-limit />
       </el-form-item>
-      <el-form-item label="标识:" prop="prefix">
+      <el-form-item label="子账号标识:" prop="prefix">
         <el-input
           v-model="formData.prefix"
           placeholder="供应商唯一标识符(不可更改)"

+ 6 - 0
src/views/components/DocIcon/index.vue

@@ -43,6 +43,12 @@ export default {
       handler: function() {
         if (suffix.video.includes(this.type)) {
           this.typeIndex = 'video'
+        } else if (suffix.word.includes(this.type)) {
+          this.typeIndex = 'word'
+        } else if (suffix.ppt.includes(this.type)) {
+          this.typeIndex = 'ppt'
+        } else if (suffix.excel.includes(this.type)) {
+          this.typeIndex = 'excel'
         } else if (this.docIcons[this.type]) {
           this.typeIndex = this.type
         } else {

+ 7 - 1
src/views/components/DocIcon/suffix.js

@@ -1,3 +1,9 @@
 const video = ['mp4', 'mov', 'avi', 'qt', 'flv', 'wmv', 'asf', 'mpeg', 'mpg', 'vob', 'mkv', 'asf', 'wmv', 'rm', 'rmvb']
 
-export default { video }
+const word = ['doc', 'docx']
+
+const ppt = ['ppt', 'pptx']
+
+const excel = ['xls', 'xlsx']
+
+export default { video, word, ppt, excel }

+ 1 - 0
src/views/components/OssUpload/upload.js

@@ -62,6 +62,7 @@ async function multipartUpload(options, callback) {
     // console.log(res.name) baseFileUrl + res.name
     callback.success && callback.success(options, res, baseFileUrl + res.name)
   } catch (err) {
+    console.log(err)
     callback.success && callback.faild(options, err)
   }
 }

+ 10 - 1
src/views/normal/docs/article-edit.vue

@@ -47,6 +47,14 @@ import { saveArticle, getArticleDeatil } from '@/api/doc'
 export default {
   components: { UploadImage, Tinymce },
   data() {
+    const fileNameValidate = (rule, value, callback) => {
+      if (/[\\\/\[\]\|^%&',;=?$\x22]+/g.test(value)) {
+        callback(new Error("文章标题不能包含|\/\\^%&',;=?$等特殊字符"))
+      } else {
+        callback()
+      }
+    }
+
     return {
       editType: 0, // 编辑模式 1:添加文章  2:修改文章
       formData: {
@@ -62,7 +70,8 @@ export default {
       formRules: {
         articleTitle: [
           { required: true, message: '文章标题不能为空', trigger: 'blur' },
-          { min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' }
+          { min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' },
+          { validator: fileNameValidate, trigger: 'blur' }
         ],
         articleImage: [{ required: true, message: '文章必须上传封面', trigger: 'change' }],
         articleContent: [{ required: true, message: '文章内容不能为空', trigger: 'change' }],

+ 4 - 4
src/views/normal/docs/detail.vue

@@ -18,7 +18,7 @@
     </div>
     <div class="doc-content">
       <img v-if="fileType === 'image'" :src="fileData.ossUrl" alt="">
-      <video v-else-if="fileType === 'video'" :src="fileData.ossUrl" />
+      <video v-else-if="fileType === 'video'" :src="fileData.ossUrl" controls />
       <div v-else class="other">
         <doc-icon type="icon-other" :width="64" :height="64" />
         <div class="name">{{ fileData.fileName }}</div>
@@ -94,16 +94,16 @@ export default {
       let downUrl = ''
       const target = this.fileData
       if (target.packageType > 0) {
-        downUrl = `${process.env.VUE_APP_BASE_API}/download/file?ossName=${target.ossName}&fileName=${target.fileName}`
+        downUrl = `${process.env.VUE_APP_BASE_API}/download/file?ossName=${target.ossName}&fileName=${encodeURIComponent(target.fileName)}`
       } else {
-        downUrl = `${process.env.VUE_APP_BASE_API}/database/path/package/zip?fileId=${target.id}&fileName=${target.fileName}`
+        downUrl = `${process.env.VUE_APP_BASE_API}/database/path/package/zip?fileId=${target.id}&fileName=${encodeURIComponent(target.fileName)}`
       }
       const options = {
         headers: {
           'X-Token': this.$store.getters.token
         }
       }
-      downloadWithUrl(downUrl, confirmText, options)
+      downloadWithUrl(downUrl, target.fileName, options)
         .catch((err) => {
           console.log(err)
           this.$message.error(`下载${confirmText}失败`)

+ 58 - 13
src/views/normal/docs/index.vue

@@ -50,18 +50,27 @@
         </template>
         <template v-else>
           <el-breadcrumb-item :key="item.id" :to="{ path: `/docs/${item.id}/list` }">
-            <span>{{ item.fileName }}</span>
+            <span>{{ item.fileName | crumbFormat }}</span>
           </el-breadcrumb-item>
         </template>
       </template>
     </el-breadcrumb>
     <!-- 列表 -->
-    <el-table :data="list" style="width: 100%" @selection-change="onSelectionChange">
+    <el-table
+      :data="list"
+      style="width: 100%"
+      :row-style="{ cursor: 'pointer' }"
+      @selection-change="onSelectionChange"
+      @row-dblclick="onRowClick"
+    >
       <el-table-column type="selection" align="center" width="50" />
       <el-table-column label="文件名">
         <template slot-scope="{ row }">
           <doc-icon v-if="!listLoading" :type="row.fileType" :src="row.screenshot" />
-          <span class="file-name" @click.stop="onRowClick(row)">{{ row.fileName }}</span>
+          <span v-if="row.fileType === 'article'" class="file-name" @click.stop="onRowClick(row)">{{
+            row.fileName | fileNameFormat
+          }}</span>
+          <span v-else class="file-name" @click.stop="onRowClick(row)">{{ row.fileName }}</span>
         </template>
       </el-table-column>
       <el-table-column prop="createTime" label="时间" width="160">
@@ -81,7 +90,7 @@
     <el-dialog :title="editText" :visible.sync="editDialog" width="30%" :close-on-click-modal="false" @close="onCancel">
       <el-form ref="ruleForm" :model="formData" :rules="rules" label-width="80">
         <el-form-item prop="fileName" label="名称:">
-          <el-input v-model="formData.fileName" placeholder="请输入文件名" />
+          <el-input v-model="formData.fileName" placeholder="请输入文件名" @keyup.enter.native="onSubmit" />
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
@@ -96,9 +105,11 @@
       <el-button icon="el-icon-arrow-right" :disabled="nextDisabled" size="mini" @click="currentIndex++" />
       <el-table
         :data="filterSameDir(moveCurrentDir.childList)"
+        :row-style="{ cursor: 'pointer' }"
         style="width: 100%"
-        height="300"
+        :height="300"
         empty-text="该目录为空"
+        @row-dblclick="onMoveRowClick"
       >
         <el-table-column label="文件名">
           <template slot-scope="{ row }">
@@ -139,9 +150,26 @@ export default {
       size = Math.round(size / 1024)
       if (size < 1024) return size + 'MB'
       return Math.round(size / 1024) + 'GB'
+    },
+    crumbFormat(name) {
+      if (name.length < 12) return name
+      return name.substring(0, 10) + '…'
+    },
+    fileNameFormat(name) {
+      return name.replace(/(.+)(.txt$)/, (match, $1, $2) => {
+        return $1
+      })
     }
   },
   data() {
+    const fileNameValidate = (rule, value, callback) => {
+      if (/[\\\/\[\]\|^%&',;=?$\x22]+/g.test(value)) {
+        callback(new Error("文件名不能包含|\/\\^%&',;=?$等特殊字符"))
+      } else {
+        callback()
+      }
+    }
+
     return {
       selectionList: [], // 选中列表
       list: [],
@@ -154,13 +182,17 @@ export default {
         fileId: ''
       },
       rules: {
-        fileName: [{ required: true, message: '文件名不能为空', trigger: ['blur'] }]
+        fileName: [
+          { required: true, message: '文件名不能为空', trigger: ['blur'] },
+          { validator: fileNameValidate, trigger: ['blur'] }
+        ]
       },
       editType: '',
       current: null,
       crumbList: [],
       currentDirStack: [],
-      currentIndex: 0
+      currentIndex: 0,
+      message: null
     }
   },
   computed: {
@@ -189,7 +221,8 @@ export default {
   },
   methods: {
     // 排除相同文件夹
-    filterSameDir(dirList = []) {
+    filterSameDir(dirList) {
+      if (!dirList) dirList = []
       return dirList.filter((item) => {
         return !this.selectionList.find((file) => file.id === item.id)
       })
@@ -253,7 +286,8 @@ export default {
       try {
         await saveFile(data)
         this.fetchDocsList()
-        this.$message.success('文件上传成功')
+        if (this.message) this.message.close()
+        this.message = this.$message.success('文件上传成功')
       } catch (error) {
         console.log(error)
       }
@@ -371,6 +405,7 @@ export default {
     // 下载文件
     async onDownload() {
       const confirmText = '文件'
+      let fileName = '文件'
       const filedIds = this.selectionList.map((file) => file.id).join(',')
       const text = await this.$confirm(`确认下载所选${confirmText}?`, '提示', {
         confirmButtonText: '确定',
@@ -391,16 +426,21 @@ export default {
       let downUrl = ''
       if (this.selectionList.length === 1) {
         const target = this.selectionList[0]
+        fileName = target.fileName
         if (target.packageType > 0) {
-          downUrl = `${process.env.VUE_APP_BASE_API}/download/file?ossName=${target.ossName}&fileName=${target.fileName}`
+          downUrl = `${process.env.VUE_APP_BASE_API}/download/file?ossName=${
+            target.ossName
+          }&fileName=${encodeURIComponent(target.fileName)}`
         } else {
-          downUrl = `${process.env.VUE_APP_BASE_API}/database/path/package/zip?fileId=${target.id}&fileName=${target.fileName}`
+          downUrl = `${process.env.VUE_APP_BASE_API}/database/path/package/zip?fileId=${
+            target.id
+          }&fileName=${encodeURIComponent(target.fileName)}`
         }
       } else {
         // 使用a链接下载
         downUrl = `${process.env.VUE_APP_BASE_API}/database/path/chose/zip?fileId=${filedIds}`
       }
-      downloadWithUrl(downUrl, confirmText, {
+      downloadWithUrl(downUrl, fileName, {
         headers: {
           'X-Token': this.$store.getters.token
         }
@@ -447,12 +487,17 @@ export default {
     },
     // 文件点击
     onRowClick(row) {
-      if (row.packageType === 1) {
+      if (row.fileType === 'article') {
+        // 文章
+        const url = `/docs/article-edit?parentId=${row.parentId}&articleId=${row.articleId}`
+        this.$router.push(url)
+      } else if (row.packageType === 1) {
         // 其它文件
         console.log('详情')
         this.$router.push(`/docs/detail?id=${row.id}`)
       } else {
         this.$router.push(`/docs/${row.id}/list`)
+        this.$store.dispatch('tagsView/delView', this.$route)
       }
     },
     // 移动位置点击