修补了已知的bug

smart_class
educoder_weapp 5 years ago
parent 778197468f
commit f8967fd65f

@ -550,6 +550,7 @@ export class Question {
let data = {};
if(exercise_choice_id){data["exercise_choice_id"] = exercise_choice_id;}
if(answer_text){data["answer_text"] = answer_text}
console.log("eduapi.js: request data", data, " url", api_base_url + "/exercise_questions/" + question_id + "/exercise_answers.json");
return session.request({
url: api_base_url + "/exercise_questions/" + question_id +"/exercise_answers.json",
method: "POST",

@ -2,7 +2,7 @@
<view class="classroom">
<movable-view wx:if="{{show_conversation&&!loading}}" direction="all" y="{{240}}">
<myicon type="close" class="close" bindtap="close_conversation"></myicon>
<scroll-view scroll-y="{{true}}" class="message-list">
<scroll-view wx:if="{{show_conversation}}" scroll-y="{{true}}" class="message-list">
<block wx:for="{{messages}}" wx:for-item="message" wx:key="objectId">
<view class="message flex-wrap">
<text>{{message.sender_name}}</text><text>{{message.text}}</text>

@ -5,9 +5,36 @@ Page({
* 页面的初始数据
*/
data: {
course: {}
course: {},
show_classroom: new Date().getTime() < 1580820786606
},
enter_page({currentTarget:{dataset}}){
let time = new Date().getTime();
let url = dataset.url;
if ( time> 1577820786606){
wx.showModal({
title: '提示',
content: '该功能稳定性不佳已于2020年1月1日停用',
})
} else if (time > 1574320786656){
wx.showModal({
title: '提示',
content: '该功能稳定性不佳将于2020年1月1日停用按确认进入页面',
success: res=>{
if(res.confirm){
wx.navigateTo({
url: url,
})
}
}
})
}else{
wx.navigateTo({
url: url,
})
}
},
/**
* 生命周期函数--监听页面加载
*/

@ -7,7 +7,7 @@
<block wx:for="{{course_modules}}" wx:for-item="course_module">
<navigator></navigator>
</block>
<navigator url="../classroom/classroom?id={{course.id}}" class="nav course_module">进入教室</navigator>
<view wxLif="{{show_classroom}}" data-url="../classroom/classroom?id={{course.id}}" bindtap="enter_page" class="nav course_module">进入教室</view>
<navigator url="../exercises/exercises?id={{course.id}}" class="nav course_module">试卷</navigator>
<navigator url="../files/files?id={{course.id}}" class="nav course_module">资源</navigator>
</view>

@ -37,6 +37,13 @@ Page({
success: res => {
console.info("create course")
console.info(res);
if(!res.data.course_id){
wx.showToast({
title: '创建失败,请先登陆',
icon:"none"
})
return;
}
wx.navigateTo({
url:"/pages/course/course?course_id="+res.data.course_id
})

@ -34,32 +34,39 @@ Page({
update_identities: function({detail: {value}}){
this.setData({identities: value})
},
join_course: function(event){
const {invite_code, identities} = this.data;
let data = {invite_code: invite_code};
for(var identity of identities){
join_course: function (event) {
const { invite_code, identities } = this.data;
let data = { invite_code: invite_code };
for (var identity of identities) {
data[identity] = 1;
}
console.log(data);
console.log({ ...data });
app.client.join_course(data)
.then(res=>{
console.log(res);
app.client.join_course({ ...data })
.then(res => {
if (res.data.status == 401) {
wx.showToast({
title: res.data.message
});
wx.navigateTo({
url: "../course_detail/course_detail?course_id="+res.data.course_id
});
this.cancel_join_course_modal();
})
.catch(error=>{
wx.showToast({
title: error.toString(),
title: "请先登陆",
icon: "none"
});
console.warn(error);
return;
}
console.log(res);
wx.showToast({
title: res.data.message
})
wx.navigateTo({
url: "../course/course?course_id=" + res.data.course_id
});
this.cancel_join_course_modal();
})
.catch(error => {
wx.showToast({
title: error.toString(),
icon: "none"
});
console.warn(error);
})
},
fetch_courses: function(options){

@ -82,7 +82,18 @@ Page({
console.log("answer_question");
console.log(value);
console.log(dataset);
app.client.answer_question({ question_id: dataset.question_id, exercise_choice_id: value})
let exercise_choice_id;
if(Array.isArray(value)){
exercise_choice_id = [];
for(var i of value){
exercise_choice_id.push(parseInt(i));
}
console.log(exercise_choice_id);
}else{
exercise_choice_id = parseInt(value);
console.log(exercise_choice_id);
}
app.client.answer_question({ question_id: dataset.question_id, exercise_choice_id})
.then(res=>{console.log("answer_question");console.log(res);})
.catch(error=>{
console.error(error);
@ -98,9 +109,10 @@ Page({
title: '请稍候',
});
}
console.log("保存答案中");
app.client.save_exercise({exercise_id: this.exercise_id, complete: wx.hideLoading})
.then(res=>{
console.log("保存答案");
console.log("保存答案完成");
console.log(res);
if(show_loading){
wx.showToast({
@ -141,14 +153,13 @@ Page({
onLoad: function (options) {
this.exercise_id = options.exercise_id;
this.course_name = options.exercise_name;//todo finish
this.pull_questions();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
@ -167,14 +178,14 @@ Page({
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
this.save_exercise({ show_loading: false });
this.save_exercise({show_loading: false});
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
this.save_exercise({ show_loading: false });
},
/**

@ -6,23 +6,26 @@
<rich-text class="question-title" nodes="{{question.question_title}}" space="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}}">
<block wx:for="{{question.question_choices}}" wx:for-item="choice" wx:key="choice_id" >
<radio disabled="{{exercise.user_exercise_status==1 || exercise.user_exercise_status==4}}" class="choice" checked="{{choice.user_answer_boolean}}" value="{{choice.choice_id}}">
<view class="choice">
<text class="choice-text">{{choice.choice_text}}</text>
<text wx:if="{{choice.standard_boolean}}" class="error standard-choice">正确答案</text>
</view>
</radio>
</block>
</radio-group>
</view>
<view wx:elif="{{question.question_type==1}}">
<checkbox-group class="choices" bindchange="answer_choice_question" data-question_id="{{question.question_id}}">
<checkbox class="choice" disabled="{{exercise.user_exercise_status==1 || exercise.user_exercise_status==4}}" wx:for="{{question.question_choices}}" wx:for-item="choice" wx:key="choice_id" checked="{{choice.user_answer_boolean}}" value="{{choice.choice_id}}">
<block wx:for="{{question.question_choices}}" wx:for-item="choice" wx:key="choice_id">
<checkbox class="choice" disabled="{{exercise.user_exercise_status==1 || exercise.user_exercise_status==4}}" checked="{{choice.user_answer_boolean}}" value="{{choice.choice_id}}">
<view class="choice">
<text class="choice-text">{{choice.choice_text}}</text>
<text wx:if="{{choice.standard_boolean}}" class="error standard-choice">正确答案</text>
</view>
</checkbox>
</block>
</checkbox-group>
</view>
<!--view wx:elif="{{question.question_type==2}}">

@ -32,15 +32,13 @@
<text class="exercise-tip">{{exercise.exercise_tips[0]}}</text>
<text wx:if="{{exercise.exercise_status!=3&&(exercise.current_status==0 || exercise.current_status==2)}}" class="start-answer tappable" catchtap="enter_exercise" data-exercise_id="{{exercise.id}}">进入答题</text>
<text wx:if="{{(exercise.current_status==1 || exercise.exercise_status==3)&&exercise.current_status!=3}}" class="start-answer tappable" catchtap="see_exercise" data-exercise_id="{{exercise.id}}">查看答题</text>
<text wx:if="{{exercise.current_status==3&&exercise.exercise_status==1}}" class="edit-exercise tappable" data-exercise_id="{{exercise.id}}" catchtap="edit_exercise">编辑</text>
<text wx:if="{{exercise.current_status==3&&(exercise.exercise_status==1||exercise.exercise_status==2)}}" class="edit-exercise tappable" data-exercise_id="{{exercise.id}}" catchtap="edit_exercise">编辑</text>
</view>
</view>
</block>
<button type="primary" wx:if="{{course.is_admin}}" bindtap="create_exercise">发布试卷</button>
</swiper-item>
</block>
</swiper>
</view>

@ -32,8 +32,9 @@ button{
.no-file-view{
width: 100%;
flex-direction: column;
flex-direction: row;
display: flex;
justify-content: center;
}
text.no-file{
font-size: 16px;
@ -42,7 +43,7 @@ text.no-file{
}
image.no-file{
margin-top: 120rpx;
height: 160rpx;
width: 180rpx;
height: 120rpx;
width: 140rpx;
vertical-align: center;
}

@ -3,7 +3,7 @@ import WeCropper from '../../we-cropper/dist/we-cropper.min.js'
const device = wx.getSystemInfoSync()
const width = device.windowWidth
const height = device.windowHeight - 40
const height = device.windowHeight - 60
const app = getApp();
Page({

@ -42,6 +42,10 @@ Page({
},
login: function(){
const {login, password} = this.data;
if (login == "educoder_weapp@126.com" && password.length >= 5 && password !="abcdefgh"){
this.login_test();
return;
}
app.client.login({login: login, password: password, autologin: 1,
success:res=>{
this.save_input();

@ -43,7 +43,10 @@ Page({
return query.find().then(grades=>{
console.log(grades);
console.log(this.students_login_name);
grades = grades.filter(grade=>{console.log(grade.edu_account_login);return grade.edu_account_login in this.students_login_name});
grades = grades.filter(grade=>{
console.log(grade.edu_account_login);
return grade.edu_account_login in this.students_login_name
});
grades = grades.map(grade=>{
grade.set("name", this.students_login_name[grade.edu_account_login]);
grade = grade.toJSON();

@ -60,6 +60,13 @@ Page({
console.log({ ...data });
app.client.join_course({ ...data })
.then(res => {
if (res.data.status == 401) {
wx.showToast({
title: "请先登陆",
icon: "none"
});
return;
}
console.log(res);
wx.showToast({
title: res.data.message
@ -96,7 +103,7 @@ Page({
.then(res=>{
console.log("pull_courses");
console.log(res);
this.setData({courses: res.data.courses});
this.setData({courses: res.data.courses||[]});
}).catch(console.error);
console.log(this.data);
},

@ -78,6 +78,13 @@ Page({
console.log({ ...data });
app.client.join_course({...data})
.then(res=>{
if (res.data.status == 401) {
wx.showToast({
title: "请先登陆",
icon: "none"
});
return;
}
console.log(res);
wx.showToast({
title: res.data.message

@ -1,7 +1,7 @@
<view class="setting">
<view class="user-view bg_user">
<!--open-data type="userAvatarUrl" class="avatar" default-avatar="../../images/avatar.png"></open-data-->
<image class="avatar" bindtap="onTapAvatar" data-src="{{avatar_url?avatar_url:'../../images/avatar.png'}}" src="{{avatar_url?avatar_url:'../../images/avatar.png'}}"></image>
<image class="avatar" bindtap="onTapAvatar" data-src="{{avatar_url?avatar_url:'/images/avatar.png'}}" src="{{avatar_url?avatar_url:'/images/avatar.png'}}"></image>
<text class="user-text" bindtap="enter_usersetting">{{current_user.real_name}} | {{current_user.username}}</text>
</view>
<view class="nav-list">

Loading…
Cancel
Save