Commit de222c84f9b3745b967e69fa48c8a29e623a11e2
1 parent
0a329040
Exists in
master
fix: 个人中心添加学生按钮显示
Showing
5 changed files
with
695 additions
and
2 deletions
 
Show diff stats
.gitignore
| ... | ... | @@ -0,0 +1,298 @@ | 
| 1 | +<template> | |
| 2 | + <div> | |
| 3 | + <div id="prefect_box"> | |
| 4 | + <img class="bg" src="../assets/msg.png" alt=""> | |
| 5 | + <div class="content"> | |
| 6 | + <div class="item"> | |
| 7 | + <input type="text" placeholder="请输入您的姓名" v-model="studentName"> | |
| 8 | + </div> | |
| 9 | + <div class="item" @click="handleYear"> | |
| 10 | + <p :class="!year||yearDisable?'nodata':''">{{year?year:'请选择当前所处高中年级'}}</p> | |
| 11 | + <img src="../assets/more.png" alt=""> | |
| 12 | + </div> | |
| 13 | + <div class="item" @click="showAreaSelect = true"> | |
| 14 | + <p :class="!area?'nodata':''">{{area?area:'请选择地区'}}</p> | |
| 15 | + <img src="../assets/more.png" alt=""> | |
| 16 | + </div> | |
| 17 | + <div class="item" @click="handleSchool"> | |
| 18 | + <p :class="!school?'nodata':''">{{school?school:'请选择学校'}}</p> | |
| 19 | + <img src="../assets/more.png" alt=""> | |
| 20 | + </div> | |
| 21 | + <div class="tip"> | |
| 22 | + <img src="../assets/tip2.png" alt=""> | |
| 23 | + <p>所处高中年级与会员有效期相关,请认真填写</p> | |
| 24 | + </div> | |
| 25 | + <button class="submit" @click="submit">完成</button> | |
| 26 | + </div> | |
| 27 | + </div> | |
| 28 | + <van-popup v-model="showYearSelect" round position="bottom" get-container="body" :safe-area-inset-bottom="true"> | |
| 29 | + <van-picker title="当前所处高中年级" show-toolbar :columns="yearArr" value-key="label" @cancel="showYearSelect = false" @confirm="selectYearOver" /> | |
| 30 | + </van-popup> | |
| 31 | + <van-popup v-model="showAreaSelect" round position="bottom" get-container="body" :safe-area-inset-bottom="true"> | |
| 32 | + <van-area title="地区" :area-list="areaList" @cancel="showAreaSelect = false" @confirm="selectAreaOver" /> | |
| 33 | + </van-popup> | |
| 34 | + <van-popup v-model="showSchoolSelect" round position="bottom" get-container="body" :safe-area-inset-bottom="true"> | |
| 35 | + <van-picker title="学校" show-toolbar :columns="schoolList" @cancel="showSchoolSelect = false" @confirm="selectSchoolOver" /> | |
| 36 | + </van-popup> | |
| 37 | + </div> | |
| 38 | +</template> | |
| 39 | + | |
| 40 | +<script> | |
| 41 | + | |
| 42 | +export default { | |
| 43 | + data () { | |
| 44 | + return { | |
| 45 | + studentName: '', | |
| 46 | + year: '', | |
| 47 | + yearDisable: false, | |
| 48 | + showYearSelect: false, | |
| 49 | + yearArr: [], | |
| 50 | + area: '', | |
| 51 | + areaCode: '', | |
| 52 | + showAreaSelect: false, | |
| 53 | + areaList: [], | |
| 54 | + school: '', | |
| 55 | + schoolId: '', | |
| 56 | + showSchoolSelect: false, | |
| 57 | + schoolList: [], | |
| 58 | + } | |
| 59 | + }, | |
| 60 | + | |
| 61 | + mounted () { | |
| 62 | + let userInfo = sessionStorage.getItem('userInfo') | |
| 63 | + this.userInfo = userInfo ? JSON.parse(userInfo) : userInfo; | |
| 64 | + this.studentName = this.userInfo?.studentName; | |
| 65 | + this.initYearArr() | |
| 66 | + this.GetSysAreaList() | |
| 67 | + }, | |
| 68 | + methods: { | |
| 69 | + // 初始化入学年份选项 | |
| 70 | + initYearArr () { | |
| 71 | + // 页面创建时执行 | |
| 72 | + let year = new Date().getFullYear(), | |
| 73 | + Month = new Date().getMonth() + 1, | |
| 74 | + yearArr = []; | |
| 75 | + // if (Month > 8) { | |
| 76 | + // // 如果月份大于8,那么当年的学年的高考年份要+1,如果月份小于7,那么当前的年份就是今年高考的年份 | |
| 77 | + // year = year + 1 | |
| 78 | + // } | |
| 79 | + for (let index = year - 2; index < year + 1; index++) { | |
| 80 | + yearArr.push({ value: index, label: '' }) | |
| 81 | + } | |
| 82 | + yearArr[0].label = `高三(${yearArr[0].value})级`; | |
| 83 | + yearArr[1].label = `高二(${yearArr[1].value})级`; | |
| 84 | + yearArr[2].label = `高一(${yearArr[2].value})级`; | |
| 85 | + this.yearArr = yearArr | |
| 86 | + if (this.userInfo?.year) { | |
| 87 | + for (let i in yearArr) { | |
| 88 | + if (yearArr[i].value == this.userInfo.year) { | |
| 89 | + this.year = yearArr[i].label | |
| 90 | + this.yearDisable = true | |
| 91 | + } | |
| 92 | + } | |
| 93 | + } | |
| 94 | + }, | |
| 95 | + selectYearOver (value) { | |
| 96 | + this.year = value.label; | |
| 97 | + this.showYearSelect = false; | |
| 98 | + }, | |
| 99 | + handleYear () { | |
| 100 | + if (!this.yearDisable) { | |
| 101 | + this.showYearSelect = true; | |
| 102 | + } | |
| 103 | + }, | |
| 104 | + // 获取地区列表 | |
| 105 | + GetSysAreaList () { | |
| 106 | + this.http.GetSysAreaList({ | |
| 107 | + areaCode: 33 | |
| 108 | + }).then((res) => { | |
| 109 | + if (res.success) { | |
| 110 | + let data = res.data; | |
| 111 | + let obj = { | |
| 112 | + province_list: { | |
| 113 | + 330000: '浙江省' | |
| 114 | + }, | |
| 115 | + city_list: {}, | |
| 116 | + county_list: {} | |
| 117 | + }; | |
| 118 | + if (data) { | |
| 119 | + data.forEach((n, i) => { | |
| 120 | + obj.city_list[n.area_code + '00'] = n.area_name; | |
| 121 | + if (n.areaList.length > 0) { | |
| 122 | + n.areaList.forEach((k, j) => { | |
| 123 | + obj.county_list[k.area_code] = k.area_name; | |
| 124 | + }) | |
| 125 | + } | |
| 126 | + }); | |
| 127 | + this.areaList = obj; | |
| 128 | + } | |
| 129 | + } else { | |
| 130 | + this.$toast.fail(res.message) | |
| 131 | + } | |
| 132 | + }) | |
| 133 | + }, | |
| 134 | + selectAreaOver (value) { | |
| 135 | + let data = value; | |
| 136 | + var city = data[1].code; | |
| 137 | + city = city.substring(0, city.length - 2); | |
| 138 | + // console.log(city) | |
| 139 | + this.area = data[0].name + ',' + data[1].name + ',' + data[2].name; | |
| 140 | + this.areaCode = [data[0].code, city, data[2].code]; | |
| 141 | + this.quCode = data[2].code; | |
| 142 | + this.school = '', | |
| 143 | + this.schoolId = '', | |
| 144 | + this.showAreaSelect = false | |
| 145 | + this.GetHighSchoolList(data[2].code);// 通过地区获取学校 | |
| 146 | + }, | |
| 147 | + // 点击选择学校 | |
| 148 | + handleSchool () { | |
| 149 | + if (!this.area) { | |
| 150 | + this.$toast('请先选择地区'); | |
| 151 | + return; | |
| 152 | + } | |
| 153 | + this.showSchoolSelect = true | |
| 154 | + }, | |
| 155 | + // 通过地区获取学校 | |
| 156 | + GetHighSchoolList (areaCode) { | |
| 157 | + this.http.GetHighSchoolList({ | |
| 158 | + areaCode: areaCode | |
| 159 | + }).then((res) => { | |
| 160 | + if (res.success) { | |
| 161 | + let data = res.data; | |
| 162 | + let arr = []; | |
| 163 | + if (data) { | |
| 164 | + data.forEach((n, i) => { | |
| 165 | + let obj = {}; | |
| 166 | + obj.text = n.schoolName; | |
| 167 | + obj.value = n.id; | |
| 168 | + arr.push(obj); | |
| 169 | + }); | |
| 170 | + this.schoolList = arr; | |
| 171 | + } | |
| 172 | + } else { | |
| 173 | + this.$toast.fail(res.message) | |
| 174 | + } | |
| 175 | + }) | |
| 176 | + }, | |
| 177 | + selectSchoolOver (value) { | |
| 178 | + this.school = value.text; | |
| 179 | + this.schoolId = value.value | |
| 180 | + this.showSchoolSelect = false | |
| 181 | + }, | |
| 182 | + | |
| 183 | + submit () { | |
| 184 | + if (!this.year) { | |
| 185 | + this.$toast('请选择入学年份'); | |
| 186 | + return; | |
| 187 | + } | |
| 188 | + let postData = { | |
| 189 | + studentName: this.studentName, | |
| 190 | + province: this.area.split(',')[0], | |
| 191 | + city: this.area.split(',')[1], | |
| 192 | + areaCode: this.areaCode[2], | |
| 193 | + areaName: this.area.split(',')[2], | |
| 194 | + school: this.school, | |
| 195 | + schoolAddress: this.areaCode[2] ? JSON.stringify(this.areaCode) : '', | |
| 196 | + year: this.year=='高一'?this.yearArr[2].value:this.year=='高二'?this.yearArr[1].value:this.yearArr[0].value | |
| 197 | + } | |
| 198 | + this.$toast.loading({ | |
| 199 | + message: '加载中', | |
| 200 | + duration: 0, | |
| 201 | + forbidClick: true | |
| 202 | + }) | |
| 203 | + this.http.updateUserInfo(postData).then((res) => { | |
| 204 | + this.$toast.clear() | |
| 205 | + if (res.success) { | |
| 206 | + this.$toast.success(res.message) | |
| 207 | + this.$emit('complete') | |
| 208 | + this.$emit('hidePrefectBox') | |
| 209 | + } else { | |
| 210 | + this.$toast.fail(res.message) | |
| 211 | + } | |
| 212 | + }) | |
| 213 | + } | |
| 214 | + } | |
| 215 | +} | |
| 216 | +</script> | |
| 217 | +<style lang="scss" scoped> | |
| 218 | +#prefect_box { | |
| 219 | + width: 638px; | |
| 220 | + height: 836px; | |
| 221 | + background: #ffffff; | |
| 222 | + border-radius: 24px; | |
| 223 | + position: relative; | |
| 224 | + .bg { | |
| 225 | + width: 100%; | |
| 226 | + position: absolute; | |
| 227 | + top: 0; | |
| 228 | + left: 0; | |
| 229 | + } | |
| 230 | + .content { | |
| 231 | + width: 100%; | |
| 232 | + box-sizing: border-box; | |
| 233 | + padding: 0 40px; | |
| 234 | + position: absolute; | |
| 235 | + top: 236px; | |
| 236 | + left: 0; | |
| 237 | + .item { | |
| 238 | + width: 558px; | |
| 239 | + height: 72px; | |
| 240 | + border-radius: 36px; | |
| 241 | + background: #f7f7f7; | |
| 242 | + box-sizing: border-box; | |
| 243 | + font-size: 28px; | |
| 244 | + padding: 0 32px; | |
| 245 | + display: flex; | |
| 246 | + justify-content: space-between; | |
| 247 | + align-items: center; | |
| 248 | + margin-bottom: 28px; | |
| 249 | + p { | |
| 250 | + color: #333333; | |
| 251 | + &.nodata { | |
| 252 | + color: #999999; | |
| 253 | + } | |
| 254 | + } | |
| 255 | + img { | |
| 256 | + width: 40px; | |
| 257 | + } | |
| 258 | + input { | |
| 259 | + width: 100%; | |
| 260 | + background: transparent; | |
| 261 | + border: 0; | |
| 262 | + color: #333333; | |
| 263 | + padding: 0; | |
| 264 | + &::-webkit-input-placeholder { | |
| 265 | + color: #999999; | |
| 266 | + } | |
| 267 | + } | |
| 268 | + } | |
| 269 | + .tip { | |
| 270 | + display: flex; | |
| 271 | + align-items: center; | |
| 272 | + justify-content: center; | |
| 273 | + margin-bottom: 40px; | |
| 274 | + img { | |
| 275 | + width: 32px; | |
| 276 | + } | |
| 277 | + p { | |
| 278 | + font-size: 24px; | |
| 279 | + color: #f7b500; | |
| 280 | + margin-left: 8px; | |
| 281 | + } | |
| 282 | + } | |
| 283 | + .submit { | |
| 284 | + width: 294px; | |
| 285 | + height: 72px; | |
| 286 | + border: 0; | |
| 287 | + background: linear-gradient(135deg, #99c2ff 0%, #1f59ff 100%); | |
| 288 | + box-shadow: 0px 4px 8px 0px rgba(189, 189, 189, 0.5), | |
| 289 | + 0px 8px 12px 0px rgba(87, 137, 255, 0.5); | |
| 290 | + border-radius: 34px; | |
| 291 | + font-size: 34px; | |
| 292 | + color: #ffffff; | |
| 293 | + margin: 0 auto; | |
| 294 | + display: block; | |
| 295 | + } | |
| 296 | + } | |
| 297 | +} | |
| 298 | +</style> | ... | ... | 
src/router/index.js
src/views/PublicHome/HomeKQ.vue
| ... | ... | @@ -29,7 +29,7 @@ | 
| 29 | 29 | <van-icon name="arrow" /> | 
| 30 | 30 | </div> | 
| 31 | 31 | </div> | 
| 32 | - <HomeChildList v-if="centerNo" parent="HomeKQ"></HomeChildList> | |
| 32 | + <HomeChildList v-if="showChildList" parent="HomeKQ"></HomeChildList> | |
| 33 | 33 | |
| 34 | 34 | <!-- <div class="cardPic" v-show='isShow'> | 
| 35 | 35 | <div class="boxPic" @click="isShow = false"> | 
| ... | ... | @@ -67,6 +67,7 @@ export default { | 
| 67 | 67 | isShow: false, | 
| 68 | 68 | appId: 'wx1305e88d2bc74073', //绍兴研学 | 
| 69 | 69 | publicName: 'KQ', | 
| 70 | + showChildList: false | |
| 70 | 71 | } | 
| 71 | 72 | }, | 
| 72 | 73 | |
| ... | ... | @@ -135,6 +136,7 @@ export default { | 
| 135 | 136 | this.centerNo = res.data.data.centerNo | 
| 136 | 137 | sessionStorage.setItem('userInfo', JSON.stringify(res.data.data)) | 
| 137 | 138 | } | 
| 139 | + this.showChildList = true | |
| 138 | 140 | }) | 
| 139 | 141 | }, | 
| 140 | 142 | // 判断是否已登录 | ... | ... | 
| ... | ... | @@ -0,0 +1,392 @@ | 
| 1 | +<template> | |
| 2 | + <div> | |
| 3 | + <div id="prefect_box"> | |
| 4 | + <img class="bg" src="@/assets/msg.png" alt=""> | |
| 5 | + <div class="content"> | |
| 6 | + <div class="name">学生信息:</div> | |
| 7 | + <div class="item"> | |
| 8 | + <input type="text" placeholder="请输入学生姓名" v-model="studentName"> | |
| 9 | + </div> | |
| 10 | + <div class="item" @click="showUserTypeSelect=true" style="width:48%;display:inline-flex;margin-right:4%;"> | |
| 11 | + <p :class="!userType?'nodata':''">{{userType?userType:'当前阶段'}}</p> | |
| 12 | + <img src="@/assets/more.png" alt=""> | |
| 13 | + </div> | |
| 14 | + <div class="item" @click="handleYear" style="width:48%;display:inline-flex;"> | |
| 15 | + <p :class="!year||yearDisable?'nodata':''">{{year?year:'入学年份'}}</p> | |
| 16 | + <img src="@/assets/more.png" alt=""> | |
| 17 | + </div> | |
| 18 | + <div class="item" @click="showAreaSelect=true"> | |
| 19 | + <p :class="!area?'nodata':''">{{area?area:'请选择地区'}}</p> | |
| 20 | + <img src="@/assets/more.png" alt=""> | |
| 21 | + </div> | |
| 22 | + <!-- <div class="item"> | |
| 23 | + <form action="/" style="width:100%;"> | |
| 24 | + <van-search v-model="searchSchool" placeholder="请输入学校关键字" @search="handleSchool" /> | |
| 25 | + </form> | |
| 26 | + </div> --> | |
| 27 | + <div class="item"> | |
| 28 | + <input type="text" placeholder="请选择学校" readonly v-model="school"> | |
| 29 | + <button type="info" class="btn" @click="chooseSchool">选择学校</button> | |
| 30 | + </div> | |
| 31 | + | |
| 32 | + <!-- <p class="school_select" v-if="school">已选择学校:{{school}}</p> --> | |
| 33 | + <button class="submit" @click="submit">完成</button> | |
| 34 | + </div> | |
| 35 | + </div> | |
| 36 | + <van-popup v-model="showUserTypeSelect" round position="bottom" get-container="body" :safe-area-inset-bottom="true"> | |
| 37 | + <van-picker title="当前阶段" show-toolbar :columns="userTypeArr" value-key="label" @cancel="showUserTypeSelect = false" @confirm="selectUserTypeOver" /> | |
| 38 | + </van-popup> | |
| 39 | + <van-popup v-model="showYearSelect" round position="bottom" get-container="body" :safe-area-inset-bottom="true"> | |
| 40 | + <van-picker title="入学年份" show-toolbar :columns="yearArr" value-key="label" @cancel="showYearSelect = false" @confirm="selectYearOver" /> | |
| 41 | + </van-popup> | |
| 42 | + <van-popup v-model="showAreaSelect" round position="bottom" get-container="body" :safe-area-inset-bottom="true"> | |
| 43 | + <van-area title="地区" :area-list="areaList" @cancel="showAreaSelect = false" @confirm="selectAreaOver" /> | |
| 44 | + </van-popup> | |
| 45 | + <van-popup v-model="showSchoolSelect" round position="bottom" get-container="body" :safe-area-inset-bottom="true"> | |
| 46 | + <van-picker title="学校" show-toolbar :columns="schoolList" :loading="schoolListLoading" @cancel="showSchoolSelect = false" @confirm="selectSchoolOver" /> | |
| 47 | + </van-popup> | |
| 48 | + | |
| 49 | + <van-popup v-model="chooseSchoolisShow" round get-container="body" :safe-area-inset-bottom="true"> | |
| 50 | + <div v-if="chooseSchoolisShow"><chooseSchool v-model="chooseSchoolisShow" @schoolData='schoolData'></chooseSchool></div> | |
| 51 | + </van-popup> | |
| 52 | + </div> | |
| 53 | +</template> | |
| 54 | + | |
| 55 | +<script> | |
| 56 | +import chooseSchool from './chooseSchool' | |
| 57 | +export default { | |
| 58 | + props: [ | |
| 59 | + "phone", | |
| 60 | + "id", | |
| 61 | + "publicName" | |
| 62 | + ], | |
| 63 | + components: {chooseSchool}, | |
| 64 | + data () { | |
| 65 | + return { | |
| 66 | + studentName: '', | |
| 67 | + | |
| 68 | + year: '',//入学年份 | |
| 69 | + yearDisable: false, | |
| 70 | + showYearSelect: false, | |
| 71 | + yearArr: [], | |
| 72 | + | |
| 73 | + userType: '', | |
| 74 | + userTypeVal: '',//所处阶段1-小学 2-初中 3-高中 | |
| 75 | + showUserTypeSelect: false, | |
| 76 | + userTypeArr: [{ | |
| 77 | + label: '小学', | |
| 78 | + value: 1 | |
| 79 | + }, { | |
| 80 | + label: '初中', | |
| 81 | + value: 2 | |
| 82 | + }, { | |
| 83 | + label: '高中', | |
| 84 | + value: 3 | |
| 85 | + }], | |
| 86 | + | |
| 87 | + area: '', | |
| 88 | + areaCode: '', | |
| 89 | + showAreaSelect: false, | |
| 90 | + areaList: [], | |
| 91 | + | |
| 92 | + searchSchool: '', | |
| 93 | + school: '', | |
| 94 | + schoolId: '', | |
| 95 | + showSchoolSelect: false, | |
| 96 | + schoolListLoading: false, | |
| 97 | + schoolList: [], | |
| 98 | + | |
| 99 | + appId: '', | |
| 100 | + chooseSchoolisShow: false | |
| 101 | + } | |
| 102 | + }, | |
| 103 | + | |
| 104 | + mounted () { | |
| 105 | + if (this.publicName == 'SXYX') { | |
| 106 | + this.appId = 'wx1305e88d2bc74073' | |
| 107 | + } else if (this.publicName == 'XST') { | |
| 108 | + this.appId = 'wx1c630c8773c482f1' | |
| 109 | + } | |
| 110 | + let userInfo = sessionStorage.getItem('userInfo') | |
| 111 | + this.userInfo = userInfo ? JSON.parse(userInfo) : userInfo; | |
| 112 | + this.studentName = this.userInfo?.studentName; | |
| 113 | + this.initYearArr() | |
| 114 | + this.GetSysAreaList() | |
| 115 | + }, | |
| 116 | + methods: { | |
| 117 | + // 初始化入学年份选项 | |
| 118 | + initYearArr () { | |
| 119 | + // 页面创建时执行 | |
| 120 | + let year = new Date().getFullYear(), | |
| 121 | + Month = new Date().getMonth() + 1, | |
| 122 | + yearArr = []; | |
| 123 | + if (Month > 8) { | |
| 124 | + // 如果月份大于8,那么当年的学年的高考年份要+1,如果月份小于7,那么当前的年份就是今年高考的年份 | |
| 125 | + year = year | |
| 126 | + } | |
| 127 | + for (let index = year; index > year - 6; index--) { | |
| 128 | + yearArr.push({ value: index, label: index }) | |
| 129 | + } | |
| 130 | + this.yearArr = yearArr | |
| 131 | + }, | |
| 132 | + selectYearOver (value) { | |
| 133 | + this.year = value.label; | |
| 134 | + this.showYearSelect = false; | |
| 135 | + }, | |
| 136 | + handleYear () { | |
| 137 | + if (!this.yearDisable) { | |
| 138 | + this.showYearSelect = true; | |
| 139 | + } | |
| 140 | + }, | |
| 141 | + selectUserTypeOver (value) { | |
| 142 | + this.userType = value.label; | |
| 143 | + this.userTypeVal = value.value; | |
| 144 | + this.showUserTypeSelect = false; | |
| 145 | + }, | |
| 146 | + // 获取地区列表 | |
| 147 | + GetSysAreaList () { | |
| 148 | + this.http.GetSysAreaList({ | |
| 149 | + areaCode: 33 | |
| 150 | + }).then((res) => { | |
| 151 | + if (res.success) { | |
| 152 | + let data = res.data; | |
| 153 | + let obj = { | |
| 154 | + province_list: { | |
| 155 | + 330000: '浙江省' | |
| 156 | + }, | |
| 157 | + city_list: {}, | |
| 158 | + county_list: {} | |
| 159 | + }; | |
| 160 | + if (data) { | |
| 161 | + data.forEach((n, i) => { | |
| 162 | + obj.city_list[n.area_code + '00'] = n.area_name; | |
| 163 | + if (n.areaList.length > 0) { | |
| 164 | + n.areaList.forEach((k, j) => { | |
| 165 | + obj.county_list[k.area_code] = k.area_name; | |
| 166 | + }) | |
| 167 | + } | |
| 168 | + }); | |
| 169 | + this.areaList = obj; | |
| 170 | + } | |
| 171 | + } else { | |
| 172 | + this.$toast.fail(res.message) | |
| 173 | + } | |
| 174 | + }) | |
| 175 | + }, | |
| 176 | + selectAreaOver (value) { | |
| 177 | + let data = value; | |
| 178 | + var city = data[1].code; | |
| 179 | + city = city.substring(0, city.length - 2); | |
| 180 | + // console.log(city) | |
| 181 | + this.area = data[0].name + ',' + data[1].name + ',' + data[2].name; | |
| 182 | + this.areaCode = [data[0].code, city, data[2].code]; | |
| 183 | + this.quCode = data[2].code; | |
| 184 | + this.school = '', | |
| 185 | + this.schoolId = '', | |
| 186 | + this.showAreaSelect = false | |
| 187 | + }, | |
| 188 | + // 点击选择学校 | |
| 189 | + handleSchool () { | |
| 190 | + if (!this.searchSchool) { | |
| 191 | + this.$toast('请输入学校关键字'); | |
| 192 | + return; | |
| 193 | + } | |
| 194 | + this.showSchoolSelect = true; | |
| 195 | + this.GetHighSchoolList(); | |
| 196 | + }, | |
| 197 | + // 通过地区获取学校 | |
| 198 | + GetHighSchoolList () { | |
| 199 | + this.schoolListLoading = true; | |
| 200 | + this.yxAxios.get(`${this.yanxueUrl}/api/SchoolManage/GetAllSchoolList?schoolName=${this.searchSchool}`).then((res) => { | |
| 201 | + if (res.data.data) { | |
| 202 | + let data = res.data.data; | |
| 203 | + let arr = []; | |
| 204 | + if (data) { | |
| 205 | + data.forEach((n, i) => { | |
| 206 | + let obj = {}; | |
| 207 | + obj.text = n.schoolName; | |
| 208 | + obj.id = n.id; | |
| 209 | + arr.push(obj); | |
| 210 | + }); | |
| 211 | + this.schoolList = arr; | |
| 212 | + this.schoolListLoading = false | |
| 213 | + } | |
| 214 | + } else { | |
| 215 | + this.schoolListLoading = false | |
| 216 | + this.$toast.fail(res.data.message) | |
| 217 | + } | |
| 218 | + }) | |
| 219 | + }, | |
| 220 | + selectSchoolOver (value) { | |
| 221 | + console.log(value) | |
| 222 | + this.school = value.text; | |
| 223 | + this.schoolId = value.id; | |
| 224 | + this.showSchoolSelect = false; | |
| 225 | + }, | |
| 226 | + | |
| 227 | + submit () { | |
| 228 | + if (!this.studentName) { | |
| 229 | + this.$toast('请输入姓名'); | |
| 230 | + } | |
| 231 | + else if (!this.userType) { | |
| 232 | + this.$toast('请选择阶段'); | |
| 233 | + } | |
| 234 | + else if (!this.year) { | |
| 235 | + this.$toast('请选择入学年份'); | |
| 236 | + } | |
| 237 | + else if (!this.area) { | |
| 238 | + this.$toast('请选择地区'); | |
| 239 | + } | |
| 240 | + else if (!this.school) { | |
| 241 | + this.$toast('请选择学校'); | |
| 242 | + } else { | |
| 243 | + let postData = { | |
| 244 | + id: this.id, | |
| 245 | + userName: this.studentName, | |
| 246 | + mobile: this.phone, | |
| 247 | + province: this.area.split(',')[0],//省份 | |
| 248 | + city: this.area.split(',')[1],//城市 | |
| 249 | + area: this.area.split(',')[2],//地区 | |
| 250 | + schoolName: this.school,//学校名称 | |
| 251 | + enrollYear: this.year,//入学年份 | |
| 252 | + userType: this.userTypeVal,//1-小学 2-初中 3-高中 | |
| 253 | + } | |
| 254 | + this.$toast.loading({ | |
| 255 | + message: '加载中', | |
| 256 | + duration: 0, | |
| 257 | + forbidClick: true | |
| 258 | + }) | |
| 259 | + this.yxAxios.post(`${this.proxyUrl}/prod/api/wx/${this.appId}/updateUserInfo`, postData).then((res) => { | |
| 260 | + this.$toast.clear() | |
| 261 | + if (res.data.code == 200) { | |
| 262 | + this.$toast.success(res.data?.message) | |
| 263 | + this.$emit('complete') | |
| 264 | + this.$emit('hidePrefectBox') | |
| 265 | + } else { | |
| 266 | + this.$toast.fail(res.message) | |
| 267 | + } | |
| 268 | + }) | |
| 269 | + } | |
| 270 | + }, | |
| 271 | + //选择学校 | |
| 272 | + chooseSchool() { | |
| 273 | + // this.$router.push({name: 'chooseSchool'}) | |
| 274 | + this.chooseSchoolisShow = true | |
| 275 | + }, | |
| 276 | + schoolData(val) { | |
| 277 | + this.school = val.text; | |
| 278 | + this.schoolId = val.id; | |
| 279 | + } | |
| 280 | + } | |
| 281 | +} | |
| 282 | +</script> | |
| 283 | +<style lang="scss" scoped> | |
| 284 | +#prefect_box { | |
| 285 | + width: 638px; | |
| 286 | + height: 836px; | |
| 287 | + background: #ffffff; | |
| 288 | + border-radius: 24px; | |
| 289 | + position: relative; | |
| 290 | + | |
| 291 | + .bg { | |
| 292 | + width: 100%; | |
| 293 | + position: absolute; | |
| 294 | + top: 0; | |
| 295 | + left: 0; | |
| 296 | + } | |
| 297 | + .content { | |
| 298 | + width: 100%; | |
| 299 | + box-sizing: border-box; | |
| 300 | + padding: 0 40px; | |
| 301 | + position: absolute; | |
| 302 | + top: 236px; | |
| 303 | + left: 0; | |
| 304 | + .name { | |
| 305 | + width: 558px; | |
| 306 | + height: 50px; | |
| 307 | + font-size: 28px; | |
| 308 | + color: #000; | |
| 309 | + padding-left: 20px; | |
| 310 | + box-sizing: border-box; | |
| 311 | + } | |
| 312 | + .item { | |
| 313 | + width: 558px; | |
| 314 | + height: 72px; | |
| 315 | + border-radius: 36px; | |
| 316 | + background: #f7f7f7; | |
| 317 | + box-sizing: border-box; | |
| 318 | + font-size: 28px; | |
| 319 | + padding: 0 32px; | |
| 320 | + display: flex; | |
| 321 | + justify-content: space-between; | |
| 322 | + align-items: center; | |
| 323 | + margin-bottom: 28px; | |
| 324 | + p { | |
| 325 | + color: #333333; | |
| 326 | + &.nodata { | |
| 327 | + color: #999999; | |
| 328 | + } | |
| 329 | + } | |
| 330 | + img { | |
| 331 | + width: 40px; | |
| 332 | + } | |
| 333 | + input { | |
| 334 | + width: 100%; | |
| 335 | + background: transparent; | |
| 336 | + border: 0; | |
| 337 | + color: #333333; | |
| 338 | + padding: 0; | |
| 339 | + &::-webkit-input-placeholder { | |
| 340 | + color: #999999; | |
| 341 | + } | |
| 342 | + } | |
| 343 | + .btn { | |
| 344 | + width: 240px; | |
| 345 | + height: 55px; | |
| 346 | + float: right; | |
| 347 | + font-size: 28px; | |
| 348 | + background: linear-gradient(135deg, #cdf8cf 0%, #8af36f 100%); | |
| 349 | + box-shadow: 0px 4px 8px 0px rgba(189, 189, 189, 0.5), | |
| 350 | + 0px 8px 12px 0px rgba(89, 199, 171, 0.5); | |
| 351 | + border-radius: 34px; | |
| 352 | + border: transparent; | |
| 353 | + color: #333333; | |
| 354 | + } | |
| 355 | + } | |
| 356 | + .school_select { | |
| 357 | + font-size: 28px; | |
| 358 | + padding: 0 32px; | |
| 359 | + margin-bottom: 28px; | |
| 360 | + } | |
| 361 | + .submit { | |
| 362 | + width: 294px; | |
| 363 | + height: 72px; | |
| 364 | + border: 0; | |
| 365 | + background: linear-gradient(135deg, #99c2ff 0%, #1f59ff 100%); | |
| 366 | + box-shadow: 0px 4px 8px 0px rgba(189, 189, 189, 0.5), | |
| 367 | + 0px 8px 12px 0px rgba(87, 137, 255, 0.5); | |
| 368 | + border-radius: 34px; | |
| 369 | + font-size: 34px; | |
| 370 | + color: #ffffff; | |
| 371 | + margin: 0 auto; | |
| 372 | + display: block; | |
| 373 | + } | |
| 374 | + } | |
| 375 | +} | |
| 376 | +/deep/.van-search { | |
| 377 | + background: transparent; | |
| 378 | + padding: 0; | |
| 379 | + width: 100%; | |
| 380 | +} | |
| 381 | +/deep/.van-search__content { | |
| 382 | + padding: 0; | |
| 383 | +} | |
| 384 | +.schoolBoxF { | |
| 385 | + width: 100vw; | |
| 386 | + height: 100vh; | |
| 387 | + position: absolute; | |
| 388 | + top: 0; | |
| 389 | + left: 0; | |
| 390 | + background-color: #fff; | |
| 391 | +} | |
| 392 | +</style> | ... | ... | 
