@ -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,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 +0,0 @@
|
||||
towxml/
|
@ -1,3 +1,5 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {
|
||||
"towxml": "/towxml/towxml"
|
||||
}
|
||||
}
|
@ -1,4 +1 @@
|
||||
<import src="/account/towxml/entry.wxml"/>
|
||||
<view>
|
||||
<template is="entry" data="{{...article}}"/>
|
||||
</view>
|
||||
<towxml nodes="{{article}}"></towxml>
|
@ -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,3 +0,0 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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>
|
@ -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,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": {}
|
||||
}
|
@ -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= {
|
||||
wechat: 'wxid_jja9klxyquox22',
|
||||
email: '1460454420@qq.com',
|
||||
qq: '1460454420',
|
||||
phone: ""
|
||||
};
|
||||
const cloudDir = "cloud://educoder.6564-educoder-1300855313/";
|
||||
const eduUrl = "https://www.educoder.net";
|
||||
|
||||
export const leancloud={
|
||||
//@todo
|
||||
appid: "",
|
||||
appkey: ""
|
||||
}
|
||||
const config = global.config = {
|
||||
module.exports = global.config = {
|
||||
versionCode: 2020022002,
|
||||
debug: true,
|
||||
contact: {
|
||||
wechat: 'wxid_jja9klxyquox22',
|
||||
email: '1460454420@qq.com',
|
||||
qq: '1460454420',
|
||||
phone: ""
|
||||
}
|
||||
version:"0.9.1",
|
||||
apiRoot:eduUrl+"/api/",
|
||||
cloudDir,
|
||||
eduUrl,
|
||||
imgDir:cloudDir+"images/",
|
||||
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": {}
|
||||
}
|
@ -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{
|
||||
height: 100%;
|
||||
}
|
||||
.nav {
|
||||
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;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tab-box{
|
||||
padding-top: 85rpx;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
flex: 1 1 10px;
|
||||
height: 10px;
|
||||
padding :0 12px;
|
||||
}
|
||||
.tab-content{
|
||||
overflow-y: scroll;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tappable{
|
||||
color: #1aad19;
|
||||
color: #4cacff;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
After Width: | Height: | Size: 512 B |
After Width: | Height: | Size: 1.3 KiB |
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();
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
initial_form_data: {
|
||||
//course_module_types
|
||||
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 "";
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
})
|
Before Width: | Height: | Size: 416 B After Width: | Height: | Size: 596 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.1 KiB |