张延森 4 anos atrás
pai
commit
124cbd249e

+ 30
- 0
project.private.config.json Ver arquivo

1
+{
2
+  "setting": {},
3
+  "condition": {
4
+    "plugin": {
5
+      "list": []
6
+    },
7
+    "game": {
8
+      "list": []
9
+    },
10
+    "gamePlugin": {
11
+      "list": []
12
+    },
13
+    "miniprogram": {
14
+      "list": [
15
+        {
16
+          "name": "pages/Index/BookAnswer/index",
17
+          "pathName": "pages/Index/BookAnswer/index",
18
+          "query": "id=087bf13fec3d74e93890f175ec867780",
19
+          "scene": null
20
+        },
21
+        {
22
+          "name": "pages/Mine/MyInfo/index",
23
+          "pathName": "pages/Mine/MyInfo/index",
24
+          "query": "",
25
+          "scene": null
26
+        }
27
+      ]
28
+    }
29
+  }
30
+}

+ 47
- 0
src/components/Picker/index.vue Ver arquivo

1
+<template>
2
+  <picker @change="handleChange" :value="index" :range="range" :range-key="labelKey">
3
+    <slot></slot>
4
+  </picker>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  props: {
10
+    value: undefined,
11
+    range: {
12
+      type: Array,
13
+      default: () => [],
14
+    },
15
+    labelKey: {
16
+      type: String,
17
+      default: 'label',
18
+    },
19
+    valueKey: {
20
+      type: String,
21
+      default: 'value',
22
+    },
23
+  },
24
+
25
+  data () {
26
+    return {
27
+      index: undefined,
28
+    }
29
+  },
30
+
31
+  methods: {
32
+    handleChange (e) {
33
+      if (e?.detail?.value) {
34
+        this.index = e.detail.value - 0
35
+        this.emitChange(this.range[this.index])
36
+      }
37
+    },
38
+
39
+    emitChange (item) {
40
+      // input 事件返回 id
41
+      this.$emit('input', item[this.valueKey])
42
+      // change 事件返回整个对象
43
+      this.$emit('change', item)
44
+    }
45
+  }
46
+}
47
+</script>

+ 18
- 12
src/pages/Index/BookAnswer/index.vue Ver arquivo

4
       <view class="page">
4
       <view class="page">
5
         <scroll-view :scroll-y="true" :enhanced="true" :show-scrollbar="false" style="height: 100%;">
5
         <scroll-view :scroll-y="true" :enhanced="true" :show-scrollbar="false" style="height: 100%;">
6
           <view class="QuestionList" v-if="ArticleInfo.postTestList && ArticleInfo.postTestList !== null && ArticleInfo.postTestList.length">
6
           <view class="QuestionList" v-if="ArticleInfo.postTestList && ArticleInfo.postTestList !== null && ArticleInfo.postTestList.length">
7
-            <view v-for="(item, index) in ArticleInfo.postTestList" :key="index">
7
+            <view class="QuestionItem" v-for="(item, index) in ArticleInfo.postTestList" :key="index">
8
               <view class="Title">
8
               <view class="Title">
9
-                <text>{{item.title}}</text>
9
+                <text>{{getQuestionTitle(item, index)}}</text>
10
               </view>
10
               </view>
11
 
11
 
12
               <checkbox-group @change="CheckboxChange(item, index, $event)" v-if="item.answerType === 'checkbox'" style="padding-top: 10px;">
12
               <checkbox-group @change="CheckboxChange(item, index, $event)" v-if="item.answerType === 'checkbox'" style="padding-top: 10px;">
13
-                <label class="checkbox">
13
+                <label>
14
                   <checkbox value="A" :checked="false" />{{item.optionA}}
14
                   <checkbox value="A" :checked="false" />{{item.optionA}}
15
                 </label>
15
                 </label>
16
-                <label class="checkbox">
16
+                <label>
17
                   <checkbox value="B" :checked="false" />{{item.optionB}}
17
                   <checkbox value="B" :checked="false" />{{item.optionB}}
18
                 </label>
18
                 </label>
19
-                <label class="checkbox">
19
+                <label>
20
                   <checkbox value="C" :checked="false" />{{item.optionC}}
20
                   <checkbox value="C" :checked="false" />{{item.optionC}}
