A 支持选用实践课程

master
educoder_weapp 5 years ago
parent 9b9053b5d4
commit 03e67f288a

@ -1,3 +1,7 @@
## v0.16.1
* A 发送实训至课堂
* A 探索实训界面支持多选
## v0.16.0
* A 探索界面
* A 我的实践课程模块

@ -10,6 +10,8 @@ Page({
},
onShareAppMessage: function () {
return getApp().shareApp({
title:"关于EduCoder"
})
}
})

@ -8,6 +8,8 @@ Page({
},
onShareAppMessage: function () {
return getApp().shareApp({
title:"EduCoder服务协议"
})
}
})

@ -47,13 +47,5 @@ Page({
.then(res=>{
this.setData({})
})
},
onReady: function () {
},
onShow: function () {
}
})

@ -240,8 +240,5 @@ Page({
this.setData({showError:0});
}, during);
}
},
onUnload: function () {
}
})

@ -40,8 +40,5 @@ Page({
this.setData({keyword, _keyword: keyword});
this.search({keyword})
}
},
onShow: function () {
}
})

@ -33,8 +33,9 @@ App({
});
wx.reportMonitor('1', 1);
}
const db = wx.cloud.database();
if (options.referrerInfo && options.referrerInfo.appId) {
var db = wx.cloud.database();
let { appId, extraData } = options.referrerInfo;
let { scene, path } = options;
db.collection("referrer_info")

@ -6,8 +6,8 @@
"navigationBarTitleText": "EduCoder",
"backgroundColor": "#f5f5f5"
},
"usingComponents":{
"require-login":"/components/require-login/require-login"
"usingComponents": {
"require-login": "/components/require-login/require-login"
},
"pages": [
"pages/main/main",
@ -78,7 +78,8 @@
{
"root": "path",
"pages": [
"pages/path/path"
"pages/path/path",
"pages/path_send/path_send"
]
},
{
@ -97,9 +98,9 @@
}
],
"preloadRule": {
"pages/findmore/findmore":{
"network":"all",
"packages":[
"pages/findmore/findmore": {
"network": "all",
"packages": [
"shixun",
"search",
"path"
@ -169,6 +170,6 @@
"weui": true
},
"sitemapLocation": "sitemap.json",
"themeLocation":"theme.json",
"themeLocation": "theme.json",
"style": "v2"
}

@ -87,7 +87,7 @@ button[plain][disabled]{
}
button[type=secondary]{
color: #00b0f0;
background: #eee;
background: #f1f1f1;
}
button[type=error]{
background: #fa5151;

@ -5,17 +5,13 @@ Page({
},
touchStart(e) {
;
this.mycropper.touchStart(e)
},
touchMove(e) {
;
this.mycropper.touchMove(e)
},
touchEnd(e) {
;
this.mycropper.touchEnd(e)
},
upload_avartar(filePath) {
@ -33,14 +29,11 @@ Page({
},
getCropperImage() {
this.mycropper.getCropperImage((avatar) => {
;
if (avatar) {
wx.showLoading({
title: '上传中',
});
this.upload_avartar(avatar).then(res => {
;
;
wx.navigateBack({
delta: 1
});

@ -6,15 +6,21 @@ Component({
shixun_ids:Array,
subject_id:{
type:Number,
value:-1
value:0
},
open_type:{
type:String,
value:"navigateTo"
},
show: {
type:Boolean,
value:false,
observer:function(v){
if(v){
if(this.data.status!=200)
this.pullCourse({refresh:1})
if(this.data.status!=200||this.user_id!=app.user().user_id){
this.pullCourse({refresh:1});
this.user_id = app.user().user_id;
}
this.setData({auto_nav: !wx.getStorageSync(KEY)})
}
}
@ -30,12 +36,9 @@ Component({
},
methods: {
close(){
this.setData({show:false});
this.onClose();
},
onClose(){
this.setData({checked: false});
this.setData({show:false});
this.course_id = null;
},
changeOption(e){
@ -59,20 +62,27 @@ Component({
})
}
//console.log(shixun_ids, course_id);
let api_name = subject_id>0?'paths.send_to_course':"shixuns.batch_send_to_course"
if(subject_id>0){
var api_name = 'paths.send_to_course';
wx.showLoading({
title: '发送中',
})
}else{
var api_name = "shixuns.batch_send_to_course";
}
app.api(api_name)({subject_id, course_id, shixun_ids})
.then(res=>{
this.triggerEvent("success",{});
wx.hideLoading();
//console.log(res);
app.showMsg(res);
this.close();
this.onClose();
if(this.data.auto_nav)
setTimeout(()=>{
app.navigateTo({
url:`{course}?course_id=${res.course_id}&module_type=shixun_homework`
app[this.data.open_type]({
url:`{course}?course_id=${course_id}&module_type=shixun_homework`
})
},400);
},420);
}).catch(e=>{
app.showError(e);
});

@ -14,9 +14,11 @@
</radio-group>
</scroll-view>
</view>
<view class="operations" slot="footer">
<button class="operation" type="secondary" bindtap="close">取消</button>
<button class="operation" type="main" bindtap="send">发送</button>
<view class="footer" slot="footer">
<view class="operations">
<button class="operation" type="secondary" bindtap="onClose">取消</button>
<button class="operation" type="main" bindtap="send">发送</button>
</view>
<radio class="option" color="#00b0f0" bindtap="changeOption" checked="{{auto_nav}}">发送后跳转到课堂</radio>
</view>
</mp-halfScreenDialog>

@ -18,15 +18,19 @@
font-size: 15px;
padding-top: 10vh;
}
.footer{
margin: -28px -18px -28px -18px;
}
.operations{
text-align: center;
margin: -28px 0 -20px 0;
display: flex;
justify-content: space-evenly;
}
.operation{
width: 120px!important;
margin: 0 8px!important;
display: inline-block!important;
flex-shrink: 1;
}
.option{
transform: scale(0.6);
padding-top: 8px;
}

@ -1,11 +1,11 @@
const cloudDir = "cloud://educoder.6564-educoder-1300855313/";
let { miniProgram:{ envVersion, version}} = wx.getAccountInfoSync();
let { miniProgram:{ envVersion, version}={}} = {}//wx.getAccountInfoSync();
const developUrl = "https://test-newweb.educoder.net";
const trialUrl = "https://pre-newweb.educoder.net";
const releaseUrl = "https://www.educoder.net";
let _version = "0.16.0";
let _version = "0.16.1";
var eduUrl = releaseUrl;
/**
*/

@ -1,7 +1,7 @@
<mp-index-list binddelete="refresh" list="{{students}}" ext="{{ext}}" generic:item="student-item" bindchoose="onChoose">
<view class="header">
<view class="student-count">
<text>学生人数</text>
<text>学生人数:</text>
<text class="count">{{students_count}}</text>
</view>
<view class="switch-wrp">

@ -8,6 +8,7 @@
display: flex;
justify-content: space-between;
align-items: center;
white-space: nowrap;
}
.invite-button{
margin: 0;

@ -19,5 +19,7 @@
"navigationBarTextStyle": "white",
"enablePullDownRefresh": true,
"backgroundTextStyle": "light",
"backgroundColor": "#0080f0"
"backgroundColor": "#0080f0",
"navigationBarTitleText": "教学课堂",
"navigationBarBackgroundColor": "#0080f0"
}

@ -38,7 +38,7 @@
flex: auto;
background: #00d0f0;
color: white;
padding: 6px 1px;
padding: 5px 1px;
transition: all ease 0.6s;
}
.navitem.active{

@ -102,6 +102,7 @@ myshixuns:{
update_file:{url:"{identifier}/*",query,form:{path:null, content: null, evaluate:null, game_id:null},config}
},
paths:{url:"*/{subject_id}",query,
choose_course:{url:"{subject_id}/*", query},
right_banner:{url:"{subject_id}/*",query},
send_to_course:{url:"{subject_id}/*", query, config, form:{course_id:null, shixun_ids:null}},
},

@ -152,6 +152,7 @@ export default class Client{
fail&&fail(e);
}, complete:res=>{
global.realTimeLog.debug(name+" api was called");
complete&&complete(res);
},
});
}

@ -3,7 +3,7 @@
"paths":"./paths/paths",
"shixuns":"./shixuns/shixuns"
},
"navigationBarTitleText": "发现",
"navigationBarTitleText": "探索",
"navigationBarTextStyle": "white",
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#00b0f0"

@ -7,5 +7,6 @@
"my-path":"../my_path/my_path"
},
"navigationBarTextStyle": "white",
"navigationBarTitleText": "我的",
"navigationBarBackgroundColor": "#00b0f0"
}

@ -13,12 +13,19 @@ Page({
this.setData({current});
}
},
enterSend(){
if(app.user().user_id==2)
return wx.showToast({
title: '登录后才能操作哦',icon:"none"
});
let {id} = this.data.subject;
app.navigateTo({url:"{path_send}?subject_id="+id});
},
collect(){
let {id, is_collect} = this.data.subject;
let api_name = is_collect?"collections.cancel":"collections";
app.api(api_name)({container_type:"Subject", container_id:id})
.then(res=>{
;
this.pullSubject({showLoading:0});
if(is_collect){
res.message = "已取消收藏";
@ -46,7 +53,6 @@ Page({
this.pullSubject();
},
onEnterShixun(e){
;
let {currentTarget:{dataset:{allow_visit}}} = e;
if(!allow_visit)
wx.showToast({
@ -72,7 +78,6 @@ Page({
}).catch(e=>{
if(e.code==403)
e.message = "您没有权限访问"
;
wx.hideLoading();
app.showError(e);
})

@ -82,4 +82,5 @@
</swiper>
<view class="operations">
<button type="main" plain bindtap="collect" class="collect">{{subject.is_collect?'已收藏':'收藏'}}</button>
<button type="main" bindtap="enterSend">发送至</button>
</view>

@ -96,8 +96,12 @@
position: sticky;
bottom: 0;
display: flex;
background: white;
}
.operations>.collect{
background: white!important;
flex: 1;
}
.operations>button{
flex: 1;
}

@ -0,0 +1,56 @@
const app = getApp();
Page({
data: {
selectCount: 0
},
onLoad: function (options) {
let {subject_id} = options;
this.setData({subject_id});
this.pullShixuns();
},
onChange(e){
let {detail:{value}} = e;
this.setData({selectCount: value.length});
if(this.length>value.length)
this.setData({isSelectAll: false});
else
this.setData({isSelectAll: true});
},
onTapSelectAll(e){
let {detail} = e;
let selectAll = !this.data.isSelectAll;
let selectCount = selectAll?this.length:0;
this.setData({isSelectAll: selectAll, selectAll, selectCount});
},
onSubmit(e){
let {detail:{value:{shixun_ids}}} = e;
if(shixun_ids.length==0)
return wx.showToast({
title: '请选择实训',icon:"none"
})
shixun_ids = shixun_ids.map(i=>parseInt(i));
this.setData({shixun_ids, showSendDialog: true});
},
pullShixuns(){
let {subject_id} = this.data;
let apiName = "paths.choose_course";
app.api(apiName)({subject_id})
.then(res=>{
let {stages} = res;
this.setData({stages});
let length = 0;
console.log(stages);
for(var i=0;i<stages.length;i++){
length+=stages[i].shixuns.length;
}
this.length = length;
}).catch(e=>{
global.realTimeLog.error(e, apiName + " fail to call");
app.showError(e);
})
},
})

@ -0,0 +1,6 @@
{
"usingComponents": {
"send-to-course":"/components/modal/send-to-course/send-to-course"
},
"navigationBarTitleText": "发送至课堂"
}

@ -0,0 +1,24 @@
<form bindsubmit="onSubmit">
<view class="body">
<scroll-view class="scroll-body" scroll-y="1">
<checkbox-group name="shixun_ids" bindchange="onChange">
<block wx:for="{{stages}}" wx:key="index">
<view class="shixun-wrp" wx:for="{{item.shixuns}}" wx:key="id">
<checkbox class="shixun-checkbox" color="#00b0f0" checked="{{selectAll}}" value="{{item.id}}">
<view class="shixun-item">
{{item.shixun_name}}
</view>
</checkbox>
</view>
</block>
</checkbox-group>
</scroll-view>
<view class="operations">
<view class="operation">
<radio color="#00b0f0" checked="{{isSelectAll}}" bindtap="onTapSelectAll">全选</radio>
</view>
<button class="operation" form-type="submit">确认选用({{selectCount}})</button>
</view>
</view>
</form>
<send-to-course show="{{showSendDialog}}" open_type="redirectTo" subject_id="{{subject_id}}" shixun_ids="{{shixun_ids}}" />

@ -0,0 +1,44 @@
.shixun-checkbox .wx-checkbox-input{
flex: none;
}
.body{
height: 100vh;
display: flex;
flex-direction: column;
}
.scroll-body{
flex: 1;
height: 1px;
flex-basis: 1px;
}
.shixun-wrp{
background: white;
padding: 12px;
margin-bottom: 2px;
}
.shixun-item{
padding-left: 8px;
}
.operations{
display: flex;
background: white;
}
.operation{
justify-content: center;
align-items: center;
}
view.operation{
display: flex;
flex: 2;
}
button.operation{
flex: 3;
background: #00b0f0;
color: white;
border-radius: 0;
}
.weui-half-screen-dialog__hd__side .weui-icon-btn.weui-icon-btn_more{
display: none;
}

@ -47,15 +47,17 @@ Page({
title: '开启中',
});
this.setData({loading: 1});
app.api("shixuns.shixun_exec")({ identifier:this.data.identifier,complete:res=>{wx.hideLoading();this.setData({loading:false})}})
app.api("shixuns.shixun_exec")({ identifier:this.data.identifier})
.then(res=>{
app.navigateTo({ url: "{task}?identifier=" + res.game_identifier});
}).catch(e=>{
app.showError(e);
}).finally(e=>{
wx.hideLoading();
this.setData({loading:false})
});
},
scrollTo({scrollTop}){
;
wx.pageScrollTo({scrollTop,duration:200})
},
switchNav({detail:{current,source}}){

@ -45,7 +45,7 @@
</swiper>
<view wx:if="{{shixun.task_operation[0]}}" class="operations">
<button class="collect" bindtap="collect" type="main" plain>{{shixun.is_collect?'已收藏':'收藏'}}</button>
<button bindtap="enterChallenge" loading="{{loading}}" disabled="{{loading}}" type="main">{{shixun.task_operation[0]}}</button>
<button bindtap="enterChallenge" disabled="{{loading}}" type="main">{{shixun.task_operation[0]}}</button>
<button class="send" type="main" bindtap="sendToCourse" plain>发送至</button>
</view>
<send-to-course show="{{showSendDialog}}" shixun_ids="{{shixun_ids}}"/>

@ -70,9 +70,14 @@
left:0;
right:0;
display: flex;
background: white;
}
.operations>button{
flex: 1;
display: flex;
justify-content: center;
align-content: center;
white-space: nowrap;
}
button.collect, button.send{
background: white!important;

@ -154,6 +154,14 @@
"id": -1,
"name": "dev/pages/dev/dev",
"pathName": "dev/pages/dev/dev",
"query": "",
"scene": null
},
{
"id": -1,
"name": "path/pages/path_send/path_send",
"pathName": "path/pages/path_send/path_send",
"query": "subject_id=475",
"scene": null
}
]

Loading…
Cancel
Save