You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
1.9 KiB

const {processObj, get, format} = require("../../../../js/utils");
const app = getApp();
const configMap={
text: "${course_act_type}",
type: "${course_act_type}",
color: "black",
CourseAttendance:{
text:"课堂签到开始了",
type:"签到",
color:"#09ad42",
url:"{attendance}?course_identity=${course_identity}&course_id=${course_id}&id_=${course_act_id}"
},
HomeworkCommon:{
practice:{
type: "实训作业",
color: "#ce223e",
url:"{shixun_homework}?homework_id=${course_act_id}"
},
normal: {
type:"普通作业",
color:"#CC6633"
},
text: "${container_name}",
type:"作业",
color:"#ac3f8a"
},
CourseMessage: {
type:"课堂申请",
text:"申请加入课堂",
color:"#3333FF",
url:"{teacher_apply}?course_id=${course_id}",
cd:[
{key:"course_identity", value:[2]}
]
},
Course: {
type:"创建课堂",
text:"大家快来加入课堂学习吧",
color:"#33DDAA"
}
}
processObj(configMap);
Component({
properties: {
data:{
type:Object,
observer:function(data){
let config = get(configMap, data.course_act_type,{});
config = get(config, data.container_type,{});
this.config = config;
data.text = format(config.text, data);
data.type = format(config.type, data);
data.color = config.color;
data.time = data.created_at.replace(/^.+ /,"");
this.setData(data);
;
}
},
course_identity:Number,
course_id:Number
},
data: {
eduImgDir:global.config.eduImgDir
},
methods: {
onTap(){
;
let url = this.config.url;
let cd = this.config.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);
;
app.navigateTo({url});
}
}
})