21
                 </label>
21
                 </label>
22
-                <label class="checkbox">
22
+                <label>
23
                   <checkbox value="D" :checked="false" />{{item.optionD}}
23
                   <checkbox value="D" :checked="false" />{{item.optionD}}
24
                 </label>
24
                 </label>
25
               </checkbox-group>
25
               </checkbox-group>
102
     MainPage,
102
     MainPage,
103
     PageBottom
103
     PageBottom
104
   },
104
   },
105
-  created () {
106
-  },
107
-  mounted () {
108
-    this.$nextTick(() => {
109
-    })
110
-  },
111
   methods: {
105
   methods: {
112
     ...mapUserActions([
106
     ...mapUserActions([
113
       'GetArticleDetail'
107
       'GetArticleDetail'
162
           }
156
           }
163
         }
157
         }
164
       }
158
       }
159
+    },
160
+    getQuestionTitle (item, index) {
161
+      let qType = '判断';
162
+      if (item.answerType === 'radio') {
163
+        qType = '单选';
164
+      } else if (item.answerType === 'checkbox') {
165
+        qType = '多选';
166
+      }
167
+
168
+      const qIndex = index + 1
169
+
170
+      return `${qIndex}、[${qType}] ${item.title}`
165
     }
171
     }
166
   }
172
   }
167
 }
173
 }

+ 23
- 15
src/pages/Index/BookAnswer/page.scss Ver arquivo

6
   .QuestionList {
6
   .QuestionList {
7
     position: relative;
7
     position: relative;
8
     overflow: hidden;
8
     overflow: hidden;
9
-    padding: 0 30px;
10
-    > view {
9
+
10
+    > .QuestionItem {
11
       position: relative;
11
       position: relative;
12
       overflow: hidden;
12
       overflow: hidden;
13
       border-bottom: 2px solid #eee;
13
       border-bottom: 2px solid #eee;
14
-      padding: 30px 0;
14
+      padding: 1em;
15
+      background: #fff;
16
+      line-height: 1.6em;
17
+
18
+      & + .QuestionItem {
19
+        margin-top: 1.6em;
20
+      }
21
+
15
       > .Title {
22
       > .Title {
16
         position: relative;
23
         position: relative;
17
         overflow: hidden;
24
         overflow: hidden;
18
         > text {
25
         > text {
19
           font-size: 28px;
26
           font-size: 28px;
20
-          line-height: 40px;
27
+          // line-height: 40px;
21
           display: block;
28
           display: block;
22
         }
29
         }
23
       }
30
       }
35
       > radio-group {
42
       > radio-group {
36
         position: relative;
43
         position: relative;
37
         overflow: hidden;
44
         overflow: hidden;
38
-        > label {
39
-          display: block;
40
-          position: relative;
41
-          overflow: hidden;
45
+      }
46
+
47
+      label {
48
+        display: block;
49
+        position: relative;
50
+        overflow: hidden;
51
+        font-size: 28px;
52
+        white-space: nowrap;
53
+        margin-top: 20px;
54
+        > view {
55
+          display: inline-block;
56
+          vertical-align: middle;
42
           font-size: 28px;
57
           font-size: 28px;
43
-          white-space: nowrap;
44
-          margin-top: 20px;
45
-          > view {
46
-            display: inline-block;
47
-            vertical-align: middle;
48
-            font-size: 28px;
49
-          }
50
         }
58
         }
51
       }
59
       }
52
     }
60
     }

+ 53
- 4
src/pages/Mine/MyInfo/index.vue Ver arquivo

49
           <view class="flex-h">
49
           <view class="flex-h">
50
             <view><text class="Point">*</text>学校</view>
50
             <view><text class="Point">*</text>学校</view>
51
             <view class="flex-item">
51
             <view class="flex-item">
52
-              <input placeholder="请输入学校" v-model="Form.schoolName" />
52
+              <Picker v-model="Form.schoolId" :range="schoolList" @change="handleSchoolChange" label-key="name" value-key="schoolId">
53
+                <text>{{ Form.schoolName || '请选择学校' }}</text>
54
+              </Picker>
55
+            </view>
56
+          </view>
57
+          <view class="flex-h">
58
+            <view><text class="Point">*</text>专业</view>
59
+            <view class="flex-item">
60
+              <Picker v-model="Form.specialtyId" :range="specialtyList" @change="handleSpecialtyChange" label-key="name" value-key="specialtyId">
61
+                <text>{{ Form.specialtyName || '请选择专业' }}</text>
62
+              </Picker>
53
             </view>
63
             </view>
54
           </view>
64
           </view>
55
           <view class="flex-h">
65
           <view class="flex-h">
74
 </template>
84
 </template>
75
 
85
 
76
 <script>
86
 <script>
77
-import MainPage from '../../../components/MainPage'
87
+import MainPage from '@/components/MainPage'
88
+import Picker from '@/components/Picker'
78
 import { createNamespacedHelpers } from 'vuex'
89
 import { createNamespacedHelpers } from 'vuex'
90
+import ToolClass from '@/util/PublicMethod'
91
+import Api from '@/util/Api'
92
+
79
 const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
93
 const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
94
+
80
 export default {
95
 export default {
81
   name: 'MyInfo',
96
   name: 'MyInfo',
82
   data () {
97
   data () {
94
         sex: null,
109
         sex: null,
95
         phone: null,
110
         phone: null,
96
         email: null,
111
         email: null,
112
+        schoolId: null,
97
         schoolName: null,
113
         schoolName: null,
98
         schoolBatch: null,
114
         schoolBatch: null,
115
+        specialtyId: null,
116
+        specialtyName: null,
99
         studentId: null
117
         studentId: null
100
-      }
118
+      },
119
+      schoolList: [],
120
+      specialtyList: [],
101
     }
121
     }
102
   },
122
   },
