Commit 8a1c8e6dcafa79304546e8be833b2b2cafd0bc2a
1 parent
d2af4897f8
Exists in
master
and in
2 other branches
建档增加户籍地址
Showing 17 changed files with 450 additions and 28 deletions
- littleApp_child/app.json
- littleApp_child/pages/Guide/guide.wxml
- littleApp_child/pages/Guide/guide.wxss
- littleApp_child/pages/childcare_knowledge_detail/childcare_knowledge_detail.js
- littleApp_child/pages/childcare_knowledge_detail/childcare_knowledge_detail.wxml
- littleApp_child/pages/childcare_knowledge_detail/childcare_knowledge_detail.wxss
- littleApp_child/pages/home/home.js
- littleApp_child/pages/home/home.wxml
- littleApp_child/pages/quickArchives/quickArchives.js
- littleApp_child/pages/quickArchives/quickArchives.wxml
- littleApp_child/pages/quickArchives/quickArchives.wxss
- littleApp_child/utils/apiFile.js
- littleApp_child/utils/areaSelector/province.js
- littleApp_child/utils/areaSelector/selector.js
- littleApp_child/utils/areaSelector/selector.wxml
- littleApp_child/utils/areaSelector/selector.wxss
- littleApp_child/utils/network_util.js
littleApp_child/app.json
View file @
8a1c8e6
littleApp_child/pages/Guide/guide.wxml
View file @
8a1c8e6
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <scroll-view class="list_scroll" scroll-y="true" bindscrolltolower="myScroll"> |
| 17 | 17 | |
| 18 | 18 | <view> |
| 19 | - <navigator url="../childcare_knowledge_detail/childcare_knowledge_detail?{{'id=' + item.id + '&category=' + category}}" wx:for="{{list}}" wx:key="{{index}}"> | |
| 19 | + <navigator url="../childcare_knowledge_detail/childcare_knowledge_detail?{{'id=' + item.id + '&category=' + category + '&item=' + item.tags}}" wx:for="{{list}}" wx:key="{{index}}"> | |
| 20 | 20 | <view class="content_item"> |
| 21 | 21 | <view style="margin-left:15px;margin-right:90px;"> |
| 22 | 22 | <view class="content_title_box"> |
| 23 | 23 | |
| 24 | 24 | |
| ... | ... | @@ -38,13 +38,14 @@ |
| 38 | 38 | <view class="content_save">{{item.viewCount}}</view> |
| 39 | 39 | </view> |
| 40 | 40 | </view> |
| 41 | - <view class="content_tags_box" wx:if="{{current_index!=0}}"> | |
| 41 | + <!--<view class="content_tags_box" wx:if="{{current_index!=0}}"> | |
| 42 | 42 | <view class="content_tags">{{item.tags[0]}}</view> |
| 43 | 43 | <view class="content_tags">{{item.tags[1]}}</view> |
| 44 | - </view> | |
| 44 | + </view>--> | |
| 45 | 45 | </view> |
| 46 | 46 | <image class="content_image" mode="aspectFill" src="{{item.image.medium}}"></image> |
| 47 | 47 | </view> |
| 48 | + <!--<view class="home__list-item__bottom {{item.tags[1].length>15?'new_home__list-item__bottom':''}}"></view>--> | |
| 48 | 49 | <view class="home__list-item__bottom"></view> |
| 49 | 50 | </navigator> |
| 50 | 51 | <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view> |
littleApp_child/pages/Guide/guide.wxss
View file @
8a1c8e6
| ... | ... | @@ -132,13 +132,11 @@ |
| 132 | 132 | |
| 133 | 133 | .like_box { |
| 134 | 134 | display: flex; |
| 135 | - height: 36px; | |
| 136 | 135 | justify-content: flex-start; |
| 137 | 136 | } |
| 138 | 137 | |
| 139 | 138 | .content_tags_box { |
| 140 | 139 | display: flex; |
| 141 | - height: 36px; | |
| 142 | 140 | justify-content: flex-end; |
| 143 | 141 | } |
| 144 | 142 | |
| 145 | 143 | |
| ... | ... | @@ -147,11 +145,16 @@ |
| 147 | 145 | color: #de7f46; |
| 148 | 146 | border-radius: 2px; |
| 149 | 147 | background-color: #ffebe0; |
| 150 | - height: 16px; | |
| 151 | - padding: 3px; | |
| 148 | + min-height: 16px; | |
| 149 | + min-width: 30px; | |
| 150 | + padding: 2.5px; | |
| 152 | 151 | line-height: 16px; |
| 153 | 152 | margin-left: 6px; |
| 154 | - text-align: center; | |
| 153 | + overflow:hidden; | |
| 154 | + text-overflow:ellipsis; | |
| 155 | + display:-webkit-box; | |
| 156 | + -webkit-box-orient:vertical; | |
| 157 | + -webkit-line-clamp:2; | |
| 155 | 158 | } |
| 156 | 159 | |
| 157 | 160 | .zarparent_box { |
| ... | ... | @@ -226,6 +229,9 @@ |
| 226 | 229 | margin-top: 5px; |
| 227 | 230 | left: 15px; |
| 228 | 231 | right: 15px; |
| 232 | +} | |
| 233 | +.home__list-item__bottom.new_home__list-item__bottom{ | |
| 234 | + margin-top: 16px!important; | |
| 229 | 235 | } |
| 230 | 236 | |
| 231 | 237 | .list_scroll { |
littleApp_child/pages/childcare_knowledge_detail/childcare_knowledge_detail.js
View file @
8a1c8e6
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | |
| 10 | 10 | Page({ |
| 11 | 11 | data: { |
| 12 | - | |
| 12 | + item: '', | |
| 13 | 13 | knowledge: null, |
| 14 | 14 | images: [], |
| 15 | 15 | titles: ["日常护理", "营养美食", "疾病护理", "亲子互动", "言传qq"], |
| ... | ... | @@ -32,6 +32,13 @@ |
| 32 | 32 | // success: function (res) { |
| 33 | 33 | // } |
| 34 | 34 | // }) |
| 35 | + if (options.item!==null&&options.item!==undefined&&options.item!=="") { | |
| 36 | + this.data.item = options.item.split(","); | |
| 37 | + console.log(this.data.item) | |
| 38 | + this.setData({ | |
| 39 | + item: this.data.item | |
| 40 | + }) | |
| 41 | + } | |
| 35 | 42 | this.requestData(options.id) |
| 36 | 43 | }, |
| 37 | 44 | onUnload: function () { |
| ... | ... | @@ -87,7 +94,7 @@ |
| 87 | 94 | swiperHeight: wx.getSystemInfoSync().windowWidth * 0.55 |
| 88 | 95 | }) |
| 89 | 96 | }, function (res) { |
| 90 | - | |
| 97 | + | |
| 91 | 98 | }) |
| 92 | 99 | }, |
| 93 | 100 | // 文章点赞 |
littleApp_child/pages/childcare_knowledge_detail/childcare_knowledge_detail.wxml
View file @
8a1c8e6
| ... | ... | @@ -5,6 +5,10 @@ |
| 5 | 5 | <view class="article_label">文章标签</view> |
| 6 | 6 | <view class="article_label">文章标签</view> |
| 7 | 7 | </view> --> |
| 8 | + <view class="detail_article_label" wx:if="{{false}}"> | |
| 9 | + <view class="item">{{item[0]}}</view> | |
| 10 | + <view class="item">{{item[1]}}</view> | |
| 11 | + </view> | |
| 8 | 12 | <view class="zar_box" style="margin-left:8px;" wx:if="{{knowledge}}"> |
| 9 | 13 | <view class="zar_box" bindtap="articleLike"> |
| 10 | 14 | <image class="zar_img" src="../../source/{{knowledge.isLike == 1 ? 'zanguo.png' : 'like.png'}}"></image> |
| ... | ... | @@ -12,7 +16,7 @@ |
| 12 | 16 | </view> |
| 13 | 17 | <view class="content_time">{{knowledge.time}}</view> |
| 14 | 18 | </view> |
| 15 | - | |
| 19 | + | |
| 16 | 20 | <swiper style="height:{{swiperHeight}}px" hidden="{{knowledge.image ? false : true}}" class="swiper" indicator-dots="true" indicator-active-color="#ffffff"> |
| 17 | 21 | <block wx:for="{{[knowledge.image]}}"> |
| 18 | 22 | <swiper-item> |
littleApp_child/pages/childcare_knowledge_detail/childcare_knowledge_detail.wxss
View file @
8a1c8e6
| ... | ... | @@ -17,6 +17,22 @@ |
| 17 | 17 | margin-right: 10px; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | +.detail_article_label{ | |
| 21 | + width: 94%; | |
| 22 | + margin-left: 3%; | |
| 23 | + display: -webkit-box; | |
| 24 | + color: #58A478; | |
| 25 | + font-size: 12px; | |
| 26 | +} | |
| 27 | +.detail_article_label .item{ | |
| 28 | + margin-right: 10px; | |
| 29 | + padding: 5px; | |
| 30 | + background: #F2FDF7; | |
| 31 | + border-radius: 2px; | |
| 32 | + -webkit-box-flex: 1; | |
| 33 | + min-width: 30px; | |
| 34 | +} | |
| 35 | + | |
| 20 | 36 | .art_labels { |
| 21 | 37 | display: flex; |
| 22 | 38 | margin-left: 10px; |
| ... | ... | @@ -85,7 +101,7 @@ |
| 85 | 101 | font-family: PingFangSC-Regular; |
| 86 | 102 | font-size: 10px; |
| 87 | 103 | margin-left: 3px; |
| 88 | - | |
| 104 | + | |
| 89 | 105 | margin-top: 5px; |
| 90 | 106 | color: #c8c6c6; |
| 91 | 107 | } |
littleApp_child/pages/home/home.js
View file @
8a1c8e6
| ... | ... | @@ -827,6 +827,20 @@ |
| 827 | 827 | networkUtil.showErrorToast(res.errormsg) |
| 828 | 828 | },'application/json') |
| 829 | 829 | }, |
| 830 | + goEditAddress() { | |
| 831 | + networkUtil.showLoading() | |
| 832 | + var param = { | |
| 833 | + 'pid': app.globalData.userInfo.pid, | |
| 834 | + 'hospitalId':app.globalData.userInfo.hospitalId | |
| 835 | + } | |
| 836 | + networkUtil._post(api.getBabyBuildPidInfo,param,function(res){ | |
| 837 | + if (res.data.data) { | |
| 838 | + wx.navigateTo({url: '/packageA/pages/editAddress/editAddress?id=' + res.data.data.id }) | |
| 839 | + } | |
| 840 | + },function(res){ | |
| 841 | + networkUtil.showErrorToast(res.errormsg) | |
| 842 | + },'application/json') | |
| 843 | + }, | |
| 830 | 844 | //专家咨询 |
| 831 | 845 | consultation(){ |
| 832 | 846 | if(this.data.riskGuide){ |
littleApp_child/pages/home/home.wxml
View file @
8a1c8e6
| ... | ... | @@ -109,6 +109,10 @@ |
| 109 | 109 | <image src="../../source/graph.jpg" style="{{item_small}}" class="foundation_item_small_image"></image> |
| 110 | 110 | <view class="foundation_item_small_text">身高体重曲线</view> |
| 111 | 111 | </navigator> |
| 112 | + <navigator class="foundation_item_small" bind:tap="goEditAddress"> | |
| 113 | + <image src="../../source/jianchajilu.png" style="{{item_small}}" class="foundation_item_small_image"></image> | |
| 114 | + <view class="foundation_item_small_text">补填户籍地址</view> | |
| 115 | + </navigator> | |
| 112 | 116 | </view> |
| 113 | 117 | |
| 114 | 118 | <!--文章列表--> |
littleApp_child/pages/quickArchives/quickArchives.js
View file @
8a1c8e6
| ... | ... | @@ -5,7 +5,8 @@ |
| 5 | 5 | var makePy = require('../../utils/makepy.js') |
| 6 | 6 | const {utils} = require("../../utils/sdk/src/utils"); |
| 7 | 7 | const util = require("../../utils/util") |
| 8 | -Page({ | |
| 8 | +import { AreaPicker } from "../../utils/areaSelector/selector.js" | |
| 9 | +Page(Object.assign({}, AreaPicker,{ | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * 页面的初始数据 |
| ... | ... | @@ -13,6 +14,7 @@ |
| 13 | 14 | data: { |
| 14 | 15 | postObj: {}, |
| 15 | 16 | queryData:{}, |
| 17 | + currentAddress: {}, | |
| 16 | 18 | sex:[ |
| 17 | 19 | { |
| 18 | 20 | name:"男", |
| ... | ... | @@ -226,6 +228,14 @@ |
| 226 | 228 | flag = false; |
| 227 | 229 | value += "儿童出生身长 " |
| 228 | 230 | } |
| 231 | + if(!this.data.currentAddress.addEntry) { | |
| 232 | + flag = false; | |
| 233 | + value += "户籍地址 " | |
| 234 | + } | |
| 235 | + if(!data.babyAddress) { | |
| 236 | + flag = false; | |
| 237 | + value += "街道门牌 " | |
| 238 | + } | |
| 229 | 239 | return { |
| 230 | 240 | flag:flag, |
| 231 | 241 | value:value |
| ... | ... | @@ -235,6 +245,12 @@ |
| 235 | 245 | var key = this.checkForm(); |
| 236 | 246 | var data = this.data.postObj; |
| 237 | 247 | data.hospitalId = this.data.queryData.hospital.hospitalId; |
| 248 | + if (this.data.currentAddress.addEntry) { | |
| 249 | + data.babyProvinceId = this.data.currentAddress.addEntry[0].id; | |
| 250 | + data.babyCityId = this.data.currentAddress.addEntry[1].id; | |
| 251 | + data.babyAreaId = this.data.currentAddress.addEntry[2].id; | |
| 252 | + data.babyStreetId = this.data.currentAddress.addEntry[3].id; | |
| 253 | + } | |
| 238 | 254 | var that = this; |
| 239 | 255 | if(key.flag){ |
| 240 | 256 | this.setData({ |
| ... | ... | @@ -326,7 +342,7 @@ |
| 326 | 342 | postObj : res.data.data[0], |
| 327 | 343 | showViewType:1 |
| 328 | 344 | }) |
| 329 | - } | |
| 345 | + } | |
| 330 | 346 | } |
| 331 | 347 | }, function(res) { |
| 332 | 348 | networkUtil.showErrorToast(res.errormsg) |
| ... | ... | @@ -371,7 +387,7 @@ |
| 371 | 387 | |
| 372 | 388 | |
| 373 | 389 | |
| 374 | - | |
| 390 | + | |
| 375 | 391 | /** |
| 376 | 392 | * 生命周期函数--监听页面初次渲染完成 |
| 377 | 393 | */ |
| 378 | 394 | |
| ... | ... | @@ -419,6 +435,26 @@ |
| 419 | 435 | */ |
| 420 | 436 | onShareAppMessage: function () { |
| 421 | 437 | |
| 438 | + }, | |
| 439 | + onAreaCommit(locationList, e) {//当用户更换地区 | |
| 440 | + console.log('选择地址后', locationList) | |
| 441 | + var self = this; | |
| 442 | + self.addrInfo = { | |
| 443 | + province: locationList[0] || {}, | |
| 444 | + city: locationList[1] || {}, | |
| 445 | + area: locationList[2] || {}, | |
| 446 | + street: locationList[3] || {}, | |
| 447 | + } | |
| 448 | + var address = {} | |
| 449 | + address.details = '' | |
| 450 | + for (var i in locationList){ | |
| 451 | + address.details += locationList[i].name | |
| 452 | + } | |
| 453 | + address.addEntry = locationList | |
| 454 | + self.setData({ | |
| 455 | + isShow: 0, | |
| 456 | + currentAddress: address | |
| 457 | + }); | |
| 422 | 458 | } |
| 423 | -}) | |
| 459 | +})) |
littleApp_child/pages/quickArchives/quickArchives.wxml
View file @
8a1c8e6
| ... | ... | @@ -121,6 +121,25 @@ |
| 121 | 121 | </view> |
| 122 | 122 | <view class="weui-cell"> |
| 123 | 123 | <view class="weui-cell__hd"> |
| 124 | + <view class="weui-label line-tt"><text style="color:red">*</text>户籍地址</view> | |
| 125 | + </view> | |
| 126 | + <view class="weui-cell__bd"> | |
| 127 | + <view wx:if="{{!currentAddress.details}}" class="add_picker__text" style="font-size:14px;" bindtap="showAreaSelector" id="currentAddress" | |
| 128 | + data-name="currentAddress">请选择省市区(县)</view> | |
| 129 | + <view name="provinceCityArea" wx:if="{{currentAddress.details}}" style="font-size:14px;" class="add_picker__text" bindtap="showAreaSelector" | |
| 130 | + data-name="currentAddress">{{currentAddress.details}}</view> | |
| 131 | + </view> | |
| 132 | + </view> | |
| 133 | + <view class="weui-cell"> | |
| 134 | + <view class="weui-cell__hd"> | |
| 135 | + <view class="weui-label line-tt"><text style="color:red">*</text>街道门牌</view> | |
| 136 | + </view> | |
| 137 | + <view class="weui-cell__bd"> | |
| 138 | + <input bindinput="bindKeyInput" value="{{postObj.babyAddress}}" id="babyAddress" type="text" placeholder="输入街道门牌" /> | |
| 139 | + </view> | |
| 140 | + </view> | |
| 141 | + <view class="weui-cell"> | |
| 142 | + <view class="weui-cell__hd"> | |
| 124 | 143 | <view class="weui-label line-tt">母亲姓名</view> |
| 125 | 144 | </view> |
| 126 | 145 | <view class="weui-cell__bd"> |
| ... | ... | @@ -304,6 +323,24 @@ |
| 304 | 323 | </view> |
| 305 | 324 | <view class="weui-cell"> |
| 306 | 325 | <view class="weui-cell__hd"> |
| 326 | + <view class="weui-label line-tt">户籍地址</view> | |
| 327 | + </view> | |
| 328 | + <view class="weui-cell__bd"> | |
| 329 | + <text> | |
| 330 | + {{currentAddress.details?currentAddress.details:''}} | |
| 331 | + </text> | |
| 332 | + </view> | |
| 333 | + </view> | |
| 334 | + <view class="weui-cell"> | |
| 335 | + <view class="weui-cell__hd"> | |
| 336 | + <view class="weui-label line-tt">街道门牌</view> | |
| 337 | + </view> | |
| 338 | + <view class="weui-cell__bd"> | |
| 339 | + <text>{{babyInfo.babyAddress?babyInfo.babyAddress:''}}</text> | |
| 340 | + </view> | |
| 341 | + </view> | |
| 342 | + <view class="weui-cell"> | |
| 343 | + <view class="weui-cell__hd"> | |
| 307 | 344 | <view class="weui-label line-tt">母亲姓名</view> |
| 308 | 345 | </view> |
| 309 | 346 | <view class="weui-cell__bd"> |
| ... | ... | @@ -371,7 +408,7 @@ |
| 371 | 408 | </view> |
| 372 | 409 | </view> |
| 373 | 410 | <!-- 选择儿童弹窗 --> |
| 374 | -<modal hidden="{{isChooseBox}}" title="选择建档儿童" confirm-text="确认" cancel-text="取消" bindcancel="cancel" bindconfirm="submitSelect"> | |
| 411 | +<modal hidden="{{isChooseBox}}" title="选择建档儿童" confirm-text="确认" cancel-text="取消" bindcancel="cancel" bindconfirm="submitSelect"> | |
| 375 | 412 | <radio-group bindchange="radioChildChange"> |
| 376 | 413 | <label class="weui-cell weui-check__label" wx:for="{{childList}}" wx:key="{{item.id}}"> |
| 377 | 414 | <view class="weui-cell__hd"> |
| ... | ... | @@ -380,7 +417,7 @@ |
| 380 | 417 | <view class="weui-cell__bd">{{item.babyName}} {{item.birth}}</view> |
| 381 | 418 | </label> |
| 382 | 419 | </radio-group> |
| 383 | -</modal> | |
| 420 | +</modal> | |
| 384 | 421 | <!-- 选择儿童弹窗 --> |
| 385 | 422 | <!-- 医院选择框 --> |
| 386 | 423 | <view hidden="{{pickerBoxModal}}" class="pickerBox" style="bottom:{{bottom}}px"> |
| ... | ... | @@ -395,4 +432,7 @@ |
| 395 | 432 | </picker-view> |
| 396 | 433 | </view> |
| 397 | 434 | <!-- 医院选择框 --> |
| 435 | + | |
| 436 | +<!--引入选择器布局--> | |
| 437 | +<include src="../../utils/areaSelector/selector.wxml" /> |
littleApp_child/pages/quickArchives/quickArchives.wxss
View file @
8a1c8e6
littleApp_child/utils/apiFile.js
View file @
8a1c8e6
littleApp_child/utils/areaSelector/province.js
View file @
8a1c8e6
| 1 | +/** | |
| 2 | + * 省级地址数据 | |
| 3 | + * 省级数据不会经常变动,可以写死在应用中,减少用户等待时常,减轻服务器压力 | |
| 4 | + */ | |
| 5 | +export let province = [ | |
| 6 | + { "id": "1", "name": "河北省", "code": "130000" }, { "id": "211", "name": "山东省", "code": "370000" }, { "id": "11aa", "name": "北京市", "code": "110000" }, { "id": "12aa", "name": "天津市", "code": "120000" }, { "id": "14aa", "name": "山西省", "code": "140000" }, { "id": "15aa", "name": "内蒙古自治区", "code": "150000" }, { "id": "21aa", "name": "辽宁省", "code": "210000" }, { "id": "22aa", "name": "吉林省", "code": "220000" }, { "id": "32aa", "name": "江苏省", "code": "320000" }, { "id": "33aa", "name": "浙江省", "code": "330000" }, { "id": "34aa", "name": "安徽省", "code": "340000" }, { "id": "23aa", "name": "黑龙江省", "code": "230000" }, { "id": "31aa", "name": "上海市", "code": "310000" }, { "id": "36aa", "name": "江西省", "code": "360000" }, { "id": "35aa", "name": "福建省", "code": "350000" }, { "id": "41aa", "name": "河南省", "code": "410000" }, { "id": "44aa", "name": "广东省", "code": "440000" }, { "id": "42aa", "name": "湖北省", "code": "420000" }, { "id": "43aa", "name": "湖南省", "code": "430000" }, { "id": "52aa", "name": "贵州省", "code": "520000" }, { "id": "53aa", "name": "云南省", "code": "530000" }, { "id": "46aa", "name": "海南省", "code": "460000" }, { "id": "45aa", "name": "广西壮族自治区", "code": "450000" }, { "id": "50aa", "name": "重庆市", "code": "500000" }, { "id": "54aa", "name": "西藏自治区", "code": "540000" }, { "id": "64aa", "name": "宁夏回族自治区", "code": "640000" }, { "id": "65aa", "name": "新疆维吾尔自治区", "code": "650000" }, { "id": "61aa", "name": "陕西省", "code": "610000" }, { "id": "62aa", "name": "甘肃省", "code": "620000" }, { "id": "63aa", "name": "青海省", "code": "630000" }, { "id": "82aa", "name": "澳门特别行政区", "code": null }, { "id": "71aa", "name": "台湾省", "code": null }, { "id": "51aa", "name": "四川省", "code": "510000" }, { "id": "81aa", "name": "香港特别行政区", "code": null } | |
| 7 | + ]; |
littleApp_child/utils/areaSelector/selector.js
View file @
8a1c8e6
| 1 | +// pages/a/a.js | |
| 2 | +// let service = require("../../utils/service.js"); | |
| 3 | +var networkUtil = require('../network_util.js') | |
| 4 | +// 选择器信息 | |
| 5 | +var event = '' | |
| 6 | +import { province } from "./province.js" | |
| 7 | + | |
| 8 | +export let AreaPicker = { | |
| 9 | + // onAreaCommit(locationList){} 需要实现的方法 | |
| 10 | + showAreaSelector(e) {//显示地址选择器 | |
| 11 | + event = e | |
| 12 | + if (!this.data._area_areaList) { | |
| 13 | + this._area_init(); | |
| 14 | + } | |
| 15 | + this.setData({ _area_showSelector: true, name: e.target.dataset.name}) | |
| 16 | + }, | |
| 17 | + _area_hideAreaSelector() {//隐藏地址选择器 | |
| 18 | + this.setData({ _area_showSelector: false }) | |
| 19 | + }, | |
| 20 | + _area_init() {//初始化 | |
| 21 | + this.setData({ | |
| 22 | + _area_level: 6,//总共有几级地址 | |
| 23 | + _area_selectAllArea: true,//是否要求用户选到最后一级 | |
| 24 | + _area_showSelector: false,//是否展示控件 | |
| 25 | + _area_activeTab: 0,//激活的选项卡 | |
| 26 | + _area_checkedIndexArr: [],//选中的地址下标 | |
| 27 | + _area_areaList: [province, null, null, null],//省市区街道二维数组 | |
| 28 | + }) | |
| 29 | + }, | |
| 30 | + _area_selectAreaItem(e) { | |
| 31 | + let level = parseInt(e.target.dataset.level); | |
| 32 | + let index = parseInt(e.target.dataset.index); | |
| 33 | + let id = e.target.dataset.id; | |
| 34 | + let newCheckedIndexArr = this.data._area_checkedIndexArr; | |
| 35 | + let newAreaList = this.data._area_areaList; | |
| 36 | + newCheckedIndexArr[level] = index; | |
| 37 | + switch (level) { | |
| 38 | + case 0: | |
| 39 | + newCheckedIndexArr[1] = null; | |
| 40 | + newCheckedIndexArr[2] = null; | |
| 41 | + newCheckedIndexArr[3] = null; | |
| 42 | + newAreaList[1] = null; | |
| 43 | + newAreaList[2] = null; | |
| 44 | + newAreaList[3] = null; | |
| 45 | + break; | |
| 46 | + case 1: | |
| 47 | + newCheckedIndexArr[2] = null; | |
| 48 | + newCheckedIndexArr[3] = null; | |
| 49 | + newAreaList[2] = null; | |
| 50 | + newAreaList[3] = null; | |
| 51 | + break; | |
| 52 | + case 2: | |
| 53 | + newCheckedIndexArr[3] = null; | |
| 54 | + newAreaList[3] = null; | |
| 55 | + break; | |
| 56 | + } | |
| 57 | + this.setData({ _area_checkedIndexArr: newCheckedIndexArr, _area_areaList: newAreaList }); | |
| 58 | + if (level < this.data._area_level - 1) { | |
| 59 | + //加载下一页地址选择数据 | |
| 60 | + this._area_loadArea(level + 1, id); | |
| 61 | + | |
| 62 | + } else { | |
| 63 | + //选择完成 | |
| 64 | + | |
| 65 | + this._area_commitArea(); | |
| 66 | + } | |
| 67 | + }, | |
| 68 | + _area_reselectArea(e) { | |
| 69 | + let level = parseInt(e.target.dataset.level); | |
| 70 | + this.setData({ | |
| 71 | + _area_activeTab: level, _area_areaList: [province, null, null, null] }); | |
| 72 | + }, | |
| 73 | + _area_loadArea(level, areaId) { | |
| 74 | + console.log('我就是层级',level) | |
| 75 | + let _area_areaList = this.data._area_areaList; | |
| 76 | + var self = this | |
| 77 | + wx.showLoading({ title: '加载中' }); | |
| 78 | + | |
| 79 | + if (this.data.name != "healthResort" && level >= 4){ | |
| 80 | + self._area_commitArea(); | |
| 81 | + wx.hideLoading() | |
| 82 | + return | |
| 83 | + } | |
| 84 | + var addr = 'https://app-member-api.healthbaby.com.cn/vqhdfy/archiveBuildRegions' | |
| 85 | + // 获取省市县 | |
| 86 | + networkUtil._getAddress(addr, { parentId: areaId, hospitalId: getApp().globalData.hospitalId ? getApp().globalData.hospitalId : ''}, function (res) { | |
| 87 | + // 确保返回数据一定有id和name这两个字段 | |
| 88 | + _area_areaList[level] = res.data.list; | |
| 89 | + self.setData({ _area_areaList: _area_areaList }); | |
| 90 | + if (res.data.list.length < 1) {//下级地址为空 | |
| 91 | + self._area_commitArea(); | |
| 92 | + } else { | |
| 93 | + self.setData({ _area_activeTab: level }); | |
| 94 | + } | |
| 95 | + console.log(res) | |
| 96 | + }, function (res) { | |
| 97 | + wx.showToast({ title: `获取地区失败`}) | |
| 98 | + }) | |
| 99 | + // service.getNextAreaList(areaId).then(data => { | |
| 100 | + | |
| 101 | + // this.setData({ _area_areaList: _area_areaList }); | |
| 102 | + // if (nextAreaList.length < 1) {//下级地址为空 | |
| 103 | + // this._area_commitArea(); | |
| 104 | + // } else { | |
| 105 | + // this.setData({ _area_activeTab: level }); | |
| 106 | + // } | |
| 107 | + // wx.hideLoading(); | |
| 108 | + // }).catch(e => { | |
| 109 | + // wx.showToast({ title: `获取地区失败,${JSON.stringify(e)}`, image: '/image/warn.png' }) | |
| 110 | + // }); | |
| 111 | + }, | |
| 112 | + _area_areaSwipe(e) { | |
| 113 | + let level = parseInt(e.detail.current); | |
| 114 | + this.setData({ | |
| 115 | + _area_activeTab: level | |
| 116 | + }); | |
| 117 | + }, | |
| 118 | + | |
| 119 | + _area_commitArea() { | |
| 120 | + let locationList = []; | |
| 121 | + for (let i in this.data._area_checkedIndexArr) { | |
| 122 | + let index = this.data._area_checkedIndexArr[i]; | |
| 123 | + if (index !== null) { | |
| 124 | + let locationItem = { | |
| 125 | + id: this.data._area_areaList[i][index].id, | |
| 126 | + name: this.data._area_areaList[i][index].name, | |
| 127 | + }; | |
| 128 | + locationList.push(locationItem); | |
| 129 | + } else { | |
| 130 | + break; | |
| 131 | + } | |
| 132 | + } | |
| 133 | + if (this.onAreaCommit) { | |
| 134 | + this.onAreaCommit(locationList,event); | |
| 135 | + } else { | |
| 136 | + console.warn('页面缺少 onAreaCommit(locationList) 回调函数'); | |
| 137 | + } | |
| 138 | + this._area_init();//选择完成 重置选择器 | |
| 139 | + } | |
| 140 | + | |
| 141 | +}; |
littleApp_child/utils/areaSelector/selector.wxml
View file @
8a1c8e6
| 1 | +<view class="areaSelectorBg" wx:if="{{_area_showSelector}}" catchtap="_area_hideAreaSelector"> | |
| 2 | + <view class="areaContainer" catchtap> | |
| 3 | + <view class="areaHead" > | |
| 4 | + <block wx:for="{{_area_areaList}}" wx:key="*this"> | |
| 5 | + <view bindtap="_area_reselectArea" data-level="{{index}}" wx:if="{{item}}"class="areaHeadItem pressLighter {{_area_activeTab==index&&'areaHeadItemChecked'}}"> | |
| 6 | + {{_area_checkedIndexArr[index]!=null?item[_area_checkedIndexArr[index]].name:'请选择'}} | |
| 7 | + </view> | |
| 8 | + </block> | |
| 9 | + <text style="flex: 1"/> | |
| 10 | + <text wx:if="{{_area_selectAllArea}}" catchtap="_area_hideAreaSelector" class="areaClose pressLighter">关闭</text> | |
| 11 | + <text wx:else catchtap="_area_commitArea" class="areaCommit pressLighter">确定</text> | |
| 12 | + </view> | |
| 13 | + <swiper class="areaBody" current="{{_area_activeTab}}" bindchange="_area_areaSwipe"> | |
| 14 | + <block wx:for="{{_area_areaList}}" wx:if="{{item}}" wx:key="*this" wx:for-index="level"> | |
| 15 | + <swiper-item> | |
| 16 | + <scroll-view scroll-y="true"> | |
| 17 | + <view class="itemContainer"> | |
| 18 | + <block wx:for="{{item}}" wx:key="id" > | |
| 19 | + <text bindtap="_area_selectAreaItem" class="areaBodyItem pressLighter" | |
| 20 | + data-id="{{item.id}}" data-index="{{index}}" data-level="{{level}}">{{item.name}}</text> | |
| 21 | + </block> | |
| 22 | + </view> | |
| 23 | + </scroll-view> | |
| 24 | + </swiper-item> | |
| 25 | + </block> | |
| 26 | + </swiper> | |
| 27 | + </view> | |
| 28 | +</view> |
littleApp_child/utils/areaSelector/selector.wxss
View file @
8a1c8e6
| 1 | + | |
| 2 | +.areaSelectorBg{ | |
| 3 | + position: fixed; | |
| 4 | + z-index: 100; | |
| 5 | + left: 0; | |
| 6 | + right: 0; | |
| 7 | + top: 0; | |
| 8 | + bottom: 0; | |
| 9 | + background-color: rgba(0, 0, 0, 0.5); | |
| 10 | + display: flex; | |
| 11 | + flex-direction: column-reverse | |
| 12 | +} | |
| 13 | +.areaContainer{ | |
| 14 | + width: 100%; | |
| 15 | + display: block; | |
| 16 | + background-color: white; | |
| 17 | +} | |
| 18 | +.areaHead{ | |
| 19 | + height: 100rpx; | |
| 20 | + line-height: 100rpx; | |
| 21 | + width: 100%; | |
| 22 | + display: flex; | |
| 23 | + font-size: 28rpx; | |
| 24 | + color: #333; | |
| 25 | + border-bottom: 1rpx solid #dddddd; | |
| 26 | +} | |
| 27 | +.areaHeadItem{ | |
| 28 | + padding: 0 15rpx; | |
| 29 | + box-sizing: border-box; | |
| 30 | + height: inherit; | |
| 31 | + max-width: 20%; | |
| 32 | + overflow: hidden; | |
| 33 | + text-overflow:ellipsis; | |
| 34 | + white-space: nowrap; | |
| 35 | +} | |
| 36 | +.areaHeadItem:first-child{ | |
| 37 | + padding:0 30rpx; | |
| 38 | +} | |
| 39 | +.areaHeadItemChecked{ | |
| 40 | + border-bottom: 4rpx crimson solid; | |
| 41 | + font-weight: bold; | |
| 42 | +} | |
| 43 | +.areaCommit{ | |
| 44 | + height: inherit; | |
| 45 | + padding: 0 30rpx; | |
| 46 | + color: #12b7f5; | |
| 47 | + font-size: 32rpx; | |
| 48 | +} | |
| 49 | +.areaClose{ | |
| 50 | + height: inherit; | |
| 51 | + padding: 0 30rpx; | |
| 52 | + color: #666666; | |
| 53 | + font-size: 32rpx; | |
| 54 | +} | |
| 55 | +.areaBody{ | |
| 56 | + height: 600rpx; | |
| 57 | + font-size: 28rpx; | |
| 58 | + text-align:left; | |
| 59 | + box-sizing: border-box; | |
| 60 | + display: flex; | |
| 61 | +} | |
| 62 | +.areaBody scroll-view{ | |
| 63 | + height: 100%; | |
| 64 | +} | |
| 65 | +.itemContainer{ | |
| 66 | + box-sizing: border-box; | |
| 67 | + display: block; | |
| 68 | + padding: 20rpx 20rpx 30rpx 22rpx; | |
| 69 | +} | |
| 70 | +.areaBodyItem{ | |
| 71 | + padding: 12rpx 20rpx; | |
| 72 | + border: 1rpx solid #dddddd; | |
| 73 | + margin: 8rpx 10rpx; | |
| 74 | + display: inline-block; | |
| 75 | +} |
littleApp_child/utils/network_util.js
View file @
8a1c8e6
| 1 | 1 | |
| 2 | 2 | // 测试用户‘花雪莲’,手机号 15928512992 ,验证码666666 |
| 3 | -//childName 七八 ID 130102200105076444 phone 18723569874 motherName 五六 vaNO 1111781111 验证码 | |
| 3 | +//childName 七八 ID 130102200105076444 phone 18723569874 motherName 五六 vaNO 1111781111 验证码 | |
| 4 | 4 | // 18382670036 多层次 |
| 5 | 5 | // 18328537371 陈云 666666 |
| 6 | 6 | // 0测试环境 1正式环境 2演示环境 3衡水 |
| 7 | -var Builing_Release_AppStore = 0; | |
| 7 | +var Builing_Release_AppStore = 4; | |
| 8 | 8 | // 获取服务器地址 |
| 9 | -function kServerBaseUrl() { | |
| 9 | +function kServerBaseUrl() { | |
| 10 | 10 | switch (Builing_Release_AppStore) { |
| 11 | 11 | case 0: |
| 12 | 12 | return 'https://dev-app-member-api.healthbaby.com.cn/'; |
| 13 | 13 | |
| ... | ... | @@ -16,9 +16,11 @@ |
| 16 | 16 | return 'https://stage-app-member-api.healthbaby.com.cn/'; |
| 17 | 17 | case 3: |
| 18 | 18 | return 'https://weixin-bj.healthbaby.com.cn/'; |
| 19 | + case 4: | |
| 20 | + return 'http://192.168.2.5:9090/member/' | |
| 19 | 21 | } |
| 20 | 22 | } |
| 21 | - | |
| 23 | + | |
| 22 | 24 | /* |
| 23 | 25 | * port: 接口名称 类型字符串 |
| 24 | 26 | * params: 参数 类型json |
| 25 | 27 | |
| ... | ... | @@ -159,12 +161,49 @@ |
| 159 | 161 | }) |
| 160 | 162 | } |
| 161 | 163 | |
| 164 | +/* | |
| 165 | + 获取地址 | |
| 166 | +* port: 接口名称 类型字符串 | |
| 167 | +* params: 参数 类型json | |
| 168 | +* success: 成功回调 类型function | |
| 169 | +* fail: 失败回调 类型function | |
| 170 | +*/ | |
| 171 | +function _getAddress(addr,params, success, fail) { | |
| 172 | + wx.request({ | |
| 173 | + url: addr, | |
| 174 | + data: params, | |
| 175 | + method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT | |
| 176 | + header: { | |
| 177 | + 'content-type': 'application/json' | |
| 178 | + }, // 设置请求的 header | |
| 179 | + success: function (res) { | |
| 180 | + // success | |
| 181 | + successData(res, success, fail) | |
| 182 | + }, | |
| 183 | + fail: function (res) { | |
| 184 | + var error = {} | |
| 185 | + error.errorcode = 404 | |
| 186 | + error.errormsg = '数据获取失败,请稍后再试' | |
| 187 | + console.log(res) | |
| 188 | + // fail | |
| 189 | + fail(error) | |
| 190 | + }, | |
| 191 | + complete: function (res) { | |
| 192 | + // complete | |
| 193 | + wx.hideToast() | |
| 194 | + // 小程序提供的api,通知页面停止下拉刷新效果 | |
| 195 | + wx.stopPullDownRefresh(); | |
| 196 | + } | |
| 197 | + }) | |
| 198 | +} | |
| 199 | + | |
| 162 | 200 | module.exports = { |
| 163 | 201 | _get: _get, |
| 164 | 202 | _post: _post, |
| 165 | 203 | _put: _put, |
| 166 | 204 | showLoading: showLoading, |
| 167 | 205 | showErrorToast: showErrorToast, |
| 206 | + _getAddress: _getAddress, | |
| 168 | 207 | Builing_Release_AppStore: Builing_Release_AppStore, |
| 169 | 208 | } |
| 170 | 209 |