Browse Source

修改上传背景

W 1 year ago
parent
commit
22f6c68d36

BIN
dist.zip


+ 2 - 2
src/router/auth.js

@@ -255,12 +255,12 @@ export const asyncRoutes = [
       },
       {
         path: 'industry',
-        name: 'IndustryModule',
+        name: 'industryModule',
         component: '/module/industry',
         meta: {
           title: '类型模块',
           noCache: true,
-          icon: 'lock'
+          icon: 'inte_manage'
         }
       },
       {

+ 1 - 1
src/views/backstage/account.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="content">
-    <div v-loading.fullscreen.lock="loadingFull" />
+    <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
     <div class="search_box">
       <el-button type="primary" icon="el-icon-edit" class="filter-item" @click="handleAddAccount">
         添加账号

+ 1 - 1
src/views/company/list.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="content">
-    <div v-loading.fullscreen.lock="loadingFull" />
+    <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
     <div class="search_box flexS">
       <div v-for="(item, idx) in categoryList" :key="idx">
         <el-select v-model="params[item.mark]" :placeholder="item.name" class="select" @change="toSearch()" clearable

+ 1 - 1
src/views/company/output.vue

@@ -1,7 +1,7 @@
 <!-- 企业产值 -->
 <template>
     <div class="content">
-        <div v-loading.fullscreen.lock="loadingFull" />
+        <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
         <div class="search_box flexS">
             <el-select v-model="params.search_company" placeholder="所属企业" class="select" @change="toSearch()" clearable
                 @clear="toSearch()">

+ 1 - 1
src/views/company/patent.vue

@@ -1,7 +1,7 @@
 <!-- 知识产权 -->
 <template>
     <div class="content">
-        <div v-loading.fullscreen.lock="loadingFull" />
+        <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
         <div class="search_box flexS">
             <div v-for="(item, idx) in categoryList" :key="idx">
                 <el-select v-model="params[item.mark]" :placeholder="item.name" class="select" @change="toSearch()"

+ 1 - 1
src/views/company/product.vue

@@ -1,7 +1,7 @@
 <!-- 企业产品 -->
 <template>
     <div class="content">
-        <div v-loading.fullscreen.lock="loadingFull" />
+        <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
         <div class="search_box flexS">
             <el-select v-model="params.search_company" placeholder="所属企业" class="select" @change="toSearch()" clearable
                 @clear="toSearch()">

+ 1 - 1
src/views/company/project.vue

@@ -1,7 +1,7 @@
 <!-- 企业项目 -->
 <template>
     <div class="content">
-        <div v-loading.fullscreen.lock="loadingFull" />
+        <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
         <div class="search_box flexS">
             <div v-for="(item, idx) in categoryList" :key="idx">
                 <el-select v-model="params[item.mark]" :placeholder="item.name" class="select" @change="toSearch()"

+ 1 - 1
src/views/company/talents.vue

@@ -1,7 +1,7 @@
 <!-- 企业人才 -->
 <template>
   <div class="content">
-    <div v-loading.fullscreen.lock="loadingFull" />
+    <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
     <div class="search_box flexS">
       <div v-for="(item, idx) in categoryList" :key="idx">
         <el-select v-model="params[item.mark]" :placeholder="item.name" class="select" @change="toSearch()" clearable

+ 97 - 45
src/views/dashboard/index.vue

@@ -5,41 +5,53 @@
       大屏背景设置
     </div>
     <div style="margin-bottom:24px;">
-      <el-button v-if="!isEdit" @click="edit">修改</el-button>
-      <el-button @click="save">保存</el-button>
+      <!-- <el-button v-if="!isEdit" @click="edit">修改</el-button> -->
+      <el-button type="primary" @click="save">保存</el-button>
+      <!-- <el-button v-if="isEdit" @click="isEdit = false, getBg()">取消</el-button> -->
     </div>
-    <div v-if="!isEdit" class="box">
+    <!-- <div v-if="!isEdit" class="box">
       <div v-if="isVideo" class="video_box">
         <video :src="videoUrl" style="width: 500px;height: 300px;" controls />
       </div>
       <div v-else class="img_box">
-        <el-image v-for="(item, i) in params.content" :key="i" :src="item" class="img_item" />
+        <el-image :src="item" v-for="(item, i) in params.content" :key="i" class="img_item" />
+      </div>
+    </div> -->
+    <div class="upload_box">
+      <el-upload class="upload-demo" drag multiple action="" :http-request="handleUpload" :show-file-list="false">
+        <i class="el-icon-upload" />
+        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+      </el-upload>
+      <div v-if="params.content.length > 0" class="imgs_box">
+        <div v-for="(item, i) in params.content" :key="i">
+          <el-image :src="item.url" style="width: 320px;height: 180px;" class="img_item" v-if="!item.isVideo" />
+          <video :src="item.url" controls v-else style="width: 320px;height: 180px;"/>
+          <i class="el-icon-delete" @click="deleteImg(i)" />
+        </div>
       </div>
     </div>
-    <el-tabs v-else v-model="activeName" type="card" @tab-click="handleClick">
+    <!-- <el-tabs v-else v-model="activeName" type="card" @tab-click="handleClick">
       <el-tab-pane label="上传图片" name="first">
         <el-upload class="upload-demo" drag multiple action="" :http-request="handleUploadImage" :show-file-list="false">
           <i class="el-icon-upload" />
           <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-          <!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div> -->
         </el-upload>
-        <div v-if="params.content.length > 0" class="img_box">
+        <div v-if="params.content.length > 0" class="imgs_box">
           <div v-for="(item, i) in params.content" :key="i">
             <el-image :src="item" style="width: 320px;height: 180px;" class="img_item" />
             <i class="el-icon-delete" @click="deleteImg(i)" /></span>
           </div>
-
         </div>
       </el-tab-pane>
       <el-tab-pane label="上传视频" name="second">
-        <video :src="params.content" controls v-if="params.content.length > 0" style="width: 300px;height:150px;" />
-        <el-upload class="upload-demo" drag action="" :http-request="handleUploadVideo" v-else :show-file-list="false">
+        <el-upload class="upload-demo" drag action="" :http-request="handleUploadVideo" :show-file-list="false">
           <i class="el-icon-upload"></i>
           <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-          <!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div> -->
         </el-upload>
+        <video v-if="params.content.length > 0 && isVideo" :src="params.content[0]" controls
+          style="width: 300px;height:150px;" />
       </el-tab-pane>
-    </el-tabs>
+    </el-tabs> -->
 
   </div>
 </template>
@@ -73,17 +85,21 @@ export default {
       this.params.content.splice(i, 1)
     },
     edit() {
-      this.params.content = []
+      // const result = this.params.content[0].split('.').pop()
+      // if (result === 'mp4') {
+      //   this.activeName = 'second'
+      // }
       this.isEdit = true
     },
-    handleUploadImage(params) {
-      this.handleUpload(params, 0)
-    },
-    handleUploadVideo(params) {
-      this.handleUpload(params, 1)
-    },
+    // handleUploadImage(params) {
+    //   this.handleUpload(params, 0)
+    // },
+    // handleUploadVideo(params) {
+    //   this.handleUpload(params, 1)
+    // },
     handleClick(tab, event) {
-      this.params.content = []
+      this.getBg()
+      // this.params.content = []
     },
     // 保存
     save() {
@@ -105,13 +121,13 @@ export default {
         if (code === 200) {
           if (data.content) {
             data.content = JSON.parse(data.content)
-            const result = data.content[0].split('.').pop()
-            if (result === 'mp4') {
-              this.isVideo = true
-              this.videoUrl = data.content[0]
-            } else {
-              this.isVideo = false
-            }
+            // const result = data.content[0].split('.').pop()
+            // if (result === 'mp4') {
+            //   this.isVideo = true
+            //   this.videoUrl = data.content[0]
+            // } else {
+            //   this.isVideo = false
+            // }
           }
           this.params = data
         } else {
@@ -120,21 +136,21 @@ export default {
       })
     },
     // 背景上传
-    handleUpload(params, type) {
+    handleUpload(params) {
       const file = params.file
-      if (type === 0) {
-        const imgType = ['image/png', 'image/jpg', 'image/jpeg']
-        if (imgType.indexOf(file.type) === -1) {
-          this.$message.warning('上传图片格式必须为: png或jpg格式')
-          return false
-        }
-      } else {
-        const videoType = ['video/mp4']
-        if (videoType.indexOf(file.type) === -1) {
-          this.$message.warning('上传视屏格式必须为: mp4格式')
-          return false
-        }
-      }
+      // if (type === 0) {
+      //   const imgType = ['image/png', 'image/jpg', 'image/jpeg']
+      //   if (imgType.indexOf(file.type) === -1) {
+      //     this.$message.warning('上传图片格式必须为: png或jpg格式')
+      //     return false
+      //   }
+      // } else {
+      //   const videoType = ['video/mp4']
+      //   if (videoType.indexOf(file.type) === -1) {
+      //     this.$message.warning('上传视屏格式必须为: mp4格式')
+      //     return false
+      //   }
+      // }
       const formData = new FormData()
       formData.append('file', file)
       formData.append('dir', 'image/background')
@@ -145,9 +161,8 @@ export default {
             const { message, code, data } = res
             if (code === 200) {
               this.fullLoading = false
-              // 域名/storage/ 拼接
-              this.params.content.push('http://api.xysyszhd.dev.xmnk.cn/storage/' + data)
-            } else {
+              const result = data.split('.').pop()
+              this.params.content.push({ url: 'http://api.xysyszhd.dev.xmnk.cn/storage/' + data, isVideo: result === 'mp4' })
               this.$message.error(message)
               this.fullLoading = false
             }
@@ -175,11 +190,48 @@ export default {
   width: 100%;
   height: 100%;
   position: relative;
+  .upload_box{
+    display: flex;
+    justify-content: flex-start;
+    align-content: center;
+    .upload-demo{
+      margin-right:24px;
+    }
+  }
+
+  .imgs_box {
+    width: 100%;
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+    flex-wrap: wrap;
+  }
+
+  .box {
+    .video_box {
+      video {
+        margin-right: 10px;
+      }
+    }
+
+
+  }
+
+  .img_box {
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+  }
 
   .img_item {
     width: 320px;
     height: 180px;
-    margin-right: 24px;
+    // margin-right: 10px;
+  }
+
+  .el-icon-delete {
+    margin:0 24px 0 10px;
+    color: red;
   }
 }
 </style>

+ 1 - 1
src/views/friendlyLinks/list.vue

@@ -1,7 +1,7 @@
 <!-- 友情链接 -->
 <template>
   <div class="content">
-    <div v-loading.fullscreen.lock="loadingFull" />
+    <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
     <div class="search_box flexS">
       <el-input v-model="params.search" clearable placeholder="链接名称" prefix-icon="el-icon-search"
         @keyup.enter.native="toSearch()" @clear="toSearch()" />

+ 1 - 1
src/views/invest/achievement.vue

@@ -1,7 +1,7 @@
 <!-- 招商成果 -->
 <template>
     <div class="content">
-        <div v-loading.fullscreen.lock="loadingFull" />
+        <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
         <div class="search_box flexS">
             <el-select v-model="params.search_act" placeholder="活动名称" class="select" @change="toSearch()" clearable
                 @clear="toSearch()">

+ 1 - 1
src/views/invest/activity.vue

@@ -1,7 +1,7 @@
 <!-- 招商活动 -->
 <template>
     <div class="content">
-        <div v-loading.fullscreen.lock="loadingFull" />
+        <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
         <div class="search_box flexS">
             <el-input v-model="params.search" clearable placeholder="请输入活动名称" prefix-icon="el-icon-search"
                 @keyup.enter.native="toSearch()" @clear="toSearch()" style="width:320px;" />

+ 2 - 6
src/views/module/industry.vue

@@ -1,10 +1,6 @@
 <!-- 动态模块 -->
 <template>
     <div class="content">
-        <div v-loading.fullscreen.lock="loadingFull" />
-        <div class="search_box">
-            <!-- <el-button @click="dialogVisible = true" type="primary" style="margin-right:24px;">添加行业简介</el-button> -->
-        </div>
         <div class="table_box">
             <el-table ref="list" :data="listData" align="center" :header-cell-style="{ background: '#f8fbfc' }"
                 class="tableBorder" border stripe>
@@ -53,7 +49,7 @@
     </div>
 </template>
 <script>
-import { addModule, editModule, deleteModule, moduleCategory, moduleBlock, talentModule, industryModule } from '@/api/module'
+import { addModule, editModule, deleteModule, moduleCategory, industryModule } from '@/api/module'
 import Tinymce from '@/components/Tinymce'
 import { addCategory, editCategory, deleteCategory } from '@/api/category'
 export default {
@@ -237,7 +233,7 @@ export default {
         },
         // 获取列表
         async getList() {
-            this.loadingFull = true
+            // this.loadingFull = true
             try {
                 const res = await industryModule()
                 const { message, code, data } = res

+ 2 - 2
src/views/notice/notice.vue

@@ -1,7 +1,7 @@
-<!-- 知识产权 -->
+<!-- 政策公告-->
 <template>
     <div class="content">
-        <div v-loading.fullscreen.lock="loadingFull" />
+        <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
         <div class="search_box flexS">
             <div v-for="(item, idx) in categoryList" :key="idx">
                 <el-select v-model="params[item.mark]" :placeholder="item.name" class="select" @change="toSearch()"

+ 1 - 1
src/views/workstation/workstation.vue

@@ -1,7 +1,7 @@
 <!-- 知识产权 -->
 <template>
     <div class="content">
-        <div v-loading.fullscreen.lock="loadingFull" />
+        <!-- <div v-loading.fullscreen.lock="loadingFull" /> -->
         <div class="search_box flexS">
             <div v-for="(item, idx) in categoryList" :key="idx">
                 <el-select v-model="params[item.mark]" :placeholder="item.name" class="select" @change="toSearch()"