Commit 306f04ff authored by lvtz's avatar lvtz

fix

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