教师加入课堂审批

master
educoder_weapp 5 years ago
parent c9202a7602
commit f62731e1a3

@ -1,3 +1,10 @@
## v0.15.1
* A 教师加入课堂审批
* A 熬夜睡觉提醒
* A markdown中URL链接解析与跳转
* F index-list滑动与窗口滚动冲突
* F 加入课堂时多身份bug
## v0.15.0
* A 实训关卡黑暗模式
* A 学生管理模块

@ -42,7 +42,9 @@
"pages/course_invite/course_invite",
"pages/attendance_detail/attendance_detail",
"modules/attendance/attendance",
"pages/attendances/attendances"
"modules/students/students",
"pages/attendances/attendances",
"pages/teacher_apply/teacher_apply"
]
},
{
@ -82,10 +84,11 @@
"pages": [
"search"
]
},{
"name":"feedback",
"root":"pages/feedback",
"pages":[
},
{
"name": "feedback",
"root": "pages/feedback",
"pages": [
"feedback"
]
}

@ -93,7 +93,7 @@ Component({
})
},
cancel() {
this.setData({ hidden: true,invite_code:'', assistant_professor:0, student:0, assistant_professor:0 });
this.setData({ hidden: true,invite_code:'', assistant_professor:"", student:"", assistant_professor:"" });
},
onTapButton({detail:{index}}){
if(index==0)

@ -1,5 +1,6 @@
if (!global.towxml)
global.towxml = require('../../towxml/index');
import {navigateToUrl} from "../../js/utils";
Component({
externalClasses: ['my-class',"class"],
@ -49,14 +50,18 @@ Component({
methods: {
handleTap(e){
//console.log(this.data);
console.log("handleTap",e, this.data,this);
var {target:{dataset:{data}}} = e;
console.log("handleTap",e);
var {target:{dataset:{data}},currentTarget:{dataset:{data:_data}}} = e;
var key = "RICHMDKEY";
//console.log(data);
//console.log(_data);
let {tag, attr} = _data;
if(tag=='navigator'&&attr.href)
navigateToUrl({url: attr.href});
//this.triggerEvent('click',{},{bubbles:true});
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:this.data.theme,child:[data],_e:{child:[data]}}
data = {theme:'light',child:[data],_e:{child:[data]}}
wx.setStorage({
key,data,success:res=>{
wx.navigateTo({

@ -10,6 +10,12 @@ const ROUTE = {
__:"{course}?module_type=common_homework&course_id=${belong_container_id}",
practice: "{shixun_homework}?homework_id=${container_id}"
},
JoinCourse:{
__:"{teacher_apply}?course_id=${belong_container_id}"
},
StudentJoinCourse:{
__:"{students}?course_id=${belong_container_id}&course_identity=2"
},
StudentWork:{
__:"{course}?module_type=common_homework&course_id=${belong_container_id}",
}

@ -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.15.0";
let _version = "0.15.1";
var eduUrl = releaseUrl;
/**
*/

@ -92,7 +92,7 @@ Component({
_scrollTo: function _scrollTo(e) {
var data = this.data;
var clientY = e.changedTouches[0].clientY;
console.log(clientY);
//console.log(clientY);
var index = Math.floor((clientY - data._anchorTop) / data._anchorItemH);
if(index<0||index>=data.alphabet.length)
return;
@ -131,6 +131,8 @@ Component({
this.__onScroll(e);
},
_onScroll: function _onScroll(e) {
if(this.data.touching)
return;
var data = this.data;
var _tops = data._tops,
alphabet = data.alphabet;

@ -28,7 +28,11 @@ const configMap={
CourseMessage: {
type:"课堂申请",
text:"申请加入课堂",
color:"#3333FF"
color:"#3333FF",
url:"{teacher_apply}?course_id=${course_id}",
cd:[
{key:"course_identity", value:[2]}
]
},
Course: {
type:"创建课堂",
@ -67,10 +71,19 @@ Component({
},
methods: {
onTap(){
let {url} = this.config;
//console.log(this.config);
let url = this.config.url;
let cd = this.config.cd;
//console.log(url, cd);
if(!url) return;
if(cd){
for(var i of cd){
if(i.value.indexOf(this.data[i.key])==-1)
return;
}
}
url = format(url, this.data);
console.log(url);
console.log(url, this.data);
app.navigateTo({url});
}
}

@ -20,9 +20,7 @@ Component({
},
attached(){
let {course_id, course_identity} = this.data;
let ext = {course_id, course_identity};
this.setData({ext});
this.refresh();
},
@ -31,12 +29,14 @@ Component({
console.log(e);
},
refresh(){
let {course_id} = this.data;
let {course_id, course_identity} = 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});
})
});
let ext = {course_id, course_identity};
this.setData({ext});
}
}
})

@ -3,5 +3,6 @@
"usingComponents": {
"mp-index-list":"../../components/index-list/index-list",
"student-item":"./student-item/student-item"
}
},
"navigationBarTitleText": "学生管理"
}

@ -1,10 +1,10 @@
<mp-index-list binddelete="refresh" list="{{students}}" ext="{{ext}}" vibrated="{{false}}" generic:item="student-item" bindchoose="onChoose">
<mp-index-list binddelete="refresh" list="{{students}}" ext="{{ext}}" generic:item="student-item" bindchoose="onChoose">
<view class="header">
<view class="student-count">
<text>学生人数:</text>
<text class="count">{{students_count}}</text>
</view>
<navigator wx:if="{{course_identity<5}}" class='invite' hover-class="none" url="/course/pages/course_invite/course_invite?course_id={{course_id}}"><button class="invite-button" size="mini" type="main">邀请学生</button></navigator>
<navigator wx:if="{{course_identity&&course_identity<5}}" class='invite' hover-class="none" url="/course/pages/course_invite/course_invite?course_id={{course_id}}"><button class="invite-button" size="mini" type="main">邀请学生</button></navigator>
</view>
</mp-index-list>

@ -16,16 +16,26 @@ Component({
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})
let teachers = [{course_member_id}];
app.api("courses.delete_course_teacher")({course_id,course_member_id})
.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();
}
}
})
}
}
})

@ -1,4 +1,6 @@
{
"component": true,
"usingComponents": {}
"usingComponents": {
"mp-slideview": "/weui-miniprogram/slideview/slideview"
}
}

@ -1,7 +1,9 @@
<mp-slideview disable="{{!ext.course_identity||ext.course_identity>2||data.role=='管理员'}}" buttons="{{buttons}}" bindbuttontap="onButtonTap">
<view class="teacher thin-border-bottom">
<image class="avatar" src="{{eduImgDir}}{{data.image_url}}"></image>
<view class="detail">
<view class="name">{{data.name}}</view>
<view class="school">{{data.school}}</view>
</view>
</view>
</view>
</mp-slideview>

@ -20,23 +20,27 @@ Component({
},
attached(){
let {course_id, course_identity} = this.data;
let ext = {course_id, course_identity};
this.setData({ext});
this.refresh();
},
pageLifetimes: {
show: function () {
this.refresh();
}
},
methods: {
onChoose(e){
console.log(e);
},
refresh(){
let {course_id} = this.data;
let {course_id,course_identity} = 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});
let {teacher_list, teacher_list_size, apply_size} = res;
this.setData({teacher_list, teacher_list_size, apply_size});
})
let ext = {course_id, course_identity};
this.setData({ext});
}
}
})

