Browse Source

fix(expenses.vue):更改文件大小加兼容safari

liyangbin 2 years ago
parent
commit
3e557ebba0
1 changed files with 17 additions and 16 deletions
  1. 17 16
      pages/members/me/expenses.vue

+ 17 - 16
pages/members/me/expenses.vue

@@ -38,9 +38,9 @@
           <span v-html="scope.row.outFilename"></span>
         </template>
       </el-table-column>
-      <el-table-column prop="size" label="文件大小" align="center">
+      <el-table-column prop="convertSize" label="文件大小" align="center">
         <template slot-scope="scope">
-          <span v-html="scope.row.size"></span>
+          <span v-html="scope.row.convertSize"></span>
         </template>
       </el-table-column>
       <el-table-column prop="price" label="消耗券数" align="center">
@@ -150,7 +150,7 @@ export default {
           for (let i = 0; i < this.tableData.length; i++) {
             this.$set(this.tableData[i], 'format', this.getFormat(this.tableData[i].inputType, this.tableData[i].outputType))
             this.tableData[i].outFilename = this.getFileFileName(this.tableData[i].outFilename,this.tableData[i].statusName,this.tableData[i])
-            this.tableData[i].size = this.getfilesize(this.tableData[i].size,this.tableData[i].status)
+            this.tableData[i].convertSize = this.getfilesize(this.tableData[i].convertSize,this.tableData[i].status)
             this.tableData[i].price = this.getfilePrice(this.tableData[i].price,this.tableData[i].status)
             this.tableData[i].status = this.getFileStatus(this.tableData[i].status)
           }
@@ -158,28 +158,28 @@ export default {
       })
     },
     // 计算文件大小函数(保留两位小数),Size为字节大小
-    getfilesize (size,status) {
+    getfilesize (convertSize,status) {
       if(status=== 3){
         return `<span style="color: #9599b1">0KB</span>`
       }
-      if (!size) {
+      if (!convertSize) {
         return "0KB"
       }
       const num = 1024.00 // byte
-      if (size < num) {
-        return size + "B"
+      if (convertSize < num) {
+        return convertSize + "B"
       }
-      if (size < Math.pow(num, 2)) {
-        return (size / num).toFixed(2) + "KB"
+      if (convertSize < Math.pow(num, 2)) {
+        return (convertSize / num).toFixed(2) + "KB"
       }
-      if (size < Math.pow(num, 3)) {
-        return (size / Math.pow(num, 2)).toFixed(2) + "MB"
+      if (convertSize < Math.pow(num, 3)) {
+        return (convertSize / Math.pow(num, 2)).toFixed(2) + "MB"
       }
-      if (size < Math.pow(num, 4)) {
-        return (size / Math.pow(num, 3)).toFixed(2) + "GB"
+      if (convertSize < Math.pow(num, 4)) {
+        return (convertSize / Math.pow(num, 3)).toFixed(2) + "GB"
       }
       else {
-        return (size / Math.pow(num, 4)).toFixed(2) + "TB"
+        return (convertSize / Math.pow(num, 4)).toFixed(2) + "TB"
       }
     },
     //计算文件消耗劵
@@ -382,7 +382,8 @@ export default {
     color: #333;
   }
   .style-ellipsis{
-    // width:100%;
+    width:100%;
+    display: inline-block;
     white-space: nowrap!important;
 	  overflow:hidden;
 	  text-overflow:ellipsis;
@@ -406,7 +407,7 @@ export default {
   opacity: 0.5;
   pointer-events: none;
 }
-::v-deep.el-table__body {
+::v-deep .el-table__body {
   // 使表格兼容safari,不错位
   // width: 100%;
   table-layout: fixed !important;