Commit 891a24ab authored by 石盼盼's avatar 石盼盼

Merge branch 'master' of...

Merge branch 'master' of http://gitlab.xueyoubangedu.com/shipanpan/wandouchengzhang_coach into shipanpan
parents 43ca7f63 7a0b5346
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<text class="prev-handle iconfont icon-left" bindtap="changeDate" data-type="prev_month"></text> <text class="prev-handle iconfont icon-left" bindtap="changeDate" data-type="prev_month"></text>
</view> </view>
<view class="flex date-in-handle b lr cc" bindtap="doubleClickToToday"> <view class="flex date-in-handle b lr cc" bindtap="doubleClickToToday">
{{calendar.curYear || "--"}}年{{calendar.curMonth || "--"}}月</view> {{calendar.curYear || "--"}}-{{calendar.curMonth || "--"}}</view>
<view class="next fs36" wx:if="{{!config.weekMode}}"> <view class="next fs36" wx:if="{{!config.weekMode}}">
<text class="next-handle iconfont icon-right" bindtap="changeDate" data-type="next_month"></text> <text class="next-handle iconfont icon-right" bindtap="changeDate" data-type="next_month"></text>
</view> </view>
......
const app = getApp() const app = getApp()
import { Base } from '../../../utils/base.js'; import {
Base
} from '../../../utils/base.js';
const base = new Base() const base = new Base()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
city: '', coach_id: '',
cityShow: false, currentArea: [],
cityList: [],
city_name: '',
cityChecked: '',
show: false,
forIndex: 3,
areaNameList: [],
},
/** city: '',
* 生命周期函数--监听页面加载 cityShow: false,
*/ cityList: [],
onLoad: function (options) { city_name: '',
this.getCitylist() cityChecked: '',
this.getMyarea() show: false,
}, areaNameList: [],
showCitypop(e) { },
this.setData({
show: true,
showIndex: e.currentTarget.dataset.index
})
},
onClose() {
this.setData({
show: false
})
},
getMyarea : function () {
let params = {
url:'coach/myarea',
data : {
coach_id: app.globalData.coach_id,
},
callback : (data) => {
console.log(data)
this.setData({
myarea : data
})
}
}
base.newRequest(params)
},
getCitylist: function () {
let params = {
url: 'coach/city',
callback: (data) => {
console.log(data)
this.setData({
cityList: data
})
for (let i = 0; i < data.length; i++) {
if (data[i].is_default == 1) {
this.setData({
cityChecked: data[i].city_name,
city: data[i].city_name,
region_id: data[i].region_id,
city_id: data[i].id
})
}
}
this.getArealist(this.data.region_id)
}
}
base.newRequest(params)
},
changeCity: function (e) {
this.setData({
cityShow: true
})
},
closeCityShow: function (e) {
this.setData({
cityShow: false
})
},
chooseCity(e) { /**
console.log(e.currentTarget.dataset.item) * 生命周期函数--监听页面加载
let city_name = e.currentTarget.dataset.item.city_name; */
let city_id = e.currentTarget.dataset.item.id; onLoad: function (options) {
let region_id = e.currentTarget.dataset.item.region_id; this.setData({
if (e.currentTarget.dataset.item.city_name != this.data.cityChecked) { coach_id: app.globalData.coach_id
this.setData({ })
cityChecked: city_name, this.getMyarea()
cityChecked_id: city_id, this.getCitylist()
region_id: region_id
}) },
this.getArealist(region_id) getMyarea: function () {
} let params = {
}, url: 'coach/myarea',
cityChangeComfirm: function (e) { data: {
const { cityChecked, cityChecked_id, region_id } = this.data; coach_id: this.data.coach_id,
this.setData({ },
city: cityChecked, callback: (data) => {
city_id: cityChecked_id, var arr = []
cityShow: false for(var i in data.area){
}) let option = {
this.getArealist(region_id) id: data.area[i] !=null && data.area[i].id ? data.area[i].id: '',
}, name: data.area[i] !=null && data.area[i].name ? data.area[i].name: '',
getArealist: function (region_id) { }
let params = { arr.push(option)
url: 'coach/area', }
data: { this.setData({
region_id: region_id currentArea: arr
}, })
callback: (data) => { console.log(this.data.currentArea)
console.log(data) }
var areaNameList = [] }
for (let i in data) { base.newRequest(params)
areaNameList.push(data[i].name); //属性 },
} getCitylist: function () {
console.log(areaNameList) let params = {
this.setData({ url: 'coach/city',
areaNameList: areaNameList, callback: (data) => {
areaList: data this.setData({
}) cityList: data
} })
} for (let i = 0; i < data.length; i++) {
base.newRequest(params) if (data[i].is_default == 1) {
}, this.setData({
onConfirm(event) { cityChecked: data[i].city_name,
const { picker, value, index } = event.detail; city: data[i].city_name,
const {showIndex, areaList } = this.data; region_id: data[i].region_id,
let area_id; city_id: data[i].id
for(let i = 0; i<areaList.length;i++){ })
if(areaList[i].name == value){ }
area_id = areaList[i].id; }
} this.getArealist(this.data.region_id)
} }
if(showIndex == 1){ }
this.setData({ base.newRequest(params)
first_area_name: value, },
first_area: area_id getArealist: function (region_id) {
}) let params = {
}else if(showIndex == 2){ url: 'coach/area',
this.setData({ data: {
second_area_name: value, region_id: region_id
second_area: area_id },
}) callback: (data) => {
}else if(showIndex == 3){ var areaNameList = []
this.setData({ for (let i in data) {
third_area_name: value, areaNameList.push(data[i].name); //属性
third_area: area_id }
}) this.setData({
} areaNameList: areaNameList,
console.log(area_id) areaList: data
this.setData({ })
show: !this.data.show }
}) }
}, base.newRequest(params)
onCancel() { },
this.setData({ showCitypop(e) {
show : !this.data.show this.setData({
}) show: true,
}, showIndex: e.currentTarget.dataset.index
save : function () { })
const {city_id, first_area, second_area, third_area} = this.data; },
if(first_area || second_area || third_area){ onClose() {
let params = { this.setData({
url : 'coach/save_area', show: false
data : { })
// coach_id : 5, },
coach_id: app.globalData.coach_id,
city_id,
first_area, changeCity: function (e) {
second_area, this.setData({
third_area cityShow: true
}, })
type:'POST', },
callback : (data) => { closeCityShow: function (e) {
base.toast('保存区域成功') this.setData({
} cityShow: false
} })
base.newRequest(params) },
}else{
base.toast('请至少选择一个意向区域') chooseCity(e) {
} let city_name = e.currentTarget.dataset.item.city_name;
}, let city_id = e.currentTarget.dataset.item.id;
let region_id = e.currentTarget.dataset.item.region_id;
if (e.currentTarget.dataset.item.city_name != this.data.cityChecked) {
this.setData({
cityChecked: city_name,
cityChecked_id: city_id,
region_id: region_id
})
this.getArealist(region_id)
}
},
cityChangeComfirm: function (e) {
const {
cityChecked,
cityChecked_id,
region_id
} = this.data;
this.setData({
city: cityChecked,
city_id: cityChecked_id,
cityShow: false
})
this.getArealist(region_id)
},
onConfirm(event) {
let index = event.detail.index
let list = this.data.currentArea
list[this.data.showIndex-1].name = this.data.areaList[index].name
list[this.data.showIndex-1].id = this.data.areaList[index].id
this.setData({
currentArea: list,
show: !this.data.show
})
},
onCancel() {
this.setData({
show: !this.data.show
})
},
save: function () {
if (this.data.currentArea[0].id || this.data.currentArea[1].id || this.data.currentArea[2].id) {
let params = {
url: 'coach/save_area',
data: {
coach_id : this.data.coach_id,
city_id: this.data.city_id,
first_area: this.data.currentArea[0].id,
second_area: this.data.currentArea[1].id,
third_area: this.data.currentArea[2].id
},
type: 'POST',
callback: (data) => {
base.toast('保存区域成功')
}
}
base.newRequest(params)
} else {
base.toast('请至少选择一个意向区域')
}
},
}) })
\ No newline at end of file
...@@ -3,13 +3,11 @@ ...@@ -3,13 +3,11 @@
<view>已选城市:{{city}}</view> <view>已选城市:{{city}}</view>
</view> </view>
<view class="select">选择意向区域</view> <view class="select">选择意向区域</view>
<view class="item" wx:for="{{forIndex}}" wx:key="index"> <view class="item" wx:for="{{currentArea}}" wx:key="index">
<view class="every flex-h flex-vc"> <view class="every flex-h flex-vc">
<view class="one">意向区域{{index+1}}</view> <view class="one">意向区域{{index+1}}</view>
<view class="two" bindtap="showCitypop" data-index="{{index+1}}"> <view class="two" bindtap="showCitypop" data-index="{{index+1}}">
<text wx:if="{{index == 0}}">{{first_area_name}}</text> <text>{{item.name}}</text>
<text wx:if="{{index == 1}}">{{second_area_name}}</text>
<text wx:if="{{index == 2}}">{{third_area_name}}</text>
<text class="iconfont icongengduo"></text> <text class="iconfont icongengduo"></text>
</view> </view>
</view> </view>
......
<view class="info"> <view class="info">
<!-- <view class="onerow flex-h flex-vc flex-hb">
<text>手机号码</text>
<view>
<input type="number" max-length='11' value="{{telphone}}" bindinput="changeTel"/>
</view>
</view> -->
<view class="onerow flex-h flex-vc flex-hb"> <view class="onerow flex-h flex-vc flex-hb">
<text>账户昵称</text> <text>账户昵称</text>
<view> <view>
...@@ -14,7 +8,7 @@ ...@@ -14,7 +8,7 @@
<view class="onerow flex-h flex-vc flex-hb"> <view class="onerow flex-h flex-vc flex-hb">
<text>账户头像</text> <text>账户头像</text>
<view class="flex-h" catchtap="changeImg"> <view class="flex-h" catchtap="changeImg">
<image src="{{headImg}}"></image> <image src="{{headImg}}" mode="aspectFill"></image>
</view> </view>
</view> </view>
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</view> </view>
<view class="every flex-h flex-vc flex-hb" catchtap="tcHold"> <view class="every flex-h flex-vc flex-hb" catchtap="tcHold">
<view class="row title"> <view class="row title">
<image src="../../../images/my/per_icon_03.png"></image> <image mode="aspectFill" src="../../../images/my/per_icon_03.png"></image>
<view>教学科目</view> <view>教学科目</view>
</view> </view>
<view class="row"> <view class="row">
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment