This commit is contained in:
@fawn-nine
2024-07-30 16:25:09 +08:00
parent c8b306343a
commit fe2ab47b63
10 changed files with 1073 additions and 136 deletions

View File

@@ -12,8 +12,8 @@
"src" : "图片路径" "src" : "图片路径"
} }
], ],
"versionName" : "1.0.12", "versionName" : "1.0.13",
"versionCode" : 1012, "versionCode" : 1013,
"app-plus" : { "app-plus" : {
"nvueCompiler" : "weex", "nvueCompiler" : "weex",
"compatible" : { "compatible" : {

View File

@@ -562,6 +562,27 @@
{ {
"navigationBarTitleText" : "主任教学" "navigationBarTitleText" : "主任教学"
} }
},
{
"path" : "pages/miniClass/addClass",
"style" :
{
"navigationBarTitleText" : "添加课程"
}
},
{
"path" : "pages/miniClass/classInfo",
"style" :
{
"navigationBarTitleText" : "班级详情页66"
}
},
{
"path" : "pages/miniClass/classList",
"style" :
{
"navigationBarTitleText" : "班级列表"
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@@ -9,6 +9,7 @@
> >
<view <view
@click="gotoDetail(item, index)" @click="gotoDetail(item, index)"
class="scroll-view-item list_item" class="scroll-view-item list_item"
v-for="(item, index) in dataList" v-for="(item, index) in dataList"
:key="indexKey ? item[indexKey] : item.id" :key="indexKey ? item[indexKey] : item.id"

View File

@@ -3,10 +3,7 @@
<!-- 公共组件-每个页面必须引入 --> <!-- 公共组件-每个页面必须引入 -->
<public-module></public-module> <public-module></public-module>
<!-- <z-nav-bar :title="pageTitle ? pageTitle : '课程详情'"> --> <!-- <z-nav-bar :title="pageTitle ? pageTitle : '课程详情'"> -->
<z-nav-bar title="课程介绍"> <z-nav-bar title="课程介绍">
<!-- <view class="curseSet" slot="right" @click="newOnShare">
<uni-icons type="redo" size="26"></uni-icons><text style="font-size: 26rpx;"></text> 分享课程
</view> -->
</z-nav-bar> </z-nav-bar>
<view class="contentBox commonPageContentBox"> <view class="contentBox commonPageContentBox">
@@ -56,7 +53,7 @@
<view :class="`${isHideCourseInfo ? 'hidden2' : ''}`" <view :class="`${isHideCourseInfo ? 'hidden2' : ''}`"
style="width: calc(100% - 50rpx)" v-html="course.content"> style="width: calc(100% - 50rpx)" v-html="course.content">
</view> </view>
<!-- <text <text
style=" style="
position: absolute; position: absolute;
bottom: 0; bottom: 0;
@@ -65,14 +62,27 @@
" "
> >
{{ isHideCourseInfo ? "展开" : "收起" }} {{ isHideCourseInfo ? "展开" : "收起" }}
</text> --> </text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 小班入口 -->
<view class="classEntrance">
<view class="flex_box" style="justify-content: space-between;">
<view class="flex_box classTitleBox">
<image src="../../static/icon/class.png" mode="" style="width: 64rpx; height: 64rpx;"></image>
<text class="mainTxt">
<span style="font-weight: bold; padding: 0 16rpx;">50</span>
个班级正在学习本门课程</text>
</view>
<view class="btntext">
<text @click="goClassLIst('/pages/miniClass/classList', course.id,course.title)">前往查看 >></text>
</view>
</view>
</view>
<view class="containerBg2"> <view class="containerBg2">
<!-- 目录 --> <!-- 目录 -->
<view :class="['coursePart','flexbox', userMsg.vip != 0 ? 'vipBgColor':'']" <view :class="['coursePart','flexbox', userMsg.vip != 0 ? 'vipBgColor':'']"
@@ -709,15 +719,7 @@
if (res.code == 0) { if (res.code == 0) {
this.getCourseDescriptionData(); this.getCourseDescriptionData();
// this.$commonJS.showToast(""); // this.$commonJS.showToast("");
} }
// if (res.productList.length > 0) {
// this.goodsList = res.productList;
// this.selectGoodsData = this.goodsList[0];
// this.$refs.commonSelectGoods.open();
// this.show = true;
// } else {
// this.$commonJS.showToast("此课程暂无购买方式");
// }
this.$forceUpdate(); this.$forceUpdate();
}); });
@@ -1376,12 +1378,24 @@
url: `${url}?id=${id}`, url: `${url}?id=${id}`,
}); });
}, },
goClassLIst(url, id,title){
uni.navigateTo({
url: `${url}?courseId=${id}&courseTitle=${title}`,
});
},
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/style/mixin.scss"; @import "@/style/mixin.scss";
.classEntrance{background-color: #f2f8ff; padding:20rpx;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
.flex_box{align-items: center;}
}
.btntext{color: $themeColor; }
.classTitleBox{font-size: 28rpx;
.mainTxt{font-size: 30rpx;}
}
.completionBg { padding: 10rpx 0; .completionBg { padding: 10rpx 0;
background-color: #fff; border-bottom: 1px solid #eee; background-color: #fff; border-bottom: 1px solid #eee;
} }

