Commit 9a225db7 authored by lvtz's avatar lvtz

fix website

parent 58a2ae8e
import {
websitesubjectGet
} from '../../../service/customer/websiteindex.js';
var app = getApp();
Page({
data: {
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
localImageRoot: '../../../images/',
list: [],
total: '',
page: 1,
perPage: 10,
hasmore: true,
emptyPage: false,
listloading: false,
},
onLoad: function (options) {
const {
sid
} = options;
this.setData({
sid: sid || 0
});
this.subjectListGet('init');
// app.getCurrentSchoolStudentId({
// source_id: this.data.sid,
// source_type: 10,
// }).then(() => {
// this.setData({
// page: 1,
// hasmore: true,
// })
// this.subjectListGet('init');
// })
},
onPullDownRefresh: function () {
this.setData({
page: 1,
hasmore: true,
})
this.teacherlistGet('down')
},
onReachBottom: function () {
this.teacherlistGet('up')
},
subjectListGet(type) {
if (!this.data.hasmore) {
return;
}
if (this.data.listloading) {
return
};
this.setData({
listloading: true
})
websitesubjectGet({
page: this.data.page,
perPage: this.data.perPage,
school_id: this.data.sid,
}).then((res) => {
const { code, data } = res;
this.setData({
listloading: false
})
if (code != 200) { // 失败的处理
} else {
if (data.total) {
this.setData({
subjectTotal: data.total
})
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
subjectList: data.list || []
}, () => {
console.log('subjectList',this.data.subjectList)
if (this.data.subjectTotal > this.data.subjectList.length) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
case 'down': // 页面下拉刷新
this.setData({
subjectList: data.list || []
}, () => {
if (this.data.subjectTotal > this.data.subjectList.length) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
let list = this.data.subjectList;
let _list = list.concat(data.list);
this.setData({
subjectList: _list
// [`subjectList[${this.data.page - 1}]`]: data.list
}, () => {
if (this.data.subjectTotal > this.data.subjectList.length) {
let page = this.data.page + 1;
this.setData({
page,
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
default:
break;
}
if (this.data.subjectList.length==0) {
this.setData({
emptyPage: true
})
} else {
this.setData({
emptyPage: false
})
}
}
}).catch((e) => {
this.setData({
listloading: false
})
})
},
goSharemoretheme(e){
const { item } = e.currentTarget.dataset;
switch (item.subject_mixture.subject_type) {
case 1:
wx.navigateTo({
url:`/src/pages/themeindex/landpage?tid=${item.subject_mixture.subject_id}&sid=${this.data.sid}`
})
break;
case 2:
wx.navigateTo({
url:`/src/pages/calendarthemeindex/landpage?tid=${item.subject_mixture.subject_id}&sid=${this.data.sid}`
})
break;
case 3:
wx.navigateTo({
url:`/src/pages/sharemoretheme/index?tid=${item.subject_mixture.subject_id}&sid=${this.data.sid}`
})
break;
default:
break;
}
}
})
\ No newline at end of file
{
"navigationBarTitleText": "一起打卡",
"enablePullDownRefresh": true,
"usingComponents": {
"list-loading": "../../../components/listloading",
"empty-content": "../../../components/emptycontent"
}
}
\ No newline at end of file
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="subject-list">
<view class="list-item" wx:for="{{subjectList}}" wx:key="index" bindtap="goSharemoretheme" data-item="{{item}}">
<view class="cover-box">
<!-- <image class="cover" src="{{filter.imagify(item.banner)}}" mode="aspectFill"/> -->
<image class="cover" src="https://cdn.s.shangjiadao.cn/clock/min/b/5d68ddeace846.jpg" mode="aspectFill"/>
</view>
<view class="main">
<view class="title">{{item.subject_mixture.title}}</view>
<view class="count-box">
<image class="icon" src="{{localImageRoot}}2c/websiteindex/icon_user.png?{{imageVersion}}"/>{{item.subject_mixture.subject_students_count}}人参与
</view>
</view>
</view>
<!-- <list-loading loading="{{subjectListLoading}}"></list-loading> -->
</view>
<list-loading loading="{{listloading}}"></list-loading>
<view wx:if="{{emptyPage}}">
<empty-content text="暂无名师风采" emptyimg="common/empty/empty_c_sraech.png"></empty-content>
</view>
<view class="has-nomore" wx:if="{{!hasmore && page>1}}">没有更多了</view>
</view>
\ No newline at end of file
page {
background: #f9f9f9;
}
.container {
}
/* 主题课 一起打卡 */
.subject-list{
padding: 30rpx 24rpx;
}
.subject-list .list-item{
width: 100%;
padding: 24rpx;
position: relative;
display: flex;
align-items: center;
background: #fff;
margin-bottom: 20rpx;
color: #999;
}
.subject-list .list-item:last-of-type {
margin-bottom: 0;
}
.subject-list .list-item .cover-box{
min-width: 130rpx;
height: 130rpx;
margin-right: 20rpx;
border-radius: 20rpx;
overflow: hidden;
}
.subject-list .list-item .cover-box .cover{
width: 100%;
height: 100%;
}
.subject-list .list-item .main{
min-height: 130rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.subject-list .list-item .main .title{
font-size: 26rpx;
color: #666;
}
.subject-list .list-item .main .count-box{
display: flex;
align-items: center;
font-size: 22rpx;
color: #999;
}
.subject-list .list-item .main .count-box .icon{
width: 20rpx;
height: 21rpx;
margin-right: 9rpx;
}
\ No newline at end of file
import {
helpDetail
} from '../../../service/common.js';
import {
teacherDetailGet
} from '../../../service/customer/websiteindex.js';
var app = getApp();
Page({
data: {
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
localImageRoot: "../../../images/",
sid: 0,
id: 0,
detail: {
id: 1,
avatar: 'https://cdn.s.shangjiadao.cn/clock/min/b/5d68ddeace846.jpg',
name: '黄老师黄老师黄老师黄老师黄老师黄老师',
seniority: '20',
course: '银币书法',
bg: '道士',
intro: '',
},
},
onLoad: function (options) {
const { id, sid } = options;
this.setData({
id: id || 0,
sid: sid || 0,
})
this.teacherDetail();
this.helpDetail();
},
teacherDetail () {
teacherDetailGet({
id: this.data.id
}).then((res) => {
const { code, data } = res;
if (code == 200) {
let intro = [];
try {
intro = JSON.parse(data.intro)[0].value;
} catch (error) {
intro = [];
}
data.intro = intro
this.setData({
detail: data,
})
}
})
},
helpDetail () {
helpDetail({
alias: 9999
}).then((res) => {
const { code, data } = res;
if (code == 200) {
let content = [];
try {
content = JSON.parse(data.content)[0].value;
} catch (error) {
content = [];
}
this.setData({
'detail.intro': content,
})
}
})
},
onShareAppMessage() {
return {
title: '老师详情',
path: `src/pages/websiteindex/teacherdetail?sid=${this.data.sid}&id=${this.data.id}`,
}
}
})
\ No newline at end of file
{
"navigationBarTitleText": "详情",
"usingComponents": {
"parser":"../../../components/Parser/parser"
}
}
\ No newline at end of file
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="list-box">
<view class="list-item">
<image class="avatar" src="{{filter.imagify(detail.avatar, 'image/resize,w_160/format,jpg')}}"></image>
<view class="main">
<view class="line">
<view class="name">{{detail.name}}</view>
<view class="label">{{detail.course}}</view>
<view class="label">{{detail.seniority}}年教龄</view>
</view>
<view class="line">
<view class="bg">{{detail.bg}}</view>
</view>
</view>
<button open-type="share" class="page-share-btn">
<image class="icon" src="{{localImageRoot}}2c/common/icon_share.png?{{imageVersion}}"></image>
<view class="text">分享</view>
</button>
</view>
</view>
<view class="detailbox" wx:if="{{detail.intro.length > 0}}">
<parser html="{{detail.intro}}"></parser>
</view>
</view>
\ No newline at end of file
.container {
min-height: 100vh;
background-color: #fff;
padding: 20rpx 24rpx;
}
.list-box .list-item {
width: 100%;
min-height: 160rpx;
background: #fff;
position: relative;
display: flex;
align-items: center;
margin-bottom: 20rpx;
color: #999;
}
.list-box .list-item:last-of-type {
margin-bottom: 0;
}
.list-box .list-item .avatar {
width: 88rpx;
height: 88rpx;
margin-right: 14rpx;
border-radius: 50%;
}
.list-box .list-item .main {
flex: 1;
padding-top: 4rpx;
padding-right: 112rpx;
}
.list-box .list-item .main .line {
display: flex;
align-items: center;
}
.list-box .list-item .main .line .name {
font-size: 32rpx;
color: #222;
line-height: 1;
max-width: 250rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.list-box .list-item .main .line .label {
height: 30rpx;
font-size: 22rpx;
background: #f7f7f7;
line-height: 30rpx;
padding: 0 10rpx;
margin-left: 14rpx;
border-radius: 6rpx;
white-space: nowrap;
}
.list-box .list-item .main .line .bg {
font-size: 22rpx;
line-height: 30rpx;
padding-top: 14rpx;
}
.page-share-btn {
width: 90rpx;
height: 90rpx;
position: absolute;
background: #fff;
box-shadow: 0 2rpx 12rpx 0 rgba(216, 216, 216, 0.4);
border-radius: 6rpx;
top: 50%;
transform: translateY(-50%);
right: 17rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 0;
margin: 0;
}
.page-share-btn .icon {
width: 46rpx;
height: 46rpx;
}
.page-share-btn .text {
font-size: 22rpx;
color: #fea917;
line-height: 30rpx;
}
.page-share-btn .button-share {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
opacity: 0;
}
.detailbox {
position: relative;
padding: 30rpx 24rpx;
}
.detailbox::before {
content: "";
width: 100%;
height: 1px;
background: #eeeeee;
position: absolute;
left: 0;
top: 0;
transform: scaleY(0.5);
}
import {
teacherlistGet
} from '../../../service/customer/websiteindex.js';
var app = getApp();
Page({
data: {
imageRoot: app.globalData.imageRoot,
imageVersion: app.globalData.imageVersion,
localImageRoot: '../../../images/',
list: [
{id: 1, avatar: 'https://cdn.s.shangjiadao.cn/clock/min/b/5d68ddeace846.jpg', name: '黄老师黄老师黄老师黄老师黄老师黄老师', seniority: '20',course: '银币书法',bg: '道士',intro: ''},
{id: 6, avatar: 'https://cdn.s.shangjiadao.cn/clock/min/b/5d68ddeace846.jpg', name: '海老师', seniority: '18',course: '琴棋书画',bg: '道是士道是士道是士道是士道是士',intro: ''},
{id: 4, avatar: 'https://cdn.s.shangjiadao.cn/clock/min/b/5d68ddeace846.jpg', name: '波老师', seniority: '02',course: '打阿萨德',bg: '道士的',intro: ''},
{id: 2, avatar: 'https://cdn.s.shangjiadao.cn/clock/min/b/5d68ddeace846.jpg', name: '好老师', seniority: '15',course: '按时发散',bg: '道是士道是士道是士道是士道是士道是士道是士道是士道是士',intro: ''},
],
total: '',
page: 1,
perPage: 10,
hasmore: true,
emptyPage: false,
listloading: false,
},
onLoad: function (options) {
const {
sid
} = options;
this.setData({
sid: sid || 0
});
// this.teacherlistGet('init');
// app.getCurrentSchoolStudentId({
// source_id: this.data.sid,
// source_type: 10,
// }).then(() => {
// this.setData({
// page: 1,
// hasmore: true,
// })
// this.teacherlistGet('init');
// })
},
onPullDownRefresh: function () {
this.setData({
page: 1,
hasmore: true,
})
this.teacherlistGet('down')
},
onReachBottom: function () {
this.teacherlistGet('up')
},
teacherlistGet(type) {
if (!this.data.hasmore) {
return;
}
if (this.data.listloading) {
return
}
this.setData({
listloading: true
})
teacherlistGet({
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({
total: data.total
})
}
switch (type) {
case 'init': //页面进来第一次加载
this.setData({
list: data.list
}, () => {
if (this.data.total > this.data.list.length) {
this.setData({
page : this.data.page + 1
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
case 'down': // 页面下拉刷新
this.setData({
list: data.list
}, () => {
if (this.data.total > this.data.list.length) {
this.setData({
page : this.data.page + 1
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
wx.stopPullDownRefresh();
break;
case 'up': // 页面上拉刷新
let list = this.data.list;
let _list = list.concat(data.list);
this.setData({
list: _list
},()=>{
if (this.data.total > this.data.list.length) {
this.setData({
page : this.data.page + 1
})
} else { // 没有更多了
this.setData({
hasmore: false
})
}
})
break;
default:
break;
}
if (this.data.list.length == 0) {
this.setData({
emptyPage: true
})
} else {
this.setData({
emptyPage: false,
})
}
}
}).catch((e) => {
this.setData({
listloading: false
})
})
},
bindDetail(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: `/src/pages/websiteindex/teacherdetail?sid=${this.data.sid}&id=${id}`,
})
},
})
\ No newline at end of file
{
"navigationBarTitleText": "老师风采",
"enablePullDownRefresh": true,
"usingComponents": {
"list-loading": "../../../components/listloading",
"empty-content": "../../../components/emptycontent"
}
}
\ No newline at end of file
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="list-box" wx:if="{{list.length>0}}">
<view class="list-item" wx:for="{{list}}" wx:key="index" bindtap="bindDetail" data-id="{{item.id}}">
<image class="avatar" src="{{filter.imagify(item.avatar, 'image/resize,w_160/format,jpg')}}"></image>
<view class="main">
<view class="line">
<view class="name">{{item.name}}</view>
<view class="label">{{item.course}}</view>
<view class="label">{{item.seniority}}年教龄</view>
</view>
<view class="line">
<view class="bg">{{item.bg}}</view>
</view>
</view>
<image class="icon-arr" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image>
</view>
<list-loading loading="{{listloading}}"></list-loading>
</view>
<list-loading loading="{{listloading}}"></list-loading>
<view wx:if="{{emptyPage}}">
<empty-content text="暂无名师风采" emptyimg="common/empty/empty_c_sraech.png"></empty-content>
</view>
<view class="has-nomore" wx:if="{{!hasmore && page>1}}">没有更多了</view>
</view>
\ No newline at end of file
page {
background: #f9f9f9;
}
.container {
}
.list-box {
padding: 30rpx 24rpx;
}
.list-box .list-item {
width: 100%;
height: 160rpx;
background: #fff;
border-radius: 20rpx;
position: relative;
display: flex;
align-items: center;
margin-bottom: 20rpx;
color: #999;
padding: 0 24rpx;
}
.list-box .list-item:last-of-type {
margin-bottom: 0;
}
.list-box .list-item .avatar {
width: 88rpx;
height: 88rpx;
margin-right: 14rpx;
border-radius: 50%;
}
.list-box .list-item .main {
flex: 1;
padding-right: 20rpx;
padding-top: 4rpx;
}
.list-box .list-item .main .line {
display: flex;
align-items: center;
}
.list-box .list-item .main .line .name {
font-size: 32rpx;
color: #222;
line-height: 1;
max-width: 300rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.list-box .list-item .main .line .label {
height: 30rpx;
font-size: 22rpx;
background: #f7f7f7;
line-height: 30rpx;
padding: 0 10rpx;
margin-left: 14rpx;
border-radius: 6rpx;
white-space: nowrap;
}
.list-box .list-item .main .line .bg {
font-size: 22rpx;
line-height: 30rpx;
padding-top: 14rpx;
}
.list-box .list-item .icon-arr {
width: 12rpx;
height: 20rpx;
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
}
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