Browse Source

格式转换判断登录态,转档记录删除按钮调整

wzl 2 years ago
parent
commit
741ed67b80
2 changed files with 74 additions and 16 deletions
  1. 48 9
      pages/converter.vue
  2. 26 7
      pages/members/me/expenses.vue

+ 48 - 9
pages/converter.vue

@@ -32,11 +32,11 @@ class="mt-20px text-[#4D4D4D] text-16px font-600 inline-flex items-center leadin
             <span aria-hidden="true">×</span>
           </button>
           <div class="recharge py-0 px-[10%] h-48px mx-0 mt-24px mb-14px absolute right-0 -top-70px z-2">
-            <span class="recharge-btn float-right bg-white border border-[#ff4f4f] boder-solid text-16px py-7px px-18px rounded-4px mt-4px cursor-pointer hover:bg-[#ff4f4f]">
-              <a class="text-[#ff4f4f] no-underline leading-normal" @click="handlerBuy('ticket')">充值</a>
+            <span @click="handlSubmit($event, 'buy')" class="recharge-btn float-right bg-white border border-[#ff4f4f] boder-solid text-16px py-7px px-18px rounded-4px mt-4px cursor-pointer hover:bg-[#ff4f4f]">
+              <a class="text-[#ff4f4f] no-underline leading-normal">充值</a>
             </span>
             <div class="need-volume float-right right-48px text-16px text-[#666] leading-48px mr-20px">
-              所需券:<span class="text-[#0dd299] text-16px" :class="{'text-red-500': requiredCoupon > userInfo?.points}">{{ requiredCoupon }}券</span> / 剩余券:<span class="text-[#0dd299] text-16px">{{ userInfo?.points }}券</span>
+              所需券:<span class="text-[#0dd299] text-16px" :class="{'text-red-500': requiredCoupon > userInfo?.points}">{{ requiredCoupon }}券</span> / 剩余券:<span class="text-[#0dd299] text-16px">{{ userInfo.points ? userInfo.points : 0 }}券</span>
             </div>
           </div>
           <div class="transfer-panel">
@@ -107,9 +107,9 @@ class="mt-20px text-[#4D4D4D] text-16px font-600 inline-flex items-center leadin
                     <div class="input-group-btn relative text-0px whitespace-nowrap !flex">
                       <div tabindex="500" class="btn btn-file" :class="{'btn-file-left' : fileList.length > 0}">
                         <div class="add-file" :class="{'add-file-left':(fileList.length > 0)}">{{ fileList.length > 0 ? '添加文件' : '' }}</div>
-                        <input
-id="fileinput-explorer" ref="file" name="file" accept=".pdf" title="上传文件" type="file" multiple="" class="absolute top-0 right-0 p-0 m-0 min-w-[100%] h-[100%] w-90px text-right opacity-0 bg-none bg-repeat bg-scroll block outline-none border-0 cursor-pointer"
-                        @change="addFile($event)"/>
+                        <input id="fileinput-explorer" ref="file" name="file" accept=".pdf" title="上传文件" type="file" multiple=""
+                        class="absolute top-0 right-0 p-0 m-0 min-w-[100%] h-[100%] w-90px text-right opacity-0 bg-none bg-repeat bg-scroll block outline-none border-0 cursor-pointer"
+                        @change="addFile($event)" @click="handlSubmit($event, '')"/>
                       </div>
                       <div v-if="fileList.length > 0" class="inline-block ml-30px bg-white border border-[#ff4f4f] boder-solid text-16px py-7px px-18px rounded-4px mt-4px cursor-pointer text-[#ff4f4f] leading-normal hover:bg-[#ff4f4f] hover:text-white" @click="deleteAllFile">清空</div>
                     </div>
@@ -120,7 +120,7 @@ id="fileinput-explorer" ref="file" name="file" accept=".pdf" title="上传文件
 
             <div class="transfer-btn mt-30px h-64px text-center">
               <div class="cursor-not-allowed inline-block">
-                <span :class="{'disabledBtn' : !checkbox || !changeFileFlag }" class="btn transfer-start-btn bg-[#ff524f] text-20px py-0 px-150px rounded-4px h-60px w-386px text-white hover:bg-[#f34545]" @click="createFileMission">
+                <span :class="{'disabledBtn' : !checkbox || !changeFileFlag }" class="btn transfer-start-btn bg-[#ff524f] text-20px py-0 px-150px rounded-4px h-60px w-386px text-white hover:bg-[#f34545]" @click="handlSubmit($event, 'change')">
                   <a class="text-white leading-60px">{{ !changeFileFlag ? '转换中...' : '开始转换' }}</a>
                   <span v-if="!changeFileFlag" class="loading"></span>
                 </span>
