parent
083406bb74
commit
c795112f0a
@ -1,7 +1,7 @@
|
||||
<!--components/icon/myicon.wxml-->
|
||||
<view
|
||||
class="custom-class iconfont myicon-{{ type }}"
|
||||
style="{{ color ? 'color: ' + color : '' }}; {{ size ? 'font-size: ' + size + 'px' : '' }}"
|
||||
style="{{ color ? 'color: ' + color + ';' : '' }}{{ size ? 'font-size: ' + size + 'px;' : '' }}"
|
||||
bind:tap="onClick">
|
||||
<view wx:if="{{ info !== null }}" class="myicon__info">{{ info }}</view>
|
||||
</view>
|
||||
|
@ -0,0 +1,23 @@
|
||||
// components/modal/join_course/join_course.js
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<!--components/modal/join_course/join_course.wxml-->
|
||||
<modal id="modal" hidden="{{!show_join_course_modal}}" title="加入课堂" confirm-text="提交" cancel-text="取消" bindcancel="cancel_join_course_modal" bindconfirm="join_course">
|
||||
<input type='text' bindinput="update_invite_code" class="code-input" placeholder="邀请码" auto-focus/>
|
||||
<checkbox-group bindchange="update_identities">
|
||||
<text>身份:</text>
|
||||
<lable class="identity"><checkbox value="professor"/>教师</lable>
|
||||
<lable class="identity"><checkbox value="assistant_professor"/>助教</lable>
|
||||
<lable class="identity"><checkbox value="student"/>学生</lable>
|
||||
</checkbox-group>
|
||||
</modal>
|
@ -0,0 +1,9 @@
|
||||
.code-input{
|
||||
border-radius: 10rpx;
|
||||
border: 1rpx solid;
|
||||
height: 36px;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
lable.identity{
|
||||
margin-right: 16rpx;
|
||||
}
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
@ -1,24 +1,4 @@
|
||||
<import src="/towxml/entry.wxml"/>
|
||||
<view class="container">
|
||||
<text>
|
||||
# 功能介绍
|
||||
|
||||
- 学员可以在点击右下角”加入课堂”选择课程加入,教员可以在“加入课堂中”新建课程
|
||||
|
||||
- 长按相应课程可以退出学习
|
||||
|
||||
- 进入课堂界面会显示在位,头像为彩色,若退出课堂界面则会显示灰色头像
|
||||
|
||||
- 教员在课堂界面中可以直观地看到学员在位情况,可以选择学员让其起立回答问题,并且对学员可以进行加分、减分操作
|
||||
|
||||
- 学员可以收到教员让其起立提问、回答的提示,还可以点击“我要提问、回答”
|
||||
|
||||
- 在课堂界面右下角进入“更多”可以查看本课堂的课程文件资源
|
||||
|
||||
- 教员可以在课程的设置界面中更新课程的名称,还可以将学员移除本课程的学习
|
||||
|
||||
## 其他
|
||||
|
||||
- 用户可以在设置中更改姓名、用户名
|
||||
|
||||
</text>
|
||||
<template is="entry" data="{{...article}}" class="about"/>
|
||||
</view>
|
@ -1 +1,17 @@
|
||||
/* pages/about/about.wxss */
|
||||
|
||||
/**基础风格样式**/
|
||||
@import '/towxml/style/main.wxss';
|
||||
|
||||
|
||||
/**如果页面有动态主题切换,则需要将使用到的样式全部引入**/
|
||||
|
||||
/**主题配色(浅色样式)**/
|
||||
@import '/towxml/style/theme/light.wxss';
|
||||
|
||||
/**主题配色(深色样式)**/
|
||||
@import '/towxml/style/theme/dark.wxss';
|
||||
|
||||
.about{
|
||||
padding-bottom: 4px;
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
// pages/course_detail/course_detail.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<!--pages/course_detail/course_detail.wxml-->
|
||||
<text>pages/course_detail/course_detail.wxml</text>
|
@ -0,0 +1 @@
|
||||
/* pages/course_detail/course_detail.wxss */
|
@ -0,0 +1,108 @@
|
||||
// pages/courses/courses.js
|
||||
const app = getApp();
|
||||
Page({
|
||||
|
||||
|
||||
data: {
|
||||
courses: [],
|
||||
loading: true,
|
||||
page: 1,
|
||||
show_join_course_modal:false,
|
||||
},show_join_course_modal: function(event){
|
||||
this.setData({show_join_course_modal: true});
|
||||
},
|
||||
cancel_join_course_modal: function(event){
|
||||
this.setData({show_join_course_modal: false});
|
||||
},
|
||||
update_invite_code: function({detail: {value}}){
|
||||
this.setData({invite_code: value});
|
||||
},
|
||||
update_identities: function({detail: {value}}){
|
||||
this.setData({identities: value})
|
||||
},
|
||||
join_course: function(event){
|
||||
const {invite_code, identities} = this.data;
|
||||
let data = {invite_code: invite_code};
|
||||
for(var identity of identities){
|
||||
data[identity] = 1;
|
||||
}
|
||||
console.log(data);
|
||||
console.log({ ...data });
|
||||
app.client.join_course({...data})
|
||||
.then(res=>{
|
||||
console.log(res);
|
||||
wx.showToast({
|
||||
title: res.data.message
|
||||
})
|
||||
wx.navigateTo({
|
||||
url: "../course_detail/course_detail?course_id="+res.data.course_id
|
||||
});
|
||||
this.cancel_join_course_modal();
|
||||
})
|
||||
.catch(error=>{
|
||||
wx.showToast({
|
||||
title: error.toString(),
|
||||
icon: "none"
|
||||
});
|
||||
console.warn(error);
|
||||
})
|
||||
|
||||
},
|
||||
fetch_courses: function(options){
|
||||
return app.client.search_courses(options)
|
||||
},
|
||||
set_courses: function(courses){
|
||||
this.setData({courses: courses});
|
||||
},
|
||||
add_courses: function(courses){
|
||||
this.setData({
|
||||
courses:[...this.data.courses, ...courses],
|
||||
})
|
||||
},
|
||||
|
||||
onLoad: function (options) {
|
||||
this.fetch_courses().then(res=>{
|
||||
console.log(res);
|
||||
this.set_courses(res.data.courses);
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
|
||||
onReachBottom: function () {
|
||||
this.fetch_courses({ page: this.data.page + 1 })
|
||||
.then(res => {
|
||||
this.setData({ page: this.data.page + 1 })
|
||||
this.add_courses(res.data.courses);
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"myicon": "/components/icon/myicon"
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<!--pages/addclass/addclass.wxml-->
|
||||
<view class="container">
|
||||
<view class="course-list form-wrap">
|
||||
<image wx:if="{{courses.length==0 && !loading}}" src="../../images/none2.png" class="none-content"></image>
|
||||
<text wx:if="{{courses.length==0 && !loading}}" class="none-content">没有可以加入的课程了</text>
|
||||
<block wx:for="{{courses}}" wx:for-item="course" wx:key="id">
|
||||
<view hidden="{{course.present}}" bindtap="join_course" class="course-item flex-wrap" data-id="{{course.id}}" data-name="{{course.name}}">
|
||||
<myicon class="course-icon" type="internet_class" size="26"></myicon>
|
||||
<text class="course-name">{{course.name}}</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--components/modal/join_course/join_course.wxml-->
|
||||
<modal id="modal" hidden="{{!show_join_course_modal}}" title="加入课堂" confirm-text="提交" cancel-text="取消" bindcancel="cancel_join_course_modal" bindconfirm="join_course">
|
||||
<input type='text' bindinput="update_invite_code" class="code-input" placeholder="邀请码" auto-focus/>
|
||||
<checkbox-group bindchange="update_identities">
|
||||
<text>身份:</text>
|
||||
<lable class="identity"><checkbox value="professor"/>教师</lable>
|
||||
<lable class="identity"><checkbox value="assistant_professor"/>助教</lable>
|
||||
<lable class="identity"><checkbox value="student"/>学生</lable>
|
||||
</checkbox-group>
|
||||
</modal>
|
@ -0,0 +1,47 @@
|
||||
/* pages/addclass/addclass.wxss */
|
||||
.course-icon{
|
||||
margin-left: 2px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
.course-list{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 0 -12px
|
||||
}
|
||||
.course-item{
|
||||
align-items: center;
|
||||
background: white;
|
||||
padding: 30rpx 12px;
|
||||
border-bottom: 1rpx solid #EEE;
|
||||
position: relative;
|
||||
}
|
||||
.course-item:after {
|
||||
content: '进入>';
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 2rpx;
|
||||
top: 50%;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
margin-top: -20rpx;
|
||||
margin-right: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
.course-name{
|
||||
vertical-align: middle;
|
||||
margin-right: 80rpx;
|
||||
}
|
||||
|
||||
.none-content{
|
||||
align-self: center;
|
||||
}
|
||||
text.none-content{
|
||||
font-size: 16px;
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
image.none-content{
|
||||
margin-top: 120rpx;
|
||||
height: 160rpx;
|
||||
width: 180rpx;
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
// pages/login/login.js
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
error: "",
|
||||
login: "",
|
||||
password: ""
|
||||
},
|
||||
update_login:function({detail: {value}}){
|
||||
this.setData({login: value});
|
||||
},
|
||||
update_password: function({detail: {value}}){
|
||||
this.setData({password: value});
|
||||
},
|
||||
login: function({currentTarget:{dataset}}){
|
||||
const {login, password} = this.data;
|
||||
app.client.login({login: login, password: password, autologin: 1,
|
||||
success(res){
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
console.log("login_successful!!!!");
|
||||
},
|
||||
fail(error){
|
||||
wx.showToast({
|
||||
title: error.toString(),
|
||||
icon: "none"
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "登陆educoder",
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<view class="container">
|
||||
<view class="logo-view">
|
||||
<image class="logo" src="../../images/educoder.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="form-wrap">
|
||||
<view class="input-wrap">
|
||||
<input class="login-input"
|
||||
bindinput="update_login"
|
||||
placeholder="用户名、邮箱、手机号">
|
||||
</input>
|
||||
</view>
|
||||
<text class="error" wx:if="{{!error}}">{{error}}</text>
|
||||
<view class="input-wrap">
|
||||
<input password
|
||||
class="login-input"
|
||||
placeholder="密码"
|
||||
bindinput="update_password">
|
||||
</input>
|
||||
</view>
|
||||
</view>
|
||||
<button class="login-submit" type="primary" bindtap="login">
|
||||
登陆
|
||||
</button>
|
||||
</view>
|
@ -0,0 +1,34 @@
|
||||
.logo-view{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.logo{
|
||||
align-self: center;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
.input-wrap {
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
margin: 0 -12px;
|
||||
padding: 0 12px;
|
||||
height: 46px;
|
||||
line-height: 46px;
|
||||
}
|
||||
.label {
|
||||
color: #999;
|
||||
width: 4.5em;
|
||||
}
|
||||
.login-input {
|
||||
font-size: 18px;
|
||||
line-height: 100%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.login-submit{
|
||||
margin: 24rpx 36rpx;
|
||||
}
|
||||
textarea {
|
||||
width: 100%;
|
||||
}
|
@ -1,20 +1,86 @@
|
||||
const AV = require("../../lib/av-live-query-weapp-min")
|
||||
const AV = require("../../lib/av-live-query-weapp-min");
|
||||
const app = getApp();
|
||||
Page({
|
||||
data:{
|
||||
current_user: null
|
||||
current_user: null,
|
||||
avatar_url: '',
|
||||
show_join_course_modal: false,
|
||||
invite_code: ""
|
||||
},
|
||||
enter_usersetting: function(event){
|
||||
wx.navigateTo({
|
||||
url: '../user/user'
|
||||
logout: function(){
|
||||
app.client.logout({
|
||||
success:res=>{
|
||||
console.log("注销成功");
|
||||
console.log(res);
|
||||
this.enter_login();
|
||||
},
|
||||
fail:error=>{
|
||||
console.error("注销失败");
|
||||
console.error(error);
|
||||
}
|
||||
})
|
||||
},
|
||||
enter_changeuser: function(event){
|
||||
console.log(event);
|
||||
enter_login: function(event){
|
||||
wx.navigateTo({
|
||||
url: '../changeuser/changeuser'
|
||||
url: '../login/login',
|
||||
})
|
||||
},
|
||||
show_join_course_modal: function(event){
|
||||
this.setData({show_join_course_modal: true});
|
||||
},
|
||||
cancel_join_course_modal: function(event){
|
||||
this.setData({show_join_course_modal: false});
|
||||
},
|
||||
update_invite_code: function({detail: {value}}){
|
||||
this.setData({invite_code: value});
|
||||
},
|
||||
update_identities: function({detail: {value}}){
|
||||
this.setData({identities: value})
|
||||
},
|
||||
join_course: function(event){
|
||||
const {invite_code, identities} = this.data;
|
||||
let data = {invite_code: invite_code};
|
||||
for(var identity of identities){
|
||||
data[identity] = 1;
|
||||
}
|
||||
console.log(data);
|
||||
console.log({ ...data });
|
||||
app.client.join_course({...data})
|
||||
.then(res=>{
|
||||
console.log(res);
|
||||
wx.showToast({
|
||||
title: res.data.message
|
||||
})
|
||||
wx.navigateTo({
|
||||
url: "../course_detail/course_detail?course_id="+res.data.course_id
|
||||
});
|
||||
this.cancel_join_course_modal();
|
||||
})
|
||||
.catch(error=>{
|
||||
wx.showToast({
|
||||
title: error.toString(),
|
||||
icon: "none"
|
||||
});
|
||||
console.warn(error);
|
||||
})
|
||||
|
||||
},
|
||||
onShow: function(){
|
||||
this.setData({current_user: AV.User.current().toJSON()})
|
||||
this.setData({current_user: app.client.current_user})
|
||||
if ("image_url" in app.client.current_user && app.client.current_user.image_url){
|
||||
this.setData({avatar_url: "https://www.educoder.net/images/" + app.client.current_user.image_url})
|
||||
}
|
||||
}
|
||||
|
||||
// enter_usersetting: function(event){
|
||||
// wx.navigateTo({
|
||||
// url: '../user/user'
|
||||
// })
|
||||
// },
|
||||
// enter_changeuser: function(event){
|
||||
// console.log(event);
|
||||
// wx.navigateTo({
|
||||
// url: '../changeuser/changeuser'
|
||||
// })
|
||||
// },
|
||||
})
|
@ -1,13 +1,26 @@
|
||||
<view class="setting">
|
||||
<view class="user-view bg_user">
|
||||
<open-data type="userAvatarUrl" class="avatar" default-avatar="../../images/avatar.png"></open-data>
|
||||
<text class="user-text" bindtap="enter_usersetting">{{current_user.name}} | {{current_user.username}}</text>
|
||||
<!--open-data type="userAvatarUrl" class="avatar" default-avatar="../../images/avatar.png"></open-data-->
|
||||
<image class="avatar" src="{{avatar_url?avatar_url:'../../images/avatar.png'}}"></image>
|
||||
<text class="user-text" bindtap="enter_usersetting">{{current_user.real_name}} | {{current_user.username}}</text>
|
||||
</view>
|
||||
<view class="nav-list">
|
||||
<navigator url="../user/user" class="nav user" bindlongpress="enter_changeuser">登陆信息修改</navigator>
|
||||
<navigator hidden="{{true}}" url="../changeuser/changeuser" class="nav user">更换登陆用户</navigator>
|
||||
<navigator url="../addclass/addclass" class="nav addclass">加入课程</navigator>
|
||||
<!--navigator url="../user/user" class="nav user" bindlongpress="enter_changeuser">登陆信息修改</navigator>
|
||||
<navigator hidden="{{true}}" url="../changeuser/changeuser" class="nav user">更换登陆用户</navigator-->
|
||||
<navigator class="nav addclass" bindtap="show_join_course_modal">加入课程</navigator>
|
||||
<navigator url="../createclass/createclass" class="nav createclass">创建课程</navigator>
|
||||
<navigator url="../about/about" class="nav about">关于</navigator>
|
||||
</view>
|
||||
<button class="login" type="primary" wx:if="{{current_user.user_id==2}}" bindtap="enter_login">登陆</button>
|
||||
<button class="logout" wx:else bindtap="logout">退出登陆</button>
|
||||
</view>
|
||||
<modal id="modal" hidden="{{!show_join_course_modal}}" title="加入课堂" confirm-text="提交" cancel-text="取消" bindcancel="cancel_join_course_modal" bindconfirm="join_course">
|
||||
<input type='text' bindinput="update_invite_code" class="code-input" placeholder="邀请码" auto-focus/>
|
||||
<checkbox-group bindchange="update_identities">
|
||||
<text>身份:</text>
|
||||
<lable class="identity"><checkbox value="professor"/>教师</lable>
|
||||
<lable class="identity"><checkbox value="assistant_professor"/>助教</lable>
|
||||
<lable class="identity"><checkbox value="student"/>学生</lable>
|
||||
</checkbox-group>
|
||||
</modal>
|
||||
|
||||
|
Loading…
Reference in new issue