优化细节

smart_class
educoder_weapp 5 years ago
parent 15abf2637e
commit 8695a98f7c

@ -20,3 +20,5 @@
## 试卷作答
- 学员在课程内可以看到老师发布的试卷,并且回答
- 试卷截止后可以学生可以看到公布的答案

@ -13,9 +13,7 @@ AV.init({
appId: 'eVHYNBdT5D2lDxNj5jtJXsWT-MdYXbMMI',
appKey: 'waM3bwf1ftpsMLjRBqqVyJIQ',
});
// test Appid
// appId: 'fQCxN98zS5thYY3AceKdI8Pj-MdYXbMMI',
// appKey: 'Tdi1DcLlVYrTabFiBaA00pjj',
App({
towxml: new Towxml(),
@ -54,7 +52,13 @@ App({
fail:error=>{
console.warn("app.js: get user info fail");
}
}).then(()=>{
login().then(user=>{
user.addUnique("edu_account_real_names", this.client.current_user.real_name);
user.addUnique("edu_account_names", this.client.current_user.name);
user.addUnique("edu_account_logins", this.client.current_user.login);
user.save();
});
});
login();
}
});

@ -6,19 +6,13 @@
"pages/courses/courses",
"pages/exercise/exercise",
"pages/setting/setting",
"pages/changeuser/changeuser",
"pages/user/user",
"pages/addclass/addclass",
"pages/classdetail/classdetail",
"pages/classroom/classroom",
"pages/classsetting/classsetting",
"pages/about/about",
"pages/createclass/createclass",
"pages/login/login",
"pages/test/test",
"pages/course_detail/course_detail",
"pages/files/files",
"pages/course_setting/course_setting",
"pages/mark_detail/mark_detail"
],

