张延森 4 年之前
父節點
當前提交
124cbd249e

+ 30
- 0
project.private.config.json 查看文件

@@ -0,0 +1,30 @@
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 查看文件

@@ -0,0 +1,47 @@
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 查看文件

@@ -4,22 +4,22 @@
4 4
       <view class="page">
5 5
         <scroll-view :scroll-y="true" :enhanced="true" :show-scrollbar="false" style="height: 100%;">
6 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 8
               <view class="Title">
9
-                <text>{{item.title}}</text>
9
+                <text>{{getQuestionTitle(item, index)}}</text>
10 10
               </view>
11 11
 
12 12
               <checkbox-group @change="CheckboxChange(item, index, $event)" v-if="item.answerType === 'checkbox'" style="padding-top: 10px;">
13
-                <label class="checkbox">
13
+                <label>
14 14
                   <checkbox value="A" :checked="false" />{{item.optionA}}
15 15
                 </label>
16
-                <label class="checkbox">
16
+                <label>
17 17
                   <checkbox value="B" :checked="false" />{{item.optionB}}
18 18
                 </label>
19
-                <label class="checkbox">
19
+                <label>
20 20
                   <checkbox value="C" :checked="false" />{{item.optionC}}
21 21
                 </label>
22
-                <label class="checkbox">
22
+                <label>
23 23
                   <checkbox value="D" :checked="false" />{{item.optionD}}
24 24
                 </label>
25 25
               </checkbox-group>
@@ -102,12 +102,6 @@ export default {
102 102
     MainPage,
103 103
     PageBottom
104 104
   },
105
-  created () {
106
-  },
107
-  mounted () {
108
-    this.$nextTick(() => {
109
-    })
110
-  },
111 105
   methods: {
112 106
     ...mapUserActions([
113 107
       'GetArticleDetail'
@@ -162,6 +156,18 @@ export default {
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 查看文件

@@ -6,18 +6,25 @@
6 6
   .QuestionList {
7 7
     position: relative;
8 8
     overflow: hidden;
9
-    padding: 0 30px;
10
-    > view {
9
+
10
+    > .QuestionItem {
11 11
       position: relative;
12 12
       overflow: hidden;
13 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 22
       > .Title {
16 23
         position: relative;
17 24
         overflow: hidden;
18 25
         > text {
19 26
           font-size: 28px;
20
-          line-height: 40px;
27
+          // line-height: 40px;
21 28
           display: block;
22 29
         }
23 30
       }
@@ -35,18 +42,19 @@
35 42
       > radio-group {
36 43
         position: relative;
37 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 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 查看文件

@@ -49,7 +49,17 @@
49 49
           <view class="flex-h">
50 50
             <view><text class="Point">*</text>学校</view>
51 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 63
             </view>
54 64
           </view>
55 65
           <view class="flex-h">
@@ -74,9 +84,14 @@
74 84
 </template>
75 85
 
76 86
 <script>
77
-import MainPage from '../../../components/MainPage'
87
+import MainPage from '@/components/MainPage'
88
+import Picker from '@/components/Picker'
78 89
 import { createNamespacedHelpers } from 'vuex'
90
+import ToolClass from '@/util/PublicMethod'
91
+import Api from '@/util/Api'
92
+
79 93
 const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
94
+
80 95
 export default {
81 96
   name: 'MyInfo',
82 97
   data () {
@@ -94,10 +109,15 @@ export default {
94 109
         sex: null,
95 110
         phone: null,
96 111
         email: null,
112
+        schoolId: null,
97 113
         schoolName: null,
98 114
         schoolBatch: null,
115
+        specialtyId: null,
116
+        specialtyName: null,
99 117
         studentId: null
100
-      }
118
+      },
119
+      schoolList: [],
120
+      specialtyList: [],
101 121
     }
102 122
   },
103 123
   computed: {
@@ -106,9 +126,11 @@ export default {
106 126
     })
107 127
   },
108 128
   components: {
109
-    MainPage
129
+    MainPage,
130
+    Picker,
110 131
   },
111 132
   created () {
133
+    this.getSchoolList()
112 134
   },
113 135
   mounted () {
114 136
     this.$nextTick(() => {
@@ -150,6 +172,7 @@ export default {
150 172
             duration: 2000
151 173
           })
152 174
           this.DataLock = false
175
+          Taro.navigateBack({ delta: 1 })
153 176
         }).catch(() => {
154 177
           this.DataLock = false
155 178
         })
@@ -160,6 +183,32 @@ export default {
160 183
       window.setTimeout(() => {
161 184
         this.IsPull = false
162 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 查看文件

@@ -73,7 +73,13 @@ const Api = {
73 73
   // GetMyBodyCheckList: { // 获取我的体检记录
74 74
   //   method: 'get',
75 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 85
 export default Api