Commit e089fe6c authored by lvtz's avatar lvtz

fix

parent d3d4b18b
......@@ -63,26 +63,37 @@ Page({
swiperIndex: 0,
bannerList: ['https://cdn.img.shangjiadao.cn/source/images/dakav4/banner/banner1.png'],
newsLsit: '',
recomdCourseList: [],
courseTotal: 0,
coursepage: 1,
coursehasmore: true,
courselistLoading: false,
courseEmpty: false,
schoolActivitesList: [],
teacherEmpty: false,
teacherList: [],
teacherpage: 1,
teacherhasmore: true,
teacherlistLoading: false,
teacherTotal: 0,
studentList: [],
studentEmpty:false,
studentpage: 1,
studenthasmore: true,
studentlistLoading: false,
studentTotal: 0,
presenceList: [],
presenceEmpty:false,
presencepage: 1,
presencehasmore: true,
presencelistLoading: false,
presenceTotal: 0,
schoolinstroInfo: '',
gainInfo: ''
},
......@@ -101,7 +112,7 @@ Page({
})
this.teacherlistGet('init');
this.studentlistGet('init');
this.presencelistGet('init')
this.presencelistGet('init');
},
/**
......@@ -115,7 +126,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.recomdCourseGet();
this.recomdCourseGet('init');
this.schoolActivitesGet();
this.schoolInstroInfoGet();
this.websitedetailGet();
......@@ -146,16 +157,16 @@ Page({
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log(this.data.actIndex)
switch (this.data.actIndex) {
case 4:
this.teacherlistGet('up');
break;
default:
break;
}
},
// onReachBottom: function () {
// console.log(this.data.actIndex)
// switch (this.data.actIndex) {
// case 4:
// this.teacherlistGet('up');
// break;
// default:
// break;
// }
// },
/**
* 用户点击右上角分享
......@@ -239,22 +250,30 @@ Page({
const {
dataset
} = e.currentTarget;
const {
id,
index,
bigindex
} = e.currentTarget.dataset;
const _courseList = this.data.recomdCourseList;
wx.showModal({
title: '提示',
content: '是否删除该课程?',
success(res) {
if (res.confirm) {
recomdCourseDelate({
id: dataset.item.id
id: id
}).then((res) => {
if (res.code == 200) {
let recomdCourseList = that.data.recomdCourseList.filter(ele => ele.id != dataset.item.id);
if (res.code != 200) {
} else {
_courseList[bigindex].splice(index, 1);
that.setData({
recomdCourseList: recomdCourseList,
recomdCourseList: _courseList,
courseEmpty: _courseList.length == 0 ? true : false
})
} else {
console.log(this.data.courseEmpty)
wx.showToast({
title: '删除成功',
icon: 'success',
......@@ -272,24 +291,103 @@ Page({
}
})
},
// 商品列表
recomdCourseGet() {
// 课程列表
recomdCourseGet(type) {
// console.log(type)
if (!this.data.coursehasmore) {
return;
}
if (this.data.courselistLoading) {
return
}
this.setData({
courselistLoading: true
})
console.log('页码',this.data.coursepage);
recomdCourseGet({
school_id: this.data.sid,
}).then(res => {
const {
data,
code
} = res;
if (code == 200) {
if (data) {
page: 1,
perPage: 6,
school_id: this.data.sid
}).then((res) => {
const { code, data } = res;
wx.hideLoading();
this.setData({
courselistLoading: false
})
if (code != 200) { // 失败的处理
} else {
if (data.total != undefined) {
this.data.courseTotal = data.total
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
recomdCourseList: [data.list]
}, () => {
console.log(this.data.recomdCourseList)
if (this.data.courseTotal > this.caculateArrLength(this.data.recomdCourseList)) {
let page = this.data.coursepage + 1;
this.data.coursepage = page;
} else { // 没有更多了
this.setData({
coursehasmore: false
})
}
})
break;
case 'down': // 页面下拉刷新
this.setData({
recomdCourseList: [data.list]
}, () => {
if (this.data.courseTotal > this.caculateArrLength(this.data.recomdCourseList)) {
let page = this.data.coursepage + 1;
this.data.coursepage = page;
} else { // 没有更多了
this.setData({
coursehasmore: false
})
}
})
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
this.setData({
[`recomdCourseList[${this.data.coursepage - 1}]`]: data.list
}, () => {
if (this.data.courseTotal > this.caculateArrLength(this.data.recomdCourseList)) {
let page = this.data.coursepage + 1;
this.data.coursepage = page;
} else { // 没有更多了
this.setData({
coursehasmore: false
})
}
})
break;
default:
break;
}
if (this.caculateArrLength(this.data.recomdCourseList) == 0) {
this.setData({
recomdCourseList: data.list
courseEmpty: true
})
} else {}
} else {
this.setData({
courseEmpty: false,
})
}
}
}).catch((e) => {
this.setData({
courselistLoading: false
})
})
},
loadmoreCourse (){
this.recomdCourseGet('up');
},
// ——————————————————————————————————————————————————————————学校活动
editOraddSchoolActivity (e){
......@@ -550,7 +648,7 @@ Page({
})
teacherlist({
page: this.data.teacherpage,
perPage: 2,
perPage: this.data.perPage/2,
school_id: this.data.sid
}).then((res) => {
const { code, data } = res;
......@@ -996,14 +1094,11 @@ Page({
swiperIndex: e.detail.current
})
},
<<<<<<< HEAD
prevImg (e) {
let environmentArr = this.data.schoolinstroInfo.environment;
let bigindex = e.currentTarget.dataset.bigindex;
let smallindex = e.currentTarget.dataset.index;
let imageBox = environmentArr[`${bigindex}`].imageBox;
console.log(bigindex,smallindex)
let images = imageBox.map(ele => ele.src);
const current = images[`${smallindex}`];
wxPreviewImage({
......@@ -1012,11 +1107,9 @@ Page({
})
},
=======
go2cWebsite(){
wx.navigateTo({
url: `/src/pages/officialweb/officialwebindex?sid=${this.data.sid}`
})
}
>>>>>>> 9fea03fe12f5c0e8230635bf46346a9822f149bd
})
\ No newline at end of file
......@@ -14,20 +14,11 @@
<view class="icon">
<image class="icon2" src="{{localImageRoot}}2b/officialwebmgt/share.png?{{imageVersion}}" ></image>
</view>
<<<<<<< HEAD
<view class="text">转发给学员</view>
</view>
<view class="nav-item">
<view class="nav-item" bindtap="go2cWebsite">
<view class="icon">
<image class="icon3" src="{{localImageRoot}}2b/officialwebmgt/preview.png?{{imageVersion}}" ></image>
=======
<view class="text" hover-class="none" hover-stop-propagation="false">转发给学员</view>
<button open-type="share" class="share-btn"></button>
</view>
<view class="nav-item" hover-class="none" hover-stop-propagation="false" bindtap="go2cWebsite">
<view class="icon" hover-class="none" hover-stop-propagation="false">
<image class="icon3" src="{{localImageRoot}}2b/officialwebmgt/preview.png?{{imageVersion}}" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""></image>
>>>>>>> 9fea03fe12f5c0e8230635bf46346a9822f149bd
</view>
<view class="text">预览</view>
</view>
......@@ -143,10 +134,10 @@
</view>
</view>
<view class="recomdcourse-box" wx:if="{{tabList[3].status}}">
<view class="goods-box" wx:if="{{recomdCourseList.length>0}}">
<view class="prizecontent">
<view class="prizecardbox {{index%2==0 ?'odd':'even'}}" wx:for="{{recomdCourseList}}" wx:key="">
<view class="prizecard" >
<view class="goods-box" wx:if="{{!courseEmpty}}">
<view class="prizecontent" wx:for="{{recomdCourseList}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="prizecardbox {{index%2==0 ?'odd':'even'}}" wx:for="{{bigitem}}" wx:key="{{index}}">
<view class="prizecard">
<image class="prizeimage" src="{{filter.imagify(filter.jsonParse(item.banner)[0], 'image/resize,w_320/format,jpg/quality,q_50')}}"></image>
<view class="prizename" >{{item.title}}</view>
<view class="prizestatic" >
......@@ -155,10 +146,12 @@
</view>
<view class="operatebox">
<view class="operatebtn" bindtap="editOrAddCourse" data-id="{{item.id}}">修改</view>
<view class="operatebtn" bindtap="delCourse" data-item="{{item}}">删除</view>
<view class="operatebtn" bindtap="delCourse" data-bigindex="{{bigindex}}" data-id="{{item.id}}" data-index="{{index}}">删除</view>
</view>
</view>
</view>
<list-loading loading="{{courselistLoading}}"></list-loading>
<view class="loadmore" bindtap="loadmoreCourse" wx:if="{{coursehasmore}}">加载更多</view>
</view>
<view class="" wx:else>
<view class="empty-content">
......@@ -175,37 +168,37 @@
<view class="text-box">还没有开启,开启后才可以编辑哦~</view>
</view>
</view>
<view class="content-item teacher-content-item" wx:if="{{actIndex===4}}">
<view class="title" >
<view class="text" >名师团队</view>
<view class="switch-box" >
<view class="content-item teacher-content-item" wx:if="{{actIndex===4}}">
<view class="title">
<view class="text">名师团队</view>
<view class="switch-box">
<w-switch slot="content" value="{{ tabList[4].status }}" size="small" color="#65B8F4" bind:onChange="handleChange" data-index="4" data-name="teacher"/>
</view>
</view>
<view class="teacher-box" wx:if="{{!teacherEmpty&&tabList[4].status}}">
<block wx:for="{{teacherList}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="clearfix" wx:for="{{teacherList}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="teacher-item" wx:for="{{bigitem}}" wx:key="{{index}}">
<view class="card-box" >
<view class="img-box" >
<view class="card-box">
<view class="img-box">
<image class="" src="{{filter.imagify(item.avatar)}}"></image>
</view>
<view class="name-text" >{{item.name}}</view>
<view class="name-text">{{item.name}}</view>
</view>
<view class="btn-box" >
<view class="btn-box">
<view class="btn" bindtap="goofficialwebteachermgt" data-id="{{item.id?item.id:0}}">修改</view>
<view class="btn" bindtap="delTeacher" data-bigindex="{{bigindex}}" data-id="{{item.id}}" data-index="{{index}}">删除</view>
</view>
</view>
</block>
</view>
<list-loading loading="{{teacherlistLoading}}"></list-loading>
<!-- <view class="loadmore" bindtap="loadmoresTeacher" wx:if="{{teacherhasmore}}">加载更多</view> -->
<view class="loadmore" bindtap="loadmoresTeacher" wx:if="{{teacherhasmore}}">加载更多</view>
</view>
<view class="empty-box" wx:if="{{teacherEmpty&&tabList[4].status}}">
<view class="icon" ><image class='empty-content-img' src='{{imageRoot}}2c/rankinglist/empty.png?{{imageVersion}}'></image></view>
<view class="text" >还没有添加名师,赶紧添加吧~</view>
<view class="empty-box" wx:if="{{teacherEmpty&&tabList[4].status}}">
<view class="icon"><image class='empty-content-img' src='{{imageRoot}}2c/rankinglist/empty.png?{{imageVersion}}'></image></view>
<view class="text">还没有添加名师,赶紧添加吧~</view>
</view>
<view class="add-btn" bindtap="goofficialwebteachermgt" wx:if="{{tabList[4].status}}">添加老师</view>
<view class="guide-box" wx:if="{{!tabList[4].status}}">
<view class="add-btn" bindtap="goofficialwebteachermgt" wx:if="{{tabList[4].status}}">添加老师</view>
<view class="guide-box" wx:if="{{!tabList[4].status}}">
<view class="img-box" >
<image class="" src="{{localImageRoot}}2b/officialwebmgt/gog.png?{{imageVersion}}"></image>
</view>
......@@ -219,28 +212,28 @@
<w-switch slot="content" value="{{ tabList[5].status }}" size="small" color="#65B8F4" bind:onChange="handleChange" data-index="5" data-name="student"/>
</view>
</view>
<view class="student-wrapper-box" wx:if="{{tabList[5].status}}">
<view class="student-wrapper-box" wx:if="{{tabList[5].status}}">
<view class="title-box"><image class="dot-icon" src="{{localImageRoot}}2b/officialwebmgt/dot.png?{{imageVersion}}"></image>优秀学员<image class="dot-icon" src="{{localImageRoot}}2b/officialwebmgt/dot.png?{{imageVersion}}"></image></view>
<view class="teacher-box" wx:if="{{!studentEmpty}}">
<view class="clearfix" wx:for="{{studentList}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="teacher-item" wx:for="{{bigitem}}" wx:key="{{index}}">
<view class="teacher-box" wx:if="{{!studentEmpty}}">
<view class="clearfix" wx:for="{{studentList}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="teacher-item" wx:for="{{bigitem}}" wx:key="{{index}}">
<view class="card-box" >
<view class="img-box" >
<image class="" src="{{filter.imagify(item.cover)}}"></image>
</view>
<view class="name-text" >{{item.nickname}}</view>
<view class="name-text">{{item.nickname}}</view>
</view>
<view class="btn-box" >
<view class="btn" data-id="{{item.id?item.id:0}}" bindtap="goofficialwebstudentmgt">修改</view>
<view class="btn" data-bigindex="{{bigindex}}" data-id="{{item.id}}" data-index="{{index}}" bindtap="delTeacher">删除</view>
<view class="btn-box">
<view class="btn" data-id="{{item.id?item.id:0}}" bindtap="goofficialwebstudentmgt">修改</view>
<view class="btn" data-bigindex="{{bigindex}}" data-id="{{item.id}}" data-index="{{index}}" bindtap="delTeacher">删除</view>
</view>
</view>
</view>
<list-loading loading="{{studentlistLoading}}"></list-loading>
<view class="loadmore" bindtap="loadmoresStudent" wx:if="{{studenthasmore}}">加载更多</view>
<view class="loadmore" bindtap="loadmoresStudent" wx:if="{{studenthasmore}}">加载更多</view>
</view>
<view class="empty-box" wx:if="{{studentEmpty}}">
<view class="text" >还没有添加学员,赶紧添加吧~</view>
<view class="text">还没有添加学员,赶紧添加吧~</view>
</view>
<view class="add-btn" bindtap="goofficialwebstudentmgt">添加学员</view>
</view>
......
......@@ -34,22 +34,8 @@
height: 80rpx;
}
<<<<<<< HEAD
/* 顶部tab */
.tab-box{
=======
}
.officialwebmgt-container .nav-box .nav-item .share-btn{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 1;
opacity: 0;
}
.officialwebmgt-container .tab-box{
>>>>>>> 9fea03fe12f5c0e8230635bf46346a9822f149bd
padding: 36rpx 12rpx 12rpx 23rpx;
box-shadow:0px 8rpx 10rpx 0px rgba(0, 0, 0, 0.05);
display: flex;
......
......@@ -19,7 +19,6 @@ import {
import {
recomdCourseDetail,
recomdCourseUpdate,
recomdCourseAdd,
circleAllSubject
} from '../../../service/business/website.js';
......@@ -349,30 +348,16 @@ Page({
let content = JSON.parse(JSON.stringify(sjdMediaEditor.data.content));
let _content = content.filter((ele) => ele.value.trim() != '');
_params.introduce = JSON.stringify(_content);
let ajax = null;
if (this.data.courseId != 0) {
ajax = recomdCourseUpdate(Object.assign(_params, this.data.params, {
banner: JSON.stringify(this.data.params.banner),
school_id: this.data.sid,
class_id: this.data.cid,
title: this.data.params.title,
// introduce: introduce,
remark: this.data.params.remark,
subject_ids: JSON.stringify(this.data.checkedItems),
id: this.data.courseId
}))
} else {
ajax = recomdCourseAdd(Object.assign(_params, this.data.params, {
banner: JSON.stringify(this.data.params.banner),
school_id: this.data.sid,
class_id: this.data.cid,
title: this.data.params.title,
// introduce: introduce,
remark: this.data.params.remark,
subject_ids: JSON.stringify(this.data.checkedItems)
}))
}
ajax.then((res) => {
recomdCourseAdd(Object.assign(_params, this.data.params, {
banner: JSON.stringify(this.data.params.banner),
school_id: this.data.sid,
class_id: this.data.cid,
title: this.data.params.title,
// introduce: introduce,
remark: this.data.params.remark,
subject_ids: JSON.stringify(this.data.checkedItems),
id: this.data.courseId
})).then((res) => {
const { code, data } = res;
if (code == 200) {
wx.showToast({
......
......@@ -359,8 +359,7 @@ const apis = {
schoolActivitesDetail: `${api}member/website/activity/detail`, //B-活动详情
recomdCourseGet: `${api}member/website/subject`, //B-推荐课程列表
recomdCourseAdd: `${api}member/website/subject`, //B-推荐课程新增
recomdCourseUpdate: `${api}member/website/subject`, //B-推荐课程修改
recomdCourseAdd: `${api}member/website/subject`, //B-推荐课程新增修改
recomdCourseDelete: `${api}member/website/subject/destory`, //B-推荐课程删除
recomdCourseDetail: `${api}member/website/subject/detail`, //B-推荐课程详情
......
......@@ -65,24 +65,23 @@ function recomdCourseGet(data) {
needToken: true
})
}
// 推荐课程修改
function recomdCourseUpdate(data) {
return wxRequest({
role: '2b',
url: apis.business.website.recomdCourseUpdate + '/' + data.id,
method: 'PUT',
data,
errorresolve: 1
})
}
// 推荐课程新增
// 推荐课程修改新增
function recomdCourseAdd(data) {
let type = '',url = '';
if (data.id == 0) {
type = 'POST';
url = apis.business.website.recomdCourseAdd;
}else{
type = 'PUT';
url = apis.business.website.recomdCourseAdd + '/' + data.id
}
return wxRequest({
role: '2b',
url: apis.business.website.recomdCourseAdd,
method: 'POST',
url: url,
method: type,
data,
errorresolve: 1
errorresolve: 1,
})
}
// 推荐课程详情
......@@ -376,7 +375,6 @@ export {
schoolActivitesDelete,
schoolActivitesDetail,
recomdCourseGet,
recomdCourseUpdate,
recomdCourseAdd,
recomdCourseDelate,
recomdCourseDetail,
......
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