@ -2,6 +2,7 @@
"component": true,
"usingComponents": {
"mp-index-list":"../../components/index-list/index-list",
"mp-badge": "/weui-miniprogram/badge/badge",
"teacher-item":"./teacher-item/teacher-item"
}
}

@ -1,11 +1,12 @@
<mp-index-list binddelete="refresh" list="{{teachers}}" ext="{{ext}}" vibrated="{{false}}" generic:item="teacher-item" bindchoose="onChoose">
<mp-index-list binddelete="refresh" list="{{teacher_list}}" ext="{{ext}}" generic:item="teacher-item" bindchoose="onChoose">
<view class="header">
<view class="student-count">
<text>教师人数:</text>
<text class="count">{{teachers_count}}</text>
<text class="count">{{teacher_list_size}}</text>
</view>
<navigator hover-class="none" url="/course/pages/teacher_apply/teacher_apply?course_id={{course_id}}" wx:if="{{course_identity&&course_identity<=2}}">
<mp-badge wx:if="{{apply_size>0}}"/>
<text class="apply-text">待审批({{apply_size}})</text>
</navigator>
</view>
</mp-index-list>
</mp-index-list>

@ -9,3 +9,7 @@
justify-content: space-between;
align-items: center;
}
.apply-text{
font-size: 14px;
margin-left: 6px;
}

@ -0,0 +1,33 @@
const app = getApp();
Component({
properties: {
data:Object,
course_id:Number
},
data: {
eduImgDir: global.config.eduImgDir
},
methods: {
review_application({approval}){
let {application_id, user_id} = this.data.data;
let {course_id} = this.data;
app.api("courses.teacher_application_review")({course_id, approval, application_id, user_id})
.then(res=>{
this.triggerEvent("review",{},{bubbles:true});
console.log(res);
res.message = approval==1?'已同意':approval==2?'已拒绝':res.message;
app.showMsg(res);
}).catch(e=>{
app.showError(e);
})
},
approval(e){
console.log(e);
this.review_application({approval:1});
},
deny(e){
console.log(e);
this.review_application({approval:2});
}
}
})

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

