Przeglądaj źródła

feat:完善信息收集二维码

ljc 2 miesięcy temu
rodzic
commit
6358d31e0d
3 zmienionych plików z 31 dodań i 27 usunięć
  1. 14 18
      pages/mine/improveImmediately.vue
  2. 2 2
      service/personal.ts
  3. 15 7
      utils/request.js

+ 14 - 18
pages/mine/improveImmediately.vue

@@ -244,7 +244,7 @@
               </uni-forms-item>
               <uni-row class="demo-uni-row uni-row1">
                 <uni-col :xs="24" :sm="24" :md="10" :lg="10" :xl="10">
-                  <cwg-file-picker
+                  <cwg-file-picker-wrapper
                     v-model="fileListID1.path"
                     :editable="fileListID1.status != 2"
                     :limit="1"
@@ -275,7 +275,7 @@
                         <image class="icon" :src="icon_doc" />
                       </view>
                     </view>
-                  </cwg-file-picker>
+                  </cwg-file-picker-wrapper>
 <!--                  <view v-else>-->
 <!--                    <view class="file-item">-->
 <!--                      <image-->
@@ -291,7 +291,7 @@
 <!--                  </view>-->
                 </uni-col>
                 <uni-col :xs="24" :sm="24" :md="10" :lg="10" :xl="10">
-                  <cwg-file-picker
+                  <cwg-file-picker-wrapper
                     v-model="fileListID2.path"
                     :editable="fileListID2.status != 2"
                     :limit="1"
@@ -322,7 +322,7 @@
                         <image class="icon" :src="icon_doc" />
                       </view>
                     </view>
-                  </cwg-file-picker>
+                  </cwg-file-picker-wrapper>
                 </uni-col>
                 <uni-col :xs="24" :sm="24" :md="4" :lg="4" :xl="4">
                   <view class="refresh">
@@ -424,7 +424,7 @@
               </view>
               <uni-row class="demo-uni-row uni-row1">
                 <uni-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16">
-                  <cwg-file-picker
+                  <cwg-file-picker-wrapper
                     v-model="fileListAdd1.path"
                     :editable="fileListAdd1.status != 2"
                     :limit="1"
@@ -455,7 +455,7 @@
                         <image class="icon" :src="icon_doc" />
                       </view>
                     </view>
-                  </cwg-file-picker>
+                  </cwg-file-picker-wrapper>
                 </uni-col>
                 <uni-col :xs="24" :sm="24" :md="4" :lg="4" :xl="4">
                   <view class="refresh">
@@ -531,7 +531,7 @@
                   <view class="fileList">
                     <view id="files" v-for="(item,index) in fileListOthers" :key="index">
 
-                      <cwg-file-picker
+                      <cwg-file-picker-wrapper
                         customClass="list_upload"
                         v-model="item.path"
                         :editable="item.status != 2"
@@ -559,7 +559,7 @@
                             <image class="icon" :src="icon_doc" />
                           </view>
                         </view>
-                      </cwg-file-picker>
+                      </cwg-file-picker-wrapper>
                       <view class="options">
                         <u-button
                           style="margin-right: 20px;"
@@ -1286,7 +1286,7 @@
         uni.showToast({ title: res.msg, icon: 'none' })
       }
     } catch (error: any) {
-      uni.showToast({ title: error.message || t('Msg.SystemError'), icon: 'none' })
+      uni.showToast({ title: error.message, icon: 'none' })
     }
   }
 
@@ -1310,7 +1310,7 @@
         }
       }
     } catch (error: any) {
-      uni.showToast({ title: error.message || t('Msg.SystemError'), icon: 'none' })
+      uni.showToast({ title: error.message, icon: 'none' })
     }
   }
 
@@ -1336,7 +1336,6 @@
         }
       }
     } catch (error: any) {
-      uni.showToast({ title: error.message || t('Msg.SystemError'), icon: 'none' })
     }
   }
 
