diff --git a/miniprogram/app.js b/miniprogram/app.js
index 324d2f8..6f86dca 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -117,7 +117,7 @@ App({
}
});
-
+/*
function getCurrentPath() {
let pages = getCurrentPages();
return pages[pages.length - 1].route;
@@ -136,3 +136,4 @@ function toAbsPath(current, path) {
}
return path;
}
+*/
\ No newline at end of file
diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss
index b3bc814..148902f 100644
--- a/miniprogram/app.wxss
+++ b/miniprogram/app.wxss
@@ -87,7 +87,7 @@ button[plain][disabled]{
}
button[type=secondary]{
color: #00b0f0;
- background: #f0f0f0;
+ background: #eee;
}
button[type=error]{
background: #fa5151;
diff --git a/miniprogram/components/modal/send-to-course/send-to-course.js b/miniprogram/components/modal/send-to-course/send-to-course.js
new file mode 100644
index 0000000..5043e2c
--- /dev/null
+++ b/miniprogram/components/modal/send-to-course/send-to-course.js
@@ -0,0 +1,105 @@
+const app = getApp();
+let KEY = "no-nav-to-course-after-send";
+
+Component({
+ properties: {
+ shixun_ids:Array,
+ subject_id:{
+ type:Number,
+ value:-1
+ },
+ show: {
+ type:Boolean,
+ value:false,
+ observer:function(v){
+ if(v){
+ if(this.data.status!=200)
+ this.pullCourse({refresh:1})
+ this.setData({auto_nav: !wx.getStorageSync(KEY)})
+ }
+ }
+ }
+ },
+
+ data: {
+ courses:[],
+ auto_nav: !wx.getStorageSync(KEY)
+ },
+ created(){
+ this.options = {page:1, limit:10};
+ },
+
+ methods: {
+ close(){
+ this.setData({show:false});
+ this.onClose();
+ },
+ onClose(){
+ this.setData({checked: false});
+ this.course_id = null;
+ },
+ changeOption(e){
+ //console.log(e);
+ this.setData({auto_nav: !this.data.auto_nav});
+ wx.setStorageSync(KEY, !this.data.auto_nav);
+ },
+ send(){
+ let {course_id} = this;
+ let {shixun_ids, subject_id} = this.data;
+ if(shixun_ids.length==0){
+ return wx.showToast({
+ title: '请选择实训',
+ icon:"none"
+ })
+ }
+ if(!course_id){
+ return wx.showToast({
+ title: '请选择课堂',
+ icon:"none"
+ })
+ }
+ //console.log(shixun_ids, course_id);
+ let api_name = subject_id>0?'paths.send_to_course':"shixuns.batch_send_to_course"
+ app.api(api_name)({subject_id, course_id, shixun_ids})
+ .then(res=>{
+ this.triggerEvent("success",{});
+ //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`
+ })
+ },400);
+ }).catch(e=>{
+ app.showError(e);
+ });
+ },
+ onChange(e){
+ let {detail:{value}} = e;
+ this.course_id = parseInt(value);
+ //console.log(e, value);
+ },
+ onReachBottom(){
+ this.pullCourse();
+ },
+ pullCourse({refresh=0}={}){
+ if(refresh){
+ this.options.page=1;
+ }else{
+ this.options.page++;
+ }
+ app.api("courses.search_slim")(this.options)
+ .then(res=>{
+ let {courses} = res;
+ if(!refresh)
+ courses = this.data.courses.concat(courses);
+ this.setData({courses, status:200});
+ }).catch(e=>{
+ global.realTimeLog.error(e, "courses.search_slim fail");
+ })
+ }
+ }
+})
diff --git a/miniprogram/components/modal/send-to-course/send-to-course.json b/miniprogram/components/modal/send-to-course/send-to-course.json
new file mode 100644
index 0000000..c6a99fa
--- /dev/null
+++ b/miniprogram/components/modal/send-to-course/send-to-course.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "mp-halfScreenDialog": "weui-miniprogram/half-screen-dialog/half-screen-dialog"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/components/modal/send-to-course/send-to-course.wxml b/miniprogram/components/modal/send-to-course/send-to-course.wxml
new file mode 100644
index 0000000..8e69171
--- /dev/null
+++ b/miniprogram/components/modal/send-to-course/send-to-course.wxml
@@ -0,0 +1,22 @@
+
+ 发送到课堂
+
+
+
+
+
+ {{item.name}}
+
+
+
+ {{status==200?'暂无管理的课堂':'努力加载中'}}
+
+
+
+
+
+
+
+ 发送后跳转到课堂
+
+
\ No newline at end of file
diff --git a/miniprogram/components/modal/send-to-course/send-to-course.wxss b/miniprogram/components/modal/send-to-course/send-to-course.wxss
new file mode 100644
index 0000000..97714d8
--- /dev/null
+++ b/miniprogram/components/modal/send-to-course/send-to-course.wxss
@@ -0,0 +1,32 @@
+.single-line{
+ overflow: hidden;
+ text-overflow:ellipsis;
+ white-space: nowrap;
+}
+.courses{
+ height: 26vh;
+}
+.course{
+ padding: 4px 12px;
+}
+.course-name{
+ padding-left: 6px;
+}
+.empty-tip{
+ text-align: center;
+ color: dimgray;
+ font-size: 15px;
+ padding-top: 10vh;
+}
+.operations{
+ text-align: center;
+ margin: -28px 0 -20px 0;
+}
+.operation{
+ width: 120px!important;
+ margin: 0 8px!important;
+ display: inline-block!important;
+}
+.option{
+ transform: scale(0.6);
+}
\ No newline at end of file
diff --git a/miniprogram/course/pages/course/course.wxml b/miniprogram/course/pages/course/course.wxml
index 5cc1bb7..b9403b4 100644
--- a/miniprogram/course/pages/course/course.wxml
+++ b/miniprogram/course/pages/course/course.wxml
@@ -68,7 +68,7 @@
- {{item.name}}
+ {{item.name}}
\ No newline at end of file
diff --git a/miniprogram/dev/pages/dev/dev.js b/miniprogram/dev/pages/dev/dev.js
index 12d41b2..d35ed2b 100644
--- a/miniprogram/dev/pages/dev/dev.js
+++ b/miniprogram/dev/pages/dev/dev.js
@@ -10,13 +10,15 @@ Page({
type:"secondary"
},
onScanCode(e){
- ;
+
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ var p =this.selectComponent("#main")
+ p.onLoad();
+ p.onShow();
},
/**
diff --git a/miniprogram/dev/pages/dev/dev.json b/miniprogram/dev/pages/dev/dev.json
index 8835af0..d201978 100644
--- a/miniprogram/dev/pages/dev/dev.json
+++ b/miniprogram/dev/pages/dev/dev.json
@@ -1,3 +1,5 @@
{
- "usingComponents": {}
+ "usingComponents": {
+ "main":"/pages/home/home"
+ }
}
\ No newline at end of file
diff --git a/miniprogram/dev/pages/dev/dev.wxml b/miniprogram/dev/pages/dev/dev.wxml
index bc103a3..126961e 100644
--- a/miniprogram/dev/pages/dev/dev.wxml
+++ b/miniprogram/dev/pages/dev/dev.wxml
@@ -1,4 +1 @@
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/miniprogram/js/apiConfig.js b/miniprogram/js/apiConfig.js
index d47910e..d2578f5 100644
--- a/miniprogram/js/apiConfig.js
+++ b/miniprogram/js/apiConfig.js
@@ -102,7 +102,8 @@ myshixuns:{
update_file:{url:"{identifier}/*",query,form:{path:null, content: null, evaluate:null, game_id:null},config}
},
paths:{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}},
},
schools:{
diff --git a/miniprogram/js/client.js b/miniprogram/js/client.js
index d38223d..2ec6d41 100644
--- a/miniprogram/js/client.js
+++ b/miniprogram/js/client.js
@@ -150,7 +150,9 @@ export default class Client{
}, fail:e=>{
this.trigger("fail",name,e);
fail&&fail(e);
- }, complete,
+ }, complete:res=>{
+ global.realTimeLog.debug(name+" api was called");
+ },
});
}
load_user() {
diff --git a/miniprogram/pages/findmore/findmore.wxss b/miniprogram/pages/findmore/findmore.wxss
index 1bf3657..da9d174 100644
--- a/miniprogram/pages/findmore/findmore.wxss
+++ b/miniprogram/pages/findmore/findmore.wxss
@@ -7,4 +7,8 @@ page{
.body{
flex: 1 1 1px;
height: 1px;
+}
+/* for tmp*/
+.weui-half-screen-dialog__hd__side .weui-icon-btn.weui-icon-btn_more{
+ display: none;
}
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/shixuns/shixuns.js b/miniprogram/pages/findmore/shixuns/shixuns.js
index 29097b5..53663fa 100644
--- a/miniprogram/pages/findmore/shixuns/shixuns.js
+++ b/miniprogram/pages/findmore/shixuns/shixuns.js
@@ -28,12 +28,8 @@ Component({
}
},
- onChange(e){
- ;
- },
onSelect(e){
let {detail} = e;
- ;
this.selects[detail.name] = detail.value;
if(detail.value&&!this.data.select)
this.setData({select: true});
@@ -46,35 +42,32 @@ Component({
if(this.selects[i])
length++;
}
- ;
if(length==0){
this.setData({select: false});
this.selects = {};
}
}
},
- onReset(e){
- ;
+ reset(e){
this.setData({select:false});
this.selects = {}
},
onSubmit(e){
- ;
if(!this.data.select)
this.setData({select: true});
else{
let shixun_ids = [];
for(var i in this.selects){
if(this.selects[i])
- shixun_ids.push(i);
+ shixun_ids.push(parseInt(i));
}
- ;
if(shixun_ids.length==0){
wx.showToast({
title: '请选择实训',icon:"none"
})
}else{
- this.select_shixun_ids = shixun_ids;
+ this.setData({shixun_ids});
+ console.info(shixun_ids);
this.setData({showSendDialog: true});
}
diff --git a/miniprogram/pages/findmore/shixuns/shixuns.json b/miniprogram/pages/findmore/shixuns/shixuns.json
index 68d10e2..b5a88de 100644
--- a/miniprogram/pages/findmore/shixuns/shixuns.json
+++ b/miniprogram/pages/findmore/shixuns/shixuns.json
@@ -2,6 +2,7 @@
"component": true,
"usingComponents": {
"empty-page":"/components/empty-page/empty-page",
- "shixun-item":"./shixun-item/shixun-item"
+ "shixun-item":"./shixun-item/shixun-item",
+ "send-to-course":"/components/modal/send-to-course/send-to-course"
}
}
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/shixuns/shixuns.wxml b/miniprogram/pages/findmore/shixuns/shixuns.wxml
index 2d05b33..7e86077 100644
--- a/miniprogram/pages/findmore/shixuns/shixuns.wxml
+++ b/miniprogram/pages/findmore/shixuns/shixuns.wxml
@@ -9,7 +9,7 @@
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/shixuns/shixuns.wxss b/miniprogram/pages/findmore/shixuns/shixuns.wxss
index a1203aa..ac499ce 100644
--- a/miniprogram/pages/findmore/shixuns/shixuns.wxss
+++ b/miniprogram/pages/findmore/shixuns/shixuns.wxss
@@ -48,4 +48,5 @@
.shixun-wrp{
margin-bottom: 2px;
-}
\ No newline at end of file
+}
+
diff --git a/miniprogram/shixun/pages/shixun/shixun.js b/miniprogram/shixun/pages/shixun/shixun.js
index d1f49c5..f23f49b 100644
--- a/miniprogram/shixun/pages/shixun/shixun.js
+++ b/miniprogram/shixun/pages/shixun/shixun.js
@@ -13,6 +13,10 @@ Page({
],
description:""
},
+ sendToCourse(){
+ let {id} = this.data.shixun;
+ this.setData({shixun_ids: [id], showSendDialog: true});
+ },
collect(){
let {id, is_collect} = this.data.shixun;
let api_name = is_collect?"collections.cancel":"collections";
diff --git a/miniprogram/shixun/pages/shixun/shixun.json b/miniprogram/shixun/pages/shixun/shixun.json
index b04cae9..29cdb55 100644
--- a/miniprogram/shixun/pages/shixun/shixun.json
+++ b/miniprogram/shixun/pages/shixun/shixun.json
@@ -3,7 +3,8 @@
"rich-md":"/components/rich-md/rich-md",
"require-login":"/components/require-login/require-login",
"challenge-item":"/shixun/components/challenge-item/challenge-item",
- "nav-bar":"/components/nav-bar/nav-bar"
+ "nav-bar":"/components/nav-bar/nav-bar",
+ "send-to-course":"/components/modal/send-to-course/send-to-course"
},
"navigationBarBackgroundColor": "#0080f0",
"navigationBarTextStyle": "white",
diff --git a/miniprogram/shixun/pages/shixun/shixun.wxml b/miniprogram/shixun/pages/shixun/shixun.wxml
index a324c19..d8a5a9a 100644
--- a/miniprogram/shixun/pages/shixun/shixun.wxml
+++ b/miniprogram/shixun/pages/shixun/shixun.wxml
@@ -46,4 +46,6 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/miniprogram/shixun/pages/shixun/shixun.wxss b/miniprogram/shixun/pages/shixun/shixun.wxss
index 5c5d140..378c744 100644
--- a/miniprogram/shixun/pages/shixun/shixun.wxss
+++ b/miniprogram/shixun/pages/shixun/shixun.wxss
@@ -74,6 +74,10 @@
.operations>button{
flex: 1;
}
-button.collect{
+button.collect, button.send{
background: white!important;
+}
+/* tmp solution*/
+.weui-half-screen-dialog__hd__side .weui-icon-btn.weui-icon-btn_more{
+ display: none;
}
\ No newline at end of file
diff --git a/miniprogram/sitemap.json b/miniprogram/sitemap.json
index 46615cd..88ef00b 100644
--- a/miniprogram/sitemap.json
+++ b/miniprogram/sitemap.json
@@ -1,7 +1,14 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [
-
+ {
+ "action":"allow",
+ "page":"path/pages/path/path",
+ "params":[
+ "subject_id"
+ ],
+ "matching":"inclusive"
+ },
{
"action": "allow",
"page": "shixun/pages/shixun/shixun",