添加分包,优化界面

master
educoder_weapp 5 years ago
parent ea0ed0b11f
commit 65d57faed8

1
.gitignore vendored

@ -1,5 +1,6 @@
api_docs/ api_docs/
.idea/ .idea/
res/
# Windows # Windows
[Dd]esktop.ini [Dd]esktop.ini

@ -0,0 +1,7 @@
{
"permissions": {
"openapi": [
"customerServiceMessage.send"
]
}
}

@ -0,0 +1,26 @@
const cloud = require('wx-server-sdk')
cloud.init({
// API 调用都保持和云函数当前所在环境一致
env: cloud.DYNAMIC_CURRENT_ENV
})
// 云函数入口函数
exports.main = async (event, context) => {
console.log(event)
const { OPENID } = cloud.getWXContext()
const result = await cloud.openapi.customerServiceMessage.send({
touser: OPENID,
msgtype: 'text',
text: {
content: '收到:' + event.Content,
}
})
console.log(result)
return result
}

@ -0,0 +1,14 @@
{
"name": "callback",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

@ -0,0 +1,5 @@
{
"permissions": {
"openapi": []
}
}

@ -0,0 +1,8 @@
const cloud = require('wx-server-sdk')
exports.main = async (event, context) => {
// event.userInfo 是已废弃的保留字段,在此不做展示
// 获取 OPENID 等微信上下文请使用 cloud.getWXContext()
delete event.userInfo
return event
}

@ -0,0 +1,14 @@
{
"name": "echo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

@ -0,0 +1,15 @@
{
"permissions": {
"openapi": [
"wxacode.get",
"subscribeMessage.send",
"subscribeMessage.addTemplate",
"templateMessage.send",
"templateMessage.addTemplate",
"templateMessage.deleteTemplate",
"templateMessage.getTemplateList",
"templateMessage.getTemplateLibraryById",
"templateMessage.getTemplateLibraryList"
]
}
}

@ -0,0 +1,83 @@
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
// 云函数入口函数
exports.main = async (event, context) => {
console.log(event)
switch (event.action) {
case 'requestSubscribeMessage': {
return requestSubscribeMessage(event)
}
case 'sendSubscribeMessage': {
return sendSubscribeMessage(event)
}
case 'getWXACode': {
return getWXACode(event)
}
case 'getOpenData': {
return getOpenData(event)
}
default: {
return
}
}
}
async function requestSubscribeMessage(event) {
// 此处为模板 ID开发者需要到小程序管理后台 - 订阅消息 - 公共模板库中添加模板,
// 然后在我的模板中找到对应模板的 ID填入此处
return '请到管理后台申请模板 ID 然后在此替换' // 如 'N_J6F05_bjhqd6zh2h1LHJ9TAv9IpkCiAJEpSw0PrmQ'
}
async function sendSubscribeMessage(event) {
const { OPENID } = cloud.getWXContext()
const { templateId } = event
const sendResult = await cloud.openapi.subscribeMessage.send({
touser: OPENID,
templateId,
miniprogram_state: 'developer',
page: 'pages/openapi/openapi',
// 此处字段应修改为所申请模板所要求的字段
data: {
thing1: {
value: '咖啡',
},
time3: {
value: '2020-01-01 00:00',
},
}
})
return sendResult
}
async function getWXACode(event) {
let {path} = event;
const wxacodeResult = await cloud.openapi.wxacode.get({
path
})
const fileExtensionMatches = wxacodeResult.contentType.match(/\/([^\/]+)/)
const fileExtension = (fileExtensionMatches && fileExtensionMatches[1]) || 'jpg'
const uploadResult = await cloud.uploadFile({
cloudPath: `images/wxacode/${path.replace(/[\/?&]/g,"_")}.${fileExtension}`,
fileContent: wxacodeResult.buffer,
})
if (!uploadResult.fileID) {
throw new Error(`upload failed with empty fileID and storage server status code ${uploadResult.statusCode}`)
}
return uploadResult.fileID
}
async function getOpenData(event) {
return cloud.getOpenData({
list: event.openData.list,
})
}

@ -0,0 +1,14 @@
{
"name": "openapi",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

@ -1,4 +1,6 @@
js/apiConfig.js js/apiConfig.js
towxml/
wemark/
# Windows # Windows
[Dd]esktop.ini [Dd]esktop.ini

@ -1 +0,0 @@
towxml/

@ -1,75 +1,20 @@
const Towxml = require('../../towxml/main');
if (!global.towxml) if (!global.towxml)
global.towxml = new Towxml(); global.towxml = require('../../../towxml/index');
Page({ Page({
/** md: '# 服务协议\n\n尊敬的用户您好\n欢迎使用本平台在您使用本平台前请您认真阅读并遵守《服务协议》以下简称”本协议”请您务必审慎阅读、充分理解协议的各条款内容。\n当您在注册过程中点击查看”看过并同意本服务协议”按照注册流程成功注册为平台的用户即表示您已充分阅读、理解并完全接受本协议中的全部条款。您承诺接受并遵守本协议的约定届时您不应以未阅读本协议的内容等理由主张本协议无效或本协议中的某些条款无效或要求撤销本协议。\n\n## 本平台权利和义务\n1. 尊重用户隐私:尊重用户隐私,保障用户隐私安全是平台的一项基本政策;\n2. 管理平台用户:平台依据国家法律、地方法律和国际法律等的标准以及本行业的规则来管理平台注册用户;\n3. 处理用户反馈:平台的相关人员会及时处理用户反馈的问题并给予及时回复。\n## 用户权利和义务\n1. 用户在使用平台的过程中,必须遵守如下原则:\n2. 遵守中国的有关法律和法规;\n3. 使用网络服务不作非法用途;\n4. 不干扰和混乱网络服务;\n5. 遵守所有使用网络服务的网络协议、规定、程序和惯例;\n6. 不传输任何非法的、骚扰性的、中伤他人的、辱骂性的、恐吓性的、伤害性的、庸俗的,淫秽等信息资料;\n7. 不传输任何教唆他人构成犯罪行为的资料;\n8. 用户不得故意或者过失损害平台合法权利和利益。及时回复。\n## 关于责任\n鉴于网络服务的特殊性本平台有权在事先通知的情况下变更、中断、升级部分网络服务。本平台不担保网络服务不会中断但承诺在用户可承受的时间内快速恢复服务同时确保用户数据的安全性和可靠性。\n\n## 免责条款\n鉴于互联网服务的特点本平台对用户自行上传的资料不承担任何法律责任希望各网友对平台提供的互动服务中的内容进行监督若发现存在侵犯任何第三人著作权等合法权益的内容请及时告知我们将严格按照《信息网络传播权保护条例》中的规定予以删除。\n\n1. 本平台属于非赢利性平台转载的文章遵循原作者的版权声明如果原文没有版权声明按照目前互联网开放的原则我们将在不通知作者的情况下转载文章如果原文明确注明“禁止转载”我们一定不会转载。如果我们转载的文章不符合作者的版权声明或者作者不想让我们转载您的文章的话请来信告知zhongjin@educoder.net\n2. 本平台转载文章仅为传播更多信息之目的,凡在本平台出现的信息,均仅供参考。本平台将尽力确保所提供信息的准确性及可靠性,但不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何损失或损害承担责任。\n3. 任何透过本平台网页而链接及得到的资讯、产品及服务,本平台概不负责,亦不负任何法律责任。\n4. 本平台所刊发、转载的文章,其版权均归原作者所有,如其他媒体、平台或个人从本网下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本网注明的“稿件来源”,并自负版权等法律责任。\n## 侵权投诉\nEducoder平台是一个接受外来投稿的平台部分图片和文字来自互联网或原作者自行编辑。投稿到Educoder平台的文章默认作者授权其全部图文内容在Educoder平台、在其微信公众号及微博帐号进行发布Educoder平台对这一部分内容不进行预先审查。\n如您发现平台上文章或图片涉嫌侵犯您的权利请您将所涉及的文章 URL 和侵权理由以邮件形式发送到邮箱zhongjin@educoder.net我们将在核实情况后依照《中华人民共和国侵权责任法》及其司法解释对内容进行屏蔽、删除和通知原作者。\n\n## 服务条款的修改\n本平台保留在必要时对本协议修改的权利一旦发生变动这些条款可由平台项目组及时更新且毋须另行通知修改后的条款一旦在网页上公布即有效代替原来的服务条款。您可随时查阅最新版服务条款。\n\n**本协议最终解释权归本平台所有**。'
* 页面的初始数据
*/
md: '# 服务协议\n\n尊敬的用户您好\n欢迎使用本网站在您使用本网站前请您认真阅读并遵守《服务协议》以下简称”本协议”请您务必审慎阅读、充分理解协议的各条款内容。\n当您在注册过程中点击查看”看过并同意本服务协议”按照注册流程成功注册为网站的用户即表示您已充分阅读、理解并完全接受本协议中的全部条款。您承诺接受并遵守本协议的约定届时您不应以未阅读本协议的内容等理由主张本协议无效或本协议中的某些条款无效或要求撤销本协议。\n\n## 本网站权利和义务\n1. 尊重用户隐私:尊重用户隐私,保障用户隐私安全是网站的一项基本政策;\n2. 管理网站用户:网站依据国家法律、地方法律和国际法律等的标准以及本行业的规则来管理网站注册用户;\n3. 处理用户反馈:网站的相关人员会及时处理用户反馈的问题并给予及时回复。\n## 用户权利和义务\n1. 用户在使用网站的过程中,必须遵守如下原则:\n2. 遵守中国的有关法律和法规;\n3. 使用网络服务不作非法用途;\n4. 不干扰和混乱网络服务;\n5. 遵守所有使用网络服务的网络协议、规定、程序和惯例;\n6. 不传输任何非法的、骚扰性的、中伤他人的、辱骂性的、恐吓性的、伤害性的、庸俗的,淫秽等信息资料;\n7. 不传输任何教唆他人构成犯罪行为的资料;\n8. 用户不得故意或者过失损害网站合法权利和利益。及时回复。\n## 关于责任\n鉴于网络服务的特殊性本网站有权在事先通知的情况下变更、中断、升级部分网络服务。本网站不担保网络服务不会中断但承诺在用户可承受的时间内快速恢复服务同时确保用户数据的安全性和可靠性。\n\n## 免责条款\n鉴于互联网服务的特点本网站对用户自行上传的资料不承担任何法律责任希望各网友对网站提供的互动服务中的内容进行监督若发现存在侵犯任何第三人著作权等合法权益的内容请及时告知我们将严格按照《信息网络传播权保护条例》中的规定予以删除。\n\n1. 本网站属于非赢利性网站转载的文章遵循原作者的版权声明如果原文没有版权声明按照目前互联网开放的原则我们将在不通知作者的情况下转载文章如果原文明确注明“禁止转载”我们一定不会转载。如果我们转载的文章不符合作者的版权声明或者作者不想让我们转载您的文章的话请来信告知zhongjin@educoder.net\n2. 本网站转载文章仅为传播更多信息之目的,凡在本网站出现的信息,均仅供参考。本网站将尽力确保所提供信息的准确性及可靠性,但不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何损失或损害承担责任。\n3. 任何透过本网站网页而链接及得到的资讯、产品及服务,本网站概不负责,亦不负任何法律责任。\n4. 本网站所刊发、转载的文章,其版权均归原作者所有,如其他媒体、网站或个人从本网下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本网注明的“稿件来源”,并自负版权等法律责任。\n## 侵权投诉\nEducoder平台是一个接受外来投稿的平台部分图片和文字来自互联网或原作者自行编辑。投稿到Educoder平台的文章默认作者授权其全部图文内容在Educoder平台、在其微信公众号及微博帐号进行发布Educoder平台对这一部分内容不进行预先审查。\n如您发现平台上文章或图片涉嫌侵犯您的权利请您将所涉及的文章 URL 和侵权理由以邮件形式发送到邮箱zhongjin@educoder.net我们将在核实情况后依照《中华人民共和国侵权责任法》及其司法解释对内容进行屏蔽、删除和通知原作者。\n\n## 服务条款的修改\n本网站保留在必要时对本协议修改的权利一旦发生变动这些条款可由网站项目组及时更新且毋须另行通知修改后的条款一旦在网页上公布即有效代替原来的服务条款。您可随时查阅最新版服务条款。\n\n**本协议最终解释权归本网站所有**。'
, ,
data: { data: {
article: {} article: {}
}, },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) { onLoad: function (options) {
const _ts = this; let article = global.towxml(this.md, 'markdown')
let data = global.towxml.toJson(this.md,'markdown'); this.setData({
_ts.setData({ article
article: data
}); });
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () { onShareAppMessage: function () {
} }

@ -1,3 +1,5 @@
{ {
"usingComponents": {} "usingComponents": {
"towxml": "/towxml/towxml"
}
} }

@ -1,4 +1 @@
<import src="/account/towxml/entry.wxml"/> <towxml nodes="{{article}}"></towxml>
<view>
<template is="entry" data="{{...article}}"/>
</view>

@ -1,16 +0,0 @@
/* pages/about/about.wxss */
/**基础风格样式**/
@import '/account/towxml/style/main.wxss';
/**如果页面有动态主题切换,则需要将使用到的样式全部引入**/
/**主题配色(浅色样式)**/
@import '/account/towxml/style/theme/light.wxss';
/**主题配色(深色样式)**/
@import '/account/towxml/style/theme/dark.wxss';
.container{
padding-bottom: 40rpx;
}

@ -1,73 +0,0 @@
const Towxml = require('../../towxml/main');
if(!global.towxml)
global.towxml = new Towxml();
Page({
agreement: '# 服务协议\n\n尊敬的用户您好\n欢迎使用本网站在您使用本网站前请您认真阅读并遵守《服务协议》以下简称”本协议”请您务必审慎阅读、充分理解协议的各条款内容。\n当您在注册过程中点击查看”看过并同意本服务协议”按照注册流程成功注册为网站的用户即表示您已充分阅读、理解并完全接受本协议中的全部条款。您承诺接受并遵守本协议的约定届时您不应以未阅读本协议的内容等理由主张本协议无效或本协议中的某些条款无效或要求撤销本协议。\n\n## 本网站权利和义务\n1. 尊重用户隐私:尊重用户隐私,保障用户隐私安全是网站的一项基本政策;\n2. 管理网站用户:网站依据国家法律、地方法律和国际法律等的标准以及本行业的规则来管理网站注册用户;\n3. 处理用户反馈:网站的相关人员会及时处理用户反馈的问题并给予及时回复。\n## 用户权利和义务\n1. 用户在使用网站的过程中,必须遵守如下原则:\n2. 遵守中国的有关法律和法规;\n3. 使用网络服务不作非法用途;\n4. 不干扰和混乱网络服务;\n5. 遵守所有使用网络服务的网络协议、规定、程序和惯例;\n6. 不传输任何非法的、骚扰性的、中伤他人的、辱骂性的、恐吓性的、伤害性的、庸俗的,淫秽等信息资料;\n7. 不传输任何教唆他人构成犯罪行为的资料;\n8. 用户不得故意或者过失损害网站合法权利和利益。及时回复。\n## 关于责任\n鉴于网络服务的特殊性本网站有权在事先通知的情况下变更、中断、升级部分网络服务。本网站不担保网络服务不会中断但承诺在用户可承受的时间内快速恢复服务同时确保用户数据的安全性和可靠性。\n\n## 免责条款\n鉴于互联网服务的特点本网站对用户自行上传的资料不承担任何法律责任希望各网友对网站提供的互动服务中的内容进行监督若发现存在侵犯任何第三人著作权等合法权益的内容请及时告知我们将严格按照《信息网络传播权保护条例》中的规定予以删除。\n\n1. 本网站属于非赢利性网站转载的文章遵循原作者的版权声明如果原文没有版权声明按照目前互联网开放的原则我们将在不通知作者的情况下转载文章如果原文明确注明“禁止转载”我们一定不会转载。如果我们转载的文章不符合作者的版权声明或者作者不想让我们转载您的文章的话请来信告知zhongjin@educoder.net\n2. 本网站转载文章仅为传播更多信息之目的,凡在本网站出现的信息,均仅供参考。本网站将尽力确保所提供信息的准确性及可靠性,但不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何损失或损害承担责任。\n3. 任何透过本网站网页而链接及得到的资讯、产品及服务,本网站概不负责,亦不负任何法律责任。\n4. 本网站所刊发、转载的文章,其版权均归原作者所有,如其他媒体、网站或个人从本网下载使用,请在转载有关文章时务必尊重该文章的著作权,保留本网注明的“稿件来源”,并自负版权等法律责任。\n## 侵权投诉\nEducoder平台是一个接受外来投稿的平台部分图片和文字来自互联网或原作者自行编辑。投稿到Educoder平台的文章默认作者授权其全部图文内容在Educoder平台、在其微信公众号及微博帐号进行发布Educoder平台对这一部分内容不进行预先审查。\n如您发现平台上文章或图片涉嫌侵犯您的权利请您将所涉及的文章 URL 和侵权理由以邮件形式发送到邮箱zhongjin@educoder.net我们将在核实情况后依照《中华人民共和国侵权责任法》及其司法解释对内容进行屏蔽、删除和通知原作者。\n\n## 服务条款的修改\n本网站保留在必要时对本协议修改的权利一旦发生变动这些条款可由网站项目组及时更新且毋须另行通知修改后的条款一旦在网页上公布即有效代替原来的服务条款。您可随时查阅最新版服务条款。\n\n**本协议最终解释权归本网站所有**。'
,
data: {
article: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
const _ts = this;
let data = global.towxml.toJson(this.agreement, 'markdown');
_ts.setData({
article: data
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

@ -1,4 +0,0 @@
<import src="/account/towxml/entry.wxml"/>
<view>
<template is="entry" data="{{...article}}"/>
</view>

@ -1,15 +0,0 @@
/* pages/about/about.wxss */
/**基础风格样式**/
@import '/account/towxml/style/main.wxss';
/**如果页面有动态主题切换,则需要将使用到的样式全部引入**/
/**主题配色(浅色样式)**/
@import '/account/towxml/style/theme/light.wxss';
/**主题配色(深色样式)**/
@import '/account/towxml/style/theme/dark.wxss';
.container{
padding-bottom: 40rpx;
}

@ -11,7 +11,7 @@ App({
versionCode: config.versionCode, versionCode: config.versionCode,
debug: config.debug debug: config.debug
}, },
client: client, client,
api(name, config){return client.api(name,config)}, api(name, config){return client.api(name,config)},
callApi(options){return client.callApi(options)}, callApi(options){return client.callApi(options)},
user(){ return client.user}, user(){ return client.user},
@ -25,6 +25,29 @@ App({
icon:"none" icon:"none"
}) })
}, },
showMsg(res){
wx.showToast({
title: res.message,
})
},
getPageUrl(url){
return url.replace(/{(.*)}/, function (match, name) {
for (var u of __wxConfig.pages) {
if (u.endsWith("/"+name))
return "/" + u;
}
return match;
});
},
reLaunch({url, success, fail, complete}){
wx.reLaunch({url: this.getPageUrl(url),success,fail,complete})
},
redirectTo({url, success, fail, complete}){
wx.redirectTo({url: this.getPageUrl(url),success,fail,complete})
},
navigateTo({url, success, fail, complete}){
wx.navigateTo({url: this.getPageUrl(url),success,fail,complete})
},
shareApp({imageUrl,path,title}){ shareApp({imageUrl,path,title}){
return { return {
title: title||"EduCoder教学", title: title||"EduCoder教学",

@ -2,58 +2,74 @@
"pages": [ "pages": [
"pages/my_courses/my_courses", "pages/my_courses/my_courses",
"pages/findmore/findmore", "pages/findmore/findmore",
"pages/exercise_setting/exercise_setting",
"pages/course_setting/course_setting",
"pages/exercises/exercises",
"pages/courses/courses", "pages/courses/courses",
"pages/exercise/exercise", "pages/my/my"
"pages/setting/setting",
"pages/course/course",
"pages/files/files",
"pages/question_setting/question_setting",
"pages/exercise_grade/exercise_grade",
"pages/course_invite/course_invite",
"pages/exercise_result/exercise_result",
"pages/code_edit/code_edit"
], ],
"subpackages": [ "subpackages": [
{ {
"name": "account",
"root": "account", "root": "account",
"pages": [ "pages": [
"pages/login/login", "pages/login/login",
"pages/reset_password/reset_password", "pages/reset_password/reset_password",
"pages/register/register", "pages/register/register",
"pages/about/about", "pages/about/about"
"pages/agreement/agreement"
] ]
}, },
{ {
"name":"avatar", "root": "avatar",
"root":"avatar", "pages": [
"pages":[
"pages/image_crop/image_crop" "pages/image_crop/image_crop"
] ]
},
{
"root": "course",
"pages": [
"pages/course/course",
"pages/course_invite/course_invite",
"pages/course_setting/course_setting"
]
},
{
"root":"exercise",
"pages":[
"pages/exercise/exercise",
"pages/exercise_grade/exercise_grade",
"pages/exercise_setting/exercise_setting",
"pages/question_setting/question_setting"
]
} }
], ],
"preloadRule": { "preloadRule": {
"pages/setting/setting": { "pages/my/my": {
"network": "all", "network": "all",
"packages": [ "packages": [
"avatar", "avatar",
"account" "account"
] ]
},
"pages/my_courses/my_courses": {
"network": "all",
"packages": [
"course","account"
]
},
"course/pages/course/course":{
"network":"all",
"packages":[
"exercise","account"
]
} }
}, },
"window": { "window": {
"backgroundTextStyle": "dark", "backgroundTextStyle": "dark",
"navigationBarTitleText": "EduCoder", "navigationBarBackgroundColor": "#fbfbfb",
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"backgroundColor": "#f2f2f2", "navigationBarTitleText": "EduCoder",
"navigationBarBackgroundColor": "#fbfbfb" "backgroundColor": "#f5f5f5"
}, },
"tabBar": { "tabBar": {
"selectedColor": "#00C7B7", "selectedColor": "#00b0f0",
"color": "#8a8a8a",
"list": [ "list": [
{ {
"pagePath": "pages/my_courses/my_courses", "pagePath": "pages/my_courses/my_courses",
@ -63,7 +79,7 @@
}, },
{ {
"pagePath": "pages/courses/courses", "pagePath": "pages/courses/courses",
"text": "课列表", "text": "课列表",
"iconPath": "images/tab_contact_default.png", "iconPath": "images/tab_contact_default.png",
"selectedIconPath": "images/tab_contact_pressed.png" "selectedIconPath": "images/tab_contact_pressed.png"
}, },
@ -74,15 +90,12 @@
"selectedIconPath": "images/tab_findmore_pressed.png" "selectedIconPath": "images/tab_findmore_pressed.png"
}, },
{ {
"pagePath": "pages/setting/setting", "pagePath": "pages/my/my",
"iconPath": "images/tab_settings_default.png", "iconPath": "images/tab_my_default.png",
"selectedIconPath": "images/tab_settings_pressed.png", "selectedIconPath": "images/tab_my_pressed.png",
"text": "设置" "text": "我的"
} }
] ]
}, },
"sitemapLocation": "sitemap.json", "sitemapLocation": "sitemap.json"
"navigateToMiniProgramAppIdList": [
"wx8c7028f9dcd29c99"
]
} }

@ -1,18 +1,16 @@
page { page {
height: 100%; height: 100%;
background-color: #f2f2f2; background-color: #f0f0f0;
} }
.flex-wrap{ .flex-wrap{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
.form-wrap { .form-wrap {
border-top: 1px solid #bbb;
margin: 12px 0; margin: 12px 0;
} }
.tappable{ .tappable{
color: #1aad19; color: #0080f0;
padding: 0 12px; padding: 0 12px;
} }
@ -30,9 +28,21 @@ page {
color: #888; color: #888;
font-size: 12px; font-size: 12px;
} }
.error{ .error{color:red;}
color:red; .warning{color: orange;}
} .color-main{color:#00b0f0}
.warning{ .color-dark-main{color:#0080f0}
color: orange; button.button-main{background:#00b0f0}
.border-main{border-color:#00b0f0}
.flex-col,.flex-row{display: flex}
.flex-col{flex-direction: column}
.single-line{
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.round{
border-radius: 50%;
overflow: hidden;
} }

@ -6,7 +6,7 @@
</view> </view>
<!-- modal --> <!-- modal -->
<view class='modal' catchtap wx:if="{{SHOW_MODAL}}"> <view class='modal' catchtap hidden="{{!SHOW_MODAL}}">
<view style='flex-direction: row;align-items:center;'> <view style='flex-direction: row;align-items:center;'>
<text>1. 点击右上角按钮</text> <text>1. 点击右上角按钮</text>
<image src='cloud://educoder.6564-educoder-1300855313/images/add-tip1.png' style='width:100px;height:40px;'></image> <image src='cloud://educoder.6564-educoder-1300855313/images/add-tip1.png' style='width:100px;height:40px;'></image>

@ -1,7 +1,6 @@
.box { .box {
position: fixed; position: fixed;
top: 0; top: 0;
/* left: 0; */
right: 0; right: 0;
z-index: 999; z-index: 999;
display: flex; display: flex;
@ -20,7 +19,7 @@
} }
.body { .body {
background-color: #00b0f0; background-color: #00b0f0;
box-shadow: 0 10rpx 20rpx -10rpx #00b0f0; box-shadow: 0 5rpx 10rpx -5rpx #00b0f0;
border-radius: 12rpx; border-radius: 12rpx;
display: flex; display: flex;
align-items: center; align-items: center;

@ -0,0 +1,16 @@
Component({
properties: {
course_id:Number,
teacher:Object,
name:String,
school:String
},
data: {
eduImgDir:global.config.eduImgDir,
imgDir:global.config.imgDir
},
methods: {
}
})

@ -0,0 +1,10 @@
<navigator class="bg{{course_id%7}} course" url="/course/pages/course/course?course_id={{course_id}}">
<view class="header"><image class="action" mode="aspectFit" catchtap="showAction" src="{{imgDir}}more-dots-white.png"/></view>
<view class="body">
<image class="avatar" src="{{eduImgDir}}{{teacher.avatar_url}}"/>
<view class="course-info">
<view class="course-name">{{name}}</view>
<view><text class="school">{{school}}</text> <text>{{teacher.real_name}}</text> </view>
</view>
</view>
</navigator>

@ -0,0 +1,62 @@
.bg0{
background-image: linear-gradient(to bottom right,#dd6098,#d47782);
}
.bg1{
background-image: linear-gradient(to bottom right,#56A9EF,#3B99F1);
}
.bg2{
background-image: linear-gradient(to bottom right,#7585E5,#6080e0);
}
.bg3{
background-image: linear-gradient(to bottom right,#Ff806c, #F38462);
}
.bg4{
background-image: linear-gradient(to bottom right,#c0a077,#c79769);
}
.bg5{
background-image: linear-gradient(to bottom right,#469493,#30b490);
}
.bg6{
background-image: linear-gradient(to bottom right,#b5764D,#c26b50);
}
.header{
text-align: end;
}
.action{
width: 20px;
height: 22px;
opacity: 0;
}
.course{
color: white;
font-size:13px;
border-radius: 5px;
padding: 0px 8px 18px 8px;
}
.body{
display: flex;
}
.avatar{
width: 52px;
height: 52px;
border-radius: 50%;
overflow: hidden;
flex: none;
margin: 0 16px 0 8px;
}
.course-info{
flex: auto;
width: 10px;
}
.course-name{
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
font-size: 17px;
font-weight: bold;
margin-bottom: 4px;
}
.school{
padding-right: 10px;
}

@ -1,38 +0,0 @@
// components/course/course.js
Component({
/**
* 组件的属性列表
*/
properties: {
name:{
type: String
},
teacher:{
type:Object
},
visits:{
type: Number
},
members_count:{
type: Number
},
homework_commons_count:{
type:Number
},
can_visited:{
type: Boolean
},
is_public:{
type: Boolean
}
},
data: {
},
methods: {
}
})

@ -1,5 +0,0 @@
<view class="square">
<view>
</view>
</view>

@ -1 +0,0 @@
/* components/course/course.wxss */

@ -1,31 +0,0 @@
// components/icon/myicon.js
Component({
/**
* 组件的属性列表
*/
properties: {
addGlobalClass: true
},
externalClasses: ['custom-class'],
properties: {
info: null,
type: String,
size: String,
color: String
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

@ -1,5 +0,0 @@
<view
class="custom-class iconfont icon-{{ type }}"
style="{{ color ? 'color: ' + color + ';' : '' }}{{ size ? 'font-size: ' + size + 'px;' : '' }}">
<view wx:if="{{ info !== null }}" class="icon__info">{{ info }}</view>
</view>

File diff suppressed because one or more lines are too long

@ -0,0 +1,12 @@
const app = getApp();
Component({
properties: {
status:Number
},
data: {
},
methods: {
}
})

@ -0,0 +1,5 @@
<view class="body" bindtap="onTapBody">
<image class="img" mode="aspectFit" src="{{imgUrl}}"/>
<view class="msg">{{msg}}</view>
<button class="btn" catchtap="onTapButton">{{btnText}}</button>
</view>

@ -0,0 +1,23 @@
.body{
z-index: 1000;
top: 0;
right: 0;
position: fixed;
left: 0;
display: flex;
flex-direction: column;
padding-top: 24px;
}
.img{
width: 200px;
height: 200px;
}
.msg{
}
.btn{
}

@ -1,8 +1,6 @@
const app = getApp(); const app = getApp();
Component({ Component({
/**
* 组件的属性列表
*/
properties: { properties: {
hidden:{ hidden:{
type:Boolean, type:Boolean,
@ -10,18 +8,12 @@ Component({
} }
}, },
/**
* 组件的初始数据
*/
data: { data: {
invite_code:"", invite_code:"",
identities:[], identities:[],
hidden:false hidden:false
}, },
/**
* 组件的方法列表
*/
methods: { methods: {
cancel: function (event) { cancel: function (event) {
this.setData({ hidden: true }); this.setData({ hidden: true });
@ -38,42 +30,18 @@ Component({
for (var identity of identities) { for (var identity of identities) {
data[identity] = 1; data[identity] = 1;
} }
console.log(data);
console.log({ ...data });
app.api("courses.apply_to_join_course")({ ...data }) app.api("courses.apply_to_join_course")({ ...data })
.then(res => { .then(res => {
if (res.status == 401) {
wx.showToast({
title: "请先登陆",
icon: "none"
});
return;
}
console.log(res); console.log(res);
wx.showToast({ app.showMsg(res);
title: res.message if (res.course_id){
})
if (res.data.course_id){
wx.navigateTo({ wx.navigateTo({
url: `/pages/course/course?course_id=${res.data.course_id}` url: `/course/pages/course/course?course_id=${res.course_id}`
}); });
} }
this.cancel(); this.cancel();
}) })
.catch(error => { .catch(app.showError)
console.log("hi");
if(error.code==401){
wx.showToast({
title: "请先登陆",
icon: "none"
});
}else
wx.showToast({
title: error.message,
icon: "none"
});
//console.warn(error);
})
} }
} }

@ -1,31 +0,0 @@
Component({
/**
* 组件的属性列表
*/
properties: {
addGlobalClass: true
},
externalClasses: ['custom-class'],
properties: {
info: null,
type: String,
size: String,
color: String
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

@ -1,6 +0,0 @@
<!--components/icon/myicon.wxml-->
<view
class="custom-class iconfont myicon-{{ type }}"
style="{{ color ? 'color: ' + color + ';' : '' }}{{ size ? 'font-size: ' + size + 'px;' : '' }}">
<view wx:if="{{ info !== null }}" class="myicon__info">{{ info }}</view>
</view>

@ -1,60 +0,0 @@
@font-face {font-family: "iconfont";
src: url('iconfont.eot?t=1572072148156'); /* IE9 */
src: url('iconfont.eot?t=1572072148156#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,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') format('woff2'),
url('iconfont.woff?t=1572072148156') format('woff'),
url('iconfont.ttf?t=1572072148156') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('iconfont.svg?t=1572072148156#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.myicon-absent_student:before {
content: "\e635";
}
.myicon-present_student:before {
content: "\e60d";
}
.myicon-answer:before {
content: "\e647";
}
.myicon-question:before {
content: "\e648";
}
.myicon-internet_class:before {
content: "\e67f";
}
.myicon-close:before {
content: "\e637";
}
.myicon-add:before {
content: "\e600";
}
.myicon__info {
color: #fff;
left: 100%;
top: -.5em;
font-size: 0.5em;
padding: 0 0.3em;
text-align: center;
min-width: 1.2em;
line-height: 1.2;
position: absolute;
border-radius: 0.6em;
box-sizing: border-box;
background-color: #f44;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
font-family: PingFang SC, Helvetica Neue, Arial, sans-serif;
}

@ -0,0 +1,84 @@
Component({
properties: {
list:{
type:Array,
observer:function(){
//console.log("observer list",this.data);
if(this.data._itemWidth&&this.data._itemWidth>0)
this.attached();
}
},
mg:Number,
bg:{
type:String,
value:"white"
},
default:{
type:Object,
value:{}
},
type:{
type:String,
value:"nav"
},
current:{
type:Number,
observer: function(current){
this.trigger();
this.scroll();
}
},
width:{
type:Number,
value:750
},
itemWidth:{
type:Number,
value:-1
},
cancellable:{
type:Number,
value:0
},
autoscroll:{
type:Number,
value:1
}
},
data: {
scrollLeft: 0
},
attached(){
if(this.data.itemWidth==-1)
var _itemWidth = Math.max(this.data.width/this.data.list.length,150);
else
var _itemWidth = this.data.itemWidth;
this.setData({ _itemWidth });
this.scroll();
},
methods: {
scroll(){
if(this.data.current>=0&&this.data.autoscroll&&this.data.itemWidth>0){
let scrollLeft = (this.data.current+0.5)*this.data.itemWidth+0.5*this.data.width;
this.setData({scrollLeft})
}
},
trigger(){
let {current} = this.data;
if (current >= 0)
var value = this.data.list[current];
else
var value = this.data.default;
this.triggerEvent("change", { current, value});
},
switchNav({currentTarget:{dataset:{current}}}){
if(current==this.data.current) {
if(this.data.cancellable)
current=-1;
else return
}
this.setData({current});
}
}
})

@ -0,0 +1,5 @@
<scroll-view wx:if="{{list.length>1}}" scroll-x="1" class="c-container" scroll-left="{{scrollLeft}}rpx" scroll-with-animation="1" style="width:{{width}}rpx;background:{{bg}}">
<view wx:for="{{list}}" wx:key="index" class="common c-{{type}} {{current == index ?'active':''}}" data-current="{{index}}" bindtap="switchNav" style="margin:0 {{mg}}rpx;{{_itemWidth>0?'width:'+_itemWidth+'rpx':''}} ">
<text class="common c-{{type}} {{current == index ?'active':''}}">{{item.text}}</text>
</view>
</scroll-view>

@ -0,0 +1,62 @@
.c-container {
box-sizing: border-box;
line-height: 34px;
height: 34px;
font-size: 13px;
white-space: nowrap;
}
view.common{
color: dimgray;
text-align: center;
display: inline-block;
height: 34px;
line-height: 34px;
}
view.c-nav {
box-sizing: border-box;
transition: all 0.26s ease;
}
view.c-nav.active{
color: #0080f0;
font-size: 15px;
border-bottom: 2px solid #0080f0;
}
view.c-plain.active{
color: #0080f0;
font-size: 15px;
}
view.c-cap{
border-radius: 36px;
background: #dbdbdb;
padding: 0 14px
}
view.c-cap.active{
background: #00a0f0;
color: white;
}
view.c-line{
position: relative;
}
text.c-line{
display: flex;
justify-content: center;
transition: all 0.26s ease;
}
text.c-line.active{
font-size: 15px;
color: #0080f0;
}
text.c-line::after{
transition: all 0.26s ease;
width: 0px;
height: 5px;
position: absolute;
content: "";
bottom: 0;
border-radius: 10px;
}
text.c-line.active::after{
width: 22px;
background: #0080f0;
}

@ -0,0 +1,11 @@
Component({
properties: {
user_id:{
type:Number
},
bg:{
type:String,
value:"#0080f0"
}
}
})

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

@ -0,0 +1,3 @@
<navigator wx:if="{{user_id==2}}" class="nav" style="background:{{bg}}" url="/account/pages/login/login?type=login">
点击登陆,获取更多内容
</navigator>

@ -0,0 +1,9 @@
.nav{
color: white;
display: flex;
justify-content: center;
align-items: center;
height: 34px;
flex: none;
font-size: 15px;
}

@ -1,24 +1,13 @@
export const contact= { const cloudDir = "cloud://educoder.6564-educoder-1300855313/";
wechat: 'wxid_jja9klxyquox22', const eduUrl = "https://www.educoder.net";
email: '1460454420@qq.com',
qq: '1460454420',
phone: ""
};
export const leancloud={ module.exports = global.config = {
//@todo
appid: "",
appkey: ""
}
const config = global.config = {
versionCode: 2020022002, versionCode: 2020022002,
debug: true, version:"0.9.1",
contact: { apiRoot:eduUrl+"/api/",
wechat: 'wxid_jja9klxyquox22', cloudDir,
email: '1460454420@qq.com', eduUrl,
qq: '1460454420', imgDir:cloudDir+"images/",
phone: "" eduImgDir:eduUrl+"/images/",
}
} }
export default config;

@ -0,0 +1,72 @@
const app = getApp();
Component({
properties: {
course_id: {
type: Number
},
id: {
type: Number
},
refresh:{
type:Boolean,
observer:function(v){
if(v){
this.onLoad();
this.setData({ refresh: false });
}
}
}
},
data: {
imgDir: global.config.imgDir,
files:[],
loading:true
},
attached(){
console.log("attachment",this.data);
this.onLoad();
},
methods: {
pull_files: function () {
wx.showLoading({
title: '加载中',
})
app.callApi({ name: "files", data: { course_id: this.data.course_id }, complete: () => { wx.hideLoading(); this.setData({ loading: false }) } })
.then(res => {
console.log("pull_files");
console.log(res);
this.setData({ files: res.data.files });
})
.catch(console.error);
},
previewFile: function ({ currentTarget: { dataset:{url=""} } }) {
let ext = url.split(".").slice(-1)[0].toLowerCase();
if(["bmp","jpg","png","gif"].indexOf(ext)!=-1){
wx.previewImage({
urls: [url]
});
return;
}
wx.showLoading({
title: '下载中',
})
wx.downloadFile({
url: global.config.eduUrl + url,
success: (res) => {
wx.openDocument({
filePath: res.tempFilePath,
fail: app.showError
});
},
fail: app.showError,
complete: wx.hideLoading
})
},
onLoad: function (options) {
this.pull_files();
},
}
})

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

@ -0,0 +1,17 @@
<view class="container">
<text>课堂资源</text>
<view class="no-file-view">
<image hidden="{{files.length!=0 || loading}}" src="{{imgDir}}/blank2.png" class="no-file"></image>
</view>
<view class="file-list form-wrap">
<block wx:for="{{files}}" wx:for-item="file" wx:key="objectId">
<view class="file-item flex-wrap" bindtap="previewFile" data-url="{{file.url}}">
<text>{{file.title}}</text>
<text class="hint file-uploader">上传者:{{file.author.name}}</text>
</view>
</block>
</view>
</view>
<view wx:if="{{false}}" class="upload-file foot">
<button type="primary" size="mini" bindtap="upload">上传文件资源</button>
</view>

@ -0,0 +1,139 @@
const app = getApp();
const navData= [
{
text: "全部",
exercise_status: "all",
course_identities: [2, 5, 6]
},
{
text: '提交中',
exercise_status: 2,
course_identities: [2, 5, 6]
},
{
text: '已截止',
exercise_status: 3,
course_identities: [2, 5, 6]
},
{
text: "未发布",
exercise_status: 1,
course_identities: [2]
}
]
Component({
options: {
pureDataPattern: /^_/
},
properties: {
course_id:{
type:Number
},
id:{
type:Number
},
refresh:{
type:Boolean,
observer:function(v){
if(v) {
this.onPullDownRefresh();
this.setData({ refresh: false });
}
}
}
},
data: {
imgDir: global.config.imgDir,
loading: true,
require_login: false,
page_status: 0,
exercises: [],
current_status: "all",
navList:navData,
currentTab: 0,
navScrollLeft: 0,
user:{}
},
attached(){
this.onLoad();
},
methods: {
switchNav({detail:{current,value}}){
this.setData({ current_status: value.exercise_status});
},
exercise_result: function ({ currentTarget: { dataset } }) {
app.navigateTo({
url: `{exercise_result}?exercise_id=${dataset.exercise_id}`,
})
},
see_grade: function ({ currentTarget: { dataset } }) {
app.navigateTo({
url: `{exercise_grade}?exercise_id=${dataset.exercise_id}`,
})
},
edit_exercise: function ({ currentTarget: { dataset } }) {
app.navigateTo({
url: `{exercise_setting}?course_id=${this.data.course_id}&exercise_id=${dataset.exercise_id}`,
})
},
create_exercise: function () {
app.navigateTo({
url: `{exercise_setting}?course_id=${this.data.course_id}`,
})
},
pull_exercise: function () {
app.api("courses.exercises")({ course_id: this.data.course_id })
.then(res => {
console.log("pull_exercise");
console.log(res);
if (res.exercises) {
this.setData({ exercises: res.exercises, loading: false });
}
console.log(this.data)
})
.catch(e => {
console.error(e);
app.showError(e)
});
},
see_exercise: function ({ currentTarget: { dataset } }) {
app.navigateTo({
url: '{exercise}?exercise_id=' + dataset.exercise_id,
});
},
enter_exercise: function ({ currentTarget: { dataset } }) {
wx.showModal({
title: '确认',
content: '开始作答吗?',
success: res => {
if (res.confirm) {
app.navigateTo({
url: '{exercise}?exercise_id=' + dataset.exercise_id,
});
}
}
});
},
onLoad: function (options) {
app.api("courses.top_banner")({ course_id: this.data.course_id })
.then(res => {
this.setData({ course: res })
console.log(res)
})
this.pull_exercise();
this.setData({ require_login: false });
},
onShow: function () {
},
onPullDownRefresh: function () {
this.pull_exercise();
},
onShareAppMessage: function () {
}
}
})

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"nav-bar":"/components/nav-bar/nav-bar"
}
}

@ -0,0 +1,27 @@
<view class="container">
<nav-bar list="{{navList}}" bindchange="switchNav"></nav-bar>
<scroll-view class="tab-box" scroll-y="1" refresher-enabled="{{true}}" bindrefresherrefresh="onPullDownRefresh">
<view class="no-content" wx:if="{{exercises.length==0&&!loading}}" class="no-content">
<image class="no-content" src="{{imgDir}}blank1.png" mode="aspectFit"></image>
</view>
<block wx:for="{{exercises}}" wx:for-item="exercise" wx:key="id">
<view class="exercise" wx:if="{{exercise.exercise_status==current_status||current_status=='all'}}" class="exercise" bindtap="see_grade" bindlongpress="enter_exercise" data-exercise_id="{{exercise.id}}">
<view class="exercise-name">
<text class="exercise-name" data-exercise_id="{{exercise.id}}" catchtap="exercise_result">{{exercise.exercise_name}}</text>
</view>
<view class="exercise-info flex-wrap">
<text class="hint" wx:if="{{exercise.exercise_status==2&&(exercise.current_status==0 || exercise.current_status==2)}}">还有{{exercise.exercise_left_time||' '}}截止</text>
<block wx:for="{{exercise.exercise_tips}}" wx:for-item="exercise_tip">
<text class="exercise-tip">{{exercise_tip}}</text>
</block>
<text wx:if="{{exercise.exercise_status!=3&&(exercise.current_status==0 || exercise.current_status==2)}}" class="start-answer tappable" catchtap="enter_exercise" data-exercise_id="{{exercise.id}}">进入答题</text>
<text wx:if="{{(exercise.current_status==1 || exercise.exercise_status==3)&&exercise.current_status!=3}}" class="start-answer tappable" catchtap="see_exercise" data-exercise_id="{{exercise.id}}">查看答题</text>
<text wx:if="{{exercise.current_status==3&&(exercise.exercise_status==1||exercise.exercise_status==2)}}" class="edit-exercise tappable" data-exercise_id="{{exercise.id}}" catchtap="edit_exercise">编辑</text>
</view>
</view>
</block>
<button type="primary" wx:if="{{course.is_admin}}" bindtap="create_exercise">发布试卷</button>
</scroll-view>
</view>

@ -1,40 +1,18 @@
.container{ .container{
height: 100%; height: 100%;
} display: flex;
.nav { flex-direction: column;
height: 85rpx;
width: 100%;
box-sizing: border-box;
overflow: hidden;
line-height: 70rpx;
font-size: 16px;
white-space: nowrap;
position: fixed;
top: 0;
left: 0;
z-index: 99;
}
.nav-item {
width: 25%;
display: inline-block;
text-align: center;
}
.active{
color: green;
border-bottom: 3rpx solid green;
} }
.tab-box{ .tab-box{
padding-top: 85rpx;
height: 100%;
box-sizing: border-box; box-sizing: border-box;
flex: 1 1 10px;
height: 10px;
padding :0 12px;
} }
.tab-content{
overflow-y: scroll;
width: 100%;
}
.tappable{ .tappable{
color: #1aad19; color: #4cacff;
padding: 0 12px; padding: 0 12px;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1,118 @@
const app = getApp();
Page({
data: {
refresh:0,
nav_type:"navigateback",
module:null,
course: {},
is_teacher: true,
course_modules: [],
hidden_modules: [] ,
statusBarHeight:20,
windowWidth:375,
eduImgDir: global.config.eduImgDir
},
switchRole({target:{dataset:{role}}}){
if(!role) return;
app.api("courses.switch_to_"+role)({course_id: this.course_id})
.then(res=>{
this.onPullDownRefresh();
app.showMsg(res);
}).catch(app.showError)
},
enterShare(){
let {course_id, course} = this.data;
let url = `{course_invite}?course_id=${course_id}&invite_code=${course.invite_code}`;
app.navigateTo({url});
},
onTapCode() {
let { name, invite_code, code_halt} = this.data.course;
if(!code_halt)
wx.setClipboardData({data: `输入邀请码${invite_code}加入“${name}”吧`})
else
wx.showActionSheet({
itemList: ["启用邀请码"],
success:res=>{
app.api("courses.set_invite_code_halt")({course_id: this.course_id})
.then(res=>{
app.showMsg(res);
this.refresh({refresh:0});
})
}
})
},
switchModule({currentTarget:{dataset:{type}}}){
let list = this.data.course_modules.filter(item=>item.type==type);
this.setData({module: list[0]});
},
navigateBack(){
if(this.data.nav_type=="navigateback")
wx.navigateBack({
delta:1
});
else
app.reLaunch({
url: '{my_courses}',
});
},
async pullCourse(){
let {course_id} = this;
let course = await app.api("courses.top_banner")({course_id});
this.setData({course});
return {course};
},
async pullModules(){
let { course_id } = this;
let data = await app.api("courses.left_banner")({ course_id });
this.setData(data);
return data;
},
refresh({ refresh = 1 } = {}) {
this.setData({ refresh });
app.syncUser().then(res => {
this.pullCourse();
this.pullModules()
.then(res => {
console.log(res);
if (this.data.module)
var module = this.data.module;
else
var module = res.course_modules.filter(i => i.type == "exercise")[0];
this.setData({ module });
});
})
},
onLoad: function (options) {
let course_id = this.course_id = options.course_id;
this.setData({course_id});
wx.getSystemInfo({
success:res=>{
let { statusBarHeight, windowWidth} = res;
this.setData({ statusBarHeight, windowWidth})
},
});
let pages = getCurrentPages();
if(pages.length<=1)
this.setData({nav_type:"relaunch"});
else
this.setData({nav_type:"navigateback"})
this.refresh({refresh:0});
},
onShow: function () {
},
onReady:function(){
wx.showToast({
title: '向右滑有更多课堂模块哦',
icon:"none"
})
},
onPullDownRefresh(){
this.refresh();
},
onShareAppMessage: function () {
}
})

@ -0,0 +1,12 @@
{
"usingComponents": {
"nav-bar":"/components/nav-bar/nav-bar",
"exercise":"/course/components/exercise/exercise",
"attachment":"/course/components/attachment/attachment"
},
"navigationStyle": "custom",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": true,
"backgroundTextStyle": "light",
"backgroundColor": "#000541"
}

@ -0,0 +1,71 @@
<wxs module="handler" src="./course.wxs"></wxs>
<view class="page">
<view class="page-bottom">
<view class="page-content">
<view wx:for="{{course_modules}}" bindtap="switchModule" capture-bind:tap="{{handler.hideSideBar}}" data-type="{{item.type}}" wx:key="id" class="wc">
<text>{{item.name}}</text>
</view>
</view>
</view>
<view class="page-top flex-col" data-width="{{windowWidth}}" bindtouchstart="{{handler.touchstart}}" bindtouchmove="{{handler.touchmove}}" bindtouchend="{{handler.touchend}}" bindtap="{{handler.hideSideBar}}">
<view class="header" bindtouchmove="{{handler.touchmHeader}}" bindtouchstart="{{handler.touchsHeader}}">
<view class="status-bar" style="height:{{statusBarHeight}}px"></view>
<view class="navigation">
<view class="nav-buttons">
<image mode="aspectFit" src="../../images/{{nav_type}}.png" catchtap="navigateBack" class="nav-button"></image>
<image class="more-img" mode="aspectFit" src="../../images/more.png" data-width="{{windowWidth}}" catchtap="{{handler.changeSideBar}}"></image>
</view>
<text class="course-name">{{course.name}}|{{module.name}}</text>
</view>
<view class="course-display flex-col">
<view class="course-info-body">
<view class="course-info flex-col">
<view class="teacher-display">
<image wx:if="{{course.teacher_img}}" class="teacher-img" mode="aspectFill" src="{{eduImgDir}}{{course.teacher_img}}"></image>
<view class="teacher-name">{{course.teacher_name}}</view>
<view class="school-name">{{course.teacher_school}}</view>
</view>
<view class="course-detail">
<text>教师</text><text>{{course.teacher_count}}</text>
<text class="sep">|</text>
<text>学生</text><text>{{course.student_count}}</text>
<block wx:if="{{course.credit!=null}}">
<text class="sep">|</text>
<text>学分</text><text>{{course.credit}}</text>
</block>
</view>
</view>
<view class="course-buttons color-main" bindtap="switchRole">
<button wx:if="{{course.switch_to_student}}" data-role="student">切换为学生</button>
<button wx:if="{{course.switch_to_assistant}}" data-role="assistant">切换为助教</button>
<button wx:if="{{course.switch_to_teacher}}" data-role="teacher">切换为老师</button>
</view>
</view>
<view wx:if="{{course.is_admin}}" class="course-footer">
<block wx:if="{{!course.code_halt}}">
<view class="span" bindtap="enterShare">
<text>邀请成员</text>
</view>
<text class="sep">|</text>
</block>
<view class="span">
<text>邀请码:</text>
<text class="code" bindtap="onTapCode">{{course.code_halt?'已停用':course.invite_code}}</text>
</view>
</view>
</view>
</view>
<view bindtouchstart="{{handler.touchsHeader}}" bindtouchmove="{{handler.touchmBody}}" bindtouchend="{{handler.toucheBody}}" class="module-container">
<attachment wx:if="{{module.type=='attachment'}}" id="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"></attachment>
<exercise wx:elif="{{module.type=='exercise'}}" id="{{module.id}}" course_id="{{module.main_id}}" refresh="{{refresh}}"></exercise>
<view wx:else style="height: 1000px;">sorry ╥﹏╥\n暂不支持[{{module.name}}]模块</view>
</view>
</view>
</view>

@ -0,0 +1,142 @@
var newmark = startmark = 0
var status = 1
var percent = 0.36;
function touchstart(e, ins) {
var pageX = (e.touches[0] || e.changedTouches[0]).pageX
startmark = newmark = pageX
}
function touchmove(e, ins) {
var pageX = (e.touches[0] || e.changedTouches[0]).pageX
newmark = pageX
// var data = ins.getData()
var data = {
windowWidth: e.currentTarget.dataset.width
}
if (startmark < pageX) {
if (data.windowWidth * percent > Math.abs(newmark - startmark)) {
ins.selectComponent('.page-top').setStyle({
transform: 'translateX(' + Math.min(data.windowWidth * percent, ((status == 1 ? data.windowWidth * percent : 0) + newmark - startmark)) + 'px)'
})
}
}
if (startmark > pageX) {
ins.selectComponent('.page-top').setStyle({
transform: 'translateX(' + Math.max(0, ((status == 1 ? data.windowWidth * percent : 0) + newmark - startmark)) + 'px)'
})
}
}
function touchend(e, ins) {
var pageX = (e.touches[0] || e.changedTouches[0]).pageX
newmark = pageX
// var data = ins.getData()
var data = {
windowWidth: e.currentTarget.dataset.width
}
if (startmark < pageX) {
if (data.windowWidth * 0.24 < Math.abs(newmark - startmark)) {
ins.selectComponent('.page-top').setStyle({
transform: 'translateX(' + (data.windowWidth * percent) + 'px)'
})
status = 1 // 展开状态
} else {
ins.selectComponent('.page-top').setStyle({
transform: 'translateX(0px)'
})
status = 0 // 收起状态
}
}
if (startmark > newmark) {
ins.selectComponent('.page-top').setStyle({
transform: 'translateX(0px)'
})
status = 0 // 收起状态
}
}
function changeSideBar(e,ins){
var width=e.currentTarget.dataset.width
status = 1-status;
ins.selectComponent('.page-top').setStyle({
transform: 'translateX('+width*percent*status+'px)'
});
}
function hideSideBar(e, ins){
var width= e.currentTarget.dataset.width
status = 0;
ins.selectComponent('.page-top').setStyle({
transform: 'translateX(0px)'
});
}
var startY = 0;
var show = 1;
function touchsHeader(e, ins){
var pageY = (e.touches[0] || e.changedTouches[0]).pageY
startY = pageY;
}
function touchmHeader(e, ins){
var changeY = (e.touches[0] || e.changedTouches[0]).pageY - startY;
if (changeY > 0){
show = 1;
ins.selectComponent(".course-display").setStyle({
"max-height": "100px",
transform: 'translateY(0px)',
opacity: show,
visibility:"visiable"
})
}
else if (changeY < -13){
show = 0;
ins.selectComponent(".course-display").setStyle({
"max-height": "0px",
transform: 'translateY(-100px)',
opacity: show,
visibility: "hidden"
})
}
}
function touchmBody(e, ins){
var changeY = (e.touches[0] || e.changedTouches[0]).pageY - startY;
//console.log(startY, changeY);
if(show&&changeY<0){
ins.selectComponent(".course-display").setStyle({
"max-height": (100+changeY)+"px",
transform: 'translateY(' + changeY + 'px)',
opacity:1- Math.abs(changeY)/100
})
}
/*else if(!show&&changeY>45){
ins.selectComponent(".course-display").setStyle({
"max-height": changeY-45 + "px",
transform: 'translateY(' + (changeY-145) + 'px)',
opacity: Math.abs(changeY-45) / 100
})
}*/
}
function toucheBody(e, ins) {
var changeY = (e.touches[0] || e.changedTouches[0]).pageY - startY;
//if (changeY > 100)
// show = 1;
//else
if (changeY < -80)
show = 0;
ins.selectComponent(".course-display").setStyle({
"max-height": 100*show+"px",
transform: 'translateY(-'+100*(1-show) +'px)',
opacity: show,
visibility: show?"visiable":"hidden"
})
}
module.exports = {
touchstart: touchstart,
touchmove: touchmove,
touchend: touchend,
changeSideBar: changeSideBar,
hideSideBar:hideSideBar,
touchmHeader: touchmHeader,
touchsHeader: touchsHeader,
touchmBody:touchmBody,
toucheBody: toucheBody
}

@ -0,0 +1,153 @@
.page-bottom{
height: 100%;
width: 750rpx;
position: fixed;
background: linear-gradient(0deg, rgb(0, 68, 97),rgb(1,1,78));
z-index: 0;
}
.wc{
color: white;
padding: 30rpx 0 30rpx 40rpx;
}
.page-content{
padding-top: 100rpx;
}
.page-top{
height: 100%;
position: fixed;
width: 750rpx;
background-color: #efefef;
z-index: 0;
transition: All 0.4s ease;
-webkit-transition: All 0.4s ease;
}
.header{
background-image: url(https://www.educoder.net/images/educoder/courtailsbdpicture.jpg);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
color: white;
flex: none;
}
.page{
height: 100%;
}
.navigation{
height: 44px;
display: flex;
align-items: center;
width:100%;
z-index: 999;
}
.nav-buttons{
width: 86px;
display: flex;
justify-content: space-evenly;
flex:none;
padding:0 7px;
}
.nav-button,.more-img{
width: 24px;
height: 24px;
padding: 4px 8px;
}
.course-name{
padding-right: 100px;
text-align: center;
overflow: hidden;
flex: auto;
font-size:14px;
}
.course-display{
transition: All 0.6s ease;
-webkit-transition: All 0.6s ease;
overflow: hidden;
max-height:100px;
}
.course-info-body{
display: flex;
justify-content: space-evenly;
flex: auto;
}
.course-info{
justify-content: center;
}
.teacher-display{
display: flex;
padding: 6px 14px;
align-items: center;
}
.teacher-img{
width:34px;
height:34px;
border-radius: 50%;
overflow: hidden;
}
.teacher-name{
padding: 0 13px;
}
.school-name{
font-size:12px;
}
.course-detail{
text-align: center;
}
.course-detail>text{
font-size: 12px;
margin: 0 3px;
}
text.sep{
color: grey;
margin: 0 5px;
}
.course-buttons{
display: flex;
flex-direction: column;
justify-content: space-evenly;
}
.course-buttons>button{
color: #0080f0;
border: solid 1px #0080f0;
border-radius: 5px;
background: transparent;
font-size: 10px;
padding: 5px;
margin: 2px;
line-height: 10px;
}
.course-footer{
padding: 7px 14px;
text-align: center;
font-size: 13px;
}
.span{
flex: none;
display: inline-block;
}
.code{
font-size: 12px;
color: chocolate;
text-decoration: underline;
}
.module-container{
flex: 1 1 10px;
height: 10px;
overflow-y: scroll;
}

@ -0,0 +1,94 @@
const app = getApp();
Page({
data: {
course:{
name:"**课堂邀请",
teacher_name:"点击最下方按钮",
teacher_school:"登陆后查看"
},
user:{},
status:0,
eduImgDir:global.config.eduImgDir
},
onImgError(e){
console.log("onImgError", e);
let path = this.getPageUrl();
wx.cloud.callFunction({ name: "openapi", data: { action:"getWXACode", path}})
.then(res=>{
this.setData({invite_code_url:""});
this.setData({invite_code_url: res.result})
});
},
login:function(){
app.navigateTo({
url: '{login}',
});
},
onTapCode(){
let data = this.data.course.invite_code || this.data.options.invite_code;
wx.setClipboardData({
data
})
},
preview(){
wx.previewImage({
urls: [this.data.invite_code_url],
})
},
joinCourse: function(event) {
//@todo 助教加入..
let invite_code = this.data.course.invite_code||this.data.options.invite_code;
let data = { invite_code, student: 1};
if (this.data.course.code_halt){
wx.showToast({
title: '>︿<\n邀请码已经停用了',
icon:"none"
});
return;
}
app.api("courses.apply_to_join_course")({ ...data })
.then(res => {
app.showMsg(res);
wx.redirectTo({
url: "../course/course?course_id=" + res.course_id
});
})
.catch(app.showError)
},
getPageUrl(){
let { course_id, _invite_code } = this.data.options;
let {invite_code=_invite_code} = this.data.course;
return app.getPageUrl(`{course_invite}?course_id=${course_id}&invite_code=${invite_code}`);
},
getWxaCodeUrl(){
let url = this.getPageUrl();
return global.config.imgDir+"wxacode/"+ url.replace(/[\/?&]/g, "_")+".jpeg";
},
pull_course(){
app.api("weapps.courses.basic_info")({ course_id:this.options.course_id })
.then(({course}) => {
this.setData({ course, status: 200});
}).catch(e=>{
app.showError(e);
this.setData({status:-1})
});
},
onLoad: function (options) {
this.setData({options});
this.setData({status:1});
this.pull_course();
let invite_code_url = this.getWxaCodeUrl();
this.setData({ invite_code_url});
},
onShow:function(){
app.syncUser()
.then(({user})=>{
this.setData({user});
})
if(this.data.status==-1)
this.pull_course()
},
onShareAppMessage(){
}
})

@ -0,0 +1,8 @@
{
"usingComponents": {
"require-login":"/components/require-login/require-login"
},
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#56A9EF",
"navigationBarTitleText": "课堂邀请"
}

@ -0,0 +1,15 @@
<view class="body">
<view class="flex-col course-display">
<view class="course-name">{{course.name}}</view>
<image class="round avatar" src="{{eduImgDir}}{{course.teacher_img}}"></image>
<view class="teacher-name">{{course.teacher_name}}</view>
<view class="school">{{course.teacher_school}}</view>
</view>
<view class="flex-col invite-display">
<view class="invite-code" bindtap="onTapCode">邀请码:{{course.invite_code||options.invite_code}}</view>
<image class="invite-code" mode="aspectFit" bindtap="preview" binderror="onImgError" show-menu-by-longpress src="{{invite_code_url}}"/>
<button open-type="share" size="mini" plain="1">发送分享</button>
</view>
<button wx:if="{{user.user_id!=2}}" class="join-button" bindtap="joinCourse">加入课堂</button>
<button wx:else class="join-button" bindtap="login">点击登陆</button>
</view>

@ -0,0 +1,61 @@
page{
display: flex;
flex-direction: column;
}
.body{
flex: 1 1 10px;
height: 10px;
background:#56A9EF;
color: white;
padding-top: 12px;
}
.course-name{
font-size: 20px;
font-weight: bold;
padding: 8px 0;
}
.avatar{
width: 58px;
height: 58px;
margin: 6px;
}
.school{
font-size: 13px;
}
.course-display{
flex: none;
align-items: center;
}
.invite-display{
align-items: center;
background: white;
width: 240px;
margin: 8px auto;
border-radius: 6px;
padding: 20px 16px;
}
view.invite-code{
color: #0080f0;
font-size: 16px;
text-decoration: underline;
font-weight: bold;
}
image.invite-code{
width: 200px;
height:200px;
margin: 10px 0;
}
.invite-display>button{
color: #0080f0;
border-color: #0080f0;
border-radius: 32px;
height: 32px;
}
.join-button{
color: #0080f0;
font-weight: bold;
margin: 12px auto;
width: 140px;
border-radius: 36px;
}

@ -1,13 +1,8 @@
// pages/course_setting/course_setting.js import { getNowFormatDate } from "../../../js/utils";
import { getNowFormatDate } from "../../js/utils";
const app = getApp(); const app = getApp();
Page({ Page({
/**
* 页面的初始数据
*/
initial_form_data: { initial_form_data: {
//course_module_types //course_module_types
shixun_homework: true, shixun_homework: true,

@ -1,13 +0,0 @@
export function getResConstruction(res=""){
switch((res||"").constructor){
case Array:
return "["+getResConstruction(res[0]||"")+"]";
case Object:
return "{"+Object.keys(res).map(key=>{
let value = getResConstruction(res[key]);
return key+(value?":"+value:"")
}).join(",")+"}"
default:
return "";
}
}

@ -1,10 +1,6 @@
// pages/exercise/exercise.js
const app = getApp(); const app = getApp();
Page({ Page({
/**
* 页面的初始数据
*/
data: { data: {
exercise_questions: [], exercise_questions: [],
loading: true, loading: true,
@ -70,12 +66,9 @@ Page({
console.log(dataset); console.log(dataset);
app.api("exercise_questions.exercise_answers")({ question_id: dataset.question_id, answer_text: value }) app.api("exercise_questions.exercise_answers")({ question_id: dataset.question_id, answer_text: value })
.then(res => { console.log("answer_main_question"); console.log(res); }) .then(res => { console.log("answer_main_question"); console.log(res); })
.catch(error => { .catch(e => {
console.error(error); console.error(e);
wx.showToast({ app.showError(e);
title: error.toString(),
icon: "none"
})
}); });
}, },
answer_choice_question: function({detail: {value}, currentTarget: {dataset}}){ answer_choice_question: function({detail: {value}, currentTarget: {dataset}}){

@ -1,5 +1,5 @@
// pages/exercise_setting/exercise_setting.js // pages/exercise_setting/exercise_setting.js
import { getNowFormatDate, getNowFormatTime, getNextWeekFormatDate} from "../../js/utils" import { getNowFormatDate, getNowFormatTime, getNextWeekFormatDate} from "../../../js/utils"
const app = getApp(); const app = getApp();
Page({ Page({
@ -63,10 +63,10 @@ Page({
}) })
}); });
}else{ }else{
app.api("courses.exercises")({ ...value, course_id: this.course_id }) app.api("courses.exercises",{method:"POST"})({ ...value, course_id: this.course_id })
.then(res => { .then(res => {
console.log(res); console.log(res);
this.exercise_id = res.data.exercise_id this.exercise_id = res.exercise_id
wx.showToast({ wx.showToast({
title: '创建成功', title: '创建成功',
}) })
@ -89,8 +89,8 @@ Page({
console.log(res); console.log(res);
this.setData( this.setData(
{ {
exercise_questions: res.data.exercise_questions, exercise_questions: res.exercise_questions,
exercise: res.data.exercise exercise: res.exercise
}) })
}) })
} }

@ -0,0 +1,28 @@
const app = getApp();
Page({
data: {
},
create_question: function({detail:{value}}){
console.log(value);
let data = {
question_title:value.question_title,
question_type:0,
question_score:5,
question_choices:[value.question_choices_0, value.question_choices_1, value.question_choices_2, value.question_choices_3],
standard_answers:value.standard_answers
}
let exercise_bank_id = this.exercise_id;
app.api("exercises.exercise_questions")({exercise_bank_id,...data})
.then(res=>{
console.log(res);
wx.navigateBack({
delta: 1
})
}).catch(app.showError)
},
onLoad: function (options) {
this.exercise_id = options.exercise_id;
}
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save