D 调试输出

master
educoder_weapp 5 years ago
parent d7a7746840
commit 76c4242bc1

@ -8,8 +8,8 @@ cloud.init({
exports.main = (event, context) => {
console.log(event)
console.log(context)
const wxContext = cloud.getWXContext()

@ -5,7 +5,7 @@ cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV})
// 云函数入口函数
exports.main = async (event, context) => {
console.log(event)
switch (event.action||event.name) {
case "wxacode.getUnlimited":
case "getWXACodeUnlimited":{

@ -22,7 +22,6 @@ Page({
}
let {action} = this.data;
let type = action=="register"?1:2;
console.log(this.cache.login, this.cache.type, login, type);
if(this.cache.login==login&&this.cache.type==type) return;
app.api("accounts.valid_email_and_phone")({
login, type,
@ -61,7 +60,6 @@ Page({
.catch(e=>{
if (showToast)
app.showError(e);
console.error(e);
})
},
register({login, password, code}){

@ -23,8 +23,6 @@ Page({
.then(res=>{
if (this.oldNum!=null && accountManager.getAccounts().length>this.oldNum && !this.data.currentAccountSaved && this.data.currentAccount) {
// 增加了新账号,将未保存的老账号信息保存
console.error("add current")
console.log(this.data.currentAccount);
accountManager.addAccount(this.data.currentAccount);
this.setData({ currentAccountSaved: 1 });
}
@ -41,7 +39,6 @@ Page({
if(res.user.user_id&&res.user.user_id!=2){
if(!currentAccount){
var currentAccount = { login: res.user.phone || res.user.email, password: "", save_password: 0, image_url: res.user.image_url, name: res.user.real_name||res.user.name, user_id: res.user.user_id};
console.log("currentAccount", currentAccount);
accountManager.setCurrentAccount(currentAccount);
}
for (var account of addedAccounts){
@ -68,7 +65,6 @@ Page({
}
},
removeAccount2(e){
console.log(e);
let { currentTarget: { dataset: { id: user_id } } } = e;
this.deleteAccount({user_id});
setTimeout(()=>{
@ -77,14 +73,12 @@ Page({
},
removeAccount1(e){
console.log(e);
let { currentTarget: { dataset: { id: user_id } } } = e;
var info = this.data.user.user_id == user_id?'退出登录并移除':"移除此账号";
wx.showActionSheet({
itemList: [info],
success:res=>{
if(res.tapIndex==0){
console.log(user_id);
this.deleteAccount({user_id});
this.refresh();
}
@ -92,7 +86,6 @@ Page({
})
},
switchAccount(e){
console.log(e);
let { currentTarget: {dataset: {id: user_id}}} = e;
if (user_id==this.data.user.user_id) return;
if (accountManager.getAccounts().length<5&&!this.data.currentAccountSaved&&this.data.currentAccount){
@ -125,7 +118,6 @@ Page({
wx.navigateTo({ url:"../account/account?nostorage=1&error=密码将加密保存至本地&save_password=1&addaccount=1"});
},
showMsg({message,duration=800}){
console.log(message);
if(this.timeoutId)
clearTimeout(this.timeoutId);
this.setData({ message, showMessage:1});

@ -20,7 +20,6 @@ Page({
this.setData({ gender: value });
},
onSubmit(e){
console.log(e);
let {detail:{value}} = e;
if(!this.checkInput(value)) return;
value.attachment_ids[0] = parseInt(value.attachment_ids[0]);

@ -39,7 +39,6 @@ Page({
})
.catch(e=>{
console.error(e);
app.showError(e);
})
},

@ -64,22 +64,18 @@ Page({
});
},
onIdentityChange(e) {
console.log(e);
let { detail: { value } } = e;
this.setData({ identity_index: value, technical_index: -1 });
},
onTechnicalChange(e) {
console.log(e);
let { detail: { value } } = e;
this.setData({ technical_index: value });
},
onDepartmentChange(e) {
console.log(e);
let { detail: { value } } = e;
this.setData({ department_index: value });
},
onSubmit(e) {
console.log(e);
let { detail: { value } } = e;
if (!this.checkInput(value)) return;
value.attachment_ids[0] = parseInt(value.attachment_ids[0]);

@ -39,7 +39,7 @@ Component({
wx.showLoading({
title: '检查内容中...'
})
console.log("onSubmit");
;
app.openapi({name:"security.msgSecCheck",data:{content},success:res=>{
if(res.errCode==0){
wx.showLoading({
@ -47,7 +47,7 @@ Component({
})
app.api("add_department_applies")({school_id, name, remarks})
.then(res=>{
//console.log(res);
;
this.triggerEvent("success",res);
wx.hideLoading();
wx.showToast({
@ -57,7 +57,7 @@ Component({
}).catch(e=>{
app.showError(e);
})
//console.log("内容合法")
}else{
wx.hideLoading();
wx.showToast({
@ -65,7 +65,7 @@ Component({
});
}
}});
console.log(remarks, name, school_id);
;
},
onTapButton({detail}){
if(detail.index==0)

@ -13,7 +13,6 @@ Page({
}
},
refresh(){
console.log(locationData);
app.api("users.accounts")().then(res=>{
this.originInfo = res;
res.authen = res.authentication == "certified";
@ -66,44 +65,40 @@ Page({
})
},
onGenderChange({detail:{value}}){
console.log("gender change", value);
value = parseInt(value);
this.setData({gender:value});
},
onLocationChange(e){
console.log(e)
let {detail:{value:[location_index, city_index]}} = e;
this.setData({location_index, city_index});
this.setData({cities:locationData[this.data.locations[location_index]]});
},
onCitiesChange(e){
console.log(e);
let {detail:{value,column}} = e;
if(column==0)
this.setData({cities:locationData[this.data.locations[value]],location_index:value ,city_index:-1});
},
onIdentityChange(e){
console.log(e);
let {detail:{value}} = e;
this.setData({identity_index:value, technical_index:-1});
},
onTechnicalChange(e){
console.log(e);
;
let { detail: { value } } = e;
this.setData({technical_index: value});
},
onDepartmentChange(e){
console.log(e);
;
let { detail: { value } } = e;
this.setData({department_index:value});
},
refreshDepartments({detail}){
console.log(detail);
;
this.setData({department_id: detail.id});
this.pullDepartments();
},
pullDepartments(){
console.log("pullDepartments");
;
let {school_id, department_id} = this.data;
app.api("schools.departments.for_option")({school_id})
.then(res=>{
@ -148,7 +143,7 @@ Page({
},
checkProInfo(value){
let info = this.originInfo;
console.log("info, value",info, value);
;
if (info.identity != value.identity)
return true;
if(info.identity=='student'){
@ -164,7 +159,7 @@ Page({
},
onSubmit(e){
let {detail:{value}} = e;
console.log("onSubmit", value);
;
if(!this.checkInput(value)) return;
if(this.data.pro_authen&&this.checkProInfo(value)){
wx.showModal({
@ -217,7 +212,7 @@ Page({
app.syncUser({refresh:1});
res.message = "更新成功";
app.showMsg(res);
console.log("success", res);
;
setTimeout(() => {
wx.navigateBack({
delta: 1
@ -228,7 +223,7 @@ Page({
})
},
onTap(e){
console.log(e);
;
let { target: { id } } = e;
if (id) {
if ((id == 'name' || id == "gender") && this.data.authen)

@ -30,7 +30,7 @@ Component({
});
},
onTapDepartment(e) {
console.log(e);
;
let { target: { dataset: { name: department_name, id: department_id } } } = e;
if (!department_id) return;
let { _id: school_id, name: school_name } = this.data;

@ -5,12 +5,12 @@ Page({
schools:[]
},
onConfirm({detail:{value}}){
console.log(value);
;
if(!value) return;
this.search({keyword:value});
},
onSubmit({detail:{value}}){
console.log(value);
;
if(!value.keyword) return;
this.search({keyword:value.keyword});
},

@ -8,10 +8,9 @@ Page({
this.setData({info:"获取中"})
wx.cloud.callFunction({name:"login"})
.then(res=>{
console.log(res);
;
this.setData(res.result);
}).catch(e=>{
console.error(e);
this.setData({info:"获取失败"});
})
},

@ -71,7 +71,7 @@ App({
client.getTidingInfo();
},
onPageNotFound(res) {
console.log("page not find!! redirect", res);
this.realTimeLog.error("page not find!! redirect", res);
this.reLaunch({ url: "{main}" });
},
showError(e, duration = 1500) {

@ -5,17 +5,17 @@ Page({
},
touchStart(e) {
//console.log(e);
;
this.mycropper.touchStart(e)
},
touchMove(e) {
//console.log(e);
;
this.mycropper.touchMove(e)
},
touchEnd(e) {
//console.log(e);
;
this.mycropper.touchEnd(e)
},
upload_avartar(filePath) {
@ -32,18 +32,15 @@ Page({
});
},
getCropperImage() {
console.warn("ontap: getCropImage")
this.mycropper.getCropperImage((avatar) => {
console.log(avatar);
;
if (avatar) {
console.info("avatar");
console.log(avatar);
wx.showLoading({
title: '上传中',
});
this.upload_avartar(avatar).then(res => {
console.log("upload avatar success");
console.log(res);
;
;
wx.navigateBack({
delta: 1
});
@ -52,7 +49,6 @@ Page({
title: '更改成功',
});
}).catch(error => {
console.error(error);
wx.showToast({
title: '失败',
icon: "none"
@ -84,13 +80,12 @@ Page({
this.mycropper = new WeCropper(cropperOpt);
this.mycropper
.on('beforeImageLoad', (ctx) => {
console.info("beforeImageLoad");
wx.showLoading({
title: '上传中'
})
})
.on('imageLoad', (ctx) => {
console.info("imageLoad")
wx.hideLoading();
})
.updateCanvas();

@ -24,7 +24,7 @@ Component({
let { homework_id } = this.data;
app.api("homework_commons.student_works", { method: "POST" })({ description, attachment_ids, homework_id })
.then(res => {
console.log(res);
;
app.showMsg(res);
this.setData({})
})
@ -55,7 +55,7 @@ Component({
wx.chooseMessageFile({
count:1,
success:res=>{
console.log("getfilepath");
;
this.upload(res.tempFiles[0])
}
})
@ -76,7 +76,7 @@ Component({
})
},
upload({path, size, name}){
console.log("upload", path, name)
if(this.size>157286400)
return wx.showModal({
title: '错误',
@ -84,7 +84,7 @@ Component({
showCancel: false
})
this.setData({uploading:true});
console.log("uploading")
app.api("attachments")({
file:path,
complete: ()=>{this.setData({uploading:false})}
@ -170,7 +170,7 @@ Component({
});
},
onLoad: function (options) {
console.log(this.data, options);
;
if(options.un_commit_work=="true")
this.setData({un_commit_work:true});
if(!this.data.un_commit_work)

@ -40,12 +40,12 @@ Component({
this.setData({message, buttons, imgUrl});
},
onTapBody(){
console.log("tapbody")
let {status} = this.data;
this.triggerEvent("refresh",{target:"body", status})
},
onTapButton({target:{dataset:{current}}}){
console.log("tapButton")
let {status} =this.data;
this.triggerEvent("refresh",{target:"button",current, status})
}

@ -46,13 +46,13 @@ Component({
scan(){
wx.scanCode({
success:res=>{
console.log(res);
;
var fail = false;
if(res.scanType=="QR_CODE")
this.setData({invite_code: res.result});
else if(res.scanType=="WX_CODE"&&res.path){
var match = res.path.match(/course_invite\?(.*)$/)
//console.log("match",match);
;
if(match){
var options = {}
match[1].split("&").map(i=>{
@ -60,7 +60,7 @@ Component({
var k = i.slice(0, index);
var v = i.slice(index + 1);
options[k]=v})
//console.log("options",options);
;
if(options.scene){
var scene = {};
for (var i of decodeURIComponent(options.scene).split("&")) {
@ -69,12 +69,12 @@ Component({
var v = i.slice(index+1);
scene[k] = v;
}
console.log(scene);
;
if(scene.course_id){
var {course_id} = scene;
app.api("weapps.courses.basic_info")({ course_id })
.then(({ course:{invite_code=""}}) => {
console.log(invite_code);
;
this.setData({invite_code});
}).catch(app.showError);
}else
@ -102,15 +102,15 @@ Component({
this.join_course();
},
update_invite_code: function ({ detail: { value } }) {
console.log(value);
;
this.setData({ invite_code: value });
},
update_identities: function ({ detail: { value } }) {
var data = {assistant_professor:"", professor:"",student:""}
console.log(value);
;
for(var identity of value)
data[identity] = 1
console.log(data);
;
this.setData(data)
},
join_course () {

@ -5,7 +5,7 @@ Component({
list:{
type:Array,
observer:function(){
//console.log("observer list",this.data);
;
if(this.data._itemWidth&&this.data._itemWidth>0)
this.refresh();
}
@ -27,7 +27,7 @@ Component({
type:Number,
observer: function(cur){
this.setData({cur});
console.log("observer current", cur);
;
this.trigger({source:""});
this.scroll();
}

@ -14,11 +14,11 @@ Component({
datakey:{
type:String,
observer:function(key){
console.log("data_key",key, this.data);
;
wx.getStorage({
key,
success: res=>{
//console.log("getStorage", res);
;
this.setData({_nodes:res.data});
},
});
@ -49,11 +49,11 @@ Component({
methods: {
handleTap(e){
//console.log(this.data);
console.log("handleTap",e);
;
;
var {target:{dataset:{data}},currentTarget:{dataset:{data:_data}}} = e;
var key = "RICHMDKEY";
//console.log(_data);
;
let {tag, attr} = _data;
if(tag=='navigator'&&attr.href){
if(!navigateToUrl({url: attr.href}))
@ -89,7 +89,7 @@ Component({
*/
process(){
let {type, nodes} = this.data;
//console.log(type);
;
if(!type){
if (nodes.match(/^\s*<.+>.*<\/.+>/s))
type = "rich-text";
@ -102,14 +102,14 @@ Component({
}
if(type=="markdown"||type=="html"){
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);
// ;
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});
}else{
this.setData({nodes, type})

@ -53,7 +53,7 @@ Component({
},
methods: {
choose: function choose(e) {
console.log("choose",e);
;
var item = e.target.dataset.item;
this.triggerEvent('choose', { item: item });
},
@ -63,7 +63,7 @@ Component({
_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;
@ -82,13 +82,13 @@ Component({
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() {
@ -107,7 +107,7 @@ Component({
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]) {

@ -26,7 +26,7 @@ Component({
},
attached(){
this.setData({data:JSON.stringify(this.data)});
//console.log(this.data);
;
},
methods: {

@ -7,7 +7,7 @@ Component({
type: Boolean,
observer: function (v) {
if (v) {
//console.log("observer refresh");
;
this.refresh({refresh:1});
this.setData({ refresh: false });
}
@ -52,7 +52,7 @@ Component({
else
groups[date] = [item];
}
console.log(groups);
;
return groups;
},
onReachBottom(){

@ -13,7 +13,7 @@ Component({
course_id:Number
},
attached:function(){
//console.log(this.data);
;
},
data: {

@ -59,7 +59,7 @@ Component({
data.color = config.color;
data.time = data.created_at.replace(/^.+ /,"");
this.setData(data);
//console.log(data);
;
}
},
course_identity:Number,
@ -71,10 +71,10 @@ Component({
},
methods: {
onTap(){
//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){
@ -83,7 +83,7 @@ Component({
}
}
url = format(url, this.data);
console.log(url, this.data);
;
app.navigateTo({url});
}
}

@ -24,18 +24,18 @@ Component({
loading:true
},
attached(){
console.log("attachment",this.data);
;
this.onLoad();
},
methods: {
pull_files: function () {
app.callApi({ name: "files", data: { course_id: this.data.course_id }, complete: () => { wx.hideLoading(); this.setData({ loading: false }) } })
.then(res => {
console.log("pull_files");
console.log(res);
this.setData({ files: res.data.files });
})
.catch(console.error);
.catch(e=>{
});
},

@ -12,7 +12,7 @@ Component({
methods: {
onButtonTap(e){
console.log(this.data);
;
let {course_identity,course_id,data:{mode, code, id:attendance_id}} = this.data;
if(course_identity==5&&mode=="QUICK"){
wx.reportAnalytics('tap_quick_attendance_button', {});

@ -34,7 +34,7 @@ Component({
},
methods: {
log(e){
console.log(e);
;
},
async refresh({refresh=1}={}){
let {course_id, course_identity} = this.data;

@ -7,7 +7,7 @@ Component({
type:Number,
observer:function(r){
if (r) {
console.log("observer refresh")
this.refresh();
this.setData({ refresh: false });
}
@ -22,7 +22,7 @@ Component({
},
methods: {
onSwitchNav({detail:{current, value}}){
console.log("switchNav")
if(!this.options)
this.options={};
this.options.order=value.order;
@ -30,14 +30,13 @@ Component({
},
refresh(){
let {course_id} = this.data;
console.log(this.options);
;
app.api("courses.homework_commons")({...this.options, course_id, type:1})
.then(res=>{
console.log(res);
;
this.setData({homeworks: res.homeworks});
}).catch(e=>{
app.showError(e);
console.error(e);
})
}

@ -59,7 +59,7 @@ Component({
app.api("courses.top_banner")({ course_id: this.data.course_id })
.then(res => {
this.setData({ course: res })
console.log(res)
})
this.pull_exercise();
this.setData({ require_login: false });
@ -71,14 +71,13 @@ Component({
pull_exercise: function () {
app.api("courses.exercises")({ course_id: this.data.course_id })
.then(res => {
console.log(res);
;
if (res.exercises) {
this.setData({ exercises: res.exercises, loading: false });
}
console.log(this.data)
})
.catch(e => {
console.error(e);
app.showError(e)
});
},

@ -8,7 +8,7 @@ Component({
type: Number,
observer: function (r) {
if (r) {
console.log("observer refresh")
this.refresh();
this.setData({ refresh: false });
}
@ -23,7 +23,7 @@ Component({
},
methods: {
onSwitchNav({ detail: { current, value } }) {
console.log("switchNav")
if (!this.options)
this.options = {};
this.options.order = value.order;
@ -31,14 +31,13 @@ Component({
},
refresh() {
let { course_id } = this.data;
console.log(this.options);
;
app.api("courses.homework_commons")({ ...this.options, course_id, type: 4 })
.then(res => {
console.log(res);
;
this.setData({ homeworks: res.homeworks });
}).catch(e => {
app.showError(e);
console.error(e);
})
}

@ -14,12 +14,12 @@ Component({
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=>{
@ -27,7 +27,7 @@ Component({
})
},
onButtonTap(e){
//console.log(e,this.data);
;
wx.showModal({
title:"提示",
content:"确认删除所选学生吗?",

@ -8,7 +8,7 @@ Component({
type: Number,
observer: function (r) {
if (r) {
console.log("observer refresh")
this.refresh();
this.setData({ refresh: false });
}
@ -26,10 +26,10 @@ Component({
methods: {
onChoose(e){
console.log(e);
;
},
onChange(e){
console.log(e);
;
let {detail:{value}} = e;
this.sort_type = value?'id':'';
this.refresh();
@ -39,7 +39,7 @@ Component({
let {sort_type=''} = this;
if(sort_type!='id')
app.api("weapps.courses.students")({course_id, limit:1000}).then(res=>{
console.log(res);
;
var {students,students_count} = res;
this.setData({students,students_count});
if(!this.imageMap)
@ -53,7 +53,7 @@ Component({
else
app.api("courses.students")({course_id, limit:10000})
.then(res=>{
console.log(res);
;
var students;
if(this.imageMap)
students = res.students.map(i=>{

@ -12,10 +12,10 @@ Component({
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 teachers = [{course_member_id}];
app.api("courses.delete_course_teacher")({course_id,course_member_id})
.then(res=>{
@ -26,7 +26,7 @@ Component({
})
},
onButtonTap(e){
//console.log(e,this.data);
;
wx.showModal({
title:"提示",
content:"确认删除所选教师吗?",

@ -8,7 +8,7 @@ Component({
type: Number,
observer: function (r) {
if (r) {
console.log("observer refresh")
this.refresh();
this.setData({ refresh: false });
}
@ -30,12 +30,12 @@ Component({
methods: {
onChoose(e){
console.log(e);
;
},
refresh(){
let {course_id,course_identity} = this.data;
app.api("weapps.courses.teachers")({course_id,limit:1000}).then(res=>{
console.log(res);
;
let {teacher_list, teacher_list_size, apply_size} = res;
this.setData({teacher_list, teacher_list_size, apply_size});
})

@ -18,7 +18,7 @@ Component({
},
onLoad(options){
if(options.scene){
console.log(options);
;
let scene = decodeURIComponent(options.scene);
let [attendance_id, mode, code] = scene.split("-");
this.setData({attendance_id, mode, code,course_identity:5});
@ -37,10 +37,10 @@ Component({
wx.setClipboardData({data});
},
onCodeLoadError(e) {
console.log("onCodeLoadError", e);
;
let page = this.route;
let scene = this.getScene();
console.log(page, scene);
;
wx.cloud.callFunction({ name: "openapi", data: { action: "getWXACodeUnlimited", name:"wxacode.getUnlimited", page, scene , data:{page, scene}} })
.then(res => {
this.setData({ code_url: "" });
@ -64,7 +64,7 @@ Component({
onSubmit(e){
let { detail: { value } } = e;
let { scaned_code, mode } = this.data;
console.log(e, value);
;
if(!value.code&&mode!="QUICK") return;
value.attendance_mode = mode;
if(mode=='QRCODE'){
@ -100,7 +100,7 @@ Component({
this.setData({ scaned_code: res.result});
else if (res.scanType == "WX_CODE" && res.path) {
var match = res.path.match(/attendance_detail\?(.*)$/)
console.log("match", match);
;
var options = {}
match[1].split("&").map(i => {
var index = i.indexOf("=");
@ -108,7 +108,7 @@ Component({
var v = i.slice(index + 1);
options[k] = v
})
console.log("options", options);
;
if(options.scene){
let [attendance_id, mode, scaned_code] = decodeURIComponent(options.scene).split("-");
if(scaned_code)
@ -139,7 +139,6 @@ Component({
this.setData({code_url});
}
}).catch(e=>{
//console.error(e);
if(e.code==402)
e.message = "你没有访问权限";
app.showError(e);
@ -161,7 +160,7 @@ Component({
let {course_id} = this.data;
return app.api("courses.top_banner")({course_id})
.then(res=>{
console.log(res);
;
let {course_identity} = res;
this.setData({course_identity});
})

@ -236,7 +236,7 @@ Component({
current
}
}) {
console.log(target);
;
switch (status) {
case 401:
if (current == 0)
@ -273,7 +273,7 @@ Component({
});
this.pullModules()
.then(res => {
console.log(res);
;
});
})
},

@ -32,7 +32,7 @@ function touchmHeader(e, ins){
function touchmBody(e, ins){
var changeY = (e.touches[0] || e.changedTouches[0]).pageY - startY;
//console.log(startY, changeY);
;
if(show&&changeY<0){
ins.selectComponent(".course-display").setStyle({
"max-height": (100+changeY)+"px",
@ -51,7 +51,7 @@ function touchmBody(e, ins){
}
function toucheBody(e, ins) {
var changeY = (e.touches[0] || e.changedTouches[0]).pageY - startY;
//console.log(startY, changeY);
;
//if (changeY > 100)
// show = 1;
//else

@ -17,11 +17,11 @@ Page({
eduImgDir:global.config.eduImgDir
},
onImgLoad(e){
console.log("img_loaded",e);
;
this.setData({code_loaded:1});
},
onImgError(e){
console.log("onImgError", e);
;
let page = this.getPageUrl();
let scene = this.getScene();
wx.cloud.callFunction({ name: "openapi", data: { action:"getWXACodeUnlimited", name:"wxacode.getUnlimited", page, scene, data:{page, scene}}})
@ -77,7 +77,7 @@ Page({
})
},
onLoad: function (options) {
console.log("onLoad", options);
;
var course_id;
if(options.course_id)
course_id= options.course_id;
@ -98,7 +98,7 @@ Page({
this.setData({ invite_code_url});
},
onShow:function(options){
console.log("onShow", options)
app.syncUser()
.then(({user})=>{
this.setData({user});

@ -25,15 +25,12 @@ Page({
this.setData({ form_data: this.initial_form_data });
},
create_course: function ({ detail: { value } }) {
console.info(value);
if (this.intent == "create") {
app.callApi({
name:"courses",
config:{method:"POST"},
data:value,
success: res => {
console.info("create course")
console.info(res);
if(!res.course_id){
wx.showToast({
title: '创建失败,请先登录',
@ -54,7 +51,7 @@ Page({
}
},
itemtap: function (e) {
console.log(e);
;
this.setData({
"form_data.school": e.currentTarget.id,
hideScroll: true
@ -67,7 +64,7 @@ Page({
if(this.data.bindSource.length==0){
app.api("schools.school_list")({ search: value })
.then(res => {
console.log(res);
;
const schools = res.school_names;
this.setData({
bindSource: schools,
@ -77,7 +74,7 @@ Page({
this.setData({hideScroll: false});
},
updateSchool: function({detail:{value}}){
console.log("updateSchool");
;
if(!value){
this.setData({
hideScroll: true,
@ -85,7 +82,7 @@ Page({
}else{
app.api("schools.school_list")({ search: value })
.then(res => {
console.log(res);
;
const schools = res.school_names;
this.setData({
hideScroll: false,
@ -98,15 +95,15 @@ Page({
this.setData({ "form_data.name": value });
},
updateEndDate({ detail: { value } }) {
console.log(value);
;
this.setData({ "form_data.end_date": value });
},
onLoad: function (options) {
this.intent = options.intent;
if (this.intent == "create") this.reset();
console.log(options);
console.log(this.intent);
;
;
},
onShow: function () {

@ -14,7 +14,7 @@ Component({
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=>{
@ -22,11 +22,11 @@ Component({
})
},
approval(e){
console.log(e);
;
this.review_application({approval:1});
},
deny(e){
console.log(e);
;
this.review_application({approval:2});
}
}

@ -14,7 +14,7 @@ Page({
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);

@ -10,7 +10,7 @@ Page({
type:"secondary"
},
onScanCode(e){
console.log(e);
;
},
/**
* 生命周期函数--监听页面加载

@ -5,13 +5,13 @@ Component({
data:{
type:Object,
observer: function(data){
//console.log(data);
;
if(data.question_choices){
this.user_answers={};
for(var choice of data.question_choices)
this.user_answers[choice.choice_id] = choice.user_answer_boolean;
}
//console.log(this.user_answers);
;
}
},
exercise_status:Number,
@ -19,37 +19,36 @@ Component({
is_md:Boolean
},
attached(){
console.log(this.data);
;
},
data: {
},
methods: {
triggerAnswer({answered=1}={}){
console.info("trigger answer");
if(this.answered!=answered){
let {question_id, q_position} = this.data.data;
this.triggerEvent("answer", { q_position, question_id, answered}, { bubbles: true});
console.log("triggered");
;
this.answered = answered;
}
},
answer_choice_question: function (e) {
console.log(e, this.data);
;
let { detail: { value }, currentTarget: { dataset } }=e
console.log("answer_question");
console.log(value);
console.log(dataset);
;
;
;
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.api("exercise_questions.exercise_answers")({ question_id: dataset.question_id, exercise_choice_id })
.then(res => {
@ -59,9 +58,9 @@ Component({
} else if (exercise_choice_id) {
answered = 1;
}
console.log(answered);
;
this.triggerAnswer({answered});
console.log("answer_question"); console.log(res);
; ;
if (!Array.isArray(exercise_choice_id))
exercise_choice_id = [exercise_choice_id];
for(var choice of this.data.data.question_choices){
@ -70,18 +69,17 @@ Component({
else
this.user_answers[choice.choice_id]=true;
}
console.log(this.user_answers);
;
})
.catch(e => {
//console.error(e);
let {question_choices} = this.data.data;
question_choices = question_choices.map(i=>{
i.user_answer_boolean = this.user_answers[i.choice_id]
//console.log(this.user_answers[i.choice_id]);
;
return i;
})
this.setData({"data.question_choices":question_choices})
console.log(e);
;
app.showError(e)
});
},

@ -18,19 +18,18 @@ Component({
}
},
answer_main_question: function ({detail: {value}, currentTarget: { dataset } }) {
console.log("answer_main_question");
console.log(value);
console.log(dataset);
;
;
;
app.api("exercise_questions.exercise_answers")({ question_id: dataset.question_id, answer_text: value })
.then(res => {
if (value)
this.triggerAnswer({answered:1});
else
this.triggerAnswer({answered:0});
console.log("answer_main_question"); console.log(res);
; ;
})
.catch(e => {
console.error(e);
app.showError(e);
});
},

@ -5,7 +5,7 @@ Component({
type:Object,
observer:function(data){
this.answers = data.user_answer.map(i=>i.answer_text);
console.log("answers",this.answers);
;
}
},
is_md: Boolean,
@ -32,18 +32,17 @@ Component({
return 0;
},
answer_null_question: function ({ detail: { value }, currentTarget: { dataset:{question_id, exercise_choice_id}} }) {
console.log("answer_main_question");
console.log(value);
console.log(question_id, exercise_choice_id);
;
;
;
app.api("exercise_questions.exercise_answers")({ question_id, exercise_choice_id, answer_text: value })
.then(res => {
this.answers[exercise_choice_id-1] = value;
console.log("answers",this.answers);
;
this.triggerAnswer();
console.log("answer_main_question"); console.log(res);
; ;
})
.catch(e => {
console.error(e);
app.showError(e);
});
},

@ -16,14 +16,14 @@ Page({
},
scrollToQues(e){
let {target: {dataset:{ques_id}}} = e;
console.log(ques_id);
;
if(!ques_id) return;
wx.pageScrollTo({
selector:"#q-"+ques_id
});
},
onAnswer(e){
console.log(e);
;
let {detail:{q_position,answered}} = e;
let key = "question_status[" + (q_position - 1) +"].ques_status"
this.setData({[key]: answered});
@ -96,7 +96,7 @@ Page({
pull_questions: function(){
app.api("exercises.start_answer")({exercise_id: this.exercise_id})
.then(res=>{
console.log("pull questions");
;
this.setData(res);
this.setData({loading: false});
if(this.data.question_status)
@ -114,18 +114,16 @@ Page({
title: '请稍候',
});
}
console.log("保存答案中");
app.callApi({ name:"exercises.begin_commit", data:{exercise_id: this.exercise_id}, complete: wx.hideLoading})
.then(res=>{
console.log("保存答案完成");
console.log(res);
if(show_loading){
wx.showToast({
title: "保存成功",
});
}
}).catch(console.error)
}).catch(e=>{
app.realTimeLog.error(e, "save exercise fail");
})
},
commit_exercise: function(){
//wx.showLoading({title: '检查作答情况中'});
@ -148,8 +146,8 @@ Page({
if(res.confirm){
app.api("exercises.commit_exercise")({exercise_id: this.exercise_id})
.then(res=>{
console.log("交卷");
console.log(res);
;
;
app.showMsg(res);
setTimeout(()=>{
wx.navigateBack({
@ -159,7 +157,6 @@ Page({
})
.catch(e=>{
app.showError(e);
console.error(e);
});
}
}
@ -168,7 +165,6 @@ Page({
})
.catch(e=>{
app.showError(e);
console.error(e);
});
},

@ -9,7 +9,7 @@ Page({
this.exercise_id = options.exercise_id;
app.api("exercises.exercise_lists")({exercise_id: this.exercise_id})
.then(res=>{
console.log(res);
;
this.setData({ grades: res.exercise_users, page_status: 1})
})
},

@ -32,7 +32,7 @@ Page({
app.api("exericses.exercise_result")({ exercise_id: this.exercise_id })
.then(res => {
this.setData({ error: "" })
console.log(res);
;
if (res.commit_results) {
let results = res.commit_results;
for (var result of results) {
@ -50,13 +50,13 @@ Page({
}
}
}
console.log(results);
;
this.setData({ results, page_status: 1 })
}
})
.catch(error => {
console.log(error);
;
this.setData({ error: error.message })
})
},

@ -12,20 +12,16 @@ Page({
},
start_publish: function(){
if (!this.exercise_id) {
console.error("请先保存试卷");
return;
}
console.log({
course_id: this.course_id, exercise_ids: [this.exercise_id],
end_time: getNextWeekFormatDate() + " " + getNowFormatTime()
});
let end_time = getNextWeekFormatDate() + " " + getNowFormatTime();
//end_time = end_time.replace("-11", "-12");
app.api("courses.exercises.publish")({
course_id: this.course_id, check_ids: [this.exercise_id],
end_time: end_time
}).then(res=>{
console.log(res);
;
app.showMsg(res);
wx.navigateBack({
delta: 1
@ -35,7 +31,6 @@ Page({
},
create_question: function(){
if(!this.exercise_id){
console.error("请先保存试卷");
wx.showToast({
title: '请先保存试卷',
icon:"none"
@ -47,33 +42,28 @@ Page({
})
},
create_exercise: function({detail:{value}}){
console.log(value);
;
if(this.exercise_id){
app.api("exercises")({...value, exercise_id: this.exercise_id})
.then(res => {
console.log(res);
;
wx.showToast({
title: res.message,
})
})
.catch(error => {
console.error(error);
wx.showToast({
title: error.message,
icon: "none"
})
.catch(e => {
app.showError(e)
});
}else{
app.api("courses.exercises",{method:"POST"})({ ...value, course_id: this.course_id })
.then(res => {
console.log(res);
;
this.exercise_id = res.exercise_id
wx.showToast({
title: '创建成功',
})
})
.catch(e => {
console.error(e);
app.showError(e);
});
}
@ -90,7 +80,7 @@ Page({
if (this.exercise_id) {
app.api("exercises.edit")({ exercise_id: this.exercise_id })
.then(res => {
console.log(res);
;
this.setData(
{
exercise_questions: res.exercise_questions,

@ -5,7 +5,7 @@ Page({
},
create_question: function({detail:{value}}){
console.log(value);
;
let data = {
question_title:value.question_title,
question_type:0,
@ -16,7 +16,7 @@ Page({
let exercise_bank_id = this.exercise_id;
app.api("exercises.exercise_questions")({exercise_bank_id,...data})
.then(res=>{
console.log(res);
;
wx.navigateBack({
delta: 1
})

@ -87,7 +87,7 @@ export default class Client{
}
}).catch(e => {
console.error("getTidingInfo", e);
});
}
syncUser({refresh=0}={}){
@ -146,13 +146,10 @@ export default class Client{
session, name, config, data: {...this.refresh_key(),...data},
success:res=>{
this.trigger("success",name,res);
console.debug(`EduCoder api ${name} construction:`, getResConstruction(res));
if(success)
success(res)
success&&success(res);
}, fail:e=>{
this.trigger("fail",name,e);
if(fail)
fail(e);
fail&&fail(e);
}, complete,
});
}

@ -3,7 +3,6 @@ import apiConfig from "./apiConfig";
function handler({success, fail, resolve, reject}){
return {
success: res => {
if (res.data.status <=100 ) console.error("!!!api response!!! status==="+res.data.status);
if (res.data.status && res.data.status > 100 || res.data.status<0) {
switch (res.data.status) {
case 401:
@ -23,12 +22,11 @@ function handler({success, fail, resolve, reject}){
resolve(res.data);
},
fail: e => {
console.error(e);
global.realTimeLog.warn(e);
if ("errMsg" in e)
(e = new Error("(⋟﹏⋞)\n网络连接出错了呢")).code = -2;
if (!("message" in e))
(e = new Error("(_)\n出现了未知错误")).code = -1;
console.debug(e);
if (fail) { fail(e); }
reject(e);
}
@ -38,15 +36,14 @@ function handler({success, fail, resolve, reject}){
export default function ({ name, data:_data = {}, session, success, fail, complete, config:{method,header={}}={}}) {
let api = apiConfig;
for (var key of name.split(".")) api=api[key]||console.error(`no api named ${key} in apiList`, api);
for (var key of name.split(".")) api=api[key];
let { url, query={}, form = {}, config:{method:_method,_header={},...config}={}} = api;
method = method || _method;
console.debug(`call EduCoder api ${name}`, api, arguments[0], "require arguments:",form,query);
if(url){
if(url._)
url = url[method||"GET"]||url._;
url = name.replace(/\.?[^\.]+$|\./g, "/") + url.replace(/\{(.*?)\}/, function (match, k) {
return _data[k]||console.error(`${k} was not given in data`, _data)
return _data[k];
}).replace(/\*/g,key);
}else
url = name.replace(/\./g, "/");
@ -83,14 +80,14 @@ export default function ({ name, data:_data = {}, session, success, fail, comple
if(queryStr)
url = url+"?"+queryStr;
if(method=="uploadFile"){
console.log("uploadFile")
var formData = data;
var {name:_name, timeout} = config;
if(!_name)
_name = Object.keys(formData)[0];
var filePath = formData[_name];
delete formData[_name];
console.log({ url, filePath, name: _name, header, timeout, formData});
;
return new Promise((resolve, reject)=>{
session.uploadFile({
url, filePath, name:_name, header, timeout, formData,complete, ...handler({success, fail, resolve, reject})

@ -11,7 +11,6 @@ export default class{
return cookies;
}
request({ url, header, success,...options}) {
console.debug("wx.requests arguments", arguments[0], new Date().getTime());
return wx.request({
...options,
url,
@ -25,8 +24,8 @@ export default class{
this.saveCookies(this.splitCookies(res.header["set-Cookie"]));
success(res);
if(url.indexOf("login.json")!=-1&&!res.data.status&&!this.cookies){
console.error("oh no!!!login fail!!!!");
wx.reportMonitor("0",2);
global.realTimeLog.error(res, "login fail: fail parse cookies!!");
var db = wx.cloud.database();
db.collection("failCookies").add({
data:{
@ -55,7 +54,7 @@ export default class{
}catch(e){
//@todo
}
console.log("uploadFile",res);
;
if(success)
success(res)
},

@ -231,7 +231,7 @@ export function parseUrl({url}){
export function navigateToUrl({url,open_type='navigateTo'}){
url = parseUrl({url});
console.log(url);
;
const app = getApp();
if(url){
app.navigateTo({url});

@ -38,7 +38,7 @@ Page({
this.switch({current});
},
switchTab({ detail: { current, source, value } }) {
//console.log(current, source, value);
;
if (source == "touch") {
this.switch({current});
}

@ -62,7 +62,7 @@ Component({
this.disciplines = [];
app.api("disciplines")({source:"subject"})
.then(res=>{
console.log(res);
;
this.disciplines = res.disciplines;
this.disciplines.unshift({id:"",name:"全部", sub_disciplines:[]});
this.setNavList({disciplines: this.disciplines, key:"list"});

@ -1,15 +1,20 @@
Component({
properties: {
data:Object,
data:{
type:Object,
observer: function(){
this.setData({value:false});
}
},
select: {
type: Boolean,
value: false,
observer: function(v){
//console.log("observer select change", v);
;
if(!v){
this.setData({value: false});
//console.log(this.data);
;
}
}
}

@ -29,16 +29,16 @@ Component({
},
onChange(e){
console.log(e);
;
},
onSelect(e){
let {detail} = e;
console.log(detail);
;
this.selects[detail.name] = detail.value;
if(detail.value&&!this.data.select)
this.setData({select: true});
else if(!detail.value&&!this.data.select){
console.error("!!!!!!!!!!!!!!!");
console.error("something unexpected happens");
}
else if(detail.from=='radio'){
let length = 0;
@ -46,7 +46,7 @@ Component({
if(this.selects[i])
length++;
}
console.log("length", length);
;
if(length==0){
this.setData({select: false});
this.selects = {};
@ -54,12 +54,12 @@ Component({
}
},
onReset(e){
console.log(e, e.detail);
;
this.setData({select:false});
this.selects = {}
},
onSubmit(e){
console.log(e,e.detail);
;
if(!this.data.select)
this.setData({select: true});
else{
@ -68,7 +68,7 @@ Component({
if(this.selects[i])
shixun_ids.push(i);
}
console.log("selected shixuns", shixun_ids);
;
if(shixun_ids.length==0){
wx.showToast({
title: '请选择实训',icon:"none"
@ -81,7 +81,7 @@ Component({
}
},
search(e){
console.log(e)
let {detail:{value}} = e;
if(this.options.keyword!=value){
this.options.keyword = value;
@ -115,6 +115,8 @@ Component({
shixun_list = this.data.shixun_list.concat(shixun_list);
var status = length>0?200:204;
}else{
this.selects = {};
this.setData({select: false});
var status = length>0?200:205;
}
this.setData({ shixun_list, status}, wx.hideNavigationBarLoading);

@ -12,7 +12,7 @@ Page({
auto_attendance: false
},
log(e){
console.log(e);
;
},
enterPage({ target: { dataset: { path } } }) {
if (!path) return;
@ -103,8 +103,6 @@ Page({
this.onShow();
},
fail: error => {
console.error("注销失败");
console.error(error);
if (showToast)
app.showError(e);
}
@ -112,7 +110,7 @@ Page({
},
enter_login: function (event) {
wx.navigateTo({
url: '/account/pages/account/account?action=login', fail: console.error
url: '/account/pages/account/account?action=login'
})
},
showModal: function (event) {
@ -140,8 +138,8 @@ Page({
let { name: show_name, avatar_url: image_url} = res;
if(show_name&&image_url)
app.updateUserInfo({ show_name, image_url});
console.log("get_homepage_info");
console.log(res)
;
this.setData({ user: res })
if (!res.attendance_signed && this.data.auto_attendance)
this.attendance({ show: 0 })
@ -181,6 +179,6 @@ Page({
app.navigateTo({url:"{user_info}"});
},
onShareAppMessage: function () {
console.log(this.route, this.__route__,212121);
;
}
})

@ -48,7 +48,7 @@ Page({
this.switch({current});
},
switchTab({detail:{current, source, value}}){
//console.log(current, source, value);
;
if(source=="touch"){
this.switch({current});
}

@ -40,7 +40,7 @@ Component({
methods: {
showAction(){
let itemList = this.getActions();
//console.log(itemList);
;
let course = this.data.data;
wx.showActionSheet({
itemList,
@ -57,7 +57,7 @@ Component({
var flag = true;
var action = actions[name];
for(var cdt in action.cd){
//console.log(action.cd[cdt],this.data.data[cdt])
if(action.cd[cdt].indexOf(this.data.data[cdt])==-1){
flag=false;
break;
@ -123,12 +123,12 @@ Component({
challenge: this.data.data.id.toString()||"123456",
authContent:"验证身份后删除该课堂",
success:res=>{
console.log("指纹验证成功");
;
success && success();
complete && complete();
},
fail:e=>{
console.log("指纹验证失败");
;
fail && fail({ message: "身份验证失败" });
complete && complete();
}
@ -148,12 +148,12 @@ Component({
wx.showLoading({
title: '删除中'
})
console.log("process delete course");
;
let {id:course_id} = this.data.data;
console.log(course_id)
app.callApi({name:"courses",data:{course_id}, config:{method:"DELETE"},
success:res=>{
console.log("delete course success", res);
;
res.message = "删除成功";
app.showMsg(res);
this.triggerRefresh();
@ -166,7 +166,6 @@ Component({
e.message = "您没有权限";
else if(e.code==404)
e.message = "该课堂已被删除";
console.error(e);
app.showError(e);
}
})
@ -198,7 +197,7 @@ Component({
app.navigateTo({ url: "{course_setting}?course_id" + this.data.data.id });
},
triggerRefresh() {
//console.log("trigger refresh")
this.triggerEvent("refresh", {}, { bubbles: true })
},
}

@ -37,7 +37,7 @@ Component({
},
methods: {
onCategoryChange: function ({ detail: { current, value } }) {
console.log("category change", current);
;
this.options["category"] = value.value;
this.pullCourses({ refresh: 1 });
this.setData({ category: value.value });
@ -66,7 +66,7 @@ Component({
*/
},
enter_course: function (event) {
console.log(event);
;
let { id, course_name } = event.currentTarget.dataset;
wx.navigateTo({
url: "/course/pages/course/course?course_id=" + id + "&course_name=" + course_name,
@ -106,7 +106,7 @@ Component({
this.pullCourses();
},
onPullDownRefresh: function () {
//console.log("pulldownrefresh");
;
this.pullCourses({ refresh: 2 });
},
}

@ -26,7 +26,7 @@ Component({
},
methods: {
onCateChange({detail:{value}}){
console.log(value);
;
this.options.category = value.value
this.pullPaths({refresh:1});
},
@ -79,7 +79,7 @@ Component({
this.pullPaths({refresh:2});
},
onReachBottom(){
console.log("onreachbottom")
if(this.data.status==200)
this.pullPaths({refresh:0});
}

@ -5,7 +5,7 @@ Component({
type:Object,
observer:function(data){
//name, image_url
//console.log(data);
;
this.setData(data);
}
}

@ -26,7 +26,7 @@ Component({
},
methods: {
onCateChange({detail:{value}}){
console.log(value);
;
this.options.category = value.value
this.pullShixuns({refresh:1});
},
@ -79,7 +79,7 @@ Component({
this.pullShixuns({refresh:2});
},
onReachBottom(){
console.log("onreachbottom")
if(this.data.status==200)
this.pullShixuns({refresh:0});
}

@ -6,7 +6,7 @@ Component({
type:Object,
observer:function(data){
//name, image_url
//console.log(data);
;
this.setData(data);
}
}

@ -32,7 +32,7 @@ Page({
this.search({refresh:1});
},
search({refresh=0}={}){
//console.log("search", this.options);
;
if(refresh==1)
this.setData({loading:1});
if(refresh){
@ -47,10 +47,9 @@ Page({
this.options.page++;
var {options} = this;
}
//console.log("search2",options)
return app.api("search")(options)
.then(res=>{
console.error(res);
let {results,count} = res;
if(refresh==1&&results.length==0)
wx.showToast({
@ -61,7 +60,6 @@ Page({
this.setData({count, results, loading:0});
})
.catch(e=>{
console.error(e);
this.setData({loading:0});
})
},

@ -37,10 +37,10 @@ Component({
let route = get(ROUTE,data.belong_container_type,{});
route = get(route, data.container_type,{});
route = get(route, data.homework_type);
console.log(route);
;
if(!route) return;
let url = format(route, data);
console.log("navutl", url);
;
app.navigateTo({url});
}
}

@ -27,7 +27,7 @@ Page({
this.options.page++;
var {options} = this;
}
//console.log(options);
;
return app.api("users.tidings")(options).then(res => {
let {tidings} = res;
if(!refresh)
@ -40,7 +40,7 @@ Page({
},
onLoad: function (options) {
this.options = { page: 1, per_page: 10 };
//console.log(this.options);
;
},
_onReachBottom(){
this.refresh();

@ -18,7 +18,7 @@ Page({
let api_name = is_collect?"collections.cancel":"collections";
app.api(api_name)({container_type:"Subject", container_id:id})
.then(res=>{
console.log(res);
;
this.pullSubject({showLoading:0});
if(is_collect){
res.message = "已取消收藏";
@ -34,7 +34,7 @@ Page({
duration
})
}).catch(e=>{
//console.log(e);
;
app.showError(e);
})
},
@ -46,7 +46,7 @@ Page({
this.pullSubject();
},
onEnterShixun(e){
console.log(e.currentTarget);
;
let {currentTarget:{dataset:{allow_visit}}} = e;
if(!allow_visit)
wx.showToast({
@ -72,7 +72,7 @@ Page({
}).catch(e=>{
if(e.code==403)
e.message = "您没有权限访问"
console.log(e);
;
wx.hideLoading();
app.showError(e);
})
@ -80,7 +80,7 @@ Page({
onShareAppMessage: function () {
//console.log(global.config.apiRoot , this.data.subject.cover )
let {subject} = this.data;
return app.shareApp({
title: subject.name,

@ -2,9 +2,9 @@ var top = 190;
function scroll(e, ins){
//var scrollTop = e.detail.scrollTop;
var deltaY = e.detail.deltaY;
//console.log(scrollTop);
//console.log(show,scrollTop<122);
//console.log(top,scrollTop, deltaY);
;
;
;
if(deltaY<-4){
ins.callMethod("scrollTo", { scrollTop: top });
}

@ -18,7 +18,7 @@ Page({
let api_name = is_collect?"collections.cancel":"collections";
app.api(api_name)({container_type:"Shixun", container_id:id})
.then(res=>{
console.log(res);
;
this.pullShixun({showLoading: 0});
if(is_collect){
res.message = "已取消收藏";
@ -34,7 +34,7 @@ Page({
duration
})
}).catch(e=>{
//console.log(e);
;
app.showError(e);
})
},
@ -51,7 +51,7 @@ Page({
});
},
scrollTo({scrollTop}){
//console.log(scrollTop);
;
wx.pageScrollTo({scrollTop,duration:200})
},
switchNav({detail:{current,source}}){

@ -2,9 +2,9 @@ var top = 140;
function scroll(e, ins){
//var scrollTop = e.detail.scrollTop;
var deltaY = e.detail.deltaY;
//console.log(scrollTop);
//console.log(show,scrollTop<122);
//console.log(top,scrollTop, deltaY);
;
;
;
if(deltaY<0){
ins.callMethod("scrollTo", { scrollTop: top });
}

@ -16,12 +16,12 @@ Component({
},
methods: {
analyse(){
//console.log(this.data);
;
let {output="",actual_output=""} = this.data.data;
//console.log(this.data,actual_output,output);
;
output = output||"";
actual_output = actual_output||"";
console.log(this.data, actual_output, output);
;
var outputs = output.split(/\n/).map(i=>({text:i}));
var actual_outputs = actual_output.split(/\n/).map(i=>({text:i}));
var lines = Math.min(outputs.length, actual_outputs.length);
@ -31,7 +31,7 @@ Component({
}
}
this.setData({outputs, actual_outputs});
//console.log(outputs);
;
},
scroll1({scrollTop1}){
this.setData({scrollTop1});

@ -3,22 +3,22 @@ function scroll1(e,ins){
if(touch==1){
var scrollTop = e.detail.scrollTop;
ins.callMethod("scroll2", { scrollTop2: scrollTop});
//console.log("scroll2");
;
}
}
function scroll2(e, ins) {
if(touch==2){
var scrollTop = e.detail.scrollTop;
ins.callMethod("scroll1", { scrollTop1: scrollTop });
//console.log("scroll1");
;
}
}
function touch1(e,ins){
//console.log("touch1");
;
touch = 1;
}
function touch2(e, ins) {
//console.log("touch2");
;
touch = 2;
}

@ -10,11 +10,11 @@ Page({
can_use_editor:wx.canIUse("editor")
},
/*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)
@ -54,7 +54,7 @@ Page({
}
},
switchTheme({detail}){
console.log(detail);
;
let {value} = detail;
let theme = value?'dark':'light';
if(theme==this.data.theme)
@ -66,7 +66,7 @@ Page({
},
enterTask(e){
var {target:{dataset:{identifier}}} = e;
console.log(e);
;
if(identifier)
wx.redirectTo({url:"./task?identifier="+identifier});
},
@ -95,7 +95,7 @@ Page({
},
onEditorInput(e){
let {text} = e.detail;
//console.log(e.detail.text);
;
this.modified = this.content!=text;
if(this.modified){
this.content = text;
@ -115,7 +115,7 @@ Page({
}
},
onEditorBlur({detail}){
//console.log("onEditorBlur")
let {text} = detail;
if(!this.modified){
this.modified = this.content.trimEnd()!=text.trimEnd();
@ -141,11 +141,11 @@ Page({
return res;
}catch(e){
this.modified = true;
throw new Error();
global.realTimeLog.error(e, "fail: update code file fail");
throw new Error(e.message);
}
},
buildGame({detail:{value}}){
//console.log("buildGame");
wx.showLoading({
title: '代码上传中',
});
@ -163,12 +163,11 @@ Page({
.catch(e=>{
wx.hideLoading();
this.setData({ building: 0 })
console.error(e);
global.realTimeLog.error(e, "fail: build game fail");
})
}).catch(e=>{
wx.hideLoading();
this.setData({building:0})
console.error(e);
this.setData({building:0});
})
},
@ -191,7 +190,7 @@ Page({
}, 1000);
},
onSwiperChange(e){
//console.log(e);
;
let {detail:{current,source}} = e;
if(source=="touch"){
this.setData({current});
@ -216,7 +215,7 @@ Page({
},
async pullContent(){
//console.log("pullContent", this.editor);
;
let {path} = this.data.challenge;
path = this.processPath(path);
let {identifier} = this.data;
@ -234,22 +233,22 @@ Page({
}
}else
this.setData({content});
//console.log("pullContent");
;
},
onEditorReady({pullContent=0}={}) {
//console.log("editor-ready")
const that = this
wx.createSelectorQuery().select('#code-editor').context(function (res) {
that.editor = res.context
if(pullContent&&that.editor)
that.pullContent();
//that.editor.insertText({text:that.content});
//console.log("exced",res,that.editor);
;
}).exec();
//console.log("redy-fin",this.editor)
},
onLoad: function (options) {
//console.log("onload")
let theme = wx.getStorageSync('config-task-theme');
this.setData({theme});
this.setNavigationTheme();

Loading…
Cancel
Save