* A 增加教学案例模块

master
educoder_weapp 4 years ago
parent 268a355df2
commit d5ff3a53eb

@ -1,3 +1,7 @@
## v0.19.0
* A 增加教学案例模块
* D 个人中心的EduCoder云网入口
## v0.18.1
* U 页面访问记录扩大页面范围
* U 分享图片封面

@ -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){
// 填入微信个人信息

@ -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"
]
},
{

@ -58,9 +58,12 @@ Page({
onReachBottom: function () {
},
/**
* 用户点击右上角分享
/*
onShareTimeline: function(){
return app.shareTimeline({
title:"EduCoder在线竞赛"
})
},
*/
onShareAppMessage: function () {
return app.shareApp({

@ -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";
}

@ -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;

@ -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;
@ -350,3 +325,36 @@ export function RealTimeLogManager(){
}
}
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();
}
})
}

@ -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});
},

@ -9,7 +9,7 @@
</view>
<rich-md nodes="{{module.md_content}}" type="markdown"/>
<view class="attachments">
<view class="attachment-item" wx:for="{{module.attachments}}" bindtap="onTapAttachment" data-url="{{item.url}}">
<view class="attachment-item" wx:for="{{module.attachments}}" bindtap="onTapAttachment" data-id="{{item.id}}">
<mp-icon icon="link" type="field" color="#002389"/>{{item.title}}
</view>
</view>

@ -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
})
}
})

@ -0,0 +1,6 @@
{
"usingComponents": {
"rich-md":"../../components/rich-md/rich-md"
},
"navigationBarTitleText": "教学案例"
}

@ -0,0 +1,10 @@
<page-meta>
<navigation-bar title="{{title}}"/>
</page-meta>
<rich-md nodes="{{content}}" type="markdown"/>
<view class="attachments">
<view wx:for="{{attachments}}" class="attachment" data-is_pdf="{{item.is_pdf}}" data-id="{{item.id}}" bindtap="openDocument">
<mp-icon icon="link" color="#00b" type="field"/>{{item.title}}
</view>
</view>

@ -0,0 +1,6 @@
.attachment{
text-decoration: underline;
font-size: 14px;
padding: 6px 8px;
color: #00b;
}

@ -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: {
}
})

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

@ -0,0 +1,7 @@
<navigator class="item-container" hover-class="none" url="/markdown/mooc_case/mooc_case/mooc_case?mooc_case_id={{data.id}}">
<image class="item-image" lazy-load mode="aspectFill" src="{{eduUrl}}{{data.cover_url||default_cover}}"></image>
<view class="item-detail">
<view>{{data.title}}<text wx:for="{{data.tags}}" class="tag {{item.id==1?'award':''}}">{{item.name}}</text></view>
<view class="tip">{{data.author_school_name}} {{data.author_name}}</view>
</view>
</navigator>

@ -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;
}

@ -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教学案例"
})
}
})

@ -1,3 +1,6 @@
{
"usingComponents": {}
"usingComponents": {
"mooc_case-item":"./mooc_case_item/mooc_case_item"
},
"navigationBarTitleText": "教学案例"
}

@ -1,2 +1,5 @@
<!--miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxml-->
<text>miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxml</text>
<view class="list-view">
<view class="item-wrp" wx:for="{{libraries}}">
<mooc_case-item data="{{item}}"/>
</view>
</view>

@ -1 +1,6 @@
/* miniprogram/mooc_case/pages/mooc_cases/mooc_cases.wxss */
.item-list{
background: #f0f0f0;
}
.item-wrp{
margin-top: 5px;
}

@ -32,11 +32,15 @@
</view>
<view class="nav-list" bindtap="enterPage">
<navigator target="miniProgram" app-id="wx2402d86a6b534f77" class="nav educoder">
<!--navigator target="miniProgram" app-id="wx2402d86a6b534f77" class="nav educoder">
<image src="{{attachDir}}872467" class="icon"></image>
EduCoder云网
<text class="tip">推荐使用</text>
<iconfont type="jinru" color="dimgrey" size="15" class="enter"/>
</navigator-->
<navigator url="/mooc_case/pages/mooc_cases/mooc_cases" class="nav">
<iconfont class="icon" type="anli" size="21" />教学案例
<iconfont type="jinru" color="dimgrey" size="15" class="enter"></iconfont>
</navigator>
<navigator url="/competition/pages/competitions/competitions" class="nav gap">
<iconfont class="icon" type="jingsai" size="21" />在线竞赛
@ -57,7 +61,7 @@
<button open-type="feedback" class="nav" style="width:auto">
<iconfont class="icon" type="fankui" size="21" />小程序反馈
<text class="tip">有建议,来反馈</text>
<text class="tip">有问题,来反馈</text>
<iconfont type="jinru" color="dimgrey" size="15" class="enter"></iconfont>
</button>
<button open-type="contact" class="nav" style="width:auto">

@ -12,7 +12,7 @@
background: white;
border-bottom: 1px solid #eee;
padding: 0 14px;
height: 41px;
height: 42px;
font-weight: normal;
display: flex;
align-items: center;

@ -134,14 +134,14 @@
"id": 9,
"name": "markdown/shixun/shixun/shixun",
"pathName": "markdown/shixun/shixun/shixun",
"query": "identifier=nyrk9xep",
"query": "identifier=jbrpm7fv",
"scene": 1000
},
{
"id": 17,
"name": "path/pages/path/path",
"pathName": "path/pages/path/path",
"query": "subject_id=13",
"id": 10,
"name": "path",
"pathName": "markdown/path/path/path",
"query": "subject_id=169",
"scene": null
},
{
@ -225,23 +225,16 @@
"id": 22,
"name": "course_invite",
"pathName": "course/pages/course_invite/course_invite",
"query": "course_id=7813",
"query": "course_id=7845",
"scene": null
},
{
"id": -1,
"name": "admin/pages/page_history/page_history",
"id": 23,
"name": "page_history",
"pathName": "admin/pages/page_history/page_history",
"query": "",
"scene": null
},
{
"id": -1,
"name": "markdown/shixun/shixun/shixun",
"pathName": "markdown/shixun/shixun/shixun",
"query": "identifier=tb7hw62n",
"scene": null
},
{
"id": -1,
"name": "account",
@ -269,6 +262,13 @@
"pathName": "competition/pages/competitions/competitions",
"query": "course_id=7845&module_type=students",
"scene": null
},
{
"id": -1,
"name": "mooc_cases",
"pathName": "mooc_case/pages/mooc_cases/mooc_cases",
"query": "",
"scene": null
}
]
}

Loading…
Cancel
Save