View File

@@ -327,6 +327,8 @@ export default {
signShow: false, signShow: false,
signContent: "是否要退出登录?", signContent: "是否要退出登录?",
playData: {}, playData: {},
directorShow:false, // 主任是否显示班级入口
monitorShow:false, // 其他管理是否显示班级入口
isAndorid: true, isAndorid: true,
platform: null, // 设备系统 platform: null, // 设备系统
pageList: [ pageList: [
@@ -353,11 +355,6 @@ export default {
url: "/pages/component/commonComponents/address/index?type=mine", url: "/pages/component/commonComponents/address/index?type=mine",
type: "pageJump", type: "pageJump",
}, },
{
name: "主任教学",
url: "/pages/miniClass/miniClassMan?type=mine",
type: "pageJump",
},
// { // {
// name: "分享APP", // name: "分享APP",
// type: "share", // type: "share",
@@ -377,12 +374,13 @@ export default {
//第一次加载 //第一次加载
onLoad(e) { onLoad(e) {
// 隐藏原生的tabbar // 隐藏原生的tabbar
// uni.hideTabBar(); uni.hideTabBar();
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.getOS(); this.getOS();
this.platform = uni.getSystemInfoSync().platform; this.platform = uni.getSystemInfoSync().platform;
// console.log('操纵系统',this.platform) // console.log('操纵系统',this.platform)
// #endif // #endif
this.getData();
}, },
computed: { computed: {
...mapState(["userInfo"]), ...mapState(["userInfo"]),
@@ -391,12 +389,8 @@ export default {
onShow() { onShow() {
console.log(this.userInfo, "11111111111111"); console.log(this.userInfo, "11111111111111");
// 隐藏原生的tabbar // 隐藏原生的tabbar
// uni.hideTabBar(); // uni.hideTabBar();
this.getData(); },
},
async onTabItemTap() {
this.getData();
},
components: { components: {
musicPlay, musicPlay,
}, },
@@ -500,16 +494,39 @@ export default {
if (this.userInfo.id != undefined) { if (this.userInfo.id != undefined) {
this.$http.post("common/user/getUserInfo").then((res) => { this.$http.post("common/user/getUserInfo").then((res) => {
this.userMes = res.result; this.userMes = res.result;
if (this.userMes.userVip) { if(res.isDirector){
// console.log( var n = this.pageList.find(item => {
// "this.userMes.vipValidtime at line 510:", return item.name == '主任教学'
// this.userMes.vipValidtime })
// ); console.log('主任找到了么',n);
// this.userMes.vipValidtime = this.userMes.vipValidtime.substring( // this.directorShow = true : this.directorShow = false
// 0, var item = {
// this.userMes.vipValidtime.indexOf(" ") // { // 主任之外的人显示班级管理
// ); name: "主任教学",
} url: "/pages/miniClass/miniClassMan?type=mine",
type: "pageJump",
// },
}
this.pageList.splice(3, 0, item);
}
if(res.isMonitor){
var n = this.pageList.find(item => {
return item.name == '班级管理'
})
console.log('班长n找到了么',n);
// this.directorShow = true : this.directorShow = false
var item = {
// 主任之外的人显示班级管理
name: "班级管理",
url: "/pages/miniClass/miniClassMan?type=mine",
type: "pageJump",
}
this.pageList.splice(3, 0, item);
}
// ?
// res.isMonitor ? this.monitorShow = true : this.monitorShow = false
}); });
} }
}, },

View File

@@ -0,0 +1,411 @@
<template>
<view class="page">
<z-nav-bar :title="getPageTitle"></z-nav-bar>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<uni-forms :modelValue="form" :rules="rules" ref="form">
<view class="input_box " style="">
<uni-forms-item label="" name="modelId" label-width="0">
<view class="">
<text class="input_tit"><i>*</i>班级模型</text>
</view>
<view class="in" style="flex: 1; border: none;">
<!-- {{modelLIst}} -->
<uni-data-select style="width: 100%;" v-model="form.modelId" placeholder="请选择班级的模型"
:localdata="modelLIst"></uni-data-select>
</view>
</uni-forms-item>
</view>
<view class="input_box">
<uni-forms-item label="" name="title" label-width="0">
<text class="input_tit"><i>*</i>班级名称:</text>
<view class="in">
<input placeholder-style="font-size:26rpx" type="text" v-model="form.title"
placeholder="请输入班级名称" />
</view>
</uni-forms-item>
</view>
<view class="input_box">
<text class="input_tit">班级封面:</text>
<view class="in" style="border: none;" @click="checkPermision">
<u-upload :fileList="fileList1" @afterRead="addPic" @delete="deletePic" :maxCount="1" width="100"
height="100" :previewFullImage="true">
</u-upload>
<!-- <text style="font-size: 24rpx; color: #999;">可上传4张问题截图</text> -->
</view>
<!-- <input type="password" maxlength="8" v-model="confirmPassword" placeholder="请确认密码" /> -->
</view>
<view class="input_box">
<uni-forms-item label="" name="number" label-width="0">
<text class="input_tit"><i>*</i>目标人数:</text>
<view class="in">
<input type="number" @input="relationInput" placeholder-style="font-size:26rpx"
v-model="form.number" placeholder="请输入学员目标人数" />
</view>
<!-- <text v-show="relationError" style="font-size: 24rpx; color: red; margin-top: 10rpx;">请填写订单编号</text> -->
<!-- <text v-show="relationErrorPattern"
style="font-size: 24rpx; color: red; margin-top: 10rpx;">订单编号格式错误</text> -->
</uni-forms-item>
</view>
<view class="input_box">
<uni-forms-item label="" name="content" label-width="0">
<text class="input_tit">
<!-- <i>*</i> -->
班级简介:</text>
<view class="in">
<view class="uni-textarea">
<textarea placeholder-style="font-size:26rpx" v-model="form.content" maxlength="600"
placeholder="请输入您的班级简介600字以内" />
</view>
</view>
</uni-forms-item>
</view>
<!-- <view class="input_box">
<uni-forms-item label="" name="contactInformation" label-width="0">
<text class="input_tit"><i>*</i>联系电话:</text>
<view class="in">
<input type="number" placeholder-style="font-size:26rpx" @input="telInput"
v-model="form.contactInformation" placeholder="请输入与您联系的手机号" />
</view>
<text v-show="telError" style="font-size: 24rpx; color: red; margin-top: 10rpx;">手机号格式错误</text>
</uni-forms-item>
</view> -->
</uni-forms>
<view class="btn_box"><button @click="onSubmit"> </button></view>
<z-navigation></z-navigation>
</view>
</template>
<script>
import $http from '@/config/requestConfig.js';
import permission from "@/js_sdk/wa-permission/permission.js"
import {
mapState,
mapMutations
} from 'vuex';
export default {
data() {
return {
fileList1: [],
playData: {},
//手机号账号
form: {
id:undefined, // 班级id
modelId:undefined,
title: '', // 账号
content: '', // 描述
icon: '', //封面
number: '', // 联系电话
},
telError: false,
// relationError: false,
// relationErrorPattern: false,
rules: {
title: {
rules: [{
required: true,
errorMessage: '请输入班级名称',
}
]
},
number: {
rules: [{
required: true,
errorMessage: '请输入学员目标人数',
}
]
},
},
pageType: '',
modelLIst: [
// { value: 0, text: "请选择" },
],
};
},
//第一次加载
onLoad(e) {
console.log('收到的值', e);
this.pageType = e.type
// this.form.type = e.type
this.getUserModel()
if(e.classId && e.name == 'edit'){
this.form.id = e.classId
this.getClassInfo()
}else{
this.form.id = undefined
}
},
//页面显示
onShow() {
},
computed: {
...mapState(['userInfo']),
getPageTitle(){
if(this.form.id){
return "修改班级"
}else{
return "添加班级"
}
}
},
//方法
methods: {
// 获取班级详情
getClassInfo(){
console.log('获取课程详情');
},
getUserModel() {
console.log('获取用户的可添加模型列表');
$http.request({
url: "common/class/getClassModelByUserid",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"userId": this.userInfo.id,
'type': this.pageType
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if(res && res.code == 0){
res.classModelList.forEach(item => {
item.value = item.id
item.text = item.title
})
console.log('处理后的', res.classModelList);
this.modelLIst = res.classModelList
}
}).catch(e => {
// console.log('表单错误信息:', err);
uni.showToast({
title: '数据获取失败',
icon: 'error'
})
})
},
relationInput(e) {
// this.relationError = false
// this.relationErrorPattern = false
},
telInput(e) {
// console.log('键盘输入',e);
this.telError = false
},
async checkPermision() {
var result = await permission.premissionCheck("CAMERA_EXTERNAL_STORAGE")
if (result != 1) {
return false
}
},
addPic(e) {
console.log("添加图片");
let that = this;
// for (var i = 0; i < e.file.length; i++) {
// console.log(i,e.file[i].url)
// uni.uploadFile({
// url: this.$baseUrl + "oss/fileoss", //仅为示例,非真实的接口地址
// filePath: tempFilePaths[0],
// name: 'file',
// formData: {
// 'user': 'test'
// },
// success: (uploadFileRes) => {
// console.log(uploadFileRes.data);
// }
// });
// return
uni.uploadFile({
url: this.$baseUrl + "oss/fileoss",
filePath: e.file.url,
//files:e.file,
name: "file",
formData: {},
success: (res) => {
// console.log("that.uploadPicLIst", res);
that.fileList1.push({
url: JSON.parse(res.data).url,
});
// console.log(that.fileList1, "that.uploadPicLIst");
},
fail: (error) => {
console.log("上传失败", error);
},
});
// }
},
deletePic(event) {
this.fileList1.splice(event.index, 1)
},
onSubmit() {
this.$refs.form.validate().then(res => {
if (this.fileList1.length > 0) {
let _list = this.fileList1
_list = _list.map(item => item.url)
// console.log('this.fileList1',_list);
this.form.icon = _list.join(',')
}
$http.request({
url: "common/class/addClass",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
// ...this.form
'id':this.form.id,
"modelId": this.form.modelId,
"title": this.form.title,
"icon": this.form.icon,
"content": this.form.content,
"number": Number(this.form.number)
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
// this.$http.post("common/class/addClass",{
// ...this.form
// })
.then(res => {
uni.showModal({
title: "提示",
content: "创建成功!",
showCancel: false,
success: (res) => {
this.fileList1 = []
// this.$nextTick(() => {
uni.navigateBack({
delta: 1
});
// })
}
});
}).catch(e => {
// console.log('表单错误信息:', err);
uni.showToast({
title: '创建失败',
icon: 'error'
})
});
}).catch(err => {
console.log('表单错误信息:', err);
uni.showToast({
title: '页面有未填写的内容哦',
icon: 'none'
})
})
}
},
//页面隐藏
onHide() {},
//页面卸载
onUnload() {},
//页面下来刷新
onPullDownRefresh() {},
//页面上拉触底
onReachBottom() {},
//用户点击分享
onShareAppMessage(e) {
return this.wxShare();
}
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
::v-deep .uni-forms-item {
margin-bottom: 26rpx !important;
}
.input_tit {
font-weight: bold;
}
.page {
background-color: #ffffff;
padding: 0 65rpx;
min-height: 100vh;
.title {
padding: 30rpx 0 40rpx 0;
font-size: 40rpx;
color: #333333;
}
.input_box {
display: block;
// justify-content: space-between;
// overflow: hidden;
// height: 100rpx;
padding-top: 10rpx;
// border-bottom: 1rpx solid #eeeeee;
align-items: center;
i {
font-size: 24rpx;
color: red;
padding-right: 10rpx;
}
.in {
border: 1rpx solid #eeeeee;
border-radius: 8rpx;
padding: 8rpx;
margin-top: 10rpx;
}
text {
font-size: 30rpx;
width: 180rpx;
}
input {
flex: 1;
height: 50rpx;
// line-height: 70rpx;
font-size: 30rpx;
}
button {
height: 78rpx;
line-height: 78rpx;
font-size: 30rpx;
color: $themeColor;
&:active {
background-color: transparent;
}
}
}
.btn_box {
margin-top: 70rpx;
padding-bottom: 20rpx;
button {
font-size: 32rpx;
@include theme('btn_bg') color: #fff;
height: 80rpx;
line-height: 80rpx;
border-radius: 50rpx;
}
}
.protocol {
font-size: 24rpx;
color: #999999;
text-align: center;
margin-top: 20rpx;
text {
color: $themeColor;
}
}
}
</style>

View File

@@ -0,0 +1,32 @@
<template>
<view>
<public-module></public-module>
<z-nav-bar title="班级详情"></z-nav-bar>
<z-navigation></z-navigation>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {
},
onShow() {
},
methods: {
getClassInfo(){
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,451 @@
<template>
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="班级列表">
</z-nav-bar>
<view style="padding: 20rpx; background-color: #fff; border-bottom: 1px solid #eee;">当前课程{{courseTitle}}</view>
<view class="tabsBox" :class="[fixed ? 'fixed' : '' ]">
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="fatherClick" :current="curTagId"
:activeStyle="activeStyle" :scrollable="scrollable" :list="tabList"
itemStyle="padding-left: 15px; background-color:#fff; padding-right: 15px; height: 50px;"></u-tabs>
</view>
<view class="containerBg">
<view class="subCate flex" v-if="subList.length> 0">
<text :class="['item',subTabId == item.id ? 'active' : '']" v-for="(item, index) in subList"
@click="curseClick(item)" :key="index">{{item.title}}</text>
</view>
<view class="learnBox box">
<view class="newBox">
<view class="item flexbox" v-for="(item, index) in courseList" :key="index" >
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer" v-if="item.icon != ''">
<image :src="item.icon" mode="aspectFit"></image>
</view>
<view class="imgcontainer defaultImg" v-else>
<image src="@/static/my_04.png" mode="aspectFit"></image>
</view>
<view class="buyItems">
<view class="txt555" @click="onPageJump('/pages/miniClass/classInfo',item.id)">
{{item.title}}
</view>
<view class="jianjie">
目标学员人数{{item.number}}
</view>
<!-- <view class="jianjie" v-html="item.content">
</view> -->
<view class="btn_box" >
<text @click="enterClass" v-show="item.state == '0'">一键加入</text>
<text class="seeInfo" @click="onPageJump('/pages/miniClass/classInfo',item.id)">查看班内情况</text>
</view>
</view>
</view>
</view>
<!-- <u-divider v-show="status == 2" text="已加载全部"></u-divider>
<u-divider v-show="status == 3" text="暂无数据"></u-divider>
<u-divider v-show="status == 1" text="加载中..."></u-divider> -->
</view>
<view>
<!-- <u-back-top scroll-top="100"></u-back-top> -->
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle'
:iconStyle="iconStyle"></u-back-top>
</view>
<z-navigation></z-navigation>
<!-- <music-play :playData="playData"></music-play> -->
</view>
</view>
</template>
<script>
import musicPlay from '@/components/music.vue'
import $http from '@/config/requestConfig.js';
var clear;
import {
mapState
} from 'vuex';
export default {
data() {
return {
playData: {},
addType:undefined, // 小班类型
range:[
{ value: '0', text: "普通小班",name:"普通小班"},
{ value: '1', text: "联合班" ,name:"普通小班"},
{ value: '2', text: "精英班" ,name:"普通小班"},
],
tagId: null,
pid:null,
fixed: false,
pupShow:false,
fatherTabId: null,
subTabId: null, //
bgiStyle: {
background: '#fff'
},
iconStyle: {
fontSize: '40rpx',
fontWeight: 'bold',
color: '#258feb',
},
scrollTop: 0,
activeStyle: {
color: '#000',
fontWeight: 'bold',
transform: 'scale(1.2)',
// backgroundColor: '#258feb'
},
courseTitle:'',
subList: [{title:'待开班',id:'0'},{title:'已开班',id:'1'},{title:'已结班',id:'2'}],
scrollable: false,
pageTitle: '',
tabList: [
{name:'普通小班', id:'0'},{name:'联合班', id:'1'},{name:'精英班',id:'2'}],
curTagId: 0,
courseList: [],
status: 3, // 0 不显示, 1 加载中2 加载全部完成3 暂无数据
page: 1,
flag: true, // 函数是否执行完
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.courseTitle = e.courseTitle
// this.tagId = e.id
this.curTagId = this.range[0].value
this.subTabId = this.subList[0].id
this.pageTitle = e.title
this.pid = e.pid
console.log(e, '传入分类id')
this.getData()
// this.getCateList(this.tagId)
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
if (this.scrollTop > 500) {
this.fixed = true
} else {
this.fixed = false
}
// console.log(this.scrollTop,'this.scrollTop')
},
onPullDownRefresh() {
console.log('下拉刷新')
// this.status = 3
// this.page = 1
this.courseList = []
this.getData()
uni.stopPullDownRefresh()
},
onReachBottom() {
// if (this.status != 2 && this.flag) {
// this.page++
// this.getData(this.subTabId)
// }
console.log('触底加载', this.page)
},
computed: {
...mapState(['userInfo'])
},
//页面显示
onShow() {
// 隐藏原生的tabbar
// uni.hideTabBar();
},
components: {
musicPlay
},
//方法
methods: {
// 加入班级
enterClass(){
},
selectChange(e){
console.log("e:", e);
},
closePup(){
this.pupShow = false
},
surl(imageurl) {
return `url(${imageurl})`
},
goCreateClass(){
console.log('this.addType',this.addType);
if(this.addType != undefined){
uni.navigateTo({
url:`/pages/miniClass/addClass?type=${this.addType}&name=add`
})
}else{
uni.showToast({
title:'请选择班级的类型',
icon:'none'
})
return
}
},
fatherClick(e) {
console.log('点击', e)
this.page = 1
// var item = e
this.curTagId = e.id
this.subTabId = this.subList[0].id
this.getData(this.subTabId);
},
curseClick(item) {
this.subTabId = item.id
this.courseList = []
this.page = 1
this.getData(this.subTabId);
},
getData(id) {
// if (!this.flag) {
// console.log('正在执行,未完成')
// return
// }
this.status = 1
this.flag = false
uni.showLoading({
title:'正在加载'
})
$http.request({
url: "common/class/getClassByDirectorid",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"state": this.subTabId, //小班状态0待开班1已开班2完成
"type": this.curTagId // 班类型 0小班 1联合班 2精英班
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
if (res.classEntityList.length > 0) {
this.courseList = res.classEntityList
// var list = res.classEntityList
// this.courseList = this.courseList.concat(list)
// if (res.courses.pages > this.page) {
// this.status = 0
// } else {
// this.status = 2
// }
}else{
this.courseList = []
}
// else if (this.page > 1) {
// this.status = 2 // 加载完成
// } else {
// this.status = 3 // 暂无数据
// }
// console.log('status', this.status)
this.flag = true
}
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
this.flag = true
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
title:`获取数据失败`,
icon:'error'
})
});
},
// 跳转
onPageJump(url,id) {
// console.log('进来了',url,id);
uni.navigateTo({
url: `${url}?id=${id}`
});
},
shuomingPage(url,id,pid){
uni.navigateTo({
url: `${url}?id=${id}&pid=${pid}`
});
}
},
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
/deep/.uni-select__selector{
top:unset;
bottom:calc(100% + 12px) ;
}
/deep/.uni-select{
border: none;
}
/deep/.uni-select__input-text{
font-size:14px;
color:#7f7f7f //修改为你的字体颜色
}
/deep/.uni-select__input-placeholder{
font-size:14px;
color:#7f7f7f //修改为你的字体颜色
}
/deep/.uni-popper__arrow{
top:unset;
bottom: -6px;
transform: rotate(180deg);
}
/deep/.uni-popper__arrow::after{
top:0
}
.box6{
.btnBox{justify-content: center;}
}
.containerBg {
// background-color: $containerColor;
background-color: #f6f6f8;
padding: 0 20rpx;
}
.curseSet{margin-right: 20rpx; font-size: 28rpx; display: flex; align-items: center;}
.fixed {
position: fixed;
z-index: 1; width: 100%; background-color: #fff;
}
.newBox {
.item {
margin-bottom: 20rpx;
background-color: #fff;
border-radius: 20rpx;
@include ptop_bottm(10px);
@include pleft_right(10px);
@include mshadow(10px, 1) .imgcontainer {
display: block;
width: 110rpx;
margin-right: 20rpx;
// background-size: cover;
// background-position: center;
height: 200rpx;
flex-grow: 1;
// @include ptop_bottm(10px);
overflow: hidden;
// @include pleft_right(10px);
image {
width: 100%;
height: 200rpx;
}
}
.btn_box{ text-align: right;
text{
border-radius: 20rpx;
padding: 3px 5px; @include theme("btn_bg");
font-size: 28rpx; color: #fff;
}
.seeInfo{background-color:#fff; background-image: none; border: 1px solid #666; color: #333; margin-left: 20rpx;}
}
.buyItems {
width: 60%;
}
.jianjie {
line-height: 30rpx; height: 60rpx; overflow: hidden;
overflow: hidden!important;
margin-top: 10rpx;
font-size: 24rpx;
@include bov();
color: #9c9c9c;
}
.txt555 {
font-size: 30rpx;
color: #000;
@include bov()
}
}
}
.subCate {
padding-top:10px;
padding-bottom: 10px;
display: flex;
.item {
border: 1px solid #bfcad9;
display: inline-block;
text-align: center;
font-size: 26rpx;
background-color: #fff;
border-radius: 4px; width: 100%;
color: #333;
margin-right: 16rpx;
padding: 14rpx 30rpx;
}
.item:last-child() {
margin-right: 0;
}
.item.active {
border-color: $themeColor;
background-color: $themeColor;
color: #fff;
}
}
.tabList {
text-align: center;
}
.flexbox {
display: flex;
}
.imgcontainer {
background-color: $imgBg;
}
.box {
// background-color: #fff;
min-height: calc(100vh - 270rpx);
}
.learnBox {
// background-color: #fff;
margin-top: 10px;
.learn {
flex-wrap: wrap;
justify-content: space-between;
margin-top: 20rpx;
.item {
width: 48%;
margin-bottom: 16px;
overflow: hidden;
image {
width: 100%;
height: 200rpx;
}
.txt555 {
display: block;
text-align: center;
height: 40rpx;
width: 100%;
line-height: 40rpx;
@include bov(1);
margin-top: 10rpx;
font-size: 24rpx;
}
}
}
}
</style>

View File

@@ -27,40 +27,39 @@
</view> </view>
<view class="learnBox box"> <view class="learnBox box">
<view class="newBox"> <view class="newBox">
<view class="item flexbox" v-for="(item, index) in courseList" :key="index" @click="onPageJump('/pages/course/courseDetail',item.id)"> <view class="item flexbox" v-for="(item, index) in courseList" :key="index" >
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> --> <!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer"> <view class="imgcontainer" v-if="item.icon != ''">
<image :src="item.image" mode="aspectFit"></image> <image :src="item.icon" mode="aspectFit"></image>
</view>
<view class="imgcontainer defaultImg" v-else>
<image src="@/static/my_04.png" mode="aspectFit"></image>
</view> </view>
<view class="buyItems"> <view class="buyItems">
<view class="txt555"> <view class="txt555" @click="onPageJump('/pages/miniClass/classInfo',item.id)">
{{item.title}} {{item.title}}
</view> </view>
<view class="jianjie" v-html="item.content"> <view class="jianjie">
目标学员人数{{item.number}}
</view> </view>
<view class="tag-view"> <!-- <view class="jianjie" v-html="item.content">
<uni-tag v-if="item.level != 0" style="margin-right: 10rpx;" :text="item.level == 1 ? '初级':'高级'" type="primary" size="small" /> </view> -->
<uni-tag v-if="item.selective != 0 && item.selective == 1" style="margin-right: 10rpx;" text="必修" size="small" type="warning" /> <view class="btn_box" >
<uni-tag v-if="item.selective != 0 && item.selective == 2" style="margin-right: 10rpx;" text="选修" size="small" type="success" /> <text @click="enterClass" v-show="item.state == '0'">一键加入</text>
<text class="seeInfo" @click="onPageJump('/pages/miniClass/classInfo',item.id)">查看班内情况</text>
</view> </view>
<view class="btn_box"> </view>
<text>了解课程</text>
</view>
</view>
</view> </view>
</view> </view>
<u-divider v-show="status == 2" text="已加载全部"></u-divider> <!-- <u-divider v-show="status == 2" text="已加载全部"></u-divider>
<u-divider v-show="status == 3" text="暂无数据"></u-divider> <u-divider v-show="status == 3" text="暂无数据"></u-divider>
<u-divider v-show="status == 1" text="加载中..."></u-divider> <u-divider v-show="status == 1" text="加载中..."></u-divider> -->
</view> </view>
<view> <view>
<!-- <u-back-top scroll-top="100"></u-back-top> --> <!-- <u-back-top scroll-top="100"></u-back-top> -->
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle' <u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle'
:iconStyle="iconStyle"></u-back-top> :iconStyle="iconStyle"></u-back-top>
</view> </view>
<public-module></public-module>
<z-navigation></z-navigation> <z-navigation></z-navigation>
<u-popup v-if="pupShow" key="1" :show="pupShow" :round="10" @close="closePup"> <u-popup v-if="pupShow" key="1" :show="pupShow" :round="10" @close="closePup">
<view style="padding: 40rpx;" class="flex_box box6"> <view style="padding: 40rpx;" class="flex_box box6">
@@ -97,9 +96,9 @@
playData: {}, playData: {},
addType:undefined, // 小班类型 addType:undefined, // 小班类型
range:[ range:[
{ value: 0, text: "普通小班" }, { value: '0', text: "普通小班",name:"普通小班"},
{ value: 1, text: "联合班" }, { value: '1', text: "联合班" ,name:"普通小班"},
{ value: 2, text: "精英班" }, { value: '2', text: "精英班" ,name:"普通小班"},
], ],
tagId: null, tagId: null,
pid:null, pid:null,
@@ -127,23 +126,27 @@
scrollable: false, scrollable: false,
pageTitle: '', pageTitle: '',
tabList: [ tabList: [
{name:'普通小班'},{name:'联合班'},{name:'精英班'}], {name:'普通小班', id:'0'},{name:'联合班', id:'1'},{name:'精英班',id:'2'}],
curTagId: 0, curTagId: 0,
courseList: [], courseList: [],
status: 3, // 0 不显示, 1 加载中2 加载全部完成3 暂无数据 status: 3, // 0 不显示, 1 加载中2 加载全部完成3 暂无数据
page: 1, page: 1,
flag: true, // 函数是否执行完 flag: true, // 函数是否执行完
}; };
}, },
//第一次加载 //第一次加载
onLoad(e) { onLoad(e) {
// 隐藏原生的tabbar // 隐藏原生的tabbar
uni.hideTabBar(); uni.hideTabBar();
this.tagId = e.id // this.tagId = e.id
this.curTagId = this.range[0].value
this.subTabId = this.subList[0].id
this.pageTitle = e.title this.pageTitle = e.title
this.pid = e.pid this.pid = e.pid
console.log(e, '传入分类id') console.log(e, '传入分类id')
this.getCateList(this.tagId) this.getData()
// this.getCateList(this.tagId)
}, },
onPageScroll(e) { onPageScroll(e) {
this.scrollTop = e.scrollTop; this.scrollTop = e.scrollTop;
@@ -156,17 +159,17 @@
}, },
onPullDownRefresh() { onPullDownRefresh() {
console.log('下拉刷新') console.log('下拉刷新')
this.status = 3 // this.status = 3
this.page = 1 // this.page = 1
this.courseList = [] this.courseList = []
this.getData(this.subTabId) this.getData()
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, },
onReachBottom() { onReachBottom() {
if (this.status != 2 && this.flag) { // if (this.status != 2 && this.flag) {
this.page++ // this.page++
this.getData(this.subTabId) // this.getData(this.subTabId)
} // }
console.log('触底加载', this.page) console.log('触底加载', this.page)
}, },
computed: { computed: {
@@ -175,15 +178,17 @@
//页面显示 //页面显示
onShow() { onShow() {
// 隐藏原生的tabbar // 隐藏原生的tabbar
uni.hideTabBar(); // uni.hideTabBar();
}, },
components: { components: {
musicPlay musicPlay
}, },
//方法 //方法
methods: { methods: {
// 加入班级
enterClass(){
},
selectChange(e){ selectChange(e){
console.log("e:", e); console.log("e:", e);
}, },
@@ -194,8 +199,11 @@
return `url(${imageurl})` return `url(${imageurl})`
}, },
goCreateClass(){ goCreateClass(){
if(this.addType){ console.log('this.addType',this.addType);
if(this.addType != undefined){
uni.navigateTo({
url:`/pages/miniClass/addClass?type=${this.addType}&name=add`
})
}else{ }else{
uni.showToast({ uni.showToast({
title:'请选择班级的类型', title:'请选择班级的类型',
@@ -203,43 +211,12 @@
}) })
return return
} }
}, },
getCateList(id) {
this.subTabId = this.subList[0].id
this.getData(id)
// $http.request({
// url: "medical/home/getChildCourseMedicalTree",
// method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
// data: {
// "id": id,
// },
// header: { //默认 无 说明:请求头
// 'Content-Type': 'application/json'
// },
// })
// .then(res => {
// if (res.code == 0) {
// if (res.labels.length > 0) {
// var list = []
// res.labels.forEach(item => {
// item.name = item.title
// })
// this.tabList = res.labels
// }else{
// // this.subList = []
// this.subTabId = id
// this.getData(id)
// }
// console.log(this.curTagId, '当前高亮')
// }
// }).catch(e => {
// console.log(e, '获取子分类报错')
// });
},
fatherClick(e) { fatherClick(e) {
// console.log(e, '点击') console.log('点击', e)
this.page = 1 this.page = 1
var item = e // var item = e
this.curTagId = e.id
this.subTabId = this.subList[0].id this.subTabId = this.subList[0].id
this.getData(this.subTabId); this.getData(this.subTabId);
}, },
@@ -254,15 +231,18 @@
// console.log('正在执行,未完成') // console.log('正在执行,未完成')
// return // return
// } // }
this.status = 1 this.status = 1
this.flag = false this.flag = false
uni.showLoading({
title:'正在加载'
})
$http.request({ $http.request({
url: "medical/home/getMedicalCourseList", url: "common/class/getClassByDirectorid",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: { data: {
"id": id, "state": this.subTabId, //小班状态0待开班1已开班2完成
"limit": 12, "type": this.curTagId // 班类型 0小班 1联合班 2精英班
"page": this.page
}, },
header: { //默认 无 说明:请求头 header: { //默认 无 说明:请求头
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -270,28 +250,33 @@
}) })
.then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
if (res.courses.records.length > 0) { if (res.classEntityList.length > 0) {
var list = res.courses.records this.courseList = res.classEntityList
this.courseList = this.courseList.concat(list) // var list = res.classEntityList
if (res.courses.pages > this.page) { // this.courseList = this.courseList.concat(list)
this.status = 0 // if (res.courses.pages > this.page) {
} else { // this.status = 0
this.status = 2 // } else {
} // this.status = 2
} else if (this.page > 1) { // }
this.status = 2 // 加载完成 }else{
this.courseList = []
}
// else if (this.page > 1) {
// this.status = 2 // 加载完成
} else { // } else {
this.status = 3 // 暂无数据 // this.status = 3 // 暂无数据
} // }
console.log('status', this.status) // console.log('status', this.status)
this.flag = true this.flag = true
} }
uni.hideLoading()
}).catch(e => { }).catch(e => {
uni.hideLoading()
this.flag = true this.flag = true
console.log(e, '数据报错') console.log(e, '数据报错')
this.status = 3 // this.status = 3
uni.showToast({ uni.showToast({
title:`获取数据失败`, title:`获取数据失败`,
icon:'error' icon:'error'
@@ -300,6 +285,7 @@
}, },
// 跳转 // 跳转
onPageJump(url,id) { onPageJump(url,id) {
// console.log('进来了',url,id);
uni.navigateTo({ uni.navigateTo({
url: `${url}?id=${id}` url: `${url}?id=${id}`
}); });
@@ -339,9 +325,12 @@
top:0 top:0
} }
.addType{width: 100%; margin-top: 40rpx;margin-bottom: 40rpx; border: 1px solid #eee;} .addType{width: 100%; margin-top: 40rpx;margin-bottom: 40rpx; border: 1px solid #eee;}
.classNewBtn{text-align: center; height: 300rpx; padding: 30rpx; background-color: $themeColor; margin-bottom: 80rpx; .classNewBtn{text-align: center; height:200rpx; padding: 30rpx;
background-image: linear-gradient(-60deg, #fdf0ed 0%, #bfe3f0 40%, #e4eefa 60%, #bfe3f0 80%, #fdf0ed 100%);
border-radius: 0 0 40rpx 40rpx; border-radius: 0 0 40rpx 40rpx;
.box88{background-color: #fff; border-radius: 40rpx; height: 300rpx; justify-content: center; align-items: center; box-shadow: 0 10rpx 8rpx #eee; .box88{ border-radius: 40rpx; padding: 30rpx; justify-content: center; align-items: center;
// box-shadow: 0 10rpx 8rpx #eee;
button{border-radius: 40rpx;} button{border-radius: 40rpx;}
} }
} }
@@ -392,6 +381,7 @@
padding: 3px 5px; @include theme("btn_bg"); padding: 3px 5px; @include theme("btn_bg");
font-size: 28rpx; color: #fff; font-size: 28rpx; color: #fff;
} }
.seeInfo{background-color:#fff; background-image: none; border: 1px solid #666; color: #333; margin-left: 20rpx;}
} }
.buyItems { .buyItems {
width: 60%; width: 60%;
@@ -452,7 +442,7 @@
.imgcontainer { .imgcontainer {
background-color: $imgBg; background-color: $imgBg;
} }
.box { .box {
// background-color: #fff; // background-color: #fff;
min-height: calc(100vh - 270rpx); min-height: calc(100vh - 270rpx);

BIN
static/icon/class.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB