chenrui 4 years ago
parent
commit
080efd2aef

+ 1 - 1
.env

@@ -2,4 +2,4 @@ NODE_ENV=production
 VUE_APP_PREVIEW=false
 VUE_APP_API_BASE_URL=https://it.zyucgj.com/zyit/
 VUE_APP_VERSION=V1.0.1
-VUE_APP_PRO_NAME=洗车机运营
+VUE_APP_PRO_NAME=洗车机运营管理平

+ 1 - 1
.env.development

@@ -2,4 +2,4 @@ NODE_ENV=development
 VUE_APP_PREVIEW=true
 VUE_APP_API_BASE_URL=/api
 VUE_APP_VERSION=V1.0.1
-VUE_APP_PRO_NAME=洗车机运营台-dev
+VUE_APP_PRO_NAME=洗车机运营管理平台-dev

+ 1 - 1
.env.preview

@@ -2,4 +2,4 @@ NODE_ENV=production
 VUE_APP_PREVIEW=true
 VUE_APP_API_BASE_URL=http://it.test.zyucgj.com/zyit
 VUE_APP_VERSION=V1.0.1
-VUE_APP_PRO_NAME=洗车机运营台-pro
+VUE_APP_PRO_NAME=洗车机运营管理平台-pro

+ 1 - 1
public/index.html

@@ -5,7 +5,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>logo.png">
-    <title>洗车机运营台</title>
+    <title>洗车机运营管理平台</title>
     <style>#loading-mask{position:fixed;left:0;top:0;height:100%;width:100%;background:#fff;user-select:none;z-index:9999;overflow:hidden}.loading-wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-100%)}.loading-dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:64px;width:64px;height:64px;box-sizing:border-box}.loading-dot i{width:22px;height:22px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.loading-dot i:nth-child(1){top:0;left:0}.loading-dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.loading-dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.loading-dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style>
     <!-- require cdn assets css -->
     <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>

+ 125 - 91
src/components/UploadFile/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="upload-file" :style="{width: maxNums>1?'100%':'auto'}">
-    <a-upload
+    <!-- <a-upload
       :action="action"
       :listType="listType"
       :fileList="fileList"
@@ -22,10 +22,33 @@
     <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
       <video v-if="fileType=='video/mp4'" controls="controls" style="width: 100%" :src="previewImage" />
       <img v-else alt="example" style="width: 100%" :src="previewImage" />
+    </a-modal> -->
+    <a-upload
+      :action="action"
+      list-type="picture-card"
+      :file-list="fileList"
+      @preview="handlePreview"
+      @change="handleChange"
+    >
+      <div v-if="fileList.length < maxNums && listType=='picture-card'">
+        <a-icon type="plus" />
+        <div class="ant-upload-text">{{ upText }}</div>
+      </div>
+    </a-upload>
+    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
+      <img alt="example" style="width: 100%" :src="previewImage" />
     </a-modal>
   </div>
 </template>
 <script>