@@ -1351,7 +1350,6 @@
         cities.value = res.data
       }
     } catch (error: any) {
-      uni.showToast({ title: error.message || t('Msg.SystemError'), icon: 'none' })
     }
   }
 
@@ -1370,20 +1368,18 @@
         uni.showToast({ title: t('Msg.SystemError'), icon: 'none' })
       }
     } catch (error: any) {
-      uni.showToast({ title: error.message || t('Msg.SystemError'), icon: 'none' })
+
     }
   }
 
   // 获取二维码
   async function getMobileInfo() {
     try {
-      let res = await personalApi.CustomFileMobileFiles({
-        responseType: 'arraybuffer',
-      })
+      let res = await personalApi.CustomFileMobileFiles({}, { responseType: 'arraybuffer' })
       // console.log(res);
       mobile.value = 'data:image/png;base64,' + uni.arrayBufferToBase64(res)
     } catch (error: any) {
-      uni.showToast({ title: error.message || t('Msg.SystemError'), icon: 'none' })
+      // uni.showToast({ title: error.message , icon: 'none' })
     }
   }
 
@@ -1958,4 +1954,4 @@
       color: #999;
     }
   }
-</style>
+</style>

+ 2 - 2
service/personal.ts

@@ -10,9 +10,9 @@ export const personalApi = {
   /** 获取新闻分析列表 */
   newsAnalysisList: (params = {}) => post('/news/analysis/search/list', params, 'Host80'),
   /** 获取二维码 */
-  CustomFileMobile: (params = {}) => get('/custom/bank/mobile', params, 'Host80'),
+  CustomFileMobile: (params = {}) => get('/custom/bank/mobile', params, 'Host80',{ responseType: 'arraybuffer' }),
   /** 获取二维码-flies */
-  CustomFileMobileFiles: (params = {}) => get('/custom/file/mobile', params, 'Host80'),
+  CustomFileMobileFiles: (params = {}) => get('/custom/file/mobile', params, 'Host80',{ responseType: 'arraybuffer' }),
   /** 银行列表 */
   BankList: (params = {}) => post('/bank/list', params, 'Host80'),
   /** 银行卡列表 */

+ 15 - 7
utils/request.js

@@ -43,11 +43,12 @@ const requestInterceptor = (config) => {
   const userStore = useUserStore();
   const cId = userStore.userInfo?.cId;
 
-  if (config.method === "get") {
-    config.params = { ...config.params, cId };
-  } else {
-    config.data = { ...config.data, cId };
-  }
+  const method = String(config.method || "GET").toUpperCase();
+  if (method === "GET") {
+    config.data = { ...(config.data || {}), cId };
+  } else {
+    config.data = { ...(config.data || {}), cId };
+  }
   if (!config.header["Content-Type"]) {
     config.header["Content-Type"] = "application/json";
   }
@@ -59,6 +60,9 @@ const responseInterceptor = (response, options = {}) => {
   const { data, statusCode } = response;
   // 处理业务错误
   if (statusCode === 200) {
+    if (options.responseType === "arraybuffer" || data instanceof ArrayBuffer) {
+      return data;
+    }
     // 1. 捕获 401 未授权错误
     if (data.code === 401 || data.code === 600) {
       // 关键:判断当前页面是否为登录页,避免循环跳转
@@ -308,12 +312,16 @@ export const uploadFile = (url, file, data = {}, header = {}, checkCode = true)
 };
 
 // 快捷方法
-export const get = (url, data = {}, options = {}) => {
+export const get = (url, data = {}, typeOrOptions = {}, options = {}) => {
+  const mergedOptions =
+    typeof typeOrOptions === "string"
+      ? { type: typeOrOptions, ...(options || {}) }
+      : (typeOrOptions || {});
   return request({
     url,
     method: "GET",
     data,
-    ...options,
+    ...mergedOptions,
   });
 };