dedsudiyu месяцев назад: 4
Родитель
Сommit
60b7699cb6
1 измененных файлов с 43 добавлено и 0 удалено
  1. 43 0
      src/views/demo.vue

+ 43 - 0
src/views/demo.vue

@@ -11,9 +11,25 @@
         <H5PlayerVideo v-for="(item,index) in videoList" :key="index" :videoProps="item"></H5PlayerVideo>
       </div>
     </div>
+    <p>apk解析</p>
+    <el-upload
+      style="align-self: center"
+      :before-upload="beforeAvatarUpload"
+      drag
+      accept=".apk"
+      action
+    >
+      <i class="el-icon-upload"></i>
+      <div class="el-upload__text">
+        将文件拖到此处,或
+        <em>点击上传</em>
+      </div>
+    </el-upload>
   </div>
 </template>
 <script>
+  //npm uninstall app-info-parser
+  const ApkParser = require('app-info-parser/src/apk');
   import { iotCameraFindByCondition } from '@/api/basicsModules/index'
   import H5PlayerVideo from '@/components/H5PlayerVideo/H5PlayerVideo.vue'
 
@@ -48,6 +64,33 @@
       offButton(){
         this.$set(this,'openType',false);
       },
+      /**
+       * 获取当前文件
+       */
+      beforeAvatarUpload (file) {
+        console.log(file);
+        const parser = new ApkParser(file);
+        parser
+          .parse()
+          .then((result) => {
+            console.log('result',result)
+            // this.appIcon = result.icon;
+            // this.appVersionCode = result.versionCode;
+            // this.appVersion = result.versionName;
+            // this.appKey = result.package;
+            // this.appName = result.application.label[0];
+            // this.byteSize = file.size / 1024;
+            // let size = file.size; //byte
+            // size = size / 1024; //kb
+            // size = (size / 1024).toFixed(2); //mb
+            // this.appSize = size + 'm';
+            // this.file = file;
+            // this.getFileMD5(file);
+          })
+          .catch((err) => {
+
+          });
+      },
     }
   }
 </script>