+  function getBase64(file) {
+    return new Promise((resolve, reject) => {
+      const reader = new FileReader();
+      reader.readAsDataURL(file);
+      reader.onload = () => resolve(reader.result);
+      reader.onerror = error => reject(error);
+    });
+  }
 export default {
   name: 'Upload',
   props: {
@@ -43,9 +66,7 @@ export default {
     },
     previewFile: {
       type: Function,
-      default: function () {
-
-      }
+      default: function () {}
     },
     action: {
       type: String,
@@ -90,101 +111,114 @@ export default {
     }
   },
   methods: {
-    setFileList (a) {
-      const temp = []
-      if (a && a.length > 0) {
-        a.split(',').map((item, index) => {
-          if (item) {
-            temp.push({
-              uid: index,
-              name: item,
-              status: 'done',
-              url: item,
-              response: {
-                data: item
-              }
-            })
-          }
-        })
-      }
-      this.fileList = temp
-    },
-    handleCancel () {
-      this.previewVisible = false
+    handleCancel() {
+      this.previewVisible = false;
     },
-    handlePreview (file) {
-      if (this.listType == 'text') {
-        return
+    async handlePreview(file) {
+      if (!file.url && !file.preview) {
+        file.preview = await getBase64(file.originFileObj);
       }
-      console.log(file,'8888888888')
-      this.previewImage = file.url || file.thumbUrl
-      // this.previewImage = file.response.data
-      this.previewVisible = true
+      this.previewImage = file.url || file.preview;
+      this.previewVisible = true;
     },
-    handleChange ({ file, fileList }) {
-      if (file.status == 'error') {
-        this.$message.error('上传失败,请重试!')
-        return
-      }
-      this.fileList = this.validaFile(file, fileList)
-      this.$emit('change', this.formatFile())
+    handleChange({ fileList }) {
+      this.fileList = fileList;
     },
-    // 格式化文件列表数据,给表单
-    formatFile () {
-      const a = this.fileList
-      const temp = []
-      if (a && a.length) {
-        a.map(item => {
-          if (item.response && item.status == 'done') {
-            temp.push(item.response.data)
-          }
-        })
-      }
-      return temp.join(',')
-    },
-    // 文件校验
-    validaFile (file, filesList) {
-      if (filesList.length == 0) {
-        return []
-      }
+    // setFileList (a) {
+    //   const temp = []
+    //   if (a && a.length > 0) {
+    //     a.split(',').map((item, index) => {
+    //       if (item) {
+    //         temp.push({
+    //           uid: index,
+    //           name: item,
+    //           status: 'done',
+    //           url: item,
+    //           response: {
+    //             data: item
+    //           }
+    //         })
+    //       }
+    //     })
+    //   }
+    //   this.fileList = temp
+    // },
+    // handleCancel () {
+    //   this.previewVisible = false
+    // },
+    // handlePreview (file) {
+    //   if (this.listType == 'text') {
+    //     return
+    //   }
+    //   console.log(file,'8888888888')
+    //   this.previewImage = file.url || file.thumbUrl
+    //   // this.previewImage = file.response.data
+    //   this.previewVisible = true
+    // },
+    // handleChange ({ file, fileList }) {
+    //   if (file.status == 'error') {
+    //     this.$message.error('上传失败,请重试!')
+    //     return
+    //   }
+    //   this.fileList = this.validaFile(file, fileList)
+    //   this.$emit('change', this.formatFile())
+    // },
+    // // 格式化文件列表数据,给表单
+    // formatFile () {
+    //   const a = this.fileList
+    //   const temp = []
+    //   if (a && a.length) {
+    //     a.map(item => {
+    //       if (item.response && item.status == 'done') {
+    //         temp.push(item.response.data)
+    //       }
+    //     })
+    //   }
+    //   return temp.join(',')
+    // },
+    // // 文件校验
+    // validaFile (file, filesList) {
+    //   if (filesList.length == 0) {
+    //     return []
+    //   }
 
-      console.log(file, filesList, this.beforeUpload(file, 0))
-      if (!this.beforeUpload(file, 0) && file.status != 'removed') {
-        const index = filesList.findIndex(item => item.uid == file.uid)
-        filesList.splice(index, 1)
-      }
-      return filesList || []
-    },
-    // 上传前校验
-    beforeUpload (file, tip) {
-      // 不限制
-      if (this.fileType == '*') {
-        return true
-      }
+    //   console.log(file, filesList, this.beforeUpload(file, 0))
+    //   if (!this.beforeUpload(file, 0) && file.status != 'removed') {
+    //     const index = filesList.findIndex(item => item.uid == file.uid)
+    //     filesList.splice(index, 1)
+    //   }
+    //   return filesList || []
+    // },
+    // // 上传前校验
+    // beforeUpload (file, tip) {
+    //   // 不限制
+    //   if (this.fileType == '*') {
+    //     return true
+    //   }
 
-      const isType = this.fileType.indexOf(file.type) >= 0 && file.type != ''
-      if (!isType) {
-        if (tip != 0) {
-          this.$message.error('请上传正确的格式!')
-        }
-        return isType
-      }
+    //   const isType = this.fileType.indexOf(file.type) >= 0 && file.type != ''
+    //   if (!isType) {
+    //     if (tip != 0) {
+    //       this.$message.error('请上传正确的格式!')
+    //     }
+    //     return isType
+    //   }
 
-      // 文件大小
-      const isLt2M = file.size / 1024 / 1024 < this.fileSize
-      if (!isLt2M ) {
-        if (tip != 0) {
-          if (this.fileType !='video/mp4') {
-            this.$message.error('图片不能超过 ' + this.fileSize + 'MB!')
-          } else {
-            this.$message.error('视频不能超过 ' + this.fileSize + 'MB!')
-          }
-        }
-        return isLt2M
-      }
+    //   // 文件大小
+    //   const isLt2M = file.size / 1024 / 1024 < this.fileSize
+    //   if (!isLt2M ) {
+    //     if (tip != 0) {
+    //       if (this.fileType !='video/mp4') {
+    //         this.$message.error('图片不能超过 ' + this.fileSize + 'MB!')
+    //       } else {
+    //         this.$message.error('视频不能超过 ' + this.fileSize + 'MB!')
+    //       }
+    //     }
+    //     return isLt2M
+    //   }
 
-      return true
-    }
+    //   return true
+    // }
   }
 }
 </script>

+ 1 - 1
src/components/global.less

@@ -407,7 +407,7 @@ body {
 
     h1 {
       color: #fff;
-      font-size: 20px;
+      font-size: 16px;
       margin: 0 0 0 12px;
       font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
       font-weight: 600;

+ 1 - 1
src/config/router.config.js

@@ -62,7 +62,7 @@ export const asyncRouterMap = [{
       name: 'CarWashManagement',
       component: () => import('@/views/CarWashManagement/CarWashManagement.vue'),
       meta: {
-        title: '洗车管理',
+        title: '洗车网点管理',
         icon: 'database'
         // permission: 'M_sys_dataDictionary'
       }

+ 1 - 1
src/utils/domUtil.js

@@ -16,4 +16,4 @@ export const setDocumentTitle = function (title) {
   }
 }
 
-export const domTitle = '洗车机运营台'
+export const domTitle = '洗车机运营管理平台'

+ 1 - 1
src/views/Home.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="home">
-    <a-alert message="欢迎登录洗车机运营台系统" type="info" showIcon />
+    <a-alert message="欢迎登录洗车机运营管理平台系统" type="info" showIcon />
   </div>
 </template>