页面构成

This commit is contained in:
Abin
2026-01-05 18:07:57 +08:00
parent 66b2e3ddac
commit c2f0c46c4d
40 changed files with 2817 additions and 0 deletions
@@ -0,0 +1,131 @@
// pages/Videodetails/Videodetails.js
const MyApi = require('../../Api/api.js');
Page({
/**
* 页面的初始数据
*/
data: {
BaseURL:getApp().globalData.BaseURL,
JustChapter:"",
zhangjieTitle:"",
VideoImageURL:"",
VideoTitle:"",
RealeaseTime:"",
shichangTime:"",
playdata:[],
VideoPlayerSrc:null,
coursedata:null,
top:0,
HiddenVideoControl:true,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
//只有当登录才有效
if (wx.getStorageSync('UserInfoCache').IsLogin) {
//获取接收到的视频序号
var receivedIndex = options.number ?? null;
if (receivedIndex){
MyApi.ApiGetFreeCourseData(receivedIndex)
.then(result => {
this.setData({
VideoTitle:result.PlayData[0].课程名称,
playdata:result.PlayData,
VideoImageURL:this.data.BaseURL+"/Course/"+result.课程id+".png",
coursedata:result,
});
})
.catch(err => {
this.setData({
playdata:[],
});
console.error("请求失败:"+err);
});
} else {
wx.switchTab({
url: '/pages/index/index',
})
}
} else {
setTimeout(function() {
wx.switchTab({
url: '/pages/index/index',
})
},50);
}
},
OnTapVideoList(e){
//只有当登录才有效
if (wx.getStorageSync('UserInfoCache').IsLogin) {
// 获取当前点击的索引
const courseindex = e.currentTarget.dataset.courseindex;
this.setData({
VideoPlayerSrc:this.data.BaseURL+'/'+this.data.coursedata.PlayData[courseindex].视频m3u8,
HiddenVideoControl:false,
top:420,
});
} else {
setTimeout(function() {
wx.switchTab({
url: '/pages/index/index',
})
},50);
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
if (!wx.getStorageSync('UserInfoCache').IsLogin) {
setTimeout(function() {
wx.switchTab({
url: '/pages/index/index',
})
},50);
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
}
})
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
@@ -0,0 +1,25 @@
<!--pages/Videodetails/Videodetails.wxml-->
<video hidden="{{HiddenVideoControl}}" class="videoplayer" src="{{VideoPlayerSrc}}"/>
<scroll-view class="scrollarea" scroll-y type="list" style="top:{{top}}rpx;">
<view class="jieshao" >
<text decode class="video_biaoti">&nbsp;&nbsp;{{VideoTitle}}</text>
<text decode class="video_info">&nbsp;&nbsp;已更新{{playdata.length}}期</text>
</view>
<!-- <text decode class="video_list_content">--&nbsp;&nbsp;目录&nbsp;&nbsp;--</text> -->
<view class="videolistcontainer" bind:tap="OnTapVideoList"
wx:for="{{playdata}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-playid="{{item['播放id']}}" data-courseIndex="{{index}}">
<view class="videoimage">
<image class="coverimage" src="{{BaseURL}}/{{item['封面图片']}}" mode="aspectFill" />
</view>
<view class="videoinfo">
<text class="videotitle">{{item['视频标题']}}</text>
<text class="videodetails">{{item['详细介绍']}}</text>
<view class="videoinfo2">
<text class="videodata">{{item['发布日期']}}</text>
<text class="videotime">{{item['时长']}}min</text>
</view>
</view>
</view>
</scroll-view>
@@ -0,0 +1,111 @@
.videoplayer {
position: fixed;
top: 0;
left: 0;
height: 420rpx;
width: 750rpx;
z-index: 999;
}
.scrollarea {
position: relative;
top: 420rpx;
flex: 1;
overflow-y: hidden;
}
.jieshao {
margin-bottom: 10rpx;
/* box-shadow: 0 4rpx 4rpx rgba(150, 150, 150, 0.5); */
position: relative;
/* height: 100rpx; */
display: block;
}
.video_biaoti {
text-align: center;
display: block;
font-size: 40rpx;
}
.video_miaoshu {
text-align: center;
display: block;
font-size: 30rpx;
}
.video_info {
position: absolute;
bottom: 10rpx;
display: block;
font-size: 24rpx;
right: 30rpx;
}
.video_list_content {
margin: 10rpx 0;
display: flex;
justify-content: center;
align-items: center;
}
.videolistcontainer {
border-radius: 20rpx;
margin: 10rpx 10rpx;
box-shadow: 0 0 4rpx rgba(0, 0, 0, 0.5);
width: 730rpx;
height: 200rpx;
position: relative;
display: flex;
justify-content: left;
align-items: center;
text-align: left;
overflow: hidden;
}
.videoimage {
width: 320rpx;
height: 180rpx;
border-radius: 10rpx;
margin-left: 10rpx;
overflow: hidden;
box-shadow: 0 5rpx 10rpx rgba(0, 0, 0, 0.5);
}
.videoinfo{
position: relative;
width: 390rpx;
height: 180rpx;
border-radius: 10rpx;
margin-left: 20rpx;
overflow: hidden;
}
.videotitle {
text-align: left;
font-size: 30rpx;
}
.videodetails {
display: block;
margin: 10rpx 0rpx;
font-size: 25rpx;
line-height: 30rpx;
}
.videoinfo2 {
position:absolute;
bottom: 0;
display: flex;
justify-content:left;
}
.videodata {
font-size: 20rpx;
}
.videotime {
font-size: 20rpx;
margin-left: 40rpx;
}
.coverimage {
width: 100%;
height: 100%;
}
@@ -0,0 +1,69 @@
// pages/IndexNewCourseDetails/IndexNewCourseDetails.js
Page({
/**
* 页面的初始数据
*/
data: {
html:String
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var number = options.number ?? "";
this.setData({
html:wx.getStorageSync('IndexNewCourseData')[number].内容
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
@@ -0,0 +1,5 @@
{
"usingComponents": {
"Parser":"/Parser/index"
}
}
@@ -0,0 +1,2 @@
<!--pages/IndexNewCourseDetails/IndexNewCourseDetails.wxml-->
<Parser html="{{html}}">加载中...</Parser>
@@ -0,0 +1 @@
/* pages/IndexNewCourseDetails/IndexNewCourseDetails.wxss */
@@ -0,0 +1,197 @@
// pages/LoginOrOutDetails/LoginOrOutDetails.js
const MyApi = require('../../Api/api.js')
Page({
/**
* 页面的初始数据
*/
data: {
userInfo: {
avatarUrl: '../../static/image/defaultAvatar.png',
nickName: wx.getStorageSync('UserInfoCache').UserName,
},
LoginTag: "一键登录",
isadmin:wx.getStorageSync('UserInfoCache').IsAdministor,
loginStatue:wx.getStorageSync('UserInfoCache').IsLogin
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
userInfo: {
avatarUrl:'../../static/image/weixin.png',
nickName: wx.getStorageSync('UserInfoCache').UserName,
},
loginStatue: wx.getStorageSync('UserInfoCache').IsLogin
});
var Storage = wx.getStorageSync('UserInfoCache');
if (Storage.IsLogin === "1") {
this.setData({
userInfo: {
//avatarUrl: getApp().globalData.BaseURL + "/Images/UsersHeadIcon/" + Storage.user_openid + ".png",
avatarUrl:'../../static/image/weixin.png',
nickName: Storage.UserName,
},
});
};
},
onLoginBtnClick() {
var isAdmin=this.data.isadmin;
var tempusername=this.data.userInfo.nickName
var random_username="";
if (!tempusername) {
//生成随机用户名
var chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
var random_username = "";
for (var i = 0; i < 8; i++) {
var randomIndex = Math.floor(Math.random() * chars.length);
random_username += chars[randomIndex];
}
random_username = "用户"+random_username;
} else {random_username = tempusername}
console.log("用户名: "+random_username);
wx.uploadFile({
filePath: "static/image/defaultAvatar.png",
name: "HeadIconKey",
url: getApp().globalData.BaseURL+'/API/ApiChangeUserInfo.php',
formData:{
username: random_username,
openid: wx.getStorageSync('UserInfoCache').user_openid
},
success(res) {
//打印服务器返回数据
wx.showToast({
title: '成功!',
icon: 'success',
mask:true,
duration: 4000
});
//这里修改缓存
var tempuesrinfo=wx.getStorageSync('UserInfoCache')
tempuesrinfo.UserName=random_username
tempuesrinfo.IsAdministor=isAdmin
tempuesrinfo.IsLogin="1"
wx.setStorageSync('UserInfoCache', tempuesrinfo)
setTimeout(function() {
wx.hideToast();
wx.switchTab({
url: '/pages/wode/wode',
})
},3000);
},
fail(res) {
//打印服务器返回数据
console.log(res);
setTimeout(function() {
wx.hideToast();
wx.switchTab({
url: '/pages/wode/wode',
})
},3000);
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.onLoad();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
datachange(){
//退出登录操作!
MyApi.ApiLogout(wx.getStorageSync('UserInfoCache').user_openid)
.then(result1 => {
//缓存状态修改
var tempuesrinfoislogin=wx.getStorageSync('UserInfoCache')
tempuesrinfoislogin.IsLogin=null
//tempuesrinfoislogin.UserName=null
tempuesrinfoislogin.IsAdministor=null
this.data.userInfo.avatarUrl= '../../static/image/defaultAvatar.png'
this.data.LoginTag= "登录"
wx.setStorageSync('UserInfoCache', tempuesrinfoislogin)
//返回个人信息页面
wx.showToast({
title: '请稍等...',
icon:'loading',
mask:true,
duration: 4000,
})
setTimeout(function() {
wx.hideToast();
wx.switchTab({
url: '/pages/wode/wode',
})
},3000);
})
.catch(err => {
});
},
onlogout() {
if (wx.getStorageSync('UserInfoCache').IsLogin){
wx.showModal({
title: '提示',
content: '确定退出登录吗?',
showCancel: true, // 是否显示取消按钮
cancelText: '取消', // 取消按钮的文本,默认是"取消"
cancelColor: '#000000', // 取消按钮的文字颜色,默认是"#000000"
confirmText: '确认', // 确认按钮的文本,默认是"确定"
confirmColor: '#ff0000', // 确认按钮的文字颜色,默认是"#3CC51F"
success:(res)=> {
if (res.confirm) {
// 用户点击了确认按钮
this.datachange()
} else if (res.cancel) {
// 用户点击了取消按钮
}
}
});
}
}
})
@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "个人信息"
}
@@ -0,0 +1,25 @@
<scroll-view class="scrollarea" scroll-y type="list">
<view class="imgview">
<image class="touxiang_img" src="{{userInfo.avatarUrl}}" mode="" />
</view>
<view class="imgview2">
<text class="imgtext2">叶雷讲数学</text>
</view>
<view class="imgview3">
<text class="imgtext3">让数学不再难学</text>
</view>
<view wx:if="{{!loginStatue}}" class="btn_wrapper">
<button plain class="btn1" bind:tap="onLoginBtnClick">
<text class="btn_text">{{LoginTag}}</text>
</button>
</view>
<view wx:else="{{loginStatue}}" class="btn_wrapper">
<button plain class="btn2" bind:tap="onlogout">
<text class="btn_text">退出登录</text>
</button>
</view>
</scroll-view>
@@ -0,0 +1,117 @@
/* pages/LoginOrOutDetails/LoginOrOutDetails.wxss */
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}
.warp {
/* border: 1px solid #353535; */
padding: 10rpx 0;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
margin: 50rpx 100rpx;
border-radius: 30rpx;
}
.userinfo1 {
margin-top: 100rpx;
display: flex;
justify-content: center;
align-items: center;
}
.userinfo2 {
margin-top: 80rpx;
margin-bottom: 100rpx;
display: flex;
justify-content: center;
align-items: center;
}
.touxiang_btn[plain] {
width: 100rpx;
height: 100rpx;
padding: 0;
margin-left: 50rpx;
margin-right: 50rpx;
border-radius: 8px;
border: none;
}
.touxiang_text {
margin-right: 50rpx;
font-size: 34rpx;
}
.imgview {
margin-top: 300rpx;
display: flex;
align-items: center;
justify-content: center;
}
.imgview2 {
margin-top: 10rpx;
display: flex;
align-items: center;
justify-content: center;
}
.imgview3 {
color: rgb(95, 95, 95);
font-size: 25rpx;
margin-top: 15rpx;
display: flex;
align-items: center;
justify-content: center;
}
.imgtext {
display: block;
}
.touxiang_img {
display: block;
width: 100rpx;
height: 100rpx;
}
.nickname_label {
margin-right: 50rpx;
font-size: 34rpx;
}
.nickname_input {
width: 160rpx;
padding-left: 40rpx;
}
.btn1 {
width: 546rpx;
margin-top: 30rpx;
border-radius: 15rpx;
}
.btn1[plain] {
border: 0px solid #d10000;
background-color: #d10000;
/* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); */
}
.btn2 {
width: 546rpx;
margin-top: 30rpx;
margin-bottom: 100rpx;
border-radius: 15rpx;
}
.btn2[plain] {
border: 0px solid #d10000;
background-color: #d10000;
/* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); */
}
.btn_text {
color: rgb(255, 255, 255);
}
+433
View File
@@ -0,0 +1,433 @@
// pages/SetPasswordCode/SetPasswordCode.js
const MyApi = require('../../Api/api.js');
Page({
/**
* 页面的初始数据
*/
data: {
isAdmin:null,
//添加口令码提交参数
selectcoursename:"请选择课程",
selectcourseindex:null,
addCourseCode:"",
codecount:"",
IntegerValid:"",
addCourse_enddata:"2099-12-31 00:00:00",
add_show:false,
add_courseinfo:"",
add_courseid:"",
columnsID:[],
columns: [],
columnsInfo:[],
//修改口令码提交参数
changeData:null,
changeindex:null,
oldcourpswdsecode:[],
tempCourseData_2:null,
activeNames: ['修改栏目-点击展开关闭'],
showCourse:false,
show: false,
minHour: 10,
maxHour: 20,
minDate: new Date(2023, 1, 1).getTime(),
maxDate: new Date(2035, 1, 1).getTime(),
currentDate: new Date().getTime(),
},
confirm_to_delete(e){
wx.showModal({
title: '删除课程码',
confirmColor:"#ff0000",
content: '确定删除吗?',
complete: (res) => {
if (res.cancel) {}
if (res.confirm) {
var delete_index=e.currentTarget.dataset.index;
wx.showToast({
title: '删除课程码中',
duration: 10000,
icon: "loading",
mask: true,
});
var delete_openid=wx.getStorageSync('UserInfoCache').user_openid;
MyApi.ApiDeletePasswordCode(delete_openid,this.data.changeData[delete_index].口令码)
.then(result => {
if (result.result) {
wx.hideToast();
//本地也删除口令码数据
var tempdata=this.data.changeData
tempdata.splice(delete_index, 1);
this.setData({
changeData:tempdata,
//恢复默认收缩栏目
activeNames: ["修改栏目-点击展开关闭", 998],
});
wx.showToast({
title: '删除成功',
duration: 1000,
icon: "success",
mask: true,
});
} else {
wx.hideToast();
wx.showToast({
title: '提交失败',
duration: 1000,
icon: "error",
mask: true,
});
}
})
.catch(err => {
console.error("请求失败:" + err);
});
}
}
})
},
confirm_to_change(e){
wx.showModal({
title: '修改口令信息',
confirmColor:"#ff0000",
content: '确定修改吗?',
complete: (res) => {
if (res.cancel) {}
if (res.confirm) {
var change_index=e.currentTarget.dataset.index;
wx.showToast({
title: '修改课程码中',
duration: 10000,
icon: "loading",
mask: true,
});
//openid,coursePswdCode,courseEndDate,courseInfo,courseCount,oldCoursePswdCode
var change_openid=wx.getStorageSync('UserInfoCache').user_openid;
var coursePswdCode=this.data.changeData[change_index].口令码;
var courseEndDate=this.data.changeData[change_index].口令结束日期;
var courseInfo=this.data.changeData[change_index].课程介绍;
var courseCount=this.data.changeData[change_index].剩余有效次数;
var oldCoursePswdCode=this.data.oldcourpswdsecode[change_index];
MyApi.ApiChangePasswordCode(change_openid,coursePswdCode,courseEndDate,courseInfo,courseCount,oldCoursePswdCode)
.then(result => {
if (result.result) {
wx.hideToast();
//旧口令码修改为修改后的口令码
var oldcoursepswdcode2=this.data.oldcourpswdsecode;
oldcoursepswdcode2[change_index]=coursePswdCode;
this.setData({
oldcourpswdsecode:oldcoursepswdcode2,
});
wx.showToast({
title: '修改成功',
duration: 1000,
icon: "success",
mask: true,
});
} else {
wx.hideToast();
wx.showToast({
title: '提交失败',
duration: 1000,
icon: "error",
mask: true,
});
}
})
.catch(err => {
console.error("请求失败:" + err);
});
}
}
})
},
onchangecodeconfirm(e){
var timeformat_02= this.formatTimestamp(e.detail);
var tempcode004=this.data.changeData;
tempcode004[this.data.changeindex].口令结束日期=timeformat_02;
this.setData({
changeData:tempcode004,
show: false,
});
},
onchangeconde_info(e){
var tempcode003=this.data.changeData;
tempcode003[e.currentTarget.dataset.index].课程介绍=e.detail;
this.setData({
changeData:tempcode003
});
},
onchangecode(e){
var tempcode001=this.data.changeData;
tempcode001[e.currentTarget.dataset.index].口令码=e.detail;
this.setData({
changeData:tempcode001
});
},
onchangecodecount(e){
//正则表达式验证纯数字
if ( /^\d+$/.test(e.detail) ) {
var tempcode002=this.data.changeData;
tempcode002[e.currentTarget.dataset.index].剩余有效次数=e.detail;
this.setData({
IntegerValid: "",
changeData:tempcode002
});
} else {
var tempcode002=this.data.changeData;
tempcode002[e.currentTarget.dataset.index].剩余有效次数="";
this.setData({
IntegerValid: "请输入整数!",
changeData:tempcode002
});
}
},
onAddcourseBtnClick() {
wx.showModal({
title: '添加课程',
content: '确定添加课程码?',
complete: (res) => {
if (res.cancel) {}
if (res.confirm) {
wx.showToast({
title: '提交中',
duration: 10000,
icon: "loading",
mask: true,
});
var var1=wx.getStorageSync('UserInfoCache').user_openid;
var var2=this.data.add_courseid
var var3=this.data.selectcoursename
var var4=this.data.addCourseCode
var var5=this.data.addCourse_enddata
var var6=this.data.add_courseinfo
var var7=this.data.codecount
MyApi.ApiAddPasswordCode(var1,var2,var3,var4,var5,var6,var7)
.then(result => {
if (result.Data) {
wx.hideToast();
wx.showToast({
title: '提交成功',
duration: 1000,
icon: "success",
mask: true,
});
//修改拉取的口令码数据
var changelistdata01=result.Data
var changechangeData=this.data.changeData
changechangeData.push(changelistdata01);
this.setData({
changeData:changechangeData,
//恢复默认收缩栏目
activeNames: ["修改栏目-点击展开关闭", 998],
});
} else {
wx.hideToast();
wx.showToast({
title: '提交失败',
duration: 1000,
icon: "error",
mask: true,
});
}
})
.catch(err => {
console.error("请求失败:" + err);
});
}
}
});
},
addcourse_onInputCourseInfo(e) {
this.setData({ add_courseinfo: e.detail });
},
addcourse_showPopup(e) {
this.setData({ add_show: true });
},
addcourse_onClose(event) {
this.setData({ add_show: false });
},
addcourse_onconfirm(e) {
var timeformat_01= this.formatTimestamp(e.detail)
this.setData({
addCourse_enddata: timeformat_01,
});
this.setData({ add_show: false });
},
addCode_onInputCode(e){
this.setData({
addCourseCode: e.detail,
});
},
addCode_onInputCodecount(e){
//正则表达式验证纯数字
if ( /^\d+$/.test(e.detail) ) {
this.setData({
IntegerValid: "",
codecount:e.detail
});
} else {
this.setData({
IntegerValid: "请输入整数!",
codecount:"",
});
}
},
onInput(event) {
this.setData({
currentDate: event.detail,
});
},
onInputCourse(event) {
this.setData({
currentDate: event.detail,
});
},
showPopup(e) {
this.setData({
show: true,
changeindex:e.currentTarget.dataset.index
});
},
showPopupCourse() {
this.setData({ showCourse: true });
},
onClose(e) {
this.setData({ show: false });
},
onCloseCourse(event) {
var info=this.data.columnsInfo
var id=this.data.columnsID
this.setData({
showCourse: false,
selectcoursename:event.detail.value,
selectcourseindex:event.detail.index,
add_courseinfo:info[event.detail.index],
add_courseid:id[event.detail.index]
});
},
onCloseCourse_popup(event) {
this.setData({
showCourse: false,
});
},
onCloseCourse_selectcourse(event) {this.setData({showCourse: false});},
onChange(event) {
this.setData({
activeNames: event.detail,
});
},
onChangeCourse(event) {
const { picker, value, index } = event.detail;
},
/*** 生命周期函数--监听页面加载*/
onLoad(options) {
},
/*** 生命周期函数--监听页面初次渲染完成*/
onReady() {
},
/*** 生命周期函数--监听页面显示*/
onShow() {
var openid=wx.getStorageSync('UserInfoCache').user_openid;
this.setData({
isAdmin:wx.getStorageSync('UserInfoCache').IsAdministor
});
//获取可以添加的课程目录
MyApi.ApiAddPasswordCodeBefor(openid)
.then(result => {
var tempcolumns=[];
var tempcolumnsInfo=[];
var tempcolumnsID=[];
for (var i = 0; i < result.Data.length; i++) {
tempcolumnsID=tempcolumnsID.concat(result.Data[i].课程id);
tempcolumns=tempcolumns.concat(result.Data[i].课程名称);
tempcolumnsInfo=tempcolumnsInfo.concat(result.Data[i].课程介绍);
}
this.setData({
tempCourseData_2:result.Data,
columns: tempcolumns,
columnsID:tempcolumnsID,
columnsInfo:tempcolumnsInfo,
});
})
.catch(err => {
// 失败后执行的代码
console.error("请求失败:" + err);
});
//获取课程口令码
MyApi.ApiGetPasswordCode(openid)
.then(result => {
var tempoldcode=[];
for (var i = 0; i < result.Data.length; i++) {
tempoldcode=tempoldcode.concat(result.Data[i].口令码);
}
this.setData({
changeData:result.Data,
oldcourpswdsecode:tempoldcode
});
})
.catch(err => {
// 失败后执行的代码
console.error("请求失败:" + err);
});
},
/*** 生命周期函数--监听页面隐藏*/
onHide() {
},
/*** 生命周期函数--监听页面卸载*/
onUnload() {
},
formatTimestamp(timestamp) {
// 创建一个新的Date对象,传入时间戳(以毫秒为单位)
var date = new Date(timestamp);
// 获取年、月、日、时、分、秒
var year = date.getFullYear();
var month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1
var day = String(date.getDate()).padStart(2, '0');
var hours = String(date.getHours()).padStart(2, '0');
var minutes = String(date.getMinutes()).padStart(2, '0');
var seconds = String(date.getSeconds()).padStart(2, '0');
// 拼接成指定格式的日期时间字符串
var formattedDateTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
return formattedDateTime;
}
})
@@ -0,0 +1,13 @@
{
"usingComponents": {
"van-collapse": "@vant/weapp/collapse/index",
"van-collapse-item": "@vant/weapp/collapse-item/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-popup": "@vant/weapp/popup/index",
"van-picker": "@vant/weapp/picker/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index"
}
}
@@ -0,0 +1,66 @@
<!--pages/SetPasswordCode/SetPasswordCode.wxml-->
<!-- 弹出课程选择 -->
<van-popup show="{{ showCourse }}" round position="bottom" bind:close="onCloseCourse_popup">
<!-- 课程选择器 -->
<van-picker title="课程选择" show-toolbar columns="{{ columns }}"
bind:change="onChangeCourse" bind:confirm="onCloseCourse" bind:cancel="onCloseCourse_selectcourse"/>
</van-popup>
<!-- 弹出添加模块时间选择 -->
<van-popup show="{{ add_show }}" round position="bottom" bind:close="addcourse_onClose">
<!-- 添加模块时间选择器 -->
<van-datetime-picker title="(添加课程)选择时间" type="datetime" value="{{ currentDate }}" min-date="{{ minDate }}" max-date="{{ maxDate }}" bind:confirm="addcourse_onconfirm" bind:cancel="addcourse_onClose" />
</van-popup>
<!-- 弹出时间选择 -->
<van-popup show="{{ show }}" round position="bottom" bind:close="onClose">
<!-- 时间选择器 -->
<van-datetime-picker title="选择时间" type="datetime" value="{{ currentDate }}" min-date="{{ minDate }}" max-date="{{ maxDate }}" bind:input="onInput" bind:confirm="onchangecodeconfirm" bind:cancel="onClose"/>
</van-popup>
<van-collapse value="{{ activeNames }}" bind:change="onChange">
<!-- 下面是添加口令码功能 -->
<van-collapse-item disabled="{{!isAdmin}}" name="{{999}}">
<view slot="title">添加课程码</view>
<van-cell-group>
<van-cell title="课程" is-link value="{{selectcoursename}}" bind:click="showPopupCourse" />
<van-field label="课程码" value="{{addCourseCode}}" placeholder="请输入课程码" border="{{ false }}" bind:change="addCode_onInputCode" />
<van-field label="有效次数" error-message="{{IntegerValid}}" type="digit" value="{{codecount}}" placeholder="请输入整数" border="{{ false }}" bind:change="addCode_onInputCodecount" />
<van-cell title="结束日期" is-link value="{{addCourse_enddata}}" bind:click="addcourse_showPopup" />
<van-field label="课程介绍" type="textarea" autosize value="{{add_courseinfo}}" placeholder="请输入课程介绍" border="{{ false }}" bind:change="addcourse_onInputCourseInfo" />
<view style="display: flex; justify-content: center; align-items: center;">
<van-button style="align-self: center;" type="primary" bind:click="onAddcourseBtnClick">确认添加</van-button>
</view>
</van-cell-group>
</van-collapse-item>
<!-- 下面是修改口令码功能 -->
<van-collapse-item disabled="{{!isAdmin}}" title="修改/删除课程码" name="{{998}}">
<van-collapse-item wx:for="{{changeData}}" wx:for-item="item" wx:for-index="index" wx:key="index" name="{{index}}">
<view slot="title">{{item['口令码']}}</view>
<van-cell-group>
<van-field label="课程" value="{{item['课程']}}" disabled border="{{ false }}"/>
<van-field label="课程码" value="{{item['口令码']}}" placeholder="请输入修改值" border="{{ false }}" data-index="{{index}}" bind:change="onchangecode" />
<van-field label="有效次数" error-message="{{IntegerValid}}" type="digit" value="{{item['剩余有效次数']}}" placeholder="请输入整数" border="{{ false }}" data-index="{{index}}" bind:change="onchangecodecount" />
<van-cell title="结束日期" is-link value="{{item['口令结束日期']}}" data-index="{{index}}" bind:click="showPopup" />
<van-field label="课程介绍" type="textarea" autosize value="{{item['课程介绍']}}" placeholder="请输入修改值" border="{{ false }}" data-index="{{index}}" bind:change="onchangeconde_info" />
<view style="display: flex; justify-content: center; align-items: center;">
<van-button style="margin: 0 20rpx;" type="danger" data-index="{{index}}" bind:click="confirm_to_delete">确认删除</van-button>
<van-button style="margin: 0 20rpx;" type="primary" data-index="{{index}}" bind:click="confirm_to_change">确认修改</van-button>
</view>
</van-cell-group>
</van-collapse-item>
</van-collapse-item>
</van-collapse>
@@ -0,0 +1 @@
/* pages/SetPasswordCode/SetPasswordCode.wxss */
+162
View File
@@ -0,0 +1,162 @@
// pages/Videodetails/Videodetails.js
const MyApi = require('../../Api/api.js');
Page({
/**
* 页面的初始数据
*/
data: {
BaseURL:getApp().globalData.BaseURL,
JustChapter:"",
zhangjieTitle:"",
VideoImageURL:"",
VideoTitle:"",
VideoDetails:"",
RealeaseTime:"",
shichangTime:"",
playdata:[],
VideoPlayerSrc:null,
coursedata:null,
top:0,
HiddenVideoControl:true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
//只有当登录才有效
if (wx.getStorageSync('UserInfoCache').IsLogin) {
var receivedIndex = options.index ?? null;
if (receivedIndex){
//分享页面跳转至课程页面
try {
wx.getStorageSync('UserInfoCache').OwnedCourse[receivedIndex];
if (wx.getStorageSync('UserInfoCache').OwnedCourse[receivedIndex] === undefined){
wx.showToast({
title: '不可用!',
icon: 'error',
mask:true,
duration: 3000
});
setTimeout(function() {
wx.switchTab({
url: '/pages/kecheng/kecheng',
})
},3000);
}
} catch (error) {
wx.showToast({
title: '不可用!',
icon: 'error',
mask:true,
duration: 3000
});
setTimeout(function() {
wx.switchTab({
url: '/pages/kecheng/kecheng',
})
},3000);
}
var tempdata=wx.getStorageSync('UserInfoCache').OwnedCourse[receivedIndex];
MyApi.ApiGetCourseData(tempdata.OpenID,tempdata.课程id)
.then(result => {
this.setData({
VideoTitle:tempdata.课程,
playdata:result.PlayData,
VideoDetails:tempdata.课程介绍,
VideoImageURL:this.data.BaseURL+"/Course/"+tempdata.课程id+".png",
coursedata:tempdata,
});
})
.catch(err => {
this.setData({
playdata:[],
});
console.error("请求失败:"+err);
});
} else {
wx.switchTab({
url: '/pages/kecheng/kecheng',
})
}
} else {
setTimeout(function() {
wx.switchTab({
url: '/pages/kecheng/kecheng',
})
},50);
}
},
OnTapVideoList(e){
//只有当登录才有效
if (wx.getStorageSync('UserInfoCache').IsLogin) {
// 获取当前点击的索引
const currentcourseid = e.currentTarget.dataset.courseid;
const currentzhangjieid = e.currentTarget.dataset.zhangjieid;
const currentplayid = e.currentTarget.dataset.playid;
this.setData({
VideoPlayerSrc:this.data.BaseURL+"/Course/"+currentcourseid+"/"+currentzhangjieid+"/"+currentplayid+"/"+"playlist.m3u8",
HiddenVideoControl:false,
top:420
});
} else {
setTimeout(function() {
wx.switchTab({
url: '/pages/kecheng/kecheng',
})
},50);
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
if (!wx.getStorageSync('UserInfoCache').IsLogin) {
setTimeout(function() {
wx.switchTab({
url: '/pages/kecheng/kecheng',
})
},50);
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
}
})
+5
View File
@@ -0,0 +1,5 @@
{
"usingComponents": {
}
}
+26
View File
@@ -0,0 +1,26 @@
<!--pages/Videodetails/Videodetails.wxml-->
<video hidden="{{HiddenVideoControl}}" class="videoplayer" src="{{VideoPlayerSrc}}"/>
<scroll-view class="scrollarea" scroll-y type="list" style="top:{{top}}rpx;">
<view class="jieshao" >
<text decode class="video_biaoti">&nbsp;&nbsp;{{VideoTitle}}</text>
<text decode class="video_miaoshu">&nbsp;&nbsp;{{VideoDetails}}</text>
<text decode class="video_info">&nbsp;&nbsp;已更新{{playdata.length}}期</text>
</view>
<!-- <text decode class="video_list_content">--&nbsp;&nbsp;目录&nbsp;&nbsp;--</text> -->
<view class="videolistcontainer" bind:tap="OnTapVideoList"
wx:for="{{playdata}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-playid="{{item['播放id']}}" data-zhangjieid="{{item['章节id']}}" data-courseid="{{item['课程id']}}">
<view class="videoimage">
<image class="coverimage" src="{{BaseURL}}/Course/{{item['课程id']}}.png" mode="aspectFill" />
</view>
<view class="videoinfo">
<text class="videotitle">{{item['章节名称']}}</text>
<text class="videodetails">{{item['视频名称']}}</text>
<view class="videoinfo2">
<text class="videodata">{{item['发布日期']}}</text>
<text class="videotime">{{item['时长']}}min</text>
</view>
</view>
</view>
</scroll-view>
+109
View File
@@ -0,0 +1,109 @@
.videoplayer {
position: fixed;
top: 0;
left: 0;
height: 420rpx;
width: 750rpx;
z-index: 999;
}
.scrollarea {
position: relative;
top: 420rpx;
flex: 1;
overflow-y: hidden;
}
.jieshao {
margin-bottom: 10rpx;
/* box-shadow: 0 4rpx 4rpx rgba(150, 150, 150, 0.5); */
position: relative;
height: 200rpx;
}
.video_biaoti {
text-align: center;
display: block;
font-size: 40rpx;
}
.video_miaoshu {
text-align: center;
display: block;
font-size: 30rpx;
}
.video_info {
position:absolute;
bottom: 10rpx;
display: block;
font-size: 24rpx;
right: 30rpx;
}
.video_list_content {
margin: 10rpx 0;
display: flex;
justify-content: center;
align-items: center;
}
.videolistcontainer {
border-radius: 20rpx;
margin: 10rpx 10rpx;
box-shadow: 0 0 4rpx rgba(0, 0, 0, 0.5);
width: 730rpx;
height: 200rpx;
position: relative;
display: flex;
justify-content: left;
align-items: center;
text-align: left;
overflow: hidden;
}
.videoimage {
width: 320rpx;
height: 180rpx;
border-radius: 10rpx;
margin-left: 10rpx;
overflow: hidden;
box-shadow: 0 5rpx 10rpx rgba(0, 0, 0, 0.5);
}
.videoinfo{
position: relative;
width: 390rpx;
height: 180rpx;
border-radius: 10rpx;
margin-left: 20rpx;
overflow: hidden;
}
.videotitle {
text-align: left;
font-size: 30rpx;
}
.videodetails {
display: block;
margin: 10rpx 0rpx;
font-size: 25rpx;
line-height: 30rpx;
}
.videoinfo2 {
position:absolute;
bottom: 0;
display: flex;
justify-content:left;
}
.videodata {
font-size: 20rpx;
}
.videotime {
font-size: 20rpx;
margin-left: 40rpx;
}
.coverimage {
width: 100%;
height: 100%;
}
@@ -0,0 +1,83 @@
// pages/VideoDetailsPage/VideoDetailsPage.js
const htmlSnip =
`<p>
在初中数学的考试当中,解所有题型都需要用到公式,公式的重要性不言而喻!为了更好的帮助孩子们记住初中数学常用的公式、定理,在此老师给大家总结了初中三年所有的公式及定理!这份资料十分珍贵,每次考试都能用的上!
</p>
<p>
<img src="https://api.yeomai.site/WebPages/2/1.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/2.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/3.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/4.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/5.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/6.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/7.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/8.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/9.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/10.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/11.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/12.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/13.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/14.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/15.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/16.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/17.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/18.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/19.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/20.jpg"/><br/><img src="https://api.yeomai.site/WebPages/2/21.jpg"/>
</p>
<p>
<br/>
</p>
`
Page({
/**
* 页面的初始数据
*/
data: {
htmlSnip,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
//允许分享到朋友圈
onShareTimeline(){
}
})
@@ -0,0 +1,6 @@
{
"usingComponents": {
"Parser":"/Parser/index"
}
}
@@ -0,0 +1,3 @@
<text>VideoDetailsPage</text>
<text>富文本测试</text>
<Parser html="{{htmlSnip}}" />
@@ -0,0 +1,7 @@
/* pages/VideoDetailsPage/VideoDetailsPage.wxss */
text {
/* display:inherit; */
left: 400rpx;
top: 100 px;
padding-left: 20rpx;
}
+103
View File
@@ -0,0 +1,103 @@
// pages/WebPageDetails/WebPageDetails.js
Page({
/**
* 页面的初始数据
*/
data: {
htmlcontent: " ",
author: "",
title: "",
date: ""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var receivedIndex = options.index ?? 0;
var tempWebPagesContent = wx.getStorageSync('WebPagesContent')[receivedIndex];
if (tempWebPagesContent.网页内容) {
this.setData({
htmlcontent: tempWebPagesContent.网页内容,
author: tempWebPagesContent.发布人,
title: tempWebPagesContent.网页标题,
date: tempWebPagesContent.发布日期
});
} else {
this.setData({
htmlcontent: " ",
author: "",
title: "",
date: ""
});
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: '叶雷讲数学'
})
}, 0)
})
return {
title: '叶雷讲数学',
path: '',
promise
}
},
//允许分享到朋友圈
onShareTimeline() {
}
})
+5
View File
@@ -0,0 +1,5 @@
{
"usingComponents": {
"Parser":"/Parser/index"
}
}
+12
View File
@@ -0,0 +1,12 @@
<scroll-view class="scrollarea" scroll-y type="list">
<text class="pagetitle">{{title}}</text>
<view class="pageauthoranddate">
<text class="pageauthor">{{author}}</text>
<text class="pagedate">{{date}}</text>
</view>
<Parser html="{{htmlcontent}}" />
</scroll-view>
+63
View File
@@ -0,0 +1,63 @@
/**index.wxss**/
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}
.pagetitle {
display: block;
font-size: 40rpx;
text-align: center;
}
.pagecontent {
display: block;
font-size: 30rpx;
text-align: left;
text-indent: 0rem;
margin-bottom: 30rpx;
padding: 0 10rpx;
}
.pagecontent:first-child {
margin-top: 30rpx;
}
.pageimg {
width: 100%;
}
.pagevideo {
width: 750rpx;
height: 421rpx;
}
.pageauthor {
color: rgb(165, 165, 165);
font-size: 30rpx;
}
.pagedate {
color: rgb(151, 151, 151);
padding-left: 60rpx;
font-size: 30rpx;
}
.pageauthoranddate {
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
}
.sharebtn[plain] {
display: inline;
color: cadetblue;
border:none;
font-size: 30rpx;
margin:0 rpx;
margin-left: 20rpx;
margin-right: 0rpx;
padding:0 ;
width: 120rpx;
}
.content123 {
margin: 0;
}
+256
View File
@@ -0,0 +1,256 @@
// index.js
const MyApi = require('../../Api/api.js');
const updateManager = wx.getUpdateManager();
Page({
/**
* 页面的初始数据
*/
data: {
BaseURL: getApp().globalData.BaseURL,
imageList: [],
WebPages: [],
CourseList: [],
FreeCourseList: [],
webPageCount: 1,
hasTouchBottom:false,
bannerImgName:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
//获取首页banner图片
MyApi.ApiGetBannerImg()
.then(result => {
this.setData({
bannerImgName: result
});
})
.catch(err => {
console.error("请求失败:" + err);
});
//获取首页课程列表
wx.setStorageSync('IndexNewCourseData', []);
MyApi.ApiGetIndexCourseList()
.then(result => {
wx.setStorageSync('IndexNewCourseData', result.ListData);
this.setData({
CourseList: result.ListData
});
})
.catch(err => {
console.error("请求失败:" + err);
});
MyApi.ApiGetIndexFreeCourseList()
.then(result => {
wx.setStorageSync('IndexFreeCourseData', result.ListData);
this.setData({
FreeCourseList: result.ListData
});
})
.catch(err => {
console.error("请求失败:" + err);
});
//获取十个页面数据
MyApi.ApiGetWebPagesFromDB(1)
.then(result => {
wx.setStorageSync('WebPagesContent', result);
var tempWebPagesContent = wx.getStorageSync('WebPagesContent');
this.setData({
WebPages: tempWebPagesContent,
});
})
.catch(err => {
console.error("请求失败:" + err);
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
//微信小程序更新
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
//console.log("是否有新版本:"+res.hasUpdate)
})
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
showCancel:false,
content: '新版本已准备好,即将重启应用',
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// 新版本下载失败
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
//逻辑同onLoad()一样,略有修改\
//获取首页banner图片
MyApi.ApiGetBannerImg()
.then(result => {
//增加停止下拉刷新显示
wx.stopPullDownRefresh();
this.setData({
bannerImgName: result
});
})
.catch(err => {
console.error("请求失败:" + err);
});
//获取首页课程列表
wx.setStorageSync('IndexNewCourseData', []);
MyApi.ApiGetIndexCourseList()
.then(result => {
//增加停止下拉刷新显示
wx.stopPullDownRefresh();
wx.setStorageSync('IndexNewCourseData', result.ListData);
this.setData({
CourseList: result.ListData
});
})
.catch(err => {
console.error("请求失败:" + err);
});
MyApi.ApiGetIndexFreeCourseList()
.then(result => {
wx.setStorageSync('IndexFreeCourseData', result.ListData);
this.setData({
FreeCourseList: result.ListData
});
})
.catch(err => {
console.error("请求失败:" + err);
});
//获取十个页面数据
MyApi.ApiGetWebPagesFromDB(1)
.then(result => {
//增加停止下拉刷新显示
wx.stopPullDownRefresh();
wx.setStorageSync('WebPagesContent', result);
var tempWebPagesContent = wx.getStorageSync('WebPagesContent');
this.setData({
WebPages: tempWebPagesContent,
});
})
.catch(err => {
console.error("请求失败:" + err);
});
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
MyApi.ApiGetWebPagesFromDB(this.data.webPageCount + 1)
.then(result => {
if (result) {
//使用展开运算符将两个JSON数据拼接在一起
var combinedJson = this.data.WebPages.concat(result);
var requireCount = this.data.webPageCount;
this.setData({
hasTouchBottom: false,
webPageCount: requireCount + 1,
WebPages: combinedJson
});
//更新缓存
wx.setStorageSync('WebPagesContent', combinedJson)
} else {
this.setData({
hasTouchBottom: true,
});
}
})
.catch(err => {
console.error("请求失败:" + err);
});
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
NavigatorToWebPageDetails(e) {
var index = e.currentTarget.dataset.index;
wx.navigateTo({
url: '/pages/WebPageDetails/WebPageDetails?index=' + index,
})
},
NavigatorToIndexNewCourseDetails(e) {
var number = e.currentTarget.dataset.number;
wx.navigateTo({
url: '/pages/IndexNewCourseDetails/IndexNewCourseDetails?number=' + number,
})
},
NavigatorToIndexFreeCourseDetails(e) {
var number = e.currentTarget.dataset.number;
wx.navigateTo({
url: '/pages/IndexFreeCourseDetails/IndexFreeCourseDetails?number=' + number,
})
},
//允许分享到朋友圈
onShareTimeline(e) {
}
})
+7
View File
@@ -0,0 +1,7 @@
{
"usingComponents": {
"van-loading": "@vant/weapp/loading/index"
},
"onReachBottomDistance":50,
"enablePullDownRefresh":true
}
+75
View File
@@ -0,0 +1,75 @@
<!--index.wxml-->
<scroll-view class="container" scroll-y enable-flex type="custom">
<view class="banner">
<swiper class="bannerswiper" autoplay interval="20000" circular indicator-dots indicator-color="rgba(255, 255, 255, .3)" indicator-active-color="rgba(255, 255, 255, 1.0)" indicator-type="normal" duration="1000" easing-function="easeOutCubic">
<swiper-item wx:for="{{bannerImgName}}" wx:for-item="item" wx:key="index" class="bannerswiperitem">
<image class="indeximage" src="{{BaseURL}}/Images/Banner/{{item['图片名']}}" mode="aspectFill" />
</swiper-item>
</swiper>
</view>
<!-- <scroll-view class="mulucontainer" scroll-x enable-flex style="flex-direction: row;" type="custom" show-scrollbar="{{false}}">
<navigator class="navpage001" url="/pages/test/test">
<image class="navpage001img" wx:if="{{BaseURL}}" src="{{BaseURL}}/Images/Icon/indeximgbtn1.png" mode="scaleToFill" />
<text class="tupianwenzi">精品好课</text>
</navigator>
</scroll-view> -->
<!-- 新课上线 -->
<view class="shouyetupianlist">
<view class="biaoti01">
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/xinke.png" mode="aspectFill" />
<text decode>&nbsp;新课上线</text>
</view>
<view class="shouyetupianlistcontent" wx:for="{{CourseList}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-number="{{index}}" bind:tap="NavigatorToIndexNewCourseDetails">
<view class="hengxianglist" key="{{index}}">
<image class="indeximagelist" src="{{BaseURL}}/Images/NewCourse/{{item['课程名称']}}.png" mode="aspectFill" />
</view>
</view>
</view>
<!-- 免费课程 -->
<view class="shouyetupianlist">
<view class="biaoti01">
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/xinke.png" mode="aspectFill" />
<text decode>&nbsp;免费课程</text>
</view>
<view class="shouyetupianlistcontent" wx:for="{{FreeCourseList}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-number="{{item['序号']}}" bind:tap="NavigatorToIndexFreeCourseDetails">
<view class="hengxianglist" key="{{index}}">
<image class="indeximagelist" src="{{BaseURL}}/Images/FreeCourse/{{item['课程名称']}}.png" mode="aspectFill" />
</view>
</view>
</view>
<!-- 知识速通 -->
<view class="shouyetupianlist">
<view class="biaoti01">
<image class="biaoti01img" src="{{BaseURL}}/Images/Icon/sutong.png" mode="aspectFill" />
<text decode>&nbsp;知识速通</text>
</view>
<view class="shouyetupianlistcontent01" wx:for="{{WebPages}}" wx:for-item="imageshuzu" wx:for-index="index" wx:key="index" bind:tap="NavigatorToWebPageDetails" data-index="{{index}}">
<view class="hengxianglist01" key="{{index}}">
<image class="indeximagelist01" src="{{BaseURL}}/WebPages/{{imageshuzu['网页id']}}.png" mode="aspectFill" />
</view>
<view class="indeximagelistmiaosu">{{imageshuzu['网页标题']}}</view>
<view class="indeximagelistmiaosu01">
<text class="indeximagelistmiaosu0102">
{{imageshuzu['详细介绍']}}
</text>
</view>
</view>
<view style="width: auto; margin: 0px auto; margin-bottom: 10px;">
<text wx:if="{{hasTouchBottom}}">已经到底啦!</text>
</view>
</view>
</scroll-view>
+137
View File
@@ -0,0 +1,137 @@
/**index.wxss**/
/* 暂时未用到
page {
} */
.container {
padding:0;
align-items:center;
flex-direction:column;
justify-content:space-between;
}
.mulucontainer {
width: 710rpx;
height: 150rpx;
white-space: nowrap; /*强制子元素为一行 */
margin-left: 25rpx;
}
.navpage001 {
display: inline-block;
width: 150rpx;
height: 150rpx;
margin-right: 25rpx;
text-align: center;
font-size: 10px;
align-items: center;
}
.navpage001img {
margin:0 auto;
width: 60%;
height: 60%;
}
.mulucontainer .navpage001:last-child{
margin-right: 0;
}
.banner{
width: 100%;
height: 400rpx;
}
.shouyetupianlist {
display: flex;
flex-wrap: wrap;/* 允许内容换行 */
justify-content:space-between;/* 水平方向上两端对齐 */
}
.shouyetupianlistcontent {
/* display: inline; */
padding: 0;
margin: 20rpx;
height: 204rpx;
width: 334rpx; /* 每行两个图片,设置宽度为 48% 可以有一定的间距 */
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.shouyetupianlistcontent01 {
position: relative;
padding: 0;
margin: 20rpx;
height: 260rpx;
width: 100%;
overflow: hidden;
border-radius: 20rpx;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.indeximagelist {
width: 100%;
height: 204rpx;
}
.indeximagelist01 {
width: 100%;
height: 100%;
}
.tupianwenzi {
display: block;
}
.biaoti01 {
display: flex;
width: 100%;
height: 60rpx;
align-items: center;
padding-left: 20rpx;
}
.biaoti01img {
width: 40rpx;
height: 40rpx;
}
.hengxianglist01 {
display: flex;
width: 300rpx;
height: inherit; /* 推荐尺寸在300*250rpx 即150*125px */
margin: 0;
overflow: hidden;
border-radius: 20rpx;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.indeximage{
border-radius: 20rpx;
height: 350rpx;
width: 710rpx;
transform: translate(20rpx, 30rpx);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.bannerswiper {
height: 390rpx;
}
.indeximagelistmiaosu {
font-size: 28rpx;
display:flex;
position: absolute;
top: 10rpx;
left: 300rpx;
height: 70rpx;
align-items: center;
padding-left: 20rpx;
}
.indeximagelistmiaosu01 {
display: inline;
position: absolute;
left: 300rpx;
top: 35px;
align-items: center;
padding-left: 20rpx;
}
.indeximagelistmiaosu0102 {
font-size: 20rpx;
position: relative;
top: -15px;
width: 370rpx;
}
+98
View File
@@ -0,0 +1,98 @@
// pages/kecheng/kecheng.js
Page({
/**
* 页面的初始数据
*/
data: {
BaseURL:getApp().globalData.BaseURL,
hasCourse: false,
OwnedCourse: null,
intervalId: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
//每10ms获取一次数据,直到获取到个人信息数据为止
// 使用箭头函数确保正确的作用域
var longtime=0;
this.intervalId = setInterval(() => {
//不间断刷新页面
this.onShow();
if (this.data.OwnedCourse){
clearInterval(this.intervalId);
return;
};
//计时500次,即5s后如果没有任何获取到已经登录的标志,依然断开计时器
if (longtime>=500){
clearInterval(this.intervalId);
console.log('暂无已购课程!');
};
longtime=longtime+1;
}, 10);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
if ((wx.getStorageSync('UserInfoCache').OwnedCourse)&&(wx.getStorageSync('UserInfoCache').IsLogin)) {
this.setData({
hasCourse: true,
OwnedCourse: wx.getStorageSync('UserInfoCache').OwnedCourse
});
} else {
this.setData({
hasCourse: false,
OwnedCourse: null
});
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
NavigatorToVideoDetails(e) {
var index=e.currentTarget.dataset.index;
wx.navigateTo({
url: '/pages/VideoDetails/VideoDetails?index='+index,
})
}
})
+6
View File
@@ -0,0 +1,6 @@
{
"usingComponents": {
},
"navigationBarTitleText": "课程"
}
+17
View File
@@ -0,0 +1,17 @@
<scroll-view class="container" scroll-y enable-flex type="custom">
<block wx:if="{{!hasCourse}}">
<text>暂无信息</text>
</block>
<block wx:else>
<view wx:for="{{OwnedCourse}}" wx:for-item="item" wx:for-index="index" wx:key="index" class="kecheng" bind:tap="NavigatorToVideoDetails" data-index="{{index}}">
<view class="kecheng_video_up">
<image class="kecheng_img" src="{{BaseURL}}/Course/{{item['课程id']}}.png" mode="aspectFit" />
</view>
<view class="kecheng_video_right">
<text class="kecheng_title">{{item['课程']}}</text>
<text class="kecheng_details">{{item['课程介绍']}}</text>
</view>
</view>
</block>
</scroll-view>
+50
View File
@@ -0,0 +1,50 @@
/* pages/kecheng/kecheng.wxss */
.container {
padding:0;
align-items:center;
flex-direction:column;
justify-content:space-between;
}
.kecheng {
width: 710rpx;
height: 275rpx;
border-radius: 20rpx;
overflow: hidden;
display: flex;
justify-content: left;
align-items: center;
margin: 6px 0;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.kecheng_video_up {
width: 400rpx;
height: 225rpx;
margin-left: 10rpx;
}
.kecheng_video_right {
margin-left: 5rpx;
width: 290rpx;
height: 225rpx;
overflow: hidden;
}
.kecheng_img {
background-color: #15457b;
width: 100%;
height: 100%;
border-radius: 15rpx;
}
.kecheng_title {
display: block;
font-size: 30rpx;
text-align: center;
}
.kecheng_details {
display: block;
font-size: 25rpx;
margin-top: 15rpx;
margin-left: 15rpx;
}
+200
View File
@@ -0,0 +1,200 @@
// pages/wode/wode.js
const MyApi = require('../../Api/api.js');
Page({
/**
* 页面的初始数据
*/
data: {
value: '',
show: false,
passwordcode: null,
intervalId: null,
headiconurl: '/static/image/user.png',
urlstring: getApp().globalData.BaseURL + "/Images/ToolsIcon/toolsicon",
LoginBtnText: '登录注册',
UserNameText: '未登录',
user_openid: null,
YelayMaths_ID: null,
IsLogin: null,
IsAdministor: null,
LastLoginDate: null,
UserName: null,
NewUser: null
},
showdialog() {
if (wx.getStorageSync('UserInfoCache').IsLogin ) {
this.setData({
show: true,
value: ''
});
} else {
wx.showToast({
mask:true,
icon: 'error',
title: '请登录后操作!',
})
}
},
onChange(e) {
this.setData({
passwordcode: e.detail
});
},
onClose() {
this.setData({
show: false,
passwordcode: null
});
},
GetCourse() {
//点击确定后的课程获取
if (this.data.passwordcode) {
wx.showToast({
title: '请稍后...',
icon: 'loading',
mask:true,
duration: 10000
});
MyApi.ApiPasswordCodeValidate(wx.getStorageSync('UserInfoCache').user_openid, this.data.passwordcode)
.then(result => {
// 成功后执行的代码
try {
wx.hideToast();
} catch (error) {}
wx.showToast({
title: result.Data,
icon: 'error',
mask:true,
duration: 2000
});
//修改缓存已拥有课程
if (result.ReturnData) {
var tempcourse = wx.getStorageSync('UserInfoCache');
tempcourse.OwnedCourse=result.ReturnData;
wx.setStorageSync('UserInfoCache', tempcourse);
};
})
.catch(err => {
// 失败后执行的代码
console.error("请求失败:" + err);
});
} else {
wx.showToast({
title: '请输入课程码!',
icon: 'error',
mask:true,
duration: 2000
});
}
this.setData({
show: false,
});
},
redirectToTargetLoginout: function () {
wx.navigateTo({
url: '/pages/LoginOrOutDetails/LoginOrOutDetails?IsLogin=' + this.IsLogin,
})
},
NGT_SetPasswordCode: function () {
this.setData({
show: false,
});
wx.navigateTo({
url: '/pages/SetPasswordCode/SetPasswordCode',
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var Storage = wx.getStorageSync('UserInfoCache');
if (Storage.IsLogin === "1") {
this.setData({
IsLogin: Storage.IsLogin,
headiconurl: getApp().globalData.BaseURL + "/Images/UsersHeadIcon/" + Storage.user_openid + ".png",
LoginBtnText: "个人信息",
UserNameText: Storage.UserName,
IsAdministor: Storage.IsAdministor,
});
} else {
this.setData({
IsLogin: null,
headiconurl: "/static/image/user.png",
LoginBtnText: "登录注册",
UserNameText: "未登录",
IsAdministor: null,
});
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.onLoad();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
function2_01() {
wx.showModal({
title: '提示',
content: '功能安排中。。。',
success(res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
})
+8
View File
@@ -0,0 +1,8 @@
{
"usingComponents": {
"van-dialog": "@vant/weapp/dialog/index",
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
},
"navigationBarTitleText": "个人中心"
}
+61
View File
@@ -0,0 +1,61 @@
<!--pages/wode/wode.wxml-->
<van-dialog
use-slot
show="{{ show }}"
show-cancel-button
bind:confirm="GetCourse"
bind:close="onClose"
>
<van-button wx:if="{{IsAdministor && IsLogin}}" enabled="{{IsAdministor && IsLogin}}" bind:click="NGT_SetPasswordCode" type="primary" size="large">点击此处设置课程码</van-button>
<van-button wx:else disabled="{{true}}" type="primary" size="large">课程码</van-button>
<van-field
value="{{ value }}"
placeholder="请输入课程码"
input-align="center"
border="{{ false }}"
bind:change="onChange"
/>
</van-dialog>
<scroll-view class="container" scroll-y enable-flex type="custom">
<view class="login">
<view class="touxiangimg">
<image class="loginuserimg" src="{{headiconurl}}" mode="aspectFill" />
</view>
<view class="userinfo_name">
<text>{{UserNameText}}</text>
<button class="loginbtn" bindtap="redirectToTargetLoginout" plain>{{LoginBtnText}}</button>
</view>
</view>
<!-- 隐藏常用工具区域 -->
<!-- <view class="functions1">
<text>常用工具</text>
<view class="functionstools">
<view wx:for="{{1}}" wx:for-item="item" wx:key="index">
<navigator class="function001" url="#">
<image class="functionimg001" src="{{urlstring}}{{index}}.png" mode="" />
<text class="functiontext001">工具{{index}}</text>
</navigator>
</view>
</view>
</view> -->
<button class="functions2" bind:tap="showdialog">
<text class="zuobianwenzi">课程码</text>
<text class="jiantou"> > </text>
</button>
<!-- 功能暂不开放 -->
<!-- <button class="functions2" bind:tap="function2_01">
<text class="zuobianwenzi">成员管理</text>
<text class="jiantou"> > </text>
</button> -->
<view class="version">
<text style="display: block;">Version 0.0.7</text>
<text style="font-size: 20rpx;display: block;">Copyright<text style="font-size: 15rpx;position: relative;top: -10rpx;right: 0rpx;">©</text> 2024 YelayMaths. All Rights Reserved.</text>
</view>
</scroll-view>
+115
View File
@@ -0,0 +1,115 @@
/* pages/wode/wode.wxss */
.container {
padding:0;
align-items:center;
flex-direction:column;
justify-content:space-between;
}
.login {
display: flex;
justify-content: center;
align-items: center;
/* border: 3rpx solid rgb(110, 110, 110); */
width: 710rpx;
height: 150rpx;
border-radius: 20rpx;
margin: 20rpx;
border-radius: 20rpx;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.touxiangimg {
display: flex;
width: 100rpx;
height: 100rpx;
border-radius: 50rpx;
}
.userinfo_name {
width: 500rpx;
height: 150rpx;
margin-left: 30rpx;
border-radius: 75rpx;
display: flex;
justify-content: center;
align-items: center;
}
.loginbtn {
display: block;
text-align: center;
}
.loginbtn[plain] {
color: #353535;
background-color: transparent;
border: 0px solid #353535;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
padding: 0rpx 20rpx;
}
.loginuserimg {
width: 100%;
height: 100%;
border-radius: 20rpx;
}
.functions1 {
border: 3rpx solid rgb(110, 110, 110);
width: 670rpx;
border-radius: 20rpx;
margin: 20rpx;
border-radius: 20rpx;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
padding: 20rpx;
}
.functions2 {
display: flex;
justify-content: space-between;
align-items: center;
/* border: 3rpx solid rgb(110, 110, 110); */
background-color: white;
width: 710rpx;
height: 100rpx;
border-radius: 20rpx;
margin: 8rpx 20rpx;
border-radius: 20rpx;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}
.jiantou {
font-size: 40rpx;
}
.zuobianwenzi {
font-size: 30rpx;
}
.function001 {
height: 150rpx;
width: 75rpx;
padding: 10rpx 47rpx;
text-align: center;
align-items: center;
}
.functionimg001 {
width: 75rpx;
height: 75rpx;
}
.functiontext001 {
font-size: 25rpx;
}
.functionstools {
position: relative;
top: 20rpx;
padding-bottom: 20rpx;
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
}
.version {
position: fixed;
bottom: 10rpx;
color: rgb(197, 197, 197);
font-size: 25rpx;
text-align: center;
}