xuqiaoying 3 anni fa
parent
commit
cad8d367dd
2 ha cambiato i file con 29 aggiunte e 30 eliminazioni
  1. 21 25
      pages2/appointment/order.vue
  2. 8 5
      pages2/exam/signCommit.vue

+ 21 - 25
pages2/appointment/order.vue

@@ -329,20 +329,36 @@ export default {
               return
             } else {
               // await this.submitApi()
-                uni.request({
-                  url: this.commitment_electr_signature, //临时路径
-                  responseType: 'arraybuffer', //设置返回的数据格式为arraybuffer
+                uni.getFileSystemManager().readFile({
+                  filePath: this.commitment_electr_signature, //临时路径
+                  encoding: 'base64', //编码格式
                   success: res => {
-                    const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
+                    console.log('返回结果', res)
+                    const base64 = "data:image/png;base64," + res.data
                     console.log('sfs签名转成base64', base64)
                     this.baseAddress = base64
+                    // return
                     this.submits()
                   },
                   fail: err => {
-                    console.log(err)
+                    console.log('转base64错误', err)
                     this.isUploading = false
                   }
                 })
+                // uni.request({
+                //   url: this.commitment_electr_signature, //临时路径
+                //   responseType: 'arraybuffer', //设置返回的数据格式为arraybuffer
+                //   success: res => {
+                //     const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
+                //     console.log('sfs签名转成base64', base64)
+                //     this.baseAddress = base64
+                //     this.submits()
+                //   },
+                //   fail: err => {
+                //     console.log('转base64错误', err)
+                //     this.isUploading = false
+                //   }
+                // })
             }
           } else {
             this.submits()
@@ -459,26 +475,6 @@ export default {
           
       });
     },
-     //提交表单
-    // async submitApi() {
-    //   if (this.commitment_electr_signature) {
-    //     // this.commitment_electr_signature = await this.$method.uploadFile(
-    //     //   this.commitment_electr_signature,
-    //     //   0
-    //     // );
-    //      var res = await uni.request({
-    //       url: this.commitment_electr_signature, //临时路径
-    //       responseType: 'arraybuffer', //设置返回的数据格式为arraybuffer
-    //       success: res => {
-    //         const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
-    //         console.log('sfs签名转成base64', base64)
-    //         this.baseAddress = base64
-    //       }
-    //     })
-    //     console.log('----commitment_electr_signature',res, this.commitment_electr_signature)
-    //   }
-
-    // },
   },
 };
 </script>

+ 8 - 5
pages2/exam/signCommit.vue

@@ -136,13 +136,16 @@ export default {
             this.isUploading = false
             return
         } else {
-            uni.request({
-                url: this.commitment_electr_signature, //临时路径
-                responseType: 'arraybuffer', //设置返回的数据格式为arraybuffer
+
+            uni.getFileSystemManager().readFile({
+                filePath: this.commitment_electr_signature, //临时路径
+                encoding: 'base64', //编码格式
                 success: res => {
-                    const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
+                    console.log('返回结果', res)
+                    const base64 = "data:image/png;base64," + res.data
                     console.log('sfs签名转成base64', base64)
                     this.baseAddress = base64
+                    // return
                     this.$http({
                         url: '/apply/signReport',
                         method: 'post',
@@ -165,7 +168,7 @@ export default {
                     })
                 },
                 fail: err => {
-                    console.log(err)
+                    console.log('转base64错误', err)
                     this.isUploading = false
                 }
             })