103
   computed: {
123
   computed: {
106
     })
126
     })
107
   },
127
   },
108
   components: {
128
   components: {
109
-    MainPage
129
+    MainPage,
130
+    Picker,
110
   },
131
   },
111
   created () {
132
   created () {
133
+    this.getSchoolList()
112
   },
134
   },
113
   mounted () {
135
   mounted () {
114
     this.$nextTick(() => {
136
     this.$nextTick(() => {
150
             duration: 2000
172
             duration: 2000
151
           })
173
           })
152
           this.DataLock = false
174
           this.DataLock = false
175
+          Taro.navigateBack({ delta: 1 })
153
         }).catch(() => {
176
         }).catch(() => {
154
           this.DataLock = false
177
           this.DataLock = false
155
         })
178
         })
160
       window.setTimeout(() => {
183
       window.setTimeout(() => {
161
         this.IsPull = false
184
         this.IsPull = false
162
       }, 1000)
185
       }, 1000)
186
+    },
187
+    getSchoolList () {
188
+      ToolClass.ToolRequest({
189
+        ...Api.GetSchoolList,
190
+        success: (res) => {
191
+          this.schoolList = res.data.data
192
+        }
193
+      })
194
+    },
195
+    getSpecialtyList (schoolId) {
196
+      ToolClass.ToolRequest({
197
+        ...Api.GetSpecialtyList,
198
+        queryData: { schoolId },
199
+        success: (res) => {
200
+          this.specialtyList = res.data.data
201
+        }
202
+      })
203
+    },
204
+    handleSchoolChange (school) {
205
+      this.Form.schoolName = school.name
206
+      this.Form.specialtyId = null
207
+      this.Form.specialtyName = null
208
+      this.getSpecialtyList(school.schoolId)
209
+    },
210
+    handleSpecialtyChange (specialty) {
211
+      this.Form.specialtyName = specialty.name
163
     }
212
     }
164
   }
213
   }
165
 }
214
 }

+ 7
- 1
src/util/Api/index.js Ver arquivo

73
   // GetMyBodyCheckList: { // 获取我的体检记录
73
   // GetMyBodyCheckList: { // 获取我的体检记录
74
   //   method: 'get',
74
   //   method: 'get',
75
   //   url: `${prefix}/ma/medical-log`
75
   //   url: `${prefix}/ma/medical-log`
76
-  // }
76
+  // },
77
+  GetSchoolList: {
78
+    url: `${prefix}/ma/school`
79
+  },
80
+  GetSpecialtyList: {
81
+    url: `${prefix}/ma/specialty`
82
+  },
77
 }
83
 }
78
 
84
 
79
 export default Api
85
 export default Api