diff --git a/README.md b/README.md index 55931de..d28ed1a 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,6 @@ ## 试卷作答 -- 学员在课程内可以看到老师发布的试卷,并且回答 \ No newline at end of file +- 学员在课程内可以看到老师发布的试卷,并且回答 + +- 试卷截止后可以学生可以看到公布的答案 \ No newline at end of file diff --git a/app.js b/app.js index 1fd4262..eba7a07 100644 --- a/app.js +++ b/app.js @@ -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(); } }); \ No newline at end of file diff --git a/app.json b/app.json index 054ac0c..e16e742 100644 --- a/app.json +++ b/app.json @@ -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" ], diff --git a/pages/about/about.js b/pages/about/about.js index fb33282..952d727 100644 --- a/pages/about/about.js +++ b/pages/about/about.js @@ -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: {} diff --git a/pages/addclass/addclass.js b/pages/addclass/addclass.js deleted file mode 100644 index 57fb704..0000000 --- a/pages/addclass/addclass.js +++ /dev/null @@ -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 () { - - } -}) \ No newline at end of file diff --git a/pages/addclass/addclass.json b/pages/addclass/addclass.json deleted file mode 100644 index c9282c8..0000000 --- a/pages/addclass/addclass.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "navigationBarTitleText": "未加入的课程", - "usingComponents": { - "myicon": "/components/icon/myicon" - }, - "enablePullDownRefresh": true -} \ No newline at end of file diff --git a/pages/addclass/addclass.wxml b/pages/addclass/addclass.wxml deleted file mode 100644 index dec8741..0000000 --- a/pages/addclass/addclass.wxml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - 没有可以加入的课程了 - - - - - \ No newline at end of file diff --git a/pages/addclass/addclass.wxss b/pages/addclass/addclass.wxss deleted file mode 100644 index e0f8d60..0000000 --- a/pages/addclass/addclass.wxss +++ /dev/null @@ -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; -} diff --git a/pages/changeuser/changeuser.js b/pages/changeuser/changeuser.js deleted file mode 100644 index cd2226f..0000000 --- a/pages/changeuser/changeuser.js +++ /dev/null @@ -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 () { - - } -}) \ No newline at end of file diff --git a/pages/changeuser/changeuser.json b/pages/changeuser/changeuser.json deleted file mode 100644 index ed511b2..0000000 --- a/pages/changeuser/changeuser.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "usingComponents": {}, - "navigationBarTitleText": "更改登陆用户", - "enablePullDownRefresh": false -} \ No newline at end of file diff --git a/pages/changeuser/changeuser.wxml b/pages/changeuser/changeuser.wxml deleted file mode 100644 index e2d4d41..0000000 --- a/pages/changeuser/changeuser.wxml +++ /dev/null @@ -1,15 +0,0 @@ - - - - 当前登陆用户: 姓 名:{{current_user.name}} - 用户名:{{current_user.username}} - - 点击切换用户: - - - - {{user.name}}{{user.username}} - - - - diff --git a/pages/changeuser/changeuser.wxss b/pages/changeuser/changeuser.wxss deleted file mode 100644 index b10a823..0000000 --- a/pages/changeuser/changeuser.wxss +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/pages/classdetail/classdetail.js b/pages/classdetail/classdetail.js deleted file mode 100644 index a9ff2d6..0000000 --- a/pages/classdetail/classdetail.js +++ /dev/null @@ -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 () { - - } -}) \ No newline at end of file diff --git a/pages/classdetail/classdetail.json b/pages/classdetail/classdetail.json deleted file mode 100644 index 0251ffe..0000000 --- a/pages/classdetail/classdetail.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "usingComponents": {}, - "navigationBarTitleText": "更多", - "enablePullDownRefresh": true -} \ No newline at end of file diff --git a/pages/classdetail/classdetail.wxml b/pages/classdetail/classdetail.wxml deleted file mode 100644 index d85075f..0000000 --- a/pages/classdetail/classdetail.wxml +++ /dev/null @@ -1,21 +0,0 @@ - - - - 课堂资源 - - - - - - - - - {{file.filename}} - 上传者:{{file.uploader_username}} - - - - - - - diff --git a/pages/classdetail/classdetail.wxss b/pages/classdetail/classdetail.wxss deleted file mode 100644 index 82cc1e7..0000000 --- a/pages/classdetail/classdetail.wxss +++ /dev/null @@ -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; -} diff --git a/pages/classsetting/classsetting.js b/pages/classsetting/classsetting.js deleted file mode 100644 index b5aa4b3..0000000 --- a/pages/classsetting/classsetting.js +++ /dev/null @@ -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 () { - - } -}) \ No newline at end of file diff --git a/pages/classsetting/classsetting.json b/pages/classsetting/classsetting.json deleted file mode 100644 index ebd09dc..0000000 --- a/pages/classsetting/classsetting.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "navigationBarTitleText": "课程设置", - "usingComponents": {}, - "enablePullDownRefresh": true -} \ No newline at end of file diff --git a/pages/classsetting/classsetting.wxml b/pages/classsetting/classsetting.wxml deleted file mode 100644 index be0b548..0000000 --- a/pages/classsetting/classsetting.wxml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - 更改课程名 - - - - 学员列表长按移除 - - - - - - - - - \ No newline at end of file diff --git a/pages/classsetting/classsetting.wxss b/pages/classsetting/classsetting.wxss deleted file mode 100644 index f37cc36..0000000 --- a/pages/classsetting/classsetting.wxss +++ /dev/null @@ -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%; -} \ No newline at end of file diff --git a/pages/course_setting/course_setting.js b/pages/course_setting/course_setting.js new file mode 100644 index 0000000..2143c6c --- /dev/null +++ b/pages/course_setting/course_setting.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/pages/createclass/createclass.json b/pages/course_setting/course_setting.json similarity index 100% rename from pages/createclass/createclass.json rename to pages/course_setting/course_setting.json diff --git a/pages/course_setting/course_setting.wxml b/pages/course_setting/course_setting.wxml new file mode 100644 index 0000000..a948cfc --- /dev/null +++ b/pages/course_setting/course_setting.wxml @@ -0,0 +1,85 @@ + + +
+ + 课程名称 + + + + 课堂名称 + + + + + 总学时 + + + + + 学分 + + + +
+ +
+ + \ No newline at end of file diff --git a/pages/course_setting/course_setting.wxss b/pages/course_setting/course_setting.wxss new file mode 100644 index 0000000..f7bec2c --- /dev/null +++ b/pages/course_setting/course_setting.wxss @@ -0,0 +1 @@ +/* pages/course_setting/course_setting.wxss */ \ No newline at end of file diff --git a/pages/createclass/createclass.js b/pages/createclass/createclass.js deleted file mode 100644 index 9c07459..0000000 --- a/pages/createclass/createclass.js +++ /dev/null @@ -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 () { - - } -}) \ No newline at end of file diff --git a/pages/createclass/createclass.wxml b/pages/createclass/createclass.wxml deleted file mode 100644 index 44a524a..0000000 --- a/pages/createclass/createclass.wxml +++ /dev/null @@ -1,14 +0,0 @@ - -暂不支持... - \ No newline at end of file diff --git a/pages/createclass/createclass.wxss b/pages/createclass/createclass.wxss deleted file mode 100644 index 9529f2b..0000000 --- a/pages/createclass/createclass.wxss +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/pages/exercise/exercise.wxml b/pages/exercise/exercise.wxml index f0a8e54..f839f09 100644 --- a/pages/exercise/exercise.wxml +++ b/pages/exercise/exercise.wxml @@ -3,7 +3,7 @@ 第{{question.q_position}}题 - {{question.question_title}} + diff --git a/pages/exercises/exercises.js b/pages/exercises/exercises.js index 72497d8..37c4b44 100644 --- a/pages/exercises/exercises.js +++ b/pages/exercises/exercises.js @@ -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) { diff --git a/pages/exercises/exercises.wxml b/pages/exercises/exercises.wxml index f13d129..ae435a5 100644 --- a/pages/exercises/exercises.wxml +++ b/pages/exercises/exercises.wxml @@ -16,6 +16,12 @@ + diff --git a/pages/exercises/exercises.wxss b/pages/exercises/exercises.wxss index 22b8fac..d930af1 100644 --- a/pages/exercises/exercises.wxss +++ b/pages/exercises/exercises.wxss @@ -71,4 +71,11 @@ view.no-content{ image.no-content{ width: 300rpx; height: 300rpx; +} + +.require-login{ + display: flex; + flex-direction: column; + margin-top: 34%; + align-items: center; } \ No newline at end of file diff --git a/pages/register/register.js b/pages/register/register.js new file mode 100644 index 0000000..1513315 --- /dev/null +++ b/pages/register/register.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/pages/register/register.json b/pages/register/register.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/register/register.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/register/register.wxml b/pages/register/register.wxml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pages/register/register.wxml @@ -0,0 +1 @@ + diff --git a/pages/register/register.wxss b/pages/register/register.wxss new file mode 100644 index 0000000..cb8065a --- /dev/null +++ b/pages/register/register.wxss @@ -0,0 +1 @@ +/* pages/register/register.wxss */ \ No newline at end of file diff --git a/pages/setting/setting.wxml b/pages/setting/setting.wxml index f0dc689..18bc2ff 100644 --- a/pages/setting/setting.wxml +++ b/pages/setting/setting.wxml @@ -8,7 +8,7 @@ 加入课程 - + 创建课程 关于 diff --git a/pages/user/user.js b/pages/user/user.js deleted file mode 100644 index 9574ae8..0000000 --- a/pages/user/user.js +++ /dev/null @@ -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, - }); - }); - } -}); \ No newline at end of file diff --git a/pages/user/user.json b/pages/user/user.json deleted file mode 100644 index cc73869..0000000 --- a/pages/user/user.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "navigationBarTitleText": "登陆信息修改", - "enablePullDownRefresh": false -} diff --git a/pages/user/user.wxml b/pages/user/user.wxml deleted file mode 100644 index 18db8b9..0000000 --- a/pages/user/user.wxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - 姓名 - - - - 用户名 - - - - 新密码 - - - - {{error}} - - diff --git a/pages/user/user.wxss b/pages/user/user.wxss deleted file mode 100644 index c8a3965..0000000 --- a/pages/user/user.wxss +++ /dev/null @@ -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%; -} \ No newline at end of file