Commit 5d519376 authored by lvtz's avatar lvtz

fix

parent d82b1c5e
......@@ -719,7 +719,8 @@
"name": "coursemgt",
"pages": [
"index",
"edit"
"edit",
"selectcourse"
]
}
],
......
......@@ -51,6 +51,7 @@ Page({
sort: 0,
need_audit: 1
},
courseSelect: [],
submit: false,
audioStatus: { // 录音弹窗的交互状态
show: false,
......@@ -278,6 +279,7 @@ Page({
id: this.data.id,
school_id: this.data.sid,
sort: 0,
// coursename: this.data.courseSelect.title
// need_audit: this.data.needPsd
})).then((res) => {
if (res.code == 200) {
......@@ -489,6 +491,14 @@ Page({
}
console.log(this.data.params)
},
// 选择课程
toSelectCourse(){
let courseSelect = this.data.courseSelect
console.log(courseSelect)
wx.navigateTo({
url: `/business/pages/coursemgt/selectcourse?id=${this.data.id}&sid=${this.data.sid}&from=circle&courseSelect=${courseSelect.id}`
})
},
// 选择老师
toSelectTeachers(){
wx.navigateTo({
......
......@@ -3,8 +3,8 @@
<view class="form-box">
<view class="form-item">
<view class="form-label">课程</view>
<view class="form-content">
<input type="text" class="form-input" value="{{}}" placeholder="请选择课程" bindinput=""/>
<view class="form-content" bindtap="toSelectCourse">
<input type="text" class="form-input" value="{{courseSelect.title}}" placeholder="请选择课程" disabled/>
<image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image>
</view>
</view>
......
......@@ -30,7 +30,7 @@ Page({
onLoad: function (options) {
if (options.sid) {
this.setData({
sid: options.sid || 3
sid: options.sid
});
}
},
......
// src/pages/classmgt/index.js
import {
courseList,
} from '../../../service/business/coursemgt.js';
import {
formIdCreate
} from '../../../service/common.js';
import {
LocalStorage
} from '../../../utilities/index.js';
var app = getApp();
Page({
data: {
localImageRoot: '../../../images/',
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
page: 1,
perPage: 10,
sid: 0,
courseList: [],
courseTatol: '',
hasmore: true,
emptyPage: false,
checkedItems: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
const{sid,courseSelect} = options
this.setData({
sid: sid || 0,
'checkedItems.id':courseSelect
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
page: 1,
hasmore: true,
})
this.getCourseList('init');
},
onPullDownRefresh: function () {
this.setData({
hasmore: true,
page: 1,
})
this.getCourseList('down')
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getCourseList('up')
},
getCourseList(type) {
let dakarole = LocalStorage.getItem('dakarole');
if (!this.data.hasmore) {
return;
}
if (this.data.listLoading) {
return
}
this.setData({
listLoading: true
})
courseList({
page: this.data.page,
perPage: this.data.perPage,
school_id: this.data.sid
}).then((res) => {
const { code, data } = res;
wx.hideLoading();
this.setData({
listLoading: false
})
if (code != 200) { // 失败的处理
} else {
if (data.total) {
this.setData({
courseTatol: data.total
})
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
courseList: [data.list]
}, () => {
if (data.total > this.caculateArrLength(this.data.courseList)) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
case 'down': // 页面下拉刷新
this.setData({
courseList: [data.list]
}, () => {
if (data.total > this.caculateArrLength(this.data.courseList)) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
this.setData({
[`courseList[${this.data.page - 1}]`]: data.list
}, () => {
if (this.data.classTatol > this.caculateArrLength(this.data.courseList)) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
default:
break;
}
if (this.caculateArrLength(this.data.courseList) == 0) {
this.setData({
emptyPage: true
})
} else {
this.setData({
emptyPage: false,
})
}
}
}).catch((e) => {
this.setData({
listLoading: false
})
})
},
caculateArrLength(array) {
let _length = 0;
array.forEach(ele => {
_length = _length + ele.length;
})
return _length;
},
// 选择课程 单选
listenCheckboxChange: function (e) {
const { item } = e.currentTarget.dataset;
this.setData({
checkedItems: item
})
console.log(this.data.checkedItems);
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2];
prevPage.setData({
courseSelect: item,
})
wx.navigateBack({
delta: 1,
})
},
})
\ No newline at end of file
{
"navigationBarTitleText": "选择课程",
"usingComponents": {
"list-loading": "../../../components/listloading"
}
}
\ No newline at end of file
<!-- <wxs src="../../../filter/index.wxs" module="filter" /> -->
<view class="container">
<view class="userlist-box" wx:if="{{!emptyPage}}">
<block wx:for="{{courseList}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="list-item" wx:for="{{bigitem}}" wx:for-item="item" data-item="{{item}}" wx:key="{{index}}" bindtap="listenCheckboxChange">
<image class="icon-checkbox" src="{{imageRoot}}2b/common/radioactive2.png?{{imageVersion}}" wx:if="{{item.id == checkedItems.id}}"></image>
<image class="icon-checkbox" src="{{localImageRoot}}2b/common/radiono.png?{{imageVersion}}" wx:else></image>
<!-- <image class="avatar" src="{{filter.imagify(item.avatar, 'image/resize,w_160/format,jpg')}}"></image> -->
<view class="itme-content">
<view class="nickname">{{item.title}}</view>
</view>
</view>
</block>
<list-loading loading="{{listLoading}}"></list-loading>
</view>
<view class="empty-content" wx:else>
<image class='empty-img' src='{{imageRoot}}2c/rankinglist/empty.png?{{imageVersion}}'></image>
<view class="empty-text">暂无数据~</view>
</view>
<view class="has-nomore" wx:if="{{!emptyPage && !hasmore}}">没有更多了</view>
</view>
\ No newline at end of file
@import '../../../style/userlist.wxss';
/* 空场景 */
.empty-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
flex-direction: column;
align-items: center;
line-height: 45rpx;
}
.empty-content .empty-img {
width: 263rpx;
height: 219rpx;
}
.empty-content .empty-text {
font-size: 26rpx;
color: rgba(0, 0, 0, 0.6);
}
.has-nomore{
font-size: 26rpx;
color: #9C9C9D;
padding: 75rpx 0;
text-align: center;
}
\ No newline at end of file
......@@ -13,6 +13,9 @@ import {
schoolList
} from '../../../service/business/ucenter.js';
import messages from '../../../constants/messages.js';
import {
bTokenExchange
} from '../../../service/common.js'
const app = getApp();
Page({
......@@ -289,17 +292,22 @@ Page({
})
return;
}else { // 登录成功
LocalStorage.setItem('user', {
expires_in: data.expires_in,
token: `bearer ${data.token}`,
mobile,
// role: 1 // 1是校长 2是老师
})
LocalStorage.setItem('dakarole', 1);
wx.showToast({
title: '登录成功',
mask: true,
success () {
bTokenExchange({
type: 1,
member_token: data.token
}).then(res2=>{
LocalStorage.setItem('user', {
expires_in: res2.data.expires_in,
token: `bearer ${res2.data.token}`,
mobile,
// role: 1 // 1是校长 2是老师
})
LocalStorage.setItem('dakarole', 1);
wx.showToast({
title: '登录成功',
mask: true,
success () {
formIdCreate({
formId
})
......@@ -325,8 +333,11 @@ Page({
url: '/business/pages/shopeditor/index?from=1'
})
})
}
}
})
})
}
}).catch((err) => {
wx.hideLoading();
......
......@@ -13,6 +13,9 @@ import {
schoolList
} from '../../../service/business/ucenter.js';
import messages from '../../../constants/messages.js';
import {
bTokenExchange
} from '../../../service/common.js'
const app = getApp();
Page({
......@@ -63,34 +66,6 @@ Page({
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
mobileInput(e) {
this.setData({
"params.mobile": e.detail.value
......@@ -166,8 +141,14 @@ Page({
})
},
login(e) {
LocalStorage.setItem('dakarole', 2);
wx.reLaunch({
url: `/business/pages/organizationalmgt/index?sid=3`
})
return;
const { formId } = e.detail;
const { mobile, password, verify_code } = this.data.params;
const { mobile, verify_code } = this.data.params;
const visitor = LocalStorage.getItem('visitor') || {};
const that = this;
if (mobile == '') {
......@@ -194,30 +175,6 @@ Page({
})
return;
}
if (password == '' && !that.data.type) {
that.setData({
warnTip: '请输入密码'
}, () => {
setTimeout(function () {
that.setData({
warnTip: false
})
}, 2000)
})
return
}
if (!regexp.passWord.test(password) && !that.data.type) {
that.setData({
warnTip: '密码格式不正确'
}, () => {
setTimeout(function () {
that.setData({
warnTip: false
})
}, 2000)
})
return;
}
if (that.submiting) {
return
}
......@@ -233,8 +190,7 @@ Page({
})
login({
mobile,
password: this.data.type ? '' : password,
verify_code: this.data.type ? verify_code : '',
verify_code ,
min_open_id: visitor && visitor.openid,
union_id: visitor && visitor.unionid,
}).then((res) => {
......@@ -255,43 +211,49 @@ Page({
})
return;
} else { // 登录成功
LocalStorage.setItem('user', {
expires_in: data.expires_in,
token: `bearer ${data.token}`,
mobile,
// role: 1 // 1是校长 2是老师
})
LocalStorage.setItem('dakarole', 1);
wx.showToast({
title: '登录成功',
mask: true,
success() {
formIdCreate({
formId
})
schoolList({
page: 1,
perPage: 100
}).then((res) => {
if (res.code == 200) {
if (res.data.total > 0) {
wx.reLaunch({
url: `/business/pages/organizationalmgt/index?sid=${res.data.list[0].id}`
})
bTokenExchange({
type: 1,
member_token: data.token
}).then(res2=>{
LocalStorage.setItem('user', {
expires_in: res2.data.expires_in,
token: `bearer ${res2.data.token}`,
mobile,
// role: 1 // 1是校长 2是老师
})
LocalStorage.setItem('dakarole', 2);
wx.showToast({
title: '登录成功',
mask: true,
success () {
formIdCreate({
formId
})
schoolList({
page: 1,
perPage: 100
}).then((res) => {
if (res.code == 200) {
if (res.data.total > 0 ) {
wx.reLaunch({
url: `/business/pages/organizationalmgt/index?sid=${res.data.list[0].id}`
})
} else {
wx.redirectTo({
url: '/business/pages/shopeditor/index?from=1'
})
}
} else {
wx.redirectTo({
url: '/business/pages/shopeditor/index?from=1'
})
}
} else {
}
}).catch(() => {
wx.redirectTo({
url: '/business/pages/shopeditor/index?from=1'
}).catch(() => {
wx.redirectTo({
url: '/business/pages/shopeditor/index?from=1'
})
})
})
}
}
})
})
}
}).catch((err) => {
......
......@@ -12,13 +12,15 @@ Page({
imageVersion: app.globalData.imageVersion,
id: 0,
sid: 0,
params: {
students: '',
type: 1,
number: '',
remark: '',
},
number: '',
remark: '',
consumer_id: '',
submit: false,
typeList: [
{type: 'add',title: '增加积分'},
{type: 'sub',title: '减少积分'}
],
typeSelect: 'add'
},
onLoad: function(options) { // Do some initialize when page load.
const {sid} = options;
......@@ -41,30 +43,25 @@ Page({
numberinput(e){
const {value} = e.detail;
this.setData({
'params.number': Number(value)
'number': Number(value)
})
},
remarkinput (e) {
const {value} = e.detail;
this.setData({
'params.remark': value.length > 500 ? value.substr(0, 500) : value
'remark': value.length > 500 ? value.substr(0, 500) : value
})
},
// 类型选择
typeChange(){
let type=this.data.params.type;
if(type==1){
type=2
}else{
type=1
}
typeChange(e){
const {type} = e.currentTarget.dataset;
this.setData({
'params.type': type
typeSelect: type
})
},
doSave (e) {
const number = parseInt(Number(this.data.params.number))
let number = parseInt(Number(this.data.number))
if (number<1) {
wx.showModal({
title: '提示',
......@@ -75,7 +72,7 @@ Page({
})
return;
}
if (!this.data.params.remark) {
if (!this.data.remark) {
wx.showModal({
title: '提示',
content: '备注内容不能为空',
......@@ -96,11 +93,16 @@ Page({
title: '保存中...'
})
// TODO 换接口
memberIntegral(Object.assign({},this.data.params,{
if(this.data.typeSelect=='sub'){
number =- number
}else{
}
memberIntegral({
school_id: this.data.sid,
// consumer_id: this.data.singleStudentInfo.consumer_id,
})).then((res) => {
consumer_id: this.data.consumer_id,
number: number,
remark: this.data.remark
}).then((res) => {
const { code, data } = res;
this.setData({
listLoading: false
......
......@@ -4,36 +4,31 @@
<view class="form-item">
<view class="form-label">学员</view>
<view class="form-content" bindtap="toSelectStudents">
<input type="text" class="form-input" value="{{params.students}}" placeholder="请选择学员" disabled/>
<input type="text" class="form-input" value="{{consumer_id}}" placeholder="请选择学员" disabled/>
<image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image>
</view>
</view>
<view class="form-item">
<view class="form-label">类型</view>
<view class="form-content">
<view class="radio-item" bindtap="typeChange">
<image class="icon-checkbox" src="{{imageRoot}}2b/common/radioactive2.png?{{imageVersion}}" wx:if="{{params.type==1}}"></image>
<image class="icon-checkbox" src="{{localImageRoot}}2b/common/radiono.png?{{imageVersion}}" wx:if="{{params.type!=1}}"></image>
<view class="radio-title">增加积分</view>
</view>
<view class="radio-item" bindtap="typeChange">
<image class="icon-checkbox" src="{{imageRoot}}2b/common/radioactive2.png?{{imageVersion}}" wx:if="{{params.type==2}}"></image>
<image class="icon-checkbox" src="{{localImageRoot}}2b/common/radiono.png?{{imageVersion}}" wx:if="{{params.type!=2}}"></image>
<view class="radio-title">减少积分</view>
<view class="radio-item" bindtap="typeChange" wx:for="{{typeList}}" data-type="{{item.type}}" wx:key="">
<image class="icon-checkbox" src="{{imageRoot}}2b/common/radioactive2.png?{{imageVersion}}" wx:if="{{item.type==typeSelect}}"></image>
<image class="icon-checkbox" src="{{localImageRoot}}2b/common/radiono.png?{{imageVersion}}" wx:else></image>
<view class="radio-title">{{item.title}}</view>
</view>
</view>
</view>
<view class="form-item">
<view class="form-label">积分值</view>
<view class="form-content">
<input type="number" class="form-input" value="{{params.number}}" placeholder="请输入积分值" bindinput="numberinput"/>
<input type="number" class="form-input" value="{{number}}" placeholder="请输入积分值" bindinput="numberinput"/>
<image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image>
</view>
</view>
<view class="form-item">
<view class="form-label">备注</view>
<view class="form-content">
<textarea class="form-input form-remark" auto-height value="{{params.remark}}"placeholder="请输入备注信息" bindinput="remarkinput"></textarea>
<textarea class="form-input form-remark" auto-height value="{{remark}}"placeholder="请输入备注信息" bindinput="remarkinput"></textarea>
<image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image>
</view>
</view>
......
......@@ -14,12 +14,12 @@
<list-loading loading="{{listLoading}}"></list-loading>
</view>
<view class="bottom-fixbox" bindtap="sureSelect">确认</view>
<view class="form-fixbtn" bindtap="sureSelect">确认</view>
<view class="empty-content" wx:if="{{emptyPage}}">
<image class='empty-img' src='{{imageRoot}}2c/rankinglist/empty.png?{{imageVersion}}'></image>
<view class="empty-text">暂无数据~</view>
</view>
<view class="has-nomore" wx:if="{{!emptyPage && !hasmore}}">没有更多了</view>
<view class="has-nomore" wx:if="{{!emptyPage && !hasmore && page>1}}">没有更多了</view>
</view>
\ No newline at end of file
......@@ -24,79 +24,4 @@
color: #9C9C9D;
padding: 75rpx 0;
text-align: center;
}
/* 学员列表 */
.userlist-box{
width: 100%;
}
.userlist-box .list-item{
display: flex;
align-items: center;
padding: 24rpx;
position: relative;
}
.list-item::after{
content: '';
width: 100%;
height: 1px;
background: rgba(0,0,0,.05);
position: absolute;
left: 0;
bottom: 0;
}
.userlist-box .list-item .icon-checkbox{
width: 31rpx;
height: 31rpx;
position: relative;
margin-right: 39rpx;
}
.userlist-box .list-item .avatar{
width: 66rpx;
height: 66rpx;
border-radius: 50%;
margin-right: 30rpx;
}
.userlist-box .list-item .itme-content{
display: flex;
flex-direction: column;
justify-content: space-between;
font-size: 26rpx;
color: #000;
line-height: 1;
/* min-height: 66rpx; */
}
.userlist-box .list-item .itme-content .nickname{
font-size: 26rpx;
color: #000;
}
.userlist-box .list-item .itme-content .info-box{
font-size: 24rpx;
color: #777;
display: flex;
align-items: center;
}
.userlist-box .list-item .itme-content .info-box .num{
font-size: 26rpx;
color: #FFB97A;
font-weight: 500;
}
/* 底部固定操作栏 */
.bottom-fixbox{
font-size: 30rpx;
color: #fff;
position: fixed;
bottom: 120rpx;
left: 50%;
transform: translateX(-50%);
width: 365rpx;
height: 80rpx;
background: #65B8F4;
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
z-index: 5;
}
}
\ No newline at end of file
import {
commonwaitjobGet,
} from '../../service/business/common.js'
import {
LocalStorage,
} from '../../utilities/index.js';
var app = getApp();
Component({
properties: {
......@@ -34,6 +37,12 @@ Component({
pageLifetimes: {
show: function () {
this.getCommonwaitJob();
const dakarole = LocalStorage.getItem('dakarole');
this.setData({
dakarole: dakarole,
},()=>{
console.log('this.data.dakarole',this.data.dakarole)
})
},
hide: function () {
}
......
......@@ -17,25 +17,34 @@
</view>
</view> -->
<view class="btabbar">
<view class="btabbaritem class {{current == 'dc' ? 'active' : ''}}" bindtap="chooseTab" data-type="dc">
<image class="icon class" wx:if="{{current != 'dc'}}" src="/images/btabbar/dc.png" ></image>
<image class="icon class" wx:if="{{current == 'dc'}}" src="/images/btabbar/dcactive.png" ></image>
<text class="btabbaritemname" >数据中心</text>
</view>
<view class="btabbaritem message {{current == 'workbench' ? 'active' : ''}}" bindtap="chooseTab" data-type="workbench">
<image class="icon workbench" wx:if="{{current != 'workbench'}}" src="/images/btabbar/workbench.png" ></image>
<image class="icon workbench" wx:if="{{current == 'workbench'}}" src="/images/btabbar/workbenchactive.png" ></image>
<text class="btabbaritemname" >工作台</text>
<!-- <view class="message-count" wx:if="{{waitJob > 0}}">{{waitJob > 99 ? '99+' : waitJob}}</view> -->
</view>
<view class="btabbaritem class {{current == 'class' ? 'active' : ''}}" bindtap="chooseTab" data-type="class">
<image class="icon class" wx:if="{{current != 'class'}}" src="/images/btabbar/class.png" ></image>
<image class="icon class" wx:if="{{current == 'class'}}" src="/images/btabbar/classactive.png" ></image>
<text class="btabbaritemname" >课务</text>
</view>
<view class="btabbaritem ucenter {{current == 'ucenter' ? 'active' : ''}}" bindtap="chooseTab" data-type="ucenter">
<block wx:if="{{dakarole==1}}">
<view class="btabbaritem {{current == 'dc' ? 'active' : ''}}" bindtap="chooseTab" data-type="dc">
<image class="icon dc" wx:if="{{current != 'dc'}}" src="/images/btabbar/dc.png" ></image>
<image class="icon dc" wx:if="{{current == 'dc'}}" src="/images/btabbar/dcactive.png" ></image>
<text class="btabbaritemname">数据中心</text>
</view>
<view class="btabbaritem {{current == 'workbench' ? 'active' : ''}}" bindtap="chooseTab" data-type="workbench">
<image class="icon workbench" wx:if="{{current != 'workbench'}}" src="/images/btabbar/workbench.png" ></image>
<image class="icon workbench" wx:if="{{current == 'workbench'}}" src="/images/btabbar/workbenchactive.png" ></image>
<text class="btabbaritemname">工作台</text>
<!-- <view class="message-count" wx:if="{{waitJob > 0}}">{{waitJob > 99 ? '99+' : waitJob}}</view> -->
</view>
<view class="btabbaritem {{current == 'class' ? 'active' : ''}}" bindtap="chooseTab" data-type="class">
<image class="icon class" wx:if="{{current != 'class'}}" src="/images/btabbar/class.png" ></image>
<image class="icon class" wx:if="{{current == 'class'}}" src="/images/btabbar/classactive.png" ></image>
<text class="btabbaritemname">课务</text>
</view>
</block>
<block wx:if="{{dakarole==2}}">
<view class="btabbaritem {{current == 'class' ? 'active' : ''}}" bindtap="chooseTab" data-type="class">
<image class="icon class" wx:if="{{current != 'class'}}" src="/images/btabbar/home.png" ></image>
<image class="icon class" wx:if="{{current == 'class'}}" src="/images/btabbar/homeactive.png" ></image>
<text class="btabbaritemname">首页</text>
</view>
</block>
<view class="btabbaritem {{current == 'ucenter' ? 'active' : ''}}" bindtap="chooseTab" data-type="ucenter">
<image class="icon ucenter" wx:if="{{current != 'ucenter'}}" src="/images/btabbar/ucenter.png" ></image>
<image class="icon ucenter" wx:if="{{current == 'ucenter'}}" src="/images/btabbar/ucenteractive.png" ></image>
<text class="btabbaritemname" >我</text>
<text class="btabbaritemname">我</text>
</view>
</view>
\ No newline at end of file
......@@ -130,6 +130,9 @@ const apis = {
noticecount: `${api}student/notice/count`, // 我的未读消息数量
noticeread: `${api}student/notice/read`, // 消息已读上报
},
mycourse: {
courseApi: `${api}member/erp/student/classes`//我的课程列表
},
schoolindex: {
classindex: `${api}student/class/index`,
schoolClassList: `${api}student/class/class_list`,
......
import {
wxRequest
} from '../../utilities/request.js';
import apis from '../../constants/api.js';
function courseList(data) {
return wxRequest({
url: apis.customer.mycourse.courseApi,
data,
method: 'GET',
errorresolve: 1,
})
}
export {
courseList
}
\ No newline at end of file
// src/pages/myclassrecord/index.js
import {
courseList,
} from '../../../service/business/coursemgt.js';
var app = getApp();
Page({
......@@ -9,6 +12,14 @@ Page({
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
localImageRoot: '../../../images/',
page: 1,
perPage: 10,
sid: 0,
courselist: [],
courseTatol: '',
hasmore: true,
emptyPage: false,
courselist: [
{
id:1,
......@@ -69,55 +80,148 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.sid) {
this.setData({
sid: options.sid
});
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
this.setData({
page: 1,
hasmore: true,
})
this.getCourseList('init');
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
hasmore: true,
page: 1,
})
this.getCourseList('down')
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getCourseList('up')
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
getCourseList(type) {
if (!this.data.hasmore) {
return;
}
if (this.data.listLoading) {
return
}
this.setData({
listLoading: true
})
courseList({
page: this.data.page,
perPage: this.data.perPage,
school_id: this.data.sid
}).then((res) => {
const { code, data } = res;
wx.hideLoading();
this.setData({
listLoading: false
})
if (code != 200) { // 失败的处理
} else {
if (data.total) {
this.setData({
courseTatol: data.total
})
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
courseList: [data.list]
}, () => {
if (data.total > this.caculateArrLength(this.data.courseList)) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
case 'down': // 页面下拉刷新
this.setData({
courseList: [data.list]
}, () => {
if (data.total > this.caculateArrLength(this.data.courseList)) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
this.setData({
[`courseList[${this.data.page - 1}]`]: data.list
}, () => {
if (this.data.classTatol > this.caculateArrLength(this.data.courseList)) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
default:
break;
}
if (this.caculateArrLength(this.data.courseList) == 0) {
this.setData({
emptyPage: true
})
} else {
this.setData({
emptyPage: false,
})
}
}
}).catch((e) => {
this.setData({
listLoading: false
})
})
},
caculateArrLength(array) {
let _length = 0;
array.forEach(ele => {
_length = _length + ele.length;
})
return _length;
},
})
\ No newline at end of file
......@@ -31,9 +31,9 @@
</view>
</block>
</view>
<view class="empty-content" wx:if="{{!emptyPage}}">
<view class="empty-content" wx:if="{{emptyPage}}">
<image class='empty-img' src='{{imageRoot}}2b/potentialcustomer/emptyimg.png?{{imageVersion}}'></image>
<view class="empty-text">暂无数据~</view>
</view>
<view class="has-nomore">没有更多了</view>
<view class="has-nomore" wx:if="{{!emptyPage && page>1}}">没有更多了</view>
</view>
import {
mixedthemeList
} from '../../../service/customer/circleindex.js';
import {
formIdCreate,
getActivities,
activityLog
} from '../../../service/common.js';
courseList
} from '../../../service/customer/mycourses.js';
import {
LocalStorage
} from '../../../utilities/index.js';
import {
noticecount
} from '../../../service/customer/mynews.js';
import {
mineClassList
} from '../../../service/customer/circleindex.js';
import {
noticeread,
} from '../../../service/customer/mynews.js';
var app = getApp();
Page({
data: {
......@@ -40,22 +27,21 @@ Page({
classList: [],
classTotal: 0,
selectedClass: {},
noticecount: 0,
statusTab: [
{ tabname: "进行中课程", statusType: 1 },
{ tabname: "已结束课程", statusType: 2 }
],
statusType: 1
statusType: 1,
custormeId: 0
},
onLoad: function (options) { // Do some initialize when page load.
const {
sid
sid,custormeId
} = options;
this.setData({
sid
sid,
custormeId
});
wx.hideShareMenu();
const visitor = LocalStorage.getItem('visitor');
},
onReady: function () { // Do something when page ready
},
......@@ -67,8 +53,7 @@ Page({
page: 1,
hasmore: true,
})
this.getClassList();
this.noticecountGet();
// this.getClassList();
if (this.data.id) {
this.courseListGet('init');
}
......@@ -95,21 +80,6 @@ Page({
backTopValue: backTopValue
})
},
noticecountGet() {
noticecount({
school_id: this.data.sid
}).then((res) => {
const {
code,
data
} = res;
if (code == 200) {
this.setData({
noticecount: data.list[3] + data.list[1] + data.list[2]
})
}
})
},
subjectStatusShift(e) {
const { statustype } = e.currentTarget.dataset;
this.setData({
......@@ -176,12 +146,12 @@ Page({
// wx.showLoading({
// title: '数据加载中'
// })
mixedthemeList({
courseList({
page: this.data.page,
perPage: this.data.perPage,
student_id: 0,
class_id: this.data.id,
type: this.data.statusType,
sort_type: 1
}).then((res) => {
const {
code,
......
......@@ -18,6 +18,7 @@
}
.userlist-box .list-item .icon-checkbox{
width: 31rpx;
min-width: 31rpx;
height: 31rpx;
position: relative;
margin-right: 39rpx;
......@@ -35,11 +36,11 @@
font-size: 26rpx;
color: #000;
line-height: 1;
/* min-height: 66rpx; */
}
.userlist-box .list-item .itme-content .nickname{
font-size: 26rpx;
color: #000;
line-height: 40rpx;
}
.userlist-box .list-item .itme-content .info-box{
font-size: 24rpx;
......
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