@ -0,0 +1,11 @@
<view class="apply-body thin-border-bottom">
<image class="avatar" src="{{eduImgDir}}{{data.image_url}}"></image>
<view class="detail">
<view class="name">{{data.name}}</view>
<view class="school">{{data.school_name}}</view>
</view>
<view class="opertions">
<button class="opertion" bindtap="approval" type="main" size="mini">同意</button>
<button class="opertion" bindtap="deny" type="main" plain size="mini">拒绝</button>
</view>
</view>

@ -0,0 +1,48 @@
.apply-body{
display: flex;
padding: 12px;
align-items: center;
}
.avatar{
width: 44px;
height: 44px;
border-radius: 50%;
flex: none;
}
.detail{
margin-left: 12px;
flex: auto;
}
.school{
color: dimgray;
font-size: 14px;
}
.opertions{
flex: none;
}
.opertion{
transform: scale(0.8);
}
.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
}
.apply-body.thin-border-bottom::after{
left: 64px;
}

@ -0,0 +1,28 @@
const app = getApp();
Page({
data: {
},
onLoad: function (options) {
let {course_id} = options;
this.setData({course_id});
this.refresh();
},
refresh(){
let {course_id} = this.data;
app.api("courses.apply_teachers")({course_id})
.then(res=>{
console.log(res);
this.setData(res);
}).catch(e=>{
app.showError(e);
})
},
onShow: function () {
}
})

@ -0,0 +1,6 @@
{
"usingComponents": {
"apply-item":"./apply-item/apply-item"
},
"navigationBarTitleText": "教师审批"
}

@ -0,0 +1,8 @@
<view class="header">
待审批:<text class="count">{{apply_size}}人</text>
</view>
<view class="apply-list">
<view class="applt-item-wrp" bindreview="refresh" wx:for="{{application_list}}">
<apply-item data="{{item}}" course_id="{{course_id}}"/>
</view>
</view>

@ -0,0 +1,14 @@
page{
background: white;
}
.header{
padding: 12px;
background: white;
border-bottom: #dddddd 1.5px solid;
}
.count{
font-size: 14px;
margin-left: 12px;
}

@ -164,7 +164,7 @@ 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"}},
delete_course_teachers:{url:"{course_id}/*",query, form:{course_member_ids: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}},
},

