Kaynağa Gözat

舌象检测修改更友好的错误提示

cc12458 1 yıl önce
ebeveyn
işleme
1cd9cd35a6

+ 2 - 0
miniprogram/app.ts

@@ -9,6 +9,8 @@ App<IAppOption>({
     dictionaries: [],
   },
   onLaunch(options: WechatMiniprogram.App.LaunchShowOption) {
+    console.log('log:AppLaunch-->', options);
+    
     const scene = decodeURIComponent(options.query.scene)
     const params = scene?.split('&').map(item=> item?.split('=')) ?? [];
     const doctorId = params.find(([key])=> ['ys', 'doctorId'].includes(key))?.[1] ?? ''

+ 3 - 3
miniprogram/module/chats/components/message-select/message-select.ts

@@ -31,14 +31,14 @@ Component({
       this.setData({ options });
     },
     'options'(options: AnyArray) {
-      this.setData({ hasSelected: options.some(option => option.checked) });
+      this.setData({ hasSelected: options.filter(option => !option.hide).some(option => option.checked) });
     }
   },
   methods: {
     handleTop(event: HandleEvent) {
       const { mark: { item } } = event;
       if (!item || !this.data.active) return;
-      const index = this.data.options.findIndex(option=>option.id === item.id);
+      const index = this.data.options.findIndex(option => option.id === item.id);
       const multiple = this.data.payload.multiple;
       const checked = !item.checked;
       const options = this._handle(this.data.options, item, index, multiple);
@@ -48,7 +48,7 @@ Component({
     handleSub(event: HandleEvent) {
       const { mark: { item } } = event;
       if (!item || !this.data.active) return;
-      const index = this.data.subOptions.findIndex(option=>option.id === item.id);
+      const index = this.data.subOptions.findIndex(option => option.id === item.id);
       const multiple = this.data.subMultiple;
       const checked = !item.checked;
       const subOptions = this._handle(this.data.subOptions, item, index, multiple);

+ 2 - 1
miniprogram/module/chats/components/message-text/message-text.ts

@@ -5,7 +5,8 @@ Component({
    * 组件的属性列表
    */
   properties: {
-    payload: { type: Object, value: { title: '', loading: false } }
+    payload: { type: Object, value: { title: '', loading: false } },
+    active: { type: Boolean, value: false },
   },
 
   /**

+ 1 - 1
miniprogram/module/chats/components/message-text/message-text.wxml

@@ -7,7 +7,7 @@
     <t-cell t-class="cell-border-gradient">
       <view class="container" slot="title">
         <text>{{payload.title}}</text>
-        <t-loading wx:if="{{payload.loading}}" theme="dots" style="margin-left: 4px;" />
+        <t-loading wx:if="{{active && payload.loading}}" theme="dots" style="margin-left: 4px;" />
       </view>
     </t-cell>
   </view>

+ 8 - 3
miniprogram/module/chats/components/questionnaire/questionnaire.ts

@@ -70,7 +70,7 @@ Component({
           })
           this._next();
         } else {
-          throw {errMsg: `您的健康分析次数已用完,请联系工作人员。`}
+          throw { errMsg: `您的健康分析次数已用完,请联系工作人员。` }
         }
       } catch (error) {
         this._createMessage({
@@ -88,6 +88,7 @@ Component({
       this.triggerEvent('next', { component: 'guide', scroll: true });
     },
     _pre() { },
+    _error(): string | void { },
     async _next() {
       try {
         this._pre();
@@ -107,8 +108,13 @@ Component({
                 });
                 this.triggerEvent('to');
               }
+              this._error = () => {
+                setTimeout(() => this._start(), 20);
+                return `图像检测失败,请重新拍摄上传`
+              }
             } else {
               this._pre = () => { }
+              this._error = () => { };
             }
             if (question.css === 'tongue') {
               this._createMessage({
@@ -160,11 +166,10 @@ Component({
         })
         this.triggerEvent('to');
       } catch (error) {
-        console.log(error);
         const date = Date.now();
         this._createMessage({
           id: `system-${date}`, type: 'system',
-          payload: { date, title: error.errMsg ?? `分析错误,请重试!`, }
+          payload: { date, title: this._error() ?? error.errMsg ?? `分析错误,请重试!`, }
         });
         this._end();
       }