diff --git a/cloudfunctions/cloudapi/index.js b/cloudfunctions/cloudapi/index.js index 8749672..36ea4b7 100644 --- a/cloudfunctions/cloudapi/index.js +++ b/cloudfunctions/cloudapi/index.js @@ -85,7 +85,11 @@ const sceneDescMap = { 1146: "地理位置信息打开出行类小程序", 1148: "卡包-交通卡,打开小程序", 1150: "扫一扫商品条码结果页打开小程序", - 1153: '“识物”结果页打开小程序' + 1153: '“识物”结果页打开小程序', + 1154:'朋友圈内打开“单页模式”', + 1155:'“单页模式”打开小程序', + 1169:'发现栏小程序主入口,各个生活服务入口(例如快递服务、出行服务等)' + } function getFormatTime(date){ date = date || new Date(); diff --git a/cloudfunctions/trigger/index.js b/cloudfunctions/trigger/index.js index 7c68329..38e1d50 100644 --- a/cloudfunctions/trigger/index.js +++ b/cloudfunctions/trigger/index.js @@ -116,7 +116,7 @@ async function clearPageHistory({Time}){ const pageHistoryCollection = db.collection(collectionNameMap.pageHistory); let res = await pageHistoryCollection.where({ - time: _lt(timeEnd) + time: _.lt(timeEnd) }).remove(); console.log("remove page History result: ", res); diff --git a/miniprogram/app.js b/miniprogram/app.js index aa5e9bd..1916f95 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -176,6 +176,42 @@ App({ }else return true; }, + addToFavorites({title, query, imageUrl}={}){ + let db = wx.cloud.database(); + let data = { + title, + imageUrl, + query, + scene: this.globalData.scene, + version: config.version, + time: db.serverDate() + } + db.collection("shareInfo").add({ + type:"addToFavorites", + data + }); + return { + title, query, imageUrl + } + }, + shareTimeline({title, query, imageUrl}={}){ + let db = wx.cloud.database(); + let data = { + title, + imageUrl, + query, + scene: this.globalData.scene, + version: config.version, + time: db.serverDate() + } + db.collection("shareInfo").add({ + type:"shareTimeline", + data + }); + return { + title, query, imageUrl + } + }, shareApp({ imageUrl, path, title="EduCoder教学"}={}) { let db = wx.cloud.database(); let shareInfo = { @@ -183,7 +219,7 @@ App({ imageUrl, path } - if (config.envVersion == 'release') { + if (config.envVersion == 'release'&&!this.globalData.isCrawl) { if (!path) { let pages = getCurrentPages(); let page = pages[pages.length - 1]; @@ -201,7 +237,8 @@ App({ time: db.serverDate() } console.log("upload", data); - db.collection("shareAppInfo").add({ + db.collection("shareInfo").add({ + type:"shareAppMessage", data }); } @@ -210,7 +247,7 @@ App({ }); -// 兼容finally +// 兼容Promise.finally if(!Promise.prototype.finally){ Promise.prototype.finally = function (callback) { let P =this.constructor; diff --git a/miniprogram/app.json b/miniprogram/app.json index 3769977..f72ec8d 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -14,7 +14,8 @@ "pages/main/main", "pages/findmore/findmore", "pages/home/home", - "pages/tidings/tidings" + "pages/tidings/tidings", + "competition/pages/competition/competition" ], "subpackages": [ { @@ -183,5 +184,7 @@ }, "sitemapLocation": "sitemap.json", "themeLocation": "theme.json", - "style": "v2" + "lazyCodeLoading": "requiredComponents", + "style": "v2", + "debug":true } \ No newline at end of file diff --git a/miniprogram/competition/apiConfig.js b/miniprogram/competition/apiConfig.js new file mode 100644 index 0000000..d6e3e5f --- /dev/null +++ b/miniprogram/competition/apiConfig.js @@ -0,0 +1,15 @@ +import apiConfig from "../js/apiConfig" + +Object.assign(apiConfig, +{ +competitions:{ + common_header:{url:"{identifier}/*"}, + competition_staff:{url:"{identifier}/*"}, + competition_modules:{url:"{identifier}/*/{module_id}"}, +} + +}) + + + +export default apiConfig; \ No newline at end of file diff --git a/miniprogram/competition/pages/competition/competition.js b/miniprogram/competition/pages/competition/competition.js new file mode 100644 index 0000000..19daef0 --- /dev/null +++ b/miniprogram/competition/pages/competition/competition.js @@ -0,0 +1,61 @@ +import apiConfig from "../../apiConfig" + +Page({ + + data: { + + }, + + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + onShareTimeline:function(){ + + }, + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/competition/pages/competition/competition.json b/miniprogram/competition/pages/competition/competition.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/competition/pages/competition/competition.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/competition/pages/competition/competition.wxml b/miniprogram/competition/pages/competition/competition.wxml new file mode 100644 index 0000000..3200328 --- /dev/null +++ b/miniprogram/competition/pages/competition/competition.wxml @@ -0,0 +1,2 @@ + +miniprogram/competition/pages/competition/competition.wxml diff --git a/miniprogram/competition/pages/competition/competition.wxss b/miniprogram/competition/pages/competition/competition.wxss new file mode 100644 index 0000000..a91573b --- /dev/null +++ b/miniprogram/competition/pages/competition/competition.wxss @@ -0,0 +1 @@ +/* miniprogram/competition/pages/competition/competition.wxss */ \ No newline at end of file diff --git a/miniprogram/markdown/admin/git_repo/git_repo.js b/miniprogram/markdown/admin/git_repo/git_repo.js index 2b75df8..37f8b73 100644 --- a/miniprogram/markdown/admin/git_repo/git_repo.js +++ b/miniprogram/markdown/admin/git_repo/git_repo.js @@ -100,6 +100,7 @@ Page({ this.navBack({level}); }, onLoad(){ + wx.showLoading({title:"加载中"}); app.cloudapi("reportPageHistory")({ page: this.route, options: this.options, @@ -111,11 +112,14 @@ Page({ this.api("shixuns.repository")().then(res=>{ console.log(res); this.setData(res); - }) + }).finally(()=>{ + wx.hideLoading(); + }) }).catch(e=>{ wx.showToast({ title: '获取失败',icon:"none" - }) + }); + wx.hideLoading(); }) }, diff --git a/miniprogram/markdown/exercise/exercise/exercise.js b/miniprogram/markdown/exercise/exercise/exercise.js index 6a458b0..ac8c70c 100644 --- a/miniprogram/markdown/exercise/exercise/exercise.js +++ b/miniprogram/markdown/exercise/exercise/exercise.js @@ -65,7 +65,7 @@ Page({ }).catch(e=>{ //app.showError(e); var title = '提交失败'; - //if(e.code==-2) + //if(e.code==-2)//@todo: unknow error! // title = '您未作答任何题'; showToast({ title, @@ -75,6 +75,7 @@ Page({ db.collection("data").add({ data: { name: "exercises.commit_exercise", + message:e.message, e, createdAt: db.serverDate() } diff --git a/miniprogram/markdown/path/path/path.js b/miniprogram/markdown/path/path/path.js index 1316eb4..3b3c46c 100644 --- a/miniprogram/markdown/path/path/path.js +++ b/miniprogram/markdown/path/path/path.js @@ -97,6 +97,20 @@ Page({ return e; }) }, + onAddToFavorites:function(){ + let {subject} = this.data; + return app.addToFavorites({ + title: "「实践课程」"+subject.name, + imageUrl: global.config.eduUrl + "/" + subject.cover + }) + }, + onShareTimeline:function(){ + let {subject} = this.data; + return app.shareTimeline({ + title: "「实践课程」"+subject.name, + imageUrl: global.config.eduUrl + "/" + subject.cover + }) + }, onShareAppMessage: function () { let {subject} = this.data; diff --git a/miniprogram/markdown/shixun/shixun/shixun.js b/miniprogram/markdown/shixun/shixun/shixun.js index 5babf21..5ac9694 100644 --- a/miniprogram/markdown/shixun/shixun/shixun.js +++ b/miniprogram/markdown/shixun/shixun/shixun.js @@ -109,11 +109,25 @@ Page({ }) }).catch(e=>{ app.showError(e); + wx.hideShareMenu(); }); this.pullChallenges().catch(e=>{ }); }, + onAddToFavorites:function(){ + return app.addToFavorites({ + title: "「实训项目」"+this.data.shixun.name, + imageUrl: global.config.eduImgDir+"avatars/Shixun/"+this.data.shixun.id + }); + }, + onShareTimeline:function(){ + + return app.shareTimeline({ + title: "「实训项目」"+this.data.shixun.name, + imageUrl: global.config.eduImgDir+"avatars/Shixun/"+this.data.shixun.id + }); + }, onShareAppMessage: function () { return app.shareApp({ diff --git a/miniprogram/pages/home/home.wxml b/miniprogram/pages/home/home.wxml index c5c32d2..f9e8c7b 100644 --- a/miniprogram/pages/home/home.wxml +++ b/miniprogram/pages/home/home.wxml @@ -82,6 +82,6 @@ - 参与开源贡献 {{version}} + 点击参与开源 {{version}} \ No newline at end of file diff --git a/project.config.json b/project.config.json index b4e2189..450f5db 100644 --- a/project.config.json +++ b/project.config.json @@ -82,10 +82,10 @@ "scene": null }, { - "id": 6, + "id": 2, "name": "course/pages/course/course", "pathName": "course/pages/course/course", - "query": "course_id=7582&module_type=students", + "query": "course_id=7845&module_type=students", "scene": null }, { @@ -134,7 +134,7 @@ "id": 9, "name": "markdown/shixun/shixun/shixun", "pathName": "markdown/shixun/shixun/shixun", - "query": "identifier=8bu9zmjy", + "query": "identifier=nyrk9xep", "scene": 1000 }, {