Commit 306f04ff authored by lvtz's avatar lvtz

fix

parent e448ec25
...@@ -313,8 +313,7 @@ Page({ ...@@ -313,8 +313,7 @@ Page({
school_id: this.data.sid, school_id: this.data.sid,
sort: 0, sort: 0,
course_id: this.data.courseSelect.id, course_id: this.data.courseSelect.id,
teacher_id: this.data.teacher_id, teacher_id: this.data.teacher_id
imageBox: JSON.stringify(this.data.imageBox)
})).then((res) => { })).then((res) => {
wx.hideLoading(); wx.hideLoading();
if (res.code == 200) { if (res.code == 200) {
......
...@@ -29,10 +29,7 @@ ...@@ -29,10 +29,7 @@
</block> </block>
<block wx:else> <block wx:else>
<view class="video-box"> <view class="video-box">
<view class="video-play-icon-box"> <image class="video-image" src="{{egBanner}}"></image>
<image class="video-play-icon" src="{{imageRoot}}2c/common/playicon.png?{{imageVersion}}"></image>
</view>
<image class="video-image" src="{{imageRoot}}2c/websiteindex/exabanner.png?{{imageVersion}}"></image>
</view> </view>
</block> </block>
<view class="notice-box" wx:if="{{schoolInfo.notice}}"> <view class="notice-box" wx:if="{{schoolInfo.notice}}">
......
...@@ -55,6 +55,7 @@ Page({ ...@@ -55,6 +55,7 @@ Page({
imageVersion: app.globalData.imageVersion, imageVersion: app.globalData.imageVersion,
titleBarHeight: app.globalData.titleBarHeight, titleBarHeight: app.globalData.titleBarHeight,
statusBarHeight: app.globalData.statusBarHeight, statusBarHeight: app.globalData.statusBarHeight,
hasModuleSwitch: true,
localImageRoot: '../../../images/', localImageRoot: '../../../images/',
egBanner: ['https://cdn.img.shangjiadao.cn/qingxiao/dakav2/images/2c/websiteindex/eg/eg_banner.png'], egBanner: ['https://cdn.img.shangjiadao.cn/qingxiao/dakav2/images/2c/websiteindex/eg/eg_banner.png'],
egBannerUrl: 'https://cdn.img.shangjiadao.cn/qingxiao/dakav2/images/2c/websiteindex/eg/eg_banner.png', egBannerUrl: 'https://cdn.img.shangjiadao.cn/qingxiao/dakav2/images/2c/websiteindex/eg/eg_banner.png',
...@@ -133,7 +134,7 @@ Page({ ...@@ -133,7 +134,7 @@ Page({
videoId: '', videoId: '',
src: '' src: ''
}, },
schoolInfo: '', // schoolInfo: {}, //
latitude: '', latitude: '',
longitude: '', longitude: '',
websiteCourses: '', websiteCourses: '',
...@@ -253,15 +254,15 @@ Page({ ...@@ -253,15 +254,15 @@ Page({
}).then(() => { }).then(() => {
this.websitehomeGet() this.websitehomeGet()
this.websitecourseshowGet() this.websitecourseshowGet()
this.websiteintrosGet(); // this.websiteintrosGet();
this.clockListGet(); // this.clockListGet();
this.teacherListGet(); // this.teacherListGet();
this.adsListGet(); // this.adsListGet();
this.momentlistGet(); // this.momentlistGet();
this.onlineCoursesListGet(); // this.onlineCoursesListGet();
this.userShow(); this.userShow();
// this.websiteBarrage();//弹幕 // this.websiteBarrage();//弹幕
this.subjectListGet(); // this.subjectListGet();
const myLocation = LocalStorage.getItem('myLocation'); const myLocation = LocalStorage.getItem('myLocation');
const that = this; const that = this;
wx.login({ wx.login({
...@@ -282,46 +283,45 @@ Page({ ...@@ -282,46 +283,45 @@ Page({
this.setData({ this.setData({
unauthorized: true unauthorized: true
}) })
this.websitehomeGet() // this.websitehomeGet()
this.websitecourseshowGet() // this.websitecourseshowGet()
this.websiteintrosGet(); // this.websiteintrosGet();
this.clockListGet(); // this.clockListGet();
this.momentlistGet(); // this.momentlistGet();
this.onlineCoursesListGet(); // this.onlineCoursesListGet();
this.userShow(); // this.userShow();
// this.websiteBarrage();//弹幕 // this.subjectListGet()
this.subjectListGet()
} }
const myLocation = LocalStorage.getItem('myLocation'); // const myLocation = LocalStorage.getItem('myLocation');
const that = this; // const that = this;
if (myLocation) { // if (myLocation) {
this.setData({ // this.setData({
latitude: Number(myLocation.split('-')[0]), // latitude: Number(myLocation.split('-')[0]),
longitude: Number(myLocation.split('-')[1]), // longitude: Number(myLocation.split('-')[1]),
}) // })
} else { // } else {
wx.getLocation({ // wx.getLocation({
type: 'wgs84', // type: 'wgs84',
success(res) { // success(res) {
const { // const {
latitude, // latitude,
longitude // longitude
} = res; // } = res;
if(that.data.schoolInfo){ // if(that.data.schoolInfo){
that.data.schoolInfo.distance = getFlatternDistance(latitude, longitude, Number(that.data.schoolInfo.latitude), Number(that.data.schoolInfo.longitude)); // that.data.schoolInfo.distance = getFlatternDistance(latitude, longitude, Number(that.data.schoolInfo.latitude), Number(that.data.schoolInfo.longitude));
that.setData({ // that.setData({
'schoolInfo.distance': that.data.schoolInfo.distance // 'schoolInfo.distance': that.data.schoolInfo.distance
}) // })
} // }
LocalStorage.setItem('myLocation', latitude + '-' + longitude) // LocalStorage.setItem('myLocation', latitude + '-' + longitude)
that.setData({ // that.setData({
latitude: latitude, // latitude: latitude,
longitude: longitude, // longitude: longitude,
}) // })
} // }
}) // })
} // }
}, },
onReady: function () { // Do something when page ready onReady: function () { // Do something when page ready
let that = this; let that = this;
...@@ -488,25 +488,6 @@ Page({ ...@@ -488,25 +488,6 @@ Page({
name: e.detail.value name: e.detail.value
}) })
}, },
// 机构介绍
websiteintrosGet() {
websiteintros({
type: 1,
page: 1,
perPage: 4,
school_id: this.data.sid,
}).then((res) => {
const {
data,
code
} = res;
if (code == 200) {
this.setData({
schoolInfoList: [data.list]
})
}
})
},
expandSchoolInfo (e){ expandSchoolInfo (e){
this.setData({ this.setData({
infoexpanded: !this.data.infoexpanded infoexpanded: !this.data.infoexpanded
...@@ -592,6 +573,11 @@ Page({ ...@@ -592,6 +573,11 @@ Page({
adsList: data.list, adsList: data.list,
adsTotal: data.total adsTotal: data.total
}) })
if(this.data.adsTotal>0 && !this.data.hasModuleSwitch){
this.setData({
'schoolInfo.module_switch.adCarousel': true
})
}
} }
}).catch((e) => {}) }).catch((e) => {})
}, },
...@@ -612,6 +598,11 @@ Page({ ...@@ -612,6 +598,11 @@ Page({
teacherList: data.list, teacherList: data.list,
teacherTotal: data.total teacherTotal: data.total
}) })
if(this.data.teacherTotal>0 && !this.data.hasModuleSwitch){
this.setData({
'schoolInfo.module_switch.teacher': true
})
}
} }
}).catch((e) => {}) }).catch((e) => {})
}, },
...@@ -638,6 +629,11 @@ Page({ ...@@ -638,6 +629,11 @@ Page({
momentList: data.list, momentList: data.list,
momentTotal: data.total momentTotal: data.total
}) })
if(this.data.momentTotal>0 && !this.data.hasModuleSwitch){
this.setData({
'schoolInfo.module_switch.classmoments': true
})
}
} }
}).catch((e) => {}) }).catch((e) => {})
}, },
...@@ -656,6 +652,11 @@ Page({ ...@@ -656,6 +652,11 @@ Page({
this.setData({ this.setData({
onlineCoursesList: data.list onlineCoursesList: data.list
}) })
if(this.data.onlineCoursesList.length>0 && !this.data.hasModuleSwitch){
this.setData({
'schoolInfo.module_switch.onlineclass': true
})
}
} }
}) })
}, },
...@@ -706,6 +707,11 @@ Page({ ...@@ -706,6 +707,11 @@ Page({
clockList: data.list || [], clockList: data.list || [],
clockTotal: data.total_count clockTotal: data.total_count
}) })
if(this.data.clockTotal>0 && !this.data.hasModuleSwitch){
this.setData({
'schoolInfo.module_switch.clocklist': true
})
}
} }
} }
let clockRecordIds = data.list.map((ele) => { let clockRecordIds = data.list.map((ele) => {
...@@ -977,13 +983,22 @@ Page({ ...@@ -977,13 +983,22 @@ Page({
data data
} = res; } = res;
if (code == 200) { if (code == 200) {
console.log(data,'data')
if (data) { if (data) {
// const myLocation = LocalStorage.getItem('myLocation'); // const myLocation = LocalStorage.getItem('myLocation');
data.banner = data.banner ? JSON.parse(data.banner) : ''; data.banner = data.banner ? JSON.parse(data.banner) : '';
data.tags = data.tags ? JSON.parse(data.tags) : ''; data.tags = data.tags ? JSON.parse(data.tags) : '';
this.data.hasModuleSwitch = data.module_switch ? true : false;
data.module_switch = data.module_switch ? JSON.parse(data.module_switch): {"clocklist":true,"classmoments":true,"onlineclass":true}; data.module_switch = data.module_switch ? JSON.parse(data.module_switch): {
adCarousel: false,
orgdesc: false,
teacher: false,
clocklist: false,
classmoments: false,
onlineclass: false,
togetherclock: false,
};
let dataSort = ''; let dataSort = '';
// 机构信息/banner图片或视频/体验课 不参与排序 固定位置 // 机构信息/banner图片或视频/体验课 不参与排序 固定位置
...@@ -998,16 +1013,43 @@ Page({ ...@@ -998,16 +1013,43 @@ Page({
dataSort.splice(removeItem3,1) dataSort.splice(removeItem3,1)
} }
// 未设置微官网则 学生动态/学校介绍 // 未设置微官网则 学生动态/学校介绍
// sort: [
// { name: 'orgdesc', desc: '学校介绍'},
// { name: 'clocklist', desc: '学生动态'},
// { name: 'adCarousel', desc: '广告轮播'},
// { name: 'teacher', desc: '名师风采'},
// { name: 'classmoments', desc: '课堂瞬间'},
// { name: 'onlineclass', desc: '在线课堂'},
// { name: 'togetherclock', desc: '一起打卡'}
// ],//默认排序
data.sort = data.sort ? dataSort : [ data.sort = data.sort ? dataSort : [
{ name: 'orgdesc', desc: '学校介绍'}, { name: 'orgdesc', desc: '学校介绍'},
{ name: 'clocklist', desc: '学生动态'}, { name: 'clocklist', desc: '学生动态'},
{ name: 'adCarousel', desc: '广告轮播'}, { name: 'adCarousel', desc: '广告轮播'},// 新的
{ name: 'teacher', desc: '名师风采'}, { name: 'teacher', desc: '名师风采'},// 新的
{ name: 'classmoments', desc: '课堂瞬间'}, { name: 'classmoments', desc: '课堂瞬间'}, // 新的
{ name: 'onlineclass', desc: '在线课堂'}, { name: 'onlineclass', desc: '在线课堂'}, // 新的
{ name: 'togetherclock', desc: '一起打卡'} { name: 'togetherclock', desc: '一起打卡'} // 新的
]; ];
if (!data.sort.find(ele => ele.name == 'classmoments')) {
data.sort.splice(2,0, { name: 'adCarousel', desc: '广告轮播'})
}
if (!data.sort.find(ele => ele.name == 'classmoments')) {
data.sort.push({ name: 'classmoments', desc: '课堂瞬间'})
}
if (!data.sort.find(ele => ele.name == 'onlineclass')) {
data.sort.push({ name: 'onlineclass', desc: '在线课堂'})
}
if (!data.sort.find(ele => ele.name == 'togetherclock')) {
data.sort.push({ name: 'togetherclock', desc: '一起打卡'})
}
this.websiteintrosGet();
this.clockListGet();
this.teacherListGet();
this.adsListGet();
this.momentlistGet();
this.onlineCoursesListGet();
this.subjectListGet();
}else{ }else{
this.schoolInfoGet() this.schoolInfoGet()
this.setData({ this.setData({
...@@ -1018,8 +1060,9 @@ Page({ ...@@ -1018,8 +1060,9 @@ Page({
// data.distance = getFlatternDistance(this.data.latitude, this.data.longitude, Number(data.latitude), Number(data.longitude)); // data.distance = getFlatternDistance(this.data.latitude, this.data.longitude, Number(data.latitude), Number(data.longitude));
this.setData({ this.setData({
bannerEmpty: data && data.banner ? false : true,
schoolInfo: data ? data : '', schoolInfo: data ? data : '',
websitehomeEmpty: data && data.banner ? false : true // websitehomeEmpty: data && data.banner ? false : true
},()=>{ },()=>{
if(that.data.schoolInfo.intro && that.data.schoolInfo.module_switch.orgdesc){ if(that.data.schoolInfo.intro && that.data.schoolInfo.module_switch.orgdesc){
wx.createSelectorQuery().select('.contentMock').boundingClientRect(function (rect) { wx.createSelectorQuery().select('.contentMock').boundingClientRect(function (rect) {
...@@ -1075,10 +1118,6 @@ Page({ ...@@ -1075,10 +1118,6 @@ Page({
}) })
}, 100) }, 100)
} }
}) })
} }
}).catch((e) => { }).catch((e) => {
...@@ -1400,6 +1439,13 @@ Page({ ...@@ -1400,6 +1439,13 @@ Page({
schoolInfoPicTotal: data.list.filter(item=>item.type==1 && item.show_status==1).length || 0, schoolInfoPicTotal: data.list.filter(item=>item.type==1 && item.show_status==1).length || 0,
schoolInfoVideoTotal: data.list.filter(item=>item.type==2 && item.show_status==1).length || 0, schoolInfoVideoTotal: data.list.filter(item=>item.type==2 && item.show_status==1).length || 0,
}) })
console.log(!this.data.hasModuleSwitch, '!this.data.hasModuleSwitch');
if(this.data.schoolInfoPicTotal+this.data.schoolInfoVideoTotal>0 && !this.data.hasModuleSwitch){
console.log('JIDSFFV')
this.setData({
'schoolInfo.module_switch.orgdesc': true
})
}
} }
}) })
}, },
...@@ -1546,6 +1592,11 @@ Page({ ...@@ -1546,6 +1592,11 @@ Page({
subjectTotal: data.total, subjectTotal: data.total,
subjectList: data.list || [] subjectList: data.list || []
}) })
if(this.data.subjectTotal>0 && !this.data.hasModuleSwitch){
this.setData({
'schoolInfo.module_switch.togetherclock': true
})
}
} }
} }
}).catch((e) => { }).catch((e) => {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
</view> </view>
<view class="container" wx:if="{{!websitehomeEmpty}}"> <view class="container" wx:if="{{!websitehomeEmpty}}">
<view class="banner-box" id="banner"> <view class="banner-box" id="banner">
<block wx:if="{{!websitehomeEmpty && !bannerEmpty}}"> <block wx:if="{{!bannerEmpty}}">
<view class="video-box" bindtap="goBannerVideoPlay" wx:if="{{schoolInfo.banner.type=='video'}}"> <view class="video-box" bindtap="goBannerVideoPlay" wx:if="{{schoolInfo.banner.type=='video'}}">
<!-- <view class="video-play-icon-box"> <!-- <view class="video-play-icon-box">
<image class="video-play-icon" src="{{imageRoot}}2c/common/playicon.png?{{imageVersion}}"></image> <image class="video-play-icon" src="{{imageRoot}}2c/common/playicon.png?{{imageVersion}}"></image>
...@@ -32,10 +32,7 @@ ...@@ -32,10 +32,7 @@
</block> </block>
<block wx:else> <block wx:else>
<view class="video-box"> <view class="video-box">
<view class="video-play-icon-box"> <image class="video-image" src="{{egBanner}}"></image>
<image class="video-play-icon" src="{{imageRoot}}2c/common/playicon.png?{{imageVersion}}"></image>
</view>
<image class="video-image" src="{{imageRoot}}2c/websiteindex/exabanner.png?{{imageVersion}}"></image>
</view> </view>
</block> </block>
<view class="notice-box" wx:if="{{schoolInfo.notice}}"> <view class="notice-box" wx:if="{{schoolInfo.notice}}">
...@@ -111,8 +108,6 @@ ...@@ -111,8 +108,6 @@
<image class="icon-mobile" src="{{imageRoot}}2c/websiteindex/website_phone.png?{{imageVersion}}"></image> <image class="icon-mobile" src="{{imageRoot}}2c/websiteindex/website_phone.png?{{imageVersion}}"></image>
</view> </view>
</view> </view>
<block wx:for="{{schoolInfo.sort?schoolInfo.sort:sort}}" wx:key="idx" wx:for-index="idx" wx:for-item="sortItem" > <block wx:for="{{schoolInfo.sort?schoolInfo.sort:sort}}" wx:key="idx" wx:for-index="idx" wx:for-item="sortItem" >
<!-- 广告banner --> <!-- 广告banner -->
<block wx:if="{{sortItem.name=='adCarousel' && schoolInfo.module_switch.adCarousel}}"> <block wx:if="{{sortItem.name=='adCarousel' && schoolInfo.module_switch.adCarousel}}">
......
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