A 支持选用实践课程

master
educoder_weapp 5 years ago
parent 9b9053b5d4
commit 03e67f288a

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,11 +1,11 @@
const cloudDir = "cloud://educoder.6564-educoder-1300855313/"; 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 developUrl = "https://test-newweb.educoder.net";
const trialUrl = "https://pre-newweb.educoder.net"; const trialUrl = "https://pre-newweb.educoder.net";
const releaseUrl = "https://www.educoder.net"; const releaseUrl = "https://www.educoder.net";
let _version = "0.16.0"; let _version = "0.16.1";
var eduUrl = releaseUrl; var eduUrl = releaseUrl;
/** /**
*/ */

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

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

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

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

@ -102,6 +102,7 @@ myshixuns:{
update_file:{url:"{identifier}/*",query,form:{path:null, content: null, evaluate:null, game_id:null},config} update_file:{url:"{identifier}/*",query,form:{path:null, content: null, evaluate:null, game_id:null},config}
}, },
paths:{url:"*/{subject_id}",query, paths:{url:"*/{subject_id}",query,
choose_course:{url:"{subject_id}/*", query},
right_banner:{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}}, 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); fail&&fail(e);
}, complete:res=>{ }, complete:res=>{
global.realTimeLog.debug(name+" api was called"); global.realTimeLog.debug(name+" api was called");
complete&&complete(res);
}, },
}); });
} }

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

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

@ -13,12 +13,19 @@ Page({
this.setData({current}); 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(){ collect(){
let {id, is_collect} = this.data.subject; let {id, is_collect} = this.data.subject;
let api_name = is_collect?"collections.cancel":"collections"; let api_name = is_collect?"collections.cancel":"collections";
app.api(api_name)({container_type:"Subject", container_id:id}) app.api(api_name)({container_type:"Subject", container_id:id})
.then(res=>{ .then(res=>{
;
this.pullSubject({showLoading:0}); this.pullSubject({showLoading:0});
if(is_collect){ if(is_collect){
res.message = "已取消收藏"; res.message = "已取消收藏";
@ -46,7 +53,6 @@ Page({
this.pullSubject(); this.pullSubject();
}, },
onEnterShixun(e){ onEnterShixun(e){
;
let {currentTarget:{dataset:{allow_visit}}} = e; let {currentTarget:{dataset:{allow_visit}}} = e;
if(!allow_visit) if(!allow_visit)
wx.showToast({ wx.showToast({
@ -72,7 +78,6 @@ Page({
}).catch(e=>{ }).catch(e=>{
if(e.code==403) if(e.code==403)
e.message = "您没有权限访问" e.message = "您没有权限访问"
;
wx.hideLoading(); wx.hideLoading();
app.showError(e); app.showError(e);
}) })

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

@ -96,8 +96,12 @@
position: sticky; position: sticky;
bottom: 0; bottom: 0;
display: flex; display: flex;
background: white;
} }
.operations>.collect{ .operations>.collect{
background: white!important; background: white!important;
flex: 1; 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: '开启中', title: '开启中',
}); });
this.setData({loading: 1}); 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=>{ .then(res=>{
app.navigateTo({ url: "{task}?identifier=" + res.game_identifier}); app.navigateTo({ url: "{task}?identifier=" + res.game_identifier});
}).catch(e=>{ }).catch(e=>{
app.showError(e); app.showError(e);
}).finally(e=>{
wx.hideLoading();
this.setData({loading:false})
}); });
}, },
scrollTo({scrollTop}){ scrollTo({scrollTop}){
;
wx.pageScrollTo({scrollTop,duration:200}) wx.pageScrollTo({scrollTop,duration:200})
}, },
switchNav({detail:{current,source}}){ switchNav({detail:{current,source}}){

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

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

@ -154,6 +154,14 @@
"id": -1, "id": -1,
"name": "dev/pages/dev/dev", "name": "dev/pages/dev/dev",
"pathName": "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 "scene": null
} }
] ]

Loading…
Cancel
Save