diff --git a/README.md b/README.md
index e4cc0f9..36c2618 100644
--- a/README.md
+++ b/README.md
@@ -3,4 +3,4 @@ educoder微信小程序,帮助使用[educoder平台](https://www.educoder.net)
## 小程序码
-
+
diff --git a/changelog.md b/changelog.md
index ea30f03..c557cbf 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,7 @@
+## v0.16.0
+ * A 探索界面
+ * A 我的实践课程模块
+
## v0.15.1
* A 教师加入课堂审批
* A 熬夜睡觉提醒
diff --git a/miniprogram/account/pages/account/account.js b/miniprogram/account/pages/account/account.js
index 651f2fc..0e4723b 100644
--- a/miniprogram/account/pages/account/account.js
+++ b/miniprogram/account/pages/account/account.js
@@ -40,7 +40,8 @@ Page({
})
},
login_test(){
- var data = {login:"educoder_weapp@126.com",save_password:1, password:"abcdefgh"};
+ var data = global.accountManager.testAccount;
+ data.save_password = 1;
this.setData(data);
this.login(data);
// this.setStorage({...data,save_password:1});
diff --git a/miniprogram/account/pages/profile/profile.wxml b/miniprogram/account/pages/profile/profile.wxml
index 90ea239..a71a366 100644
--- a/miniprogram/account/pages/profile/profile.wxml
+++ b/miniprogram/account/pages/profile/profile.wxml
@@ -58,7 +58,7 @@
{{identity_index<0?'院系/部门':identity_index==2?'部门':'院系'}}
- {{departments[department_index].name||department_name||'请选择'}}
+ {{departments[department_index].name||'请选择'}}
暂无子单位,点击申请新增
diff --git a/miniprogram/app.js b/miniprogram/app.js
index 316aebe..b06f360 100644
--- a/miniprogram/app.js
+++ b/miniprogram/app.js
@@ -18,12 +18,21 @@ App({
success&&success(res.result);
}, fail, complete});
},
+ realTimeLog:global.realTimeLog,
api(name, config) { return client.api(name, config) },
callApi(options) { return client.callApi(options) },
user() { return client.user },
syncUser(options) { return client.syncUser(options) },
updateUserInfo(info){return client.updateUserInfo(info)},
onLaunch: function (options) {
+ if(options.scene==1129){
+ this.api("accounts.login")(global.accountManager.testAccount)
+ .then(res=>{
+ let account = { ...res, ...global.accountManager.testAccount};
+ global.accountManager.setCurrentAccount(account);
+ });
+ wx.reportMonitor('1', 1);
+ }
const db = wx.cloud.database();
if (options.referrerInfo && options.referrerInfo.appId) {
let { appId, extraData } = options.referrerInfo;
@@ -55,14 +64,7 @@ App({
})
}
}).catch(e=>{});
- wx.getSystemInfo({
- complete: (res) => {
- let {SDKVersion} = res;
- wx.reportAnalytics('lib_version', {
- sdkversion: SDKVersion
- });
- },
- })
+
},
onShow() {
if (client.user_id && client.user_id != 2)
diff --git a/miniprogram/app.json b/miniprogram/app.json
index d01a7e6..221297f 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -6,6 +6,9 @@
"navigationBarTitleText": "EduCoder",
"backgroundColor": "#f5f5f5"
},
+ "usingComponents":{
+ "require-login":"/components/require-login/require-login"
+ },
"pages": [
"pages/main/main",
"pages/findmore/findmore",
@@ -94,6 +97,14 @@
}
],
"preloadRule": {
+ "pages/findmore/findmore":{
+ "network":"all",
+ "packages":[
+ "shixun",
+ "search",
+ "path"
+ ]
+ },
"pages/home/home": {
"network": "all",
"packages": [
@@ -107,7 +118,7 @@
"course",
"account",
"shixun",
- "search"
+ "path"
]
},
"course/pages/course/course": {
@@ -134,6 +145,12 @@
"iconPath": "images/tab_study_default.png",
"selectedIconPath": "images/tab_study_pressed.png"
},
+ {
+ "pagePath": "pages/findmore/findmore",
+ "text": "探索",
+ "iconPath": "images/tab_findmore_default.png",
+ "selectedIconPath": "images/tab_findmore_pressed.png"
+ },
{
"pagePath": "pages/tidings/tidings",
"text": "消息",
@@ -151,9 +168,7 @@
"useExtendedLib": {
"weui": true
},
- "navigateToMiniProgramAppIdList": [
- "wx2402d86a6b534f77"
- ],
"sitemapLocation": "sitemap.json",
+ "themeLocation":"theme.json",
"style": "v2"
}
\ No newline at end of file
diff --git a/miniprogram/components/empty-page/empty-page.js b/miniprogram/components/empty-page/empty-page.js
new file mode 100644
index 0000000..f344d1f
--- /dev/null
+++ b/miniprogram/components/empty-page/empty-page.js
@@ -0,0 +1,23 @@
+Component({
+ properties: {
+ image:{
+ type:String,
+ value:global.config.attachDir + "908959"
+ },
+ show:{
+ type:Boolean,
+ value:false
+ },
+ title:{
+ type:String,
+ value:"没有相关内容呢"
+ },
+ desc:String
+ },
+ data: {
+
+ },
+ methods: {
+
+ }
+})
diff --git a/miniprogram/components/empty-page/empty-page.json b/miniprogram/components/empty-page/empty-page.json
new file mode 100644
index 0000000..7e37c03
--- /dev/null
+++ b/miniprogram/components/empty-page/empty-page.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/miniprogram/components/empty-page/empty-page.wxml b/miniprogram/components/empty-page/empty-page.wxml
new file mode 100644
index 0000000..1c568d9
--- /dev/null
+++ b/miniprogram/components/empty-page/empty-page.wxml
@@ -0,0 +1,5 @@
+
+
+ {{title}}
+ {{desc}}
+
diff --git a/miniprogram/components/empty-page/empty-page.wxss b/miniprogram/components/empty-page/empty-page.wxss
new file mode 100644
index 0000000..357f2a5
--- /dev/null
+++ b/miniprogram/components/empty-page/empty-page.wxss
@@ -0,0 +1,15 @@
+.empty{
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding-top: 40px;
+}
+.image{
+ width: 30vw;
+ height: 30vw;
+ padding-bottom: 20px;
+}
+.desc{
+ font-size: 12px;
+ color: dimgray;
+}
\ No newline at end of file
diff --git a/miniprogram/components/modal/join-course/join-course.js b/miniprogram/components/modal/join-course/join-course.js
index 1d9c6f0..e51f82d 100644
--- a/miniprogram/components/modal/join-course/join-course.js
+++ b/miniprogram/components/modal/join-course/join-course.js
@@ -52,7 +52,7 @@ Component({
this.setData({invite_code: res.result});
else if(res.scanType=="WX_CODE"&&res.path){
var match = res.path.match(/course_invite\?(.*)$/)
- console.log("match",match);
+ //console.log("match",match);
if(match){
var options = {}
match[1].split("&").map(i=>{
@@ -60,7 +60,7 @@ Component({
var k = i.slice(0, index);
var v = i.slice(index + 1);
options[k]=v})
- console.log("options",options);
+ //console.log("options",options);
if(options.scene){
var scene = {};
for (var i of decodeURIComponent(options.scene).split("&")) {
@@ -120,6 +120,7 @@ Component({
app.api("courses.apply_to_join_course")({ invite_code, assistant_professor, professor, student,complete: res=>{this.disabled=false}})
.then(res => {
app.showMsg(res,800);
+ wx.reportAnalytics('join_course', {});
if (res.course_id&&this.data.auto_navigate&&res.message.indexOf("助教申请")==-1){
setTimeout(()=>{
app[this.data.opentype]({
diff --git a/miniprogram/components/nav-bar/nav-bar.js b/miniprogram/components/nav-bar/nav-bar.js
index 165a6d4..2400464 100644
--- a/miniprogram/components/nav-bar/nav-bar.js
+++ b/miniprogram/components/nav-bar/nav-bar.js
@@ -27,6 +27,7 @@ Component({
type:Number,
observer: function(cur){
this.setData({cur});
+ console.log("observer current", cur);
this.trigger({source:""});
this.scroll();
}
diff --git a/miniprogram/components/nav-bar/nav-bar.wxml b/miniprogram/components/nav-bar/nav-bar.wxml
index 4577515..4baf677 100644
--- a/miniprogram/components/nav-bar/nav-bar.wxml
+++ b/miniprogram/components/nav-bar/nav-bar.wxml
@@ -1,5 +1,5 @@
-
+
{{item.text}}
\ No newline at end of file
diff --git a/miniprogram/components/nav-bar/nav-bar.wxss b/miniprogram/components/nav-bar/nav-bar.wxss
index 7d8b130..4b10cc1 100644
--- a/miniprogram/components/nav-bar/nav-bar.wxss
+++ b/miniprogram/components/nav-bar/nav-bar.wxss
@@ -21,6 +21,7 @@
.view.nav.active{
color: #0080f0;
font-size: 15px;
+ font-weight: bold;
border-bottom: 2px solid #0080f0;
}
.view.plain{
@@ -33,7 +34,7 @@
}
.view.cap{
border-radius: 36px;
- background: #dddddd;
+ background: #dfdfdf;
padding: 0 14px;
height: 28px;
line-height: 28px;
@@ -54,7 +55,8 @@
}
.text.line.active{
font-size: 15px;
- color: #0080f0;
+ color: #00b0f0;
+ font-weight: bold;
}
.text.line::after{
transition: all 0.26s ease;
diff --git a/miniprogram/components/page-status/page-status.js b/miniprogram/components/page-status/page-status.js
new file mode 100644
index 0000000..7958b48
--- /dev/null
+++ b/miniprogram/components/page-status/page-status.js
@@ -0,0 +1,23 @@
+// components/page-status/page-status.js
+Component({
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+
+ },
+
+ /**
+ * 组件的初始数据
+ */
+ data: {
+
+ },
+
+ /**
+ * 组件的方法列表
+ */
+ methods: {
+
+ }
+})
diff --git a/miniprogram/components/page-status/page-status.json b/miniprogram/components/page-status/page-status.json
new file mode 100644
index 0000000..7e37c03
--- /dev/null
+++ b/miniprogram/components/page-status/page-status.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/miniprogram/components/page-status/page-status.wxml b/miniprogram/components/page-status/page-status.wxml
new file mode 100644
index 0000000..64d5283
--- /dev/null
+++ b/miniprogram/components/page-status/page-status.wxml
@@ -0,0 +1,2 @@
+
+components/page-status/page-status.wxml
diff --git a/miniprogram/components/page-status/page-status.wxss b/miniprogram/components/page-status/page-status.wxss
new file mode 100644
index 0000000..86381f7
--- /dev/null
+++ b/miniprogram/components/page-status/page-status.wxss
@@ -0,0 +1 @@
+/* components/page-status/page-status.wxss */
\ No newline at end of file
diff --git a/miniprogram/components/require-login/require-login.js b/miniprogram/components/require-login/require-login.js
index 0167f6c..35c82d9 100644
--- a/miniprogram/components/require-login/require-login.js
+++ b/miniprogram/components/require-login/require-login.js
@@ -3,7 +3,8 @@ const app = getApp();
Component({
properties: {
user_id:{
- type:Number
+ type:Number,
+ value:-1
},
message:{
type:"String",
@@ -21,7 +22,11 @@ Component({
show:function(){
app.syncUser()
.then(res=>{
- this.setData({user_id: res.user.user_id});
+ if(this.data.user_id!=res.user.user_id){
+ if(this.data.user_id!=-1)
+ this.triggerEvent("change",{});
+ this.setData({user_id: res.user.user_id});
+ }
})
}
}
diff --git a/miniprogram/components/rich-md/rich-md.js b/miniprogram/components/rich-md/rich-md.js
index 572424e..867b156 100644
--- a/miniprogram/components/rich-md/rich-md.js
+++ b/miniprogram/components/rich-md/rich-md.js
@@ -55,8 +55,16 @@ Component({
var key = "RICHMDKEY";
//console.log(_data);
let {tag, attr} = _data;
- if(tag=='navigator'&&attr.href)
- navigateToUrl({url: attr.href});
+ if(tag=='navigator'&&attr.href){
+ if(!navigateToUrl({url: attr.href}))
+ wx.setClipboardData({
+ data: attr.href,success:res=>{
+ wx.showToast({
+ title: '链接已复制'
+ })
+ }
+ });
+ }
//this.triggerEvent('click',{},{bubbles:true});
if(data&&data._e.tag=="code")
data={attr:{class:"h2w__pre"},child:[data],tag:"view",type:"tag",_e:{type:"tag",attr:{},tag:"pre", child:[data]}}
@@ -83,9 +91,7 @@ Component({
let {type, nodes} = this.data;
//console.log(type);
if(!type){
- if (nodes.match(/
/))
- type = "html"
- else if (nodes.match(/^\s*<.+>.*<\/.+>/s))
+ if (nodes.match(/^\s*<.+>.*<\/.+>/s))
type = "rich-text";
else if(nodes.match(/##+|\*.+\*|- |`|\$|\[.*\]\(.+\)|\|.+\|/))
type = "markdown";
diff --git a/miniprogram/components/shixun-item/shixun-item.wxml b/miniprogram/components/shixun-item/shixun-item.wxml
deleted file mode 100644
index ed1e561..0000000
--- a/miniprogram/components/shixun-item/shixun-item.wxml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- {{shixun.name}}
-
-
\ No newline at end of file
diff --git a/miniprogram/components/shixun-item/shixun-item.wxss b/miniprogram/components/shixun-item/shixun-item.wxss
deleted file mode 100644
index 9f26574..0000000
--- a/miniprogram/components/shixun-item/shixun-item.wxss
+++ /dev/null
@@ -1,20 +0,0 @@
-.shixun{
- background: white;
- padding: 10px 8px;
- overflow: hidden;
- word-wrap: break-word;
- display: flex;
-}
-
-.shixun-img{
- flex:none;
- width: 250rpx;
- height: 170rpx;
- border-radius: 4px;
-}
-.detail{
- padding-top: 10px;
- text-align: center;
- flex: auto;
- width: 1px;
-}
\ No newline at end of file
diff --git a/miniprogram/config.js b/miniprogram/config.js
index 167f962..1dcff6d 100644
--- a/miniprogram/config.js
+++ b/miniprogram/config.js
@@ -5,10 +5,9 @@ const developUrl = "https://test-newweb.educoder.net";
const trialUrl = "https://pre-newweb.educoder.net";
const releaseUrl = "https://www.educoder.net";
-let _version = "0.15.2";
+let _version = "0.16.0";
var eduUrl = releaseUrl;
/**
- * A 试卷倒计时
*/
export function switchEnv(env) {
@@ -46,7 +45,7 @@ const config = global.config = {
]
};
-envVersion="release";
-switchEnv(envVersion=="develop"?"trial":"release");
+switchEnv("release");
+//switchEnv(envVersion=="develop"?"trial":"release");
module.exports = config;
\ No newline at end of file
diff --git a/miniprogram/course/modules/attachment/attachment.js b/miniprogram/course/modules/attachment/attachment.js
index 45fc14c..6945050 100644
--- a/miniprogram/course/modules/attachment/attachment.js
+++ b/miniprogram/course/modules/attachment/attachment.js
@@ -29,9 +29,6 @@ Component({
},
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");
diff --git a/miniprogram/course/modules/students/students.js b/miniprogram/course/modules/students/students.js
index 728dc37..90e4553 100644
--- a/miniprogram/course/modules/students/students.js
+++ b/miniprogram/course/modules/students/students.js
@@ -28,13 +28,42 @@ Component({
onChoose(e){
console.log(e);
},
+ onChange(e){
+ console.log(e);
+ let {detail:{value}} = e;
+ this.sort_type = value?'id':'';
+ this.refresh();
+ },
refresh(){
let {course_id, course_identity} = this.data;
- app.api("weapps.courses.students")({course_id,limit:1000}).then(res=>{
- console.log(res);
- let {students,students_count} = res;
- this.setData({students,students_count});
- });
+ let {sort_type=''} = this;
+ if(sort_type!='id')
+ app.api("weapps.courses.students")({course_id, limit:1000}).then(res=>{
+ console.log(res);
+ var {students,students_count} = res;
+ this.setData({students,students_count});
+ if(!this.imageMap)
+ this.imageMap = new Map();
+ for(var item of students){
+ for(var stu of item.items){
+ this.imageMap.set(stu.user_id, stu.image_url);
+ }
+ }
+ });
+ else
+ app.api("courses.students")({course_id, limit:10000})
+ .then(res=>{
+ console.log(res);
+ var students;
+ if(this.imageMap)
+ students = res.students.map(i=>{
+ i.image_url = this.imageMap.get(i.user_id);
+ return i;
+ })
+ students = [{letter:"#", items:res.students}];
+ var {students_count} = res;
+ this.setData({ students, students_count});
+ })
let ext = {course_id, course_identity};
this.setData({ext});
}
diff --git a/miniprogram/course/modules/students/students.wxml b/miniprogram/course/modules/students/students.wxml
index 9f73bfa..c1dbae0 100644
--- a/miniprogram/course/modules/students/students.wxml
+++ b/miniprogram/course/modules/students/students.wxml
@@ -4,6 +4,9 @@
学生人数:
{{students_count}}
+
+ 按学号排序
+
diff --git a/miniprogram/course/modules/students/students.wxss b/miniprogram/course/modules/students/students.wxss
index 28418f2..f04e122 100644
--- a/miniprogram/course/modules/students/students.wxss
+++ b/miniprogram/course/modules/students/students.wxss
@@ -11,4 +11,7 @@
}
.invite-button{
margin: 0;
+}
+.switch-wrp{
+ transform: scale(0.6);
}
\ No newline at end of file
diff --git a/miniprogram/course/pages/course/course.js b/miniprogram/course/pages/course/course.js
index 323a201..0d3fbfb 100644
--- a/miniprogram/course/pages/course/course.js
+++ b/miniprogram/course/pages/course/course.js
@@ -307,7 +307,7 @@ Component({
});
},
onShow: function () {
- if (this.data.status != 200 && this.data.status != 0 || this.data.status != 0) {
+ if (this.data.status != 200 && this.data.status != 0) {
this.refresh();
}
},
diff --git a/miniprogram/dev/pages/dev/dev.js b/miniprogram/dev/pages/dev/dev.js
index 7f65cd3..56d448b 100644
--- a/miniprogram/dev/pages/dev/dev.js
+++ b/miniprogram/dev/pages/dev/dev.js
@@ -5,7 +5,8 @@ Page({
* 页面的初始数据
*/
data: {
-
+ scrollTop:0,
+ re:false
},
onScanCode(e){
console.log(e);
diff --git a/miniprogram/dev/pages/dev/dev.wxml b/miniprogram/dev/pages/dev/dev.wxml
index f01a0d2..8be2286 100644
--- a/miniprogram/dev/pages/dev/dev.wxml
+++ b/miniprogram/dev/pages/dev/dev.wxml
@@ -1,2 +1,3 @@
-
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/miniprogram/dev/pages/dev/dev.wxss b/miniprogram/dev/pages/dev/dev.wxss
index 5f42582..97fa6b9 100644
--- a/miniprogram/dev/pages/dev/dev.wxss
+++ b/miniprogram/dev/pages/dev/dev.wxss
@@ -1,4 +1,8 @@
#cam{
width: 100%;
height: 40vh;
+}
+.scroll{
+ background: red;
+ height: 72vh;
}
\ No newline at end of file
diff --git a/miniprogram/images/tab_findmore_default.png b/miniprogram/images/tab_findmore_default.png
index fa79ff4..a19066c 100644
Binary files a/miniprogram/images/tab_findmore_default.png and b/miniprogram/images/tab_findmore_default.png differ
diff --git a/miniprogram/images/tab_findmore_pressed.png b/miniprogram/images/tab_findmore_pressed.png
index 0fbc127..2df3e11 100644
Binary files a/miniprogram/images/tab_findmore_pressed.png and b/miniprogram/images/tab_findmore_pressed.png differ
diff --git a/miniprogram/includes/navigation-bar/navigaation-bar.wxml b/miniprogram/includes/navigation-bar/navigaation-bar.wxml
new file mode 100644
index 0000000..370d23f
--- /dev/null
+++ b/miniprogram/includes/navigation-bar/navigaation-bar.wxml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ {{title}}
+
+
+
+ {{item.text}}
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/includes/navigation-bar/navigation-bar.wxss b/miniprogram/includes/navigation-bar/navigation-bar.wxss
new file mode 100644
index 0000000..d211bb9
--- /dev/null
+++ b/miniprogram/includes/navigation-bar/navigation-bar.wxss
@@ -0,0 +1,47 @@
+
+.navigation{
+ background: #00b0f0;
+ flex: none;
+}
+.navigation-bar{
+ height: 44px;
+ padding-right: 105px;
+ display: flex;
+ align-items: center;
+}
+.navigation-left{
+ width: 105px;
+ display: flex;
+ align-items: center;
+ color: white;
+}
+.search{
+ padding: 5px 0 5px 7px;
+}
+.title{
+ flex: auto;
+ text-align: center;
+ white-space: pre;
+ font-size: 14px;
+}
+.navbar{
+ flex: 1 1 1px;
+ width: 1px;
+ font-size: 15px;
+ border-radius: 7px;
+ display: flex;
+ text-align: center;
+ white-space: nowrap;
+ overflow-x: scroll;
+}
+.navitem{
+ flex: auto;
+ background: #00d0f0;
+ color: white;
+ padding: 6px 1px;
+ transition: all ease 0.6s;
+}
+.navitem.active{
+ color: #00b0f0;
+ background: white;
+}
diff --git a/miniprogram/js/apiConfig.js b/miniprogram/js/apiConfig.js
index 55d77a2..bb8b074 100644
--- a/miniprogram/js/apiConfig.js
+++ b/miniprogram/js/apiConfig.js
@@ -17,7 +17,9 @@ accounts:{
add_department_applies:{config, query, form:{school_id:null, name:null, remarks:void 0},disp:"新增子单位"},
attachments:{url:{_:1,DELETE:'*/{attachment_id}',uploadFile:"*"},query,form:{_:1,uploadFile:{file:null},DELETE:{}},config:{method:"uploadFile", name:"file"}},
-
+collections:{config, query, form:{container_id: null, container_type: null},
+ cancel:{query, config:{method:"DELETE", form:{container_id: null, container_type: null}}},
+},
courses:{ url:{_:"*", DELETE:"*/{course_id}",PUT:"*/{course_id}"},query, form:{_:1,GET:{search:"",limit:20, page:1, order:"all"}, POST:{course_list_name:null,name:null,school: null,end_date: null,class_period:null,credit:null,course_module_types:["shixun_homework","common_homework","group_homework","exercise","attachment","course_group"],authentication:null,professional_certification:null},PUT:{course_list_name:null,name:null,school: null,end_date: null,class_period:null,credit:null,course_module_types:["shixun_homework","common_homework","group_homework","exercise","attachment","course_group"],authentication:null,professional_certification:null}},
act_score:{url:"{course_id}/*", query},
all_course_groups:{url:"{course_id}/*", query},
@@ -68,7 +70,7 @@ exercises:{url:"{exercise_id}",query,form:{exercise_name:null, exercise_descript
},
disciplines:{
-
+ query, form:{source:null}
},
files:{query, form:{course_id:null, page_size:15, page:1,search:"",sort:0, sort_type:"created_on"},
@@ -99,7 +101,9 @@ myshixuns:{
repository: {url:"{identifier}/*",query,form:{path:null},config},
update_file:{url:"{identifier}/*",query,form:{path:null, content: null, evaluate:null, game_id:null},config}
},
-paths:{url:""},
+paths:{url:"*/{subject_id}",query,
+ right_banner:{url:"{subject_id}/*",query}
+},
schools:{
school_list:{query, form:{search:null}},
@@ -117,7 +121,7 @@ shixuns:{url:"*/{identifier}", query, res:{tpm_modified:"代码库是否有更
show_right:{url:""},
shixun_exec:{url:"{identifier}/*", query},
},
-stages:{},
+stages:{form:{subject_id:null},query},
student_works:{url:"*/{work_id}", query, form:{_:1, PUT:{description:null,attachment_ids:null},GET:{}},config:{method:"PUT"},disp:"提交作业",
comment_list:{url:"{work_id}/*",query},
@@ -147,7 +151,8 @@ users:{
courses:{url:"{login}/*", query, form:{page:1, sort_by:"updated_at",sort_direction:"desc", per_page:10, category:void 0, status:void 0},category:["study","manage"],status:["processing","end"]},
get_user_info:{query,form:{school:1}},
homepage_info:{url:"{login}/*",query},
- shixuns: { url: "{login}/*", query, form: {sort_by:"updated_at" ,page:1, sort_direction:"desc",per_page:16}},
+ shixuns: { url: "{login}/*", query, form: {sort_by:"updated_at",category:void 0, page:1, sort_direction:"desc",per_page:16}},
+ subjects:{url:"{login}/*", query, form:{sort_by:"update_at", category:void 0, page:1, sort_direction:"desc"}},
system_update:{query:query},
/*{"system_update":true,"system_score":"为了给大家提供更优质的体验,平台将于2020年3月24日13:20开始对系统进行升级。升级期间系统响应会有一定的延迟。系统拟于2020年3月24日13:30恢复正常。\r\n请大家知悉,并提前做好教学安排。带来不便,敬请谅解。","subject":" educoder升级服务通知","start_time":"2020-03-24T13:20:00.000+08:00","end_time":"2020-03-24T13:30:00.000+08:00"}*/
tidings: {query, form:{type:void 0,page:1,per_page:10}, data:"type:course,project,interaction,apply,notice"},
@@ -167,6 +172,7 @@ weapps:{
delete_course_teachers:{url:"{course_id}/*",query, form:{course_member_ids:null},config:{method:"DELETE"}},
students: {url:"{course_id}/*", query, form:{page:1, limit: void 0}},
teachers: {url:"{course_id}/*", query, form:{page:1, limit: void 0}},
+
},
course_member_attendances:{query, form:{_:1, GET:{page:1, limit: 10},POST:{attendance_id:null, attendance_mode:null, code:void 0}}, config, disp:"课堂成员签到",
update_status:{query, config, form:{attendance_id:null, attendance_status:null, course_id:null, user_id:null}}
@@ -176,7 +182,7 @@ weapps:{
},
code_session: { query, form: {code: null, encrypted_data: null, iv: null }, config },
home: { query,form: { page: 1, limit: 15, category: "study"} },
- paths: {},
+ paths:{query, form:{order:"myshixuns_count", sort:"desc", page:1, limit:10, discipline_id: void 0,sub_discipline_id: void 0}},
register:{query,form:{login:null,password:null, code:null}, config},
session: {query,form:{login:null, password:null},config},
course_stickies:{query, form:{course_id:null, category:null},config,
diff --git a/miniprogram/js/client.js b/miniprogram/js/client.js
index 03c5940..b70abe2 100644
--- a/miniprogram/js/client.js
+++ b/miniprogram/js/client.js
@@ -38,6 +38,7 @@ export default class Client{
this.on("before", "users.accounts", getId);
this.on("before", "users.accounts.password", getLogin);
this.on("before","users.courses", getLogin);
+ this.on("before","users.subjects", getLogin);
this.on("before","users.homepage_info", getLogin);
this.on("before","users.accounts.avatar",getLogin);
this.on("before","users.unread_message_info", getLogin);
@@ -70,25 +71,33 @@ export default class Client{
})
}
getTidingInfo({login}={}){
+ let index = 2;
this.tidingGet = 1;
const handler = {
fail: res=>{this.tidingGet=0}
};
return this.api("users.unread_message_info")({login}).then(res => {
if (res.unread_message_count)
- wx.setTabBarBadge({ index: 1, text: res.unread_message_count.toString(),...handler});
+ wx.setTabBarBadge({ index, text: res.unread_message_count.toString(),...handler});
else if (res.unread_tiding_count)
- wx.showTabBarRedDot({index: 1,...handler});
+ wx.showTabBarRedDot({index,...handler});
else{
- wx.removeTabBarBadge({index:1});
- wx.hideTabBarRedDot({index:1});
+ wx.removeTabBarBadge({index});
+ wx.hideTabBarRedDot({index});
}
}).catch(e => {
console.error("getTidingInfo", e);
});
}
- async syncUser({ refresh = 0 } = {}) {
+ syncUser({refresh=0}={}){
+ if(!this.synching||!this.tmp_promise||!this.synch||refresh){
+ this.synching = 1;
+ this.tmp_promise = this._syncUser({refresh});
+ }
+ return this.tmp_promise;
+ }
+ async _syncUser({ refresh = 0 }) {
let old_id = this.user.user_id;
if(!this.synch||refresh){
let info = await this.callApi({name:"users.get_user_info"});
@@ -110,6 +119,7 @@ export default class Client{
}
}
+ this.synching = 0;
return {synch:this.synch,changed, user:this.user};
}
updateUserInfo(info){
diff --git a/miniprogram/js/utils.js b/miniprogram/js/utils.js
index 0b98b53..ed03881 100644
--- a/miniprogram/js/utils.js
+++ b/miniprogram/js/utils.js
@@ -105,6 +105,9 @@ class AccountManager{
this.accounts = []; //保存的账号信息
this.loadStorage();
}
+ get testAccount(){
+ return {login:"educoder_weapp@126.com", password:"abcdefgh"};
+ }
addAccount(account, sync=1){
if(!this.updateAccount(account))
this.accounts.push(account);
@@ -237,7 +240,7 @@ export function navigateToUrl({url,open_type='navigateTo'}){
return false;
}
-export function throttle(func, wait, options) {
+export function throttle(func, wait, options) {
var context = void 0;
var args = void 0;
var result = void 0;
@@ -267,4 +270,37 @@ export function throttle(func, wait, options) {
}
return result;
};
-};
\ No newline at end of file
+};
+
+export function RealTimeLogManager(){
+ const log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : null;
+ return {
+ debug() {
+ if (!log) return
+ log.debug.apply(log, arguments)
+ },
+ info() {
+ if (!log) return
+ log.info.apply(log, arguments)
+ },
+ warn() {
+ if (!log) return
+ log.warn.apply(log, arguments)
+ },
+ error() {
+ if (!log) return
+ log.error.apply(log, arguments)
+ },
+ setFilterMsg(msg) { // 从基础库2.7.3开始支持
+ if (!log || !log.setFilterMsg) return
+ if (typeof msg !== 'string') return
+ log.setFilterMsg(msg)
+ },
+ addFilterMsg(msg) { // 从基础库2.8.1开始支持
+ if (!log || !log.addFilterMsg) return
+ if (typeof msg !== 'string') return
+ log.addFilterMsg(msg)
+ }
+}
+}
+global.realTimeLog = RealTimeLogManager();
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/findmore.js b/miniprogram/pages/findmore/findmore.js
index 00bf8ec..36d5ec5 100644
--- a/miniprogram/pages/findmore/findmore.js
+++ b/miniprogram/pages/findmore/findmore.js
@@ -1,13 +1,21 @@
const app = getApp();
+const titleMap = ["实训项目", "实践课程","教学课堂"]
+const typeMap = {
+ shixun:0,
+ path:1,
+ course:2
+}
Page({
data: {
statusBarHeight: 20,
current: 0,
show: [1],
+ showSearch:1,
+ title:"实训项目",
list: [
- { text: "实训" ,type:"shixun"},
- { text: "课堂" , type:"course"},
- //{text:"课程"}
+ { text: "实训", type:"shixun"},
+ { text: "课程", type:"path"},
+ //{ text: "课堂", type:"course"}
]
},
enterSearch() {
@@ -22,18 +30,23 @@ Page({
},
})
},
+ switch({current}){
+ let title = titleMap[current];
+ this.setData({ ['show[' + current + ']']: 1,current, title});
+ },
switchNav({ target: { dataset: { current } } }) {
- this.setData({ current });
- this.setData({ ['show[' + current + ']']: 1 })
+ this.switch({current});
},
switchTab({ detail: { current, source, value } }) {
- console.log(current, source, value);
+ //console.log(current, source, value);
if (source == "touch") {
- this.setData({ current });
- this.setData({ ['show[' + current + ']']: 1 })
+ this.switch({current});
}
},
onShareAppMessage: function () {
-
+ let {list, current} = this.data;
+ return app.shareApp({
+ path:"/"+this.route+"?type="+list[current].type
+ })
}
})
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/findmore.json b/miniprogram/pages/findmore/findmore.json
index d3777c6..bfbfeb1 100644
--- a/miniprogram/pages/findmore/findmore.json
+++ b/miniprogram/pages/findmore/findmore.json
@@ -1,5 +1,10 @@
{
- "usingComponents": {},
+ "usingComponents": {
+ "paths":"./paths/paths",
+ "shixuns":"./shixuns/shixuns"
+ },
"navigationBarTitleText": "发现",
- "navigationStyle": "custom"
+ "navigationBarTextStyle": "white",
+ "navigationStyle": "custom",
+ "navigationBarBackgroundColor": "#00b0f0"
}
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/findmore.wxml b/miniprogram/pages/findmore/findmore.wxml
index edb0838..f540cd3 100644
--- a/miniprogram/pages/findmore/findmore.wxml
+++ b/miniprogram/pages/findmore/findmore.wxml
@@ -1,22 +1,9 @@
-
-
-
-
-
- 发现
-
-
-
- {{item.text}}
-
-
-
-
+
-
+
-
+
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/findmore.wxss b/miniprogram/pages/findmore/findmore.wxss
index 3d54365..1bf3657 100644
--- a/miniprogram/pages/findmore/findmore.wxss
+++ b/miniprogram/pages/findmore/findmore.wxss
@@ -1,48 +1,9 @@
+@import "../../includes/navigation-bar/navigation-bar.wxss";
page{
display: flex;
flex-direction: column;
height: 100%;
}
-.navigation{
- background: #00b0f0;
- flex: none;
-}
-.navigation-bar{
- height: 44px;
- padding-right: 100px;
- display: flex;
- align-items: center;
-}
-.navigation-left{
- width: 100px;
- display: flex;
- align-items: center;
- color: white;
-}
-.search{
- padding:0 8px;
-}
-.navbar{
- flex: 1 1 1px;
- width: 1px;
- border-radius: 7px;
- display: flex;
- text-align: center;
- white-space: nowrap;
- overflow-x: scroll;
-}
-.navitem{
- flex: auto;
- background: #00d0f0;
- color: white;
- padding: 5px 1px;
- transition: all ease 0.6s;
-}
-.navitem.active{
- color: #00b0f0;
- background: white;
-}
-
.body{
flex: 1 1 1px;
height: 1px;
diff --git a/miniprogram/pages/findmore/paths/path-item/path-item.js b/miniprogram/pages/findmore/paths/path-item/path-item.js
new file mode 100644
index 0000000..c7d05de
--- /dev/null
+++ b/miniprogram/pages/findmore/paths/path-item/path-item.js
@@ -0,0 +1,13 @@
+const app = getApp();
+Component({
+ properties: {
+ data:Object
+ },
+ data: {
+ eduUrl: global.config.eduUrl
+ },
+
+ methods: {
+
+ }
+})
diff --git a/miniprogram/components/shixun-item/shixun-item.json b/miniprogram/pages/findmore/paths/path-item/path-item.json
similarity index 100%
rename from miniprogram/components/shixun-item/shixun-item.json
rename to miniprogram/pages/findmore/paths/path-item/path-item.json
diff --git a/miniprogram/pages/findmore/paths/path-item/path-item.wxml b/miniprogram/pages/findmore/paths/path-item/path-item.wxml
new file mode 100644
index 0000000..160f7e4
--- /dev/null
+++ b/miniprogram/pages/findmore/paths/path-item/path-item.wxml
@@ -0,0 +1,6 @@
+
+
+
+ {{data.name}}
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/paths/path-item/path-item.wxss b/miniprogram/pages/findmore/paths/path-item/path-item.wxss
new file mode 100644
index 0000000..18e3031
--- /dev/null
+++ b/miniprogram/pages/findmore/paths/path-item/path-item.wxss
@@ -0,0 +1,15 @@
+.path-item{
+ padding: 12px;
+ display: flex;
+ background: white;
+}
+.image{
+ flex: none;
+ width: 250rpx;
+ height: 170rpx;
+ border-radius: 4px;
+ background: #221f53;
+}
+.detail{
+ padding-left: 8px;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/paths/paths.js b/miniprogram/pages/findmore/paths/paths.js
new file mode 100644
index 0000000..f69db54
--- /dev/null
+++ b/miniprogram/pages/findmore/paths/paths.js
@@ -0,0 +1,101 @@
+const app = getApp();
+Component({
+
+ properties: {
+
+ },
+
+ data: {
+ list: [],
+ subList:[],
+ subjects:[],
+ subCurrent:-1
+ },
+ pageLifetimes:{
+ show(){
+ if(!this.disciplines)
+ this.pullDisciplines();
+ }
+ },
+ attached(){
+ this.options = {page:1, limit:10};
+ this.pullDisciplines();
+ this.pullSubjects({refresh:1});
+ },
+
+
+ methods: {
+ pullSubjects({refresh=0}={}){
+ if(refresh){
+ if(refresh==1){
+ this.options.page = 1;
+ var { options } = this;
+ }else if(refresh==2){
+ var {page, per_page} = this.options;
+ var options = {...this.options,page:1, per_page: page*per_page};
+ }
+ }else{
+ this.options.page++;
+ var {options} = this;
+ }
+ return app.api("weapps.paths")(options).then(({subjects})=>{
+ let length = subjects.length;
+ if (!refresh){
+ subjects = this.data.subjects.concat(subjects);
+ var status = length>0?200:204;
+ }else{
+ var status = length>0?200:205;
+ }
+ this.setData({ subjects, status});
+ }).catch(e=>{
+ this.setData({subjects:[], status:e.code});
+ })
+ },
+ onPullDownRefresh(){
+ this.pullSubjects({refresh:2});
+ },
+ onReachBottom(){
+ if(this.data.status==200)
+ this.pullSubjects();
+ },
+ pullDisciplines(){
+ this.disciplines = [];
+ app.api("disciplines")({source:"subject"})
+ .then(res=>{
+ console.log(res);
+ this.disciplines = res.disciplines;
+ this.disciplines.unshift({id:"",name:"全部", sub_disciplines:[]});
+ this.setNavList({disciplines: this.disciplines, key:"list"});
+ //this.setNavList({disciplines: this.disciplines[0].sub_disciplines, key:"subList"});
+ }).catch(e=>{
+ this.disciplines = null;
+ })
+ },
+ setNavList({disciplines, key}){
+ let list = disciplines.map(i=>{
+ return {text: i.name, id: i.id};
+ })
+ this.setData({[key]: list});
+ },
+ onCateChange({detail}){
+ console.log(detail);
+ let {current, value} = detail;
+ this.options.discipline_id = value.id;
+ this.setNavList({disciplines: this.disciplines[current].sub_disciplines, key:"subList"});
+ this.setData({subCurrent:-1});
+ delete this.options.sub_discipline_id;
+ this.pullSubjects({refresh:1});
+ },
+ onSubCateChange({detail}){
+ console.log(detail);
+ let {current, value, source} = detail;
+ if(source!="touch")
+ return;
+ if(value.id)
+ this.options.sub_discipline_id = value.id;
+ else
+ delete this.options.sub_discipline_id;
+ this.pullSubjects({refresh:1});
+ }
+ }
+})
diff --git a/miniprogram/pages/findmore/paths/paths.json b/miniprogram/pages/findmore/paths/paths.json
new file mode 100644
index 0000000..ba7f619
--- /dev/null
+++ b/miniprogram/pages/findmore/paths/paths.json
@@ -0,0 +1,8 @@
+{
+ "component": true,
+ "usingComponents": {
+ "nav-bar":"/components/nav-bar/nav-bar",
+ "empty-page":"/components/empty-page/empty-page",
+ "path-item":"./path-item/path-item"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/paths/paths.wxml b/miniprogram/pages/findmore/paths/paths.wxml
new file mode 100644
index 0000000..5b848b8
--- /dev/null
+++ b/miniprogram/pages/findmore/paths/paths.wxml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/paths/paths.wxss b/miniprogram/pages/findmore/paths/paths.wxss
new file mode 100644
index 0000000..55e3f7d
--- /dev/null
+++ b/miniprogram/pages/findmore/paths/paths.wxss
@@ -0,0 +1,10 @@
+.path-body{
+ height: 100%;
+}
+.nav-wrp{
+ position: sticky;
+ top: 0;
+}
+.path-wrp{
+ margin-bottom: 2px;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.js b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.js
new file mode 100644
index 0000000..61b7dbf
--- /dev/null
+++ b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.js
@@ -0,0 +1,14 @@
+
+Component({
+ properties: {
+ data:Object
+ },
+
+ data: {
+ eduUrl: global.config.eduUrl
+ },
+
+ methods: {
+
+ }
+})
diff --git a/miniprogram/components/tiding-item/tiding-item.json b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.json
similarity index 100%
rename from miniprogram/components/tiding-item/tiding-item.json
rename to miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.json
diff --git a/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml
new file mode 100644
index 0000000..ea65652
--- /dev/null
+++ b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxml
@@ -0,0 +1,7 @@
+
+
+
+
+ 初级
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxss b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxss
new file mode 100644
index 0000000..e542b37
--- /dev/null
+++ b/miniprogram/pages/findmore/shixuns/shixun-item/shixun-item.wxss
@@ -0,0 +1,24 @@
+.shixun-item{
+ padding: 12px;
+ display: flex;
+ background: white;
+}
+.image{
+ flex: none;
+ width: 250rpx;
+ height: 170rpx;
+ border-radius: 4px;
+ background: #221f53;
+}
+.detail{
+ padding:0 0 4px 12px;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+}
+.level{
+ font-size: 12px;
+}
+.highlight{
+ color: #00b0f0;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/shixuns/shixuns.js b/miniprogram/pages/findmore/shixuns/shixuns.js
index fca97c7..653e588 100644
--- a/miniprogram/pages/findmore/shixuns/shixuns.js
+++ b/miniprogram/pages/findmore/shixuns/shixuns.js
@@ -1,23 +1,73 @@
-// pages/findmore/shixuns/shixuns.js
+
+const app = getApp();
Component({
- /**
- * 组件的属性列表
- */
properties: {
},
- /**
- * 组件的初始数据
- */
data: {
-
+ shixun_list:[]
+ },
+ attached(){
+ this.options = {page:1, limit: 10};
+ this.pullShixuns({refresh:1});
},
-
- /**
- * 组件的方法列表
- */
methods: {
-
+ clear(){
+ this.setData({keyword:"", showClear:0});
+ this.options.keyword = "";
+ this.pullShixuns({refresh:1});
+ },
+ onInput(e){
+ let {detail:{value}} = e;
+ if(this.data.showClear&&!value){
+ this.clear();
+ }else if(!this.data.showClear&&value){
+ this.setData({showClear:1});
+ }
+
+ },
+ onSubmit(e){
+ console.log(e)
+ let {detail:{value}} = e;
+ if(this.options.keyword!=value){
+ this.options.keyword = value;
+ this.pullShixuns({refresh:1});
+ }
+ },
+ onPullDownRefresh(){
+ this.pullShixuns({refresh:1});
+ },
+ onReachBottom(){
+ if(this.data.status==200)
+ this.pullShixuns();
+ },
+ pullShixuns({refresh=0}={}){
+ if(refresh){
+ if(refresh==1){
+ this.options.page = 1;
+ var { options } = this;
+ }else if(refresh==2){
+ var {page, per_page} = this.options;
+ var options = {...this.options,page:1, per_page: page*per_page};
+ }
+ }else{
+ this.options.page++;
+ var {options} = this;
+ }
+ wx.showNavigationBarLoading();
+ return app.api("shixun_lists")(options).then(({shixun_list})=>{
+ let length = shixun_list.length;
+ if (!refresh){
+ shixun_list = this.data.shixun_list.concat(shixun_list);
+ var status = length>0?200:204;
+ }else{
+ var status = length>0?200:205;
+ }
+ this.setData({ shixun_list, status}, wx.hideNavigationBarLoading);
+ }).catch(e=>{
+ this.setData({ shixun_list:[], status:e.code}, wx.hideNavigationBarLoading);
+ })
+ }
}
})
diff --git a/miniprogram/pages/findmore/shixuns/shixuns.json b/miniprogram/pages/findmore/shixuns/shixuns.json
index e8cfaaf..68d10e2 100644
--- a/miniprogram/pages/findmore/shixuns/shixuns.json
+++ b/miniprogram/pages/findmore/shixuns/shixuns.json
@@ -1,4 +1,7 @@
{
"component": true,
- "usingComponents": {}
+ "usingComponents": {
+ "empty-page":"/components/empty-page/empty-page",
+ "shixun-item":"./shixun-item/shixun-item"
+ }
}
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/shixuns/shixuns.wxml b/miniprogram/pages/findmore/shixuns/shixuns.wxml
index 176f53f..dfece4f 100644
--- a/miniprogram/pages/findmore/shixuns/shixuns.wxml
+++ b/miniprogram/pages/findmore/shixuns/shixuns.wxml
@@ -1,2 +1,17 @@
-
-pages/findmore/shixuns/shixuns.wxml
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/findmore/shixuns/shixuns.wxss b/miniprogram/pages/findmore/shixuns/shixuns.wxss
index cd9181f..b2efed1 100644
--- a/miniprogram/pages/findmore/shixuns/shixuns.wxss
+++ b/miniprogram/pages/findmore/shixuns/shixuns.wxss
@@ -1 +1,25 @@
-/* pages/findmore/shixuns/shixuns.wxss */
\ No newline at end of file
+.shixun-body{
+ height: 100%;
+}
+.header{
+ top: 0;
+ position: sticky;
+ background: white;
+ padding: 4px 12px;
+}
+.input-wrp{
+ display: flex;
+ padding: 4px 10px;
+ border-radius: 4px;
+ border: 1px #00b0f0 solid;
+}
+.input{
+ flex: auto;
+}
+.icon{
+ flex: none;
+}
+
+.shixun-wrp{
+ margin-bottom: 2px;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/main/main.js b/miniprogram/pages/main/main.js
index d56159d..02ba964 100644
--- a/miniprogram/pages/main/main.js
+++ b/miniprogram/pages/main/main.js
@@ -1,17 +1,34 @@
const app = getApp();
+const typeMap = {
+ course: 0,
+ shixun: 1,
+ path: 2,
+ subject:2
+}
+const titleMap = {
+ course:"教学课堂",
+ shixun:"实训项目",
+ path:"实践课程"
+}
Page({
data:{
statusBarHeight:20,
current:0,
show:[1],
+ showSearch:0,
+ title:"我的教学课堂",
list:[
{text:"课堂", type:"course"},
{text:"实训", type:"shixun"},
- //{text:"课程"}
+ {text:"课程", type:"path"}
]
},
- onLoad(){
+ onLoad(options){
+ if(options.type){
+ let current = typeMap[options.type]||0;
+ this.switch({current});
+ }
wx.getSystemInfo({
success: res=>{
let {statusBarHeight} = res;
@@ -23,18 +40,23 @@ Page({
let type = this.data.list[this.data.current].type||'';
app.navigateTo({url:`{search}?type=${type}`});
},
+ switch({current}){
+ let title = "我的"+titleMap[this.data.list[current].type];
+ this.setData({['show['+current+']']:1, current, title})
+ },
switchNav({target:{dataset:{current}}}){
- this.setData({current});
- this.setData({['show['+current+']']:1})
+ this.switch({current});
},
switchTab({detail:{current, source, value}}){
- console.log(current, source, value);
+ //console.log(current, source, value);
if(source=="touch"){
- this.setData({ current });
- this.setData({ ['show[' + current + ']']: 1 })
+ this.switch({current});
}
},
onShareAppMessage(){
-
+ let {list, current} = this.data;
+ return app.showApp({
+ path: "/"+this.route+"?type="+list[current].type
+ })
}
})
\ No newline at end of file
diff --git a/miniprogram/pages/main/main.json b/miniprogram/pages/main/main.json
index 4ccbd74..dda9b16 100644
--- a/miniprogram/pages/main/main.json
+++ b/miniprogram/pages/main/main.json
@@ -3,7 +3,9 @@
"usingComponents": {
"add-tips": "/components/add-tips/add-tips",
"my-course":"./my_course/my_course",
- "my-shixun":"./my_shixun/my_shixun"
+ "my-shixun":"./my_shixun/my_shixun",
+ "my-path":"../my_path/my_path"
},
- "navigationBarTextStyle": "white"
+ "navigationBarTextStyle": "white",
+ "navigationBarBackgroundColor": "#00b0f0"
}
\ No newline at end of file
diff --git a/miniprogram/pages/main/main.wxml b/miniprogram/pages/main/main.wxml
index f6ab07a..8f4dcaf 100644
--- a/miniprogram/pages/main/main.wxml
+++ b/miniprogram/pages/main/main.wxml
@@ -1,17 +1,5 @@
-
-
-
-
-
- 我的
-
-
-
- {{item.text}}
-
-
-
-
+
+
@@ -19,6 +7,9 @@
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/main/main.wxss b/miniprogram/pages/main/main.wxss
index 3d54365..67c6ef4 100644
--- a/miniprogram/pages/main/main.wxss
+++ b/miniprogram/pages/main/main.wxss
@@ -1,48 +1,9 @@
+@import "../../includes//navigation-bar/navigation-bar.wxss";
page{
display: flex;
flex-direction: column;
height: 100%;
}
-.navigation{
- background: #00b0f0;
- flex: none;
-}
-.navigation-bar{
- height: 44px;
- padding-right: 100px;
- display: flex;
- align-items: center;
-}
-.navigation-left{
- width: 100px;
- display: flex;
- align-items: center;
- color: white;
-}
-.search{
- padding:0 8px;
-}
-.navbar{
- flex: 1 1 1px;
- width: 1px;
- border-radius: 7px;
- display: flex;
- text-align: center;
- white-space: nowrap;
- overflow-x: scroll;
-}
-.navitem{
- flex: auto;
- background: #00d0f0;
- color: white;
- padding: 5px 1px;
- transition: all ease 0.6s;
-}
-.navitem.active{
- color: #00b0f0;
- background: white;
-}
-
.body{
flex: 1 1 1px;
height: 1px;
diff --git a/miniprogram/components/course-item/course-item.js b/miniprogram/pages/main/my_course/course-item/course-item.js
similarity index 100%
rename from miniprogram/components/course-item/course-item.js
rename to miniprogram/pages/main/my_course/course-item/course-item.js
diff --git a/miniprogram/components/course-item/course-item.json b/miniprogram/pages/main/my_course/course-item/course-item.json
similarity index 78%
rename from miniprogram/components/course-item/course-item.json
rename to miniprogram/pages/main/my_course/course-item/course-item.json
index 2ea3b8c..38ed8ad 100644
--- a/miniprogram/components/course-item/course-item.json
+++ b/miniprogram/pages/main/my_course/course-item/course-item.json
@@ -1,7 +1,7 @@
{
"component": true,
"usingComponents": {
- "iconfont":"../iconfont/iconfont",
+ "iconfont":"/components/iconfont/iconfont",
"mp-icon": "/weui-miniprogram/icon/icon"
},
"navigationBarBackgroundColor": "#00b0f0",
diff --git a/miniprogram/components/course-item/course-item.wxml b/miniprogram/pages/main/my_course/course-item/course-item.wxml
similarity index 100%
rename from miniprogram/components/course-item/course-item.wxml
rename to miniprogram/pages/main/my_course/course-item/course-item.wxml
diff --git a/miniprogram/components/course-item/course-item.wxss b/miniprogram/pages/main/my_course/course-item/course-item.wxss
similarity index 87%
rename from miniprogram/components/course-item/course-item.wxss
rename to miniprogram/pages/main/my_course/course-item/course-item.wxss
index 21e077c..165382e 100644
--- a/miniprogram/components/course-item/course-item.wxss
+++ b/miniprogram/pages/main/my_course/course-item/course-item.wxss
@@ -2,7 +2,7 @@
background-image: linear-gradient(to bottom right,#FEAC5E, #C779D0,#4BC0C8);/*#FEAC5E, #C779D0,#4BC0C8*/
}
.bg1{
- background-image: linear-gradient(to bottom right,#f8cdda, #1d2b64);/*#f8cdda, #1d2b64*/
+ background-image: linear-gradient(to bottom right, #716da3, #ae5b84, #d76d77);/*#f8cdda, #1d2b64*/
}
.bg2{
background-image: linear-gradient(to bottom right, #43cea2, #185a9d);/*#43cea2, #185a9d*/
@@ -14,7 +14,7 @@
background-image: linear-gradient(to bottom right, #b92b27, #1565c0);/*#b92b27, #1565c0*/
}
.bg5{
- background-image: linear-gradient(to bottom right,#5fc3e4, #e55d87);/*#5fc3e4, #e55d87*/
+ background-image: linear-gradient(to bottom right,#4f2f54,#505587, #755d97);/*#5fc3e4, #e55d87*/
}
.bg6{
background-image: linear-gradient(to bottom right, #3a1c71, #d76d77, #ffaf7b);/*#3a1c71, #d76d77, #ffaf7b*/
diff --git a/miniprogram/pages/main/my_course/my_course.json b/miniprogram/pages/main/my_course/my_course.json
index 852d9cd..1b0512d 100644
--- a/miniprogram/pages/main/my_course/my_course.json
+++ b/miniprogram/pages/main/my_course/my_course.json
@@ -4,7 +4,7 @@
"join-course-modal": "/components/modal/join-course/join-course",
"require-login": "/components/require-login/require-login",
"nav-bar": "/components/nav-bar/nav-bar",
- "course-item": "/components/course-item/course-item",
+ "course-item": "./course-item/course-item",
"mp-icon": "/weui-miniprogram/icon/icon"
}
}
\ No newline at end of file
diff --git a/miniprogram/pages/main/my_path/my_path.js b/miniprogram/pages/main/my_path/my_path.js
new file mode 100644
index 0000000..31c3120
--- /dev/null
+++ b/miniprogram/pages/main/my_path/my_path.js
@@ -0,0 +1,87 @@
+const app = getApp();
+// status:[0, 204, 205, 200]
+Component({
+ properties: {
+
+ },
+
+ data: {
+ shixuns:[],
+ status:0,
+ cates:[
+ {text:'全部',value:""},
+ {text:'我学习的',value:"study"},
+ {text:'我管理的',value:"manage"},
+ {text:"我收藏的",value:"collect"}
+ ]
+ },
+ pageLifetimes: {
+ show(){
+ this.refresh();
+ }
+ },
+ attached(){
+ this.options = {page:1, per_page:16};
+ this.refresh();
+ },
+ methods: {
+ onCateChange({detail:{value}}){
+ console.log(value);
+ this.options.category = value.value
+ this.pullPaths({refresh:1});
+ },
+ refresh(){
+ app.syncUser()
+ .then(res => {
+ if (res.user.user_id != this.user_id) {
+ if(res.user_id==2)
+ this.setData({shixuns:[]})
+ else
+ this.pullPaths({ refresh: 1 })
+ this.user_id = res.user.user_id;
+ }else if(this.data.status==200){
+ this.pullPaths({refresh:2});
+ }
+ })
+ },
+ setStatus(status){
+ this.setData({status});
+ },
+ pullPaths({refresh=0}={}){
+ if(refresh){
+ if(refresh==1){
+ this.options.page = 1;
+ var { options } = this;
+ }else if(refresh==2){
+ var {page, per_page, category=""} = this.options;
+ var options = {page:1, per_page: page*per_page, category};
+ }
+ //this.setStatus(1);
+ }else{
+ this.options.page++;
+ var {options} = this;
+ //this.setStatus(100);
+ }
+ return app.api("users.subjects")(options).then(({subjects})=>{
+ let length = subjects.length;
+ if (!refresh){
+ subjects = this.data.subjects.concat(subjects);
+ var status = length>0?200:204;
+ }else{
+ var status = length>0?200:205;
+ }
+ this.setData({ subjects, status});
+ }).catch(e=>{
+ this.setData({subjects:[], status:e.code});
+ })
+ },
+ onPullDownRefresh(){
+ this.pullPaths({refresh:2});
+ },
+ onReachBottom(){
+ console.log("onreachbottom")
+ if(this.data.status==200)
+ this.pullPaths({refresh:0});
+ }
+ }
+})
diff --git a/miniprogram/pages/main/my_path/my_path.json b/miniprogram/pages/main/my_path/my_path.json
new file mode 100644
index 0000000..bde129b
--- /dev/null
+++ b/miniprogram/pages/main/my_path/my_path.json
@@ -0,0 +1,9 @@
+{
+ "component": true,
+ "usingComponents": {
+ "nav-bar": "/components/nav-bar/nav-bar",
+ "path-item":"./path-item/path-item",
+ "empty-page":"/components/empty-page/empty-page",
+ "require-login":"/components/require-login/require-login"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/main/my_path/my_path.wxml b/miniprogram/pages/main/my_path/my_path.wxml
new file mode 100644
index 0000000..797abce
--- /dev/null
+++ b/miniprogram/pages/main/my_path/my_path.wxml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/main/my_path/my_path.wxss b/miniprogram/pages/main/my_path/my_path.wxss
new file mode 100644
index 0000000..59289bd
--- /dev/null
+++ b/miniprogram/pages/main/my_path/my_path.wxss
@@ -0,0 +1,14 @@
+.my-path {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.path-wrap {
+ margin: 2px 0;
+}
+
+.body {
+ flex: 1 1 1px;
+ height: 1px;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/main/my_path/path-item/path-item.js b/miniprogram/pages/main/my_path/path-item/path-item.js
new file mode 100644
index 0000000..7cededc
--- /dev/null
+++ b/miniprogram/pages/main/my_path/path-item/path-item.js
@@ -0,0 +1,20 @@
+
+Component({
+ properties: {
+ data:{
+ type:Object,
+ observer:function(data){
+ //name, image_url
+ //console.log(data);
+ this.setData(data);
+ }
+ }
+ },
+ data: {
+ eduUrl:global.config.eduUrl
+ },
+ methods: {
+
+ }
+
+})
diff --git a/miniprogram/pages/main/my_path/path-item/path-item.json b/miniprogram/pages/main/my_path/path-item/path-item.json
new file mode 100644
index 0000000..7e37c03
--- /dev/null
+++ b/miniprogram/pages/main/my_path/path-item/path-item.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/miniprogram/pages/main/my_path/path-item/path-item.wxml b/miniprogram/pages/main/my_path/path-item/path-item.wxml
new file mode 100644
index 0000000..956e6a8
--- /dev/null
+++ b/miniprogram/pages/main/my_path/path-item/path-item.wxml
@@ -0,0 +1,8 @@
+
+
+
+
+ {{name}}
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/main/my_path/path-item/path-item.wxss b/miniprogram/pages/main/my_path/path-item/path-item.wxss
new file mode 100644
index 0000000..9b5282e
--- /dev/null
+++ b/miniprogram/pages/main/my_path/path-item/path-item.wxss
@@ -0,0 +1,28 @@
+.path {
+ background: white;
+ padding: 10px 8px;
+ overflow: hidden;
+ word-wrap: break-word;
+ display: flex;
+}
+
+.path-img {
+ flex: none;
+ width: 250rpx;
+ height: 170rpx;
+ border-radius: 4px;
+ background: #221f53;
+}
+
+.detail {
+ padding-top: 6px;
+ flex: auto;
+ width: 1px;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+}
+
+.name {
+ padding-left: 8px;
+}
diff --git a/miniprogram/pages/main/my_shixun/my_shixun.js b/miniprogram/pages/main/my_shixun/my_shixun.js
index 9e6085e..1e1c447 100644
--- a/miniprogram/pages/main/my_shixun/my_shixun.js
+++ b/miniprogram/pages/main/my_shixun/my_shixun.js
@@ -1,11 +1,19 @@
const app = getApp();
+// status:[0, 204, 205, 200]
Component({
properties: {
},
data: {
- shixuns:[]
+ shixuns:[],
+ status:0,
+ cates:[
+ {text:'全部',value:""},
+ {text:'我学习的',value:"study"},
+ {text:'我管理的',value:"manage"},
+ {text:"我收藏的",value:"collect"}
+ ]
},
pageLifetimes: {
show(){
@@ -17,6 +25,11 @@ Component({
this.refresh();
},
methods: {
+ onCateChange({detail:{value}}){
+ console.log(value);
+ this.options.category = value.value
+ this.pullShixuns({refresh:1});
+ },
refresh(){
app.syncUser()
.then(res => {
@@ -26,35 +39,49 @@ Component({
else
this.pullShixuns({ refresh: 1 })
this.user_id = res.user.user_id;
+ }else if(this.data.status==200){
+ this.pullShixuns({refresh:2});
}
})
},
+ setStatus(status){
+ this.setData({status});
+ },
pullShixuns({refresh=0}={}){
if(refresh){
if(refresh==1){
this.options.page = 1;
var { options } = this;
}else if(refresh==2){
- var {page, per_page} = this.options;
- var options = {page:1, per_page: page*per_page};
+ var {page, per_page, category=""} = this.options;
+ var options = {page:1, per_page: page*per_page, category};
}
+ //this.setStatus(1);
}else{
this.options.page++;
var {options} = this;
+ //this.setStatus(100);
}
return app.api("users.shixuns")(options).then(({shixuns})=>{
- if (!refresh)
+ let length = shixuns.length;
+ if (!refresh){
shixuns = this.data.shixuns.concat(shixuns);
- this.setData({ shixuns });
+ var status = length>0?200:204;
+ }else{
+ var status = length>0?200:205;
+ }
+ this.setData({ shixuns, status});
}).catch(e=>{
- this.setData({shixuns:[]});
+ this.setData({shixuns:[], status:e.code});
})
},
onPullDownRefresh(){
this.pullShixuns({refresh:2});
},
onReachBottom(){
- this.pullShixuns({refresh:0});
+ console.log("onreachbottom")
+ if(this.data.status==200)
+ this.pullShixuns({refresh:0});
}
}
})
diff --git a/miniprogram/pages/main/my_shixun/my_shixun.json b/miniprogram/pages/main/my_shixun/my_shixun.json
index 1edb765..d209db7 100644
--- a/miniprogram/pages/main/my_shixun/my_shixun.json
+++ b/miniprogram/pages/main/my_shixun/my_shixun.json
@@ -2,7 +2,8 @@
"component": true,
"usingComponents": {
"nav-bar": "/components/nav-bar/nav-bar",
- "shixun-item":"/components/shixun-item/shixun-item",
+ "shixun-item":"./shixun-item/shixun-item",
+ "empty-page":"/components/empty-page/empty-page",
"require-login":"/components/require-login/require-login"
}
}
\ No newline at end of file
diff --git a/miniprogram/pages/main/my_shixun/my_shixun.wxml b/miniprogram/pages/main/my_shixun/my_shixun.wxml
index 09bb431..116471a 100644
--- a/miniprogram/pages/main/my_shixun/my_shixun.wxml
+++ b/miniprogram/pages/main/my_shixun/my_shixun.wxml
@@ -1,8 +1,10 @@
-
+
+
+
\ No newline at end of file
diff --git a/miniprogram/components/shixun-item/shixun-item.js b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.js
similarity index 62%
rename from miniprogram/components/shixun-item/shixun-item.js
rename to miniprogram/pages/main/my_shixun/shixun-item/shixun-item.js
index 9954b1e..d2d7458 100644
--- a/miniprogram/components/shixun-item/shixun-item.js
+++ b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.js
@@ -6,10 +6,10 @@ Component({
type:Object,
observer:function(data){
//name, image_url
- this.setData({shixun:data});
+ //console.log(data);
+ this.setData(data);
}
- },
- origin:String
+ }
},
data: {
eduUrl:global.config.eduUrl
@@ -17,7 +17,7 @@ Component({
methods: {
onTap(){
- app.navigateTo({url:"{shixun}?identifier="+this.data.shixun.identifier})
+ app.navigateTo({url:"{shixun}?identifier="+this.data.identifier})
}
}
})
diff --git a/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.json b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.json
new file mode 100644
index 0000000..e8cfaaf
--- /dev/null
+++ b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml
new file mode 100644
index 0000000..c7f3c97
--- /dev/null
+++ b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxml
@@ -0,0 +1,13 @@
+
+
+
+
+ {{name}}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxss b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxss
new file mode 100644
index 0000000..5a67660
--- /dev/null
+++ b/miniprogram/pages/main/my_shixun/shixun-item/shixun-item.wxss
@@ -0,0 +1,34 @@
+.shixun{
+ background: white;
+ padding: 10px 8px;
+ overflow: hidden;
+ word-wrap: break-word;
+ display: flex;
+}
+
+.shixun-img{
+ flex:none;
+ width: 250rpx;
+ height: 170rpx;
+ border-radius: 4px;
+ background: #221f53;
+}
+.detail{
+ padding-top: 6px;
+ flex: auto;
+ width: 1px;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+}
+.name{
+ padding-left: 8px;
+}
+.progress-wrp{
+ padding: 10px;
+}
+.finish-text{
+ font-size: 12px;
+ font-weight: bold;
+ padding-left: 6px;
+}
\ No newline at end of file
diff --git a/miniprogram/pages/search/search-item/search-item.js b/miniprogram/pages/search/search-item/search-item.js
index 6047f81..5c94620 100644
--- a/miniprogram/pages/search/search-item/search-item.js
+++ b/miniprogram/pages/search/search-item/search-item.js
@@ -9,13 +9,25 @@ Component({
},
methods: {
+ enterInvite(){
+ let {type, id} = this.data.data;
+ let {envVersion} = global.config;
+ if(envVersion!='develop'&&envVersion!='trial')
+ return;
+ if(type=='course')
+ app.navigateTo({url:"{course_invite}?course_id="+id});
+ },
enterPage(){
- let {type} = this.data.data;
+ let {type, id, identifier} = this.data.data;
switch(type){
case 'shixun':
- return app.navigateTo({ url: "{shixun}?identifier=" + this.data.data.identifier});
+ return app.navigateTo({ url: "{shixun}?identifier=" + identifier});
case "course":
- return app.navigateTo({url:"{course}?course_id="+this.data.data.id});
+ return app.navigateTo({url:"{course}?course_id="+id});
+ case "subject":
+ case "path":
+ return app.navigateTo({url:"{path}?subject_id="+id});
+
}
}
}
diff --git a/miniprogram/pages/search/search-item/search-item.wxml b/miniprogram/pages/search/search-item/search-item.wxml
index 4103905..7bb199e 100644
--- a/miniprogram/pages/search/search-item/search-item.wxml
+++ b/miniprogram/pages/search/search-item/search-item.wxml
@@ -1,4 +1,4 @@
-
+
diff --git a/miniprogram/pages/search/search.js b/miniprogram/pages/search/search.js
index 91bd6c7..f4f97ae 100644
--- a/miniprogram/pages/search/search.js
+++ b/miniprogram/pages/search/search.js
@@ -1,9 +1,16 @@
const app = getApp();
+const typeMap = {
+ shixun:{current:0, type:"shixun"},
+ path: {current:1, type:"subject"},
+ subject:{current:1, type:"subject"},
+ course:{current:2, type:"course"}
+}
Page({
data: {
keyword:"",
list:[
{text:"实训项目", type:"shixun"},
+ {text:"实践课程", type:"subject"},
{text:"教学课堂", type:"course"}
]
},
@@ -25,6 +32,7 @@ Page({
this.search({refresh:1});
},
search({refresh=0}={}){
+ //console.log("search", this.options);
if(refresh==1)
this.setData({loading:1});
if(refresh){
@@ -39,6 +47,7 @@ Page({
this.options.page++;
var {options} = this;
}
+ //console.log("search2",options)
return app.api("search")(options)
.then(res=>{
console.error(res);
@@ -57,15 +66,11 @@ Page({
})
},
onLoad: function (options) {
- var {type="shixun", keyword=""} = options;
+ let {type:_type="shixun", keyword=""} = options;
+ let {type, current} = typeMap[_type]||typeMap["shixun"];
this.options = {page:1, per_page:20, type, keyword};
this.search({ refresh: 1 });
- for (var current=this.data.list.length-1; current >=0; current--){
- if(this.data.list[current].type==type)
- break;
- }
this.setData({keyword, current});
- console.log(this.data);
},
diff --git a/miniprogram/components/tiding-item/tiding-item.js b/miniprogram/pages/tidings/tiding-item/tiding-item.js
similarity index 94%
rename from miniprogram/components/tiding-item/tiding-item.js
rename to miniprogram/pages/tidings/tiding-item/tiding-item.js
index 2538980..2772b19 100644
--- a/miniprogram/components/tiding-item/tiding-item.js
+++ b/miniprogram/pages/tidings/tiding-item/tiding-item.js
@@ -1,5 +1,5 @@
const app = getApp();
-const { processObj, get, format } = require("../../js/utils");
+const { processObj, get, format } = require("../../../js/utils");
const ROUTE = {
Course:{
diff --git a/miniprogram/pages/tidings/tiding-item/tiding-item.json b/miniprogram/pages/tidings/tiding-item/tiding-item.json
new file mode 100644
index 0000000..e8cfaaf
--- /dev/null
+++ b/miniprogram/pages/tidings/tiding-item/tiding-item.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/miniprogram/components/tiding-item/tiding-item.wxml b/miniprogram/pages/tidings/tiding-item/tiding-item.wxml
similarity index 100%
rename from miniprogram/components/tiding-item/tiding-item.wxml
rename to miniprogram/pages/tidings/tiding-item/tiding-item.wxml
diff --git a/miniprogram/components/tiding-item/tiding-item.wxss b/miniprogram/pages/tidings/tiding-item/tiding-item.wxss
similarity index 100%
rename from miniprogram/components/tiding-item/tiding-item.wxss
rename to miniprogram/pages/tidings/tiding-item/tiding-item.wxss
diff --git a/miniprogram/pages/tidings/tidings.js b/miniprogram/pages/tidings/tidings.js
index 0c51c4a..dbde15a 100644
--- a/miniprogram/pages/tidings/tidings.js
+++ b/miniprogram/pages/tidings/tidings.js
@@ -46,9 +46,10 @@ Page({
this.refresh();
},
onShow: function () {
+ let index = 2;
this.refresh({refresh:2})
- wx.hideTabBarRedDot({index: 1});
- wx.removeTabBarBadge({index: 1});
+ wx.hideTabBarRedDot({index});
+ wx.removeTabBarBadge({index});
},
onPullDownRefresh: function () {
diff --git a/miniprogram/pages/tidings/tidings.json b/miniprogram/pages/tidings/tidings.json
index 67fed7a..9692017 100644
--- a/miniprogram/pages/tidings/tidings.json
+++ b/miniprogram/pages/tidings/tidings.json
@@ -1,6 +1,6 @@
{
"usingComponents": {
- "tiding-item":"/components/tiding-item/tiding-item",
+ "tiding-item":"./tiding-item/tiding-item",
"nav-bar":"/components/nav-bar/nav-bar",
"error-page":"/components/error-page/error-page"
},
diff --git a/miniprogram/path/pages/path/path.js b/miniprogram/path/pages/path/path.js
index a15ad70..cb7f087 100644
--- a/miniprogram/path/pages/path/path.js
+++ b/miniprogram/path/pages/path/path.js
@@ -1,66 +1,90 @@
-// miniprogram/path/pages/path/path.js
+const app = getApp();
Page({
- /**
- * 页面的初始数据
- */
data: {
-
+ cates:[
+ {text:"章节"},
+ {text:"介绍"}
+ ]
},
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
-
+ onSwitch({detail}){
+ let {source, current} = detail
+ if(source=='touch'){
+ this.setData({current});
+ }
},
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
+ 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=>{
+ console.log(res);
+ this.pullSubject({showLoading:0});
+ if(is_collect){
+ res.message = "已取消收藏";
+ var icon = "success";
+ var duration = 1500;
+ }else{
+ var icon = "none";
+ var duration = 3000;
+ }
+ wx.showToast({
+ title: res.message,
+ icon,
+ duration
+ })
+ }).catch(e=>{
+ //console.log(e);
+ app.showError(e);
+ })
},
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
+ scrollTo({scrollTop}){
+ wx.pageScrollTo({scrollTop,duration:380})
},
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
+ onLoad: function (options) {
+ this.subject_id = options.path_id||options.subject_id;
+ this.pullSubject();
},
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
+ onEnterShixun(e){
+ console.log(e.currentTarget);
+ let {currentTarget:{dataset:{allow_visit}}} = e;
+ if(!allow_visit)
+ wx.showToast({
+ title: '该实训暂未公开',icon:"none"
+ })
},
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
+ pullSubject({showLoading=1}={}){
+ if(showLoading)
+ wx.showLoading({
+ title: '努力加载中'
+ });
+ let {subject_id} = this;
+ let promise1 = app.api("paths")({subject_id})
+ let promise2 = app.api("paths.right_banner")({subject_id})
+ let promise3 = app.api("stages")({subject_id})
+ Promise.all([promise1, promise2, promise3])
+ .then(res=>{
+ this.setData({subject:res[0], ...res[1], ...res[2]},
+ res=>{
+ if(showLoading)
+ wx.hideLoading()
+ });
+ }).catch(e=>{
+ if(e.code==403)
+ e.message = "您没有权限访问"
+ console.log(e);
+ wx.hideLoading();
+ app.showError(e);
+ })
},
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
- /**
- * 用户点击右上角分享
- */
onShareAppMessage: function () {
-
+ //console.log(global.config.apiRoot , this.data.subject.cover )
+ let {subject} = this.data;
+ return app.shareApp({
+ title: subject.name,
+ imageUrl: global.config.eduUrl + "/" + subject.cover
+ })
}
})
\ No newline at end of file
diff --git a/miniprogram/path/pages/path/path.json b/miniprogram/path/pages/path/path.json
index 8835af0..bb0c564 100644
--- a/miniprogram/path/pages/path/path.json
+++ b/miniprogram/path/pages/path/path.json
@@ -1,3 +1,8 @@
{
- "usingComponents": {}
+ "usingComponents": {
+ "nav-bar":"/components/nav-bar/nav-bar",
+ "rich-md":"/components/rich-md/rich-md",
+ "mp-icon":"/weui-miniprogram/icon/icon"
+ },
+ "navigationBarTitleText": "实践课程"
}
\ No newline at end of file
diff --git a/miniprogram/path/pages/path/path.wxml b/miniprogram/path/pages/path/path.wxml
index c63e4b2..5470e6f 100644
--- a/miniprogram/path/pages/path/path.wxml
+++ b/miniprogram/path/pages/path/path.wxml
@@ -1,2 +1,85 @@
-
-miniprogram/path/pages/path/path.wxml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{stage.stage_position}}-{{index+1}}
+ {{shixun.shixun_name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.tag_name}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/path/pages/path/path.wxs b/miniprogram/path/pages/path/path.wxs
new file mode 100644
index 0000000..000582a
--- /dev/null
+++ b/miniprogram/path/pages/path/path.wxs
@@ -0,0 +1,15 @@
+var top = 190;
+function scroll(e, ins){
+ //var scrollTop = e.detail.scrollTop;
+ var deltaY = e.detail.deltaY;
+ //console.log(scrollTop);
+ //console.log(show,scrollTop<122);
+ //console.log(top,scrollTop, deltaY);
+ if(deltaY<-4){
+ ins.callMethod("scrollTo", { scrollTop: top });
+ }
+}
+
+module.exports={
+ scroll: scroll
+}
\ No newline at end of file
diff --git a/miniprogram/path/pages/path/path.wxss b/miniprogram/path/pages/path/path.wxss
index 061c509..c77a194 100644
--- a/miniprogram/path/pages/path/path.wxss
+++ b/miniprogram/path/pages/path/path.wxss
@@ -1 +1,103 @@
-/* miniprogram/path/pages/path/path.wxss */
\ No newline at end of file
+
+.header{
+ background: white;
+ margin-bottom: 4px;
+ border-bottom: 1px #eee solid;
+}
+.title{
+ font-size: 18px;
+ padding: 10px;
+ font-weight: bold;
+}
+.subject-detail{
+ display: flex;
+ justify-content: space-evenly;
+}
+
+.detail-item{
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ flex: 1;
+ font-size: 12px;
+}
+.detail-item>.key{
+ padding-bottom: 4px;
+}
+.detail-item>.value{
+ color: #009af0;
+ font-weight: bold;
+}
+.progress-wrp{
+ padding: 12px;
+}
+.progress-wrp .score{
+ padding-left: 8px;
+ font-size: 11px;
+ font-weight: bold;
+}
+
+.body{
+ background: white;
+ height: calc(100vh - 76px);
+}
+.cate-body{
+ height: 100%;
+}
+.shixun{
+ display: flex;
+ padding: 7px 6px 7px 12px;
+ align-items: center;
+}
+.shixun.forbidden{
+ color: gray;
+}
+.shixun-index,
+.shixun-icon{
+ margin-right: 6px;
+}
+.cate-header{
+ padding-left: 8px;
+}
+.cate-header.stage_name{
+ margin: 5px 0;
+}
+.cate-header>.cate-name{
+ padding-left: 10px;
+}
+.cate-header>.square{
+ width: 0;
+ height: 0px;
+ border-radius: 10px;
+ border-left: 5px solid #00b0f0;
+}
+.tags-list{
+ display: flex;
+ flex-wrap: wrap;
+ overflow-y: scroll;
+ padding: 6px;
+ max-height: 50vh;
+ font-size: 12px;
+ margin-top: 8px;
+}
+.tags-list>.tag{
+ background: #f0f0f0;
+ color: #666;
+ border-radius: 30px;
+ padding: 4px 10px;
+ margin: 4px;
+ flex: none;
+}
+.tags-list>.tag.active{
+ color: white;
+ background: #00b0f0;
+}
+.operations{
+ position: sticky;
+ bottom: 0;
+ display: flex;
+}
+.operations>.collect{
+ background: white!important;
+ flex: 1;
+}
\ No newline at end of file
diff --git a/miniprogram/shixun/pages/shixun/shixun.js b/miniprogram/shixun/pages/shixun/shixun.js
index 3b7128a..3005cbe 100644
--- a/miniprogram/shixun/pages/shixun/shixun.js
+++ b/miniprogram/shixun/pages/shixun/shixun.js
@@ -13,8 +13,30 @@ Page({
],
description:""
},
- log(e){
- console.log(e)
+ collect(){
+ let {id, is_collect} = this.data.shixun;
+ let api_name = is_collect?"collections.cancel":"collections";
+ app.api(api_name)({container_type:"Shixun", container_id:id})
+ .then(res=>{
+ console.log(res);
+ this.pullShixun({showLoading: 0});
+ if(is_collect){
+ res.message = "已取消收藏";
+ var icon = "success";
+ var duration = 1500;
+ }else{
+ var icon = "none";
+ var duration = 3000;
+ }
+ wx.showToast({
+ title: res.message,
+ icon,
+ duration
+ })
+ }).catch(e=>{
+ //console.log(e);
+ app.showError(e);
+ })
},
enterChallenge(){
wx.showLoading({
@@ -42,29 +64,30 @@ Page({
let {description, challenge_list:challenges} = await this.apiChallenges({identifier:this.data.identifier});
this.setData({description, challenges});
},
- async pullShixun(){
+ async pullShixun({showLoading=1}={}){
+ if(showLoading)
+ wx.showLoading({
+ title: '努力加载中'
+ })
let {identifier} = this.data;
let shixun = await this.apiShixun({identifier});
- this.setData({shixun});
+ this.setData({shixun}, res=>{
+ if(showLoading)
+ wx.hideLoading()
+ });
},
onLoad: function (options) {
let {identifier,cate_type} = options;
let current = cateTypes[cate_type];
this.setData({identifier, current});
- this.pullChallenges();
- this.pullShixun();
- },
- onShow: function () {
- app.syncUser().then(res=>{
- this.setData({user:res.user});
- })
- },
- onPullDownRefresh: function () {
-
+ this.pullChallenges().catch(e=>{
+
+ });
+ this.pullShixun().catch(e=>{
+ app.showError(e);
+ });
},
- onReachBottom: function () {
- },
onShareAppMessage: function () {
return app.shareApp({
title:this.data.shixun.name,
diff --git a/miniprogram/shixun/pages/shixun/shixun.json b/miniprogram/shixun/pages/shixun/shixun.json
index 7a8926e..b04cae9 100644
--- a/miniprogram/shixun/pages/shixun/shixun.json
+++ b/miniprogram/shixun/pages/shixun/shixun.json
@@ -7,5 +7,5 @@
},
"navigationBarBackgroundColor": "#0080f0",
"navigationBarTextStyle": "white",
- "navigationBarTitleText": "实训详情"
+ "navigationBarTitleText": "实训项目"
}
\ No newline at end of file
diff --git a/miniprogram/shixun/pages/shixun/shixun.wxml b/miniprogram/shixun/pages/shixun/shixun.wxml
index 9eae05a..a324c19 100644
--- a/miniprogram/shixun/pages/shixun/shixun.wxml
+++ b/miniprogram/shixun/pages/shixun/shixun.wxml
@@ -1,6 +1,6 @@
-
+
-
+
@@ -44,5 +44,6 @@
+
\ No newline at end of file
diff --git a/miniprogram/shixun/pages/shixun/shixun.wxs b/miniprogram/shixun/pages/shixun/shixun.wxs
index b1b4d9f..b358892 100644
--- a/miniprogram/shixun/pages/shixun/shixun.wxs
+++ b/miniprogram/shixun/pages/shixun/shixun.wxs
@@ -1,6 +1,6 @@
-var top = 126;
+var top = 140;
function scroll(e, ins){
- var scrollTop = e.detail.scrollTop;
+ //var scrollTop = e.detail.scrollTop;
var deltaY = e.detail.deltaY;
//console.log(scrollTop);
//console.log(show,scrollTop<122);
diff --git a/miniprogram/shixun/pages/shixun/shixun.wxss b/miniprogram/shixun/pages/shixun/shixun.wxss
index dc697ac..5c5d140 100644
--- a/miniprogram/shixun/pages/shixun/shixun.wxss
+++ b/miniprogram/shixun/pages/shixun/shixun.wxss
@@ -10,10 +10,10 @@
.shixun-title{
background: #0080f0;
font-weight: bolder;
- padding-top: 6px;
+ padding: 2px 10px;
font-size: 20px;
color: white;
- height: 80px;
+ height: 84px;
width: 100%;
}
.shixun-detail{
@@ -42,7 +42,6 @@
font-size: 13px;
}
.cate{
- margin-top: 3px;
background: white;
overflow: hidden;
}
@@ -59,19 +58,22 @@
padding: 0 10px;
}
.body{
- height: calc(100vh - 74px);
- margin-bottom: 40px;
+ height: calc(100vh - 76px);
}
.scroll-body{
height: 100%;
background: white;
}
.operations{
- position: fixed;
+ position: sticky;
bottom: 0;
left:0;
right:0;
+ display: flex;
}
.operations>button{
- width: auto!important;
+ flex: 1;
+}
+button.collect{
+ background: white!important;
}
\ No newline at end of file
diff --git a/miniprogram/shixun_homework/pages/shixun_homework/shixun_homework.wxss b/miniprogram/shixun_homework/pages/shixun_homework/shixun_homework.wxss
index 98a1dfc..b4035b4 100644
--- a/miniprogram/shixun_homework/pages/shixun_homework/shixun_homework.wxss
+++ b/miniprogram/shixun_homework/pages/shixun_homework/shixun_homework.wxss
@@ -3,6 +3,7 @@ page,.homework{
}
.header{
text-align: center;
+ padding-top: 16px;
}
.title{
font-weight: 560;
@@ -19,7 +20,7 @@ page,.homework{
}
.footer{
position: absolute;
- bottom: 0;
+ bottom: 18px;
left: 0;
right: 0;
}
\ No newline at end of file
diff --git a/miniprogram/sitemap.json b/miniprogram/sitemap.json
index 58eb8d7..46615cd 100644
--- a/miniprogram/sitemap.json
+++ b/miniprogram/sitemap.json
@@ -1,6 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [
+
{
"action": "allow",
"page": "shixun/pages/shixun/shixun",
@@ -9,6 +10,18 @@
],
"matching": "inclusive"
},
+ {
+ "action":"disallow",
+ "page":"account/pages/profile/profile"
+ },
+ {
+ "action":"disallow",
+ "page":"task/pages/task/task"
+ },
+ {
+ "action":"disallow",
+ "page":"course/pages/course/course"
+ },
{
"action": "allow",
"page": "*"
diff --git a/miniprogram/task/pages/task/task.js b/miniprogram/task/pages/task/task.js
index fdb773b..e2b182a 100644
--- a/miniprogram/task/pages/task/task.js
+++ b/miniprogram/task/pages/task/task.js
@@ -5,6 +5,7 @@ Page({
theme: 'light',
current: 0,
content:"加载中...",
+ attachDir: global.config.attachDir,
titles: ["任务描述", "代码文件", "测评结果"],
can_use_editor:wx.canIUse("editor")
},
@@ -56,7 +57,10 @@ Page({
console.log(detail);
let {value} = detail;
let theme = value?'dark':'light';
- this.setData({theme});
+ if(theme==this.data.theme)
+ return;
+ wx.showNavigationBarLoading()
+ this.setData({theme},wx.hideNavigationBarLoading);
this.setNavigationTheme();
wx.setStorageSync('config-task-theme', theme);
},
@@ -198,10 +202,17 @@ Page({
this.checkTime();
},
async pullTask(){
+ wx.showLoading({
+ title: '努力加载中',
+ })
+ wx.showNavigationBarLoading();
let {identifier} = this.data;
let res = await app.api("tasks")({identifier});
res.challenge.task_pass = res.challenge.task_pass.replace(/\[TOC\]\s*-+\s*/,"")
- this.setData(res);
+ this.setData(res,()=>{
+ wx.hideLoading();
+ wx.hideNavigationBarLoading();
+ });
},
async pullContent(){
@@ -242,7 +253,6 @@ Page({
let theme = wx.getStorageSync('config-task-theme');
this.setData({theme});
this.setNavigationTheme();
-
let {identifier} = options;
this.setData({identifier});
this.pullTask();
diff --git a/miniprogram/task/pages/task/task.wxml b/miniprogram/task/pages/task/task.wxml
index b53144e..91e8757 100644
--- a/miniprogram/task/pages/task/task.wxml
+++ b/miniprogram/task/pages/task/task.wxml
@@ -7,7 +7,19 @@
第{{challenge.position}}关:{{challenge.subject}}
- 黑暗模式
+
diff --git a/miniprogram/task/pages/task/task.wxss b/miniprogram/task/pages/task/task.wxss
index 7ea9fd0..8fa1ad0 100644
--- a/miniprogram/task/pages/task/task.wxss
+++ b/miniprogram/task/pages/task/task.wxss
@@ -1,6 +1,21 @@
.body{
height: 100vh;
}
+.sub-header{
+ display: flex;
+ padding-top: 14px;
+ margin-bottom: -10px;
+ justify-content: space-between;
+ align-items: center;
+}
+.nav-educoder{
+ font-size: 12px;
+ padding-left: 12px;
+}
+.nav-educoder>.icon{
+ height: 20px;
+ width: 20px;
+}
.dark{
background: black!important;
color: white;
diff --git a/miniprogram/theme.json b/miniprogram/theme.json
new file mode 100644
index 0000000..9249692
--- /dev/null
+++ b/miniprogram/theme.json
@@ -0,0 +1,8 @@
+{
+ "light": {
+
+ },
+ "dark": {
+
+ }
+ }
\ No newline at end of file
diff --git a/project.config.json b/project.config.json
index e8b79a6..fb61e1e 100644
--- a/project.config.json
+++ b/project.config.json
@@ -10,6 +10,7 @@
"es6": true,
"enhance": true,
"postcss": true,
+ "preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
@@ -27,6 +28,8 @@
"outputPath": ""
},
"bundle": false,
+ "useCompilerModule": false,
+ "userConfirmedUseCompilerModuleSwitch": false,
"skeletonGenerateFilesWithoutConfirm": true
},
"compileType": "miniprogram",
@@ -63,20 +66,6 @@
"miniprogram": {
"current": -1,
"list": [
- {
- "id": -1,
- "name": "account/pages/profile/profile",
- "pathName": "account/pages/profile/profile",
- "query": "",
- "scene": null
- },
- {
- "id": 1,
- "name": "account/pages/profile/school_select/school_select",
- "pathName": "account/pages/profile/school_select/school_select",
- "query": "keyword=国",
- "scene": null
- },
{
"id": 2,
"name": "home",
@@ -91,32 +80,11 @@
"query": "",
"scene": null
},
- {
- "id": -1,
- "name": "authentication",
- "pathName": "account/pages/authentication/authentication",
- "query": "",
- "scene": null
- },
- {
- "id": -1,
- "name": "account/pages/pro_authentication/pro_authentication",
- "pathName": "account/pages/pro_authentication/pro_authentication",
- "query": "",
- "scene": null
- },
{
"id": 6,
"name": "course/pages/course/course",
"pathName": "course/pages/course/course",
- "query": "course_id=5141&module_type=exercise",
- "scene": null
- },
- {
- "id": -1,
- "name": "account/pages/accounts/accounts",
- "pathName": "account/pages/accounts/accounts",
- "query": "",
+ "query": "course_id=7582&module_type=students",
"scene": null
},
{
@@ -133,13 +101,6 @@
"query": "course_identity=2&course_id=5141&id_=956",
"scene": null
},
- {
- "id": 11,
- "name": "course/pages/attendance_detail/attendance_detail",
- "pathName": "course/pages/attendance_detail/attendance_detail",
- "query": "course_identity=5&course_id=5141&code=&mode=&attendance_id=956",
- "scene": null
- },
{
"id": -1,
"name": "accounts",
@@ -156,23 +117,37 @@
},
{
"id": -1,
- "name": "account/pages/profile/school_select/school_select",
- "pathName": "account/pages/profile/school_select/school_select",
+ "name": "account/pages/profile/profile",
+ "pathName": "account/pages/profile/profile",
"query": "course_id=5876",
"scene": null
},
{
"id": -1,
- "name": "account/pages/profile/profile",
- "pathName": "account/pages/profile/profile",
- "query": "course_id=5876",
+ "name": "爬虫访问",
+ "pathName": "pages/main/main",
+ "query": "course_id=7582&module_type=students",
+ "scene": 1129
+ },
+ {
+ "id": 16,
+ "name": "shixun/pages/shixun/shixun",
+ "pathName": "shixun/pages/shixun/shixun",
+ "query": "identifier=8bu9zmjy",
+ "scene": null
+ },
+ {
+ "id": 17,
+ "name": "path/pages/path/path",
+ "pathName": "path/pages/path/path",
+ "query": "subject_id=13",
"scene": null
},
{
"id": -1,
- "name": "course/pages/teacher_apply/teacher_apply",
- "pathName": "course/pages/teacher_apply/teacher_apply",
- "query": "course_id=5141",
+ "name": "pages/findmore/findmore",
+ "pathName": "pages/findmore/findmore",
+ "query": "identifier=8bu9zmjy",
"scene": null
}
]