From e05f762bc8bd7e93db954a748bf15dd2dcb4b0d9 Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期五, 19 十一月 2021 18:07:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 PAMapp/components/Consultant-ques.vue |  106 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 61 insertions(+), 45 deletions(-)

diff --git a/PAMapp/components/Consultant-ques.vue b/PAMapp/components/Consultant-ques.vue
index 084fbfa..4bd6bad 100644
--- a/PAMapp/components/Consultant-ques.vue
+++ b/PAMapp/components/Consultant-ques.vue
@@ -2,48 +2,64 @@
     <div>
         <div class="pam-tags">
             <div class="pb-10" v-for="(qaItem,index) in questionList" :key="index">
-                <el-button  class="tags" :class="{'active': qaItem.selected}"      
-                @click="selectQuestion(index)">                    
+                <el-button  class="tags" :class="{'active': qaItem.selected}"
+                @click="selectQuestion(index)">
                 {{qaItem.name}}
-                </el-button>              
-            </div>    
+                </el-button>
+            </div>
         </div>
-        
+
     </div>
 </template>
+
 <script lang="ts">
-import { Vue, Component, Emit} from 'vue-property-decorator';
+import { Vue, Component, Emit, Prop} from 'vue-property-decorator';
+
 @Component
     export default class ConsultantQues extends Vue{
 
         showDialog = false;
         other = '';
         otherQuestion = '';
-        questionList=[
-            {
-                name:'�摨瑁����',
-                selected:false
-                },
-            {
-                name:'摮戊��',
-                selected:false
-                },
-            {
-                name:'鞈閬��',
-                selected:false
-                },
-            {
-                name:'璅暑��隡�',
-                selected:false
-                },
-            {
-                name:'靽�瑼�/閬��',
-                selected:false
-                },
-            {
-                name:'��靽����',
-                selected:false
-                }       
+
+        @Prop({ default: () => []}) selectedQuestions!: string[];
+
+        get questionList(): any[] {
+          return this.defaultQuestionList.map((question) => {
+            const isSeleted = (quesName: string): boolean => this.selectedQuestions.some((question) => question === quesName);
+            if (isSeleted(question.name)) {
+                question.selected = true;
+              }
+            return question;
+            }
+          );
+        }
+
+        defaultQuestionList = [
+          {
+            name:'�摨瑁����',
+            selected:false
+          },
+          {
+            name:'摮戊��',
+            selected:false
+          },
+          {
+            name:'鞈閬��',
+            selected:false
+          },
+          {
+            name:'璅暑��隡�',
+            selected:false
+          },
+          {
+            name:'靽�瑼�/閬��',
+            selected:false
+          },
+          {
+            name:'��靽����',
+            selected:false
+          }
         ];
 
         @Emit('change')
@@ -57,22 +73,22 @@
 <style lang="scss">
 .con-input{
     input:focus,textarea:focus {
-
     outline: none;
-
     border: 1px solid #ED1B2E;
+  }
+}
 
-}
-}
 .other-input{
     height: 50px;
     width:316px;
     border:1px solid #CCCCCC;
     margin-top: 10px;
 }
+
 .tags{
     height: 47px;
 }
+
 .qa-dialog-footer{
     display: flex;
     justify-content: center;
@@ -110,14 +126,14 @@
 
 @include desktop
 {
-    .pam-tags{
-        display:flex;
-        flex-wrap:wrap;
-        
-    }
-    .tags{
-        margin-right: 10px;
-        height: 47px;
-    }
+  .pam-tags{
+      display:flex;
+      flex-wrap:wrap;
+
+  }
+  .tags{
+      margin-right: 10px;
+      height: 47px;
+  }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0