diff --git a/changelog.md b/changelog.md index 82d3d8f..a0acbf8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +## v0.19.0 + * A 增加教学案例模块 + * D 个人中心的EduCoder云网入口 + ## v0.18.1 * U 页面访问记录扩大页面范围 * U 分享图片封面 diff --git a/miniprogram/account/pages/profile/profile.js b/miniprogram/account/pages/profile/profile.js index b9cfb6b..2709553 100644 --- a/miniprogram/account/pages/profile/profile.js +++ b/miniprogram/account/pages/profile/profile.js @@ -47,12 +47,11 @@ Page({ msgSecCheck, throttledMsgSecCheck: throttle(msgSecCheck, 1000, {}), updateNickName({detail:{value}}){ - this.setData({nickname: value}); - this.throttledMsgSecCheck(this.data); + this.throttledMsgSecCheck({...this.data, nickname: value}); }, updateName({detail:{value}}){ - this.setData({name: value}); - this.throttledMsgSecCheck(this.data); + //this.setData({name: value}); + this.throttledMsgSecCheck({...this.data, name: value}); }, onGetUserInfo(e){ // 填入微信个人信息 diff --git a/miniprogram/app.json b/miniprogram/app.json index 4f23f1e..9644954 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -55,7 +55,8 @@ "path/path/path", "path/path_send/path_send", "shixun/shixun/shixun", - "admin/git_repo/git_repo" + "admin/git_repo/git_repo", + "mooc_case/mooc_case/mooc_case" ] }, { diff --git a/miniprogram/competition/pages/competitions/competitions.js b/miniprogram/competition/pages/competitions/competitions.js index 6d7b858..486851c 100644 --- a/miniprogram/competition/pages/competitions/competitions.js +++ b/miniprogram/competition/pages/competitions/competitions.js @@ -58,10 +58,13 @@ Page({ onReachBottom: function () { }, - - /** - * 用户点击右上角分享 - */ + /* + onShareTimeline: function(){ + return app.shareTimeline({ + title:"EduCoder在线竞赛" + }) + }, + */ onShareAppMessage: function () { return app.shareApp({ title:"EduCoder在线竞赛" diff --git a/miniprogram/components/iconfont/iconfont.wxss b/miniprogram/components/iconfont/iconfont.wxss index c40c4a5..3609967 100644 --- a/miniprogram/components/iconfont/iconfont.wxss +++ b/miniprogram/components/iconfont/iconfont.wxss @@ -1,11 +1,11 @@ @font-face { font-family: 'iconfont'; /* project id 1656783 */ - src: url('//at.alicdn.com/t/font_1656783_5uvt676wssl.eot'); - src: url('//at.alicdn.com/t/font_1656783_5uvt676wssl.eot?#iefix') format('embedded-opentype'), - url('//at.alicdn.com/t/font_1656783_5uvt676wssl.woff2') format('woff2'), - url('//at.alicdn.com/t/font_1656783_5uvt676wssl.woff') format('woff'), - url('//at.alicdn.com/t/font_1656783_5uvt676wssl.ttf') format('truetype'), - url('//at.alicdn.com/t/font_1656783_5uvt676wssl.svg#iconfont') format('svg'); + src: url('//at.alicdn.com/t/font_1656783_bha2h77g8oh.eot'); + src: url('//at.alicdn.com/t/font_1656783_bha2h77g8oh.eot?#iefix') format('embedded-opentype'), + url('//at.alicdn.com/t/font_1656783_bha2h77g8oh.woff2') format('woff2'), + url('//at.alicdn.com/t/font_1656783_bha2h77g8oh.woff') format('woff'), + url('//at.alicdn.com/t/font_1656783_bha2h77g8oh.ttf') format('truetype'), + url('//at.alicdn.com/t/font_1656783_bha2h77g8oh.svg#iconfont') format('svg'); } .iconfont { display: inline-block; @@ -142,3 +142,6 @@ .icon-jingsai:before{ content:"\e702"; } +.icon-anli:before{ + content: "\e643"; +} \ No newline at end of file diff --git a/miniprogram/config.js b/miniprogram/config.js index 9cc709f..aae4f5e 100644 --- a/miniprogram/config.js +++ b/miniprogram/config.js @@ -1,6 +1,6 @@ const cloudDir = "cloud://educoder.6564-educoder-1300855313/"; -let _version = "0.18.0"; +let _version = "0.19.0"; let { miniProgram:{ envVersion="release", version=_version}={}} = wx.getAccountInfoSync(); version = version||_version; diff --git a/miniprogram/js/utils.js b/miniprogram/js/utils.js index 24ac835..5af74ee 100644 --- a/miniprogram/js/utils.js +++ b/miniprogram/js/utils.js @@ -249,32 +249,7 @@ export function navigateToUrl({url,open_type='navigateTo'}){ var match = url.match(/api\/attachments\/([0-9]*)/); console.log(url,match) if(match){ - wx.showLoading({ - title: '加载中' - }); - wx.downloadFile({ - url: 'https://www.educoder.net/api/attachments/'+match[1], - success: res=>{ - wx.openDocument({ - filePath: res.tempFilePath, - showMenu: true, - complete: res=>{ - wx.hideLoading() - }, - fail:e=>{ - wx.showToast({ - title:"暂不支持预览",icon:"none" - }) - } - }) - }, - fail:e=>{ - wx.hideLoading(); - wx.showToast({ - title: '下载失败',icon:"none" - }) - } - }) + openAttachment({id: match[1]}); return true } return false; @@ -349,4 +324,37 @@ export function RealTimeLogManager(){ } } } -global.realTimeLog = RealTimeLogManager(); \ No newline at end of file +global.realTimeLog = RealTimeLogManager(); + + +export function openAttachment({id,fileType}){ + let url = global.config.attachDir + id; + console.log("downloading", url); + wx.showLoading({title:"加载中"}); + wx.downloadFile({ + url, + success: res=>{ + console.log("download success", res); + wx.openDocument({ + filePath: res.tempFilePath, + showMenu: true, + fileType, + fail: e=>{ + console.log(e); + wx.showToast({ + title: '暂不支持预览',icon:"none" + }) + } + }) + }, + fail:e=>{ + console.log(e); + wx.showToast({ + title:"下载失败", icon:"none" + }) + }, + complete: ()=>{ + wx.hideLoading(); + } + }) +} \ No newline at end of file diff --git a/miniprogram/markdown/competition/competition/competition.js b/miniprogram/markdown/competition/competition/competition.js index 04bc482..c12c2e0 100644 --- a/miniprogram/markdown/competition/competition/competition.js +++ b/miniprogram/markdown/competition/competition/competition.js @@ -1,4 +1,4 @@ - +import {openAttachment} from "../../../js/utils" const app = getApp(); Page({ @@ -49,28 +49,10 @@ Page({ }, onTapAttachment(e){ - console.log(e); - let {currentTarget:{dataset:{url}}} = e; - console.log(url); - url = "https://www.educoder.net"+url; - wx.showLoading({title:"加载中"}); - wx.downloadFile({ - url, - success: res=>{ - wx.openDocument({ - filePath: res.tempFilePath, - showMenu: true - }) - }, - fail:e=>{ - wx.showToast({ - title:"暂不支持预览", icon:"none" - }) - }, - complete: ()=>{ - wx.hideLoading(); - } - }) + //console.log(e); + let {currentTarget:{dataset:{id}}} = e; + + openAttachment({id}); }, diff --git a/miniprogram/markdown/competition/competition/competition.wxml b/miniprogram/markdown/competition/competition/competition.wxml index 88d64f7..fe144ed 100644 --- a/miniprogram/markdown/competition/competition/competition.wxml +++ b/miniprogram/markdown/competition/competition/competition.wxml @@ -9,7 +9,7 @@ - + {{item.title}} diff --git a/miniprogram/markdown/mooc_case/mooc_case/mooc_case.js b/miniprogram/markdown/mooc_case/mooc_case/mooc_case.js new file mode 100644 index 0000000..4ffd4c7 --- /dev/null +++ b/miniprogram/markdown/mooc_case/mooc_case/mooc_case.js @@ -0,0 +1,98 @@ +const app = getApp(); +import {openAttachment} from "../../../js/utils"; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + app.reportPageHistory() + app.api("libraries.$")({mooc_case_id: options.mooc_case_id}) + .then(res=>{ + this.setData(res); + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + openDocument:function(e){ + let {currentTarget:{dataset} }= e; + let {id, is_pdf} = dataset + console.log(dataset, id); + let fileType; + if(is_pdf&&is_pdf!='false') + fileType = "pdf"; + else + fileType = void 0; + openAttachment({id, fileType}); + }, + + onAddToFavorites:function(){ + let {title, cover} = this.data + return app.addToFavorites({ + title: "「教学案例」"+title, + imageUrl:global.config.eduUrl+cover.url + }) + }, + onShareTimeline:function(){ + let {title, cover} = this.data + return app.shareTimeline({ + title: "「教学案例」"+title, + imageUrl:global.config.eduUrl+cover.url + }) + }, + onShareAppMessage: function () { + let {title, cover} = this.data + return app.shareApp({ + title: "「教学案例」"+title, + imageUrl:global.config.eduUrl+cover.url + }) + } +}) \ No newline at end of file diff --git a/miniprogram/markdown/mooc_case/mooc_case/mooc_case.json b/miniprogram/markdown/mooc_case/mooc_case/mooc_case.json new file mode 100644 index 0000000..cadae1a --- /dev/null +++ b/miniprogram/markdown/mooc_case/mooc_case/mooc_case.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "rich-md":"../../components/rich-md/rich-md" + }, + "navigationBarTitleText": "教学案例" +} \ No newline at end of file diff --git a/miniprogram/markdown/mooc_case/mooc_case/mooc_case.wxml b/miniprogram/markdown/mooc_case/mooc_case/mooc_case.wxml new file mode 100644 index 0000000..962c9a3 --- /dev/null +++ b/miniprogram/markdown/mooc_case/mooc_case/mooc_case.wxml @@ -0,0 +1,10 @@ + + + + + + + + {{item.title}} + + \ No newline at end of file diff --git a/miniprogram/markdown/mooc_case/mooc_case/mooc_case.wxss b/miniprogram/markdown/mooc_case/mooc_case/mooc_case.wxss new file mode 100644 index 0000000..79852e7 --- /dev/null +++ b/miniprogram/markdown/mooc_case/mooc_case/mooc_case.wxss @@ -0,0 +1,6 @@ +.attachment{ + text-decoration: underline; + font-size: 14px; + padding: 6px 8px; + color: #00b; +} \ No newline at end of file diff --git a/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.js b/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.js new file mode 100644 index 0000000..b696606 --- /dev/null +++ b/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.js @@ -0,0 +1,18 @@ +// mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.js +Component({ + properties: { + data:Object + }, + + data: { + eduUrl:global.config.eduUrl, + default_cover:"/images/educoder/library-default-cover.png" + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.json b/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.wxml b/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.wxml new file mode 100644 index 0000000..ef03856 --- /dev/null +++ b/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.wxml @@ -0,0 +1,7 @@ + + + + {{data.title}}{{item.name}} + {{data.author_school_name}} {{data.author_name}} + + \ No newline at end of file diff --git a/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.wxss b/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.wxss new file mode 100644 index 0000000..10f7ca2 --- /dev/null +++ b/miniprogram/mooc_case/pages/mooc_cases/mooc_case_item/mooc_case_item.wxss @@ -0,0 +1,36 @@ +.item-container{ + padding: 10px 12px; + display: flex; + background: white; + align-items: center; +} + +.item-detail{ + font-size: 15px; + margin-left: 12px; +} + +.tip{ + font-size: 12px; + color: grey; + margin-top: 4px; +} +.item-image{ + height: 180rpx; + width: 240rpx; + background: #804080; + flex: none; + border-radius: 4px; +} +.tag{ + background: #00b0f0; + color: white; + padding: 4px 6px; + border-radius: 40px; + font-size: 10px; + margin-left: 5px; + white-space: nowrap; +} +.tag.award{ + background: #fc2b6a; +} \ No newline at end of file diff --git a/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.js b/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.js index affa920..7b25fe3 100644 --- a/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.js +++ b/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.js @@ -1,37 +1,25 @@ -// miniprogram/mooc_case/pages/mooc_cases/mooc_cases.js +const app = getApp(); Page({ - /** - * 页面的初始数据 - */ data: { }, - - /** - * 生命周期函数--监听页面加载 - */ onLoad: function (options) { - + app.reportPageHistory() + app.api("libraries")() + .then(res=>{ + this.setData(res); + }) + .catch(app.showError) }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ onReady: function () { }, - /** - * 生命周期函数--监听页面显示 - */ onShow: function () { }, - - /** - * 生命周期函数--监听页面隐藏 - */ onHide: function () { }, @@ -50,17 +38,19 @@ Page({ }, - /** - * 页面上拉触底事件的处理函数 - */ onReachBottom: function () { }, - - /** - * 用户点击右上角分享 - */ + /* + onShareTimeline:function(){ + return app.shareTimeline({ + title: "EduCoder教学案例" + }) + }, + */ onShareAppMessage: function () { - + return app.shareApp({ + title:"EduCoder教学案例" + }) } }) \ No newline at end of file diff --git a/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.json b/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.json index 8835af0..60a820b 100644 --- a/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.json +++ b/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.json @@ -1,3 +1,6 @@ { - "usingComponents": {} + "usingComponents": { + "mooc_case-item":"./mooc_case_item/mooc_case_item" + }, + "navigationBarTitleText": "教学案例" } \ No newline at end of file diff --git a/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxml b/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxml index 1ad592c..f83a468 100644 --- a/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxml +++ b/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxml @@ -1,2 +1,5 @@ - -miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxml + + + + + \ No newline at end of file diff --git a/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxss b/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxss index 05dca4d..6035a1c 100644 --- a/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxss +++ b/miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxss @@ -1 +1,6 @@ -/* miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxss */ \ No newline at end of file +.item-list{ + background: #f0f0f0; +} +.item-wrp{ + margin-top: 5px; +} \ No newline at end of file diff --git a/miniprogram/pages/home/home.wxml b/miniprogram/pages/home/home.wxml index 76586d4..6892347 100644 --- a/miniprogram/pages/home/home.wxml +++ b/miniprogram/pages/home/home.wxml @@ -32,11 +32,15 @@ - + + + 教学案例 + 在线竞赛 @@ -57,7 +61,7 @@