Commit bebc3109 authored by 石盼盼's avatar 石盼盼

Merge branch 'shipanpan' into 'master'

Shipanpan

See merge request !27
parents 6f020145 9decfc16
......@@ -24,7 +24,7 @@
</view>
</view>
<view class="status">
<view class="evaluation" data-id="{{item.id}}" data-class_single_id="{{item.class_single_id}}" catchtap="goperformance" wx:if="{{item.is_leave == 0}}">运动评价</view>
<view class="evaluation" data-id="{{item.child_id}}" data-class_single_id="{{item.class_single_id}}" catchtap="goperformance" wx:if="{{item.is_leave == 0}}">运动评价</view>
<view class="leave" wx:else>已请假</view>
<view class="unread" wx:if="{{ !item.class_moment }}"></view>
</view>
......
......@@ -7,8 +7,14 @@ Page({
* 页面的初始数据
*/
data: {
city: '',
cityShow: false,
cityList: []
cityList: [],
city_name: '',
cityChecked: '',
show: false,
forIndex: 3,
areaNameList: [],
},
/**
......@@ -17,14 +23,36 @@ Page({
onLoad: function (options) {
this.getCitylist()
},
getCitylist : function () {
showCitypop(e) {
this.setData({
show: true,
showIndex: e.currentTarget.dataset.index
})
},
onClose() {
this.setData({
show: false
})
},
getCitylist: function () {
let params = {
url : 'coach/city',
callback : (data) => {
url: 'coach/city',
callback: (data) => {
console.log(data)
this.setData({
cityList : data
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)
......@@ -39,87 +67,107 @@ Page({
cityShow: false
})
},
chooseCity(e) {
let index = e.currentTarget.dataset.index
let list = this.data.cityList
if (list[index].isChecked) {
list[index].isChecked = false
} else {
list[index].isChecked = true
console.log(e.currentTarget.dataset.item)
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({
cityList: list
city: cityChecked,
city_id: cityChecked_id,
cityShow: false
})
// console.log(e.currentTarget.dataset.item)
// if (e.currentTarget.dataset.item.city_name != this.data.cityChecked) {
// this.setData({
// cityList: list
// })
// }
this.getArealist(region_id)
},
cityChangeComfirm() {
for (var i = 0; i < this.data.cityList.length; i++) {
if (this.data.cityChecked == this.data.cityList[i].city_name) {
app.globalData.city_id = this.data.cityList[i].id
app.globalData.city_name = this.data.cityList[i].city_name
getArealist: function (region_id) {
let params = {
url: 'coach/area',
data: {
region_id: region_id
},
callback: (data) => {
console.log(data)
var areaNameList = []
for (let i in data) {
areaNameList.push(data[i].name); //属性
}
console.log(areaNameList)
this.setData({
areaNameList: areaNameList,
areaList: data
})
}
}
base.newRequest(params)
},
onConfirm(event) {
const { picker, value, index } = event.detail;
const {showIndex, areaList } = this.data;
let area_id;
for(let i = 0; i<areaList.length;i++){
if(areaList[i].name == value){
area_id = areaList[i].id;
}
}
if(showIndex == 1){
this.setData({
first_area_name: value,
first_area: area_id
})
}else if(showIndex == 2){
this.setData({
second_area_name: value,
second_area: area_id
})
}else if(showIndex == 3){
this.setData({
cityShow: false
third_area_name: value,
third_area: area_id
})
}
// if (arr.length == 0) {
// base.toast('至少选择一个城市')
// }else {
// console.log(arr)
// }
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
console.log(area_id)
this.setData({
show: !this.data.show
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onCancel() {
this.setData({
show : !this.data.show
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
save : function () {
const {city_id, first_area, second_area, third_area} = this.data;
if(first_area || second_area || third_area){
let params = {
url : 'coach/save_area',
data : {
coach_id: 5,
city_id,
first_area,
second_area,
third_area
},
type:'POST',
callback : (data) => {
base.toast('保存区域成功')
}
}
base.newRequest(params)
}else{
base.toast('请至少选择一个意向区域')
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {},
"usingComponents": {
"van-picker": "/components/vant/picker/index"
},
"navigationBarTitleText": "教学区域"
}
\ No newline at end of file
<view class="place flex-h flex-vc" catchtap="changeCity">
<image src="../../../images/location.png"></image>
<view>已选城市:石家庄</view>
<view>已选城市:{{city}}</view>
</view>
<view class="select">选择意向区域</view>
<view class="every flex-h flex-vc flex-hb">
<view>意向区域1</view>
<view>
<text>长安区</text>
<text class="iconfont icongengduo"></text>
</view>
</view>
<view class="line"></view>
<view class="every flex-h flex-vc flex-hb">
<view>意向区域2</view>
<view>
<text>高新区</text>
<text class="iconfont icongengduo"></text>
</view>
</view>
<view class="line"></view>
<view class="every flex-h flex-vc flex-hb">
<view>意向区域3</view>
<view>
<text>裕华区</text>
<text class="iconfont icongengduo"></text>
<view class="item" wx:for="{{forIndex}}" wx:key="index">
<view class="every flex-h flex-vc flex-hb">
<view>意向区域{{index+1}}</view>
<view bindtap="showCitypop" data-index="{{index+1}}">
<text wx:if="{{index == 0}}">{{first_area_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>
</view>
</view>
<view class="line"></view>
</view>
<view class="line"></view>
<van-popup show="{{ show }}" position="bottom" custom-style="height: 50%;" bind:close="onClose">
<van-picker show-toolbar columns="{{ areaNameList }}" bind:confirm="onConfirm" bind:cancel="onCancel" />
</van-popup>
<view class="cityBox" wx:if="{{cityShow}}" catchtap="closeCityShow">
<view class="cityContent">
<view class="cityTitle">
......@@ -37,13 +25,15 @@
<text class="iconfont iconguanbi1" catchtap="closeCityShow"></text>
</view>
<view class="cityCenter">
<!-- <view class="cityCenter_title">已开通服务城市</view> -->
<view class="cityCenter_con flex-h flex-hw">
<block wx:for='{{cityList}}' wx:key='index'>
<text class="{{item.isChecked ? 'city_active' : ''}}" catchtap="chooseCity" data-index='{{index}}'>{{item.city_name}}</text>
<text class="{{cityChecked == item.city_name ? 'city_active': ''}}" catchtap="chooseCity" data-index='{{index}}' data-item='{{item}}'>{{item.city_name}}</text>
</block>
</view>
</view>
<view class="cityConfirm" catchtap="cityChangeComfirm">确定</view>
</view>
</view>
<view class="button">
<view class="save" bindtap="save">保存</view>
</view>
\ No newline at end of file
......@@ -105,4 +105,26 @@ line-height: 68rpx;
margin: 29rpx auto 0 auto;
font-size: 28rpx;
color: #1A1A1A;
}
/* 按钮样式 */
.button{
width: 750rpx;
height: 118rpx;
padding: 18rpx 68rpx 20rpx;
position: fixed;
bottom: 0;
background: #FFFFFF;
}
.button .save{
width: 620rpx;
height: 80rpx;
border:none;
background: linear-gradient(-70deg, #FFC600 0%, #FFD400 100%);
border-radius: 40rpx;
color: #000000;
font-size: 30rpx;
text-align: center;
line-height: 80rpx;
}
\ No newline at end of file
......@@ -11,7 +11,7 @@ Page({
data: {
showUserInfo: true, //用户信息是否显示
noticeCount: 9, // 家长回复小红点
show:false,
show: false,
subjectShow: false,
subjectList:[],
// subjectList:[
......@@ -56,7 +56,7 @@ Page({
})
}
},
goLogin() {
wx.navigateTo({ // 登录
url: '/pages/sign/login/login',
......@@ -67,25 +67,25 @@ Page({
url: '/pages/sign/info/info',
})
},
goparents:function(){
goparents: function () {
wx.navigateTo({
url: '../../my/parents/parents',
})
},
goteachingArea:function(){
goteachingArea: function () {
wx.navigateTo({
url: '../../my/teachingArea/teachingArea',
})
},
getSubjectlist : function (){
getSubjectlist: function () {
let params = {
url:'coach/course',
callback : (data) => {
url: 'coach/course',
callback: (data) => {
console.log(data)
this.setData({
subjectList : data
subjectList: data
})
}
}
base.newRequest(params)
......@@ -99,7 +99,7 @@ Page({
chooseOne(e) {
let index = e.currentTarget.dataset.index
let list = this.data.subjectList
if (list[index].isChecked){
if (list[index].isChecked) {
list[index].isChecked = false
} else {
list[index].isChecked = true
......@@ -108,20 +108,38 @@ Page({
subjectList: list
})
},
confirm(){
confirm() {
var arr = []
for (var i=0; i<this.data.subjectList.length;i++) {
var newArr = []
for (var i = 0; i < this.data.subjectList.length; i++) {
if (this.data.subjectList[i].isChecked == true) {
arr.push(this.data.subjectList[i])
newArr.push(this.data.subjectList[i].id)
}
}
console.log(arr)
console.log(newArr)
if (arr.length == 0) {
base.toast('教学科目至少选择一项')
} else {
console.log(arr)
let params = {
url: 'coach/save_course',
data: {
coach_id: 4,
course_ids: JSON.stringify(newArr)
},
type : 'POST',
callback: (data) => {
base.toast('保存科目成功')
this.setData({
subjectShow : false
})
}
}
base.newRequest(params)
}
},
goCall: function(e){
goCall: function (e) {
wx.showModal({
content: '确定要拨打电话吗?',
success(res) {
......
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