@ -1,3 +1,4 @@
export function deprecate(name=""){
try{
throw new Error(name + "这个方法或界面被弃用了");
@ -69,7 +70,7 @@ export function getResConstruction(res = "") {
export function processObj(obj) {
for (var key in obj) {
if (!obj.hasOwnProperty(key) || typeof obj[key] != "object")
if (!obj.hasOwnProperty(key) || typeof obj[key] != "object" ||obj.constructor!=Object)
continue
processObj(obj[key]);
obj[key].__proto__ = obj;
@ -209,4 +210,29 @@ export const accountManager = global.accountManager = new AccountManager();
export function getWXACodeUrl({url, scene}){
return global.config.imgDir + "wxacode/" + (url + "?" + scene).replace(/[\/?&]/g, "_") + ".jpeg";
}
//https://www.educoder.net/shixuns/ac46rzbw/challenges/3481
export function parseUrl({url}){
var match = url.match(/https:\/\/www.educoder.net\/(.*)/);
if(!match)
return '';
const route = match[1]; // 路径
// case 1:
match = route.match(/shixuns\/(.*)\/challenges\/(.*)/);
if(match){
var identifier = match[1]
return `{shixun}?identifier=${identifier}&cate_type=task`
}
return ''
}
export function navigateToUrl({url,open_type='navigateTo'}){
url = parseUrl({url});
console.log(url);
const app = getApp();
if(url){
app.navigateTo({url});
return true;
}else
return false;
}

@ -32,7 +32,7 @@
</view>
<view class="nav-list" bindtap="enterPage">
<navigator target="miniProgram" app-id="wx2402d86a6b534f77" class="nav gap">
<navigator target="miniProgram" app-id="wx2402d86a6b534f77" class="nav gap educoder">
<image src="{{attachDir}}872467" class="icon"></image>
EduCoder云网
<text class="tip">推荐使用</text>

@ -1,4 +1,5 @@
const app = getApp();
import {navigateToUrl} from '../../../js/utils';
Page({
data: {
theme: 'light',
@ -7,10 +8,46 @@ Page({
titles: ["任务描述", "代码文件", "测评结果"],
can_use_editor:wx.canIUse("editor")
},
initTheme(){
/*onTap(e){
console.log(e);
let {detail:{tag, attr}} = e;
if(tag=='navigator'&&attr.href)
navigateToUrl({url: attr.href});
//console.log(detail);
},*/
checkTime(){
if(this.timeChecked)
return;
let date = new Date();
let hours = date.getHours();
let min = date.getMinutes();
if(hours>=0&&hours<=3||hours>=23&&min>=30){
this.timeChecked = true;
let y = date.getFullYear();
let m = date.getMonth();
let d = date.getDate();
if(hours>=23)
d += 1;
let t = y+'-'+m+'-'+d;
let key = 'task-show-go-to-sleep-last-time'
let last = wx.getStorageSync(key);
if(last==t)
return
this.setData({showGoToSleep:true});
wx.reportAnalytics('show_go_to_sleep_in_task', {});
wx.setStorageSync(key, t);
}else if(hours<=21){
this.timeChecked = true;
}
},
onTapTopTip(){
this.setData({showGoToSleep:false});
wx.reportAnalytics('tap_go_to_sleep', {});
},
setNavigationTheme(){
let {theme} = this.data;
if(theme=='dark'){
wx.setNavigationBarColor({backgroundColor:"#333333",frontColor:"#ffffff",animation:'linear'});
wx.setNavigationBarColor({backgroundColor:"#303030",frontColor:"#ffffff",animation:'linear'});
}else{
wx.setNavigationBarColor({backgroundColor:"#fbfbfb",frontColor:"#000000",animation:"linear"});
}
@ -20,7 +57,7 @@ Page({
let {value} = detail;
let theme = value?'dark':'light';
this.setData({theme});
this.initTheme();
this.setNavigationTheme();
wx.setStorageSync('config-task-theme', theme);
},
enterTask(e){
@ -52,9 +89,6 @@ Page({
if(this.modified)
this.content = value;
},
addIndent(){
this.editor.insertText({text:" "});
},
onEditorInput(e){
let {text} = e.detail;
//console.log(e.detail.text);
@ -152,13 +186,16 @@ Page({
})
}, 1000);
},
onSwiperChange({detail:{current,source}}){
onSwiperChange(e){
//console.log(e);
let {detail:{current,source}} = e;
if(source=="touch"){
this.setData({current});
}
if(current==1&&!this.content){
this.pullContent();
}
this.checkTime();
},
async pullTask(){
let {identifier} = this.data;
@ -168,7 +205,7 @@ Page({
},
async pullContent(){
console.log("pullContent", this.editor);
//console.log("pullContent", this.editor);
let {path} = this.data.challenge;
path = this.processPath(path);
let {identifier} = this.data;
@ -186,7 +223,7 @@ Page({
}
}else
this.setData({content});
console.log("pullContent");
//console.log("pullContent");
},
onEditorReady({pullContent=0}={}) {
//console.log("editor-ready")
@ -204,12 +241,15 @@ Page({
//console.log("onload")
let theme = wx.getStorageSync('config-task-theme');
this.setData({theme});
this.initTheme();
this.setNavigationTheme();
let {identifier} = options;
this.setData({identifier});
this.pullTask();
},
onReady(){
this.checkTime();
},
onHide: function () {
this.updateFile();
},

@ -1,7 +1,8 @@
{
"usingComponents": {
"rich-md":"/components/rich-md/rich-md",
"test-set":"/task/components/test_set/test_set"
"test-set":"/task/components/test_set/test_set",
"mp-toptips":"/weui-miniprogram/toptips/toptips"
},
"navigationBarTitleText": "实训关卡"
}

@ -1,6 +1,7 @@
<page-meta>
<navigation-bar title="{{titles[current]}}"/>
</page-meta>
<mp-toptips bindtap="onTapTopTip" msg="夜深了,注意休息" type="info" show="{{showGoToSleep}}" delay="0"></mp-toptips>
<swiper class="body" circular="1" current="{{current}}" bindchange="onSwiperChange">
<swiper-item>
<scroll-view class="challenge-body {{theme}}" scroll-y="1">

@ -148,10 +148,10 @@
"scene": null
},
{
"id": -1,
"id": 12,
"name": "task/pages/task/task",
"pathName": "task/pages/task/task",
"query": "identifier=ji2wy8sqkou5",
"query": "identifier=ocsejtwkaxhq",
"scene": null
},
{
@ -167,6 +167,13 @@
"pathName": "account/pages/profile/profile",
"query": "course_id=5876",
"scene": null
},
{
"id": -1,
"name": "course/pages/teacher_apply/teacher_apply",
"pathName": "course/pages/teacher_apply/teacher_apply",
"query": "course_id=5141",
"scene": null
}
]
}

Loading…
Cancel
Save