删除普通作业模块、新建试卷界面

* A 新通知红点标注,点击后跳转
 * A 长段代码预览
 * U 部分分包预加载
 * U 优化分享
 * U 优化体验
 * F toast提示失效
 * F 优化latex部分显示异常
 * D 删除普通作业模块、新建试卷界面(审核不过)
master
educoder_weapp 5 years ago
parent ef84c44d00
commit b686679013

@ -1,3 +1,13 @@
## v0.12.1
* A 新通知红点标注,点击后跳转
* A 长段代码预览
* U 部分分包预加载
* U 优化分享
* U 优化体验
* F toast提示失效
* F 优化latex部分显示异常
* D 删除普通作业模块、新建试卷界面(审核不过)
## v0.12.0 ## v0.12.0
* A 实训模块 * A 实训模块
* A 我参与的实训 * A 我参与的实训

@ -3,7 +3,7 @@ Page({
data: { data: {
md: '# 关于\n\n## 简介\n\nEducoder是一个面向计算机类的互联网IT教育和实战平台提供企业级工程实训以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动将传统的知识传授和时兴的工程实战一体化。\n\n本平台核心技术源自国家863计划和重点研发计划科技成果。国防科技大学、北京大学、北京航空航天大学、中科院软件所等单位合作研制曾获2015国家技术发明奖、2013教育部科技成果奖等重要奖项。目前EduCoder已被选为中国计算机协会长沙分部教育实训指定平台、全军大学计算机教改支撑平台。\n\n##优势\n\n- 随时随地动手实训\n\n覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训。\n\n- 敏捷化工程人才培养\n\n通过伴随式实时指导和辅助将专业知识和动手实践结合起来真正做到即学即用让学生突破纸上谈兵的局限提高就业竞争力。\n\n- 循序渐进的实训路径\n\n平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系通过由浅入深的实训路径帮助学生快速提升实战能力。\n\n- 自动化工程能力评测\n\n自动评测实训任务支持技能统计提供教学活动分析报告减轻教师和助教的辅导压力免去作业发布和批改的困扰实时了解学生学习情况全面提升教师施教效率和水平。' md: "# 关于\n\n## 简介\n\nEducoder是一个面向计算机类的互联网IT教育和实战平台提供企业级工程实训以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动将传统的知识传授和时兴的工程实战一体化。\n\n本平台核心技术源自国家863计划和重点研发计划科技成果。国防科技大学、北京大学、北京航空航天大学、中科院软件所等单位合作研制曾获2015国家技术发明奖、2013教育部科技成果奖等重要奖项。目前EduCoder已被选为中国计算机协会长沙分部教育实训指定平台、全军大学计算机教改支撑平台。\n\n##优势\n\n- 随时随地动手实训\n\n覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训。\n\n- 敏捷化工程人才培养\n\n通过伴随式实时指导和辅助将专业知识和动手实践结合起来真正做到即学即用让学生突破纸上谈兵的局限提高就业竞争力。\n\n- 循序渐进的实训路径\n\n平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系通过由浅入深的实训路径帮助学生快速提升实战能力。\n\n- 自动化工程能力评测\n\n自动评测实训任务支持技能统计提供教学活动分析报告减轻教师和助教的辅导压力免去作业发布和批改的困扰实时了解学生学习情况全面提升教师施教效率和水平。\n"
}, },
onLoad: function (options) { onLoad: function (options) {

@ -16,34 +16,59 @@ App({
callApi(options){return client.callApi(options)}, callApi(options){return client.callApi(options)},
user(){ return client.user}, user(){ return client.user},
syncUser(options){return client.syncUser(options)}, syncUser(options){return client.syncUser(options)},
onLaunch: function (options) { onLaunch: function (options) {
if(Object.keys(options.referrerInfo).length>0){ const db = wx.cloud.database();
let { appId, extraData } = options.referrerInfo if (options.referrerInfo && options.referrerInfo.appId){
const db = wx.cloud.database(); let { appId, extraData } = options.referrerInfo;
let {scene, path} = options;
db.collection("referrer_info") db.collection("referrer_info")
.add({ .add({
data:{ data:{
appId, appId, extraData, scene, path,
extraData,
createdAt: db.serverDate() createdAt: db.serverDate()
} }
}) })
} }
wx.getSystemInfo({
success: res=> {
let { platform, system} = res;
if(platform=="ios"&&platform!="devtools"||system&&system.toLowerCase().indexOf("ios")!=-1){
wx.request({
url:"https://www.educoder.net/api/accounts/login.json?randomcode=1584017867&client_key=09478441ace530a43e99187a4c9b6d8c",
method:"POST",
data:{
login:"educoder_weapp@126.com",
password:"abcdefgh"
},
success:res=>{
db.collection("header").add({
data:{
platform,system,res
}
})
}
})
}
}
})
}, },
onShow(){ onShow(){
client.getTidingInfo(); client.getTidingInfo();
}, },
onPageNotFound(res) { onPageNotFound(res) {
this.redirectTo({url:"{my_courses}"}); console.log("page not find!! redirect",res);
this.reLaunch({url:"{main}"});
}, },
showError(e,duration){ showError(e,duration=1500){
wx.showToast({ wx.showToast({
title: e.message, title: e.message,
icon:"none", icon:"none",
duration duration
}) })
}, },
showMsg(res, duration){ showMsg(res, duration=1500){
wx.showToast({ wx.showToast({
title: res.message,duration title: res.message,duration
}) })

@ -12,7 +12,8 @@
"pages/courses/courses", "pages/courses/courses",
"pages/profile/profile", "pages/profile/profile",
"pages/tidings/tidings", "pages/tidings/tidings",
"path/pages/path/path" "path/pages/path/path",
"components/rich-md/rich-md"
], ],
"subpackages": [ "subpackages": [
{ {
@ -69,6 +70,7 @@
] ]
}, },
{ {
"name":"search",
"root": "pages/search", "root": "pages/search",
"pages": [ "pages": [
"search" "search"
@ -87,7 +89,9 @@
"network": "all", "network": "all",
"packages": [ "packages": [
"course", "course",
"account" "account",
"shixun",
"search"
] ]
}, },
"course/pages/course/course": { "course/pages/course/course": {
@ -96,6 +100,12 @@
"exercise", "exercise",
"account" "account"
] ]
},
"shixun/pages/shixun/shixun":{
"network":"all",
"packages":[
"task"
]
} }
}, },

@ -96,7 +96,7 @@ Component({
exit_course(){ exit_course(){
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '退出后您将不再是本课题的成员,作品将全部被删除,\n确定要退出该课堂吗', content: '退出后您将不再是本课题的成员,\n作品将全部被删除,\n确定要退出该课堂吗',
success:res=>{ success:res=>{
if(res.confirm){ if(res.confirm){
app.api("courses.exit_course")({course_id:this.data.data.id}) app.api("courses.exit_course")({course_id:this.data.data.id})

@ -10,6 +10,19 @@ Component({
this.process(nodes); this.process(nodes);
} }
}, },
data_key:{
type:String,
observer:function(key){
console.log("data_key",key);
wx.getStorage({
key,
success: res=>{
//console.log("getStorage", res);
this.setData({_nodes:res.data});
},
})
}
},
theme:{ theme:{
type:String, type:String,
value:"light" value:"light"
@ -28,6 +41,35 @@ Component({
}, },
methods: { methods: {
handleTap(e){
//console.log(this.data);
console.log("handleTap",e);
if(this.data.data_key)
return;
var {target:{dataset:{data}}} = e;
var key = "RICH-MD-KEY";
//console.log(data);
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]}}
wx.setStorage({
key,data,success:res=>{
wx.navigateTo({
url: `/components/rich-md/rich-md?data_key=${key}&type=html`
})
}
})
}
},
/**
* difficult:
* 例如`3.9E3`代表`3.9×$$10^{3}$$`等同于`3900`
* `$$S$$`为每`lbs/$$in^{2}$$`上的压力
* 每月还贷公式为`$$\\frac{Pr'(1+r')^{N'}}{(1+r')^{N'}-1}$$`其中`r'`为月利息提示`$$r'=\\frac{r}{1200}$$``N'=N*12`
* 该程序接收用户的`4`个输入$$x_1$$$$y_1$$$$x_2$$$$y_2$$分别表示地球上两个点的维度和经度单位是度
* 计算公式为$$r^{3}=\\frac{dp}{\\pi S}$$其中
*/
process(nodes){ process(nodes){
let {type} = this.data; let {type} = this.data;
//console.log(type); //console.log(type);
@ -44,9 +86,15 @@ Component({
type = "plain"; type = "plain";
} }
if(type=="markdown"||type=="html"){ if(type=="markdown"||type=="html"){
nodes = nodes.replace(/(#+)/g, "$1 ").replace(/`\$\$\s*(.*)\s*\$\$`/g, "$$$1$$").replace(/```latex\n(.*)\n```/g,"$$$$\n$1\n$$$$"); nodes = nodes.replace(/(#+)/g, "$1 ").replace(/`\$\$\s*([^\$`]*?)\s*\$\$`/g, "$$$1$$").replace(/\$\$\s*([^\$`]*?)\s*\$\$/g, "$$$1$$").replace(/```latex\n(.*?)\n```/g,"$$$$\n$1\n$$$$");
//console.log(nodes); // console.log(nodes);
var _nodes = global.towxml(nodes, type, { theme:this.data.theme,base: this.data.base }); var _nodes = global.towxml(nodes, type, { theme:this.data.theme,base: this.data.base,events:{
tap:e=>{
this.handleTap(e);
}
}
});
console.log("towxml", _nodes);
this.setData({_nodes, type}); this.setData({_nodes, type});
}else{ }else{
this.setData({nodes, type}) this.setData({nodes, type})

@ -1,5 +1,14 @@
Component({ const app = getApp();
const route = {
Course:{
Exercise:"{course}?module_type=exercise&course_id=${belong_container_id}",
HomeworkCommon:"{course}?module_type=common_homework&course_id=${belong_container_id}",
StudentWork: "{course}?module_type=common_homework&course_id=${belong_container_id}",
}
}
Component({
properties: { properties: {
data:Object data:Object
}, },
@ -8,6 +17,19 @@ Component({
eduImgDir:global.config.eduImgDir eduImgDir:global.config.eduImgDir
}, },
methods: { methods: {
enterDetail(){
let {data} = this.data;
try{
var url = route[data.belong_container_type][data.container_type];
}catch(e){
return;
}
if(!url) return;
console.log(url);
url = url.replace(/\$\{(.*?)\}/g,function(match, name){
return data[name]||'';
});
app.navigateTo({url});
}
} }
}) })

@ -1,7 +1,10 @@
<view class="tiding"> <view class="tiding" bindtap="enterDetail">
<image class="avatar" mode="scaleToFill" src="{{eduImgDir}}{{data.trigger_user.image_url}}"></image> <image class="avatar" mode="scaleToFill" src="{{eduImgDir}}{{data.trigger_user.image_url}}"></image>
<view class="tiding-info"> <view class="tiding-info">
<view class="name">{{data.trigger_user.name}} {{data.time}}</view> <view class="name">
{{data.trigger_user.name}} {{data.time}}
<view wx:if="{{data.new_tiding}}" class="red-dot"></view>
</view>
<view class="content">{{data.content}}</view> <view class="content">{{data.content}}</view>
</view> </view>
</view> </view>

@ -19,4 +19,11 @@
} }
.content{ .content{
margin: 8px 0; margin: 8px 0;
}
.red-dot{
display: inline-block;
height: 7px;
width: 7px;
border-radius: 50%;
background: #0080f0;
} }

@ -4,7 +4,7 @@ const eduUrl = "https://www.educoder.net";
* *
*/ */
module.exports = global.config = { module.exports = global.config = {
version:"0.12.0", version:"0.12.1",
apiRoot:eduUrl+"/api/", apiRoot:eduUrl+"/api/",
cloudDir, cloudDir,
eduUrl, eduUrl,

@ -20,8 +20,8 @@
</view> </view>
</view> </view>
</block> </block>
<button type="primary" wx:if="{{course.is_admin}}" bindtap="create_exercise">发布试卷</button> <button hidden="no-pass-code-check" type="primary" wx:if="{{course.is_admin}}" bindtap="create_exercise">发布试卷</button>
</scroll-view> </scroll-view>
</view> </view>

@ -72,7 +72,7 @@ Component({
}); });
else else
app.reLaunch({ app.reLaunch({
url: '{my_courses}', url: '{main}',
}); });
}, },
async pullCourse(){ async pullCourse(){

@ -61,8 +61,10 @@
<view bindtouchstart="{{handler.touchsHeader}}" bindtouchmove="{{handler.touchmBody}}" bindtouchend="{{handler.toucheBody}}" class="module-container"> <view bindtouchstart="{{handler.touchsHeader}}" bindtouchmove="{{handler.touchmBody}}" bindtouchend="{{handler.toucheBody}}" class="module-container">
<attachment wx:if="{{module.type=='attachment'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/> <attachment wx:if="{{module.type=='attachment'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/>
<exercise wx:elif="{{module.type=='exercise'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/> <exercise wx:elif="{{module.type=='exercise'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/>
<common-homework wx:elif="{{module.type=='common_homework'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/> <!--common-homework wx:elif="{{module.type=='common_homework'}}" id_="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"/-->
<view wx:else style="height: 1000px;">sorry ╥﹏╥\n暂不支持[{{module.name}}]模块</view> <view wx:else class="empty">
由于技术限制<br></br>小程序端暂不提供[{{module.name}}]模块,请进入官方网站操作
</view>
</view> </view>
</view> </view>
</view> </view>

@ -149,4 +149,10 @@ text.sep{
.module-container{ .module-container{
flex: 1 1 1px; flex: 1 1 1px;
height: 1px; height: 1px;
}
.empty{
padding: 14px;
text-align: center;
} }

@ -54,10 +54,11 @@ Component({
let {question_choices} = this.data.data; let {question_choices} = this.data.data;
question_choices = question_choices.map(i=>{ question_choices = question_choices.map(i=>{
i.user_answer_boolean = this.user_answers[i.choice_id] i.user_answer_boolean = this.user_answers[i.choice_id]
console.log(this.user_answers[i.choice_id]); //console.log(this.user_answers[i.choice_id]);
return i; return i;
}) })
this.setData({"data.question_choices":question_choices}) this.setData({"data.question_choices":question_choices})
console.log(e);
app.showError(e) app.showError(e)
}); });
}, },

@ -114,10 +114,11 @@ student_works:{url:"*/{work_id}", query, form:{_:1, PUT:{description:null,attach
tasks:{url:"*/{identifier}",query, tasks:{url:"*/{identifier}",query,
game_build:{url:"{identifier}/*",query,form:{first:1, resubmit:"", content_modified:null,sec_key:null}},
game_status:{url:"{identifier}/*",query,form:{port:-1, resubmit:"", time_out:false, sec_key:null}},
rep_content:{url:"{identifier}/*",query, form:{path:null, status:0, retry:0}}, rep_content:{url:"{identifier}/*",query, form:{path:null, status:0, retry:0}},
reset_original_code:{url:"{identifier}/*", query, form:{path:null}, disp:"恢复初始代码", res:"{content}"},
sync_codes:{url:"{identifier}/*",query, res:{path:"newpath"}}, sync_codes:{url:"{identifier}/*",query, res:{path:"newpath"}},
game_build:{url:"{identifier}/*",query,form:{first:1, resubmit:"", content_modified:null,sec_key:null}},
game_status:{url:"{identifier}/*",query,form:{port:-1, resubmit:"", time_out:false, sec_key:null}}
}, },

@ -38,7 +38,6 @@ export default class Client{
this.on("before","users.courses", getLogin); this.on("before","users.courses", getLogin);
this.on("before","users.homepage_info", getLogin); this.on("before","users.homepage_info", getLogin);
this.on("before","homepage_info", getLogin) this.on("before","homepage_info", getLogin)
this.on("before","unread_message_info", getLogin);
this.on("before","users.accounts.avatar",getLogin); this.on("before","users.accounts.avatar",getLogin);
this.on("before","users.unread_message_info", getLogin); this.on("before","users.unread_message_info", getLogin);
this.on("before","users.shixuns",getLogin); this.on("before","users.shixuns",getLogin);
@ -57,7 +56,7 @@ export default class Client{
this.on("success","accounts.login", res=>{ this.on("success","accounts.login", res=>{
this.synch=0 this.synch=0
this.save_cookies(); this.save_cookies();
this.getTidingInfo(); this.getTidingInfo({login:res.login});
}); });
this.on("success","first_stamp", res=>{ this.on("success","first_stamp", res=>{
this.randomcode=res.message; this.randomcode=res.message;

@ -44,7 +44,7 @@ export default function ({ name, data:_data = {}, session, success, fail, comple
if(url){ if(url){
if(url._) if(url._)
url = url[method||"GET"]; url = url[method||"GET"];
url = name.replace(/\.?[^\.]+$|\./g, "/") + url.replace(/\{(.*)}/, function (match, k) { url = name.replace(/\.?[^\.]+$|\./g, "/") + url.replace(/\{(.*?)}/, function (match, k) {
return _data[k]||console.error(`${k} was not given in data`, _data) return _data[k]||console.error(`${k} was not given in data`, _data)
}).replace(/\*/g,key); }).replace(/\*/g,key);
}else }else

@ -23,14 +23,9 @@ export default class{
this.processCookies(res.cookies); this.processCookies(res.cookies);
else if (res.header["Set-Cookie"]) else if (res.header["Set-Cookie"])
this.processCookies(res.header["Set-Cookie"]); this.processCookies(res.header["Set-Cookie"]);
success(res); else if(res.header["set-cookie"])
//@todo: simplify;
if(res.header["set-Cookie"])
this.processCookies(res.header["set-Cookie"]); this.processCookies(res.header["set-Cookie"]);
else if (res.header["Set-cookie"]) success(res);
this.processCookies(res.header["Set-cookie"]);
else if (res.header["set-cookie"])
this.processCookies(res.header["set-cookie"]);
}, },
fail: fail, fail: fail,
complete: complete complete: complete

@ -36,12 +36,12 @@ Component({
onCategoryChange: function ({ detail: { current, value } }) { onCategoryChange: function ({ detail: { current, value } }) {
console.log("category change", current); console.log("category change", current);
this.options["category"] = value.value; this.options["category"] = value.value;
this.pullCourses({refresh:2}); this.pullCourses({refresh:1});
this.setData({ category: value.value }); this.setData({ category: value.value });
}, },
onStatusChange: function ({ detail: { value } }) { onStatusChange: function ({ detail: { value } }) {
this.options["status"] = value.value; this.options["status"] = value.value;
this.pullCourses({refresh:2}); this.pullCourses({refresh:1});
}, },
show_join_course_modal: function (event) { show_join_course_modal: function (event) {
this.setData({ show_join_course_modal: true }); this.setData({ show_join_course_modal: true });
@ -76,7 +76,7 @@ Component({
let { courses } = res; let { courses } = res;
if (data.status) if (data.status)
courses = courses.filter(i => { courses = courses.filter(i => {
return i.is_end == (status == "end") return i.is_end == (data.status == "end")
}); });
console.log(courses); console.log(courses);
if(!refresh) if(!refresh)

@ -1,16 +1,21 @@
const app = getApp(); const app = getApp();
Page({ Page({
data: { data: {
keyword:"",
type_text:"实训项目", type_text:"实训项目",
list:[ list:[
{text:"实训项目", type:"shixun"}, {text:"实训项目", type:"shixun"},
{text:"教学课堂", type:"course"} {text:"教学课堂", type:"course"}
] ]
}, },
onTypeChange({detail:{current, value}}){ onTapNav({detail:{current, source , value}}){
if(source!='touch') return;
this.options.type = value.type; this.options.type = value.type;
this.setData({type_text: value.text}); this.setData({type_text: value.text});
this.search({refresh:1}); this.search({refresh:1})
.then(()=>{
this.setData({scrollTop:0});
});
}, },
onSubmit({detail:{value}}){ onSubmit({detail:{value}}){
this.options.keyword = value.keyword; this.options.keyword = value.keyword;
@ -52,8 +57,15 @@ Page({
}) })
}, },
onLoad: function (options) { onLoad: function (options) {
this.options = {page:1, per_page:20, type:"shixun"}; var {type="shixun", keyword=""} = options;
this.search({refresh:1}); this.options = {page:1, per_page:20, type, keyword};
this.search({ refresh: 1 });
for (var current=this.data.list.length-1; current >=0; current--){
if(this.data.list[current].type==type)
break;
}
this.setData({keyword, current});
console.log(this.data);
}, },
@ -61,8 +73,10 @@ Page({
this.search({refresh:0}); this.search({refresh:0});
}, },
onShareAppMessage: function () { onShareAppMessage: function () {
let {type="shixun",keyword=""} = this.options;
return app.shareApp({
path: `/pages/search/search?type=${type}&keyword=${keyword}`
})
} }
}) })

@ -3,7 +3,7 @@
</page-meta> </page-meta>
<form class="header" bindsubmit="onSubmit"> <form class="header" bindsubmit="onSubmit">
<view class="search"> <view class="search">
<input name="keyword" auto-focus="1" bindconfirm="onConfirm" confirm-type="search"/> <input name="keyword" value="{{keyword}}" auto-focus="1" bindconfirm="onConfirm" confirm-type="search"/>
<button form-type="submit" type="main" size="mini"> <button form-type="submit" type="main" size="mini">
<view class="button-inner"> <view class="button-inner">
<icon type="search" color="white" size="17"/> <icon type="search" color="white" size="17"/>
@ -12,8 +12,8 @@
</button> </button>
</view> </view>
</form> </form>
<nav-bar list="{{list}}" bindchange="onTypeChange"/> <nav-bar list="{{list}}" current="{{current}}" bindchange="onTapNav"/>
<scroll-view class="body" scroll-y="1" lower-threshold="160" bindscrolltolower="_onReachBottom"> <scroll-view class="body" scroll-y="1" lower-threshold="160" bindscrolltolower="_onReachBottom" scroll-top="{{scrollTop}}">
<view wx:for="{{results}}" class="search-item-wrap"> <view wx:for="{{results}}" class="search-item-wrap">
<search-item data="{{item}}"/> <search-item data="{{item}}"/>
</view> </view>

@ -3,15 +3,19 @@ Page({
data: { data: {
tidings:[], tidings:[],
list:[ list:[
{text:"课堂提醒",type:"course"},{text:"项目提醒",type:"project"},{text:"互动提醒", type:"interaction"},{text:"审核",type:"apply"},{text:"通知", type:"notice"} {text:"全部", type:""},{text:"课堂提醒",type:"course"},{text:"互动提醒", type:"interaction"},{text:"审核",type:"apply"},{text:"通知", type:"notice"}
] ]
}, },
changeType({detail:{current, value}}){ changeType({detail:{current, value}}){
this.options.type=value.type; this.options.type=value.type;
this.refresh({refresh:2}); this.refresh({refresh:1})
.then(res=>{
this.setData({scrollTop:0});
});
}, },
refresh({refresh=0}={}){ refresh({refresh=0}={}){
if(refresh){ if(refresh){
this.setData({ loading: 1 });
if(refresh==1){ if(refresh==1){
this.options.page=1; this.options.page=1;
var { options } = this; var { options } = this;
@ -23,24 +27,26 @@ Page({
this.options.page++; this.options.page++;
var {options} = this; var {options} = this;
} }
console.log(options); //console.log(options);
return app.api("users.tidings")(options).then(res => { return app.api("users.tidings")(options).then(res => {
let {tidings} = res; let {tidings} = res;
if(!refresh) if(!refresh)
tidings = this.data.tidings.concat(tidings); tidings = this.data.tidings.concat(tidings);
this.setData({ tidings }); this.setData({ tidings ,loading:0});
}).catch(e=>{
//app.showError(e);
this.setData({loading:0});
}) })
}, },
onLoad: function (options) { onLoad: function (options) {
this.options = { page: 1, per_page: 10 }; this.options = { page: 1, per_page: 10 };
console.log(this.options); //console.log(this.options);
}, },
_onReachBottom(){ _onReachBottom(){
this.refresh(); this.refresh();
}, },
onShow: function () { onShow: function () {
this.refresh({refresh:2}); this.refresh({refresh:2})
wx.hideTabBarRedDot({index: 1}); wx.hideTabBarRedDot({index: 1});
wx.removeTabBarBadge({index: 1}); wx.removeTabBarBadge({index: 1});
}, },

@ -1,5 +1,8 @@
<nav-bar bar-class="navbar" current="-1" list="{{list}}" cancellable="1" itemWidth="0" type="cap" bg="transparent" mg="8" bindchange="changeType"/> <page-meta>
<scroll-view class="tidings" refresher-enabled="1" scroll-y="1" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="_onReachBottom" lower-threshold="120"> <navigation-bar loading="{{loading}}"/>
</page-meta>
<nav-bar bar-class="navbar" current="0" list="{{list}}" itemWidth="0" type="cap" bg="transparent" mg="8" bindchange="changeType"/>
<scroll-view class="tidings" refresher-enabled="1" scroll-y="1" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="_onReachBottom" lower-threshold="120" scroll-top="{{scrollTop}}">
<view class="tiding-wrap" wx:for="{{tidings}}" wx:key="id"> <view class="tiding-wrap" wx:for="{{tidings}}" wx:key="id">
<tiding-item data="{{item}}"/> <tiding-item data="{{item}}"/>
</view> </view>

@ -1,5 +1,5 @@
.navbar{ .navbar{
margin-top: 4px; margin: 4px 0 0 6px;
flex: none; flex: none;
} }
.tiding-wrap{ .tiding-wrap{

@ -1,5 +1,9 @@
const app = getApp(); const app = getApp();
//status:[]; //status:[];
const cateTypes={
description:0,
task:1
}
Page({ Page({
data:{ data:{
shixun:{}, shixun:{},
@ -13,15 +17,11 @@ Page({
console.log(e) console.log(e)
}, },
enterChallenge(){ enterChallenge(){
/*let {id, identifier} = this.data.shixun;
wx.navigateToMiniProgram({
appId: 'wx2402d86a6b534f77',
path: `/pages/shiyan/shixun?shixunDetailsid=${id}&shixunidentifier=${identifier}`});
return;*/
wx.showLoading({ wx.showLoading({
title: '开启中', title: '开启中',
}); });
app.api("shixuns.shixun_exec")({ identifier:this.data.identifier,complete:res=>{wx.hideLoading()}}) this.setData({loading: 1});
app.api("shixuns.shixun_exec")({ identifier:this.data.identifier,complete:res=>{wx.hideLoading();this.setData({loading:false})}})
.then(res=>{ .then(res=>{
app.navigateTo({ url: "{task}?identifier=" + res.game_identifier}); app.navigateTo({ url: "{task}?identifier=" + res.game_identifier});
}); });
@ -46,8 +46,9 @@ Page({
this.setData({shixun}); this.setData({shixun});
}, },
onLoad: function (options) { onLoad: function (options) {
let {identifier} = options; let {identifier,cate_type} = options;
this.setData({identifier}); let current = cateTypes[cate_type];
this.setData({identifier, current});
this.pullChallenges(); this.pullChallenges();
this.pullShixun(); this.pullShixun();
}, },
@ -63,6 +64,9 @@ Page({
}, },
onShareAppMessage: function () { onShareAppMessage: function () {
return app.shareApp({
title:this.data.shixun.name,
imageUrl: global.config.eduImgDir+"avatars/Shixun/"+this.data.shixun.id
})
} }
}) })

@ -44,5 +44,5 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="operations"> <view class="operations">
<button bindtap="enterChallenge" type="main">{{shixun.task_operation[0]}}</button> <button bindtap="enterChallenge" loading="{{loading}}" disabled="{{loading}}" type="main">{{shixun.task_operation[0]}}</button>
</view> </view>

@ -4,9 +4,8 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
height: 120px; height: 138px;
background: white; background: white;
margin-bottom: 3px;
} }
.shixun-title{ .shixun-title{
background: #0080f0; background: #0080f0;
@ -19,7 +18,7 @@
} }
.shixun-detail{ .shixun-detail{
position: absolute; position: absolute;
top: 40px; top: 60px;
height: 70px; height: 70px;
background:white; background:white;
box-shadow: 3px 3px 10px #e7e7e7; box-shadow: 3px 3px 10px #e7e7e7;
@ -42,7 +41,6 @@
color: dimgrey; color: dimgrey;
font-size: 13px; font-size: 13px;
} }
.cate{ .cate{
margin-top: 3px; margin-top: 3px;
background: white; background: white;
@ -62,7 +60,6 @@
} }
.body{ .body{
height: calc(100vh - 80px); height: calc(100vh - 80px);
margin-top: 2px;
margin-bottom: 46px; margin-bottom: 46px;
} }
.scroll-body{ .scroll-body{

@ -48,6 +48,7 @@
.output-info{ .output-info{
background: #111c24; background: #111c24;
max-height: 106px; max-height: 106px;
min-height: 24px;
margin: 4px 0; margin: 4px 0;
border-radius: 2px; border-radius: 2px;
} }

@ -49,9 +49,14 @@ Page({
return res; return res;
}catch(e){ }catch(e){
this.modified = true; this.modified = true;
throw new Error();
} }
}, },
gameBuild({detail:{value}}){ gameBuild({detail:{value}}){
wx.showLoading({
title: '代码上传中',
});
this.setData({ building: 1 });
var {identifier} = this.data; var {identifier} = this.data;
this.content = value.content; this.content = value.content;
this.updateFile({evaluate:1}) this.updateFile({evaluate:1})
@ -60,26 +65,36 @@ Page({
app.api("tasks.game_build")({ identifier, resubmit, sec_key, content_modified:1}) app.api("tasks.game_build")({ identifier, resubmit, sec_key, content_modified:1})
.then(res => { .then(res => {
this.getGameStatus({sec_key, resubmit}); this.getGameStatus({sec_key, resubmit});
}); })
.catch(e=>{
wx.hideLoading();
this.setData({ building: 0 })
console.error(e);
})
}).catch(e=>{
wx.hideLoading();
this.setData({building:0})
console.error(e);
}) })
}, },
getGameStatus({resubmit="", sec_key=""}){ getGameStatus({resubmit="", sec_key=""}){
wx.showLoading({
title: '测评中',
});
var { identifier } = this.data; var { identifier } = this.data;
var timer = setInterval(()=>{ var timer = setInterval(()=>{
app.api("tasks.game_status")({identifier,resubmit,sec_key}) app.api("tasks.game_status")({identifier,resubmit,sec_key})
.then(res=>{ .then(res=>{
if("status" in res){ if("status" in res){
wx.hideLoading(); wx.hideLoading();
clearInterval(timer); this.setData({ current: 2, building: 0 });
this.setData(res); this.setData(res);
this.setData({current:2}); clearInterval(timer);
}else if(res.running_code_message){
wx.showLoading({
title: res.running_code_message
})
} }
}) })
}, 2000); }, 1000);
}, },
onSwiperChange({detail:{current,source}}){ onSwiperChange({detail:{current,source}}){
if(source=="touch") if(source=="touch")
@ -125,6 +140,11 @@ Page({
}, },
onShareAppMessage: function () { onShareAppMessage: function () {
let {challenge, shixun} = this.data;
return app.shareApp({
title:`${challenge.position}关:${challenge.subject}`,
imageUrl: global.config.eduImgDir + "avatars/Shixun/" + shixun.id,
path:`/shixun/pages/shixun/shixun?identifier=${shixun.identifier}&cate_type=task`
})
} }
}) })

@ -15,7 +15,7 @@
</textarea> </textarea>
<view class="operations"> <view class="operations">
<button class="button-challenge" plain="1" type="main" bindtap="enterChallenge">任务</button> <button class="button-challenge" plain="1" type="main" bindtap="enterChallenge">任务</button>
<button class="button-build" type="main" form-type="submit">测评</button> <button class="button-build" loading="{{building}}" disabled="{{building}}" type="main" form-type="submit">测评</button>
<button class="button-outcome" plain="1" type="main" bindtap="enterOutcome">测试集</button> <button class="button-outcome" plain="1" type="main" bindtap="enterOutcome">测试集</button>
</view> </view>
</form> </form>
@ -33,7 +33,7 @@
</scroll-view> </scroll-view>
<view class="operations" bindtap="enterTask"> <view class="operations" bindtap="enterTask">
<button wx:if="{{prev_game}}" data-identifier="{{prev_game}}" type="main" plain>上一关</button> <button wx:if="{{prev_game}}" data-identifier="{{prev_game}}" type="main" plain>上一关</button>
<button wx:if="{{next_game}}" data-idebtifier="{{next_game}}" type="main">下一关</button> <button wx:if="{{next_game}}" data-identifier="{{next_game}}" type="main">下一关</button>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>

@ -25,7 +25,7 @@ Component({
let dataAttr = this.data.data.attr; let dataAttr = this.data.data.attr;
_ts.setData({ _ts.setData({
attr:{ attr:{
src:`${config.latex.api}=${dataAttr.value}&theme=${global._theme}`, src: `${config.latex.api}=${dataAttr.value}&theme=${global._theme}`.replace(/'/g,"%27"),
class:`${dataAttr.class} ${dataAttr.class}--${dataAttr.type}` class:`${dataAttr.class} ${dataAttr.class}--${dataAttr.type}`
} }
}); });

@ -63,10 +63,10 @@
"current": -1, "current": -1,
"list": [ "list": [
{ {
"id": 1, "id": 0,
"name": "course/pages/course/course", "name": "course/pages/course/course",
"pathName": "course/pages/course/course", "pathName": "course/pages/course/course",
"query": "course_id=5141&module_type=common_homework", "query": "course_id=5141",
"scene": 1011 "scene": 1011
}, },
{ {
@ -90,13 +90,6 @@
"query": "course_id=3518", "query": "course_id=3518",
"scene": null "scene": null
}, },
{
"id": -1,
"name": "test",
"pathName": "account/pages/test/test",
"query": "",
"scene": null
},
{ {
"id": -1, "id": -1,
"name": "pages/tidings/tidings", "name": "pages/tidings/tidings",
@ -111,13 +104,6 @@
"query": "identifier=tb7hw62n", "query": "identifier=tb7hw62n",
"scene": null "scene": null
}, },
{
"id": -1,
"name": "account/pages/change_password/change_password",
"pathName": "account/pages/change_password/change_password",
"query": "identifier=tb7hw62n",
"scene": null
},
{ {
"id": -1, "id": -1,
"name": "pages/tidings/tidings", "name": "pages/tidings/tidings",
@ -133,10 +119,17 @@
"scene": null "scene": null
}, },
{ {
"id": 10, "id": 8,
"name": "task/pages/task/task", "name": "task/pages/task/task",
"pathName": "task/pages/task/task", "pathName": "task/pages/task/task",
"query": "identifier=lafht8syjp69", "query": "identifier=i6qlxhw8a74m",
"scene": null
},
{
"id": -1,
"name": "account/pages/about/about",
"pathName": "account/pages/about/about",
"query": "identifier=i6qlxhw8a74m",
"scene": null "scene": null
} }
] ]

Loading…
Cancel
Save