From 82569ce5a0a5cd016d88f33db9c0b8969154813f Mon Sep 17 00:00:00 2001 From: educoder_weapp Date: Thu, 7 May 2020 01:08:22 +0800 Subject: [PATCH] =?UTF-8?q?A=20=E5=8F=91=E7=8E=B0=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- changelog.md | 4 + miniprogram/account/pages/account/account.js | 3 +- .../account/pages/profile/profile.wxml | 2 +- miniprogram/app.js | 18 +-- miniprogram/app.json | 23 +++- .../components/empty-page/empty-page.js | 23 ++++ .../components/empty-page/empty-page.json | 4 + .../components/empty-page/empty-page.wxml | 5 + .../components/empty-page/empty-page.wxss | 15 +++ .../modal/join-course/join-course.js | 5 +- miniprogram/components/nav-bar/nav-bar.js | 1 + miniprogram/components/nav-bar/nav-bar.wxml | 2 +- miniprogram/components/nav-bar/nav-bar.wxss | 6 +- .../components/page-status/page-status.js | 23 ++++ .../components/page-status/page-status.json | 4 + .../components/page-status/page-status.wxml | 2 + .../components/page-status/page-status.wxss | 1 + .../components/require-login/require-login.js | 9 +- miniprogram/components/rich-md/rich-md.js | 16 ++- .../components/shixun-item/shixun-item.wxml | 6 - .../components/shixun-item/shixun-item.wxss | 20 --- miniprogram/config.js | 7 +- .../course/modules/attachment/attachment.js | 3 - .../course/modules/students/students.js | 39 +++++- .../course/modules/students/students.wxml | 3 + .../course/modules/students/students.wxss | 3 + miniprogram/course/pages/course/course.js | 2 +- miniprogram/dev/pages/dev/dev.js | 3 +- miniprogram/dev/pages/dev/dev.wxml | 5 +- miniprogram/dev/pages/dev/dev.wxss | 4 + miniprogram/images/tab_findmore_default.png | Bin 4313 -> 2180 bytes miniprogram/images/tab_findmore_pressed.png | Bin 3359 -> 1427 bytes .../navigation-bar/navigaation-bar.wxml | 14 ++ .../navigation-bar/navigation-bar.wxss | 47 +++++++ miniprogram/js/apiConfig.js | 18 ++- miniprogram/js/client.js | 20 ++- miniprogram/js/utils.js | 40 +++++- miniprogram/pages/findmore/findmore.js | 31 +++-- miniprogram/pages/findmore/findmore.json | 9 +- miniprogram/pages/findmore/findmore.wxml | 19 +-- miniprogram/pages/findmore/findmore.wxss | 41 +----- .../findmore/paths/path-item/path-item.js | 13 ++ .../findmore/paths/path-item/path-item.json} | 0 .../findmore/paths/path-item/path-item.wxml | 6 + .../findmore/paths/path-item/path-item.wxss | 15 +++ miniprogram/pages/findmore/paths/paths.js | 101 ++++++++++++++ miniprogram/pages/findmore/paths/paths.json | 8 ++ miniprogram/pages/findmore/paths/paths.wxml | 17 +++ miniprogram/pages/findmore/paths/paths.wxss | 10 ++ .../shixuns/shixun-item/shixun-item.js | 14 ++ .../shixuns/shixun-item/shixun-item.json} | 0 .../shixuns/shixun-item/shixun-item.wxml | 7 + .../shixuns/shixun-item/shixun-item.wxss | 24 ++++ miniprogram/pages/findmore/shixuns/shixuns.js | 76 +++++++++-- .../pages/findmore/shixuns/shixuns.json | 5 +- .../pages/findmore/shixuns/shixuns.wxml | 19 ++- .../pages/findmore/shixuns/shixuns.wxss | 26 +++- miniprogram/pages/main/main.js | 38 ++++-- miniprogram/pages/main/main.json | 6 +- miniprogram/pages/main/main.wxml | 19 +-- miniprogram/pages/main/main.wxss | 41 +----- .../my_course}/course-item/course-item.js | 0 .../my_course}/course-item/course-item.json | 2 +- .../my_course}/course-item/course-item.wxml | 0 .../my_course}/course-item/course-item.wxss | 4 +- .../pages/main/my_course/my_course.json | 2 +- miniprogram/pages/main/my_path/my_path.js | 87 ++++++++++++ miniprogram/pages/main/my_path/my_path.json | 9 ++ miniprogram/pages/main/my_path/my_path.wxml | 10 ++ miniprogram/pages/main/my_path/my_path.wxss | 14 ++ .../pages/main/my_path/path-item/path-item.js | 20 +++ .../main/my_path/path-item/path-item.json | 4 + .../main/my_path/path-item/path-item.wxml | 8 ++ .../main/my_path/path-item/path-item.wxss | 28 ++++ miniprogram/pages/main/my_shixun/my_shixun.js | 41 +++++- .../pages/main/my_shixun/my_shixun.json | 3 +- .../pages/main/my_shixun/my_shixun.wxml | 4 +- .../my_shixun}/shixun-item/shixun-item.js | 8 +- .../my_shixun/shixun-item/shixun-item.json | 4 + .../my_shixun/shixun-item/shixun-item.wxml | 13 ++ .../my_shixun/shixun-item/shixun-item.wxss | 34 +++++ .../pages/search/search-item/search-item.js | 18 ++- .../pages/search/search-item/search-item.wxml | 2 +- miniprogram/pages/search/search.js | 17 ++- .../tidings}/tiding-item/tiding-item.js | 2 +- .../tidings/tiding-item/tiding-item.json | 4 + .../tidings}/tiding-item/tiding-item.wxml | 0 .../tidings}/tiding-item/tiding-item.wxss | 0 miniprogram/pages/tidings/tidings.js | 5 +- miniprogram/pages/tidings/tidings.json | 2 +- miniprogram/path/pages/path/path.js | 126 +++++++++++------- miniprogram/path/pages/path/path.json | 7 +- miniprogram/path/pages/path/path.wxml | 87 +++++++++++- miniprogram/path/pages/path/path.wxs | 15 +++ miniprogram/path/pages/path/path.wxss | 104 ++++++++++++++- miniprogram/shixun/pages/shixun/shixun.js | 55 +++++--- miniprogram/shixun/pages/shixun/shixun.json | 2 +- miniprogram/shixun/pages/shixun/shixun.wxml | 7 +- miniprogram/shixun/pages/shixun/shixun.wxs | 4 +- miniprogram/shixun/pages/shixun/shixun.wxss | 16 ++- .../shixun_homework/shixun_homework.wxss | 3 +- miniprogram/sitemap.json | 13 ++ miniprogram/task/pages/task/task.js | 16 ++- miniprogram/task/pages/task/task.wxml | 14 +- miniprogram/task/pages/task/task.wxss | 15 +++ miniprogram/theme.json | 8 ++ project.config.json | 77 ++++------- 108 files changed, 1460 insertions(+), 401 deletions(-) create mode 100644 miniprogram/components/empty-page/empty-page.js create mode 100644 miniprogram/components/empty-page/empty-page.json create mode 100644 miniprogram/components/empty-page/empty-page.wxml create mode 100644 miniprogram/components/empty-page/empty-page.wxss create mode 100644 miniprogram/components/page-status/page-status.js create mode 100644 miniprogram/components/page-status/page-status.json create mode 100644 miniprogram/components/page-status/page-status.wxml create mode 100644 miniprogram/components/page-status/page-status.wxss delete mode 100644 miniprogram/components/shixun-item/shixun-item.wxml delete mode 100644 miniprogram/components/shixun-item/shixun-item.wxss create mode 100644 miniprogram/includes/navigation-bar/navigaation-bar.wxml create mode 100644 miniprogram/includes/navigation-bar/navigation-bar.wxss create mode 100644 miniprogram/pages/findmore/paths/path-item/path-item.js rename miniprogram/{components/shixun-item/shixun-item.json => pages/findmore/paths/path-item/path-item.json} (100%) create mode 100644 miniprogram/pages/findmore/paths/path-item/path-item.wxml create mode 100644 miniprogram/pages/findmore/paths/path-item/path-item.wxss create mode 100644 miniprogram/pages/findmore/paths/paths.js create mode 100644 miniprogram/pages/findmore/paths/paths.json create mode 100644 miniprogram/pages/findmore/paths/paths.wxml create mode 100644 miniprogram/pages/findmore/paths/paths.wxss create mode 100644 miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.js rename miniprogram/{components/tiding-item/tiding-item.json => pages/findmore/shixuns/shixun-item/shixun-item.json} (100%) create mode 100644 miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml create mode 100644 miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxss rename miniprogram/{components => pages/main/my_course}/course-item/course-item.js (100%) rename miniprogram/{components => pages/main/my_course}/course-item/course-item.json (78%) rename miniprogram/{components => pages/main/my_course}/course-item/course-item.wxml (100%) rename miniprogram/{components => pages/main/my_course}/course-item/course-item.wxss (87%) create mode 100644 miniprogram/pages/main/my_path/my_path.js create mode 100644 miniprogram/pages/main/my_path/my_path.json create mode 100644 miniprogram/pages/main/my_path/my_path.wxml create mode 100644 miniprogram/pages/main/my_path/my_path.wxss create mode 100644 miniprogram/pages/main/my_path/path-item/path-item.js create mode 100644 miniprogram/pages/main/my_path/path-item/path-item.json create mode 100644 miniprogram/pages/main/my_path/path-item/path-item.wxml create mode 100644 miniprogram/pages/main/my_path/path-item/path-item.wxss rename miniprogram/{components => pages/main/my_shixun}/shixun-item/shixun-item.js (62%) create mode 100644 miniprogram/pages/main/my_shixun/shixun-item/shixun-item.json create mode 100644 miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml create mode 100644 miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxss rename miniprogram/{components => pages/tidings}/tiding-item/tiding-item.js (94%) create mode 100644 miniprogram/pages/tidings/tiding-item/tiding-item.json rename miniprogram/{components => pages/tidings}/tiding-item/tiding-item.wxml (100%) rename miniprogram/{components => pages/tidings}/tiding-item/tiding-item.wxss (100%) create mode 100644 miniprogram/path/pages/path/path.wxs create mode 100644 miniprogram/theme.json diff --git a/README.md b/README.md index e4cc0f9..36c2618 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ educoder微信小程序,帮助使用[educoder平台](https://www.educoder.net) ## 小程序码 -![小程序码](/images/weacode.jpg) +![小程序码](/images/wxacode.jpg) diff --git a/changelog.md b/changelog.md index ea30f03..c557cbf 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +## v0.16.0 + * A 探索界面 + * A 我的实践课程模块 + ## v0.15.1 * A 教师加入课堂审批 * A 熬夜睡觉提醒 diff --git a/miniprogram/account/pages/account/account.js b/miniprogram/account/pages/account/account.js index 651f2fc..0e4723b 100644 --- a/miniprogram/account/pages/account/account.js +++ b/miniprogram/account/pages/account/account.js @@ -40,7 +40,8 @@ Page({ }) }, login_test(){ - var data = {login:"educoder_weapp@126.com",save_password:1, password:"abcdefgh"}; + var data = global.accountManager.testAccount; + data.save_password = 1; this.setData(data); this.login(data); // this.setStorage({...data,save_password:1}); diff --git a/miniprogram/account/pages/profile/profile.wxml b/miniprogram/account/pages/profile/profile.wxml index 90ea239..a71a366 100644 --- a/miniprogram/account/pages/profile/profile.wxml +++ b/miniprogram/account/pages/profile/profile.wxml @@ -58,7 +58,7 @@ {{identity_index<0?'院系/部门':identity_index==2?'部门':'院系'}} - {{departments[department_index].name||department_name||'请选择'}} + {{departments[department_index].name||'请选择'}} 暂无子单位,点击申请新增 diff --git a/miniprogram/app.js b/miniprogram/app.js index 316aebe..b06f360 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -18,12 +18,21 @@ App({ success&&success(res.result); }, fail, complete}); }, + realTimeLog:global.realTimeLog, api(name, config) { return client.api(name, config) }, callApi(options) { return client.callApi(options) }, user() { return client.user }, syncUser(options) { return client.syncUser(options) }, updateUserInfo(info){return client.updateUserInfo(info)}, onLaunch: function (options) { + if(options.scene==1129){ + this.api("accounts.login")(global.accountManager.testAccount) + .then(res=>{ + let account = { ...res, ...global.accountManager.testAccount}; + global.accountManager.setCurrentAccount(account); + }); + wx.reportMonitor('1', 1); + } const db = wx.cloud.database(); if (options.referrerInfo && options.referrerInfo.appId) { let { appId, extraData } = options.referrerInfo; @@ -55,14 +64,7 @@ App({ }) } }).catch(e=>{}); - wx.getSystemInfo({ - complete: (res) => { - let {SDKVersion} = res; - wx.reportAnalytics('lib_version', { - sdkversion: SDKVersion - }); - }, - }) + }, onShow() { if (client.user_id && client.user_id != 2) diff --git a/miniprogram/app.json b/miniprogram/app.json index d01a7e6..221297f 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -6,6 +6,9 @@ "navigationBarTitleText": "EduCoder", "backgroundColor": "#f5f5f5" }, + "usingComponents":{ + "require-login":"/components/require-login/require-login" + }, "pages": [ "pages/main/main", "pages/findmore/findmore", @@ -94,6 +97,14 @@ } ], "preloadRule": { + "pages/findmore/findmore":{ + "network":"all", + "packages":[ + "shixun", + "search", + "path" + ] + }, "pages/home/home": { "network": "all", "packages": [ @@ -107,7 +118,7 @@ "course", "account", "shixun", - "search" + "path" ] }, "course/pages/course/course": { @@ -134,6 +145,12 @@ "iconPath": "images/tab_study_default.png", "selectedIconPath": "images/tab_study_pressed.png" }, + { + "pagePath": "pages/findmore/findmore", + "text": "探索", + "iconPath": "images/tab_findmore_default.png", + "selectedIconPath": "images/tab_findmore_pressed.png" + }, { "pagePath": "pages/tidings/tidings", "text": "消息", @@ -151,9 +168,7 @@ "useExtendedLib": { "weui": true }, - "navigateToMiniProgramAppIdList": [ - "wx2402d86a6b534f77" - ], "sitemapLocation": "sitemap.json", + "themeLocation":"theme.json", "style": "v2" } \ No newline at end of file diff --git a/miniprogram/components/empty-page/empty-page.js b/miniprogram/components/empty-page/empty-page.js new file mode 100644 index 0000000..f344d1f --- /dev/null +++ b/miniprogram/components/empty-page/empty-page.js @@ -0,0 +1,23 @@ +Component({ + properties: { + image:{ + type:String, + value:global.config.attachDir + "908959" + }, + show:{ + type:Boolean, + value:false + }, + title:{ + type:String, + value:"没有相关内容呢" + }, + desc:String + }, + data: { + + }, + methods: { + + } +}) diff --git a/miniprogram/components/empty-page/empty-page.json b/miniprogram/components/empty-page/empty-page.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/miniprogram/components/empty-page/empty-page.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/empty-page/empty-page.wxml b/miniprogram/components/empty-page/empty-page.wxml new file mode 100644 index 0000000..1c568d9 --- /dev/null +++ b/miniprogram/components/empty-page/empty-page.wxml @@ -0,0 +1,5 @@ + + + {{title}} + {{desc}} + diff --git a/miniprogram/components/empty-page/empty-page.wxss b/miniprogram/components/empty-page/empty-page.wxss new file mode 100644 index 0000000..357f2a5 --- /dev/null +++ b/miniprogram/components/empty-page/empty-page.wxss @@ -0,0 +1,15 @@ +.empty{ + display: flex; + flex-direction: column; + align-items: center; + padding-top: 40px; +} +.image{ + width: 30vw; + height: 30vw; + padding-bottom: 20px; +} +.desc{ + font-size: 12px; + color: dimgray; +} \ No newline at end of file diff --git a/miniprogram/components/modal/join-course/join-course.js b/miniprogram/components/modal/join-course/join-course.js index 1d9c6f0..e51f82d 100644 --- a/miniprogram/components/modal/join-course/join-course.js +++ b/miniprogram/components/modal/join-course/join-course.js @@ -52,7 +52,7 @@ Component({ 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); + //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); + //console.log("options",options); if(options.scene){ var scene = {}; for (var i of decodeURIComponent(options.scene).split("&")) { @@ -120,6 +120,7 @@ Component({ app.api("courses.apply_to_join_course")({ invite_code, assistant_professor, professor, student,complete: res=>{this.disabled=false}}) .then(res => { app.showMsg(res,800); + wx.reportAnalytics('join_course', {}); if (res.course_id&&this.data.auto_navigate&&res.message.indexOf("助教申请")==-1){ setTimeout(()=>{ app[this.data.opentype]({ diff --git a/miniprogram/components/nav-bar/nav-bar.js b/miniprogram/components/nav-bar/nav-bar.js index 165a6d4..2400464 100644 --- a/miniprogram/components/nav-bar/nav-bar.js +++ b/miniprogram/components/nav-bar/nav-bar.js @@ -27,6 +27,7 @@ Component({ type:Number, observer: function(cur){ this.setData({cur}); + console.log("observer current", cur); this.trigger({source:""}); this.scroll(); } diff --git a/miniprogram/components/nav-bar/nav-bar.wxml b/miniprogram/components/nav-bar/nav-bar.wxml index 4577515..4baf677 100644 --- a/miniprogram/components/nav-bar/nav-bar.wxml +++ b/miniprogram/components/nav-bar/nav-bar.wxml @@ -1,5 +1,5 @@ - + {{item.text}} \ No newline at end of file diff --git a/miniprogram/components/nav-bar/nav-bar.wxss b/miniprogram/components/nav-bar/nav-bar.wxss index 7d8b130..4b10cc1 100644 --- a/miniprogram/components/nav-bar/nav-bar.wxss +++ b/miniprogram/components/nav-bar/nav-bar.wxss @@ -21,6 +21,7 @@ .view.nav.active{ color: #0080f0; font-size: 15px; + font-weight: bold; border-bottom: 2px solid #0080f0; } .view.plain{ @@ -33,7 +34,7 @@ } .view.cap{ border-radius: 36px; - background: #dddddd; + background: #dfdfdf; padding: 0 14px; height: 28px; line-height: 28px; @@ -54,7 +55,8 @@ } .text.line.active{ font-size: 15px; - color: #0080f0; + color: #00b0f0; + font-weight: bold; } .text.line::after{ transition: all 0.26s ease; diff --git a/miniprogram/components/page-status/page-status.js b/miniprogram/components/page-status/page-status.js new file mode 100644 index 0000000..7958b48 --- /dev/null +++ b/miniprogram/components/page-status/page-status.js @@ -0,0 +1,23 @@ +// components/page-status/page-status.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/miniprogram/components/page-status/page-status.json b/miniprogram/components/page-status/page-status.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/miniprogram/components/page-status/page-status.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/page-status/page-status.wxml b/miniprogram/components/page-status/page-status.wxml new file mode 100644 index 0000000..64d5283 --- /dev/null +++ b/miniprogram/components/page-status/page-status.wxml @@ -0,0 +1,2 @@ + +components/page-status/page-status.wxml diff --git a/miniprogram/components/page-status/page-status.wxss b/miniprogram/components/page-status/page-status.wxss new file mode 100644 index 0000000..86381f7 --- /dev/null +++ b/miniprogram/components/page-status/page-status.wxss @@ -0,0 +1 @@ +/* components/page-status/page-status.wxss */ \ No newline at end of file diff --git a/miniprogram/components/require-login/require-login.js b/miniprogram/components/require-login/require-login.js index 0167f6c..35c82d9 100644 --- a/miniprogram/components/require-login/require-login.js +++ b/miniprogram/components/require-login/require-login.js @@ -3,7 +3,8 @@ const app = getApp(); Component({ properties: { user_id:{ - type:Number + type:Number, + value:-1 }, message:{ type:"String", @@ -21,7 +22,11 @@ Component({ show:function(){ app.syncUser() .then(res=>{ - this.setData({user_id: res.user.user_id}); + if(this.data.user_id!=res.user.user_id){ + if(this.data.user_id!=-1) + this.triggerEvent("change",{}); + this.setData({user_id: res.user.user_id}); + } }) } } diff --git a/miniprogram/components/rich-md/rich-md.js b/miniprogram/components/rich-md/rich-md.js index 572424e..867b156 100644 --- a/miniprogram/components/rich-md/rich-md.js +++ b/miniprogram/components/rich-md/rich-md.js @@ -55,8 +55,16 @@ Component({ var key = "RICHMDKEY"; //console.log(_data); let {tag, attr} = _data; - if(tag=='navigator'&&attr.href) - navigateToUrl({url: attr.href}); + if(tag=='navigator'&&attr.href){ + if(!navigateToUrl({url: attr.href})) + wx.setClipboardData({ + data: attr.href,success:res=>{ + wx.showToast({ + title: '链接已复制' + }) + } + }); + } //this.triggerEvent('click',{},{bubbles:true}); if(data&&data._e.tag=="code") data={attr:{class:"h2w__pre"},child:[data],tag:"view",type:"tag",_e:{type:"tag",attr:{},tag:"pre", child:[data]}} @@ -83,9 +91,7 @@ Component({ let {type, nodes} = this.data; //console.log(type); if(!type){ - if (nodes.match(//)) - type = "html" - else if (nodes.match(/^\s*<.+>.*<\/.+>/s)) + if (nodes.match(/^\s*<.+>.*<\/.+>/s)) type = "rich-text"; else if(nodes.match(/##+|\*.+\*|- |`|\$|\[.*\]\(.+\)|\|.+\|/)) type = "markdown"; diff --git a/miniprogram/components/shixun-item/shixun-item.wxml b/miniprogram/components/shixun-item/shixun-item.wxml deleted file mode 100644 index ed1e561..0000000 --- a/miniprogram/components/shixun-item/shixun-item.wxml +++ /dev/null @@ -1,6 +0,0 @@ - - - - {{shixun.name}} - - \ No newline at end of file diff --git a/miniprogram/components/shixun-item/shixun-item.wxss b/miniprogram/components/shixun-item/shixun-item.wxss deleted file mode 100644 index 9f26574..0000000 --- a/miniprogram/components/shixun-item/shixun-item.wxss +++ /dev/null @@ -1,20 +0,0 @@ -.shixun{ - background: white; - padding: 10px 8px; - overflow: hidden; - word-wrap: break-word; - display: flex; -} - -.shixun-img{ - flex:none; - width: 250rpx; - height: 170rpx; - border-radius: 4px; -} -.detail{ - padding-top: 10px; - text-align: center; - flex: auto; - width: 1px; -} \ No newline at end of file diff --git a/miniprogram/config.js b/miniprogram/config.js index 167f962..1dcff6d 100644 --- a/miniprogram/config.js +++ b/miniprogram/config.js @@ -5,10 +5,9 @@ const developUrl = "https://test-newweb.educoder.net"; const trialUrl = "https://pre-newweb.educoder.net"; const releaseUrl = "https://www.educoder.net"; -let _version = "0.15.2"; +let _version = "0.16.0"; var eduUrl = releaseUrl; /** - * A 试卷倒计时 */ export function switchEnv(env) { @@ -46,7 +45,7 @@ const config = global.config = { ] }; -envVersion="release"; -switchEnv(envVersion=="develop"?"trial":"release"); +switchEnv("release"); +//switchEnv(envVersion=="develop"?"trial":"release"); module.exports = config; \ No newline at end of file diff --git a/miniprogram/course/modules/attachment/attachment.js b/miniprogram/course/modules/attachment/attachment.js index 45fc14c..6945050 100644 --- a/miniprogram/course/modules/attachment/attachment.js +++ b/miniprogram/course/modules/attachment/attachment.js @@ -29,9 +29,6 @@ Component({ }, methods: { pull_files: function () { - wx.showLoading({ - title: '加载中', - }) app.callApi({ name: "files", data: { course_id: this.data.course_id }, complete: () => { wx.hideLoading(); this.setData({ loading: false }) } }) .then(res => { console.log("pull_files"); diff --git a/miniprogram/course/modules/students/students.js b/miniprogram/course/modules/students/students.js index 728dc37..90e4553 100644 --- a/miniprogram/course/modules/students/students.js +++ b/miniprogram/course/modules/students/students.js @@ -28,13 +28,42 @@ Component({ onChoose(e){ console.log(e); }, + onChange(e){ + console.log(e); + let {detail:{value}} = e; + this.sort_type = value?'id':''; + this.refresh(); + }, refresh(){ let {course_id, course_identity} = this.data; - app.api("weapps.courses.students")({course_id,limit:1000}).then(res=>{ - console.log(res); - let {students,students_count} = res; - this.setData({students,students_count}); - }); + 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) + this.imageMap = new Map(); + for(var item of students){ + for(var stu of item.items){ + this.imageMap.set(stu.user_id, stu.image_url); + } + } + }); + else + app.api("courses.students")({course_id, limit:10000}) + .then(res=>{ + console.log(res); + var students; + if(this.imageMap) + students = res.students.map(i=>{ + i.image_url = this.imageMap.get(i.user_id); + return i; + }) + students = [{letter:"#", items:res.students}]; + var {students_count} = res; + this.setData({ students, students_count}); + }) let ext = {course_id, course_identity}; this.setData({ext}); } diff --git a/miniprogram/course/modules/students/students.wxml b/miniprogram/course/modules/students/students.wxml index 9f73bfa..c1dbae0 100644 --- a/miniprogram/course/modules/students/students.wxml +++ b/miniprogram/course/modules/students/students.wxml @@ -4,6 +4,9 @@ 学生人数: {{students_count}} + + 按学号排序 + diff --git a/miniprogram/course/modules/students/students.wxss b/miniprogram/course/modules/students/students.wxss index 28418f2..f04e122 100644 --- a/miniprogram/course/modules/students/students.wxss +++ b/miniprogram/course/modules/students/students.wxss @@ -11,4 +11,7 @@ } .invite-button{ margin: 0; +} +.switch-wrp{ + transform: scale(0.6); } \ No newline at end of file diff --git a/miniprogram/course/pages/course/course.js b/miniprogram/course/pages/course/course.js index 323a201..0d3fbfb 100644 --- a/miniprogram/course/pages/course/course.js +++ b/miniprogram/course/pages/course/course.js @@ -307,7 +307,7 @@ Component({ }); }, onShow: function () { - if (this.data.status != 200 && this.data.status != 0 || this.data.status != 0) { + if (this.data.status != 200 && this.data.status != 0) { this.refresh(); } }, diff --git a/miniprogram/dev/pages/dev/dev.js b/miniprogram/dev/pages/dev/dev.js index 7f65cd3..56d448b 100644 --- a/miniprogram/dev/pages/dev/dev.js +++ b/miniprogram/dev/pages/dev/dev.js @@ -5,7 +5,8 @@ Page({ * 页面的初始数据 */ data: { - + scrollTop:0, + re:false }, onScanCode(e){ console.log(e); diff --git a/miniprogram/dev/pages/dev/dev.wxml b/miniprogram/dev/pages/dev/dev.wxml index f01a0d2..8be2286 100644 --- a/miniprogram/dev/pages/dev/dev.wxml +++ b/miniprogram/dev/pages/dev/dev.wxml @@ -1,2 +1,3 @@ - - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/dev/pages/dev/dev.wxss b/miniprogram/dev/pages/dev/dev.wxss index 5f42582..97fa6b9 100644 --- a/miniprogram/dev/pages/dev/dev.wxss +++ b/miniprogram/dev/pages/dev/dev.wxss @@ -1,4 +1,8 @@ #cam{ width: 100%; height: 40vh; +} +.scroll{ + background: red; + height: 72vh; } \ No newline at end of file diff --git a/miniprogram/images/tab_findmore_default.png b/miniprogram/images/tab_findmore_default.png index fa79ff4b4ed56ddca3c3d6adc04a24ababf4e3da..a19066c2626afadbe829f9430645c665ed6b0f4d 100644 GIT binary patch delta 2179 zcmV-}2z>Y1A%qc-7=H)`000120{Mpk00>J-L_t(&L&aKsj9gU}Kj+RH|FED{qmd64 zKd4%iP(>nG`KXArK?E&D4I;HDgi6BB&O3Kkny>`j*?ZnjSAiv#_(jy%E+2xXk&g;R zp*3is1xqc6ZlnQ0sV;O^ZFk-=XY$_o=JoBoo!Q-blgaG7dwV}C@yMWinpYjjQtIOjGX;)*Qbi1-u$+$$p6j4?Y!dCR-Hx}Hz!1VM1Vhy(!e&iHv4hNt!P^!zHZf7C@k z7X5x?#ssR>>W6E!+Sb&}t+CdAL!UA8u>hbkKYwmxL^OXYSIU@-tweN6g20~v;F#$5 z<{1$Pf?%GA{00EtmzdpKeBak7Q*S{KtPqh63BZ*wD9@HYVXYZMOSF}D_r#bsSxT?!y3 zFn=T>SH-_YR~8rvPwX;@L_f`awGcMC4j)ZJ%@QJVey-;AUb?>lQl(w zHVJ&5h<=jRan4X)=t5>hCUo1Ll%&f`U z@onl35m71Hrw;+ZMyQmssdz9una%yH#%`N=#4S^dtrZbTexp?g3?Zm`yN zt4xM`WA-x%!~-+4F4vc$Ps3gulRE()>jXh?X5{yp^Snc&8Y1r0{Sb!XPJbeLG&C?F`hCK-&Ki@lp|aS#zV5kzW(hsqGkc z&OM5VjZ0IZQ20P6<;J{&O!J?3bG?j+$NIkiA~S1YDovv4@|{N}odpw7t~<9CM$^>+ z5xL1)tEKXKn}Wn|iGS#%Jn)fzQyM=P1bztsjkG~TmRM`mXroPs1T!xKfIiRj&eqC8 zVglxlK&4W7SD{dNI)QZ$5jDl>APC+B0G|{Q-PGxg{cy2Zy!gO@16n?*pWGP*-nk>d z%xd(um;fSHeBZAZTb*+nah4;ZUd&%J9e0Ujc1=u7oY2?Tw|{@mU5J^li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J3G7c=?0;W0cqBQJd#R6j$t%9H{x zQI39K7#(|J^^Jsdn{RM1TX!#>y8NIMl@BIqY9e$v5X(QIbCQ7k+(RPCyz{aOMc&HC zZ0Qlpg_#_b=*M@>oYHxuCy{>^8iECYnh}mCi#%6r6rUNGe?$G{P0Oy2!-BK1`u*Jc z{`ACewPa~&m%%2~ISggx0W*PQZRCpo-%4CpI@$gE{ql*POz$I3Z%7e_%AOZSOvsFu zvLNV7sK&>}nD`-S;0q?Y|0 zRkGJ01V*t2LtadOoH0<$eBkElDyrxrsyOqJU7$n{S7zy}uJn}888tFPQrJH10bS^T z3}5uI1Oxx!mvQ=bI5!N=UDY+v9Y~<7u&Xdxn7k|uZVgvfg~L_hD$+1zRTvECR`B5e zbnx+W!+M1M{~f4QF2R8g=HwZILOfMnFhTCJ!GTzi2lkG;DijL!^7Cx H7aj9Ih7aJ$ diff --git a/miniprogram/images/tab_findmore_pressed.png b/miniprogram/images/tab_findmore_pressed.png index 0fbc127160ef2e2131fb93526fd91601425dca90..2df3e111ea84ebff42190ff3923d600efcad657f 100644 GIT binary patch delta 1421 zcmV;81#b5O9E6s4b^Gr|*6gdV!uBJ*PfNQ__Ct<9Xiq{eRxeS4Kp5QaC>*)38Js z3Pq9pJ}Jju0U7bXJv`vy7(6_Kmyf+S7I5IRNw~wW(77=MXGbGAH>Mz{7&l%(1_Ckx zQsNmR%8r1ZK$Mz$rtsZB#L|5yWY{m@z#WO2yCsZB)`#kZY_kV8UJlZUA#1Ikj0u_G zuxs-VJ43dT2Y-Nx2<#ECt4pGTePKJcP65XV%<43HbRbMyu7xb!Qw<9QW~~Q0{0cSQ zoU(FDP2_OQ+C$uQV+s$##ywgnGL*SvHXH~>F>2yj0LbAiOrsxN57BSqvf=gnt6lhH znUf`d*3v7{r?-rI(9JPx&cLC*Fm3NN9{2Qm9@F}swSW5!ky@S4Wqt-OJycAQKe5Vf z$r=D~^A;T9ZGRglUm!AUC=oQR4*(lV1XkhEr}o@a8qM78NrkT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XZs-|2R#{f@gKTlhCLZfs~gr;vaESAshJ zd^)UKCsvk#`wpx1HTFVA#>J(kghP?9SOYCvmT6#eQ!Y3v`GCht(#lJ7F>=t-6nXSf z&$+ymz0dG0)U0Xn6D@!1;G0$0%%ahBkGV}$JPd_D;H=%oXo~J!nt)}Dcy=6DV z#N@4yn=bOVG(}-!~;NWU5QU(=6?sM@s ziG1>jX37GHj@Ba*4pC9ZABrmyS+b6OepwSef`}g}uO=>|_ z7H|+emlc>K8OtKG#IRj9q33F*n=l=3zaZmaJJ=av&f;)-xCC*5%IxL;d=^$9A+)ql=V5$xAAb==tLMtA~!&QOKf2Bs1J$ zM+uxql1;5|pob2*IurgKR|pqJlFps5`GZ*>?`?f=H0UCh!JIjzFMyPxBFu{kX2iU$ z_;nA*e#f5T`y(=KTIt7S0$|<<(J6FCCQb6T{?|Ri*a9!V?CMUMOENC6tN%!J#tcnj zHo9wT$Yv-m zHmXn??!W(7di)%btSndJ<kj5hFq#~6;K1D5#yam4{JkrO*qL{_XYZ-m^aS(BO7*mCTf(D3l%RpRG}tXz4u{knlo zagb*Lw>*Ii94LR)g)nK7d2_@Y&buO%x~Ltvv4UWFE1}>Z*65SVPtJ-ZZBzLZ*DDSZ*FuibZu}iX=870 pUw39@Woc_Scr|J-W?^_~VQwySc4s0l&_VzJ002ovPDHLkV1lILJgWcz diff --git a/miniprogram/includes/navigation-bar/navigaation-bar.wxml b/miniprogram/includes/navigation-bar/navigaation-bar.wxml new file mode 100644 index 0000000..370d23f --- /dev/null +++ b/miniprogram/includes/navigation-bar/navigaation-bar.wxml @@ -0,0 +1,14 @@ + + + + + + {{title}} + + + + {{item.text}} + + + + \ No newline at end of file diff --git a/miniprogram/includes/navigation-bar/navigation-bar.wxss b/miniprogram/includes/navigation-bar/navigation-bar.wxss new file mode 100644 index 0000000..d211bb9 --- /dev/null +++ b/miniprogram/includes/navigation-bar/navigation-bar.wxss @@ -0,0 +1,47 @@ + +.navigation{ + background: #00b0f0; + flex: none; +} +.navigation-bar{ + height: 44px; + padding-right: 105px; + display: flex; + align-items: center; +} +.navigation-left{ + width: 105px; + display: flex; + align-items: center; + color: white; +} +.search{ + padding: 5px 0 5px 7px; +} +.title{ + flex: auto; + text-align: center; + white-space: pre; + font-size: 14px; +} +.navbar{ + flex: 1 1 1px; + width: 1px; + font-size: 15px; + border-radius: 7px; + display: flex; + text-align: center; + white-space: nowrap; + overflow-x: scroll; +} +.navitem{ + flex: auto; + background: #00d0f0; + color: white; + padding: 6px 1px; + transition: all ease 0.6s; +} +.navitem.active{ + color: #00b0f0; + background: white; +} diff --git a/miniprogram/js/apiConfig.js b/miniprogram/js/apiConfig.js index 55d77a2..bb8b074 100644 --- a/miniprogram/js/apiConfig.js +++ b/miniprogram/js/apiConfig.js @@ -17,7 +17,9 @@ accounts:{ add_department_applies:{config, query, form:{school_id:null, name:null, remarks:void 0},disp:"新增子单位"}, attachments:{url:{_:1,DELETE:'*/{attachment_id}',uploadFile:"*"},query,form:{_:1,uploadFile:{file:null},DELETE:{}},config:{method:"uploadFile", name:"file"}}, - +collections:{config, query, form:{container_id: null, container_type: null}, + cancel:{query, config:{method:"DELETE", form:{container_id: null, container_type: null}}}, +}, courses:{ url:{_:"*", DELETE:"*/{course_id}",PUT:"*/{course_id}"},query, form:{_:1,GET:{search:"",limit:20, page:1, order:"all"}, POST:{course_list_name:null,name:null,school: null,end_date: null,class_period:null,credit:null,course_module_types:["shixun_homework","common_homework","group_homework","exercise","attachment","course_group"],authentication:null,professional_certification:null},PUT:{course_list_name:null,name:null,school: null,end_date: null,class_period:null,credit:null,course_module_types:["shixun_homework","common_homework","group_homework","exercise","attachment","course_group"],authentication:null,professional_certification:null}}, act_score:{url:"{course_id}/*", query}, all_course_groups:{url:"{course_id}/*", query}, @@ -68,7 +70,7 @@ exercises:{url:"{exercise_id}",query,form:{exercise_name:null, exercise_descript }, disciplines:{ - + query, form:{source:null} }, files:{query, form:{course_id:null, page_size:15, page:1,search:"",sort:0, sort_type:"created_on"}, @@ -99,7 +101,9 @@ myshixuns:{ repository: {url:"{identifier}/*",query,form:{path:null},config}, update_file:{url:"{identifier}/*",query,form:{path:null, content: null, evaluate:null, game_id:null},config} }, -paths:{url:""}, +paths:{url:"*/{subject_id}",query, + right_banner:{url:"{subject_id}/*",query} +}, schools:{ school_list:{query, form:{search:null}}, @@ -117,7 +121,7 @@ shixuns:{url:"*/{identifier}", query, res:{tpm_modified:"代码库是否有更 show_right:{url:""}, shixun_exec:{url:"{identifier}/*", query}, }, -stages:{}, +stages:{form:{subject_id:null},query}, student_works:{url:"*/{work_id}", query, form:{_:1, PUT:{description:null,attachment_ids:null},GET:{}},config:{method:"PUT"},disp:"提交作业", comment_list:{url:"{work_id}/*",query}, @@ -147,7 +151,8 @@ users:{ courses:{url:"{login}/*", query, form:{page:1, sort_by:"updated_at",sort_direction:"desc", per_page:10, category:void 0, status:void 0},category:["study","manage"],status:["processing","end"]}, get_user_info:{query,form:{school:1}}, homepage_info:{url:"{login}/*",query}, - shixuns: { url: "{login}/*", query, form: {sort_by:"updated_at" ,page:1, sort_direction:"desc",per_page:16}}, + shixuns: { url: "{login}/*", query, form: {sort_by:"updated_at",category:void 0, page:1, sort_direction:"desc",per_page:16}}, + subjects:{url:"{login}/*", query, form:{sort_by:"update_at", category:void 0, page:1, sort_direction:"desc"}}, system_update:{query:query}, /*{"system_update":true,"system_score":"为了给大家提供更优质的体验,平台将于2020年3月24日13:20开始对系统进行升级。升级期间系统响应会有一定的延迟。系统拟于2020年3月24日13:30恢复正常。\r\n请大家知悉,并提前做好教学安排。带来不便,敬请谅解。","subject":" educoder升级服务通知","start_time":"2020-03-24T13:20:00.000+08:00","end_time":"2020-03-24T13:30:00.000+08:00"}*/ tidings: {query, form:{type:void 0,page:1,per_page:10}, data:"type:course,project,interaction,apply,notice"}, @@ -167,6 +172,7 @@ weapps:{ delete_course_teachers:{url:"{course_id}/*",query, form:{course_member_ids:null},config:{method:"DELETE"}}, students: {url:"{course_id}/*", query, form:{page:1, limit: void 0}}, teachers: {url:"{course_id}/*", query, form:{page:1, limit: void 0}}, + }, course_member_attendances:{query, form:{_:1, GET:{page:1, limit: 10},POST:{attendance_id:null, attendance_mode:null, code:void 0}}, config, disp:"课堂成员签到", update_status:{query, config, form:{attendance_id:null, attendance_status:null, course_id:null, user_id:null}} @@ -176,7 +182,7 @@ weapps:{ }, code_session: { query, form: {code: null, encrypted_data: null, iv: null }, config }, home: { query,form: { page: 1, limit: 15, category: "study"} }, - paths: {}, + paths:{query, form:{order:"myshixuns_count", sort:"desc", page:1, limit:10, discipline_id: void 0,sub_discipline_id: void 0}}, register:{query,form:{login:null,password:null, code:null}, config}, session: {query,form:{login:null, password:null},config}, course_stickies:{query, form:{course_id:null, category:null},config, diff --git a/miniprogram/js/client.js b/miniprogram/js/client.js index 03c5940..b70abe2 100644 --- a/miniprogram/js/client.js +++ b/miniprogram/js/client.js @@ -38,6 +38,7 @@ export default class Client{ this.on("before", "users.accounts", getId); this.on("before", "users.accounts.password", getLogin); this.on("before","users.courses", getLogin); + this.on("before","users.subjects", getLogin); this.on("before","users.homepage_info", getLogin); this.on("before","users.accounts.avatar",getLogin); this.on("before","users.unread_message_info", getLogin); @@ -70,25 +71,33 @@ export default class Client{ }) } getTidingInfo({login}={}){ + let index = 2; this.tidingGet = 1; const handler = { fail: res=>{this.tidingGet=0} }; return this.api("users.unread_message_info")({login}).then(res => { if (res.unread_message_count) - wx.setTabBarBadge({ index: 1, text: res.unread_message_count.toString(),...handler}); + wx.setTabBarBadge({ index, text: res.unread_message_count.toString(),...handler}); else if (res.unread_tiding_count) - wx.showTabBarRedDot({index: 1,...handler}); + wx.showTabBarRedDot({index,...handler}); else{ - wx.removeTabBarBadge({index:1}); - wx.hideTabBarRedDot({index:1}); + wx.removeTabBarBadge({index}); + wx.hideTabBarRedDot({index}); } }).catch(e => { console.error("getTidingInfo", e); }); } - async syncUser({ refresh = 0 } = {}) { + syncUser({refresh=0}={}){ + if(!this.synching||!this.tmp_promise||!this.synch||refresh){ + this.synching = 1; + this.tmp_promise = this._syncUser({refresh}); + } + return this.tmp_promise; + } + async _syncUser({ refresh = 0 }) { let old_id = this.user.user_id; if(!this.synch||refresh){ let info = await this.callApi({name:"users.get_user_info"}); @@ -110,6 +119,7 @@ export default class Client{ } } + this.synching = 0; return {synch:this.synch,changed, user:this.user}; } updateUserInfo(info){ diff --git a/miniprogram/js/utils.js b/miniprogram/js/utils.js index 0b98b53..ed03881 100644 --- a/miniprogram/js/utils.js +++ b/miniprogram/js/utils.js @@ -105,6 +105,9 @@ class AccountManager{ this.accounts = []; //保存的账号信息 this.loadStorage(); } + get testAccount(){ + return {login:"educoder_weapp@126.com", password:"abcdefgh"}; + } addAccount(account, sync=1){ if(!this.updateAccount(account)) this.accounts.push(account); @@ -237,7 +240,7 @@ export function navigateToUrl({url,open_type='navigateTo'}){ return false; } -export function throttle(func, wait, options) { +export function throttle(func, wait, options) { var context = void 0; var args = void 0; var result = void 0; @@ -267,4 +270,37 @@ export function throttle(func, wait, options) { } return result; }; -}; \ No newline at end of file +}; + +export function RealTimeLogManager(){ + const log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : null; + return { + debug() { + if (!log) return + log.debug.apply(log, arguments) + }, + info() { + if (!log) return + log.info.apply(log, arguments) + }, + warn() { + if (!log) return + log.warn.apply(log, arguments) + }, + error() { + if (!log) return + log.error.apply(log, arguments) + }, + setFilterMsg(msg) { // 从基础库2.7.3开始支持 + if (!log || !log.setFilterMsg) return + if (typeof msg !== 'string') return + log.setFilterMsg(msg) + }, + addFilterMsg(msg) { // 从基础库2.8.1开始支持 + if (!log || !log.addFilterMsg) return + if (typeof msg !== 'string') return + log.addFilterMsg(msg) + } +} +} +global.realTimeLog = RealTimeLogManager(); \ No newline at end of file diff --git a/miniprogram/pages/findmore/findmore.js b/miniprogram/pages/findmore/findmore.js index 00bf8ec..36d5ec5 100644 --- a/miniprogram/pages/findmore/findmore.js +++ b/miniprogram/pages/findmore/findmore.js @@ -1,13 +1,21 @@ const app = getApp(); +const titleMap = ["实训项目", "实践课程","教学课堂"] +const typeMap = { + shixun:0, + path:1, + course:2 +} Page({ data: { statusBarHeight: 20, current: 0, show: [1], + showSearch:1, + title:"实训项目", list: [ - { text: "实训" ,type:"shixun"}, - { text: "课堂" , type:"course"}, - //{text:"课程"} + { text: "实训", type:"shixun"}, + { text: "课程", type:"path"}, + //{ text: "课堂", type:"course"} ] }, enterSearch() { @@ -22,18 +30,23 @@ Page({ }, }) }, + switch({current}){ + let title = titleMap[current]; + this.setData({ ['show[' + current + ']']: 1,current, title}); + }, switchNav({ target: { dataset: { current } } }) { - this.setData({ current }); - this.setData({ ['show[' + current + ']']: 1 }) + this.switch({current}); }, switchTab({ detail: { current, source, value } }) { - console.log(current, source, value); + //console.log(current, source, value); if (source == "touch") { - this.setData({ current }); - this.setData({ ['show[' + current + ']']: 1 }) + this.switch({current}); } }, onShareAppMessage: function () { - + let {list, current} = this.data; + return app.shareApp({ + path:"/"+this.route+"?type="+list[current].type + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/findmore/findmore.json b/miniprogram/pages/findmore/findmore.json index d3777c6..bfbfeb1 100644 --- a/miniprogram/pages/findmore/findmore.json +++ b/miniprogram/pages/findmore/findmore.json @@ -1,5 +1,10 @@ { - "usingComponents": {}, + "usingComponents": { + "paths":"./paths/paths", + "shixuns":"./shixuns/shixuns" + }, "navigationBarTitleText": "发现", - "navigationStyle": "custom" + "navigationBarTextStyle": "white", + "navigationStyle": "custom", + "navigationBarBackgroundColor": "#00b0f0" } \ No newline at end of file diff --git a/miniprogram/pages/findmore/findmore.wxml b/miniprogram/pages/findmore/findmore.wxml index edb0838..f540cd3 100644 --- a/miniprogram/pages/findmore/findmore.wxml +++ b/miniprogram/pages/findmore/findmore.wxml @@ -1,22 +1,9 @@ - - - - - - 发现 - - - - {{item.text}} - - - - + - + - + \ No newline at end of file diff --git a/miniprogram/pages/findmore/findmore.wxss b/miniprogram/pages/findmore/findmore.wxss index 3d54365..1bf3657 100644 --- a/miniprogram/pages/findmore/findmore.wxss +++ b/miniprogram/pages/findmore/findmore.wxss @@ -1,48 +1,9 @@ +@import "../../includes/navigation-bar/navigation-bar.wxss"; page{ display: flex; flex-direction: column; height: 100%; } -.navigation{ - background: #00b0f0; - flex: none; -} -.navigation-bar{ - height: 44px; - padding-right: 100px; - display: flex; - align-items: center; -} -.navigation-left{ - width: 100px; - display: flex; - align-items: center; - color: white; -} -.search{ - padding:0 8px; -} -.navbar{ - flex: 1 1 1px; - width: 1px; - border-radius: 7px; - display: flex; - text-align: center; - white-space: nowrap; - overflow-x: scroll; -} -.navitem{ - flex: auto; - background: #00d0f0; - color: white; - padding: 5px 1px; - transition: all ease 0.6s; -} -.navitem.active{ - color: #00b0f0; - background: white; -} - .body{ flex: 1 1 1px; height: 1px; diff --git a/miniprogram/pages/findmore/paths/path-item/path-item.js b/miniprogram/pages/findmore/paths/path-item/path-item.js new file mode 100644 index 0000000..c7d05de --- /dev/null +++ b/miniprogram/pages/findmore/paths/path-item/path-item.js @@ -0,0 +1,13 @@ +const app = getApp(); +Component({ + properties: { + data:Object + }, + data: { + eduUrl: global.config.eduUrl + }, + + methods: { + + } +}) diff --git a/miniprogram/components/shixun-item/shixun-item.json b/miniprogram/pages/findmore/paths/path-item/path-item.json similarity index 100% rename from miniprogram/components/shixun-item/shixun-item.json rename to miniprogram/pages/findmore/paths/path-item/path-item.json diff --git a/miniprogram/pages/findmore/paths/path-item/path-item.wxml b/miniprogram/pages/findmore/paths/path-item/path-item.wxml new file mode 100644 index 0000000..160f7e4 --- /dev/null +++ b/miniprogram/pages/findmore/paths/path-item/path-item.wxml @@ -0,0 +1,6 @@ + + + + {{data.name}} + + \ No newline at end of file diff --git a/miniprogram/pages/findmore/paths/path-item/path-item.wxss b/miniprogram/pages/findmore/paths/path-item/path-item.wxss new file mode 100644 index 0000000..18e3031 --- /dev/null +++ b/miniprogram/pages/findmore/paths/path-item/path-item.wxss @@ -0,0 +1,15 @@ +.path-item{ + padding: 12px; + display: flex; + background: white; +} +.image{ + flex: none; + width: 250rpx; + height: 170rpx; + border-radius: 4px; + background: #221f53; +} +.detail{ + padding-left: 8px; +} \ No newline at end of file diff --git a/miniprogram/pages/findmore/paths/paths.js b/miniprogram/pages/findmore/paths/paths.js new file mode 100644 index 0000000..f69db54 --- /dev/null +++ b/miniprogram/pages/findmore/paths/paths.js @@ -0,0 +1,101 @@ +const app = getApp(); +Component({ + + properties: { + + }, + + data: { + list: [], + subList:[], + subjects:[], + subCurrent:-1 + }, + pageLifetimes:{ + show(){ + if(!this.disciplines) + this.pullDisciplines(); + } + }, + attached(){ + this.options = {page:1, limit:10}; + this.pullDisciplines(); + this.pullSubjects({refresh:1}); + }, + + + methods: { + pullSubjects({refresh=0}={}){ + if(refresh){ + if(refresh==1){ + this.options.page = 1; + var { options } = this; + }else if(refresh==2){ + var {page, per_page} = this.options; + var options = {...this.options,page:1, per_page: page*per_page}; + } + }else{ + this.options.page++; + var {options} = this; + } + return app.api("weapps.paths")(options).then(({subjects})=>{ + let length = subjects.length; + if (!refresh){ + subjects = this.data.subjects.concat(subjects); + var status = length>0?200:204; + }else{ + var status = length>0?200:205; + } + this.setData({ subjects, status}); + }).catch(e=>{ + this.setData({subjects:[], status:e.code}); + }) + }, + onPullDownRefresh(){ + this.pullSubjects({refresh:2}); + }, + onReachBottom(){ + if(this.data.status==200) + this.pullSubjects(); + }, + pullDisciplines(){ + 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"}); + //this.setNavList({disciplines: this.disciplines[0].sub_disciplines, key:"subList"}); + }).catch(e=>{ + this.disciplines = null; + }) + }, + setNavList({disciplines, key}){ + let list = disciplines.map(i=>{ + return {text: i.name, id: i.id}; + }) + this.setData({[key]: list}); + }, + onCateChange({detail}){ + console.log(detail); + let {current, value} = detail; + this.options.discipline_id = value.id; + this.setNavList({disciplines: this.disciplines[current].sub_disciplines, key:"subList"}); + this.setData({subCurrent:-1}); + delete this.options.sub_discipline_id; + this.pullSubjects({refresh:1}); + }, + onSubCateChange({detail}){ + console.log(detail); + let {current, value, source} = detail; + if(source!="touch") + return; + if(value.id) + this.options.sub_discipline_id = value.id; + else + delete this.options.sub_discipline_id; + this.pullSubjects({refresh:1}); + } + } +}) diff --git a/miniprogram/pages/findmore/paths/paths.json b/miniprogram/pages/findmore/paths/paths.json new file mode 100644 index 0000000..ba7f619 --- /dev/null +++ b/miniprogram/pages/findmore/paths/paths.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "nav-bar":"/components/nav-bar/nav-bar", + "empty-page":"/components/empty-page/empty-page", + "path-item":"./path-item/path-item" + } +} \ No newline at end of file diff --git a/miniprogram/pages/findmore/paths/paths.wxml b/miniprogram/pages/findmore/paths/paths.wxml new file mode 100644 index 0000000..5b848b8 --- /dev/null +++ b/miniprogram/pages/findmore/paths/paths.wxml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/findmore/paths/paths.wxss b/miniprogram/pages/findmore/paths/paths.wxss new file mode 100644 index 0000000..55e3f7d --- /dev/null +++ b/miniprogram/pages/findmore/paths/paths.wxss @@ -0,0 +1,10 @@ +.path-body{ + height: 100%; +} +.nav-wrp{ + position: sticky; + top: 0; +} +.path-wrp{ + margin-bottom: 2px; +} \ No newline at end of file diff --git a/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.js b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.js new file mode 100644 index 0000000..61b7dbf --- /dev/null +++ b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.js @@ -0,0 +1,14 @@ + +Component({ + properties: { + data:Object + }, + + data: { + eduUrl: global.config.eduUrl + }, + + methods: { + + } +}) diff --git a/miniprogram/components/tiding-item/tiding-item.json b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.json similarity index 100% rename from miniprogram/components/tiding-item/tiding-item.json rename to miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.json diff --git a/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml new file mode 100644 index 0000000..ea65652 --- /dev/null +++ b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml @@ -0,0 +1,7 @@ + + + + + 初级 + + \ No newline at end of file diff --git a/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxss b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxss new file mode 100644 index 0000000..e542b37 --- /dev/null +++ b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxss @@ -0,0 +1,24 @@ +.shixun-item{ + padding: 12px; + display: flex; + background: white; +} +.image{ + flex: none; + width: 250rpx; + height: 170rpx; + border-radius: 4px; + background: #221f53; +} +.detail{ + padding:0 0 4px 12px; + display: flex; + flex-direction: column; + justify-content: space-between; +} +.level{ + font-size: 12px; +} +.highlight{ + color: #00b0f0; +} \ No newline at end of file diff --git a/miniprogram/pages/findmore/shixuns/shixuns.js b/miniprogram/pages/findmore/shixuns/shixuns.js index fca97c7..653e588 100644 --- a/miniprogram/pages/findmore/shixuns/shixuns.js +++ b/miniprogram/pages/findmore/shixuns/shixuns.js @@ -1,23 +1,73 @@ -// pages/findmore/shixuns/shixuns.js + +const app = getApp(); Component({ - /** - * 组件的属性列表 - */ properties: { }, - /** - * 组件的初始数据 - */ data: { - + shixun_list:[] + }, + attached(){ + this.options = {page:1, limit: 10}; + this.pullShixuns({refresh:1}); }, - - /** - * 组件的方法列表 - */ methods: { - + clear(){ + this.setData({keyword:"", showClear:0}); + this.options.keyword = ""; + this.pullShixuns({refresh:1}); + }, + onInput(e){ + let {detail:{value}} = e; + if(this.data.showClear&&!value){ + this.clear(); + }else if(!this.data.showClear&&value){ + this.setData({showClear:1}); + } + + }, + onSubmit(e){ + console.log(e) + let {detail:{value}} = e; + if(this.options.keyword!=value){ + this.options.keyword = value; + this.pullShixuns({refresh:1}); + } + }, + onPullDownRefresh(){ + this.pullShixuns({refresh:1}); + }, + onReachBottom(){ + if(this.data.status==200) + this.pullShixuns(); + }, + pullShixuns({refresh=0}={}){ + if(refresh){ + if(refresh==1){ + this.options.page = 1; + var { options } = this; + }else if(refresh==2){ + var {page, per_page} = this.options; + var options = {...this.options,page:1, per_page: page*per_page}; + } + }else{ + this.options.page++; + var {options} = this; + } + wx.showNavigationBarLoading(); + return app.api("shixun_lists")(options).then(({shixun_list})=>{ + let length = shixun_list.length; + if (!refresh){ + shixun_list = this.data.shixun_list.concat(shixun_list); + var status = length>0?200:204; + }else{ + var status = length>0?200:205; + } + this.setData({ shixun_list, status}, wx.hideNavigationBarLoading); + }).catch(e=>{ + this.setData({ shixun_list:[], status:e.code}, wx.hideNavigationBarLoading); + }) + } } }) diff --git a/miniprogram/pages/findmore/shixuns/shixuns.json b/miniprogram/pages/findmore/shixuns/shixuns.json index e8cfaaf..68d10e2 100644 --- a/miniprogram/pages/findmore/shixuns/shixuns.json +++ b/miniprogram/pages/findmore/shixuns/shixuns.json @@ -1,4 +1,7 @@ { "component": true, - "usingComponents": {} + "usingComponents": { + "empty-page":"/components/empty-page/empty-page", + "shixun-item":"./shixun-item/shixun-item" + } } \ No newline at end of file diff --git a/miniprogram/pages/findmore/shixuns/shixuns.wxml b/miniprogram/pages/findmore/shixuns/shixuns.wxml index 176f53f..dfece4f 100644 --- a/miniprogram/pages/findmore/shixuns/shixuns.wxml +++ b/miniprogram/pages/findmore/shixuns/shixuns.wxml @@ -1,2 +1,17 @@ - -pages/findmore/shixuns/shixuns.wxml + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/findmore/shixuns/shixuns.wxss b/miniprogram/pages/findmore/shixuns/shixuns.wxss index cd9181f..b2efed1 100644 --- a/miniprogram/pages/findmore/shixuns/shixuns.wxss +++ b/miniprogram/pages/findmore/shixuns/shixuns.wxss @@ -1 +1,25 @@ -/* pages/findmore/shixuns/shixuns.wxss */ \ No newline at end of file +.shixun-body{ + height: 100%; +} +.header{ + top: 0; + position: sticky; + background: white; + padding: 4px 12px; +} +.input-wrp{ + display: flex; + padding: 4px 10px; + border-radius: 4px; + border: 1px #00b0f0 solid; +} +.input{ + flex: auto; +} +.icon{ + flex: none; +} + +.shixun-wrp{ + margin-bottom: 2px; +} \ No newline at end of file diff --git a/miniprogram/pages/main/main.js b/miniprogram/pages/main/main.js index d56159d..02ba964 100644 --- a/miniprogram/pages/main/main.js +++ b/miniprogram/pages/main/main.js @@ -1,17 +1,34 @@ const app = getApp(); +const typeMap = { + course: 0, + shixun: 1, + path: 2, + subject:2 +} +const titleMap = { + course:"教学课堂", + shixun:"实训项目", + path:"实践课程" +} Page({ data:{ statusBarHeight:20, current:0, show:[1], + showSearch:0, + title:"我的教学课堂", list:[ {text:"课堂", type:"course"}, {text:"实训", type:"shixun"}, - //{text:"课程"} + {text:"课程", type:"path"} ] }, - onLoad(){ + onLoad(options){ + if(options.type){ + let current = typeMap[options.type]||0; + this.switch({current}); + } wx.getSystemInfo({ success: res=>{ let {statusBarHeight} = res; @@ -23,18 +40,23 @@ Page({ let type = this.data.list[this.data.current].type||''; app.navigateTo({url:`{search}?type=${type}`}); }, + switch({current}){ + let title = "我的"+titleMap[this.data.list[current].type]; + this.setData({['show['+current+']']:1, current, title}) + }, switchNav({target:{dataset:{current}}}){ - this.setData({current}); - this.setData({['show['+current+']']:1}) + this.switch({current}); }, switchTab({detail:{current, source, value}}){ - console.log(current, source, value); + //console.log(current, source, value); if(source=="touch"){ - this.setData({ current }); - this.setData({ ['show[' + current + ']']: 1 }) + this.switch({current}); } }, onShareAppMessage(){ - + let {list, current} = this.data; + return app.showApp({ + path: "/"+this.route+"?type="+list[current].type + }) } }) \ No newline at end of file diff --git a/miniprogram/pages/main/main.json b/miniprogram/pages/main/main.json index 4ccbd74..dda9b16 100644 --- a/miniprogram/pages/main/main.json +++ b/miniprogram/pages/main/main.json @@ -3,7 +3,9 @@ "usingComponents": { "add-tips": "/components/add-tips/add-tips", "my-course":"./my_course/my_course", - "my-shixun":"./my_shixun/my_shixun" + "my-shixun":"./my_shixun/my_shixun", + "my-path":"../my_path/my_path" }, - "navigationBarTextStyle": "white" + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor": "#00b0f0" } \ No newline at end of file diff --git a/miniprogram/pages/main/main.wxml b/miniprogram/pages/main/main.wxml index f6ab07a..8f4dcaf 100644 --- a/miniprogram/pages/main/main.wxml +++ b/miniprogram/pages/main/main.wxml @@ -1,17 +1,5 @@ - - - - - - 我的 - - - - {{item.text}} - - - - + + @@ -19,6 +7,9 @@ + + + \ No newline at end of file diff --git a/miniprogram/pages/main/main.wxss b/miniprogram/pages/main/main.wxss index 3d54365..67c6ef4 100644 --- a/miniprogram/pages/main/main.wxss +++ b/miniprogram/pages/main/main.wxss @@ -1,48 +1,9 @@ +@import "../../includes//navigation-bar/navigation-bar.wxss"; page{ display: flex; flex-direction: column; height: 100%; } -.navigation{ - background: #00b0f0; - flex: none; -} -.navigation-bar{ - height: 44px; - padding-right: 100px; - display: flex; - align-items: center; -} -.navigation-left{ - width: 100px; - display: flex; - align-items: center; - color: white; -} -.search{ - padding:0 8px; -} -.navbar{ - flex: 1 1 1px; - width: 1px; - border-radius: 7px; - display: flex; - text-align: center; - white-space: nowrap; - overflow-x: scroll; -} -.navitem{ - flex: auto; - background: #00d0f0; - color: white; - padding: 5px 1px; - transition: all ease 0.6s; -} -.navitem.active{ - color: #00b0f0; - background: white; -} - .body{ flex: 1 1 1px; height: 1px; diff --git a/miniprogram/components/course-item/course-item.js b/miniprogram/pages/main/my_course/course-item/course-item.js similarity index 100% rename from miniprogram/components/course-item/course-item.js rename to miniprogram/pages/main/my_course/course-item/course-item.js diff --git a/miniprogram/components/course-item/course-item.json b/miniprogram/pages/main/my_course/course-item/course-item.json similarity index 78% rename from miniprogram/components/course-item/course-item.json rename to miniprogram/pages/main/my_course/course-item/course-item.json index 2ea3b8c..38ed8ad 100644 --- a/miniprogram/components/course-item/course-item.json +++ b/miniprogram/pages/main/my_course/course-item/course-item.json @@ -1,7 +1,7 @@ { "component": true, "usingComponents": { - "iconfont":"../iconfont/iconfont", + "iconfont":"/components/iconfont/iconfont", "mp-icon": "/weui-miniprogram/icon/icon" }, "navigationBarBackgroundColor": "#00b0f0", diff --git a/miniprogram/components/course-item/course-item.wxml b/miniprogram/pages/main/my_course/course-item/course-item.wxml similarity index 100% rename from miniprogram/components/course-item/course-item.wxml rename to miniprogram/pages/main/my_course/course-item/course-item.wxml diff --git a/miniprogram/components/course-item/course-item.wxss b/miniprogram/pages/main/my_course/course-item/course-item.wxss similarity index 87% rename from miniprogram/components/course-item/course-item.wxss rename to miniprogram/pages/main/my_course/course-item/course-item.wxss index 21e077c..165382e 100644 --- a/miniprogram/components/course-item/course-item.wxss +++ b/miniprogram/pages/main/my_course/course-item/course-item.wxss @@ -2,7 +2,7 @@ background-image: linear-gradient(to bottom right,#FEAC5E, #C779D0,#4BC0C8);/*#FEAC5E, #C779D0,#4BC0C8*/ } .bg1{ - background-image: linear-gradient(to bottom right,#f8cdda, #1d2b64);/*#f8cdda, #1d2b64*/ + background-image: linear-gradient(to bottom right, #716da3, #ae5b84, #d76d77);/*#f8cdda, #1d2b64*/ } .bg2{ background-image: linear-gradient(to bottom right, #43cea2, #185a9d);/*#43cea2, #185a9d*/ @@ -14,7 +14,7 @@ background-image: linear-gradient(to bottom right, #b92b27, #1565c0);/*#b92b27, #1565c0*/ } .bg5{ - background-image: linear-gradient(to bottom right,#5fc3e4, #e55d87);/*#5fc3e4, #e55d87*/ + background-image: linear-gradient(to bottom right,#4f2f54,#505587, #755d97);/*#5fc3e4, #e55d87*/ } .bg6{ background-image: linear-gradient(to bottom right, #3a1c71, #d76d77, #ffaf7b);/*#3a1c71, #d76d77, #ffaf7b*/ diff --git a/miniprogram/pages/main/my_course/my_course.json b/miniprogram/pages/main/my_course/my_course.json index 852d9cd..1b0512d 100644 --- a/miniprogram/pages/main/my_course/my_course.json +++ b/miniprogram/pages/main/my_course/my_course.json @@ -4,7 +4,7 @@ "join-course-modal": "/components/modal/join-course/join-course", "require-login": "/components/require-login/require-login", "nav-bar": "/components/nav-bar/nav-bar", - "course-item": "/components/course-item/course-item", + "course-item": "./course-item/course-item", "mp-icon": "/weui-miniprogram/icon/icon" } } \ No newline at end of file diff --git a/miniprogram/pages/main/my_path/my_path.js b/miniprogram/pages/main/my_path/my_path.js new file mode 100644 index 0000000..31c3120 --- /dev/null +++ b/miniprogram/pages/main/my_path/my_path.js @@ -0,0 +1,87 @@ +const app = getApp(); +// status:[0, 204, 205, 200] +Component({ + properties: { + + }, + + data: { + shixuns:[], + status:0, + cates:[ + {text:'全部',value:""}, + {text:'我学习的',value:"study"}, + {text:'我管理的',value:"manage"}, + {text:"我收藏的",value:"collect"} + ] + }, + pageLifetimes: { + show(){ + this.refresh(); + } + }, + attached(){ + this.options = {page:1, per_page:16}; + this.refresh(); + }, + methods: { + onCateChange({detail:{value}}){ + console.log(value); + this.options.category = value.value + this.pullPaths({refresh:1}); + }, + refresh(){ + app.syncUser() + .then(res => { + if (res.user.user_id != this.user_id) { + if(res.user_id==2) + this.setData({shixuns:[]}) + else + this.pullPaths({ refresh: 1 }) + this.user_id = res.user.user_id; + }else if(this.data.status==200){ + this.pullPaths({refresh:2}); + } + }) + }, + setStatus(status){ + this.setData({status}); + }, + pullPaths({refresh=0}={}){ + if(refresh){ + if(refresh==1){ + this.options.page = 1; + var { options } = this; + }else if(refresh==2){ + var {page, per_page, category=""} = this.options; + var options = {page:1, per_page: page*per_page, category}; + } + //this.setStatus(1); + }else{ + this.options.page++; + var {options} = this; + //this.setStatus(100); + } + return app.api("users.subjects")(options).then(({subjects})=>{ + let length = subjects.length; + if (!refresh){ + subjects = this.data.subjects.concat(subjects); + var status = length>0?200:204; + }else{ + var status = length>0?200:205; + } + this.setData({ subjects, status}); + }).catch(e=>{ + this.setData({subjects:[], status:e.code}); + }) + }, + onPullDownRefresh(){ + this.pullPaths({refresh:2}); + }, + onReachBottom(){ + console.log("onreachbottom") + if(this.data.status==200) + this.pullPaths({refresh:0}); + } + } +}) diff --git a/miniprogram/pages/main/my_path/my_path.json b/miniprogram/pages/main/my_path/my_path.json new file mode 100644 index 0000000..bde129b --- /dev/null +++ b/miniprogram/pages/main/my_path/my_path.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "nav-bar": "/components/nav-bar/nav-bar", + "path-item":"./path-item/path-item", + "empty-page":"/components/empty-page/empty-page", + "require-login":"/components/require-login/require-login" + } +} \ No newline at end of file diff --git a/miniprogram/pages/main/my_path/my_path.wxml b/miniprogram/pages/main/my_path/my_path.wxml new file mode 100644 index 0000000..797abce --- /dev/null +++ b/miniprogram/pages/main/my_path/my_path.wxml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/main/my_path/my_path.wxss b/miniprogram/pages/main/my_path/my_path.wxss new file mode 100644 index 0000000..59289bd --- /dev/null +++ b/miniprogram/pages/main/my_path/my_path.wxss @@ -0,0 +1,14 @@ +.my-path { + height: 100%; + display: flex; + flex-direction: column; +} + +.path-wrap { + margin: 2px 0; +} + +.body { + flex: 1 1 1px; + height: 1px; +} \ No newline at end of file diff --git a/miniprogram/pages/main/my_path/path-item/path-item.js b/miniprogram/pages/main/my_path/path-item/path-item.js new file mode 100644 index 0000000..7cededc --- /dev/null +++ b/miniprogram/pages/main/my_path/path-item/path-item.js @@ -0,0 +1,20 @@ + +Component({ + properties: { + data:{ + type:Object, + observer:function(data){ + //name, image_url + //console.log(data); + this.setData(data); + } + } + }, + data: { + eduUrl:global.config.eduUrl + }, + methods: { + + } + +}) diff --git a/miniprogram/pages/main/my_path/path-item/path-item.json b/miniprogram/pages/main/my_path/path-item/path-item.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/miniprogram/pages/main/my_path/path-item/path-item.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/main/my_path/path-item/path-item.wxml b/miniprogram/pages/main/my_path/path-item/path-item.wxml new file mode 100644 index 0000000..956e6a8 --- /dev/null +++ b/miniprogram/pages/main/my_path/path-item/path-item.wxml @@ -0,0 +1,8 @@ + + + + + {{name}} + + + \ No newline at end of file diff --git a/miniprogram/pages/main/my_path/path-item/path-item.wxss b/miniprogram/pages/main/my_path/path-item/path-item.wxss new file mode 100644 index 0000000..9b5282e --- /dev/null +++ b/miniprogram/pages/main/my_path/path-item/path-item.wxss @@ -0,0 +1,28 @@ +.path { + background: white; + padding: 10px 8px; + overflow: hidden; + word-wrap: break-word; + display: flex; +} + +.path-img { + flex: none; + width: 250rpx; + height: 170rpx; + border-radius: 4px; + background: #221f53; +} + +.detail { + padding-top: 6px; + flex: auto; + width: 1px; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.name { + padding-left: 8px; +} diff --git a/miniprogram/pages/main/my_shixun/my_shixun.js b/miniprogram/pages/main/my_shixun/my_shixun.js index 9e6085e..1e1c447 100644 --- a/miniprogram/pages/main/my_shixun/my_shixun.js +++ b/miniprogram/pages/main/my_shixun/my_shixun.js @@ -1,11 +1,19 @@ const app = getApp(); +// status:[0, 204, 205, 200] Component({ properties: { }, data: { - shixuns:[] + shixuns:[], + status:0, + cates:[ + {text:'全部',value:""}, + {text:'我学习的',value:"study"}, + {text:'我管理的',value:"manage"}, + {text:"我收藏的",value:"collect"} + ] }, pageLifetimes: { show(){ @@ -17,6 +25,11 @@ Component({ this.refresh(); }, methods: { + onCateChange({detail:{value}}){ + console.log(value); + this.options.category = value.value + this.pullShixuns({refresh:1}); + }, refresh(){ app.syncUser() .then(res => { @@ -26,35 +39,49 @@ Component({ else this.pullShixuns({ refresh: 1 }) this.user_id = res.user.user_id; + }else if(this.data.status==200){ + this.pullShixuns({refresh:2}); } }) }, + setStatus(status){ + this.setData({status}); + }, pullShixuns({refresh=0}={}){ if(refresh){ if(refresh==1){ this.options.page = 1; var { options } = this; }else if(refresh==2){ - var {page, per_page} = this.options; - var options = {page:1, per_page: page*per_page}; + var {page, per_page, category=""} = this.options; + var options = {page:1, per_page: page*per_page, category}; } + //this.setStatus(1); }else{ this.options.page++; var {options} = this; + //this.setStatus(100); } return app.api("users.shixuns")(options).then(({shixuns})=>{ - if (!refresh) + let length = shixuns.length; + if (!refresh){ shixuns = this.data.shixuns.concat(shixuns); - this.setData({ shixuns }); + var status = length>0?200:204; + }else{ + var status = length>0?200:205; + } + this.setData({ shixuns, status}); }).catch(e=>{ - this.setData({shixuns:[]}); + this.setData({shixuns:[], status:e.code}); }) }, onPullDownRefresh(){ this.pullShixuns({refresh:2}); }, onReachBottom(){ - this.pullShixuns({refresh:0}); + console.log("onreachbottom") + if(this.data.status==200) + this.pullShixuns({refresh:0}); } } }) diff --git a/miniprogram/pages/main/my_shixun/my_shixun.json b/miniprogram/pages/main/my_shixun/my_shixun.json index 1edb765..d209db7 100644 --- a/miniprogram/pages/main/my_shixun/my_shixun.json +++ b/miniprogram/pages/main/my_shixun/my_shixun.json @@ -2,7 +2,8 @@ "component": true, "usingComponents": { "nav-bar": "/components/nav-bar/nav-bar", - "shixun-item":"/components/shixun-item/shixun-item", + "shixun-item":"./shixun-item/shixun-item", + "empty-page":"/components/empty-page/empty-page", "require-login":"/components/require-login/require-login" } } \ No newline at end of file diff --git a/miniprogram/pages/main/my_shixun/my_shixun.wxml b/miniprogram/pages/main/my_shixun/my_shixun.wxml index 09bb431..116471a 100644 --- a/miniprogram/pages/main/my_shixun/my_shixun.wxml +++ b/miniprogram/pages/main/my_shixun/my_shixun.wxml @@ -1,8 +1,10 @@ - + + + \ No newline at end of file diff --git a/miniprogram/components/shixun-item/shixun-item.js b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.js similarity index 62% rename from miniprogram/components/shixun-item/shixun-item.js rename to miniprogram/pages/main/my_shixun/shixun-item/shixun-item.js index 9954b1e..d2d7458 100644 --- a/miniprogram/components/shixun-item/shixun-item.js +++ b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.js @@ -6,10 +6,10 @@ Component({ type:Object, observer:function(data){ //name, image_url - this.setData({shixun:data}); + //console.log(data); + this.setData(data); } - }, - origin:String + } }, data: { eduUrl:global.config.eduUrl @@ -17,7 +17,7 @@ Component({ methods: { onTap(){ - app.navigateTo({url:"{shixun}?identifier="+this.data.shixun.identifier}) + app.navigateTo({url:"{shixun}?identifier="+this.data.identifier}) } } }) diff --git a/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.json b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml new file mode 100644 index 0000000..c7f3c97 --- /dev/null +++ b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml @@ -0,0 +1,13 @@ + + + + + {{name}} + + + + 已完成:{{finished_challenges_count}}/{{challenges_count}} + + + + \ No newline at end of file diff --git a/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxss b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxss new file mode 100644 index 0000000..5a67660 --- /dev/null +++ b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxss @@ -0,0 +1,34 @@ +.shixun{ + background: white; + padding: 10px 8px; + overflow: hidden; + word-wrap: break-word; + display: flex; +} + +.shixun-img{ + flex:none; + width: 250rpx; + height: 170rpx; + border-radius: 4px; + background: #221f53; +} +.detail{ + padding-top: 6px; + flex: auto; + width: 1px; + display: flex; + flex-direction: column; + justify-content: space-between; +} +.name{ + padding-left: 8px; +} +.progress-wrp{ + padding: 10px; +} +.finish-text{ + font-size: 12px; + font-weight: bold; + padding-left: 6px; +} \ No newline at end of file diff --git a/miniprogram/pages/search/search-item/search-item.js b/miniprogram/pages/search/search-item/search-item.js index 6047f81..5c94620 100644 --- a/miniprogram/pages/search/search-item/search-item.js +++ b/miniprogram/pages/search/search-item/search-item.js @@ -9,13 +9,25 @@ Component({ }, methods: { + enterInvite(){ + let {type, id} = this.data.data; + let {envVersion} = global.config; + if(envVersion!='develop'&&envVersion!='trial') + return; + if(type=='course') + app.navigateTo({url:"{course_invite}?course_id="+id}); + }, enterPage(){ - let {type} = this.data.data; + let {type, id, identifier} = this.data.data; switch(type){ case 'shixun': - return app.navigateTo({ url: "{shixun}?identifier=" + this.data.data.identifier}); + return app.navigateTo({ url: "{shixun}?identifier=" + identifier}); case "course": - return app.navigateTo({url:"{course}?course_id="+this.data.data.id}); + return app.navigateTo({url:"{course}?course_id="+id}); + case "subject": + case "path": + return app.navigateTo({url:"{path}?subject_id="+id}); + } } } diff --git a/miniprogram/pages/search/search-item/search-item.wxml b/miniprogram/pages/search/search-item/search-item.wxml index 4103905..7bb199e 100644 --- a/miniprogram/pages/search/search-item/search-item.wxml +++ b/miniprogram/pages/search/search-item/search-item.wxml @@ -1,4 +1,4 @@ - + diff --git a/miniprogram/pages/search/search.js b/miniprogram/pages/search/search.js index 91bd6c7..f4f97ae 100644 --- a/miniprogram/pages/search/search.js +++ b/miniprogram/pages/search/search.js @@ -1,9 +1,16 @@ const app = getApp(); +const typeMap = { + shixun:{current:0, type:"shixun"}, + path: {current:1, type:"subject"}, + subject:{current:1, type:"subject"}, + course:{current:2, type:"course"} +} Page({ data: { keyword:"", list:[ {text:"实训项目", type:"shixun"}, + {text:"实践课程", type:"subject"}, {text:"教学课堂", type:"course"} ] }, @@ -25,6 +32,7 @@ Page({ this.search({refresh:1}); }, search({refresh=0}={}){ + //console.log("search", this.options); if(refresh==1) this.setData({loading:1}); if(refresh){ @@ -39,6 +47,7 @@ Page({ this.options.page++; var {options} = this; } + //console.log("search2",options) return app.api("search")(options) .then(res=>{ console.error(res); @@ -57,15 +66,11 @@ Page({ }) }, onLoad: function (options) { - var {type="shixun", keyword=""} = options; + let {type:_type="shixun", keyword=""} = options; + let {type, current} = typeMap[_type]||typeMap["shixun"]; this.options = {page:1, per_page:20, type, keyword}; this.search({ refresh: 1 }); - for (var current=this.data.list.length-1; current >=0; current--){ - if(this.data.list[current].type==type) - break; - } this.setData({keyword, current}); - console.log(this.data); }, diff --git a/miniprogram/components/tiding-item/tiding-item.js b/miniprogram/pages/tidings/tiding-item/tiding-item.js similarity index 94% rename from miniprogram/components/tiding-item/tiding-item.js rename to miniprogram/pages/tidings/tiding-item/tiding-item.js index 2538980..2772b19 100644 --- a/miniprogram/components/tiding-item/tiding-item.js +++ b/miniprogram/pages/tidings/tiding-item/tiding-item.js @@ -1,5 +1,5 @@ const app = getApp(); -const { processObj, get, format } = require("../../js/utils"); +const { processObj, get, format } = require("../../../js/utils"); const ROUTE = { Course:{ diff --git a/miniprogram/pages/tidings/tiding-item/tiding-item.json b/miniprogram/pages/tidings/tiding-item/tiding-item.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/pages/tidings/tiding-item/tiding-item.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/components/tiding-item/tiding-item.wxml b/miniprogram/pages/tidings/tiding-item/tiding-item.wxml similarity index 100% rename from miniprogram/components/tiding-item/tiding-item.wxml rename to miniprogram/pages/tidings/tiding-item/tiding-item.wxml diff --git a/miniprogram/components/tiding-item/tiding-item.wxss b/miniprogram/pages/tidings/tiding-item/tiding-item.wxss similarity index 100% rename from miniprogram/components/tiding-item/tiding-item.wxss rename to miniprogram/pages/tidings/tiding-item/tiding-item.wxss diff --git a/miniprogram/pages/tidings/tidings.js b/miniprogram/pages/tidings/tidings.js index 0c51c4a..dbde15a 100644 --- a/miniprogram/pages/tidings/tidings.js +++ b/miniprogram/pages/tidings/tidings.js @@ -46,9 +46,10 @@ Page({ this.refresh(); }, onShow: function () { + let index = 2; this.refresh({refresh:2}) - wx.hideTabBarRedDot({index: 1}); - wx.removeTabBarBadge({index: 1}); + wx.hideTabBarRedDot({index}); + wx.removeTabBarBadge({index}); }, onPullDownRefresh: function () { diff --git a/miniprogram/pages/tidings/tidings.json b/miniprogram/pages/tidings/tidings.json index 67fed7a..9692017 100644 --- a/miniprogram/pages/tidings/tidings.json +++ b/miniprogram/pages/tidings/tidings.json @@ -1,6 +1,6 @@ { "usingComponents": { - "tiding-item":"/components/tiding-item/tiding-item", + "tiding-item":"./tiding-item/tiding-item", "nav-bar":"/components/nav-bar/nav-bar", "error-page":"/components/error-page/error-page" }, diff --git a/miniprogram/path/pages/path/path.js b/miniprogram/path/pages/path/path.js index a15ad70..cb7f087 100644 --- a/miniprogram/path/pages/path/path.js +++ b/miniprogram/path/pages/path/path.js @@ -1,66 +1,90 @@ -// miniprogram/path/pages/path/path.js +const app = getApp(); Page({ - /** - * 页面的初始数据 - */ data: { - + cates:[ + {text:"章节"}, + {text:"介绍"} + ] }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - + onSwitch({detail}){ + let {source, current} = detail + if(source=='touch'){ + this.setData({current}); + } }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - + collect(){ + 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}) + .then(res=>{ + console.log(res); + this.pullSubject({showLoading:0}); + if(is_collect){ + res.message = "已取消收藏"; + var icon = "success"; + var duration = 1500; + }else{ + var icon = "none"; + var duration = 3000; + } + wx.showToast({ + title: res.message, + icon, + duration + }) + }).catch(e=>{ + //console.log(e); + app.showError(e); + }) }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - + scrollTo({scrollTop}){ + wx.pageScrollTo({scrollTop,duration:380}) }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - + onLoad: function (options) { + this.subject_id = options.path_id||options.subject_id; + this.pullSubject(); }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + onEnterShixun(e){ + console.log(e.currentTarget); + let {currentTarget:{dataset:{allow_visit}}} = e; + if(!allow_visit) + wx.showToast({ + title: '该实训暂未公开',icon:"none" + }) }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - + pullSubject({showLoading=1}={}){ + if(showLoading) + wx.showLoading({ + title: '努力加载中' + }); + let {subject_id} = this; + let promise1 = app.api("paths")({subject_id}) + let promise2 = app.api("paths.right_banner")({subject_id}) + let promise3 = app.api("stages")({subject_id}) + Promise.all([promise1, promise2, promise3]) + .then(res=>{ + this.setData({subject:res[0], ...res[1], ...res[2]}, + res=>{ + if(showLoading) + wx.hideLoading() + }); + }).catch(e=>{ + if(e.code==403) + e.message = "您没有权限访问" + console.log(e); + wx.hideLoading(); + app.showError(e); + }) }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - /** - * 用户点击右上角分享 - */ onShareAppMessage: function () { - + //console.log(global.config.apiRoot , this.data.subject.cover ) + let {subject} = this.data; + return app.shareApp({ + title: subject.name, + imageUrl: global.config.eduUrl + "/" + subject.cover + }) } }) \ No newline at end of file diff --git a/miniprogram/path/pages/path/path.json b/miniprogram/path/pages/path/path.json index 8835af0..bb0c564 100644 --- a/miniprogram/path/pages/path/path.json +++ b/miniprogram/path/pages/path/path.json @@ -1,3 +1,8 @@ { - "usingComponents": {} + "usingComponents": { + "nav-bar":"/components/nav-bar/nav-bar", + "rich-md":"/components/rich-md/rich-md", + "mp-icon":"/weui-miniprogram/icon/icon" + }, + "navigationBarTitleText": "实践课程" } \ No newline at end of file diff --git a/miniprogram/path/pages/path/path.wxml b/miniprogram/path/pages/path/path.wxml index c63e4b2..5470e6f 100644 --- a/miniprogram/path/pages/path/path.wxml +++ b/miniprogram/path/pages/path/path.wxml @@ -1,2 +1,85 @@ - -miniprogram/path/pages/path/path.wxml + + + + + {{subject.name}} + + + + 章节 + {{subject.stages_count}} + + + 实训 + {{subject.shixuns_count}} + + + 关卡 + {{subject.challenges_count}} + + + 经验值 + {{subject.subject_score}} + + + 学习人数 + {{subject.member_count}} + + + + + 已学:{{progress.my_score}}/{{progress.all_score}} + + + + + + + + + + + + {{stage.stage_name}} + + + + + + + {{stage.stage_position}}-{{index+1}} + {{shixun.shixun_name}} + + + + + + + + + + + 简介 + + + + 课程须知 + + + + 技能标签 + + + + {{item.tag_name}} + + + + + + + + \ No newline at end of file diff --git a/miniprogram/path/pages/path/path.wxs b/miniprogram/path/pages/path/path.wxs new file mode 100644 index 0000000..000582a --- /dev/null +++ b/miniprogram/path/pages/path/path.wxs @@ -0,0 +1,15 @@ +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 }); + } +} + +module.exports={ + scroll: scroll +} \ No newline at end of file diff --git a/miniprogram/path/pages/path/path.wxss b/miniprogram/path/pages/path/path.wxss index 061c509..c77a194 100644 --- a/miniprogram/path/pages/path/path.wxss +++ b/miniprogram/path/pages/path/path.wxss @@ -1 +1,103 @@ -/* miniprogram/path/pages/path/path.wxss */ \ No newline at end of file + +.header{ + background: white; + margin-bottom: 4px; + border-bottom: 1px #eee solid; +} +.title{ + font-size: 18px; + padding: 10px; + font-weight: bold; +} +.subject-detail{ + display: flex; + justify-content: space-evenly; +} + +.detail-item{ + display: flex; + flex-direction: column; + align-items: center; + flex: 1; + font-size: 12px; +} +.detail-item>.key{ + padding-bottom: 4px; +} +.detail-item>.value{ + color: #009af0; + font-weight: bold; +} +.progress-wrp{ + padding: 12px; +} +.progress-wrp .score{ + padding-left: 8px; + font-size: 11px; + font-weight: bold; +} + +.body{ + background: white; + height: calc(100vh - 76px); +} +.cate-body{ + height: 100%; +} +.shixun{ + display: flex; + padding: 7px 6px 7px 12px; + align-items: center; +} +.shixun.forbidden{ + color: gray; +} +.shixun-index, +.shixun-icon{ + margin-right: 6px; +} +.cate-header{ + padding-left: 8px; +} +.cate-header.stage_name{ + margin: 5px 0; +} +.cate-header>.cate-name{ + padding-left: 10px; +} +.cate-header>.square{ + width: 0; + height: 0px; + border-radius: 10px; + border-left: 5px solid #00b0f0; +} +.tags-list{ + display: flex; + flex-wrap: wrap; + overflow-y: scroll; + padding: 6px; + max-height: 50vh; + font-size: 12px; + margin-top: 8px; +} +.tags-list>.tag{ + background: #f0f0f0; + color: #666; + border-radius: 30px; + padding: 4px 10px; + margin: 4px; + flex: none; +} +.tags-list>.tag.active{ + color: white; + background: #00b0f0; +} +.operations{ + position: sticky; + bottom: 0; + display: flex; +} +.operations>.collect{ + background: white!important; + flex: 1; +} \ No newline at end of file diff --git a/miniprogram/shixun/pages/shixun/shixun.js b/miniprogram/shixun/pages/shixun/shixun.js index 3b7128a..3005cbe 100644 --- a/miniprogram/shixun/pages/shixun/shixun.js +++ b/miniprogram/shixun/pages/shixun/shixun.js @@ -13,8 +13,30 @@ Page({ ], description:"" }, - log(e){ - console.log(e) + collect(){ + 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}) + .then(res=>{ + console.log(res); + this.pullShixun({showLoading: 0}); + if(is_collect){ + res.message = "已取消收藏"; + var icon = "success"; + var duration = 1500; + }else{ + var icon = "none"; + var duration = 3000; + } + wx.showToast({ + title: res.message, + icon, + duration + }) + }).catch(e=>{ + //console.log(e); + app.showError(e); + }) }, enterChallenge(){ wx.showLoading({ @@ -42,29 +64,30 @@ Page({ let {description, challenge_list:challenges} = await this.apiChallenges({identifier:this.data.identifier}); this.setData({description, challenges}); }, - async pullShixun(){ + async pullShixun({showLoading=1}={}){ + if(showLoading) + wx.showLoading({ + title: '努力加载中' + }) let {identifier} = this.data; let shixun = await this.apiShixun({identifier}); - this.setData({shixun}); + this.setData({shixun}, res=>{ + if(showLoading) + wx.hideLoading() + }); }, onLoad: function (options) { let {identifier,cate_type} = options; let current = cateTypes[cate_type]; this.setData({identifier, current}); - this.pullChallenges(); - this.pullShixun(); - }, - onShow: function () { - app.syncUser().then(res=>{ - this.setData({user:res.user}); - }) - }, - onPullDownRefresh: function () { - + this.pullChallenges().catch(e=>{ + + }); + this.pullShixun().catch(e=>{ + app.showError(e); + }); }, - onReachBottom: function () { - }, onShareAppMessage: function () { return app.shareApp({ title:this.data.shixun.name, diff --git a/miniprogram/shixun/pages/shixun/shixun.json b/miniprogram/shixun/pages/shixun/shixun.json index 7a8926e..b04cae9 100644 --- a/miniprogram/shixun/pages/shixun/shixun.json +++ b/miniprogram/shixun/pages/shixun/shixun.json @@ -7,5 +7,5 @@ }, "navigationBarBackgroundColor": "#0080f0", "navigationBarTextStyle": "white", - "navigationBarTitleText": "实训详情" + "navigationBarTitleText": "实训项目" } \ No newline at end of file diff --git a/miniprogram/shixun/pages/shixun/shixun.wxml b/miniprogram/shixun/pages/shixun/shixun.wxml index 9eae05a..a324c19 100644 --- a/miniprogram/shixun/pages/shixun/shixun.wxml +++ b/miniprogram/shixun/pages/shixun/shixun.wxml @@ -1,6 +1,6 @@ - + {{shixun.name}} @@ -19,7 +19,7 @@ - + @@ -44,5 +44,6 @@ + \ No newline at end of file diff --git a/miniprogram/shixun/pages/shixun/shixun.wxs b/miniprogram/shixun/pages/shixun/shixun.wxs index b1b4d9f..b358892 100644 --- a/miniprogram/shixun/pages/shixun/shixun.wxs +++ b/miniprogram/shixun/pages/shixun/shixun.wxs @@ -1,6 +1,6 @@ -var top = 126; +var top = 140; function scroll(e, ins){ - var scrollTop = e.detail.scrollTop; + //var scrollTop = e.detail.scrollTop; var deltaY = e.detail.deltaY; //console.log(scrollTop); //console.log(show,scrollTop<122); diff --git a/miniprogram/shixun/pages/shixun/shixun.wxss b/miniprogram/shixun/pages/shixun/shixun.wxss index dc697ac..5c5d140 100644 --- a/miniprogram/shixun/pages/shixun/shixun.wxss +++ b/miniprogram/shixun/pages/shixun/shixun.wxss @@ -10,10 +10,10 @@ .shixun-title{ background: #0080f0; font-weight: bolder; - padding-top: 6px; + padding: 2px 10px; font-size: 20px; color: white; - height: 80px; + height: 84px; width: 100%; } .shixun-detail{ @@ -42,7 +42,6 @@ font-size: 13px; } .cate{ - margin-top: 3px; background: white; overflow: hidden; } @@ -59,19 +58,22 @@ padding: 0 10px; } .body{ - height: calc(100vh - 74px); - margin-bottom: 40px; + height: calc(100vh - 76px); } .scroll-body{ height: 100%; background: white; } .operations{ - position: fixed; + position: sticky; bottom: 0; left:0; right:0; + display: flex; } .operations>button{ - width: auto!important; + flex: 1; +} +button.collect{ + background: white!important; } \ No newline at end of file diff --git a/miniprogram/shixun_homework/pages/shixun_homework/shixun_homework.wxss b/miniprogram/shixun_homework/pages/shixun_homework/shixun_homework.wxss index 98a1dfc..b4035b4 100644 --- a/miniprogram/shixun_homework/pages/shixun_homework/shixun_homework.wxss +++ b/miniprogram/shixun_homework/pages/shixun_homework/shixun_homework.wxss @@ -3,6 +3,7 @@ page,.homework{ } .header{ text-align: center; + padding-top: 16px; } .title{ font-weight: 560; @@ -19,7 +20,7 @@ page,.homework{ } .footer{ position: absolute; - bottom: 0; + bottom: 18px; left: 0; right: 0; } \ No newline at end of file diff --git a/miniprogram/sitemap.json b/miniprogram/sitemap.json index 58eb8d7..46615cd 100644 --- a/miniprogram/sitemap.json +++ b/miniprogram/sitemap.json @@ -1,6 +1,7 @@ { "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", "rules": [ + { "action": "allow", "page": "shixun/pages/shixun/shixun", @@ -9,6 +10,18 @@ ], "matching": "inclusive" }, + { + "action":"disallow", + "page":"account/pages/profile/profile" + }, + { + "action":"disallow", + "page":"task/pages/task/task" + }, + { + "action":"disallow", + "page":"course/pages/course/course" + }, { "action": "allow", "page": "*" diff --git a/miniprogram/task/pages/task/task.js b/miniprogram/task/pages/task/task.js index fdb773b..e2b182a 100644 --- a/miniprogram/task/pages/task/task.js +++ b/miniprogram/task/pages/task/task.js @@ -5,6 +5,7 @@ Page({ theme: 'light', current: 0, content:"加载中...", + attachDir: global.config.attachDir, titles: ["任务描述", "代码文件", "测评结果"], can_use_editor:wx.canIUse("editor") }, @@ -56,7 +57,10 @@ Page({ console.log(detail); let {value} = detail; let theme = value?'dark':'light'; - this.setData({theme}); + if(theme==this.data.theme) + return; + wx.showNavigationBarLoading() + this.setData({theme},wx.hideNavigationBarLoading); this.setNavigationTheme(); wx.setStorageSync('config-task-theme', theme); }, @@ -198,10 +202,17 @@ Page({ this.checkTime(); }, async pullTask(){ + wx.showLoading({ + title: '努力加载中', + }) + wx.showNavigationBarLoading(); let {identifier} = this.data; let res = await app.api("tasks")({identifier}); res.challenge.task_pass = res.challenge.task_pass.replace(/\[TOC\]\s*-+\s*/,"") - this.setData(res); + this.setData(res,()=>{ + wx.hideLoading(); + wx.hideNavigationBarLoading(); + }); }, async pullContent(){ @@ -242,7 +253,6 @@ Page({ let theme = wx.getStorageSync('config-task-theme'); this.setData({theme}); this.setNavigationTheme(); - let {identifier} = options; this.setData({identifier}); this.pullTask(); diff --git a/miniprogram/task/pages/task/task.wxml b/miniprogram/task/pages/task/task.wxml index b53144e..91e8757 100644 --- a/miniprogram/task/pages/task/task.wxml +++ b/miniprogram/task/pages/task/task.wxml @@ -7,7 +7,19 @@ 第{{challenge.position}}关:{{challenge.subject}} - 黑暗模式 + + + + + + 用EduCoder云网实训(推荐) + + 黑暗模式 + diff --git a/miniprogram/task/pages/task/task.wxss b/miniprogram/task/pages/task/task.wxss index 7ea9fd0..8fa1ad0 100644 --- a/miniprogram/task/pages/task/task.wxss +++ b/miniprogram/task/pages/task/task.wxss @@ -1,6 +1,21 @@ .body{ height: 100vh; } +.sub-header{ + display: flex; + padding-top: 14px; + margin-bottom: -10px; + justify-content: space-between; + align-items: center; +} +.nav-educoder{ + font-size: 12px; + padding-left: 12px; +} +.nav-educoder>.icon{ + height: 20px; + width: 20px; +} .dark{ background: black!important; color: white; diff --git a/miniprogram/theme.json b/miniprogram/theme.json new file mode 100644 index 0000000..9249692 --- /dev/null +++ b/miniprogram/theme.json @@ -0,0 +1,8 @@ +{ + "light": { + + }, + "dark": { + + } + } \ No newline at end of file diff --git a/project.config.json b/project.config.json index e8b79a6..fb61e1e 100644 --- a/project.config.json +++ b/project.config.json @@ -10,6 +10,7 @@ "es6": true, "enhance": true, "postcss": true, + "preloadBackgroundData": false, "minified": true, "newFeature": true, "coverView": true, @@ -27,6 +28,8 @@ "outputPath": "" }, "bundle": false, + "useCompilerModule": false, + "userConfirmedUseCompilerModuleSwitch": false, "skeletonGenerateFilesWithoutConfirm": true }, "compileType": "miniprogram", @@ -63,20 +66,6 @@ "miniprogram": { "current": -1, "list": [ - { - "id": -1, - "name": "account/pages/profile/profile", - "pathName": "account/pages/profile/profile", - "query": "", - "scene": null - }, - { - "id": 1, - "name": "account/pages/profile/school_select/school_select", - "pathName": "account/pages/profile/school_select/school_select", - "query": "keyword=国", - "scene": null - }, { "id": 2, "name": "home", @@ -91,32 +80,11 @@ "query": "", "scene": null }, - { - "id": -1, - "name": "authentication", - "pathName": "account/pages/authentication/authentication", - "query": "", - "scene": null - }, - { - "id": -1, - "name": "account/pages/pro_authentication/pro_authentication", - "pathName": "account/pages/pro_authentication/pro_authentication", - "query": "", - "scene": null - }, { "id": 6, "name": "course/pages/course/course", "pathName": "course/pages/course/course", - "query": "course_id=5141&module_type=exercise", - "scene": null - }, - { - "id": -1, - "name": "account/pages/accounts/accounts", - "pathName": "account/pages/accounts/accounts", - "query": "", + "query": "course_id=7582&module_type=students", "scene": null }, { @@ -133,13 +101,6 @@ "query": "course_identity=2&course_id=5141&id_=956", "scene": null }, - { - "id": 11, - "name": "course/pages/attendance_detail/attendance_detail", - "pathName": "course/pages/attendance_detail/attendance_detail", - "query": "course_identity=5&course_id=5141&code=&mode=&attendance_id=956", - "scene": null - }, { "id": -1, "name": "accounts", @@ -156,23 +117,37 @@ }, { "id": -1, - "name": "account/pages/profile/school_select/school_select", - "pathName": "account/pages/profile/school_select/school_select", + "name": "account/pages/profile/profile", + "pathName": "account/pages/profile/profile", "query": "course_id=5876", "scene": null }, { "id": -1, - "name": "account/pages/profile/profile", - "pathName": "account/pages/profile/profile", - "query": "course_id=5876", + "name": "爬虫访问", + "pathName": "pages/main/main", + "query": "course_id=7582&module_type=students", + "scene": 1129 + }, + { + "id": 16, + "name": "shixun/pages/shixun/shixun", + "pathName": "shixun/pages/shixun/shixun", + "query": "identifier=8bu9zmjy", + "scene": null + }, + { + "id": 17, + "name": "path/pages/path/path", + "pathName": "path/pages/path/path", + "query": "subject_id=13", "scene": null }, { "id": -1, - "name": "course/pages/teacher_apply/teacher_apply", - "pathName": "course/pages/teacher_apply/teacher_apply", - "query": "course_id=5141", + "name": "pages/findmore/findmore", + "pathName": "pages/findmore/findmore", + "query": "identifier=8bu9zmjy", "scene": null } ]