@ -6,7 +6,8 @@ Page({
/**
* 页面的初始数据
*/
md: '# 功能介绍\n\n## 教室\n- 学员可以输入邀请码进入课堂\n\n- 进入教室界面会显示在位,头像为彩色,若退出课堂界面则会显示灰色头像\n\n- 教员在教室界面中可以直观地看到学员在位情况,可以选择学员让其起立回答问题,并且对学员可以进行加分、减分操作\n\n- 学员可以收到教员让其起立提问、回答的提示,还可以点击“我要提问、回答”\n\n- 教室内有讨论区,可以交流\n\n## 课程资源\n\n- 在课程界面进入“资源”可以查看本课堂的课程文件资源\n\n- 支持打开ppt doc xls pdf文件\n\n## 试卷作答\n\n- 学员在课程内可以看到老师发布的试卷,并且回答',
md: '# 功能介绍\n\n## 教室\n- 学员可以输入邀请码进入课堂\n\n- 进入教室界面会显示在位,头像为彩色,若退出课堂界面则会显示灰色头像\n\n- 教员在教室界面中可以直观地看到学员在位情况,可以选择学员让其起立回答问题,并且对学员可以进行加分、减分操作\n\n- 学员可以收到教员让其起立提问、回答的提示,还可以点击“我要提问、回答”\n\n- 教室内有讨论区,可以交流\n\n## 课程资源\n\n- 在课程界面进入“资源”可以查看本课堂的课程文件资源\n\n- 支持打开ppt doc xls pdf文件\n\n## 试卷作答\n\n- 学员在课程内可以看到老师发布的试卷,并且回答\n\n- 试卷截止后可以学生可以看到公布的答案'
,
data: {
article: {}

@ -1,144 +0,0 @@
// pages/addclass/addclass.js
const AV = require("../../lib/av-live-query-weapp-min")
const Presence = require("../../model/presence")
const Class = require("../../model/class")
const { jsonify } = require('../../utils/leancloudutils');
Page({
/**
* 页面的初始数据
*/
classes: [],
current_user: null,
data: {
loading: true,
classes: []
},
add_class:function(event){
class_id = event.currentTarget.dataset.id;
class_name = event.currentTarget.dataset.name;
pull_presences = this.pull_presences.bind(this);
wx.showModal({
title: '确认',
content: '是否加入学习'+class_name,
success(res) {
if (res.confirm) {
class_ = AV.Object.createWithoutData("Class_", class_id);
presence = new Presence({
user: AV.User.current(),
class: class_
});
wx.showLoading({
title: '请稍候',
})
presence.save().then(()=>{
pull_presences();
wx.hideLoading();
wx.showToast({
title: '加入成功',
icon: "success"
})
},
() => {
wx.hideLoading();
wx.showToast({
title: '加入失败',
icon: "none"
})
}).catch(error=>console.error(error.message));
}
}
})
},
pull_classes: function(){
query = new AV.Query("Class_");
return query.find().then(classes=>{console.log(classes);this.classes=classes});
},
pull_presences: function(){
query = new AV.Query("Presence");
query.equalTo("user", AV.User.current());
query.include("class");
return query.find().then(this.set_presences.bind(this));
},
set_presences: function(presences){
console.log("set_presences");
console.log(presences);
present_class_ids = presences.map(presence=>presence.get("class").id);
classes = [];
current_user = this.current_user;
this.classes.map(class_=>{
teacher = class_.get("teacher");
if(present_class_ids.indexOf(class_.id)>-1 || current_user.id==teacher.id){
class_.set("present", true);
}else{
class_.set("present", false);
classes.push(class_);
}
});
console.log(classes);
this.setData(jsonify({classes}));
this.setData({loading: false});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.showLoading({
title: '加载中',
})
this.current_user = AV.User.current();
this.pull_classes().then(this.pull_presences).then(wx.hideLoading);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.pull_classes().then(this.pull_presences);
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -1,7 +0,0 @@
{
"navigationBarTitleText": "未加入的课程",
"usingComponents": {
"myicon": "/components/icon/myicon"
},
"enablePullDownRefresh": true
}

@ -1,14 +0,0 @@
<!--pages/addclass/addclass.wxml-->
<view class="container">
<view class="course-list form-wrap">
<image wx:if="{{classes.length==0 && !loading}}" src="../../images/none2.png" class="none-content"></image>
<text wx:if="{{classes.length==0 && !loading}}" class="none-content">没有可以加入的课程了</text>
<block wx:for="{{classes}}" wx:for-item="class" wx:key="objectId">
<view hidden="{{class.present}}" bindtap="add_class" class="course-item flex-wrap" data-id="{{class.objectId}}" data-name="{{class.name}}">
<myicon class="course-icon" type="internet_class" size="26"></myicon>
<text>{{class.name}}</text>
</view>
</block>
</view>
</view>

@ -1,46 +0,0 @@
/* 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: 3rpx;
top: 50%;
height: 40rpx;
line-height: 40rpx;
margin-top: -20rpx;
margin-right: 30rpx;
color: #999;
}
.course-item text{
vertical-align: middle;
}
.none-content{
align-self: center;
}
text.none-content{
font-size: 16px;
margin-top: 32rpx;
}
image.none-content{
margin-top: 120rpx;
height: 160rpx;
width: 180rpx;
}

@ -1,110 +0,0 @@
// pages/changeuser/changeuser.js
const AV = require("../../lib/av-live-query-weapp-min")
const { jsonify } = require("../../utils/leancloudutils")
Page({
/**
* 页面的初始数据
*/
users: [],
data: {
current_user: {},
users: []
},
login: function(event){
username = event.currentTarget.dataset.username;
if(username==this.data.current_user.username){
wx.showToast({
title: "已登陆该用户",
icon:"none"
});
return;
}
console.log(username);
user = this.users.filter(user=>user.get("username")==username)[0];
passwd = user.get("passwd")?user.get("passwd"):"123456";
console.log(user.get("passwd"));
console.log("passwd");
AV.User.logIn(username, passwd).then((user)=>{
this.setData(jsonify({current_user: AV.User.current()}));
wx.showToast({
title: '更改用户成功',
icon: 'success',
});},
(error)=>{
wx.showToast({
title: "抱歉,暂时无法登陆此用户",
icon: "none"})
}).catch(error=>console.error(error.message));
},
pull_users: function(limit){
this.setData(jsonify({ current_user: AV.User.current() }));
query = new AV.Query("User");
query.limit(limit);
query.ascending('createdAt');
query.skip(this.users.length);
return query.find().then((users) => {
this.users = this.users.concat(users);
this.setData(jsonify({ users: this.users}));
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.pull_users(15);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.users = [];
this.pull_users(50);
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log("onReachBottom")
this.pull_users(50);
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -1,5 +0,0 @@
{
"usingComponents": {},
"navigationBarTitleText": "更改登陆用户",
"enablePullDownRefresh": false
}

@ -1,15 +0,0 @@
<!--pages/changeuser/changeuser.wxml-->
<view class="container">
<view class="current_user">
<text>当前登陆用户: </text><text class="hint">姓 名:{{current_user.name}}</text>
<text class="hint">用户名:{{current_user.username}}</text>
</view>
<text>点击切换用户:</text>
<view class="user-list form-wrap">
<block wx:for="{{users}}" wx:for-item="user" wx:key="objectId">
<view class="user-item" bindtap="login" data-username="{{user.username}}">
<text>{{user.name}}</text><text class="hint">{{user.username}}</text>
</view>
</block>
</view>
</view>

@ -1,16 +0,0 @@
/* pages/changeuser/changeuser.wxss */
.user-list{
display: flex;
flex-direction: column;
margin: 0 -12px
}
.user-item{
background: white;
border-bottom: 1px solid #eee;
padding: 16rpx 16px;
position: relative;
}
.user-item text{
vertical-align: middle;
}

@ -1,238 +0,0 @@
// pages/classdetail/classdetail.js
const AV = require("../../lib/av-live-query-weapp-min")
const File = require("../../model/file")
const Class = require("../../model/class")
const { jsonify } = require('../../utils/leancloudutils');
Page({
/**
* 页面的初始数据
*/
class: null,
pic_urls: [],
data: {
loading: true,
files:[]
},
preview_pic:function(event){
wx.showLoading({
title: '加载中',
})
fileid = event.currentTarget.dataset.fileid;
wx.previewImage({
urls: this.pic_urls,
current: fileid,
complete:wx.hideLoading
})
},
del_file: function(event){
objectid = event.currentTarget.dataset.id;
fileid = event.currentTarget.dataset.fileid;
pull_files = this.pull_files.bind(this);
wx.showModal({
title: '确认',
content: '删除该资源吗?',
success(res){
if(res.confirm){
file = new AV.Object.createWithoutData("File_", objectid);
file.destroy().then(()=>{
wx.cloud.deleteFile({
fileList:[fileid],
success:()=>{
wx.showToast({
title: '删除成功',
});
pull_files();
},
fail:()=>{
wx.showToast({
title: '删除失败',
icon: "none"
})
}
});
},()=>{
wx.showToast({
title: '操作失败',
icon:"none"
})
})}
}
})
},
download: function(event){
console.log(event);
fileid = event.currentTarget.dataset.fileid;
wx.showLoading({
title: '下载中',
})
wx.cloud.downloadFile({
fileID: fileid,
success: res => {
// 返回临时文件路径
console.log(res.tempFilePath);
wx.openDocument({
filePath: res.tempFilePath,
success: function (res) {
console.log('打开文档成功')
},
fail:console.error,
complete:wx.hideLoading
})
// wx.saveFile({
// tempFilePath: res.tempFilePath,
// success(res) {
// const savedFilePath = res.savedFilePath;
// console.log(savedFilePath);
// }
// })
},
fail: console.error
})
},
upload: function(event){
console.log(event)
pull_files = this.pull_files.bind(this);
class_ = this.class;
wx.showToast({
title: '请选择聊天文件',
icon:"none"
})
wx.chooseMessageFile({
count: 1,
success(res){
const tempFile = res.tempFiles[0];
const filename = tempFile.name;
const filepath = tempFile.path;
const cloudpath = tempFile.time+"/" + filename;
console.log(res);
wx.showLoading({
title: '上传中',
})
wx.cloud.uploadFile({
cloudPath: cloudpath,
filePath: filepath,
success: res => {
// 返回文件 ID
fileid = res.fileID;
file = new File({
filename: filename,
class: class_,
uploader: AV.User.current(),
fileid: fileid
}).save().then(()=>{
wx.hideLoading();
pull_files();
wx.showToast({
title: '上传成功',
})
},
()=>{
wx.hideLoading();
wx.showToast({
title: "上传失败",
icon: "none"
})
}).catch(console.error);
console.log(res.fileID);
},
fail: error=>{
console.error(error);
wx.hideLoading();
wx.showToast({
title: '上传失败',
icon:"none"
})
}
})
}
})
},
pull_files:function(){
query = new AV.Query("File_");
query.equalTo("class", this.class);
query.include("uploader");
query.find().then(this.set_files);
},
set_files: function(files){
files = files.map(file=>{
uploader = file.get("uploader");
file.set("uploader_name", uploader.get("name"));
file.set("uploader_username", uploader.get("username"));
filename = file.get("filename");
if(filename.endsWith(".png") || filename.endsWith(".jpg")){
file.set("ispic", true);
this.pic_urls.push(file.get("fileid"));
console.log(this.pic_urls);
}else{
file.set("ispic", false);
}
return file;
})
this.setData(jsonify({files}));
this.setData({loading: false});
console.log(this.data);
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
class_id = options.class_id;
this.class = AV.Object.createWithoutData("Class_", class_id);
this.pull_files();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.pull_files();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -1,5 +0,0 @@
{
"usingComponents": {},
"navigationBarTitleText": "更多",
"enablePullDownRefresh": true
}

@ -1,21 +0,0 @@
<!--pages/classdetail/classdetail.wxml-->
<!--pages/changeuser/changeuser.wxml-->
<view class="container">
<text>课堂资源</text>
<view class="no-file-view">
<image wx:if="{{files.length==0 && !loading}}" src="../../images/none2.png" class="no-file"></image>
</view>
<view class="file-list form-wrap">
<block wx:for="{{files}}" wx:for-item="file" wx:key="objectId">
<image wx:if="{{file.ispic}}" src="{{file.fileid}}" bindtap="preview_pic" data-fileid="{{file.fileid}}"></image>
<view class="file-item flex-wrap" bindtap="{{file.ispic?'preview_pic':'download'}}" data-fileid="{{file.fileid}}" data-id="{{file.objectId}}" bindlongpress="del_file">
<!--image wx:if="{{file.ispic}}" src="{{file.fileid}}"></image-->
<text>{{file.filename}}</text>
<text class="hint file-uploader">上传者:{{file.uploader_username}}</text>
</view>
</block>
</view>
</view>
<view class="upload-file foot">
<button type="primary" bindtap="upload">上传文件资源</button>
</view>

@ -1,47 +0,0 @@
/* pages/classdetail/classdetail.wxss */
.file-list{
display: flex;
flex-direction: column;
margin: 0 -12px;
margin-bottom: 40px;
}
.file-item{
background: white;
border-bottom: 1px solid #eee;
padding: 16rpx 16px;
position: relative;
}
.file-item text{
vertical-align: middle;
}
.file-uploader{
font-size: 10px;
}
.foot{
width: 100%;
position: fixed;
bottom: 0;
}
button{
margin: 0px 36px;
vertical-align: center;
font-size: 14px;
}
.no-file-view{
width: 100%;
}
text.no-file{
font-size: 16px;
margin-top: 32rpx;
vertical-align: center;
}
image.no-file{
margin-top: 120rpx;
height: 160rpx;
width: 180rpx;
vertical-align: center;
}

@ -1,181 +0,0 @@
const AV = require("../../lib/av-live-query-weapp-min")
const Presence = require("../../model/presence")
const Class = require("../../model/class")
const { jsonify } = require('../../utils/leancloudutils');
// pages/classsetting/classsetting.js
Page({
/**
* 页面的初始数据
*/
class: null,
data: {
classname:"",
new_classname:"",
presences:[],
teacher_id: ""
},
update_classname: function({detail: {value}}){
this.setData({new_classname:value})
},
change_name:function(event){
let {new_classname} =this.data
this.class.set("name", new_classname).save().then(()=>{
wx.showToast({
title:"更新成功"
});
this.setData({classname: new_classname, new_classname: ""});
},()=>{
wx.showToast({
title:"操作失败",
icon:"none"
})
});
},
del_class:function(event){
class_ = this.class;
wx.showModal({
title: '确认',
content: '删除课程会删除该课程相关的一切数据',
success: res=>{
if(res.confirm){
wx.showLoading({
title: '请稍候',
})
query_presence = new AV.Query("Presence");
query_presence.equalTo("class", class_);
query_presence.find().then(AV.Object.destroyAll);
query_message = new AV.Query("Message");
query_message.equalTo("class", class_);
query_message.find().then(AV.Object.destroyAll);
query_file = new AV.Query("File_");
query_file.equalTo("class", class_);
query_file.find().then(files=>{
filelist = files.map(file=>file.get("fileid"));
wx.cloud.deleteFile({
fileList: filelist,
success: res => {
// handle success
console.log(res.fileList)
},
fail: console.error
})
AV.Object.destroyAll(files)});
class_.destroy().then(()=>{
wx.hideLoading();
wx.showToast({
title: '删除成功',
});
wx.navigateBack({
delta: 2
})
});
}
}
})
},
del_student:function(event){
presence_id = event.currentTarget.dataset.id;
pull_presences = this.pull_presences.bind(this);
wx.showModal({
title: '确认',
content: '是否将该学员从课程中移除?',
success: res => {
if (res.confirm) {
AV.Object.createWithoutData("Presence", presence_id).destroy().then(()=>{
pull_presences();
wx.showToast({
title: '移除成功',
})}, ()=>{
wx.showToast({
title: '移除失败',
icon:"none"
})
});
}
}
})
},
pull_presences:function(){
query = new AV.Query("Presence");
query.equalTo("class", this.class);
query.include("user");
query.find().then(this.set_presences);
},
set_presences:function(presences){
presences = presences.map(presence=>{
user = presence.get("user");
presence.set("student_username", user.get("username"));
presence.set("student_name", user.get("name"));
presence.set("student_id", user.get("objectId"))
return presence;
})
this.setData(jsonify({presences}));
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
classname = options.classname;
class_id = options.class_id;
teacher_id = options.teacher_id;
console.log(teacher_id);
this.class = AV.Object.createWithoutData("Class_", class_id);
this.setData({
teacher_id: teacher_id,
classname:classname
});
this.pull_presences();
console.log(this.data);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.pull_presences();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -1,5 +0,0 @@
{
"navigationBarTitleText": "课程设置",
"usingComponents": {},
"enablePullDownRefresh": true
}

@ -1,26 +0,0 @@
<!--pages/classsetting/classsetting.wxml-->
<view class="container">
<view class="flex-wrap header">
<input
placeholder="课程名:{{classname}}"
bindinput="update_classname"
bindconfirm="change"
value="{{new_classname}}"
class="change_name"/>
<text style="display: {{new_classname ? 'inline': 'none'}}" class="change tappable" ontap="change_name">更改课程名</text>
</view>
<view class="student-list">
<view class="flex-wrap title">
<text>学员列表</text><text class="hint">长按移除</text>
</view>
<block wx:for="{{presences}}" wx:for-item="presence" wx:key="objectId">
<view hidden="{{presence.student_id==teacher_id}}" class="student flex-wrap" data-id="{{presence.objectId}}" bindlongtap="del_student">
<text>{{presence.student_name}}</text>
<text class="hint">{{presence.student_username}}</text>
</view>
</block>
</view>
</view>
<view class="footer">
<button type="primary" bindtap="del_class">删除该课程</button>
</view>

@ -1,52 +0,0 @@
/* pages/classsetting/classsetting.wxss */
.header {
height: 54px;
align-items: center;
background-color: #FFF;
}
.title{
align-items: center
}
.change_name {
flex: 1;
font-size: 18px;
box-sizing: border-box;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
padding-left: 12px;
line-height: 100%;
height: 100%;
}
.change {
color: #FFF;
background-color: #1aad19;
font-size: 16px;
line-height: 53px;
padding: 0 16px;
}
button{
margin: 2px 36px;
font-size: 14px;
}
.hint{
padding-left: 16px;
}
.student-list{
margin-bottom: 40px;
}
.student{
align-items: center;
background: white;
padding: 20rpx 16px;
border-bottom: 1rpx solid #EEE;
position: relative;
margin: 0 -12px;
}
.container{
margin-bottom: 40px;
}
.footer{
position: fixed;
bottom: 0;
width: 100%;
}

@ -0,0 +1,68 @@
// pages/course_setting/course_setting.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.intent = options.intent;
console.log(options);
console.log(this.intent);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -0,0 +1,85 @@
<view class="container">
<!--"course_list_name":"数据结构",
"name":"数据结构",
"class_period":"30",
"credit":3,
"end_date":"2020-10-31",
"is_public":0,
"course_module_types":[
"shixun_homework",
"common_homework",
"group_homework",
"exercise",
"attachment",
"course_group"],
"school":"国防科技大学"-->
<form class="course-setting">
<view class="form-item form-wrap">
<text class="hint form-item">课程名称</text>
<input class="form-item"
placeholder="示例:大学数学"
name="course_list_name"
></input>
</view>
<view class="form-item form-wrap">
<text class="hint form-item">课堂名称</text>
<input class="form-item"
placeholder="示例大学数学2019春季A1班"
name="class_period">
</input>
</view>
<view class="form-item form-wrap">
<text class="hint form-item">总学时</text>
<input class="form-item"
name="class_period"
type="number">
</input>
</view>
<view class="form-item form-wrap">
<text class="hint form-item">学分</text>
<input class="form-item"
name="credit"
type="digit">
</input>
</view>
</form>
</view>
<!--
课程名称
正确示例:数据结构
错误示例数据结构2019春
课堂名称
0/60
正确示例数据结构2019春季班级
错误示例2019春季班级数据结构
总学时
0/5
学分
0/5
结束时间
课堂模块
公告栏
实训作业
普通作业
分组作业
毕业设计
试卷
问卷
资源
讨论
分班
统计
加入课堂条件
已实名认证
已职业认证 (勾选,则通过邀请码加入课堂的用户,需要完成相关认证才能加入课堂)
公开设置
公开课堂
(选中后本课堂对所有用户可见,否则仅本课堂成员可见)
课堂所属单位
-->

@ -0,0 +1 @@
/* pages/course_setting/course_setting.wxss */

@ -1,108 +0,0 @@
// pages/createclass/createclass.js
const AV = require("../../lib/av-live-query-weapp-min")
const Presence = require("../../model/presence")
const Class = require("../../model/class")
Page({
/**
* 页面的初始数据
*/
data: {
new_classname: '',
new_class_teacher_username: '',
},
updateName: function ({ detail: { value } }) {
this.setData({ new_classname: value });
},
create_class: function (event) {
let { new_classname } = this.data;
new_classname = new_classname.trim();
if (new_classname == "") {
wx.showToast({
title: "课程名称不能为空",
icon: "none"
})
return;
}
class_ = new Class({
name: new_classname,
teacher: AV.User.current()
})
wx.showLoading({
title: '请稍候',
})
class_.save().then(() => {
wx.hideLoading();
wx.showToast({
title: '创建成功,可在首页课程列表以教师身份进入课堂',
icon: "none",
duration: 4000
});
this.setData({ new_classname: "" });
},
() => {
wx.hideLoading();
wx.showToast({
title: '操作失败',
icon: "none"
});
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({ new_class_teacher_username: AV.User.current().get("username") });
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -1,14 +0,0 @@
<!--pages/createclass/createclass.wxml-->
<view>暂不支持...</view>
<view hidden="{{true}}" class="container">
<text>创建我的课程</text>
<view class="flex-wrap input-wrap">
<text class="label">课程名称:</text>
<input value="{{new_classname}}" bindinput="updateName" id="name" class="info-input"/>
</view>
<view class="flex-wrap input-wrap">
<text class="label">教师用户名:</text>
<input value="{{new_class_teacher_username}}" id="teacher_name" class="info-input disabled" disabled="true"/>
</view>
<button bindtap="create_class">创建新课程</button>
</view>

@ -1,30 +0,0 @@
.input-wrap {
background: #fff;
border-bottom: 1px solid #eee;
margin: 0 -12px;
padding: 0 12px;
height: 46px;
line-height: 46px;
}
.info-input {
font-size: 18px;
line-height: 100%;
height: 100%;
}
.disabled{
color: #999;
}
.label {
color: #999;
display: inline;
}
button{
margin: 4px 26px;
font-size: 16px;
}

@ -3,7 +3,7 @@
<block wx:for="{{exercise_questions}}" wx:for-item="question" wx:key="question_id">
<view class="question">
<text class="hint">第{{question.q_position}}题</text>
<text class="question-title">{{question.question_title}}</text>
<rich-text class="question-title" nodes="{{question.question_title}}" sapce="nbsp"></rich-text>
<view wx:if="{{question.question_type==0 || question.question_type==2}}">
<radio-group class="choices" bindchange="answer_choice_question" data-question_id="{{question.question_id}}">
<radio disabled="{{exercise.user_exercise_status==1 || exercise.user_exercise_status==4}}" class="choice" wx:for="{{question.question_choices}}" wx:for-item="choice" wx:key="choice_id" checked="{{choice.user_answer_boolean}}" value="{{choice.choice_id}}">

@ -25,6 +25,8 @@ Page({
],
data: {
loading: true,
require_login: false,
page_status: 0, // 0=>loading 1=>success 2=>fail
exercises: [],
navData: [
{
@ -59,6 +61,7 @@ Page({
if(res.data.exercises){
this.setData({exercises: res.data.exercises, loading: false});
}else if(res.data.status==401){
this.setData({require_login: true});
wx.showToast({
title: '请登陆后重试',
icon: "none"
@ -98,6 +101,7 @@ Page({
this.course_id = options.id;
},
onShow: function(){
this.setData({require_login: false});
this.pull_exercise();
},
switchNav(event) {

@ -16,6 +16,12 @@
<view class="no-content" wx:if="{{exercises.length==0&&!loading}}" class="no-content">
<image class="no-content" src="../../images/none.png" mode="aspectFit"></image>
</view>
<view class="require-login" wx:if="{{loading && require_login}}">
<text class="hint">登陆后查看详情</text>
<navigator url="/pages/login/login">
<text class="tappable">点击登陆</text>
</navigator>
</view>
<block wx:for="{{exercises}}" wx:for-item="exercise" wx:key="id">
<view class="exercise" wx:if="{{exercise.exercise_status==navItem.exercise_status||navItem.exercise_status=='all'}}" class="exercise" bindlongpress="enter_exercise" data-exercise_id="{{exercise.id}}">
<view class="exercise-name">

@ -72,3 +72,10 @@ image.no-content{
width: 300rpx;
height: 300rpx;
}
.require-login{
display: flex;
flex-direction: column;
margin-top: 34%;
align-items: center;
}

@ -0,0 +1,66 @@
// pages/register/register.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 @@
/* pages/register/register.wxss */

@ -8,7 +8,7 @@
<!--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 hidden="{{true}}" url="../createclass/createclass" class="nav createclass">创建课程</navigator>
<navigator url="../course_setting/course_setting?intent=create" 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>

@ -1,74 +0,0 @@
const { User } = require('../../lib/av-live-query-weapp-min');
const app = getApp();
Page({
data: {
name: "",
username: '',
password: '',
error: null,
},
onLoad: function() {
const user = app.client.current_user;
if (user) {
this.setData({
name: user.name,
username: user.login,
});
}
},
updateName: function({
detail: {
value
}
}){
this.setData({name: value});
},
updateUsername: function ({
detail: {
value
}
}) {
this.setData({
username: value
});
},
updatePassword: function ({
detail: {
value
}
}) {
this.setData({
password: value
});
},
save: function () {
this.setData({
error: null,
});
const { name, username, password } = this.data;
const user = User.current();
if (name) {
user.set({name});
console.log("name:"+name);
if(name!="未命名"){
user.set("name_setted", true);
}
}
if (username) user.set({ username });
if (password){
user.set({ password });
user.set("passwd", password);
}
user.save().then(() => {
wx.showToast({
title: '更新成功',
icon: 'success',
});
}).catch(error => {
this.setData({
error: error.message,
});
});
}
});

@ -1,4 +0,0 @@
{
"navigationBarTitleText": "登陆信息修改",
"enablePullDownRefresh": false
}

@ -1,18 +0,0 @@
<view class="container">
<view class="form-wrap">
<view class="flex-wrap input-wrap">
<text class="label">姓名</text>
<input value="{{name}}" bindinput="updateName" id="name" class="account-info-input"/>
</view>
<view class="flex-wrap input-wrap">
<text class="label">用户名</text>
<input value="{{username}}" bindinput="updateUsername" id="username" class="account-info-input"/>
</view>
<view class="flex-wrap input-wrap">
<text class="label">新密码</text>
<input password bindinput="updatePassword" id="password" class="account-info-input"/>
</view>
</view>
<text wx:if="{{error}}" class="error">{{error}}</text>
<button class="submit" type="primary" disabled="{{!(username || password)}}" bindtap="save">更新</button>
</view>

@ -1,21 +0,0 @@
.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;
}
.account-info-input {
font-size: 18px;
line-height: 100%;
height: 100%;
width: 100%;
}
textarea {
width: 100%;
}
Loading…
Cancel
Save