Browse Source

显示新增按钮

wyling007 3 years ago
parent
commit
457b31861a
1 changed files with 34 additions and 34 deletions
  1. 34 34
      src/views/shortVideo/index.vue

+ 34 - 34
src/views/shortVideo/index.vue

@@ -22,7 +22,7 @@
 
         <el-row :gutter="10" class="mb8">
           <el-col :span="1.5">
-            <el-button v-if="pid!=0" type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:user:add']">新增</el-button>
+            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:user:add']">新增</el-button>
           </el-col>
           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
@@ -35,9 +35,9 @@
               <video :src="scope.row.fileUrl" class="videoPreview" :poster="scope.row.coverFileUrl" controls preload="meta"></video>
             </template>
           </el-table-column>
-          <el-table-column label="视频时长" align="center" prop="videoDuration" >
+          <el-table-column label="视频时长" align="center" prop="videoDuration">
             <template slot-scope="scope">
-              <span>{{new Date(scope.row.videoDuration*1000).toISOString().slice(11,19)}}</span>
+              <span>{{ new Date(scope.row.videoDuration * 1000).toISOString().slice(11, 19) }}</span>
             </template>
           </el-table-column>
           <el-table-column label="视频分类" align="center" prop="teachingVideoTypeName" :show-overflow-tooltip="true" />
@@ -110,7 +110,7 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="视频封面">
-              <input type="file" ref="coverFile"  @change="coverUpload" />
+              <input type="file" ref="coverFile" @change="coverUpload" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -129,7 +129,7 @@
 </template>
 
 <script>
-import { listUser, getUser, delUser, addUser, updateUser,  changeUserStatus,  uploadCover } from '@/api/teachingVideo/index'
+import { listUser, getUser, delUser, addUser, updateUser, changeUserStatus, uploadCover } from '@/api/teachingVideo/index'
 import { treeselect } from '@/api/videoType'
 import Treeselect from '@riophae/vue-treeselect'
 import '@riophae/vue-treeselect/dist/vue-treeselect.css'
@@ -141,7 +141,7 @@ export default {
   components: { Treeselect },
   data() {
     return {
-      pid:0,
+      pid: 0,
       teachingVideoTypeId: 0,
       videoPercentage: 0,
       imagePercentage: 0,
@@ -178,32 +178,32 @@ export default {
       form: {},
       defaultProps: {
         children: 'children',
-        label: 'typeName'
+        label: 'typeName',
       },
       // 查询参数
       queryParams: {
         pageNum: 1,
-        pageSize: 10
+        pageSize: 10,
       },
       // 表单校验
       rules: {
-        userName: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }]
-      }
+        userName: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }],
+      },
     }
   },
   watch: {
     // 根据名称筛选部门树
     deptName(val) {
       this.$refs.tree.filter(val)
-    }
+    },
   },
   async created() {
     this.tcVod = new TcVod({
-      getSignature: vodSignature
+      getSignature: vodSignature,
     })
     this.getList()
     this.getTreeselect()
-    this.getDicts('sys_normal_disable').then(response => {
+    this.getDicts('sys_normal_disable').then((response) => {
       this.statusOptions = response.data
     })
   },
@@ -213,12 +213,12 @@ export default {
       this.mediaFile = e.target.files[0]
       this.videoPercentage = 0
       const uploader = this.tcVod.upload({
-        mediaFile: this.mediaFile // 媒体文件(视频或音频或图片),类型为 File
+        mediaFile: this.mediaFile, // 媒体文件(视频或音频或图片),类型为 File
       })
-      uploader.on('media_progress', info => {
+      uploader.on('media_progress', (info) => {
         this.videoPercentage = Math.floor(info.percent * 100 * 100) / 100
       })
-      uploader.done().then(doneResult => {
+      uploader.done().then((doneResult) => {
         this.form.vodVideoFileId = doneResult.fileId
       })
     },
@@ -229,7 +229,7 @@ export default {
       let formData = new FormData()
       formData.append('coverFile', this.coverFile)
       formData.append('fileId', this.form.vodVideoFileId)
-      let { data } = await uploadCover(formData, e => {
+      let { data } = await uploadCover(formData, (e) => {
         this.imagePercentage = Math.floor((e.loaded / e.total) * 100 * 100) / 100
       })
       this.form.coverFileId = data.fileId
@@ -237,7 +237,7 @@ export default {
     /** 查询用户列表 */
     getList() {
       this.loading = true
-      listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+      listUser(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
         this.userList = response.rows
         this.total = response.total
         this.loading = false
@@ -245,7 +245,7 @@ export default {
     },
     /** 查询部门下拉树结构 */
     getTreeselect() {
-      treeselect().then(response => {
+      treeselect().then((response) => {
         this.deptOptions = response.data
       })
     },
@@ -267,15 +267,15 @@ export default {
       this.$confirm('确认要"' + text + '""' + row.title + '"视频吗?', '警告', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
-        type: 'warning'
+        type: 'warning',
       })
-        .then(function() {
+        .then(function () {
           return changeUserStatus(row.id, row.shelfStatus)
         })
         .then(() => {
           this.msgSuccess(text + '成功')
         })
-        .catch(function() {
+        .catch(function () {
           row.shelfStatus = row.shelfStatus === '0' ? '1' : '0'
         })
     },
@@ -306,7 +306,7 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.userId)
+      this.ids = selection.map((item) => item.userId)
       this.single = selection.length != 1
       this.multiple = !selection.length
     },
@@ -322,15 +322,15 @@ export default {
       this.reset()
       this.getTreeselect()
       const userId = row.id || this.ids
-      getUser(userId).then(response => {
+      getUser(userId).then((response) => {
         this.form = response.data
         this.open = true
         this.title = '修改视频信息'
       })
     },
     /** 提交按钮 */
-    submitForm: function() {
-      this.$refs['form'].validate(valid => {
+    submitForm: function () {
+      this.$refs['form'].validate((valid) => {
         if (valid) {
           if (this.form.id != undefined) {
             let data = {
@@ -339,9 +339,9 @@ export default {
               title: this.form.title,
               videoDescribe: this.form.videoDescribe,
               videoFileId: this.form.vodVideoFileId,
-              coverFileId: this.form.coverFileId
+              coverFileId: this.form.coverFileId,
             }
-            updateUser(data).then(response => {
+            updateUser(data).then((response) => {
               this.msgSuccess('修改成功')
               this.open = false
               this.getList()
@@ -353,9 +353,9 @@ export default {
               title: this.form.title,
               videoDescribe: this.form.videoDescribe,
               videoFileId: this.form.vodVideoFileId,
-              coverFileId: this.form.coverFileId
+              coverFileId: this.form.coverFileId,
             }
-            addUser(data).then(response => {
+            addUser(data).then((response) => {
               this.msgSuccess('新增成功')
               this.open = false
               this.getList()
@@ -370,17 +370,17 @@ export default {
       this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', '警告', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
-        type: 'warning'
+        type: 'warning',
       })
-        .then(function() {
+        .then(function () {
           return delUser(userIds)
         })
         .then(() => {
           this.getList()
           this.msgSuccess('删除成功')
         })
-    }
-  }
+    },
+  },
 }
 </script>