From f25c84d5e8985e9c46a347ae7de49ba7195754c3 Mon Sep 17 00:00:00 2001 From: educoder_weapp Date: Sat, 9 May 2020 22:39:54 +0800 Subject: [PATCH] =?UTF-8?q?U=20=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=EF=BC=8C=E5=8E=8B=E7=BC=A9=E4=B8=BB=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 8 +- .../rich-md.wxss => account/apiConfig.js} | 0 miniprogram/account/pages/about/about.json | 5 - miniprogram/account/pages/account/account.js | 1 + .../account/pages/account/account.wxml | 2 +- miniprogram/app.json | 51 ++-- miniprogram/config.js | 5 +- miniprogram/dev/pages/dev/dev.js | 72 ----- miniprogram/dev/pages/dev/dev.json | 5 - miniprogram/dev/pages/dev/dev.wxml | 1 - miniprogram/dev/pages/dev/dev.wxss | 3 - .../choice-question/choice-question.json | 6 - .../main-question/main-question.json | 6 - .../null-question/null-question.json | 6 - .../shixun-question/shixun-question.json | 6 - .../exercise/pages/exercise/exercise.js | 189 +----------- .../exercise/pages/exercise/exercise.json | 8 +- .../exercise/pages/exercise/exercise.wxml | 65 +--- .../exercise/pages/exercise/exercise.wxss | 119 +------- .../navigation-bar/navigaation-bar.wxml | 2 +- .../navigation-bar/navigation-bar.wxss | 3 + miniprogram/js/api.js | 180 +++++++++++- miniprogram/js/apiConfig.js | 13 - miniprogram/js/client.js | 12 +- miniprogram/js/edu.js | 115 -------- miniprogram/js/md5.js | 2 +- miniprogram/js/requests.js | 75 ----- .../pages => markdown/account}/about/about.js | 0 miniprogram/markdown/account/about/about.json | 5 + .../account}/about/about.wxml | 0 .../account}/about/about.wxss | 0 .../account}/agreement/agreement.js | 0 .../account}/agreement/agreement.json | 2 +- .../account}/agreement/agreement.wxml | 0 .../account}/agreement/agreement.wxss | 0 .../account}/authentication/authentication.js | 0 .../authentication/authentication.json | 2 +- .../authentication/authentication.wxml | 0 .../authentication/authentication.wxss | 0 .../markdown/account/form-item-common.wxss | 27 ++ .../pro_authentication/pro_authentication.js | 0 .../pro_authentication.json | 2 +- .../pro_authentication.wxml | 0 .../pro_authentication.wxss | 0 .../components/rich-md/rich-md.js | 10 +- .../components/rich-md/rich-md.json | 2 +- .../components/rich-md/rich-md.wxml | 0 .../components/rich-md/rich-md.wxss} | 0 .../choice-question/choice-question.js | 0 .../choice-question/choice-question.json | 6 + .../choice-question/choice-question.wxml | 0 .../choice-question/choice-question.wxss | 0 .../markdown/exercise/exercise/exercise.js | 192 ++++++++++++ .../markdown/exercise/exercise/exercise.json | 9 + .../markdown/exercise/exercise/exercise.wxml | 62 ++++ .../markdown/exercise/exercise/exercise.wxss | 118 ++++++++ .../exercise}/main-question/main-question.js | 0 .../exercise/main-question/main-question.json | 6 + .../main-question/main-question.wxml | 0 .../main-question/main-question.wxss | 0 .../exercise}/null-question/null-question.js | 0 .../exercise/null-question/null-question.json | 6 + .../null-question/null-question.wxml | 0 .../null-question/null-question.wxss | 0 .../exercise/exercise}/question-common.wxss | 0 .../shixun-question/shixun-question.js | 0 .../shixun-question/shixun-question.json | 6 + .../shixun-question/shixun-question.wxml | 0 .../shixun-question/shixun-question.wxss | 0 .../pages => markdown/path}/path/path.js | 0 .../pages => markdown/path}/path/path.json | 2 +- .../pages => markdown/path}/path/path.wxml | 0 .../pages => markdown/path}/path/path.wxs | 0 .../pages => markdown/path}/path/path.wxss | 0 .../path}/path_send/path_send.js | 0 .../path}/path_send/path_send.json | 0 .../path}/path_send/path_send.wxml | 0 .../path}/path_send/path_send.wxss | 0 .../shixun}/challenge-item/challenge-item.js | 0 .../challenge-item/challenge-item.json | 0 .../challenge-item/challenge-item.wxml | 0 .../challenge-item/challenge-item.wxss | 0 miniprogram/markdown/shixun/shixun/shixun.js | 103 +++++++ .../markdown/shixun/shixun/shixun.json | 12 + .../markdown/shixun/shixun/shixun.wxml | 51 ++++ .../shixun}/shixun/shixun.wxs | 0 .../markdown/shixun/shixun/shixun.wxss | 89 ++++++ miniprogram/markdown/task/task/task.js | 274 +++++++++++++++++ miniprogram/markdown/task/task/task.json | 8 + miniprogram/markdown/task/task/task.wxml | 64 ++++ .../pages => markdown/task}/task/task.wxs | 0 miniprogram/markdown/task/task/task.wxss | 89 ++++++ .../task/task}/test_set/test_set.js | 0 .../task/task}/test_set/test_set.json | 0 .../task/task}/test_set/test_set.wxml | 0 .../task/task}/test_set/test_set.wxs | 0 .../task/task}/test_set/test_set.wxss | 0 miniprogram/{ => markdown}/towxml/config.js | 0 miniprogram/{ => markdown}/towxml/decode.js | 0 miniprogram/markdown/towxml/decode.json | 9 + miniprogram/{ => markdown}/towxml/decode.wxml | 0 miniprogram/{ => markdown}/towxml/decode.wxss | 0 miniprogram/{ => markdown}/towxml/img/img.js | 0 .../{ => markdown}/towxml/img/img.json | 0 .../{ => markdown}/towxml/img/img.wxml | 0 .../{ => markdown}/towxml/img/img.wxss | 0 miniprogram/{ => markdown}/towxml/index.js | 0 .../{ => markdown}/towxml/latex/latex.js | 0 .../{ => markdown}/towxml/latex/latex.json | 0 .../{ => markdown}/towxml/latex/latex.wxml | 0 .../{ => markdown}/towxml/latex/latex.wxss | 0 .../towxml/parse/highlight/highlight.js | 0 .../towxml/parse/highlight/index.js | 0 .../towxml/parse/highlight/languages/css.js | 0 .../towxml/parse/highlight/languages/java.js | 0 .../parse/highlight/languages/javascript.js | 0 .../parse/highlight/languages/python.js | 0 .../towxml/parse/highlight/style/github.wxss | 0 .../towxml/parse/highlight/style/monokai.wxss | 0 .../{ => markdown}/towxml/parse/index.js | 0 .../towxml/parse/markdown/index.js | 0 .../towxml/parse/markdown/markdown.js | 0 .../towxml/parse/markdown/plugins/ins.js | 0 .../towxml/parse/markdown/plugins/latex.js | 0 .../towxml/parse/markdown/plugins/sub.js | 0 .../towxml/parse/markdown/plugins/sup.js | 0 .../towxml/parse/parse2/Parser.js | 0 .../towxml/parse/parse2/Tokenizer.js | 0 .../towxml/parse/parse2/domhandler/index.js | 0 .../towxml/parse/parse2/domhandler/node.js | 0 .../towxml/parse/parse2/entities/decode.js | 0 .../parse/parse2/entities/decode_codepoint.js | 0 .../towxml/parse/parse2/entities/encode.js | 0 .../towxml/parse/parse2/entities/index.js | 0 .../parse/parse2/entities/maps/decode.js | 0 .../parse/parse2/entities/maps/entities.js | 0 .../parse/parse2/entities/maps/legacy.js | 0 .../towxml/parse/parse2/entities/maps/xml.js | 0 .../towxml/parse/parse2/index.js | 0 .../{ => markdown}/towxml/style/main.wxss | 0 .../towxml/style/theme/dark.wxss | 0 .../towxml/style/theme/light.wxss | 0 .../{ => markdown}/towxml/table/table.js | 0 .../{ => markdown}/towxml/table/table.json | 0 .../{ => markdown}/towxml/table/table.wxml | 0 .../{ => markdown}/towxml/table/table.wxss | 0 miniprogram/{ => markdown}/towxml/towxml.js | 0 miniprogram/{ => markdown}/towxml/towxml.json | 0 miniprogram/{ => markdown}/towxml/towxml.wxml | 0 miniprogram/{ => markdown}/towxml/towxml.wxss | 0 miniprogram/pages/feedback/feedback.js | 5 - miniprogram/pages/feedback/feedback.json | 3 - miniprogram/pages/feedback/feedback.wxss | 1 - miniprogram/pages/findmore/findmore.js | 10 +- .../findmore/paths/path-item/path-item.wxml | 2 +- .../shixuns/shixun-item/shixun-item.wxml | 2 +- miniprogram/pages/home/home.wxml | 2 +- miniprogram/pages/main/main.js | 12 +- .../main/my_path/path-item/path-item.wxml | 2 +- .../my_shixun/shixun-item/shixun-item.wxml | 2 +- miniprogram/shixun/pages/shixun/shixun.js | 108 +------ miniprogram/shixun/pages/shixun/shixun.json | 11 +- miniprogram/shixun/pages/shixun/shixun.wxml | 53 +--- miniprogram/shixun/pages/shixun/shixun.wxss | 90 +----- miniprogram/task/pages/task/task.js | 278 +----------------- miniprogram/task/pages/task/task.json | 7 +- miniprogram/task/pages/task/task.wxml | 66 +---- miniprogram/task/pages/task/task.wxss | 90 +----- miniprogram/towxml/decode.json | 9 - 169 files changed, 1415 insertions(+), 1454 deletions(-) rename miniprogram/{components/rich-md/rich-md.wxss => account/apiConfig.js} (100%) delete mode 100644 miniprogram/account/pages/about/about.json delete mode 100644 miniprogram/dev/pages/dev/dev.js delete mode 100644 miniprogram/dev/pages/dev/dev.json delete mode 100644 miniprogram/dev/pages/dev/dev.wxml delete mode 100644 miniprogram/dev/pages/dev/dev.wxss delete mode 100644 miniprogram/exercise/components/choice-question/choice-question.json delete mode 100644 miniprogram/exercise/components/main-question/main-question.json delete mode 100644 miniprogram/exercise/components/null-question/null-question.json delete mode 100644 miniprogram/exercise/components/shixun-question/shixun-question.json delete mode 100644 miniprogram/js/edu.js rename miniprogram/{account/pages => markdown/account}/about/about.js (100%) create mode 100644 miniprogram/markdown/account/about/about.json rename miniprogram/{account/pages => markdown/account}/about/about.wxml (100%) rename miniprogram/{account/pages => markdown/account}/about/about.wxss (100%) rename miniprogram/{account/pages => markdown/account}/agreement/agreement.js (100%) rename miniprogram/{account/pages => markdown/account}/agreement/agreement.json (57%) rename miniprogram/{account/pages => markdown/account}/agreement/agreement.wxml (100%) rename miniprogram/{account/pages => markdown/account}/agreement/agreement.wxss (100%) rename miniprogram/{account/pages => markdown/account}/authentication/authentication.js (100%) rename miniprogram/{account/pages => markdown/account}/authentication/authentication.json (68%) rename miniprogram/{account/pages => markdown/account}/authentication/authentication.wxml (100%) rename miniprogram/{account/pages => markdown/account}/authentication/authentication.wxss (100%) create mode 100644 miniprogram/markdown/account/form-item-common.wxss rename miniprogram/{account/pages => markdown/account}/pro_authentication/pro_authentication.js (100%) rename miniprogram/{account/pages => markdown/account}/pro_authentication/pro_authentication.json (68%) rename miniprogram/{account/pages => markdown/account}/pro_authentication/pro_authentication.wxml (100%) rename miniprogram/{account/pages => markdown/account}/pro_authentication/pro_authentication.wxss (100%) rename miniprogram/{ => markdown}/components/rich-md/rich-md.js (94%) rename miniprogram/{ => markdown}/components/rich-md/rich-md.json (55%) rename miniprogram/{ => markdown}/components/rich-md/rich-md.wxml (100%) rename miniprogram/{pages/feedback/feedback.wxml => markdown/components/rich-md/rich-md.wxss} (100%) rename miniprogram/{exercise/components => markdown/exercise/exercise}/choice-question/choice-question.js (100%) create mode 100644 miniprogram/markdown/exercise/exercise/choice-question/choice-question.json rename miniprogram/{exercise/components => markdown/exercise/exercise}/choice-question/choice-question.wxml (100%) rename miniprogram/{exercise/components => markdown/exercise/exercise}/choice-question/choice-question.wxss (100%) create mode 100644 miniprogram/markdown/exercise/exercise/exercise.js create mode 100644 miniprogram/markdown/exercise/exercise/exercise.json create mode 100644 miniprogram/markdown/exercise/exercise/exercise.wxml create mode 100644 miniprogram/markdown/exercise/exercise/exercise.wxss rename miniprogram/{exercise/components => markdown/exercise/exercise}/main-question/main-question.js (100%) create mode 100644 miniprogram/markdown/exercise/exercise/main-question/main-question.json rename miniprogram/{exercise/components => markdown/exercise/exercise}/main-question/main-question.wxml (100%) rename miniprogram/{exercise/components => markdown/exercise/exercise}/main-question/main-question.wxss (100%) rename miniprogram/{exercise/components => markdown/exercise/exercise}/null-question/null-question.js (100%) create mode 100644 miniprogram/markdown/exercise/exercise/null-question/null-question.json rename miniprogram/{exercise/components => markdown/exercise/exercise}/null-question/null-question.wxml (100%) rename miniprogram/{exercise/components => markdown/exercise/exercise}/null-question/null-question.wxss (100%) rename miniprogram/{exercise/components => markdown/exercise/exercise}/question-common.wxss (100%) rename miniprogram/{exercise/components => markdown/exercise/exercise}/shixun-question/shixun-question.js (100%) create mode 100644 miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.json rename miniprogram/{exercise/components => markdown/exercise/exercise}/shixun-question/shixun-question.wxml (100%) rename miniprogram/{exercise/components => markdown/exercise/exercise}/shixun-question/shixun-question.wxss (100%) rename miniprogram/{path/pages => markdown/path}/path/path.js (100%) rename miniprogram/{path/pages => markdown/path}/path/path.json (74%) rename miniprogram/{path/pages => markdown/path}/path/path.wxml (100%) rename miniprogram/{path/pages => markdown/path}/path/path.wxs (100%) rename miniprogram/{path/pages => markdown/path}/path/path.wxss (100%) rename miniprogram/{path/pages => markdown/path}/path_send/path_send.js (100%) rename miniprogram/{path/pages => markdown/path}/path_send/path_send.json (100%) rename miniprogram/{path/pages => markdown/path}/path_send/path_send.wxml (100%) rename miniprogram/{path/pages => markdown/path}/path_send/path_send.wxss (100%) rename miniprogram/{shixun/components => markdown/shixun/shixun}/challenge-item/challenge-item.js (100%) rename miniprogram/{shixun/components => markdown/shixun/shixun}/challenge-item/challenge-item.json (100%) rename miniprogram/{shixun/components => markdown/shixun/shixun}/challenge-item/challenge-item.wxml (100%) rename miniprogram/{shixun/components => markdown/shixun/shixun}/challenge-item/challenge-item.wxss (100%) create mode 100644 miniprogram/markdown/shixun/shixun/shixun.js create mode 100644 miniprogram/markdown/shixun/shixun/shixun.json create mode 100644 miniprogram/markdown/shixun/shixun/shixun.wxml rename miniprogram/{shixun/pages => markdown/shixun}/shixun/shixun.wxs (100%) create mode 100644 miniprogram/markdown/shixun/shixun/shixun.wxss create mode 100644 miniprogram/markdown/task/task/task.js create mode 100644 miniprogram/markdown/task/task/task.json create mode 100644 miniprogram/markdown/task/task/task.wxml rename miniprogram/{task/pages => markdown/task}/task/task.wxs (100%) create mode 100644 miniprogram/markdown/task/task/task.wxss rename miniprogram/{task/components => markdown/task/task}/test_set/test_set.js (100%) rename miniprogram/{task/components => markdown/task/task}/test_set/test_set.json (100%) rename miniprogram/{task/components => markdown/task/task}/test_set/test_set.wxml (100%) rename miniprogram/{task/components => markdown/task/task}/test_set/test_set.wxs (100%) rename miniprogram/{task/components => markdown/task/task}/test_set/test_set.wxss (100%) rename miniprogram/{ => markdown}/towxml/config.js (100%) rename miniprogram/{ => markdown}/towxml/decode.js (100%) create mode 100644 miniprogram/markdown/towxml/decode.json rename miniprogram/{ => markdown}/towxml/decode.wxml (100%) rename miniprogram/{ => markdown}/towxml/decode.wxss (100%) rename miniprogram/{ => markdown}/towxml/img/img.js (100%) rename miniprogram/{ => markdown}/towxml/img/img.json (100%) rename miniprogram/{ => markdown}/towxml/img/img.wxml (100%) rename miniprogram/{ => markdown}/towxml/img/img.wxss (100%) rename miniprogram/{ => markdown}/towxml/index.js (100%) rename miniprogram/{ => markdown}/towxml/latex/latex.js (100%) rename miniprogram/{ => markdown}/towxml/latex/latex.json (100%) rename miniprogram/{ => markdown}/towxml/latex/latex.wxml (100%) rename miniprogram/{ => markdown}/towxml/latex/latex.wxss (100%) rename miniprogram/{ => markdown}/towxml/parse/highlight/highlight.js (100%) rename miniprogram/{ => markdown}/towxml/parse/highlight/index.js (100%) rename miniprogram/{ => markdown}/towxml/parse/highlight/languages/css.js (100%) rename miniprogram/{ => markdown}/towxml/parse/highlight/languages/java.js (100%) rename miniprogram/{ => markdown}/towxml/parse/highlight/languages/javascript.js (100%) rename miniprogram/{ => markdown}/towxml/parse/highlight/languages/python.js (100%) rename miniprogram/{ => markdown}/towxml/parse/highlight/style/github.wxss (100%) rename miniprogram/{ => markdown}/towxml/parse/highlight/style/monokai.wxss (100%) rename miniprogram/{ => markdown}/towxml/parse/index.js (100%) rename miniprogram/{ => markdown}/towxml/parse/markdown/index.js (100%) rename miniprogram/{ => markdown}/towxml/parse/markdown/markdown.js (100%) rename miniprogram/{ => markdown}/towxml/parse/markdown/plugins/ins.js (100%) rename miniprogram/{ => markdown}/towxml/parse/markdown/plugins/latex.js (100%) rename miniprogram/{ => markdown}/towxml/parse/markdown/plugins/sub.js (100%) rename miniprogram/{ => markdown}/towxml/parse/markdown/plugins/sup.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/Parser.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/Tokenizer.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/domhandler/index.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/domhandler/node.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/entities/decode.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/entities/decode_codepoint.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/entities/encode.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/entities/index.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/entities/maps/decode.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/entities/maps/entities.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/entities/maps/legacy.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/entities/maps/xml.js (100%) rename miniprogram/{ => markdown}/towxml/parse/parse2/index.js (100%) rename miniprogram/{ => markdown}/towxml/style/main.wxss (100%) rename miniprogram/{ => markdown}/towxml/style/theme/dark.wxss (100%) rename miniprogram/{ => markdown}/towxml/style/theme/light.wxss (100%) rename miniprogram/{ => markdown}/towxml/table/table.js (100%) rename miniprogram/{ => markdown}/towxml/table/table.json (100%) rename miniprogram/{ => markdown}/towxml/table/table.wxml (100%) rename miniprogram/{ => markdown}/towxml/table/table.wxss (100%) rename miniprogram/{ => markdown}/towxml/towxml.js (100%) rename miniprogram/{ => markdown}/towxml/towxml.json (100%) rename miniprogram/{ => markdown}/towxml/towxml.wxml (100%) rename miniprogram/{ => markdown}/towxml/towxml.wxss (100%) delete mode 100644 miniprogram/pages/feedback/feedback.js delete mode 100644 miniprogram/pages/feedback/feedback.json delete mode 100644 miniprogram/pages/feedback/feedback.wxss delete mode 100644 miniprogram/towxml/decode.json diff --git a/changelog.md b/changelog.md index 5d44ae3..e7df4b9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,10 @@ +## v0.16.2 + * A 支持选用实践课程 + * A 网络请求缓存 + ## v0.16.1 - * A 发送实训至课堂 - * A 探索实训界面支持多选 + * A 发送单个实训至课堂 + * A 探索的实训界面支持多选 ## v0.16.0 * A 探索界面 diff --git a/miniprogram/components/rich-md/rich-md.wxss b/miniprogram/account/apiConfig.js similarity index 100% rename from miniprogram/components/rich-md/rich-md.wxss rename to miniprogram/account/apiConfig.js diff --git a/miniprogram/account/pages/about/about.json b/miniprogram/account/pages/about/about.json deleted file mode 100644 index dc69edc..0000000 --- a/miniprogram/account/pages/about/about.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "usingComponents": { - "rich-md": "/components/rich-md/rich-md" - } -} \ No newline at end of file diff --git a/miniprogram/account/pages/account/account.js b/miniprogram/account/pages/account/account.js index f436269..3bf191f 100644 --- a/miniprogram/account/pages/account/account.js +++ b/miniprogram/account/pages/account/account.js @@ -1,3 +1,4 @@ +import apiConfig from "../../apiConfig"; import {accountManager} from "../../../js/utils"; const app = getApp(); diff --git a/miniprogram/account/pages/account/account.wxml b/miniprogram/account/pages/account/account.wxml index a935672..802374c 100644 --- a/miniprogram/account/pages/account/account.wxml +++ b/miniprogram/account/pages/account/account.wxml @@ -46,7 +46,7 @@ - + 登录即代表您同意 用户协议 diff --git a/miniprogram/app.json b/miniprogram/app.json index 287d4b2..ffbce86 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -13,21 +13,30 @@ "pages/main/main", "pages/findmore/findmore", "pages/home/home", - "pages/tidings/tidings", - "components/rich-md/rich-md", - "dev/pages/dev/dev" + "pages/tidings/tidings" ], "subpackages": [ + { + "root": "markdown", + "pages": [ + "task/task/task", + "components/rich-md/rich-md", + "account/about/about", + "account/agreement/agreement", + "account/pro_authentication/pro_authentication", + "exercise/exercise/exercise", + "path/path/path", + "path/path_send/path_send", + "shixun/shixun/shixun" + ] + }, { "root": "account", "pages": [ - "pages/agreement/agreement", - "pages/about/about", "pages/change_password/change_password", "pages/profile/profile", "pages/account/account", "pages/profile/school_select/school_select", - "pages/pro_authentication/pro_authentication", "pages/accounts/accounts", "pages/user_info/user_info" ] @@ -76,26 +85,12 @@ "pages/task/task" ] }, - { - "root": "path", - "pages": [ - "pages/path/path", - "pages/path_send/path_send" - ] - }, { "name": "search", "root": "pages/search", "pages": [ "search" ] - }, - { - "name": "feedback", - "root": "pages/feedback", - "pages": [ - "feedback" - ] } ], "preloadRule": { @@ -104,14 +99,15 @@ "packages": [ "shixun", "search", - "path" + "markdown" ] }, "pages/home/home": { "network": "all", "packages": [ "setting", - "account" + "account", + "markdown" ] }, "pages/main/main": { @@ -120,20 +116,21 @@ "course", "account", "shixun", - "path" + "markdown" ] }, "course/pages/course/course": { "network": "all", "packages": [ + "markdown", "exercise", "account" ] }, - "shixun/pages/shixun/shixun": { - "network": "all", - "packages": [ - "task" + "account/pages/account/account": { + "network":"all", + "packages":[ + "markdown" ] } }, diff --git a/miniprogram/config.js b/miniprogram/config.js index 7a47651..5d4cb6a 100644 --- a/miniprogram/config.js +++ b/miniprogram/config.js @@ -5,11 +5,10 @@ const developUrl = "https://test-newweb.educoder.net"; const trialUrl = "https://pre-newweb.educoder.net"; const releaseUrl = "https://www.educoder.net"; -let _version = "0.16.2"; +let _version = "0.16.3"; var eduUrl = releaseUrl; /** - * A 支持选用实践课程 - * A 网络请求缓存 + * U 优化项目结构,主包压缩一半 */ export function switchEnv(env) { diff --git a/miniprogram/dev/pages/dev/dev.js b/miniprogram/dev/pages/dev/dev.js deleted file mode 100644 index d35ed2b..0000000 --- a/miniprogram/dev/pages/dev/dev.js +++ /dev/null @@ -1,72 +0,0 @@ -// miniprogram/dev/pages/dev/dev.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - scrollTop:0, - re:false, - type:"secondary" - }, - onScanCode(e){ - - }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - var p =this.selectComponent("#main") - p.onLoad(); - p.onShow(); - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } -}) \ No newline at end of file diff --git a/miniprogram/dev/pages/dev/dev.json b/miniprogram/dev/pages/dev/dev.json deleted file mode 100644 index d201978..0000000 --- a/miniprogram/dev/pages/dev/dev.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "usingComponents": { - "main":"/pages/home/home" - } -} \ No newline at end of file diff --git a/miniprogram/dev/pages/dev/dev.wxml b/miniprogram/dev/pages/dev/dev.wxml deleted file mode 100644 index 126961e..0000000 --- a/miniprogram/dev/pages/dev/dev.wxml +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/miniprogram/dev/pages/dev/dev.wxss b/miniprogram/dev/pages/dev/dev.wxss deleted file mode 100644 index 37f466e..0000000 --- a/miniprogram/dev/pages/dev/dev.wxss +++ /dev/null @@ -1,3 +0,0 @@ -page{ - background: white; -} \ No newline at end of file diff --git a/miniprogram/exercise/components/choice-question/choice-question.json b/miniprogram/exercise/components/choice-question/choice-question.json deleted file mode 100644 index 8de232c..0000000 --- a/miniprogram/exercise/components/choice-question/choice-question.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "rich-md": "/components/rich-md/rich-md" - } -} \ No newline at end of file diff --git a/miniprogram/exercise/components/main-question/main-question.json b/miniprogram/exercise/components/main-question/main-question.json deleted file mode 100644 index 8de232c..0000000 --- a/miniprogram/exercise/components/main-question/main-question.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "rich-md": "/components/rich-md/rich-md" - } -} \ No newline at end of file diff --git a/miniprogram/exercise/components/null-question/null-question.json b/miniprogram/exercise/components/null-question/null-question.json deleted file mode 100644 index 8de232c..0000000 --- a/miniprogram/exercise/components/null-question/null-question.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "rich-md": "/components/rich-md/rich-md" - } -} \ No newline at end of file diff --git a/miniprogram/exercise/components/shixun-question/shixun-question.json b/miniprogram/exercise/components/shixun-question/shixun-question.json deleted file mode 100644 index 8de232c..0000000 --- a/miniprogram/exercise/components/shixun-question/shixun-question.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "component": true, - "usingComponents": { - "rich-md": "/components/rich-md/rich-md" - } -} \ No newline at end of file diff --git a/miniprogram/exercise/pages/exercise/exercise.js b/miniprogram/exercise/pages/exercise/exercise.js index 7848776..ca61208 100644 --- a/miniprogram/exercise/pages/exercise/exercise.js +++ b/miniprogram/exercise/pages/exercise/exercise.js @@ -1,192 +1,15 @@ -import {throttle} from "../../../js/utils"; -const app = getApp(); Page({ data: { - exercise_questions: [], - loading: true, - exercise: {}, - count_down:'试卷不限时' - }, - scrollToAnswerSheet(){ - wx.pageScrollTo({ - selector:".exercise-status" - }) - }, - scrollToQues(e){ - let {target: {dataset:{ques_id}}} = e; - ; - if(!ques_id) return; - wx.pageScrollTo({ - selector:"#q-"+ques_id - }); - }, - onAnswer(e){ - ; - let {detail:{q_position,answered}} = e; - let key = "question_status[" + (q_position - 1) +"].ques_status" - this.setData({[key]: answered}); - this.refreshAnsweredCount(); - }, - startCountDown({left_time}){ - var left = left_time; - var setCountDown = (time)=>{ - let s = time%60; - let m = parseInt(time/60)%60; - let h = parseInt(time/3600); - if(s<10) - s = '0' +s; - if(m<10) - m = '0' + m; - if(h<10) - h = '0' + h; - let count_down = h + ":" + m + ":" + s; - this.setData({count_down}); - } - setCountDown(--left); - var id = setInterval(()=>{ - if(left<=1){ - return this.stopCountDown(id); - } - setCountDown(--left); - },1000); - }, - stopCountDown(id){ - clearInterval(id); - var showToast = throttle(wx.showToast, 800, {});//延时Toast - showToast({ - title: '时间已到,系统自动为你提交中',icon:"none" - }) - app.api("exercises.commit_exercise")({exercise_id:this.exercise_id, commit_method:2}) - .then(res=>{ - showToast({ - title: "试卷提交成功!" - }); - //this.pull_questions(); - }).catch(e=>{ - //app.showError(e); - var title = '提交失败'; - //if(e.code==-2) - // title = '您未作答任何题'; - showToast({ - title, - icon:"none" - }); - let db = wx.cloud.database(); - db.collection("data").add({ - data: { - name: "exercises.commit_exercise", - e, - createdAt: db.serverDate() - } - }); - }) - this.setData({count_down: '考试时间已截止'}); - }, - refreshAnsweredCount(){ - if(!this.data.question_status) - return; - let answered_count = 0; - this.data.question_status.map(i=>{ - answered_count += i.ques_status; - }); - this.setData({answered_count}); - }, - pull_questions: function(){ - app.api("exercises.start_answer")({exercise_id: this.exercise_id}) - .then(res=>{ - ; - this.setData(res); - this.setData({loading: false}); - if(this.data.question_status) - this.refreshAnsweredCount(); - if(res.exercise.left_time) - this.startCountDown({left_time: res.exercise.left_time}); - }).catch(e => { - this.setData({status:e.code}); - app.showError(e); - }); - }, - save_exercise: function({show_loading=true}={}){ - if(show_loading){ - wx.showLoading({ - title: '请稍候', - }); - } - app.callApi({ name:"exercises.begin_commit", data:{exercise_id: this.exercise_id}, complete: wx.hideLoading}) - .then(res=>{ - if(show_loading){ - wx.showToast({ - title: "保存成功", - }); - } - }).catch(e=>{ - app.realTimeLog.error(e, "save exercise fail"); - }) - }, - commit_exercise: function(){ - //wx.showLoading({title: '检查作答情况中'}); - app.api("exercises.begin_commit")({ exercise_id: this.exercise_id}) - .then(resp=>{ - let {question_undo, shixun_undo} = resp; - if(question_undo==0) - var content = "交卷后无法更改作答,是否确认?" - else { - var content = "您还有"+question_undo+"题未作答"; - if(shixun_undo>0) - content += ",包含"+shixun_undo+"道实训题"; - content +=",是否现在交卷呢?"; - } - //wx.hideLoading(); - wx.showModal({ - title:"提示", - content, - success:res=>{ - if(res.confirm){ - app.api("exercises.commit_exercise")({exercise_id: this.exercise_id}) - .then(res=>{ - ; - ; - app.showMsg(res); - setTimeout(()=>{ - wx.navigateBack({ - delta:1 - }) - }, 800); - }) - .catch(e=>{ - app.showError(e); - }); - } - } - }) - - }) - .catch(e=>{ - app.showError(e); - }); }, onLoad: function (options) { - this.exercise_id = options.exercise_id; - this.course_name = options.exercise_name; - this.pull_questions(); - }, - - onShow: function () { - - }, - - onHide: function () { - this.save_exercise({show_loading: false}); - }, - - onUnload: function () { - this.save_exercise({ show_loading: false }); - }, - - onPullDownRefresh: function () { - + if(options) + var query = "?" + Object.keys(options).map(i=>`${i}=${options[i]}`).join("&"); + else + var query = "" + wx.redirectTo({url: "/markdown/exercise/exercise/exercise" + query}); + global.realTimeLog.error("unexpected page"); } }) \ No newline at end of file diff --git a/miniprogram/exercise/pages/exercise/exercise.json b/miniprogram/exercise/pages/exercise/exercise.json index 0fe1539..8835af0 100644 --- a/miniprogram/exercise/pages/exercise/exercise.json +++ b/miniprogram/exercise/pages/exercise/exercise.json @@ -1,9 +1,3 @@ { - "usingComponents": { - "choice-question":"/exercise/components/choice-question/choice-question", - "main-question": "/exercise/components/main-question/main-question", - "null-question": "/exercise/components/null-question/null-question", - "shixun-question":"/exercise/components/shixun-question/shixun-question" - }, - "navigationBarTitleText": "试卷" + "usingComponents": {} } \ No newline at end of file diff --git a/miniprogram/exercise/pages/exercise/exercise.wxml b/miniprogram/exercise/pages/exercise/exercise.wxml index aa98623..6a93a00 100644 --- a/miniprogram/exercise/pages/exercise/exercise.wxml +++ b/miniprogram/exercise/pages/exercise/exercise.wxml @@ -1,62 +1,3 @@ - - - - - - - - 倒计时:{{count_down}} - - - 答题卡 - {{answered_count}}/{{question_status.length}} - - - - - - 总分 - {{user_score}}/{{exercise_types.q_scores}} - - 客观题 - - - {{item.ques_position}} - {{item.user_score||'未评分'}} - - - - - 主观题 - - - {{item.ques_position}} - {{item.user_score||'未评分'}} - - - - - - - - - - - - ----- END ---- - - - - 作答情况 - - - {{item.ques_number}} - - - - - - - - \ No newline at end of file + +跳转中... + \ No newline at end of file diff --git a/miniprogram/exercise/pages/exercise/exercise.wxss b/miniprogram/exercise/pages/exercise/exercise.wxss index 8f45be6..ff485bf 100644 --- a/miniprogram/exercise/pages/exercise/exercise.wxss +++ b/miniprogram/exercise/pages/exercise/exercise.wxss @@ -1,118 +1 @@ -page{ - overflow-x: hidden; -} -.header{ - position: fixed; - top: 0; - background: white; - display: flex; - align-items: center; - height: 40px; - width: 100%; - z-index: 1000; - justify-content: space-evenly; - font-size: 15px; - box-shadow: 2px 2px 2px #dddddd; -} -.left-time{ - padding: 0 8px 0 12px; -} -.count-down{ - flex:auto; - text-align: center; -} -.answer-count{ - padding: 0 12px 0 8px; - font-size: 13px; - color: #0095f0; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; -} -.answer-count-num{ - font-size: 11px; -} - - -.header-place-holder{ - height: 40px; -} -.user-score{ - text-align: center; - font-size: 18px; - padding-bottom: 12px; -} - -.total-score{ - font-weight: bolder; -} - -.exercise-status, -.exercise-score{ - background: white; - padding: 12px; -} -.statuses, -.scores{ - display: flex; - flex-wrap: wrap; -} - -.status-item, -.score-item{ - border-radius: 4px; - margin: 8px 0 8px 10px; - width: 44px; - height: 44px; - display: flex; - justify-content: center; - align-items: center; - flex: none; -} -.status-item{ - background: #cbcbcb; - color: white; -} -.status-item.answered{ - background: #00b0f0; -} -.score-item{ - color: #00b0f0; - border: 1px #00b0f0 solid; - position: relative; -} - -.score{ - position: absolute; - bottom: -8px; - font-size: 10px; - color: white; - border-radius: 32px; - padding: 1.8px 5px; - white-space: nowrap; -} -.score.right{ - background: #00b0f0; -} -.score.wrong{ - background: #fa5151; -} - -.question-wrap{ - margin: 8px 10px; -} -.end{ - text-align: center; - margin: 10px; - color: dimgray; -} - -.operations{ - display: flex; - padding: 2px; -} -.operations>button{ - flex: 1; -} - +/* miniprogram/exercise/pages/exercise/exercise.wxss */ \ No newline at end of file diff --git a/miniprogram/includes/navigation-bar/navigaation-bar.wxml b/miniprogram/includes/navigation-bar/navigaation-bar.wxml index da26154..c4c4c1e 100644 --- a/miniprogram/includes/navigation-bar/navigaation-bar.wxml +++ b/miniprogram/includes/navigation-bar/navigaation-bar.wxml @@ -1,5 +1,5 @@ - + diff --git a/miniprogram/includes/navigation-bar/navigation-bar.wxss b/miniprogram/includes/navigation-bar/navigation-bar.wxss index fae84f2..c462e70 100644 --- a/miniprogram/includes/navigation-bar/navigation-bar.wxss +++ b/miniprogram/includes/navigation-bar/navigation-bar.wxss @@ -3,6 +3,9 @@ background: #00b0f0; flex: none; } +.status-bar{ + transition: all ease-out 0.6s +} .navigation-bar{ height: 44px; padding-right: 105px; diff --git a/miniprogram/js/api.js b/miniprogram/js/api.js index fe35e91..f272525 100644 --- a/miniprogram/js/api.js +++ b/miniprogram/js/api.js @@ -1,8 +1,180 @@ -class Record{ - +import apiConfig from "./apiConfig"; + +export class Session{ + cookies = "" + constructor(){ + + } + saveCookies(cookies){ + this.cookies = cookies.map(item => item.split(";")[0]).join("; "); + } + splitCookies(string){ + let cookies = string.split(/,\s?(?=[^=,\;]*?\=)/ig); + return cookies; + } + request({ url, header, success,...options}) { + return wx.request({ + ...options, + url, + header: {...header, "Cookie": this.cookies}, + success: (res) => { + if (res.cookies && res.cookies.length>0) + this.saveCookies(res.cookies); + else if (res.header["Set-Cookie"]) + this.saveCookies(this.splitCookies(res.header["Set-Cookie"])); + else if(res.header["set-cookie"]) + this.saveCookies(this.splitCookies(res.header["set-Cookie"])); + success(res); + if(url.indexOf("login.json")!=-1&&!res.data.status&&!this.cookies){ + wx.reportMonitor("0", 2); + global.realTimeLog.error(res, "login fail: fail parse cookies!!", res); + } + } + }); + } + uploadFile({url, filePath, name, header, formData, success, fail, complete}){ + return wx.uploadFile({ + url, + filePath, + name, + header: {"Cookie": this.cookies, ...header}, + formData, + success:res=>{ + try{ + res.data = JSON.parse(res.data); + }catch(e){ + //@todo + } + ; + if(success) + success(res) + }, + fail, + complete + }) + } + downloadFile({url, header, filePath, success, fail, complete}){ + return wx.downloadFile({ + url, + header: {...header, "Cookie": this.cookies}, + filePath, + success, + fail, + complete + }) + } } -export default function Api(options){ +function handler({success, fail, complete, resolve, reject}){ + return { + success: res => { + if (res.data.status && res.data.status > 100 || res.data.status<0) { + switch (res.data.status) { + case 401: + var message = "(●'◡'●)\n请先登录哦"; + var code = res.data.status; + break; + default: + var message = res.data.message; + var code = res.data.status; + } + let e = new Error(message); + e.code = code; + if (fail) fail(e, res.data); + reject(e, res.data); + return complete&&complete(e, res.data); + } + success&&success(res.data); + resolve(res.data); + complete&&complete(res.data); + }, + fail: e => { + if ("errMsg" in e) + (e = new Error("(⋟﹏⋞)\n网络连接失败了")).code = -2; + if (!("message" in e)) + (e = new Error("哎呀,出错了\n(>_<)")).code = -1; + fail&& fail(e, {}); + reject(e, {}); + complete&&complete(e, {}); + } + } +} -} \ No newline at end of file +export function triggerApi({session, name, data:_data = {}, success, fail, complete, config:{method,header={}}={}}) { + let api = apiConfig; + for (var key of name.split(".")) api=api[key]; + let { url, query={}, form = {}, config:{method:_method,_header={},...config}={}} = api; + method = method || _method; + if(url){ + if(url._) + url = url[method||"GET"]||url._; + url = name.replace(/\.?[^\.]+$|\./g, "/") + url.replace(/\{(.*?)\}/, function (match, k) { + return _data[k]; + }).replace(/\*/g,key); + }else + url = name.replace(/\./g, "/"); + url = global.config.apiRoot + url + ".json"; + header = {..._header,...header}; + var data={},param={}; + if(form._) + form={...form._,...form[method||"GET"]}; + if(query._) + query={...query._,...query[method||"GET"]}; + for(var key in form){ + if(key in _data) + data[key]=_data[key]; + else{ + let value = form[key]; + if (value!=null) + data[key] = value; + else if (typeof value == "object") + console.error(`${key} was not given in data`, _data); + } + } + for(var key in query){ + if (key in _data) + param[key] = _data[key]; + else { + let value = query[key]; + if (value!=null) + param[key] = value; + else if (typeof value == "object") + console.error(`${key} was not given in data`, _data); + } + } + let queryStr = Object.keys(param).map(key => `${key}=${param[key]}`).join("&"); + if(queryStr) + url = url+"?"+queryStr; + if(method=="uploadFile"){ + + var formData = data; + var {name:_name, timeout} = config; + if(!_name) + _name = Object.keys(formData)[0]; + var filePath = formData[_name]; + delete formData[_name]; + return new Promise((resolve, reject)=>{ + session.uploadFile({ + url, filePath, name:_name, header, timeout, formData, ...handler({success, fail, complete, resolve, reject}) + }) + }); + }else if(method=="downloadFile"){ + return new Promise((resolve,reject)=>{ + session.downloadFile({ + url, header, success:res=>{ + resolve(res); + success&&success(res); + }, fail:e=>{ + reject(e); + fail&&fail(e) + },complete + }) + }) + }else + return new Promise((resolve, reject) => { + session.request({ + url, method, data, header,...handler({success, fail, complete, resolve, reject}) + }); + }) +} diff --git a/miniprogram/js/apiConfig.js b/miniprogram/js/apiConfig.js index 601000d..4bc3c0b 100644 --- a/miniprogram/js/apiConfig.js +++ b/miniprogram/js/apiConfig.js @@ -201,17 +201,4 @@ weapps:{ export default apiConfig; -export function setApi(obj){ - for(var kstr in obj){ - var value = obj[kstr]; - var ref = apiConfig - for(var k of kstr.split(".")){ - if(!(k in ref)) - ref[k]={} - ref = ref[k]; - } - Object.assign(ref, value); - } -} -global.setApi = setApi; global.apiConfig = apiConfig; \ No newline at end of file diff --git a/miniprogram/js/client.js b/miniprogram/js/client.js index c6377e3..99352a3 100644 --- a/miniprogram/js/client.js +++ b/miniprogram/js/client.js @@ -1,10 +1,9 @@ -import apiConfig from "./apiConfig"; -import edu from "./edu"; + +import {triggerApi, Session} from "./api"; import md5 from "./md5"; -import Session from "./requests"; -import { getResConstruction, accountManager} from "./utils"; +import { accountManager} from "./utils"; -export default class Client{ +class Client{ constructor({session} = {}) { this.session = session || new Session(); this.user = {}; @@ -134,6 +133,7 @@ export default class Client{ return {randomcode:this.randomcode,client_key:this.client_key}; } api(name,config={},data={}){ + global.realTimeLog.error("call desprated method!!!"); return ({success, fail, complete,..._data}={})=>{ return this.callApi({name,config, data:{...data,..._data}, success, fail, complete}); } @@ -142,7 +142,7 @@ export default class Client{ let session = this.session; let _data = this.trigger("before",name,data)||{}; data = {..._data, ...data}; - return edu({ + return triggerApi({ session, name, config, data: {...this.refresh_key(),...data}, success:res=>{ this.trigger("success",name,res); diff --git a/miniprogram/js/edu.js b/miniprogram/js/edu.js deleted file mode 100644 index af8c2bd..0000000 --- a/miniprogram/js/edu.js +++ /dev/null @@ -1,115 +0,0 @@ -import apiConfig from "./apiConfig"; - -function handler({success, fail, complete, resolve, reject}){ - return { - success: res => { - if (res.data.status && res.data.status > 100 || res.data.status<0) { - switch (res.data.status) { - case 401: - var message = "(●'◡'●)\n请先登录哦"; - var code = res.data.status; - break; - default: - var message = res.data.message; - var code = res.data.status; - } - let e = new Error(message); - e.code = code; - if (fail) fail(e, res.data); - reject(e, res.data); - return complete&&complete(e, res.data); - } - success&&success(res.data); - resolve(res.data); - complete&&complete(res.data); - }, - fail: e => { - if ("errMsg" in e) - (e = new Error("(⋟﹏⋞)\n网络连接失败了")).code = -2; - if (!("message" in e)) - (e = new Error("哎呀,出错了\n(>_<)")).code = -1; - fail&& fail(e, {}); - reject(e, {}); - complete&&complete(e, {}); - } - } -} - - -export default function ({ name, data:_data = {}, session, success, fail, complete, config:{method,header={}}={}}) { - let api = apiConfig; - for (var key of name.split(".")) api=api[key]; - let { url, query={}, form = {}, config:{method:_method,_header={},...config}={}} = api; - method = method || _method; - if(url){ - if(url._) - url = url[method||"GET"]||url._; - url = name.replace(/\.?[^\.]+$|\./g, "/") + url.replace(/\{(.*?)\}/, function (match, k) { - return _data[k]; - }).replace(/\*/g,key); - }else - url = name.replace(/\./g, "/"); - url = global.config.apiRoot + url + ".json"; - header = {..._header,...header}; - var data={},param={}; - if(form._) - form={...form._,...form[method||"GET"]}; - if(query._) - query={...query._,...query[method||"GET"]}; - for(var key in form){ - if(key in _data) - data[key]=_data[key]; - else{ - let value = form[key]; - if (value!=null) - data[key] = value; - else if (typeof value == "object") - console.error(`${key} was not given in data`, _data); - } - } - for(var key in query){ - if (key in _data) - param[key] = _data[key]; - else { - let value = query[key]; - if (value!=null) - param[key] = value; - else if (typeof value == "object") - console.error(`${key} was not given in data`, _data); - } - } - let queryStr = Object.keys(param).map(key => `${key}=${param[key]}`).join("&"); - if(queryStr) - url = url+"?"+queryStr; - if(method=="uploadFile"){ - - var formData = data; - var {name:_name, timeout} = config; - if(!_name) - _name = Object.keys(formData)[0]; - var filePath = formData[_name]; - delete formData[_name]; - return new Promise((resolve, reject)=>{ - session.uploadFile({ - url, filePath, name:_name, header, timeout, formData, ...handler({success, fail, complete, resolve, reject}) - }) - }); - }else if(method=="downloadFile"){ - return new Promise((resolve,reject)=>{ - session.downloadFile({ - url, header, success:res=>{ - resolve(res); - success&&success(res); - }, fail:e=>{ - reject(e); - fail&&fail(e) - },complete - }) - }) - }else - return new Promise((resolve, reject) => { - session.request({ - url, method, data, header,...handler({success, fail, complete, resolve, reject}) - }); - }) -} diff --git a/miniprogram/js/md5.js b/miniprogram/js/md5.js index d8cebc6..8c9c456 100644 --- a/miniprogram/js/md5.js +++ b/miniprogram/js/md5.js @@ -1 +1 @@ -var k="79e33abd4b6588941ab7622aed1e67e8";class K{static e(t,a){t=C.e(t);for(var n=C.b(t),i=8*t.length,o=1732584193,e=-271733879,r=-1732584194,s=271733878,m=0;m>>24)|4278255360&(n[m]<<24|n[m]>>>8);n[i>>>5]|=128<>>9<<4)]=i;var l=K.f,f=K.g,c=K.h,d=K.i;for(m=0;m>>0,e=e+p>>>0,r=r+u>>>0,s=s+x>>>0}return C.a([o,e,r,s])}static f(t,a,n,i,o,e,r){var s=t+(a&n|~a&i)+(o>>>0)+r;return(s<>>32-e)+a}static g(t,a,n,i,o,e,r){var s=t+(a&i|n&~i)+(o>>>0)+r;return(s<>>32-e)+a}static h(t,a,n,i,o,e,r){var s=t+(a^n^i)+(o>>>0)+r;return(s<>>32-e)+a}static i(t,a,n,i,o,e,r){var s=t+(n^(a|~i))+(o>>>0)+r;return(s<>>32-e)+a}static m(t){var n=C.c(K.e(t));return C.d(n)}} class C{static r(t,a){return t<>>32-a}static a(t){if(t.constructor==Number)return 16711935&C.r(t,8)|4278255360&C.r(t,24);for(var a=0;a>>5]|=t[n]<<24-i%32;return a}static c(t){for(var a=[],n=0;n<32*t.length;n+=8)a.push(t[n>>>5]>>>24-n%32&255);return a}static d(t){for(var a=[],n=0;n>>4).toString(16)),a.push((15&t[n]).toString(16));return a.join("")}static e(t){for(var a=[],n=0;n>>24)|4278255360&(n[m]<<24|n[m]>>>8);n[i>>>5]|=128<>>9<<4)]=i;var l=K.f,f=K.g,c=K.h,d=K.i;for(m=0;m>>0,e=e+p>>>0,r=r+u>>>0,s=s+x>>>0}return C.a([o,e,r,s])}static f(t,a,n,i,o,e,r){var s=t+(a&n|~a&i)+(o>>>0)+r;return(s<>>32-e)+a}static g(t,a,n,i,o,e,r){var s=t+(a&i|n&~i)+(o>>>0)+r;return(s<>>32-e)+a}static h(t,a,n,i,o,e,r){var s=t+(a^n^i)+(o>>>0)+r;return(s<>>32-e)+a}static i(t,a,n,i,o,e,r){var s=t+(n^(a|~i))+(o>>>0)+r;return(s<>>32-e)+a}static m(t){var n=C.c(K.e(t));return C.d(n)}} class C{static r(t,a){return t<>>32-a}static a(t){if(t.constructor==Number)return 16711935&C.r(t,8)|4278255360&C.r(t,24);for(var a=0;a>>5]|=t[n]<<24-i%32;return a}static c(t){for(var a=[],n=0;n<32*t.length;n+=8)a.push(t[n>>>5]>>>24-n%32&255);return a}static d(t){for(var a=[],n=0;n>>4).toString(16)),a.push((15&t[n]).toString(16));return a.join("")}static e(t){for(var a=[],n=0;n item.split(";")[0]).join("; "); - } - splitCookies(string){ - let cookies = string.split(/,\s?(?=[^=,\;]*?\=)/ig); - return cookies; - } - request({ url, header, success,...options}) { - return wx.request({ - ...options, - url, - header: {...header, "Cookie": this.cookies}, - success: (res) => { - if (res.cookies && res.cookies.length>0) - this.saveCookies(res.cookies); - else if (res.header["Set-Cookie"]) - this.saveCookies(this.splitCookies(res.header["Set-Cookie"])); - else if(res.header["set-cookie"]) - this.saveCookies(this.splitCookies(res.header["set-Cookie"])); - success(res); - if(url.indexOf("login.json")!=-1&&!res.data.status&&!this.cookies){ - wx.reportMonitor("0",2); - global.realTimeLog.error(res, "login fail: fail parse cookies!!"); - var db = wx.cloud.database(); - db.collection("failCookies").add({ - data:{ - createdAt: db.serverDate(), - res, - header:res.header, - "Set-Cookies": res.header["Set-Cookie"], - "set-cookie":res.header["set-cookie"], - cookies:res.cookies - } - }) - } - } - }); - } - uploadFile({url, filePath, name, header, formData, success, fail, complete}){ - return wx.uploadFile({ - url, - filePath, - name, - header: {"Cookie": this.cookies, ...header}, - formData, - success:res=>{ - try{ - res.data = JSON.parse(res.data); - }catch(e){ - //@todo - } - ; - if(success) - success(res) - }, - fail, - complete - }) - } - downloadFile({url, header, filePath, success, fail, complete}){ - return wx.downloadFile({ - url, - header: {...header, "Cookie": this.cookies}, - filePath, - success, - fail, - complete - }) - } -} diff --git a/miniprogram/account/pages/about/about.js b/miniprogram/markdown/account/about/about.js similarity index 100% rename from miniprogram/account/pages/about/about.js rename to miniprogram/markdown/account/about/about.js diff --git a/miniprogram/markdown/account/about/about.json b/miniprogram/markdown/account/about/about.json new file mode 100644 index 0000000..e0ad9d3 --- /dev/null +++ b/miniprogram/markdown/account/about/about.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "rich-md": "/markdown/components/rich-md/rich-md" + } +} \ No newline at end of file diff --git a/miniprogram/account/pages/about/about.wxml b/miniprogram/markdown/account/about/about.wxml similarity index 100% rename from miniprogram/account/pages/about/about.wxml rename to miniprogram/markdown/account/about/about.wxml diff --git a/miniprogram/account/pages/about/about.wxss b/miniprogram/markdown/account/about/about.wxss similarity index 100% rename from miniprogram/account/pages/about/about.wxss rename to miniprogram/markdown/account/about/about.wxss diff --git a/miniprogram/account/pages/agreement/agreement.js b/miniprogram/markdown/account/agreement/agreement.js similarity index 100% rename from miniprogram/account/pages/agreement/agreement.js rename to miniprogram/markdown/account/agreement/agreement.js diff --git a/miniprogram/account/pages/agreement/agreement.json b/miniprogram/markdown/account/agreement/agreement.json similarity index 57% rename from miniprogram/account/pages/agreement/agreement.json rename to miniprogram/markdown/account/agreement/agreement.json index 0059f77..f82336e 100644 --- a/miniprogram/account/pages/agreement/agreement.json +++ b/miniprogram/markdown/account/agreement/agreement.json @@ -1,6 +1,6 @@ { "usingComponents": { - "rich-md": "/components/rich-md/rich-md" + "rich-md": "/markdown/components/rich-md/rich-md" }, "navigationBarTitleText": "服务协议" } \ No newline at end of file diff --git a/miniprogram/account/pages/agreement/agreement.wxml b/miniprogram/markdown/account/agreement/agreement.wxml similarity index 100% rename from miniprogram/account/pages/agreement/agreement.wxml rename to miniprogram/markdown/account/agreement/agreement.wxml diff --git a/miniprogram/account/pages/agreement/agreement.wxss b/miniprogram/markdown/account/agreement/agreement.wxss similarity index 100% rename from miniprogram/account/pages/agreement/agreement.wxss rename to miniprogram/markdown/account/agreement/agreement.wxss diff --git a/miniprogram/account/pages/authentication/authentication.js b/miniprogram/markdown/account/authentication/authentication.js similarity index 100% rename from miniprogram/account/pages/authentication/authentication.js rename to miniprogram/markdown/account/authentication/authentication.js diff --git a/miniprogram/account/pages/authentication/authentication.json b/miniprogram/markdown/account/authentication/authentication.json similarity index 68% rename from miniprogram/account/pages/authentication/authentication.json rename to miniprogram/markdown/account/authentication/authentication.json index 72d117a..7529258 100644 --- a/miniprogram/account/pages/authentication/authentication.json +++ b/miniprogram/markdown/account/authentication/authentication.json @@ -1,6 +1,6 @@ { "usingComponents": { - "rich-md":"/components/rich-md/rich-md", + "rich-md":"/markdown/components/rich-md/rich-md", "iconfont":"/components/iconfont/iconfont" }, "navigationBarTitleText": "实名认证" diff --git a/miniprogram/account/pages/authentication/authentication.wxml b/miniprogram/markdown/account/authentication/authentication.wxml similarity index 100% rename from miniprogram/account/pages/authentication/authentication.wxml rename to miniprogram/markdown/account/authentication/authentication.wxml diff --git a/miniprogram/account/pages/authentication/authentication.wxss b/miniprogram/markdown/account/authentication/authentication.wxss similarity index 100% rename from miniprogram/account/pages/authentication/authentication.wxss rename to miniprogram/markdown/account/authentication/authentication.wxss diff --git a/miniprogram/markdown/account/form-item-common.wxss b/miniprogram/markdown/account/form-item-common.wxss new file mode 100644 index 0000000..aa9da68 --- /dev/null +++ b/miniprogram/markdown/account/form-item-common.wxss @@ -0,0 +1,27 @@ +.form-item { + background: #fefefe; + display: flex; + justify-content: space-between; + align-items: center; + padding: 14px 12px; + margin-bottom: 1px; +} + +.form-item>.value { + text-align: right; + flex: auto; +} + +.form-item>.key { + display: inline-block; + flex: none; +} + +.form-item .tip { + font-size: 12px; + color: dimgray; +} + +.form-item>switch { + transform: scale(0.8); +} diff --git a/miniprogram/account/pages/pro_authentication/pro_authentication.js b/miniprogram/markdown/account/pro_authentication/pro_authentication.js similarity index 100% rename from miniprogram/account/pages/pro_authentication/pro_authentication.js rename to miniprogram/markdown/account/pro_authentication/pro_authentication.js diff --git a/miniprogram/account/pages/pro_authentication/pro_authentication.json b/miniprogram/markdown/account/pro_authentication/pro_authentication.json similarity index 68% rename from miniprogram/account/pages/pro_authentication/pro_authentication.json rename to miniprogram/markdown/account/pro_authentication/pro_authentication.json index 42f3d07..f813fd8 100644 --- a/miniprogram/account/pages/pro_authentication/pro_authentication.json +++ b/miniprogram/markdown/account/pro_authentication/pro_authentication.json @@ -1,6 +1,6 @@ { "usingComponents": { - "rich-md": "/components/rich-md/rich-md", + "rich-md": "/markdown/components/rich-md/rich-md", "iconfont": "/components/iconfont/iconfont" }, "navigationBarTitleText": "职业认证" diff --git a/miniprogram/account/pages/pro_authentication/pro_authentication.wxml b/miniprogram/markdown/account/pro_authentication/pro_authentication.wxml similarity index 100% rename from miniprogram/account/pages/pro_authentication/pro_authentication.wxml rename to miniprogram/markdown/account/pro_authentication/pro_authentication.wxml diff --git a/miniprogram/account/pages/pro_authentication/pro_authentication.wxss b/miniprogram/markdown/account/pro_authentication/pro_authentication.wxss similarity index 100% rename from miniprogram/account/pages/pro_authentication/pro_authentication.wxss rename to miniprogram/markdown/account/pro_authentication/pro_authentication.wxss diff --git a/miniprogram/components/rich-md/rich-md.js b/miniprogram/markdown/components/rich-md/rich-md.js similarity index 94% rename from miniprogram/components/rich-md/rich-md.js rename to miniprogram/markdown/components/rich-md/rich-md.js index 483e416..096ce82 100644 --- a/miniprogram/components/rich-md/rich-md.js +++ b/miniprogram/markdown/components/rich-md/rich-md.js @@ -1,6 +1,6 @@ if (!global.towxml) global.towxml = require('../../towxml/index'); -import {navigateToUrl} from "../../js/utils"; +import {navigateToUrl} from "../../../js/utils"; Component({ externalClasses: ['my-class',"class"], @@ -14,11 +14,9 @@ Component({ datakey:{ type:String, observer:function(key){ - ; wx.getStorage({ key, success: res=>{ - ; this.setData({_nodes:res.data}); }, }); @@ -49,11 +47,7 @@ Component({ methods: { handleTap(e){ - ; - ; var {target:{dataset:{data}},currentTarget:{dataset:{data:_data}}} = e; - var key = "RICHMDKEY"; - ; let {tag, attr} = _data; if(tag=='navigator'&&attr.href){ if(!navigateToUrl({url: attr.href})) @@ -73,7 +67,7 @@ Component({ wx.setStorage({ key,data,success:res=>{ wx.navigateTo({ - url: `/components/rich-md/rich-md?datakey=${key}&type=html` + url: `/markdown/components/rich-md/rich-md?datakey=${key}&type=html` }) } }) diff --git a/miniprogram/components/rich-md/rich-md.json b/miniprogram/markdown/components/rich-md/rich-md.json similarity index 55% rename from miniprogram/components/rich-md/rich-md.json rename to miniprogram/markdown/components/rich-md/rich-md.json index 9dc3362..2224ae2 100644 --- a/miniprogram/components/rich-md/rich-md.json +++ b/miniprogram/markdown/components/rich-md/rich-md.json @@ -1,6 +1,6 @@ { "component": true, "usingComponents": { - "towxml":"/towxml/towxml" + "towxml":"/markdown/towxml/towxml" } } \ No newline at end of file diff --git a/miniprogram/components/rich-md/rich-md.wxml b/miniprogram/markdown/components/rich-md/rich-md.wxml similarity index 100% rename from miniprogram/components/rich-md/rich-md.wxml rename to miniprogram/markdown/components/rich-md/rich-md.wxml diff --git a/miniprogram/pages/feedback/feedback.wxml b/miniprogram/markdown/components/rich-md/rich-md.wxss similarity index 100% rename from miniprogram/pages/feedback/feedback.wxml rename to miniprogram/markdown/components/rich-md/rich-md.wxss diff --git a/miniprogram/exercise/components/choice-question/choice-question.js b/miniprogram/markdown/exercise/exercise/choice-question/choice-question.js similarity index 100% rename from miniprogram/exercise/components/choice-question/choice-question.js rename to miniprogram/markdown/exercise/exercise/choice-question/choice-question.js diff --git a/miniprogram/markdown/exercise/exercise/choice-question/choice-question.json b/miniprogram/markdown/exercise/exercise/choice-question/choice-question.json new file mode 100644 index 0000000..1b6878e --- /dev/null +++ b/miniprogram/markdown/exercise/exercise/choice-question/choice-question.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "rich-md": "/markdown/components/rich-md/rich-md" + } +} \ No newline at end of file diff --git a/miniprogram/exercise/components/choice-question/choice-question.wxml b/miniprogram/markdown/exercise/exercise/choice-question/choice-question.wxml similarity index 100% rename from miniprogram/exercise/components/choice-question/choice-question.wxml rename to miniprogram/markdown/exercise/exercise/choice-question/choice-question.wxml diff --git a/miniprogram/exercise/components/choice-question/choice-question.wxss b/miniprogram/markdown/exercise/exercise/choice-question/choice-question.wxss similarity index 100% rename from miniprogram/exercise/components/choice-question/choice-question.wxss rename to miniprogram/markdown/exercise/exercise/choice-question/choice-question.wxss diff --git a/miniprogram/markdown/exercise/exercise/exercise.js b/miniprogram/markdown/exercise/exercise/exercise.js new file mode 100644 index 0000000..7848776 --- /dev/null +++ b/miniprogram/markdown/exercise/exercise/exercise.js @@ -0,0 +1,192 @@ +import {throttle} from "../../../js/utils"; + +const app = getApp(); +Page({ + + data: { + exercise_questions: [], + loading: true, + exercise: {}, + count_down:'试卷不限时' + }, + scrollToAnswerSheet(){ + wx.pageScrollTo({ + selector:".exercise-status" + }) + }, + scrollToQues(e){ + let {target: {dataset:{ques_id}}} = e; + ; + if(!ques_id) return; + wx.pageScrollTo({ + selector:"#q-"+ques_id + }); + }, + onAnswer(e){ + ; + let {detail:{q_position,answered}} = e; + let key = "question_status[" + (q_position - 1) +"].ques_status" + this.setData({[key]: answered}); + this.refreshAnsweredCount(); + }, + startCountDown({left_time}){ + var left = left_time; + var setCountDown = (time)=>{ + let s = time%60; + let m = parseInt(time/60)%60; + let h = parseInt(time/3600); + if(s<10) + s = '0' +s; + if(m<10) + m = '0' + m; + if(h<10) + h = '0' + h; + let count_down = h + ":" + m + ":" + s; + this.setData({count_down}); + } + setCountDown(--left); + var id = setInterval(()=>{ + if(left<=1){ + return this.stopCountDown(id); + } + setCountDown(--left); + },1000); + }, + stopCountDown(id){ + clearInterval(id); + var showToast = throttle(wx.showToast, 800, {});//延时Toast + showToast({ + title: '时间已到,系统自动为你提交中',icon:"none" + }) + app.api("exercises.commit_exercise")({exercise_id:this.exercise_id, commit_method:2}) + .then(res=>{ + showToast({ + title: "试卷提交成功!" + }); + //this.pull_questions(); + }).catch(e=>{ + //app.showError(e); + var title = '提交失败'; + //if(e.code==-2) + // title = '您未作答任何题'; + showToast({ + title, + icon:"none" + }); + let db = wx.cloud.database(); + db.collection("data").add({ + data: { + name: "exercises.commit_exercise", + e, + createdAt: db.serverDate() + } + }); + }) + this.setData({count_down: '考试时间已截止'}); + }, + refreshAnsweredCount(){ + if(!this.data.question_status) + return; + let answered_count = 0; + this.data.question_status.map(i=>{ + answered_count += i.ques_status; + }); + this.setData({answered_count}); + }, + pull_questions: function(){ + app.api("exercises.start_answer")({exercise_id: this.exercise_id}) + .then(res=>{ + ; + this.setData(res); + this.setData({loading: false}); + if(this.data.question_status) + this.refreshAnsweredCount(); + if(res.exercise.left_time) + this.startCountDown({left_time: res.exercise.left_time}); + }).catch(e => { + this.setData({status:e.code}); + app.showError(e); + }); + }, + save_exercise: function({show_loading=true}={}){ + if(show_loading){ + wx.showLoading({ + title: '请稍候', + }); + } + app.callApi({ name:"exercises.begin_commit", data:{exercise_id: this.exercise_id}, complete: wx.hideLoading}) + .then(res=>{ + if(show_loading){ + wx.showToast({ + title: "保存成功", + }); + } + }).catch(e=>{ + app.realTimeLog.error(e, "save exercise fail"); + }) + }, + commit_exercise: function(){ + //wx.showLoading({title: '检查作答情况中'}); + app.api("exercises.begin_commit")({ exercise_id: this.exercise_id}) + .then(resp=>{ + let {question_undo, shixun_undo} = resp; + if(question_undo==0) + var content = "交卷后无法更改作答,是否确认?" + else { + var content = "您还有"+question_undo+"题未作答"; + if(shixun_undo>0) + content += ",包含"+shixun_undo+"道实训题"; + content +=",是否现在交卷呢?"; + } + //wx.hideLoading(); + wx.showModal({ + title:"提示", + content, + success:res=>{ + if(res.confirm){ + app.api("exercises.commit_exercise")({exercise_id: this.exercise_id}) + .then(res=>{ + ; + ; + app.showMsg(res); + setTimeout(()=>{ + wx.navigateBack({ + delta:1 + }) + }, 800); + }) + .catch(e=>{ + app.showError(e); + }); + } + } + }) + + }) + .catch(e=>{ + app.showError(e); + }); + + }, + onLoad: function (options) { + this.exercise_id = options.exercise_id; + this.course_name = options.exercise_name; + this.pull_questions(); + }, + + onShow: function () { + + }, + + onHide: function () { + this.save_exercise({show_loading: false}); + }, + + onUnload: function () { + this.save_exercise({ show_loading: false }); + }, + + onPullDownRefresh: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/markdown/exercise/exercise/exercise.json b/miniprogram/markdown/exercise/exercise/exercise.json new file mode 100644 index 0000000..bae999c --- /dev/null +++ b/miniprogram/markdown/exercise/exercise/exercise.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "choice-question":"./choice-question/choice-question", + "main-question": "./main-question/main-question", + "null-question": "./null-question/null-question", + "shixun-question":"./shixun-question/shixun-question" + }, + "navigationBarTitleText": "试卷" +} \ No newline at end of file diff --git a/miniprogram/markdown/exercise/exercise/exercise.wxml b/miniprogram/markdown/exercise/exercise/exercise.wxml new file mode 100644 index 0000000..aa98623 --- /dev/null +++ b/miniprogram/markdown/exercise/exercise/exercise.wxml @@ -0,0 +1,62 @@ + + + + + + + + 倒计时:{{count_down}} + + + 答题卡 + {{answered_count}}/{{question_status.length}} + + + + + + 总分 + {{user_score}}/{{exercise_types.q_scores}} + + 客观题 + + + {{item.ques_position}} + {{item.user_score||'未评分'}} + + + + + 主观题 + + + {{item.ques_position}} + {{item.user_score||'未评分'}} + + + + + + + + + + + + +---- END ---- + + + + 作答情况 + + + {{item.ques_number}} + + + + + + + + \ No newline at end of file diff --git a/miniprogram/markdown/exercise/exercise/exercise.wxss b/miniprogram/markdown/exercise/exercise/exercise.wxss new file mode 100644 index 0000000..8f45be6 --- /dev/null +++ b/miniprogram/markdown/exercise/exercise/exercise.wxss @@ -0,0 +1,118 @@ +page{ + overflow-x: hidden; +} +.header{ + position: fixed; + top: 0; + background: white; + display: flex; + align-items: center; + height: 40px; + width: 100%; + z-index: 1000; + justify-content: space-evenly; + font-size: 15px; + box-shadow: 2px 2px 2px #dddddd; +} +.left-time{ + padding: 0 8px 0 12px; +} +.count-down{ + flex:auto; + text-align: center; +} +.answer-count{ + padding: 0 12px 0 8px; + font-size: 13px; + color: #0095f0; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} +.answer-count-num{ + font-size: 11px; +} + + +.header-place-holder{ + height: 40px; +} +.user-score{ + text-align: center; + font-size: 18px; + padding-bottom: 12px; +} + +.total-score{ + font-weight: bolder; +} + +.exercise-status, +.exercise-score{ + background: white; + padding: 12px; +} +.statuses, +.scores{ + display: flex; + flex-wrap: wrap; +} + +.status-item, +.score-item{ + border-radius: 4px; + margin: 8px 0 8px 10px; + width: 44px; + height: 44px; + display: flex; + justify-content: center; + align-items: center; + flex: none; +} +.status-item{ + background: #cbcbcb; + color: white; +} +.status-item.answered{ + background: #00b0f0; +} +.score-item{ + color: #00b0f0; + border: 1px #00b0f0 solid; + position: relative; +} + +.score{ + position: absolute; + bottom: -8px; + font-size: 10px; + color: white; + border-radius: 32px; + padding: 1.8px 5px; + white-space: nowrap; +} +.score.right{ + background: #00b0f0; +} +.score.wrong{ + background: #fa5151; +} + +.question-wrap{ + margin: 8px 10px; +} +.end{ + text-align: center; + margin: 10px; + color: dimgray; +} + +.operations{ + display: flex; + padding: 2px; +} +.operations>button{ + flex: 1; +} + diff --git a/miniprogram/exercise/components/main-question/main-question.js b/miniprogram/markdown/exercise/exercise/main-question/main-question.js similarity index 100% rename from miniprogram/exercise/components/main-question/main-question.js rename to miniprogram/markdown/exercise/exercise/main-question/main-question.js diff --git a/miniprogram/markdown/exercise/exercise/main-question/main-question.json b/miniprogram/markdown/exercise/exercise/main-question/main-question.json new file mode 100644 index 0000000..1b6878e --- /dev/null +++ b/miniprogram/markdown/exercise/exercise/main-question/main-question.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "rich-md": "/markdown/components/rich-md/rich-md" + } +} \ No newline at end of file diff --git a/miniprogram/exercise/components/main-question/main-question.wxml b/miniprogram/markdown/exercise/exercise/main-question/main-question.wxml similarity index 100% rename from miniprogram/exercise/components/main-question/main-question.wxml rename to miniprogram/markdown/exercise/exercise/main-question/main-question.wxml diff --git a/miniprogram/exercise/components/main-question/main-question.wxss b/miniprogram/markdown/exercise/exercise/main-question/main-question.wxss similarity index 100% rename from miniprogram/exercise/components/main-question/main-question.wxss rename to miniprogram/markdown/exercise/exercise/main-question/main-question.wxss diff --git a/miniprogram/exercise/components/null-question/null-question.js b/miniprogram/markdown/exercise/exercise/null-question/null-question.js similarity index 100% rename from miniprogram/exercise/components/null-question/null-question.js rename to miniprogram/markdown/exercise/exercise/null-question/null-question.js diff --git a/miniprogram/markdown/exercise/exercise/null-question/null-question.json b/miniprogram/markdown/exercise/exercise/null-question/null-question.json new file mode 100644 index 0000000..1b6878e --- /dev/null +++ b/miniprogram/markdown/exercise/exercise/null-question/null-question.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "rich-md": "/markdown/components/rich-md/rich-md" + } +} \ No newline at end of file diff --git a/miniprogram/exercise/components/null-question/null-question.wxml b/miniprogram/markdown/exercise/exercise/null-question/null-question.wxml similarity index 100% rename from miniprogram/exercise/components/null-question/null-question.wxml rename to miniprogram/markdown/exercise/exercise/null-question/null-question.wxml diff --git a/miniprogram/exercise/components/null-question/null-question.wxss b/miniprogram/markdown/exercise/exercise/null-question/null-question.wxss similarity index 100% rename from miniprogram/exercise/components/null-question/null-question.wxss rename to miniprogram/markdown/exercise/exercise/null-question/null-question.wxss diff --git a/miniprogram/exercise/components/question-common.wxss b/miniprogram/markdown/exercise/exercise/question-common.wxss similarity index 100% rename from miniprogram/exercise/components/question-common.wxss rename to miniprogram/markdown/exercise/exercise/question-common.wxss diff --git a/miniprogram/exercise/components/shixun-question/shixun-question.js b/miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.js similarity index 100% rename from miniprogram/exercise/components/shixun-question/shixun-question.js rename to miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.js diff --git a/miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.json b/miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.json new file mode 100644 index 0000000..1b6878e --- /dev/null +++ b/miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "rich-md": "/markdown/components/rich-md/rich-md" + } +} \ No newline at end of file diff --git a/miniprogram/exercise/components/shixun-question/shixun-question.wxml b/miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.wxml similarity index 100% rename from miniprogram/exercise/components/shixun-question/shixun-question.wxml rename to miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.wxml diff --git a/miniprogram/exercise/components/shixun-question/shixun-question.wxss b/miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.wxss similarity index 100% rename from miniprogram/exercise/components/shixun-question/shixun-question.wxss rename to miniprogram/markdown/exercise/exercise/shixun-question/shixun-question.wxss diff --git a/miniprogram/path/pages/path/path.js b/miniprogram/markdown/path/path/path.js similarity index 100% rename from miniprogram/path/pages/path/path.js rename to miniprogram/markdown/path/path/path.js diff --git a/miniprogram/path/pages/path/path.json b/miniprogram/markdown/path/path/path.json similarity index 74% rename from miniprogram/path/pages/path/path.json rename to miniprogram/markdown/path/path/path.json index bb0c564..e257a00 100644 --- a/miniprogram/path/pages/path/path.json +++ b/miniprogram/markdown/path/path/path.json @@ -1,7 +1,7 @@ { "usingComponents": { "nav-bar":"/components/nav-bar/nav-bar", - "rich-md":"/components/rich-md/rich-md", + "rich-md":"/markdown/components/rich-md/rich-md", "mp-icon":"/weui-miniprogram/icon/icon" }, "navigationBarTitleText": "实践课程" diff --git a/miniprogram/path/pages/path/path.wxml b/miniprogram/markdown/path/path/path.wxml similarity index 100% rename from miniprogram/path/pages/path/path.wxml rename to miniprogram/markdown/path/path/path.wxml diff --git a/miniprogram/path/pages/path/path.wxs b/miniprogram/markdown/path/path/path.wxs similarity index 100% rename from miniprogram/path/pages/path/path.wxs rename to miniprogram/markdown/path/path/path.wxs diff --git a/miniprogram/path/pages/path/path.wxss b/miniprogram/markdown/path/path/path.wxss similarity index 100% rename from miniprogram/path/pages/path/path.wxss rename to miniprogram/markdown/path/path/path.wxss diff --git a/miniprogram/path/pages/path_send/path_send.js b/miniprogram/markdown/path/path_send/path_send.js similarity index 100% rename from miniprogram/path/pages/path_send/path_send.js rename to miniprogram/markdown/path/path_send/path_send.js diff --git a/miniprogram/path/pages/path_send/path_send.json b/miniprogram/markdown/path/path_send/path_send.json similarity index 100% rename from miniprogram/path/pages/path_send/path_send.json rename to miniprogram/markdown/path/path_send/path_send.json diff --git a/miniprogram/path/pages/path_send/path_send.wxml b/miniprogram/markdown/path/path_send/path_send.wxml similarity index 100% rename from miniprogram/path/pages/path_send/path_send.wxml rename to miniprogram/markdown/path/path_send/path_send.wxml diff --git a/miniprogram/path/pages/path_send/path_send.wxss b/miniprogram/markdown/path/path_send/path_send.wxss similarity index 100% rename from miniprogram/path/pages/path_send/path_send.wxss rename to miniprogram/markdown/path/path_send/path_send.wxss diff --git a/miniprogram/shixun/components/challenge-item/challenge-item.js b/miniprogram/markdown/shixun/shixun/challenge-item/challenge-item.js similarity index 100% rename from miniprogram/shixun/components/challenge-item/challenge-item.js rename to miniprogram/markdown/shixun/shixun/challenge-item/challenge-item.js diff --git a/miniprogram/shixun/components/challenge-item/challenge-item.json b/miniprogram/markdown/shixun/shixun/challenge-item/challenge-item.json similarity index 100% rename from miniprogram/shixun/components/challenge-item/challenge-item.json rename to miniprogram/markdown/shixun/shixun/challenge-item/challenge-item.json diff --git a/miniprogram/shixun/components/challenge-item/challenge-item.wxml b/miniprogram/markdown/shixun/shixun/challenge-item/challenge-item.wxml similarity index 100% rename from miniprogram/shixun/components/challenge-item/challenge-item.wxml rename to miniprogram/markdown/shixun/shixun/challenge-item/challenge-item.wxml diff --git a/miniprogram/shixun/components/challenge-item/challenge-item.wxss b/miniprogram/markdown/shixun/shixun/challenge-item/challenge-item.wxss similarity index 100% rename from miniprogram/shixun/components/challenge-item/challenge-item.wxss rename to miniprogram/markdown/shixun/shixun/challenge-item/challenge-item.wxss diff --git a/miniprogram/markdown/shixun/shixun/shixun.js b/miniprogram/markdown/shixun/shixun/shixun.js new file mode 100644 index 0000000..6bbaefa --- /dev/null +++ b/miniprogram/markdown/shixun/shixun/shixun.js @@ -0,0 +1,103 @@ +const app = getApp(); +//status:[]; +const cateTypes={ + description:0, + task:1 +} +Page({ + data:{ + shixun:{}, + challenges:[], + list:[ + {text:"简介"},{text:"任务"} + ], + description:"" + }, + sendToCourse(){ + let {id} = this.data.shixun; + this.setData({shixun_ids: [id], showSendDialog: true}); + }, + 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=>{ + ; + 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=>{ + ; + app.showError(e); + }) + }, + enterChallenge(){ + wx.showLoading({ + title: '开启中', + }); + this.setData({loading: 1}); + app.api("shixuns.shixun_exec")({ identifier:this.data.identifier}) + .then(res=>{ + app.navigateTo({ url: "{task}?identifier=" + res.game_identifier}); + }).catch(e=>{ + app.showError(e); + }).finally(e=>{ + wx.hideLoading(); + this.setData({loading:false}) + }); + }, + scrollTo({scrollTop}){ + wx.pageScrollTo({scrollTop,duration:200}) + }, + switchNav({detail:{current,source}}){ + if(source=="touch") + this.setData({current}); + }, + apiChallenges: app.api("shixuns.challenges"), + apiShixun:app.api("shixuns"), + async pullChallenges(){ + let {description, challenge_list:challenges} = await this.apiChallenges({identifier:this.data.identifier}); + this.setData({description, challenges}); + }, + async pullShixun({showLoading=1}={}){ + if(showLoading) + wx.showLoading({ + title: '努力加载中' + }) + let {identifier} = this.data; + let shixun = await this.apiShixun({identifier}); + 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().catch(e=>{ + + }); + this.pullShixun().catch(e=>{ + app.showError(e); + }); + }, + + onShareAppMessage: function () { + return app.shareApp({ + title:this.data.shixun.name, + imageUrl: global.config.eduImgDir+"avatars/Shixun/"+this.data.shixun.id + }) + } +}) \ No newline at end of file diff --git a/miniprogram/markdown/shixun/shixun/shixun.json b/miniprogram/markdown/shixun/shixun/shixun.json new file mode 100644 index 0000000..59344cc --- /dev/null +++ b/miniprogram/markdown/shixun/shixun/shixun.json @@ -0,0 +1,12 @@ +{ + "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" + }, + "navigationBarBackgroundColor": "#0080f0", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "实训项目" +} \ No newline at end of file diff --git a/miniprogram/markdown/shixun/shixun/shixun.wxml b/miniprogram/markdown/shixun/shixun/shixun.wxml new file mode 100644 index 0000000..5fc0681 --- /dev/null +++ b/miniprogram/markdown/shixun/shixun/shixun.wxml @@ -0,0 +1,51 @@ + + + + {{shixun.name}} + + + 学习人数 + {{shixun.stu_num}} + + + 难度级别 + {{shixun.diffcult}} + + + 经验值 + {{shixun.experience}} + + + + + + + + + + + + + + + + + 全部任务 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/shixun/pages/shixun/shixun.wxs b/miniprogram/markdown/shixun/shixun/shixun.wxs similarity index 100% rename from miniprogram/shixun/pages/shixun/shixun.wxs rename to miniprogram/markdown/shixun/shixun/shixun.wxs diff --git a/miniprogram/markdown/shixun/shixun/shixun.wxss b/miniprogram/markdown/shixun/shixun/shixun.wxss new file mode 100644 index 0000000..10e5a22 --- /dev/null +++ b/miniprogram/markdown/shixun/shixun/shixun.wxss @@ -0,0 +1,89 @@ +.header{ + text-align: center; + position: relative; + display: flex; + flex-direction: column; + align-items: center; + height: 138px; + background: white; +} +.shixun-title{ + background: #0080f0; + font-weight: bolder; + padding: 2px 10px; + font-size: 20px; + color: white; + height: 84px; + width: 100%; +} +.shixun-detail{ + position: absolute; + top: 60px; + height: 70px; + background:white; + box-shadow: 3px 3px 10px #e7e7e7; + display: flex; + border-radius: 6px; + width: 600rpx; +} +.shixun-detail>view{ + flex:auto; + display: flex; + flex-direction: column; +} +.shixun-detail>view>view{ + flex: auto; + display: flex; + justify-content: center; + flex-direction: column; +} +.detail-key{ + color: dimgrey; + font-size: 13px; +} +.cate{ + background: white; + overflow: hidden; +} +.cate-header{ + padding: 8px 8px 0px 8px; +} +.square{ + width: 0; + height: 0px; + border-radius: 10px; + border-left: 5px solid #00b0f0; +} +.cate-name{ + padding: 0 10px; +} +.body{ + height: calc(100vh - 76px); +} +.scroll-body{ + height: 100%; + background: white; +} +.operations{ + position: sticky; + bottom: 0; + left:0; + right:0; + display: flex; + background: white; +} +.operations>button{ + flex: 1; + display: flex; + justify-content: center; + align-content: center; + white-space: nowrap; + border-radius: 0; +} +button.collect, button.send{ + background: white!important; +} +/* tmp solution*/ +.weui-half-screen-dialog__hd__side .weui-icon-btn.weui-icon-btn_more{ + display: none; +} \ No newline at end of file diff --git a/miniprogram/markdown/task/task/task.js b/miniprogram/markdown/task/task/task.js new file mode 100644 index 0000000..6827268 --- /dev/null +++ b/miniprogram/markdown/task/task/task.js @@ -0,0 +1,274 @@ +const app = getApp(); +import {navigateToUrl} from '../../../js/utils'; +Page({ + data: { + theme: 'light', + current: 0, + content:"加载中...", + attachDir: global.config.attachDir, + titles: ["任务描述", "代码文件", "测评结果"], + can_use_editor:wx.canIUse("editor") + }, + /*onTap(e){ + ; + let {detail:{tag, attr}} = e; + if(tag=='navigator'&&attr.href) + navigateToUrl({url: attr.href}); + ; + },*/ + checkTime(){ + if(this.timeChecked) + return; + let date = new Date(); + let hours = date.getHours(); + let min = date.getMinutes(); + if(hours>=0&&hours<=3||hours>=23&&min>=30){ + this.timeChecked = true; + let y = date.getFullYear(); + let m = date.getMonth(); + let d = date.getDate(); + if(hours>=23) + d += 1; + let t = y+'-'+m+'-'+d; + let key = 'task-show-go-to-sleep-last-time' + let last = wx.getStorageSync(key); + if(last==t) + return + this.setData({showGoToSleep:true}); + wx.reportAnalytics('show_go_to_sleep_in_task', {}); + wx.setStorageSync(key, t); + }else if(hours<=21){ + this.timeChecked = true; + } + }, + onTapTopTip(){ + this.setData({showGoToSleep:false}); + wx.reportAnalytics('tap_go_to_sleep', {}); + }, + setNavigationTheme(){ + let {theme} = this.data; + if(theme=='dark'){ + wx.setNavigationBarColor({backgroundColor:"#303030",frontColor:"#ffffff",animation:'linear'}); + }else{ + wx.setNavigationBarColor({backgroundColor:"#fbfbfb",frontColor:"#000000",animation:"linear"}); + } + }, + switchTheme({detail}){ + ; + let {value} = detail; + let theme = value?'dark':'light'; + if(theme==this.data.theme) + return; + wx.showNavigationBarLoading() + this.setData({theme},wx.hideNavigationBarLoading); + this.setNavigationTheme(); + wx.setStorageSync('config-task-theme', theme); + }, + enterTask(e){ + var {target:{dataset:{identifier}}} = e; + ; + if(identifier) + wx.redirectTo({url:"./task?identifier="+identifier}); + }, + setCurrent({current}){ + this.setData({current}); + }, + enterChallenge(){ + this.setData({current:0}) + }, + enterOutcome(){ + this.setData({current:2}); + }, + onTextAreaBlur({detail:{value}}){ + if (!this.modified) { + this.modified = this.content != value; + } + if(this.modified){ + this.content = value; + this.updateFile(); + } + }, + onTextAreaInput({detail:{value}}){ + this.modified = this.content!=value; + if(this.modified) + this.content = value; + }, + onEditorInput(e){ + let {text} = e.detail; + ; + this.modified = this.content!=text; + if(this.modified){ + this.content = text; + // 自动缩进适配┭┮﹏┭┮,小程序限制太多了 + this.oldLines = this.lines; + this.lines = this.content.split(/\n/g); + if(this.oldLines.length+1==this.lines.length){ + for(var i=this.oldLines.length-1;i>=0;i--){ + if(this.lines[i+1]!=this.oldLines[i]){ + let match = this.lines[i].match(/^\s+/); + if(match) + this.editor.insertText({text:match[0]}); + break; + } + } + } + } + }, + onEditorBlur({detail}){ + + let {text} = detail; + if(!this.modified){ + this.modified = this.content.trimEnd()!=text.trimEnd(); + } + if(this.modified){ + this.content = text; + this.updateFile(); + } + }, + processPath(path){ + return path.replace(/[;;]$/,""); + }, + async updateFile({ evaluate=0}={}){ + var {content} = this; + var {path} = this.data.challenge; + path = this.processPath(path); + var {identifier} = this.data.myshixun; + var {id:game_id} = this.data.game; + if(this.modified||evaluate) + this.modified = false; + try{ + var res = await app.api("myshixuns.update_file")({path,identifier,game_id,content,evaluate}); + return res; + }catch(e){ + this.modified = true; + global.realTimeLog.error(e, "fail: update code file fail"); + throw new Error(e.message); + } + }, + buildGame({detail:{value}}){ + wx.showLoading({ + title: '代码上传中', + }); + this.setData({ building: 1 }); + var {identifier} = this.data; + if(!this.data.can_use_editor) + this.content = value.content; + this.updateFile({evaluate:1}) + .then(res=>{ + var {sec_key, resubmit=""} = res; + app.api("tasks.game_build")({ identifier, resubmit, sec_key, content_modified:1}) + .then(res => { + this.getBuildStatus({sec_key, resubmit}); + }) + .catch(e=>{ + wx.hideLoading(); + this.setData({ building: 0 }) + global.realTimeLog.error(e, "fail: build game fail"); + }) + }).catch(e=>{ + wx.hideLoading(); + this.setData({building:0}); + }) + + }, + getBuildStatus({resubmit="", sec_key=""}){ + var { identifier } = this.data; + var timer = setInterval(()=>{ + app.api("tasks.game_status")({identifier,resubmit,sec_key}) + .then(res=>{ + if("status" in res){ + wx.hideLoading(); + this.setData({ current: 2, building: 0 }); + this.setData(res); + clearInterval(timer); + }else if(res.running_code_message){ + wx.showLoading({ + title: res.running_code_message + }) + } + }) + }, 1000); + }, + onSwiperChange(e){ + ; + let {detail:{current,source}} = e; + if(source=="touch"){ + this.setData({current}); + } + if(current==1&&!this.content){ + this.pullContent(); + } + 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,()=>{ + wx.hideLoading(); + wx.hideNavigationBarLoading(); + }); + + }, + async pullContent(){ + ; + let {path} = this.data.challenge; + path = this.processPath(path); + let {identifier} = this.data; + let {content} = await app.api("tasks.rep_content")({identifier,path}); + this.content = content; + if(this.data.can_use_editor){ + if(!this.editor) + this.onEditorReady({pullContent:1}); + else{ + //let delta = {ops:[{insert:content}]}; + //this.editor.setContents({delta}); + this.editor.clear(); + this.lines = content.split(/\n/g); + this.editor.insertText({text:content}); + } + }else + this.setData({content}); + ; + }, + onEditorReady({pullContent=0}={}) { + + const that = this + wx.createSelectorQuery().select('#code-editor').context(function (res) { + that.editor = res.context + if(pullContent&&that.editor) + that.pullContent(); + //that.editor.insertText({text:that.content}); + ; + }).exec(); + + }, + onLoad: function (options) { + + let theme = wx.getStorageSync('config-task-theme'); + this.setData({theme}); + this.setNavigationTheme(); + let {identifier} = options; + this.setData({identifier}); + this.pullTask(); + }, + onReady(){ + this.checkTime(); + }, + onHide: function () { + this.updateFile(); + }, + + onShareAppMessage: function () { + let {challenge, shixun} = this.data; + return app.shareApp({ + title:`第${challenge.position}关:${challenge.subject}`, + imageUrl: global.config.eduImgDir + "avatars/Shixun/" + shixun.id, + path:`/shixun/pages/shixun/shixun?identifier=${shixun.identifier}&cate_type=task` + }) + } +}) \ No newline at end of file diff --git a/miniprogram/markdown/task/task/task.json b/miniprogram/markdown/task/task/task.json new file mode 100644 index 0000000..0f8dfd1 --- /dev/null +++ b/miniprogram/markdown/task/task/task.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "rich-md":"/markdown/components/rich-md/rich-md", + "test-set":"./test_set/test_set", + "mp-toptips":"/weui-miniprogram/toptips/toptips" + }, + "navigationBarTitleText": "实训关卡" +} \ No newline at end of file diff --git a/miniprogram/markdown/task/task/task.wxml b/miniprogram/markdown/task/task/task.wxml new file mode 100644 index 0000000..91e8757 --- /dev/null +++ b/miniprogram/markdown/task/task/task.wxml @@ -0,0 +1,64 @@ + + + + + + + + + 第{{challenge.position}}关:{{challenge.subject}} + + + + + + 用EduCoder云网实训(推荐) + + 黑暗模式 + + + + + + + +
+ + + + + + + + +
+
+ + + + + 成功通过 {{test_sets_count-sets_error_count}}/{{test_sets_count}} + + + + + + + + + + +
\ No newline at end of file diff --git a/miniprogram/task/pages/task/task.wxs b/miniprogram/markdown/task/task/task.wxs similarity index 100% rename from miniprogram/task/pages/task/task.wxs rename to miniprogram/markdown/task/task/task.wxs diff --git a/miniprogram/markdown/task/task/task.wxss b/miniprogram/markdown/task/task/task.wxss new file mode 100644 index 0000000..093372a --- /dev/null +++ b/miniprogram/markdown/task/task/task.wxss @@ -0,0 +1,89 @@ +.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; + opacity: 0.8; +} +.switch-wrap{ + text-align: right; + font-size: 12px; +} +.theme-switch{ + transform: scale(0.6); +} +.challenge-body{ + height: 100%; + background: white; +} +.subject{ + padding-left: 20px; + font-size: 18px; + font-weight: bolder; + +} +.editor-body{ + height: 100%; + display: flex; + flex-direction: column; +} +.form-body{ + height: 100%; + display: flex; + flex-direction: column; +} +.editor{ + width: auto; + background: #002B36; + color: #93A1A1; + font: 14px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + white-space: pre; + padding: 0px 10px; + height: calc(100vh - 42px); + flex: auto; +} +.operations{ + flex: none; + display: flex; +} +.operations>button{ + flex: auto; + border-radius: 0; +} +.outcome-swiper{ + display: flex; + flex-direction: column; +} +.outcome-body{ + flex: 1 1 1px; + height: 1px; + background: #111c24; +} +.compile-output{ + max-height: 36vh; + overflow-y: scroll; + padding: 6px 10px; + color: #ff6545; +} +.success{ + color: #12af25; +} +.test-set-wrap{ + margin: 7px 8px; +} \ No newline at end of file diff --git a/miniprogram/task/components/test_set/test_set.js b/miniprogram/markdown/task/task/test_set/test_set.js similarity index 100% rename from miniprogram/task/components/test_set/test_set.js rename to miniprogram/markdown/task/task/test_set/test_set.js diff --git a/miniprogram/task/components/test_set/test_set.json b/miniprogram/markdown/task/task/test_set/test_set.json similarity index 100% rename from miniprogram/task/components/test_set/test_set.json rename to miniprogram/markdown/task/task/test_set/test_set.json diff --git a/miniprogram/task/components/test_set/test_set.wxml b/miniprogram/markdown/task/task/test_set/test_set.wxml similarity index 100% rename from miniprogram/task/components/test_set/test_set.wxml rename to miniprogram/markdown/task/task/test_set/test_set.wxml diff --git a/miniprogram/task/components/test_set/test_set.wxs b/miniprogram/markdown/task/task/test_set/test_set.wxs similarity index 100% rename from miniprogram/task/components/test_set/test_set.wxs rename to miniprogram/markdown/task/task/test_set/test_set.wxs diff --git a/miniprogram/task/components/test_set/test_set.wxss b/miniprogram/markdown/task/task/test_set/test_set.wxss similarity index 100% rename from miniprogram/task/components/test_set/test_set.wxss rename to miniprogram/markdown/task/task/test_set/test_set.wxss diff --git a/miniprogram/towxml/config.js b/miniprogram/markdown/towxml/config.js similarity index 100% rename from miniprogram/towxml/config.js rename to miniprogram/markdown/towxml/config.js diff --git a/miniprogram/towxml/decode.js b/miniprogram/markdown/towxml/decode.js similarity index 100% rename from miniprogram/towxml/decode.js rename to miniprogram/markdown/towxml/decode.js diff --git a/miniprogram/markdown/towxml/decode.json b/miniprogram/markdown/towxml/decode.json new file mode 100644 index 0000000..32e9c48 --- /dev/null +++ b/miniprogram/markdown/towxml/decode.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "decode": "./decode", + "latex": "./latex/latex", + "table": "./table/table", + "img": "./img/img" + } +} \ No newline at end of file diff --git a/miniprogram/towxml/decode.wxml b/miniprogram/markdown/towxml/decode.wxml similarity index 100% rename from miniprogram/towxml/decode.wxml rename to miniprogram/markdown/towxml/decode.wxml diff --git a/miniprogram/towxml/decode.wxss b/miniprogram/markdown/towxml/decode.wxss similarity index 100% rename from miniprogram/towxml/decode.wxss rename to miniprogram/markdown/towxml/decode.wxss diff --git a/miniprogram/towxml/img/img.js b/miniprogram/markdown/towxml/img/img.js similarity index 100% rename from miniprogram/towxml/img/img.js rename to miniprogram/markdown/towxml/img/img.js diff --git a/miniprogram/towxml/img/img.json b/miniprogram/markdown/towxml/img/img.json similarity index 100% rename from miniprogram/towxml/img/img.json rename to miniprogram/markdown/towxml/img/img.json diff --git a/miniprogram/towxml/img/img.wxml b/miniprogram/markdown/towxml/img/img.wxml similarity index 100% rename from miniprogram/towxml/img/img.wxml rename to miniprogram/markdown/towxml/img/img.wxml diff --git a/miniprogram/towxml/img/img.wxss b/miniprogram/markdown/towxml/img/img.wxss similarity index 100% rename from miniprogram/towxml/img/img.wxss rename to miniprogram/markdown/towxml/img/img.wxss diff --git a/miniprogram/towxml/index.js b/miniprogram/markdown/towxml/index.js similarity index 100% rename from miniprogram/towxml/index.js rename to miniprogram/markdown/towxml/index.js diff --git a/miniprogram/towxml/latex/latex.js b/miniprogram/markdown/towxml/latex/latex.js similarity index 100% rename from miniprogram/towxml/latex/latex.js rename to miniprogram/markdown/towxml/latex/latex.js diff --git a/miniprogram/towxml/latex/latex.json b/miniprogram/markdown/towxml/latex/latex.json similarity index 100% rename from miniprogram/towxml/latex/latex.json rename to miniprogram/markdown/towxml/latex/latex.json diff --git a/miniprogram/towxml/latex/latex.wxml b/miniprogram/markdown/towxml/latex/latex.wxml similarity index 100% rename from miniprogram/towxml/latex/latex.wxml rename to miniprogram/markdown/towxml/latex/latex.wxml diff --git a/miniprogram/towxml/latex/latex.wxss b/miniprogram/markdown/towxml/latex/latex.wxss similarity index 100% rename from miniprogram/towxml/latex/latex.wxss rename to miniprogram/markdown/towxml/latex/latex.wxss diff --git a/miniprogram/towxml/parse/highlight/highlight.js b/miniprogram/markdown/towxml/parse/highlight/highlight.js similarity index 100% rename from miniprogram/towxml/parse/highlight/highlight.js rename to miniprogram/markdown/towxml/parse/highlight/highlight.js diff --git a/miniprogram/towxml/parse/highlight/index.js b/miniprogram/markdown/towxml/parse/highlight/index.js similarity index 100% rename from miniprogram/towxml/parse/highlight/index.js rename to miniprogram/markdown/towxml/parse/highlight/index.js diff --git a/miniprogram/towxml/parse/highlight/languages/css.js b/miniprogram/markdown/towxml/parse/highlight/languages/css.js similarity index 100% rename from miniprogram/towxml/parse/highlight/languages/css.js rename to miniprogram/markdown/towxml/parse/highlight/languages/css.js diff --git a/miniprogram/towxml/parse/highlight/languages/java.js b/miniprogram/markdown/towxml/parse/highlight/languages/java.js similarity index 100% rename from miniprogram/towxml/parse/highlight/languages/java.js rename to miniprogram/markdown/towxml/parse/highlight/languages/java.js diff --git a/miniprogram/towxml/parse/highlight/languages/javascript.js b/miniprogram/markdown/towxml/parse/highlight/languages/javascript.js similarity index 100% rename from miniprogram/towxml/parse/highlight/languages/javascript.js rename to miniprogram/markdown/towxml/parse/highlight/languages/javascript.js diff --git a/miniprogram/towxml/parse/highlight/languages/python.js b/miniprogram/markdown/towxml/parse/highlight/languages/python.js similarity index 100% rename from miniprogram/towxml/parse/highlight/languages/python.js rename to miniprogram/markdown/towxml/parse/highlight/languages/python.js diff --git a/miniprogram/towxml/parse/highlight/style/github.wxss b/miniprogram/markdown/towxml/parse/highlight/style/github.wxss similarity index 100% rename from miniprogram/towxml/parse/highlight/style/github.wxss rename to miniprogram/markdown/towxml/parse/highlight/style/github.wxss diff --git a/miniprogram/towxml/parse/highlight/style/monokai.wxss b/miniprogram/markdown/towxml/parse/highlight/style/monokai.wxss similarity index 100% rename from miniprogram/towxml/parse/highlight/style/monokai.wxss rename to miniprogram/markdown/towxml/parse/highlight/style/monokai.wxss diff --git a/miniprogram/towxml/parse/index.js b/miniprogram/markdown/towxml/parse/index.js similarity index 100% rename from miniprogram/towxml/parse/index.js rename to miniprogram/markdown/towxml/parse/index.js diff --git a/miniprogram/towxml/parse/markdown/index.js b/miniprogram/markdown/towxml/parse/markdown/index.js similarity index 100% rename from miniprogram/towxml/parse/markdown/index.js rename to miniprogram/markdown/towxml/parse/markdown/index.js diff --git a/miniprogram/towxml/parse/markdown/markdown.js b/miniprogram/markdown/towxml/parse/markdown/markdown.js similarity index 100% rename from miniprogram/towxml/parse/markdown/markdown.js rename to miniprogram/markdown/towxml/parse/markdown/markdown.js diff --git a/miniprogram/towxml/parse/markdown/plugins/ins.js b/miniprogram/markdown/towxml/parse/markdown/plugins/ins.js similarity index 100% rename from miniprogram/towxml/parse/markdown/plugins/ins.js rename to miniprogram/markdown/towxml/parse/markdown/plugins/ins.js diff --git a/miniprogram/towxml/parse/markdown/plugins/latex.js b/miniprogram/markdown/towxml/parse/markdown/plugins/latex.js similarity index 100% rename from miniprogram/towxml/parse/markdown/plugins/latex.js rename to miniprogram/markdown/towxml/parse/markdown/plugins/latex.js diff --git a/miniprogram/towxml/parse/markdown/plugins/sub.js b/miniprogram/markdown/towxml/parse/markdown/plugins/sub.js similarity index 100% rename from miniprogram/towxml/parse/markdown/plugins/sub.js rename to miniprogram/markdown/towxml/parse/markdown/plugins/sub.js diff --git a/miniprogram/towxml/parse/markdown/plugins/sup.js b/miniprogram/markdown/towxml/parse/markdown/plugins/sup.js similarity index 100% rename from miniprogram/towxml/parse/markdown/plugins/sup.js rename to miniprogram/markdown/towxml/parse/markdown/plugins/sup.js diff --git a/miniprogram/towxml/parse/parse2/Parser.js b/miniprogram/markdown/towxml/parse/parse2/Parser.js similarity index 100% rename from miniprogram/towxml/parse/parse2/Parser.js rename to miniprogram/markdown/towxml/parse/parse2/Parser.js diff --git a/miniprogram/towxml/parse/parse2/Tokenizer.js b/miniprogram/markdown/towxml/parse/parse2/Tokenizer.js similarity index 100% rename from miniprogram/towxml/parse/parse2/Tokenizer.js rename to miniprogram/markdown/towxml/parse/parse2/Tokenizer.js diff --git a/miniprogram/towxml/parse/parse2/domhandler/index.js b/miniprogram/markdown/towxml/parse/parse2/domhandler/index.js similarity index 100% rename from miniprogram/towxml/parse/parse2/domhandler/index.js rename to miniprogram/markdown/towxml/parse/parse2/domhandler/index.js diff --git a/miniprogram/towxml/parse/parse2/domhandler/node.js b/miniprogram/markdown/towxml/parse/parse2/domhandler/node.js similarity index 100% rename from miniprogram/towxml/parse/parse2/domhandler/node.js rename to miniprogram/markdown/towxml/parse/parse2/domhandler/node.js diff --git a/miniprogram/towxml/parse/parse2/entities/decode.js b/miniprogram/markdown/towxml/parse/parse2/entities/decode.js similarity index 100% rename from miniprogram/towxml/parse/parse2/entities/decode.js rename to miniprogram/markdown/towxml/parse/parse2/entities/decode.js diff --git a/miniprogram/towxml/parse/parse2/entities/decode_codepoint.js b/miniprogram/markdown/towxml/parse/parse2/entities/decode_codepoint.js similarity index 100% rename from miniprogram/towxml/parse/parse2/entities/decode_codepoint.js rename to miniprogram/markdown/towxml/parse/parse2/entities/decode_codepoint.js diff --git a/miniprogram/towxml/parse/parse2/entities/encode.js b/miniprogram/markdown/towxml/parse/parse2/entities/encode.js similarity index 100% rename from miniprogram/towxml/parse/parse2/entities/encode.js rename to miniprogram/markdown/towxml/parse/parse2/entities/encode.js diff --git a/miniprogram/towxml/parse/parse2/entities/index.js b/miniprogram/markdown/towxml/parse/parse2/entities/index.js similarity index 100% rename from miniprogram/towxml/parse/parse2/entities/index.js rename to miniprogram/markdown/towxml/parse/parse2/entities/index.js diff --git a/miniprogram/towxml/parse/parse2/entities/maps/decode.js b/miniprogram/markdown/towxml/parse/parse2/entities/maps/decode.js similarity index 100% rename from miniprogram/towxml/parse/parse2/entities/maps/decode.js rename to miniprogram/markdown/towxml/parse/parse2/entities/maps/decode.js diff --git a/miniprogram/towxml/parse/parse2/entities/maps/entities.js b/miniprogram/markdown/towxml/parse/parse2/entities/maps/entities.js similarity index 100% rename from miniprogram/towxml/parse/parse2/entities/maps/entities.js rename to miniprogram/markdown/towxml/parse/parse2/entities/maps/entities.js diff --git a/miniprogram/towxml/parse/parse2/entities/maps/legacy.js b/miniprogram/markdown/towxml/parse/parse2/entities/maps/legacy.js similarity index 100% rename from miniprogram/towxml/parse/parse2/entities/maps/legacy.js rename to miniprogram/markdown/towxml/parse/parse2/entities/maps/legacy.js diff --git a/miniprogram/towxml/parse/parse2/entities/maps/xml.js b/miniprogram/markdown/towxml/parse/parse2/entities/maps/xml.js similarity index 100% rename from miniprogram/towxml/parse/parse2/entities/maps/xml.js rename to miniprogram/markdown/towxml/parse/parse2/entities/maps/xml.js diff --git a/miniprogram/towxml/parse/parse2/index.js b/miniprogram/markdown/towxml/parse/parse2/index.js similarity index 100% rename from miniprogram/towxml/parse/parse2/index.js rename to miniprogram/markdown/towxml/parse/parse2/index.js diff --git a/miniprogram/towxml/style/main.wxss b/miniprogram/markdown/towxml/style/main.wxss similarity index 100% rename from miniprogram/towxml/style/main.wxss rename to miniprogram/markdown/towxml/style/main.wxss diff --git a/miniprogram/towxml/style/theme/dark.wxss b/miniprogram/markdown/towxml/style/theme/dark.wxss similarity index 100% rename from miniprogram/towxml/style/theme/dark.wxss rename to miniprogram/markdown/towxml/style/theme/dark.wxss diff --git a/miniprogram/towxml/style/theme/light.wxss b/miniprogram/markdown/towxml/style/theme/light.wxss similarity index 100% rename from miniprogram/towxml/style/theme/light.wxss rename to miniprogram/markdown/towxml/style/theme/light.wxss diff --git a/miniprogram/towxml/table/table.js b/miniprogram/markdown/towxml/table/table.js similarity index 100% rename from miniprogram/towxml/table/table.js rename to miniprogram/markdown/towxml/table/table.js diff --git a/miniprogram/towxml/table/table.json b/miniprogram/markdown/towxml/table/table.json similarity index 100% rename from miniprogram/towxml/table/table.json rename to miniprogram/markdown/towxml/table/table.json diff --git a/miniprogram/towxml/table/table.wxml b/miniprogram/markdown/towxml/table/table.wxml similarity index 100% rename from miniprogram/towxml/table/table.wxml rename to miniprogram/markdown/towxml/table/table.wxml diff --git a/miniprogram/towxml/table/table.wxss b/miniprogram/markdown/towxml/table/table.wxss similarity index 100% rename from miniprogram/towxml/table/table.wxss rename to miniprogram/markdown/towxml/table/table.wxss diff --git a/miniprogram/towxml/towxml.js b/miniprogram/markdown/towxml/towxml.js similarity index 100% rename from miniprogram/towxml/towxml.js rename to miniprogram/markdown/towxml/towxml.js diff --git a/miniprogram/towxml/towxml.json b/miniprogram/markdown/towxml/towxml.json similarity index 100% rename from miniprogram/towxml/towxml.json rename to miniprogram/markdown/towxml/towxml.json diff --git a/miniprogram/towxml/towxml.wxml b/miniprogram/markdown/towxml/towxml.wxml similarity index 100% rename from miniprogram/towxml/towxml.wxml rename to miniprogram/markdown/towxml/towxml.wxml diff --git a/miniprogram/towxml/towxml.wxss b/miniprogram/markdown/towxml/towxml.wxss similarity index 100% rename from miniprogram/towxml/towxml.wxss rename to miniprogram/markdown/towxml/towxml.wxss diff --git a/miniprogram/pages/feedback/feedback.js b/miniprogram/pages/feedback/feedback.js deleted file mode 100644 index deefddc..0000000 --- a/miniprogram/pages/feedback/feedback.js +++ /dev/null @@ -1,5 +0,0 @@ -const app = getApp(); - -Page({ - -}) \ No newline at end of file diff --git a/miniprogram/pages/feedback/feedback.json b/miniprogram/pages/feedback/feedback.json deleted file mode 100644 index 8835af0..0000000 --- a/miniprogram/pages/feedback/feedback.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "usingComponents": {} -} \ No newline at end of file diff --git a/miniprogram/pages/feedback/feedback.wxss b/miniprogram/pages/feedback/feedback.wxss deleted file mode 100644 index 284c540..0000000 --- a/miniprogram/pages/feedback/feedback.wxss +++ /dev/null @@ -1 +0,0 @@ -/* miniprogram/pages/feedback/feedback.wxss */ \ No newline at end of file diff --git a/miniprogram/pages/findmore/findmore.js b/miniprogram/pages/findmore/findmore.js index f01fbdd..277d654 100644 --- a/miniprogram/pages/findmore/findmore.js +++ b/miniprogram/pages/findmore/findmore.js @@ -7,7 +7,7 @@ const typeMap = { } Page({ data: { - statusBarHeight: 20, + statusBarHeight: 24, current: 0, show: [1], showSearch:1, @@ -23,12 +23,8 @@ Page({ app.navigateTo({ url: `{search}?type=${type}`}); }, onLoad: function (options) { - wx.getSystemInfo({ - success: res => { - let { statusBarHeight } = res; - this.setData({ statusBarHeight }); - }, - }) + let { statusBarHeight=24 } = wx.getSystemInfoSync(); + this.setData({ statusBarHeight }); }, switch({current}){ let title = titleMap[current]; diff --git a/miniprogram/pages/findmore/paths/path-item/path-item.wxml b/miniprogram/pages/findmore/paths/path-item/path-item.wxml index 4d9a392..ff44f33 100644 --- a/miniprogram/pages/findmore/paths/path-item/path-item.wxml +++ b/miniprogram/pages/findmore/paths/path-item/path-item.wxml @@ -1,4 +1,4 @@ - + {{data.name}} diff --git a/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml index 78ca712..cea21aa 100644 --- a/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml +++ b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml @@ -1,4 +1,4 @@ - + diff --git a/miniprogram/pages/home/home.wxml b/miniprogram/pages/home/home.wxml index 90d0b12..65f03d9 100644 --- a/miniprogram/pages/home/home.wxml +++ b/miniprogram/pages/home/home.wxml @@ -63,7 +63,7 @@ 设置 - + 关于 diff --git a/miniprogram/pages/main/main.js b/miniprogram/pages/main/main.js index 2b9fd8e..e39a78b 100644 --- a/miniprogram/pages/main/main.js +++ b/miniprogram/pages/main/main.js @@ -12,7 +12,7 @@ const titleMap = { } Page({ data:{ - statusBarHeight:20, + statusBarHeight: 24, current:0, show:[1], showSearch:0, @@ -24,16 +24,12 @@ Page({ ] }, onLoad(options){ + let { statusBarHeight=24 } = wx.getSystemInfoSync(); + this.setData({ statusBarHeight }); if(options.type){ let current = typeMap[options.type]||0; this.switch({current}); } - wx.getSystemInfo({ - success: res=>{ - let {statusBarHeight} = res; - this.setData({statusBarHeight}); - }, - }) }, enterSearch(){ let type = this.data.list[this.data.current].type||''; @@ -53,7 +49,7 @@ Page({ }, onShareAppMessage(){ let {list, current} = this.data; - return app.showApp({ + return app.shareApp({ path: "/"+this.route+"?type="+list[current].type }) } diff --git a/miniprogram/pages/main/my_path/path-item/path-item.wxml b/miniprogram/pages/main/my_path/path-item/path-item.wxml index 956e6a8..3f4d038 100644 --- a/miniprogram/pages/main/my_path/path-item/path-item.wxml +++ b/miniprogram/pages/main/my_path/path-item/path-item.wxml @@ -1,4 +1,4 @@ - + diff --git a/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml index c7f3c97..97f1075 100644 --- a/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml +++ b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml @@ -1,4 +1,4 @@ - + diff --git a/miniprogram/shixun/pages/shixun/shixun.js b/miniprogram/shixun/pages/shixun/shixun.js index 6bbaefa..a5c6160 100644 --- a/miniprogram/shixun/pages/shixun/shixun.js +++ b/miniprogram/shixun/pages/shixun/shixun.js @@ -1,103 +1,15 @@ -const app = getApp(); -//status:[]; -const cateTypes={ - description:0, - task:1 -} + Page({ - data:{ - shixun:{}, - challenges:[], - list:[ - {text:"简介"},{text:"任务"} - ], - description:"" - }, - sendToCourse(){ - let {id} = this.data.shixun; - this.setData({shixun_ids: [id], showSendDialog: true}); - }, - 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=>{ - ; - 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=>{ - ; - app.showError(e); - }) - }, - enterChallenge(){ - wx.showLoading({ - title: '开启中', - }); - this.setData({loading: 1}); - app.api("shixuns.shixun_exec")({ identifier:this.data.identifier}) - .then(res=>{ - app.navigateTo({ url: "{task}?identifier=" + res.game_identifier}); - }).catch(e=>{ - app.showError(e); - }).finally(e=>{ - wx.hideLoading(); - this.setData({loading:false}) - }); - }, - scrollTo({scrollTop}){ - wx.pageScrollTo({scrollTop,duration:200}) - }, - switchNav({detail:{current,source}}){ - if(source=="touch") - this.setData({current}); - }, - apiChallenges: app.api("shixuns.challenges"), - apiShixun:app.api("shixuns"), - async pullChallenges(){ - let {description, challenge_list:challenges} = await this.apiChallenges({identifier:this.data.identifier}); - this.setData({description, challenges}); - }, - async pullShixun({showLoading=1}={}){ - if(showLoading) - wx.showLoading({ - title: '努力加载中' - }) - let {identifier} = this.data; - let shixun = await this.apiShixun({identifier}); - this.setData({shixun}, res=>{ - if(showLoading) - wx.hideLoading() - }); + + data: { + }, onLoad: function (options) { - let {identifier,cate_type} = options; - let current = cateTypes[cate_type]; - this.setData({identifier, current}); - this.pullChallenges().catch(e=>{ - - }); - this.pullShixun().catch(e=>{ - app.showError(e); - }); - }, - - onShareAppMessage: function () { - return app.shareApp({ - title:this.data.shixun.name, - imageUrl: global.config.eduImgDir+"avatars/Shixun/"+this.data.shixun.id - }) + if(options) + var query = "?" + Object.keys(options).map(i=>`${i}=${options[i]}`).join("&"); + else + var query = "" + wx.redirectTo({url: "/markdown/shixun/shixun/shixun" + query}); + global.realTimeLog.error("unexpected page"); } }) \ No newline at end of file diff --git a/miniprogram/shixun/pages/shixun/shixun.json b/miniprogram/shixun/pages/shixun/shixun.json index 29cdb55..8835af0 100644 --- a/miniprogram/shixun/pages/shixun/shixun.json +++ b/miniprogram/shixun/pages/shixun/shixun.json @@ -1,12 +1,3 @@ { - "usingComponents": { - "rich-md":"/components/rich-md/rich-md", - "require-login":"/components/require-login/require-login", - "challenge-item":"/shixun/components/challenge-item/challenge-item", - "nav-bar":"/components/nav-bar/nav-bar", - "send-to-course":"/components/modal/send-to-course/send-to-course" - }, - "navigationBarBackgroundColor": "#0080f0", - "navigationBarTextStyle": "white", - "navigationBarTitleText": "实训项目" + "usingComponents": {} } \ No newline at end of file diff --git a/miniprogram/shixun/pages/shixun/shixun.wxml b/miniprogram/shixun/pages/shixun/shixun.wxml index 5fc0681..580eeaf 100644 --- a/miniprogram/shixun/pages/shixun/shixun.wxml +++ b/miniprogram/shixun/pages/shixun/shixun.wxml @@ -1,51 +1,2 @@ - - - - {{shixun.name}} - - - 学习人数 - {{shixun.stu_num}} - - - 难度级别 - {{shixun.diffcult}} - - - 经验值 - {{shixun.experience}} - - - - - - - - - - - - - - - - - 全部任务 - - - - - - - - - - - - - - - - \ No newline at end of file + +miniprogram/shixun/pages/shixun/shixun.wxml diff --git a/miniprogram/shixun/pages/shixun/shixun.wxss b/miniprogram/shixun/pages/shixun/shixun.wxss index 10e5a22..cef5e41 100644 --- a/miniprogram/shixun/pages/shixun/shixun.wxss +++ b/miniprogram/shixun/pages/shixun/shixun.wxss @@ -1,89 +1 @@ -.header{ - text-align: center; - position: relative; - display: flex; - flex-direction: column; - align-items: center; - height: 138px; - background: white; -} -.shixun-title{ - background: #0080f0; - font-weight: bolder; - padding: 2px 10px; - font-size: 20px; - color: white; - height: 84px; - width: 100%; -} -.shixun-detail{ - position: absolute; - top: 60px; - height: 70px; - background:white; - box-shadow: 3px 3px 10px #e7e7e7; - display: flex; - border-radius: 6px; - width: 600rpx; -} -.shixun-detail>view{ - flex:auto; - display: flex; - flex-direction: column; -} -.shixun-detail>view>view{ - flex: auto; - display: flex; - justify-content: center; - flex-direction: column; -} -.detail-key{ - color: dimgrey; - font-size: 13px; -} -.cate{ - background: white; - overflow: hidden; -} -.cate-header{ - padding: 8px 8px 0px 8px; -} -.square{ - width: 0; - height: 0px; - border-radius: 10px; - border-left: 5px solid #00b0f0; -} -.cate-name{ - padding: 0 10px; -} -.body{ - height: calc(100vh - 76px); -} -.scroll-body{ - height: 100%; - background: white; -} -.operations{ - position: sticky; - bottom: 0; - left:0; - right:0; - display: flex; - background: white; -} -.operations>button{ - flex: 1; - display: flex; - justify-content: center; - align-content: center; - white-space: nowrap; - border-radius: 0; -} -button.collect, button.send{ - background: white!important; -} -/* tmp solution*/ -.weui-half-screen-dialog__hd__side .weui-icon-btn.weui-icon-btn_more{ - display: none; -} \ No newline at end of file +/* miniprogram/shixun/pages/shixun/shixun.wxss */ \ No newline at end of file diff --git a/miniprogram/task/pages/task/task.js b/miniprogram/task/pages/task/task.js index 6827268..96eee1c 100644 --- a/miniprogram/task/pages/task/task.js +++ b/miniprogram/task/pages/task/task.js @@ -1,274 +1,16 @@ -const app = getApp(); -import {navigateToUrl} from '../../../js/utils'; +// miniprogram/task/pages/task.js Page({ + data: { - theme: 'light', - current: 0, - content:"加载中...", - attachDir: global.config.attachDir, - titles: ["任务描述", "代码文件", "测评结果"], - can_use_editor:wx.canIUse("editor") - }, - /*onTap(e){ - ; - let {detail:{tag, attr}} = e; - if(tag=='navigator'&&attr.href) - navigateToUrl({url: attr.href}); - ; - },*/ - checkTime(){ - if(this.timeChecked) - return; - let date = new Date(); - let hours = date.getHours(); - let min = date.getMinutes(); - if(hours>=0&&hours<=3||hours>=23&&min>=30){ - this.timeChecked = true; - let y = date.getFullYear(); - let m = date.getMonth(); - let d = date.getDate(); - if(hours>=23) - d += 1; - let t = y+'-'+m+'-'+d; - let key = 'task-show-go-to-sleep-last-time' - let last = wx.getStorageSync(key); - if(last==t) - return - this.setData({showGoToSleep:true}); - wx.reportAnalytics('show_go_to_sleep_in_task', {}); - wx.setStorageSync(key, t); - }else if(hours<=21){ - this.timeChecked = true; - } - }, - onTapTopTip(){ - this.setData({showGoToSleep:false}); - wx.reportAnalytics('tap_go_to_sleep', {}); - }, - setNavigationTheme(){ - let {theme} = this.data; - if(theme=='dark'){ - wx.setNavigationBarColor({backgroundColor:"#303030",frontColor:"#ffffff",animation:'linear'}); - }else{ - wx.setNavigationBarColor({backgroundColor:"#fbfbfb",frontColor:"#000000",animation:"linear"}); - } - }, - switchTheme({detail}){ - ; - let {value} = detail; - let theme = value?'dark':'light'; - if(theme==this.data.theme) - return; - wx.showNavigationBarLoading() - this.setData({theme},wx.hideNavigationBarLoading); - this.setNavigationTheme(); - wx.setStorageSync('config-task-theme', theme); - }, - enterTask(e){ - var {target:{dataset:{identifier}}} = e; - ; - if(identifier) - wx.redirectTo({url:"./task?identifier="+identifier}); - }, - setCurrent({current}){ - this.setData({current}); - }, - enterChallenge(){ - this.setData({current:0}) - }, - enterOutcome(){ - this.setData({current:2}); - }, - onTextAreaBlur({detail:{value}}){ - if (!this.modified) { - this.modified = this.content != value; - } - if(this.modified){ - this.content = value; - this.updateFile(); - } - }, - onTextAreaInput({detail:{value}}){ - this.modified = this.content!=value; - if(this.modified) - this.content = value; - }, - onEditorInput(e){ - let {text} = e.detail; - ; - this.modified = this.content!=text; - if(this.modified){ - this.content = text; - // 自动缩进适配┭┮﹏┭┮,小程序限制太多了 - this.oldLines = this.lines; - this.lines = this.content.split(/\n/g); - if(this.oldLines.length+1==this.lines.length){ - for(var i=this.oldLines.length-1;i>=0;i--){ - if(this.lines[i+1]!=this.oldLines[i]){ - let match = this.lines[i].match(/^\s+/); - if(match) - this.editor.insertText({text:match[0]}); - break; - } - } - } - } - }, - onEditorBlur({detail}){ - - let {text} = detail; - if(!this.modified){ - this.modified = this.content.trimEnd()!=text.trimEnd(); - } - if(this.modified){ - this.content = text; - this.updateFile(); - } - }, - processPath(path){ - return path.replace(/[;;]$/,""); - }, - async updateFile({ evaluate=0}={}){ - var {content} = this; - var {path} = this.data.challenge; - path = this.processPath(path); - var {identifier} = this.data.myshixun; - var {id:game_id} = this.data.game; - if(this.modified||evaluate) - this.modified = false; - try{ - var res = await app.api("myshixuns.update_file")({path,identifier,game_id,content,evaluate}); - return res; - }catch(e){ - this.modified = true; - global.realTimeLog.error(e, "fail: update code file fail"); - throw new Error(e.message); - } - }, - buildGame({detail:{value}}){ - wx.showLoading({ - title: '代码上传中', - }); - this.setData({ building: 1 }); - var {identifier} = this.data; - if(!this.data.can_use_editor) - this.content = value.content; - this.updateFile({evaluate:1}) - .then(res=>{ - var {sec_key, resubmit=""} = res; - app.api("tasks.game_build")({ identifier, resubmit, sec_key, content_modified:1}) - .then(res => { - this.getBuildStatus({sec_key, resubmit}); - }) - .catch(e=>{ - wx.hideLoading(); - this.setData({ building: 0 }) - global.realTimeLog.error(e, "fail: build game fail"); - }) - }).catch(e=>{ - wx.hideLoading(); - this.setData({building:0}); - }) - - }, - getBuildStatus({resubmit="", sec_key=""}){ - var { identifier } = this.data; - var timer = setInterval(()=>{ - app.api("tasks.game_status")({identifier,resubmit,sec_key}) - .then(res=>{ - if("status" in res){ - wx.hideLoading(); - this.setData({ current: 2, building: 0 }); - this.setData(res); - clearInterval(timer); - }else if(res.running_code_message){ - wx.showLoading({ - title: res.running_code_message - }) - } - }) - }, 1000); - }, - onSwiperChange(e){ - ; - let {detail:{current,source}} = e; - if(source=="touch"){ - this.setData({current}); - } - if(current==1&&!this.content){ - this.pullContent(); - } - 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,()=>{ - wx.hideLoading(); - wx.hideNavigationBarLoading(); - }); - - }, - async pullContent(){ - ; - let {path} = this.data.challenge; - path = this.processPath(path); - let {identifier} = this.data; - let {content} = await app.api("tasks.rep_content")({identifier,path}); - this.content = content; - if(this.data.can_use_editor){ - if(!this.editor) - this.onEditorReady({pullContent:1}); - else{ - //let delta = {ops:[{insert:content}]}; - //this.editor.setContents({delta}); - this.editor.clear(); - this.lines = content.split(/\n/g); - this.editor.insertText({text:content}); - } - }else - this.setData({content}); - ; - }, - onEditorReady({pullContent=0}={}) { - - const that = this - wx.createSelectorQuery().select('#code-editor').context(function (res) { - that.editor = res.context - if(pullContent&&that.editor) - that.pullContent(); - //that.editor.insertText({text:that.content}); - ; - }).exec(); - - }, - onLoad: function (options) { - - let theme = wx.getStorageSync('config-task-theme'); - this.setData({theme}); - this.setNavigationTheme(); - let {identifier} = options; - this.setData({identifier}); - this.pullTask(); - }, - onReady(){ - this.checkTime(); - }, - onHide: function () { - this.updateFile(); + }, - onShareAppMessage: function () { - let {challenge, shixun} = this.data; - return app.shareApp({ - title:`第${challenge.position}关:${challenge.subject}`, - imageUrl: global.config.eduImgDir + "avatars/Shixun/" + shixun.id, - path:`/shixun/pages/shixun/shixun?identifier=${shixun.identifier}&cate_type=task` - }) + onLoad: function (options) { + if(options) + var query = "?" + Object.keys(options).map(i=>`${i}=${options[i]}`).join("&"); + else + var query = "" + wx.redirectTo({url: "/markdown/task/task/task" + query}); + global.realTimeLog.error("unexpected page"); } }) \ No newline at end of file diff --git a/miniprogram/task/pages/task/task.json b/miniprogram/task/pages/task/task.json index 6be0469..8835af0 100644 --- a/miniprogram/task/pages/task/task.json +++ b/miniprogram/task/pages/task/task.json @@ -1,8 +1,3 @@ { - "usingComponents": { - "rich-md":"/components/rich-md/rich-md", - "test-set":"/task/components/test_set/test_set", - "mp-toptips":"/weui-miniprogram/toptips/toptips" - }, - "navigationBarTitleText": "实训关卡" + "usingComponents": {} } \ No newline at end of file diff --git a/miniprogram/task/pages/task/task.wxml b/miniprogram/task/pages/task/task.wxml index 91e8757..cb70a4b 100644 --- a/miniprogram/task/pages/task/task.wxml +++ b/miniprogram/task/pages/task/task.wxml @@ -1,64 +1,2 @@ - - - - - - - - - 第{{challenge.position}}关:{{challenge.subject}} - - - - - - 用EduCoder云网实训(推荐) - - 黑暗模式 - - - - - - - -
- - - - - - - - -
-
- - - - - 成功通过 {{test_sets_count-sets_error_count}}/{{test_sets_count}} - - - - - - - - - - -
\ No newline at end of file + +跳转中... diff --git a/miniprogram/task/pages/task/task.wxss b/miniprogram/task/pages/task/task.wxss index 093372a..2b68ec1 100644 --- a/miniprogram/task/pages/task/task.wxss +++ b/miniprogram/task/pages/task/task.wxss @@ -1,89 +1 @@ -.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; - opacity: 0.8; -} -.switch-wrap{ - text-align: right; - font-size: 12px; -} -.theme-switch{ - transform: scale(0.6); -} -.challenge-body{ - height: 100%; - background: white; -} -.subject{ - padding-left: 20px; - font-size: 18px; - font-weight: bolder; - -} -.editor-body{ - height: 100%; - display: flex; - flex-direction: column; -} -.form-body{ - height: 100%; - display: flex; - flex-direction: column; -} -.editor{ - width: auto; - background: #002B36; - color: #93A1A1; - font: 14px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; - white-space: pre; - padding: 0px 10px; - height: calc(100vh - 42px); - flex: auto; -} -.operations{ - flex: none; - display: flex; -} -.operations>button{ - flex: auto; - border-radius: 0; -} -.outcome-swiper{ - display: flex; - flex-direction: column; -} -.outcome-body{ - flex: 1 1 1px; - height: 1px; - background: #111c24; -} -.compile-output{ - max-height: 36vh; - overflow-y: scroll; - padding: 6px 10px; - color: #ff6545; -} -.success{ - color: #12af25; -} -.test-set-wrap{ - margin: 7px 8px; -} \ No newline at end of file +/* miniprogram/task/pages/task.wxss */ \ No newline at end of file diff --git a/miniprogram/towxml/decode.json b/miniprogram/towxml/decode.json deleted file mode 100644 index 33d3a1a..0000000 --- a/miniprogram/towxml/decode.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "component": true, - "usingComponents": { - "decode": "/towxml/decode", - "latex": "/towxml/latex/latex", - "table": "/towxml/table/table", - "img": "/towxml/img/img" - } -} \ No newline at end of file