@@ -281,6 +281,17 @@ id="fileinput-explorer" ref="file" name="file" accept=".pdf" title="上传文件
         <span class="inline-block w-[100%] text-14px my-6px mx-0">使用更便捷</span>
       </div>
     </div>
+    <el-dialog :visible.sync="visiable" :close-on-click-modal="false" :close-on-press-escape="false" width="480px" append-to-body center>
+      <div class="changepwd-tittle">
+        <p class="text-20px text-center text-$btn-color-primary">提示</p>
+      </div>
+      <div class="text-16px text-[#707070] text-center my-30px">
+        您还未登录或注册,请先
+        <span class="text-$btn-color-primary cursor-pointer" @click="login">登录</span>
+        或
+        <span class="text-$btn-color-primary cursor-pointer" @click="register">注册</span>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -296,7 +307,8 @@ export default {
       uploadNum: 0,
       getFileStatusTimer: null,
       changeSucesssNumTotal: 0,
-      changeSucesssFileList: []
+      changeSucesssFileList: [],
+      visiable: false
     }
   },
   // middleware: 'user',
@@ -325,6 +337,9 @@ export default {
       for (let i = 0; i < this.fileList.length; i++) {
         total += this.fileList[i].price
       }
+      if (this.userInfo.subscriberType !== null && this.userInfo.subscriberType === 1) {
+        total = 0
+      }
       return total
     }
   },
@@ -334,6 +349,30 @@ export default {
     }
   },
   methods: {
+    handlSubmit(event, type) {
+      if (!this.$store.state.token) {
+        event.preventDefault()
+        this.visiable = true
+        return
+      }
+      if (type === 'buy') {
+        this.handlerBuy('ticket')
+      } else if (type === 'change') {
+        this.createFileMission()
+      }
+      // this.$store.commit('OPEN_LOGIN', true)
+      // this.$store.commit('SET_INTERFACE', 'vip')
+    },
+    login() {
+      this.visiable = false
+      this.$store.commit('OPEN_LOGIN', true)
+      this.$store.commit('SET_INTERFACE', 'login')
+    },
+    register() {
+      this.visiable = false
+      this.$store.commit('OPEN_LOGIN', true)
+      this.$store.commit('SET_INTERFACE', 'register')
+    },
     // 充值弹框
     handlerBuy(type) {
       this.$store.commit('OPEN_LOGIN', true)
@@ -342,7 +381,7 @@ export default {
     // 添加文件
     async addFile (event) {
       // 阻止发生默认行为
-      event.preventDefault();
+      event.preventDefault()
       const array = event.target.files
       const defaultPrice = await this.getFilePrice('pdf', 'docx')
       for (let i = 0; i < array.length; i++) {

+ 26 - 7
pages/members/me/expenses.vue

@@ -150,11 +150,15 @@ export default {
     getFormat (input, output) {
       return input.toUpperCase() + '-->' + output.toUpperCase()
     },
+    // 选中的数据行
     handleSelectionChange(val) {
       this.tableDataSelection = val
-      this.isDelete = false
+      if (this.tableDataSelection.length === 0) {
+        this.isDelete = true
+      } else {
+        this.isDelete = false
+      }
       for (const file of this.tableDataSelection) {
-        console.log(file.status)
         if (file.status === '转档中' || file.status === '转档失败') {
           this.isDownload = true
         } else {
@@ -180,15 +184,30 @@ export default {
         }
       })
     },
+    // 分页器
     handleCurrentChange(val) {
       this.getChangeFileRecord(val)
     },
+    // 下载文件
     downloadFiles () {
-      for (const file of this.tableDataSelection) {
-        if (file.status !== 2 || file.status !== 4) {
-          this.isDownload = true
-        }
-      }
+      // for (const file of this.tableDataSelection) {
+      //   if (file.status !== 2 || file.status !== 4) {
+      //     this.isDownload = true
+      //   }
+      // }
+      this.tableDataSelection.forEach(item => {
+        this.downloadFile(item.path)
+      })
+    },
+    downloadFile (url) {
+      const iframe = document.createElement("iframe");
+      iframe.style.display = "none";  // 防止影响页面
+      iframe.style.height = 0;  // 防止影响页面
+      iframe.src = url;
+      document.body.appendChild(iframe);
+      setTimeout(()=>{
+        iframe.remove();
+      }, 5 * 60 * 1000);
     }
   }
 }