D 调试输出

master
educoder_weapp 5 years ago
parent d7a7746840
commit 76c4242bc1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -53,7 +53,7 @@ Component({
}, },
methods: { methods: {
choose: function choose(e) { choose: function choose(e) {
console.log("choose",e); ;
var item = e.target.dataset.item; var item = e.target.dataset.item;
this.triggerEvent('choose', { item: item }); this.triggerEvent('choose', { item: item });
}, },
@ -63,7 +63,7 @@ Component({
_scrollTo: function _scrollTo(e) { _scrollTo: function _scrollTo(e) {
var data = this.data; var data = this.data;
var clientY = e.changedTouches[0].clientY; var clientY = e.changedTouches[0].clientY;
//console.log(clientY); ;
var index = Math.floor((clientY - data._anchorTop) / data._anchorItemH); var index = Math.floor((clientY - data._anchorTop) / data._anchorItemH);
if(index<0||index>=data.alphabet.length) if(index<0||index>=data.alphabet.length)
return; return;
@ -82,13 +82,13 @@ Component({
query.select('.anchor-list').boundingClientRect(function (rect) { query.select('.anchor-list').boundingClientRect(function (rect) {
data._anchorItemH = rect.height / data.alphabet.length; data._anchorItemH = rect.height / data.alphabet.length;
data._anchorTop = rect.top; data._anchorTop = rect.top;
//console.log("select anchor list"); ;
}); });
query.exec(res=>{ query.exec(res=>{
data._tops = res[0].map(function (item) { data._tops = res[0].map(function (item) {
return item.top-res[1].top; return item.top-res[1].top;
}); });
//console.log(res); ;
}); });
}, },
removeTouching: function removeTouching() { removeTouching: function removeTouching() {
@ -107,7 +107,7 @@ Component({
var data = this.data; var data = this.data;
var _tops = data._tops, var _tops = data._tops,
alphabet = data.alphabet; alphabet = data.alphabet;
//console.log("scroll", e.detail, this.data); ;
var pageTop = e.detail.scrollTop; var pageTop = e.detail.scrollTop;
var current = ''; var current = '';
if (pageTop < _tops[0]) { if (pageTop < _tops[0]) {

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

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

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

@ -59,7 +59,7 @@ Component({
data.color = config.color; data.color = config.color;
data.time = data.created_at.replace(/^.+ /,""); data.time = data.created_at.replace(/^.+ /,"");
this.setData(data); this.setData(data);
//console.log(data); ;
} }
}, },
course_identity:Number, course_identity:Number,
@ -71,10 +71,10 @@ Component({
}, },
methods: { methods: {
onTap(){ onTap(){
//console.log(this.config); ;
let url = this.config.url; let url = this.config.url;
let cd = this.config.cd; let cd = this.config.cd;
//console.log(url, cd); ;
if(!url) return; if(!url) return;
if(cd){ if(cd){
for(var i of cd){ for(var i of cd){
@ -83,7 +83,7 @@ Component({
} }
} }
url = format(url, this.data); url = format(url, this.data);
console.log(url, this.data); ;
app.navigateTo({url}); app.navigateTo({url});
} }
} }

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

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

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

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

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

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

@ -14,12 +14,12 @@ Component({
delete(){ delete(){
let {course_id} = this.data.ext; let {course_id} = this.data.ext;
let {course_member_id} = this.data.data; let {course_member_id} = this.data.data;
//console.log(course_id, course_member_id); ;
let students = [{course_member_id}]; let students = [{course_member_id}];
app.api("courses.delete_from_course")({course_id,students}) app.api("courses.delete_from_course")({course_id,students})
.then(res=>{ .then(res=>{
this.triggerEvent("delete",{},{bubbles:true,composed:true}); this.triggerEvent("delete",{},{bubbles:true,composed:true});
//console.log(res); ;
//res.message='删除成功'; //res.message='删除成功';
app.showMsg(res); app.showMsg(res);
}).catch(e=>{ }).catch(e=>{
@ -27,7 +27,7 @@ Component({
}) })
}, },
onButtonTap(e){ onButtonTap(e){
//console.log(e,this.data); ;
wx.showModal({ wx.showModal({
title:"提示", title:"提示",
content:"确认删除所选学生吗?", content:"确认删除所选学生吗?",

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

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

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

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

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

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

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

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

@ -14,7 +14,7 @@ Component({
app.api("courses.teacher_application_review")({course_id, approval, application_id, user_id}) app.api("courses.teacher_application_review")({course_id, approval, application_id, user_id})
.then(res=>{ .then(res=>{
this.triggerEvent("review",{},{bubbles:true}); this.triggerEvent("review",{},{bubbles:true});
console.log(res); ;
res.message = approval==1?'已同意':approval==2?'已拒绝':res.message; res.message = approval==1?'已同意':approval==2?'已拒绝':res.message;
app.showMsg(res); app.showMsg(res);
}).catch(e=>{ }).catch(e=>{
@ -22,11 +22,11 @@ Component({
}) })
}, },
approval(e){ approval(e){
console.log(e); ;
this.review_application({approval:1}); this.review_application({approval:1});
}, },
deny(e){ deny(e){
console.log(e); ;
this.review_application({approval:2}); this.review_application({approval:2});
} }
} }

@ -14,7 +14,7 @@ Page({
let {course_id} = this.data; let {course_id} = this.data;
app.api("courses.apply_teachers")({course_id}) app.api("courses.apply_teachers")({course_id})
.then(res=>{ .then(res=>{
console.log(res); ;
this.setData(res); this.setData(res);
}).catch(e=>{ }).catch(e=>{
app.showError(e); app.showError(e);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -27,7 +27,7 @@ Page({
this.options.page++; this.options.page++;
var {options} = this; var {options} = this;
} }
//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)
@ -40,7 +40,7 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
this.options = { page: 1, per_page: 10 }; this.options = { page: 1, per_page: 10 };
//console.log(this.options); ;
}, },
_onReachBottom(){ _onReachBottom(){
this.refresh(); this.refresh();

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

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

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

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

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

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

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

Loading…
Cancel
Save