diff --git a/miniprogram/app.js b/miniprogram/app.js index cf473a2..5483d1e 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -161,6 +161,23 @@ App({ navigateTo({ url, success, fail, complete }) { wx.navigateTo({ url: this.getPageUrl(url), success, fail, complete }) }, + checkLogin({showModal=1, content="您需要登陆后才能使用该功能"}={}){ + if(client.user.user_id==2){ + if(showModal){ + wx.showModal({ + confirmText:"现在登录", + title:"提示", + content, + success:res=>{ + if(res.confirm) + app.navigateTo({url:"{account}"}) + } + }) + } + return false; + }else + return true; + }, shareApp({ imageUrl, path, title }) { return { title: title || "EduCoder教学", diff --git a/miniprogram/components/modal/join-course/join-course.js b/miniprogram/components/modal/join-course/join-course.js index 110bc0d..8f88e4c 100644 --- a/miniprogram/components/modal/join-course/join-course.js +++ b/miniprogram/components/modal/join-course/join-course.js @@ -33,7 +33,7 @@ Component({ methods: { onShowChange(value){ if(value){ - if(!this.checkLogin()||!this.checkProfile()){ + if(!app.checkLogin({content:"您需要登录后才能加入课堂"})||!this.checkProfile()){ value = false; this.setData({show: false}); } @@ -51,21 +51,6 @@ Component({ this.setData({showDialog: value}); } }, - checkLogin(){ - if(app.user().user_id==2){ - wx.showModal({ - title:"提示", - content:"您需要登录后才能加入课堂", - confirmText:"现在登录", - success: res=>{ - if(res.confirm) - app.navigateTo({url:"{account}"}); - } - }) - return false; - } - return true; - }, checkProfile(){ if(app.user().profile_completed) return true; diff --git a/miniprogram/markdown/path/path/path.js b/miniprogram/markdown/path/path/path.js index 562178c..1316eb4 100644 --- a/miniprogram/markdown/path/path/path.js +++ b/miniprogram/markdown/path/path/path.js @@ -14,14 +14,14 @@ Page({ } }, enterSend(){ - if(app.user().user_id==2) - return wx.showToast({ - title: '登录后才能操作哦',icon:"none" - }); + if(!app.checkLogin()) + return; let {id} = this.data.subject; app.navigateTo({url:"{path_send}?subject_id="+id}); }, collect(){ + if(!app.checkLogin()) + return; let {id, is_collect} = this.data.subject; let api_name = is_collect?"collections.cancel":"collections"; app.api(api_name)({container_type:"Subject", container_id:id}) diff --git a/miniprogram/markdown/shixun/shixun/shixun.js b/miniprogram/markdown/shixun/shixun/shixun.js index cbfd989..5babf21 100644 --- a/miniprogram/markdown/shixun/shixun/shixun.js +++ b/miniprogram/markdown/shixun/shixun/shixun.js @@ -11,13 +11,18 @@ Page({ list:[ {text:"简介"},{text:"任务"} ], + attachDir:global.config.attachDir, description:"" }, sendToCourse(){ + if(!app.checkLogin()) + return; let {id} = this.data.shixun; this.setData({shixun_ids: [id], showSendDialog: true}); }, collect(){ + if(!app.checkLogin()) + return; let {id, is_collect} = this.data.shixun; let api_name = is_collect?"collections.cancel":"collections"; app.api(api_name)({container_type:"Shixun", container_id:id}) @@ -42,6 +47,8 @@ Page({ }) }, enterChallenge(){ + if(!app.checkLogin()) + return; wx.showLoading({ title: '开启中', }); diff --git a/miniprogram/markdown/shixun/shixun/shixun.json b/miniprogram/markdown/shixun/shixun/shixun.json index 59344cc..4f5f859 100644 --- a/miniprogram/markdown/shixun/shixun/shixun.json +++ b/miniprogram/markdown/shixun/shixun/shixun.json @@ -1,7 +1,6 @@ { "usingComponents": { "rich-md":"/markdown/components/rich-md/rich-md", - "require-login":"/components/require-login/require-login", "challenge-item":"./challenge-item/challenge-item", "nav-bar":"/components/nav-bar/nav-bar", "send-to-course":"/components/modal/send-to-course/send-to-course" diff --git a/miniprogram/markdown/shixun/shixun/shixun.wxml b/miniprogram/markdown/shixun/shixun/shixun.wxml index fcbf7ca..cfedf2e 100644 --- a/miniprogram/markdown/shixun/shixun/shixun.wxml +++ b/miniprogram/markdown/shixun/shixun/shixun.wxml @@ -19,7 +19,13 @@ - + + + 点击使用EduCoder云网实战 + @@ -48,4 +54,4 @@ - \ No newline at end of file + diff --git a/miniprogram/markdown/shixun/shixun/shixun.wxs b/miniprogram/markdown/shixun/shixun/shixun.wxs index abe14ec..24e26d0 100644 --- a/miniprogram/markdown/shixun/shixun/shixun.wxs +++ b/miniprogram/markdown/shixun/shixun/shixun.wxs @@ -1,10 +1,8 @@ -var top = 140; +var top = 172; function scroll(e, ins){ //var scrollTop = e.detail.scrollTop; var deltaY = e.detail.deltaY; - ; - ; - ; + if(deltaY<0){ ins.callMethod("scrollTo", { scrollTop: top }); } diff --git a/miniprogram/markdown/shixun/shixun/shixun.wxss b/miniprogram/markdown/shixun/shixun/shixun.wxss index 490ccfb..76b4061 100644 --- a/miniprogram/markdown/shixun/shixun/shixun.wxss +++ b/miniprogram/markdown/shixun/shixun/shixun.wxss @@ -54,6 +54,15 @@ border-radius: 10px; border-left: 5px solid #00b0f0; } +.nav-educoder{ + padding: 6px; + text-align: center; + font-size: 12px; +} +.nav-educoder>.icon{ + height: 20px; + width: 20px; +} .cate-name{ padding: 0 10px; } diff --git a/miniprogram/markdown/task/task/task.wxml b/miniprogram/markdown/task/task/task.wxml index d379297..95429d3 100644 --- a/miniprogram/markdown/task/task/task.wxml +++ b/miniprogram/markdown/task/task/task.wxml @@ -8,15 +8,16 @@ 第{{challenge.position}}关:{{challenge.subject}} - - - + - 用EduCoder云网实训(推荐) + 用EduCoder云网实战(推荐) 黑暗模式 diff --git a/miniprogram/pages/tidings/tidings.wxml b/miniprogram/pages/tidings/tidings.wxml index 3ba9407..85654bb 100644 --- a/miniprogram/pages/tidings/tidings.wxml +++ b/miniprogram/pages/tidings/tidings.wxml @@ -1,7 +1,7 @@ - + diff --git a/project.config.json b/project.config.json index f1ffc71..3c84f9a 100644 --- a/project.config.json +++ b/project.config.json @@ -232,6 +232,14 @@ "id": -1, "name": "admin/pages/page_history/page_history", "pathName": "admin/pages/page_history/page_history", + "query": "", + "scene": null + }, + { + "id": -1, + "name": "markdown/shixun/shixun/shixun", + "pathName": "markdown/shixun/shixun/shixun", + "query": "identifier=tb7hw62n", "scene": null } ]