diff --git a/.gitignore b/.gitignore index a5b0a74..6287089 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ api_docs/ .idea/ +.wechatide/ res/ docs/ pandocs diff --git a/changelog.md b/changelog.md index ac2800b..52767a2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +## v0.15.0 + * A 实训关卡黑暗模式 + * A 学生管理模块 + * A 教师管理模块 + ## v0.14.5 * A 接入内容安全接口 * A 添加EduCoder云网推荐链接 diff --git a/miniprogram/account/pages/change_password/change_password.wxml b/miniprogram/account/pages/change_password/change_password.wxml index b9a8e61..8efbcee 100644 --- a/miniprogram/account/pages/change_password/change_password.wxml +++ b/miniprogram/account/pages/change_password/change_password.wxml @@ -1,7 +1,7 @@
- + diff --git a/miniprogram/account/pages/profile/school_select/school_select.wxss b/miniprogram/account/pages/profile/school_select/school_select.wxss index 3e095e2..0ddd571 100644 --- a/miniprogram/account/pages/profile/school_select/school_select.wxss +++ b/miniprogram/account/pages/profile/school_select/school_select.wxss @@ -30,5 +30,5 @@ height: 1px; } .school-wrap{ - margin-bottom: 1.2px; + margin-bottom: 1px; } \ No newline at end of file diff --git a/miniprogram/components/modal/join-course/join-course.js b/miniprogram/components/modal/join-course/join-course.js index 5ecce11..8f82d5e 100644 --- a/miniprogram/components/modal/join-course/join-course.js +++ b/miniprogram/components/modal/join-course/join-course.js @@ -11,7 +11,7 @@ Component({ success:res=>{ if(!res.data||res.data==this.clipboardData) return; this.clipboardData = res.data; - var match = res.data.match(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Z]{5,6}$/); + var match = res.data.match(/(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Z]{5,6}/); if(match) this.setData({invite_code: match[0]}); } @@ -93,7 +93,7 @@ Component({ }) }, cancel() { - this.setData({ hidden: true }); + this.setData({ hidden: true,invite_code:'', assistant_professor:0, student:0, assistant_professor:0 }); }, onTapButton({detail:{index}}){ if(index==0) diff --git a/miniprogram/components/rich-md/rich-md.js b/miniprogram/components/rich-md/rich-md.js index 6699aba..a486b61 100644 --- a/miniprogram/components/rich-md/rich-md.js +++ b/miniprogram/components/rich-md/rich-md.js @@ -7,7 +7,7 @@ Component({ nodes:{ type:String, observer:function(nodes){ - this.process(nodes); + this.process(); } }, datakey:{ @@ -26,7 +26,12 @@ Component({ }, theme:{ type:String, - value:"light" + value:"light", + observer:function(theme,old){ + let {type} = this.data; + if(this.ready&&theme!=old&&(type=='html'||type=='markdown')) + this.process(); + } }, base:{ type:String, @@ -51,7 +56,7 @@ Component({ if(data&&data._e.tag=="code") data={attr:{class:"h2w__pre"},child:[data],tag:"view",type:"tag",_e:{type:"tag",attr:{},tag:"pre", child:[data]}} if(data&&data._e.tag=='pre'){ - data = {theme:"light",child:[data],_e:{child:[data]}} + data = {theme:this.data.theme,child:[data],_e:{child:[data]}} wx.setStorage({ key,data,success:res=>{ wx.navigateTo({ @@ -69,8 +74,8 @@ Component({ * 该程序接收用户的`4`个输入$$x_1$$,$$y_1$$,$$x_2$$,$$y_2$$(分别表示地球上两个点的维度和经度,单位是度) * 计算公式为:$$r^{3}=\\frac{dp}{\\pi S}$$,其中 */ - process(nodes){ - let {type} = this.data; + process(){ + let {type, nodes} = this.data; //console.log(type); if(!type){ if (nodes.match(//)) @@ -98,6 +103,7 @@ Component({ }else{ this.setData({nodes, type}) } + this.ready = true; } } }) diff --git a/miniprogram/config.js b/miniprogram/config.js index 76c1c11..22ab99f 100644 --- a/miniprogram/config.js +++ b/miniprogram/config.js @@ -5,7 +5,7 @@ const developUrl = "https://test-newweb.educoder.net"; const trialUrl = "https://pre-newweb.educoder.net"; const releaseUrl = "https://www.educoder.net"; -let _version = "0.14.5"; +let _version = "0.15.0"; var eduUrl = releaseUrl; /** */ diff --git a/miniprogram/course/components/index-list/index-list.js b/miniprogram/course/components/index-list/index-list.js new file mode 100644 index 0000000..218e7d6 --- /dev/null +++ b/miniprogram/course/components/index-list/index-list.js @@ -0,0 +1,153 @@ + +var throttle = function throttle(func, wait, options) { + var context = void 0; + var args = void 0; + var result = void 0; + var timeout = null; + var previous = 0; + if (!options) options = {}; + var later = function later() { + previous = options.leading === false ? 0 : Date.now(); + timeout = null; + result = func.apply(context, args); + if (!timeout) context = args = null; + }; + return function () { + var now = Date.now(); + if (!previous && options.leading === false) previous = now; + var remaining = wait - (now - previous); + context = this; + args = arguments; + if (remaining <= 0 || remaining > wait) { + clearTimeout(timeout); + timeout = null; + previous = now; + result = func.apply(context, args); + if (!timeout) context = args = null; + } else if (!timeout && options.trailing !== false) { + timeout = setTimeout(later, remaining); + } + return result; + }; +}; +Component({ + options: { + addGlobalClass: true, + pureDataPattern: /^_/ + }, + properties: { + list: { + type: Array, + value: [], + observer: function observer(newVal) { + var _this = this; + + if (newVal.length === 0) return; + var data = this.data; + var alphabet = data.list.map(function (item) { + return item.letter; + }); + alphabet.unshift("↑"); + this.setData({ + alphabet: alphabet, + current: alphabet[0] + }, function () { + _this.computedSize(); + }); + } + }, + ext:{ + type:Object + }, + vibrated: { + type: Boolean, + value: true + } + }, + data: { + current: 'A', + intoView: '', + touching: false, + alphabet: [], + _tops: [], + _anchorItemH: 0, + _anchorTop: 0 + }, + lifetimes: { + created: function created() {}, + attached: function attached() { + this.__scrollTo = throttle(this._scrollTo, 100, {}); + this.__onScroll = throttle(this._onScroll, 100, {}); + } + }, + methods: { + choose: function choose(e) { + console.log("choose",e); + var item = e.target.dataset.item; + this.triggerEvent('choose', { item: item }); + }, + scrollTo: function scrollTo(e) { + this.__scrollTo(e); + }, + _scrollTo: function _scrollTo(e) { + var data = this.data; + var clientY = e.changedTouches[0].clientY; + console.log(clientY); + var index = Math.floor((clientY - data._anchorTop) / data._anchorItemH); + if(index<0||index>=data.alphabet.length) + return; + var current = data.alphabet[index]; + if(current=='↑') + this.setData({current, scrollTop:0, touching:true}); + else + this.setData({ current: current, intoView: current=='#'?'hash':current, touching: true }); + if (data.vibrated) wx.vibrateShort(); + }, + computedSize: function computedSize() { + var data = this.data; + var query = this.createSelectorQuery(); + query.selectAll('.index_list_item').boundingClientRect(); + query.select(".top-view").boundingClientRect(); + query.select('.anchor-list').boundingClientRect(function (rect) { + data._anchorItemH = rect.height / data.alphabet.length; + data._anchorTop = rect.top; + //console.log("select anchor list"); + }); + query.exec(res=>{ + data._tops = res[0].map(function (item) { + return item.top-res[1].top; + }); + //console.log(res); + }); + }, + removeTouching: function removeTouching() { + var _this2 = this; + + setTimeout(function () { + _this2.setData({ touching: false }); + }, 150); + }, + onScroll: function onScroll(e) { + this.__onScroll(e); + }, + _onScroll: function _onScroll(e) { + var data = this.data; + var _tops = data._tops, + alphabet = data.alphabet; + //console.log("scroll", e.detail, this.data); + var pageTop = e.detail.scrollTop; + var current = ''; + if (pageTop < _tops[0]) { + current = alphabet[0]; + } else { + for (var i = 0, len = _tops.length; i < len - 1; i++) { + if (pageTop >= _tops[i] && pageTop < _tops[i + 1]) { + current = alphabet[i+1]; + } + } + } + if (!current) current = alphabet[alphabet.length - 1]; + this.setData({ current: current }); + } + } +}); \ No newline at end of file diff --git a/miniprogram/course/components/index-list/index-list.json b/miniprogram/course/components/index-list/index-list.json new file mode 100644 index 0000000..414ebbd --- /dev/null +++ b/miniprogram/course/components/index-list/index-list.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": {}, + "componentGenerics": { + "item": true + } +} \ No newline at end of file diff --git a/miniprogram/course/components/index-list/index-list.wxml b/miniprogram/course/components/index-list/index-list.wxml new file mode 100644 index 0000000..9cdf010 --- /dev/null +++ b/miniprogram/course/components/index-list/index-list.wxml @@ -0,0 +1,40 @@ + + + + + + {{item.letter}} + + + + + + + + + + + + + {{alpha}} + {{alpha}} + + + + + \ No newline at end of file diff --git a/miniprogram/course/components/index-list/index-list.wxss b/miniprogram/course/components/index-list/index-list.wxss new file mode 100644 index 0000000..ae2beb8 --- /dev/null +++ b/miniprogram/course/components/index-list/index-list.wxss @@ -0,0 +1,81 @@ +.page-select-index{ + height: 100%; +} + +.wx-flex { + display: flex; + align-items: center +} + +.wx-flex__item { + flex: 1 +} + + +.index-group__title { + padding: 12rpx 24rpx; + background: #f0f0f0; +} + +.anchor-bar__wrp { + position: fixed; + right: 0; + width: 60rpx; + z-index: 999; + top:50%; + transform: translateY(-50%); +} + +.anchor-item { + font-size: 0; + text-align: center; + position: relative +} + +.anchor-item__inner { + line-height: 28rpx; + height: 28rpx; + width: 28rpx; + border-radius: 50%; + display: inline-block; + font-size: 20rpx; + margin: 2rpx 0; + font-weight: 500 +} + +.tapped .anchor-item__pop { + display: block +} + +.anchor-item__pop { + position: absolute; + font-size: 64rpx; + width: 100rpx; + height: 100rpx; + line-height: 100rpx; + color: #fff; + background-color: #C9C9C9; + border-radius: 50%; + right: 80rpx; + top: 50%; + transform: translateY(-50%); + display: none +} + +.anchor-item__pop:after { + content: ""; + display: block; + position: absolute; + width: 0; + height: 0; + left: 80rpx; + border: 40rpx solid; + border-color: transparent transparent transparent #C9C9C9; + top: 50%; + transform: translateY(-50%) +} + +.anchor-item.selected .anchor-item__inner { + color: #fff; + background-color: #00b0f0 +} \ No newline at end of file diff --git a/miniprogram/course/components/muti-progress/muti-progress.js b/miniprogram/course/components/muti-progress/muti-progress.js index 733aa0a..77c6c10 100644 --- a/miniprogram/course/components/muti-progress/muti-progress.js +++ b/miniprogram/course/components/muti-progress/muti-progress.js @@ -26,7 +26,7 @@ Component({ }, attached(){ this.setData({data:JSON.stringify(this.data)}); - console.log(this.data); + //console.log(this.data); }, methods: { diff --git a/miniprogram/course/images/svg/students.svg b/miniprogram/course/images/svg/students.svg new file mode 100644 index 0000000..c99a941 --- /dev/null +++ b/miniprogram/course/images/svg/students.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/course/images/svg/students_select.svg b/miniprogram/course/images/svg/students_select.svg new file mode 100644 index 0000000..2ac55ec --- /dev/null +++ b/miniprogram/course/images/svg/students_select.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/course/images/svg/teachers.svg b/miniprogram/course/images/svg/teachers.svg new file mode 100644 index 0000000..bd4bd68 --- /dev/null +++ b/miniprogram/course/images/svg/teachers.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/course/images/svg/teachers_select.svg b/miniprogram/course/images/svg/teachers_select.svg new file mode 100644 index 0000000..8a086a9 --- /dev/null +++ b/miniprogram/course/images/svg/teachers_select.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/course/modules/attendance/attendance-item/attendance-item.wxml b/miniprogram/course/modules/attendance/attendance-item/attendance-item.wxml index aa2d1f6..7d8fa3b 100644 --- a/miniprogram/course/modules/attendance/attendance-item/attendance-item.wxml +++ b/miniprogram/course/modules/attendance/attendance-item/attendance-item.wxml @@ -4,7 +4,7 @@ - 已签到:{{data.normal_count}}/{{data.all_count}} + 已签到:{{data.normal_count}}/{{data.all_count}} 签到时间:{{data.start_time}}-{{data.end_time}} diff --git a/miniprogram/course/modules/attendance/attendance-item/attendance-item.wxss b/miniprogram/course/modules/attendance/attendance-item/attendance-item.wxss index d887af2..e44eb02 100644 --- a/miniprogram/course/modules/attendance/attendance-item/attendance-item.wxss +++ b/miniprogram/course/modules/attendance/attendance-item/attendance-item.wxss @@ -14,7 +14,7 @@ .attendance-button{ margin: 0; } -progress{ +.progress{ margin: 4px 0; } .percent-text{ diff --git a/miniprogram/course/modules/exercise/exercise_item/exercise_item.wxml b/miniprogram/course/modules/exercise/exercise_item/exercise_item.wxml index c12f372..db933fb 100644 --- a/miniprogram/course/modules/exercise/exercise_item/exercise_item.wxml +++ b/miniprogram/course/modules/exercise/exercise_item/exercise_item.wxml @@ -3,9 +3,13 @@ {{data.exercise_name}}{{item}} - 还剩{{data.exercise_left_time}}截止 + 发布人:{{data.author}} + 剩余时间:{{data.exercise_left_time}} - 完成:{{data.exercise_answer}}/{{data.exercise_answer+data.exercise_unanswer}} + + 提交:{{data.exercise_answer}}/{{data.exercise_answer+data.exercise_unanswer+data.exercise_answerings}} + 考试中:{{data.exercise_answerings}} + \ No newline at end of file diff --git a/miniprogram/course/modules/exercise/exercise_item/exercise_item.wxss b/miniprogram/course/modules/exercise/exercise_item/exercise_item.wxss index c32c7c3..50af311 100644 --- a/miniprogram/course/modules/exercise/exercise_item/exercise_item.wxss +++ b/miniprogram/course/modules/exercise/exercise_item/exercise_item.wxss @@ -7,10 +7,13 @@ .title{ font-weight: bold; } -.left-time{ +.status{ font-size: 12px; color: gray; } +.author{ + margin-right: 12px; +} .tip{ font-size: 12px; border-radius: 36px; diff --git a/miniprogram/course/modules/students/student-item/student-item.js b/miniprogram/course/modules/students/student-item/student-item.js new file mode 100644 index 0000000..af02083 --- /dev/null +++ b/miniprogram/course/modules/students/student-item/student-item.js @@ -0,0 +1,43 @@ +const app = getApp(); +Component({ + properties: { + data:Object, + ext:Object + }, + + data: { + eduImgDir: global.config.eduImgDir, + buttons:[{text:"删除", type:"warn"}] + }, + + methods: { + delete(){ + let {course_id} = this.data.ext; + let {course_member_id} = this.data.data; + //console.log(course_id, course_member_id); + let students = [{course_member_id}]; + app.api("courses.delete_from_course")({course_id,students}) + .then(res=>{ + this.triggerEvent("delete",{},{bubbles:true,composed:true}); + //console.log(res); + //res.message='删除成功'; + app.showMsg(res); + }).catch(e=>{ + app.showError(e); + }) + }, + onButtonTap(e){ + //console.log(e,this.data); + wx.showModal({ + title:"提示", + content:"确认删除所选学生吗?", + success:res=>{ + if(res.confirm){ + this.delete(); + } + } + }) + + } + } +}) diff --git a/miniprogram/course/modules/students/student-item/student-item.json b/miniprogram/course/modules/students/student-item/student-item.json new file mode 100644 index 0000000..cbf84d2 --- /dev/null +++ b/miniprogram/course/modules/students/student-item/student-item.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "mp-slideview": "/weui-miniprogram/slideview/slideview" + } +} \ No newline at end of file diff --git a/miniprogram/course/modules/students/student-item/student-item.wxml b/miniprogram/course/modules/students/student-item/student-item.wxml new file mode 100644 index 0000000..78ee377 --- /dev/null +++ b/miniprogram/course/modules/students/student-item/student-item.wxml @@ -0,0 +1,9 @@ + + + + + {{data.name}} + 学号:{{data.student_id}} + + + \ No newline at end of file diff --git a/miniprogram/course/modules/students/student-item/student-item.wxss b/miniprogram/course/modules/students/student-item/student-item.wxss new file mode 100644 index 0000000..21da322 --- /dev/null +++ b/miniprogram/course/modules/students/student-item/student-item.wxss @@ -0,0 +1,40 @@ +.student{ + padding: 12px; + display: flex; + background: white; +} +.thin-border-bottom { + position: relative +} + +.thin-border-bottom::after { + content: ""; + position: absolute; + left: 0; + bottom: 0; + right: 0; + height: 1px; + border-bottom: 1px solid #EAEAEA; + color: #e5e5e5; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + -webkit-transform: scaleY(.5); + transform: scaleY(.5); + z-index: 2 +} + +.student.thin-border-bottom::after{ + left: 60px; +} +.detail{ + margin-left: 12px; +} +.avatar{ + border-radius: 50%; + width: 45px; + height: 45px; +} +.student-id{ + color: dimgray; + font-size: 14px; +} \ No newline at end of file diff --git a/miniprogram/course/modules/students/students.js b/miniprogram/course/modules/students/students.js new file mode 100644 index 0000000..3fbc133 --- /dev/null +++ b/miniprogram/course/modules/students/students.js @@ -0,0 +1,42 @@ +const app = getApp(); +Component({ + properties: { + course_id: Number, + id_: Number, + course_identity:Number, + refresh: { + type: Number, + observer: function (r) { + if (r) { + console.log("observer refresh") + this.refresh(); + this.setData({ refresh: false }); + } + } + } + }, + + data: { + + }, + attached(){ + let {course_id, course_identity} = this.data; + let ext = {course_id, course_identity}; + this.setData({ext}); + this.refresh(); + }, + + methods: { + onChoose(e){ + console.log(e); + }, + refresh(){ + let {course_id} = this.data; + app.api("weapps.courses.students")({course_id,limit:1000}).then(res=>{ + console.log(res); + let {students,students_count} = res; + this.setData({students,students_count}); + }) + } + } +}) diff --git a/miniprogram/course/modules/students/students.json b/miniprogram/course/modules/students/students.json new file mode 100644 index 0000000..1fc8cfc --- /dev/null +++ b/miniprogram/course/modules/students/students.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "mp-index-list":"../../components/index-list/index-list", + "student-item":"./student-item/student-item" + } +} \ No newline at end of file diff --git a/miniprogram/course/modules/students/students.wxml b/miniprogram/course/modules/students/students.wxml new file mode 100644 index 0000000..f274c7b --- /dev/null +++ b/miniprogram/course/modules/students/students.wxml @@ -0,0 +1,12 @@ + + + + 学生人数: + {{students_count}} + + + + + + + diff --git a/miniprogram/course/modules/students/students.wxss b/miniprogram/course/modules/students/students.wxss new file mode 100644 index 0000000..28418f2 --- /dev/null +++ b/miniprogram/course/modules/students/students.wxss @@ -0,0 +1,14 @@ +.student-list-wrap{ + flex:auto; +} + +.header{ + background: white; + padding: 12px; + display: flex; + justify-content: space-between; + align-items: center; +} +.invite-button{ + margin: 0; +} \ No newline at end of file diff --git a/miniprogram/course/modules/teachers/teacher-item/teacher-item.js b/miniprogram/course/modules/teachers/teacher-item/teacher-item.js new file mode 100644 index 0000000..74b98f5 --- /dev/null +++ b/miniprogram/course/modules/teachers/teacher-item/teacher-item.js @@ -0,0 +1,31 @@ +const app = getApp(); +Component({ + properties: { + data:Object, + ext:Object + }, + + data: { + eduImgDir: global.config.eduImgDir, + buttons:[{text:"删除", type:"warn"}] + }, + + methods: { + delete(e){ + console.log(e,this.data); + let {course_id} = this.data.ext; + let {course_member_id} = this.data.data; + console.log(course_id, course_member_id); + let students = [{course_member_id}]; + app.api("courses.delete_from_course")({course_id,students}) + .then(res=>{ + this.triggerEvent("delete",{},{bubbles:true,composed:true}); + //console.log(res); + //res.message='删除成功'; + app.showMsg(res); + }).catch(e=>{ + app.showError(e); + }) + } + } +}) diff --git a/miniprogram/course/modules/teachers/teacher-item/teacher-item.json b/miniprogram/course/modules/teachers/teacher-item/teacher-item.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/course/modules/teachers/teacher-item/teacher-item.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/course/modules/teachers/teacher-item/teacher-item.wxml b/miniprogram/course/modules/teachers/teacher-item/teacher-item.wxml new file mode 100644 index 0000000..313ba8b --- /dev/null +++ b/miniprogram/course/modules/teachers/teacher-item/teacher-item.wxml @@ -0,0 +1,7 @@ + + + + {{data.name}} + {{data.school}} + + \ No newline at end of file diff --git a/miniprogram/course/modules/teachers/teacher-item/teacher-item.wxss b/miniprogram/course/modules/teachers/teacher-item/teacher-item.wxss new file mode 100644 index 0000000..6883ae5 --- /dev/null +++ b/miniprogram/course/modules/teachers/teacher-item/teacher-item.wxss @@ -0,0 +1,40 @@ +.teacher{ + padding: 12px; + display: flex; + background: white; +} +.thin-border-bottom { + position: relative +} + +.thin-border-bottom::after { + content: ""; + position: absolute; + left: 0; + bottom: 0; + right: 0; + height: 1px; + border-bottom: 1px solid #EAEAEA; + color: #e5e5e5; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + -webkit-transform: scaleY(.5); + transform: scaleY(.5); + z-index: 2 +} + +.teacher.thin-border-bottom::after{ + left: 60px; +} +.detail{ + margin-left: 12px; +} +.avatar{ + border-radius: 50%; + width: 45px; + height: 45px; +} +.school{ + color: dimgray; + font-size: 14px; +} \ No newline at end of file diff --git a/miniprogram/course/modules/teachers/teachers.js b/miniprogram/course/modules/teachers/teachers.js new file mode 100644 index 0000000..51b6da2 --- /dev/null +++ b/miniprogram/course/modules/teachers/teachers.js @@ -0,0 +1,42 @@ +const app = getApp(); +Component({ + properties: { + course_id: Number, + id_: Number, + course_identity:Number, + refresh: { + type: Number, + observer: function (r) { + if (r) { + console.log("observer refresh") + this.refresh(); + this.setData({ refresh: false }); + } + } + } + }, + + data: { + + }, + attached(){ + let {course_id, course_identity} = this.data; + let ext = {course_id, course_identity}; + this.setData({ext}); + this.refresh(); + }, + + methods: { + onChoose(e){ + console.log(e); + }, + refresh(){ + let {course_id} = this.data; + app.api("weapps.courses.teachers")({course_id,limit:1000}).then(res=>{ + console.log(res); + let {teacher_list:teachers,teacher_list_size:teachers_count} = res; + this.setData({teachers,teachers_count}); + }) + } + } +}) diff --git a/miniprogram/course/modules/teachers/teachers.json b/miniprogram/course/modules/teachers/teachers.json new file mode 100644 index 0000000..3f6bbb5 --- /dev/null +++ b/miniprogram/course/modules/teachers/teachers.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "mp-index-list":"../../components/index-list/index-list", + "teacher-item":"./teacher-item/teacher-item" + } +} \ No newline at end of file diff --git a/miniprogram/course/modules/teachers/teachers.wxml b/miniprogram/course/modules/teachers/teachers.wxml new file mode 100644 index 0000000..a85937d --- /dev/null +++ b/miniprogram/course/modules/teachers/teachers.wxml @@ -0,0 +1,11 @@ + + + + 教师人数: + {{teachers_count}} + + + + + + diff --git a/miniprogram/course/modules/teachers/teachers.wxss b/miniprogram/course/modules/teachers/teachers.wxss new file mode 100644 index 0000000..8c91318 --- /dev/null +++ b/miniprogram/course/modules/teachers/teachers.wxss @@ -0,0 +1,11 @@ +.teacher-list-wrap{ + flex:auto; +} + +.header{ + background: white; + padding: 12px; + display: flex; + justify-content: space-between; + align-items: center; +} diff --git a/miniprogram/course/pages/course/course.js b/miniprogram/course/pages/course/course.js index c8a93ea..323a201 100644 --- a/miniprogram/course/pages/course/course.js +++ b/miniprogram/course/pages/course/course.js @@ -4,7 +4,11 @@ const defaultModules = [{ type: "activity", name: "课堂动态" }]; -const supportModules = ["activity", "attachment", "exercise", "shixun_homework", "attendance"]; +const defaultModulesEnd = [ + {type:"students",name:"学生管理"}, + {type:"teachers",name:"教师管理"} +] +const supportModules = ["activity", "attachment", "exercise", "shixun_homework", "attendance","students","teachers"]; const nosupportMsgs = { video:"请使用网页版EduCoder" }; @@ -14,6 +18,7 @@ Component({ course_id: Number, module_type: { type: String, + value:'activity', observer: function (module) { //this.setModule(module,0); } @@ -25,8 +30,6 @@ Component({ nav_type: "back", current:0, module: { - type: "activity", - name: "课堂动态" }, tabbar_show:1, course: {}, @@ -78,6 +81,9 @@ Component({ }); }, setModule({type,showToast = 1}) { + if(type==this.data.module.type) + return false; + var flag = false; for (var module of this.data.course_modules) { if (module.type == type) { if (supportModules.indexOf(type) == -1) { @@ -92,8 +98,11 @@ Component({ this.setData({ module }); + flag = true; } } + if(!flag) + return flag; for (var i = 0; i < this.data.list.length; i++) { if (this.data.list[i].type == type) { this.setData({ @@ -158,15 +167,9 @@ Component({ let { course_id } = this.data; - let course = await app.api("courses.top_banner")({ - course_id - }); - this.setData({ - course - }); - return { - course - }; + let course = await app.api("courses.top_banner")({ course_id }); + this.setData({ course }); + return { course }; }, async pullModules() { let { @@ -175,7 +178,7 @@ Component({ let data = await app.api("courses.left_banner")({ course_id }); - let course_modules = defaultModules.concat(data.course_modules); + let course_modules = defaultModules.concat(data.course_modules).concat(defaultModulesEnd); course_modules = course_modules.filter(i=>supportModules.indexOf(i.type)>-1); this.setData({ course_modules @@ -183,6 +186,11 @@ Component({ this.setTabbar({ course_modules }); + if(this.data.module_type){ + if(!this.setModule({type:this.data.module_type,showModal:0})) + this.setModule({type:course_modules[0].type,showModal:0}) + this.setData({module_type: ""}); + } return course_modules; }, setTabbar({course_modules}) { @@ -198,7 +206,7 @@ Component({ }) } else { var list = []; - for (var i = 0; i < 5; i++) { + for (var i = 0; i < 4; i++) { if (i == 2) list.push({ type: "more", @@ -206,15 +214,14 @@ Component({ selectedIconPath: base + "module_select.svg", iconPath: base + "module.svg" }); - else { - var m = course_modules[i]; - list.push({ - type: m.type, - text: m.name, - selectedIconPath: base + m.type + "_select.svg", - iconPath: base + m.type + ".svg" - }); - } + + var m = course_modules[i]; + list.push({ + type: m.type, + text: m.name, + selectedIconPath: base + m.type + "_select.svg", + iconPath: base + m.type + ".svg" + }); } } this.setData({ @@ -311,7 +318,10 @@ Component({ this.refresh(); }, onShareAppMessage: function () { - + return app.shareApp({ + title: this.data.name, + path: "/"+this.route+`?course_id=${this.data.course_id}&module_type=${this.data.module.type}` + }) } } }) \ No newline at end of file diff --git a/miniprogram/course/pages/course/course.json b/miniprogram/course/pages/course/course.json index 0d02d0b..4f14f34 100644 --- a/miniprogram/course/pages/course/course.json +++ b/miniprogram/course/pages/course/course.json @@ -7,6 +7,8 @@ "shixun-homework": "/course/modules/shixun_homework/shixun_homework", "activity":"/course/modules/activity/activity", "attendance":"/course/modules/attendance/attendance", + "students":"/course/modules/students/students", + "teachers":"/course/modules/teachers/teachers", "join-course":"/components/modal/join-course/join-course", "error-page":"/components/error-page/error-page", "mp-tabbar": "weui-miniprogram/tabbar/tabbar", diff --git a/miniprogram/course/pages/course/course.wxml b/miniprogram/course/pages/course/course.wxml index 2a12a93..d640d4d 100644 --- a/miniprogram/course/pages/course/course.wxml +++ b/miniprogram/course/pages/course/course.wxml @@ -55,6 +55,8 @@ + + diff --git a/miniprogram/js/apiConfig.js b/miniprogram/js/apiConfig.js index 88343e3..5013a76 100644 --- a/miniprogram/js/apiConfig.js +++ b/miniprogram/js/apiConfig.js @@ -14,16 +14,19 @@ accounts:{ valid_email_and_phone: { query,form: {login: null, type: 1 } }, }, -add_department_applies:{config, query, form:{school_id:null, name:null, remarks:void 0}}, +add_department_applies:{config, query, form:{school_id:null, name:null, remarks:void 0},disp:"新增子单位"}, attachments:{url:{_:1,DELETE:'*/{attachment_id}',uploadFile:"*"},query,form:{_:1,uploadFile:{file:null},DELETE:{}},config:{method:"uploadFile", name:"file"}}, courses:{ url:{_:"*", DELETE:"*/{course_id}",PUT:"*/{course_id}"},query, form:{_:1,GET:{search:"",limit:20, page:1, order:"all"}, POST:{course_list_name:null,name:null,school: null,end_date: null,class_period:null,credit:null,course_module_types:["shixun_homework","common_homework","group_homework","exercise","attachment","course_group"],authentication:null,professional_certification:null},PUT:{course_list_name:null,name:null,school: null,end_date: null,class_period:null,credit:null,course_module_types:["shixun_homework","common_homework","group_homework","exercise","attachment","course_group"],authentication:null,professional_certification:null}}, act_score:{url:"{course_id}/*", query}, all_course_groups:{url:"{course_id}/*", query}, + apply_teachers:{url:"{course_id}/*",query,disp:"获取正在申请教师的列表"}, apply_to_join_course:{query,form:{invite_code:null, professor:void 0,assistant_professor:void 0,student:void 0}, config}, attendances:{url:"{course_id}/*",query, form:{page:1, limit:10, history:void 0}}, calculate_all_shixun_scores:{url:"{course_id}/*", query}, + delete_course_teacher:{url:"{course_id}/*",query,config,form:{course_member_id:null}}, + delete_from_course:{url:"{course_id}/*", query, config, form:{students:null},data:{students:{course_member_id:121}}, disp:"删除学生"}, exercises:{url:"{course_id}/*", query, form:{_:1, GET:{page:1,limit:15},POST:{exercise_name:null, exercise_description:""}}, publish:{url:"../{course_id}/exercises/*",query,form:{check_ids: null, end_time:null},config}, }, @@ -38,6 +41,7 @@ courses:{ url:{_:"*", DELETE:"*/{course_id}",PUT:"*/{course_id}"},query, form:{_ switch_to_assistant: { url: "{course_id}/*", query ,config}, switch_to_student:{url:"{course_id}/*",query, config}, switch_to_teacher:{url:"{course_id}/*",query, config}, + teacher_application_review:{url:"{course_id}/*",config, query, form:{application_id:null, approval:null,user_id:null},data:{approval:{2:"拒绝",1:"同意"}},disp:"审批教师申请"}, work_score:{url:"{course_id}/*",query, form:{limit:20, page:1, sort:"desc"}}, }, @@ -146,7 +150,7 @@ users:{ shixuns: { url: "{login}/*", query, form: {sort_by:"updated_at" ,page:1, sort_direction:"desc",per_page:16}}, system_update:{query:query}, /*{"system_update":true,"system_score":"为了给大家提供更优质的体验,平台将于2020年3月24日13:20开始对系统进行升级。升级期间系统响应会有一定的延迟。系统拟于2020年3月24日13:30恢复正常。\r\n请大家知悉,并提前做好教学安排。带来不便,敬请谅解。","subject":" educoder升级服务通知","start_time":"2020-03-24T13:20:00.000+08:00","end_time":"2020-03-24T13:30:00.000+08:00"}*/ - tidings: {query, form:{type:"",page:1,per_page:10}, data:"type:course,project,interaction,apply,notice"}, + tidings: {query, form:{type:void 0,page:1,per_page:10}, data:"type:course,project,interaction,apply,notice"}, unread_message_info:{url:"{login}/*", query}, watch:{url:"{user_id}/*",query,config,disp:"关注用户,delete取消关注"} }, @@ -160,6 +164,9 @@ weapps:{ }, basic_info:{url:"{course_id}/*",query,disp:"课堂基本信息"}, course_activities:{url:"{course_id}/*",query,form:{page:1, limit:20}}, + delete_course_teachers:{url:"{course_id}/*",query, form:{course_member_id:null},config:{method:"DELETE"}}, + students: {url:"{course_id}/*", query, form:{page:1, limit: void 0}}, + teachers: {url:"{course_id}/*", query, form:{page:1, limit: void 0}}, }, course_member_attendances:{query, form:{_:1, GET:{page:1, limit: 10},POST:{attendance_id:null, attendance_mode:null, code:void 0}}, config, disp:"课堂成员签到", update_status:{query, config, form:{attendance_id:null, attendance_status:null, course_id:null, user_id:null}} diff --git a/miniprogram/task/pages/task/task.js b/miniprogram/task/pages/task/task.js index 2ae5ba9..5742e05 100644 --- a/miniprogram/task/pages/task/task.js +++ b/miniprogram/task/pages/task/task.js @@ -1,11 +1,28 @@ const app = getApp(); Page({ data: { + theme: 'light', current: 0, content:"加载中...", titles: ["任务描述", "代码文件", "测评结果"], can_use_editor:wx.canIUse("editor") }, + initTheme(){ + let {theme} = this.data; + if(theme=='dark'){ + wx.setNavigationBarColor({backgroundColor:"#333333",frontColor:"#ffffff",animation:'linear'}); + }else{ + wx.setNavigationBarColor({backgroundColor:"#fbfbfb",frontColor:"#000000",animation:"linear"}); + } + }, + switchTheme({detail}){ + console.log(detail); + let {value} = detail; + let theme = value?'dark':'light'; + this.setData({theme}); + this.initTheme(); + wx.setStorageSync('config-task-theme', theme); + }, enterTask(e){ var {target:{dataset:{identifier}}} = e; console.log(e); @@ -185,6 +202,9 @@ Page({ }, onLoad: function (options) { //console.log("onload") + let theme = wx.getStorageSync('config-task-theme'); + this.setData({theme}); + this.initTheme(); let {identifier} = options; this.setData({identifier}); this.pullTask(); diff --git a/miniprogram/task/pages/task/task.wxml b/miniprogram/task/pages/task/task.wxml index 090cad6..e2648a8 100644 --- a/miniprogram/task/pages/task/task.wxml +++ b/miniprogram/task/pages/task/task.wxml @@ -3,9 +3,12 @@ - - 第{{challenge.position}}关:{{challenge.subject}} - + + + 第{{challenge.position}}关:{{challenge.subject}} + 黑暗模式(测试功能) + + diff --git a/miniprogram/task/pages/task/task.wxss b/miniprogram/task/pages/task/task.wxss index b846915..7ea9fd0 100644 --- a/miniprogram/task/pages/task/task.wxss +++ b/miniprogram/task/pages/task/task.wxss @@ -1,6 +1,18 @@ .body{ height: 100vh; } +.dark{ + background: black!important; + color: white; + opacity: 0.8; +} +.switch-wrap{ + text-align: right; + font-size: 12px; +} +.theme-switch{ + transform: scale(0.6); +} .challenge-body{ height: 100%; background: white; diff --git a/project.config.json b/project.config.json index a159a15..5ab61a0 100644 --- a/project.config.json +++ b/project.config.json @@ -109,7 +109,7 @@ "id": 6, "name": "course/pages/course/course", "pathName": "course/pages/course/course", - "query": "course_id=5876", + "query": "course_id=5141&module_type=teachers", "scene": null }, {