parent
bfd7f13a58
commit
82569ce5a0
@ -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: {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
<view class="empty" wx:if="{{show}}">
|
||||||
|
<image class="image" mode="aspectFit" src="{{image}}"/>
|
||||||
|
<view class="message">{{title}}</view>
|
||||||
|
<view class="desc">{{desc}}</view>
|
||||||
|
</view>
|
@ -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;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<scroll-view wx:if="{{list.length>1}}" scroll-x="1" class="navbar {{type}} bar-class" scroll-left="{{scrollLeft}}rpx" scroll-with-animation="1" style="width:{{width}}rpx;background:{{bg}}">
|
<scroll-view wx:if="{{list.length>1}}" scroll-x="1" class="navbar {{type}} bar-class" scroll-left="{{scrollLeft}}rpx" scroll-with-animation="1" style="width:{{width}}rpx;background:{{bg}}">
|
||||||
<view wx:for="{{list}}" wx:key="index" class="view common {{type}} item-class {{cur == index ?'active':''}}" data-current="{{index}}" bindtap="switchNav" style="margin-right:{{mg}}rpx;{{_itemWidth>0?'width:'+_itemWidth+'rpx':''}} ">
|
<view wx:for="{{list}}" wx:key="index" class="view common {{type}} item-class {{cur == index ?'active':''}}" data-current="{{index}}" bindtap="switchNav" style="margin:0 {{mg}}rpx;{{_itemWidth>0?'width:'+_itemWidth+'rpx':''}} ">
|
||||||
<text class="text common {{type}} item-class {{cur == index ?'active':''}}">{{item.text}}</text>
|
<text class="text common {{type}} item-class {{cur == index ?'active':''}}">{{item.text}}</text>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
@ -0,0 +1,23 @@
|
|||||||
|
// components/page-status/page-status.js
|
||||||
|
Component({
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
<!--components/page-status/page-status.wxml-->
|
||||||
|
<text>components/page-status/page-status.wxml</text>
|
@ -0,0 +1 @@
|
|||||||
|
/* components/page-status/page-status.wxss */
|
@ -1,6 +0,0 @@
|
|||||||
<view class="shixun" bindtap="onTap">
|
|
||||||
<image class="shixun-img" mode="aspectFill" src="{{eduUrl}}/{{shixun.image_url}}"></image>
|
|
||||||
<view class="detail">
|
|
||||||
{{shixun.name}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
@ -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;
|
|
||||||
}
|
|
@ -1,2 +1,3 @@
|
|||||||
<textarea></textarea>
|
<scroll-view class="scroll" scroll-top="scrollTop" refresher-triggered="{{re}}" refresher-enabled="1">
|
||||||
<editor/>
|
<button>撒</button>
|
||||||
|
</scroll-view>
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,14 @@
|
|||||||
|
<view class="navigation">
|
||||||
|
<view style="height:{{statusBarHeight}}px"></view>
|
||||||
|
<view class="navigation-bar">
|
||||||
|
<view class="navigation-left">
|
||||||
|
<icon wx:if="{{showSearch}}" class="search" type="search" size="25" color="white" bindtap="enterSearch" />
|
||||||
|
<text class="title">{{title}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="navbar" bindtap="switchNav">
|
||||||
|
<view class="navitem {{current==index?'active':''}}" wx:for="{{list}}" data-current="{{index}}">
|
||||||
|
{{item.text}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
@ -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;
|
||||||
|
}
|
@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {},
|
"usingComponents": {
|
||||||
|
"paths":"./paths/paths",
|
||||||
|
"shixuns":"./shixuns/shixuns"
|
||||||
|
},
|
||||||
"navigationBarTitleText": "发现",
|
"navigationBarTitleText": "发现",
|
||||||
"navigationStyle": "custom"
|
"navigationBarTextStyle": "white",
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarBackgroundColor": "#00b0f0"
|
||||||
}
|
}
|
@ -1,22 +1,9 @@
|
|||||||
<view class="navigation">
|
<include src="../../includes/navigation-bar/navigaation-bar.wxml"/>
|
||||||
<view style="height:{{statusBarHeight}}px"></view>
|
|
||||||
<view class="navigation-bar">
|
|
||||||
<view class="navigation-left">
|
|
||||||
<icon class="search" type="search" size="26" color="white" bindtap="enterSearch"/>
|
|
||||||
<text class="title">发现</text>
|
|
||||||
</view>
|
|
||||||
<view class="navbar" bindtap="switchNav">
|
|
||||||
<view class="navitem {{current==index?'active':''}}" wx:for="{{list}}" data-current="{{index}}">
|
|
||||||
{{item.text}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<swiper class="body" current="{{current}}" bindchange="switchTab" circular="1">
|
<swiper class="body" current="{{current}}" bindchange="switchTab" circular="1">
|
||||||
<swiper-item>
|
<swiper-item>
|
||||||
<courses wx:if="{{show[0]}}"/>
|
<shixuns wx:if="{{show[0]}}"/>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
<swiper-item>
|
<swiper-item>
|
||||||
<shixuns wx:if="{{show[1]}}"/>
|
<paths wx:if="{{show[1]}}"/>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
@ -1,48 +1,9 @@
|
|||||||
|
@import "../../includes/navigation-bar/navigation-bar.wxss";
|
||||||
page{
|
page{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
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{
|
.body{
|
||||||
flex: 1 1 1px;
|
flex: 1 1 1px;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
const app = getApp();
|
||||||
|
Component({
|
||||||
|
properties: {
|
||||||
|
data:Object
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
eduUrl: global.config.eduUrl
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
@ -0,0 +1,6 @@
|
|||||||
|
<navigator class="path-item" url="/path/pages/path/path?subject_id={{data.id}}">
|
||||||
|
<image class="image" src="{{eduUrl}}/{{data.image_url}}"></image>
|
||||||
|
<view class="detail">
|
||||||
|
<view class="name">{{data.name}}</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
@ -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;
|
||||||
|
}
|
@ -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});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
<scroll-view scroll-y="1" class="path-body" refresher-enabled="1"
|
||||||
|
bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"
|
||||||
|
lower-threshold="200" bindrefresh="onPullDownRefresh">
|
||||||
|
<view>
|
||||||
|
<view class="nav-wrp">
|
||||||
|
<nav-bar list="{{list}}" type="line" itemWidth="0" mg="20" bindchange="onCateChange"/>
|
||||||
|
<nav-bar list="{{subList}}" cancellable="1" current="{{subCurrent}}"
|
||||||
|
type="cap" itemWidth="0" mg="12" bindchange="onSubCateChange"/>
|
||||||
|
</view>
|
||||||
|
<view class="subjects-list">
|
||||||
|
<view class="path-wrp" wx:for="{{subjects}}">
|
||||||
|
<path-item data="{{item}}"/>
|
||||||
|
</view>
|
||||||
|
<empty-page show="{{status==205}}" title="更多数据请访问EduCoder官网"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
@ -0,0 +1,10 @@
|
|||||||
|
.path-body{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.nav-wrp{
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
.path-wrp{
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
Component({
|
||||||
|
properties: {
|
||||||
|
data:Object
|
||||||
|
},
|
||||||
|
|
||||||
|
data: {
|
||||||
|
eduUrl: global.config.eduUrl
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
@ -0,0 +1,7 @@
|
|||||||
|
<navigator class="shixun-item" url="/shixun/pages/shixun/shixun?identifier={{data.identifier}}">
|
||||||
|
<image class="image" src="{{eduUrl}}/{{data.pic}}"></image>
|
||||||
|
<view class="detail">
|
||||||
|
<view class="name"><rich-text nodes="{{data.title}}"/></view>
|
||||||
|
<view class="level">初级</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
@ -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;
|
||||||
|
}
|
@ -1,23 +1,73 @@
|
|||||||
// pages/findmore/shixuns/shixuns.js
|
|
||||||
|
const app = getApp();
|
||||||
Component({
|
Component({
|
||||||
/**
|
|
||||||
* 组件的属性列表
|
|
||||||
*/
|
|
||||||
properties: {
|
properties: {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件的初始数据
|
|
||||||
*/
|
|
||||||
data: {
|
data: {
|
||||||
|
shixun_list:[]
|
||||||
|
},
|
||||||
|
attached(){
|
||||||
|
this.options = {page:1, limit: 10};
|
||||||
|
this.pullShixuns({refresh:1});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 组件的方法列表
|
|
||||||
*/
|
|
||||||
methods: {
|
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);
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
"component": true,
|
"component": true,
|
||||||
"usingComponents": {}
|
"usingComponents": {
|
||||||
|
"empty-page":"/components/empty-page/empty-page",
|
||||||
|
"shixun-item":"./shixun-item/shixun-item"
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,2 +1,17 @@
|
|||||||
<!--pages/findmore/shixuns/shixuns.wxml-->
|
<scroll-view class="shixun-body" scroll-y="1" refresher-enabled="1"
|
||||||
<text>pages/findmore/shixuns/shixuns.wxml</text>
|
bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"
|
||||||
|
lower-threshold="200" bindrefresh="onPullDownRefresh">
|
||||||
|
<view>
|
||||||
|
<view class="header">
|
||||||
|
<view class="input-wrp">
|
||||||
|
<input class="input" value="{{keyword}}" bindinput="onInput" bindblur="onSubmit" bindconfirm="onSubmit" confirm-type="search" placeholder="输入实训关键词进行搜索"></input>
|
||||||
|
<icon wx:if="{{showClear}}" class="icon" type="clear" bindtap="clear"></icon>
|
||||||
|
<icon class="icon" type="search"></icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view wx:for="{{shixun_list}}" class="shixun-wrp">
|
||||||
|
<shixun-item data="{{item}}"/>
|
||||||
|
</view>
|
||||||
|
<empty-page show="{{status==205}}" title="暂无相关内容" desc="获取更多请进入EduCoder官网"/>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
@ -1 +1,25 @@
|
|||||||
/* pages/findmore/shixuns/shixuns.wxss */
|
.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;
|
||||||
|
}
|
@ -1,48 +1,9 @@
|
|||||||
|
@import "../../includes//navigation-bar/navigation-bar.wxss";
|
||||||
page{
|
page{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
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{
|
.body{
|
||||||
flex: 1 1 1px;
|
flex: 1 1 1px;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"component": true,
|
"component": true,
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"iconfont":"../iconfont/iconfont",
|
"iconfont":"/components/iconfont/iconfont",
|
||||||
"mp-icon": "/weui-miniprogram/icon/icon"
|
"mp-icon": "/weui-miniprogram/icon/icon"
|
||||||
},
|
},
|
||||||
"navigationBarBackgroundColor": "#00b0f0",
|
"navigationBarBackgroundColor": "#00b0f0",
|
@ -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});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
<view class="my-path">
|
||||||
|
<require-login/>
|
||||||
|
<nav-bar list="{{cates}}" bindchange="onCateChange"/>
|
||||||
|
<scroll-view class="body" scroll-y="1" refresher-enabled="1" lower-threshold="140" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom">
|
||||||
|
<view class="path-wrap" wx:for="{{subjects}}" wx:key="id">
|
||||||
|
<path-item data="{{item}}"/>
|
||||||
|
</view>
|
||||||
|
<empty-page show="{{status==205}}"/>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
@ -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;
|
||||||
|
}
|
@ -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: {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
<navigator class="path" url="/path/pages/path/path?subject_id={{id}}">
|
||||||
|
<image class="path-img" mode="aspectFill" src="{{eduUrl}}/{{image_url}}"></image>
|
||||||
|
<view class="detail">
|
||||||
|
<view class="name">
|
||||||
|
{{name}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
@ -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;
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
<view class="my-shixun">
|
<view class="my-shixun">
|
||||||
<require-login/>
|
<require-login/>
|
||||||
<scroll-view class="body" scroll-y="1" refresher-enabled="1" lower-threshold="120" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom">
|
<nav-bar list="{{cates}}" bindchange="onCateChange"/>
|
||||||
|
<scroll-view class="body" scroll-y="1" refresher-enabled="1" lower-threshold="140" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom">
|
||||||
<view class="shixun-wrap" wx:for="{{shixuns}}" wx:key="id">
|
<view class="shixun-wrap" wx:for="{{shixuns}}" wx:key="id">
|
||||||
<shixun-item data="{{item}}"/>
|
<shixun-item data="{{item}}"/>
|
||||||
</view>
|
</view>
|
||||||
|
<empty-page show="{{status==205}}"/>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
<navigator class="shixun" url="/shixun/pages/shixun/shixun?identifier={{identifier}}">
|
||||||
|
<image class="shixun-img" mode="aspectFill" src="{{eduUrl}}/{{image_url}}"></image>
|
||||||
|
<view class="detail">
|
||||||
|
<view class="name">
|
||||||
|
{{name}}
|
||||||
|
</view>
|
||||||
|
<view class="progress-wrp">
|
||||||
|
<progress percent="{{finished_challenges_count/challenges_count*100}}" border-radius="4" backgroundColor="#cdcdcd" activeColor="#00b0f0">
|
||||||
|
<text class="finish-text">已完成:{{finished_challenges_count}}/{{challenges_count}}</text>
|
||||||
|
</progress>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
@ -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;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
const app = getApp();
|
const app = getApp();
|
||||||
const { processObj, get, format } = require("../../js/utils");
|
const { processObj, get, format } = require("../../../js/utils");
|
||||||
|
|
||||||
const ROUTE = {
|
const ROUTE = {
|
||||||
Course:{
|
Course:{
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
@ -1,66 +1,90 @@
|
|||||||
// miniprogram/path/pages/path/path.js
|
const app = getApp();
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面的初始数据
|
|
||||||
*/
|
|
||||||
data: {
|
data: {
|
||||||
|
cates:[
|
||||||
|
{text:"章节"},
|
||||||
|
{text:"介绍"}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
onSwitch({detail}){
|
||||||
/**
|
let {source, current} = detail
|
||||||
* 生命周期函数--监听页面加载
|
if(source=='touch'){
|
||||||
*/
|
this.setData({current});
|
||||||
onLoad: function (options) {
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
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})
|
||||||
onReady: function () {
|
.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);
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
scrollTo({scrollTop}){
|
||||||
/**
|
wx.pageScrollTo({scrollTop,duration:380})
|
||||||
* 生命周期函数--监听页面显示
|
|
||||||
*/
|
|
||||||
onShow: function () {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
onLoad: function (options) {
|
||||||
/**
|
this.subject_id = options.path_id||options.subject_id;
|
||||||
* 生命周期函数--监听页面隐藏
|
this.pullSubject();
|
||||||
*/
|
|
||||||
onHide: function () {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
onEnterShixun(e){
|
||||||
/**
|
console.log(e.currentTarget);
|
||||||
* 生命周期函数--监听页面卸载
|
let {currentTarget:{dataset:{allow_visit}}} = e;
|
||||||
*/
|
if(!allow_visit)
|
||||||
onUnload: function () {
|
wx.showToast({
|
||||||
|
title: '该实训暂未公开',icon:"none"
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
pullSubject({showLoading=1}={}){
|
||||||
/**
|
if(showLoading)
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
wx.showLoading({
|
||||||
*/
|
title: '努力加载中'
|
||||||
onPullDownRefresh: function () {
|
});
|
||||||
|
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 () {
|
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
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -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": "实践课程"
|
||||||
}
|
}
|
@ -1,2 +1,85 @@
|
|||||||
<!--miniprogram/path/pages/path/path.wxml-->
|
<wxs src="./path.wxs" module="handler" />
|
||||||
<text>miniprogram/path/pages/path/path.wxml</text>
|
<view class="header">
|
||||||
|
<require-login bg="#00b0f0" bindchange="pullSubject"/>
|
||||||
|
<view class="title">
|
||||||
|
{{subject.name}}
|
||||||
|
</view>
|
||||||
|
<view class="subject-detail">
|
||||||
|
<view class="detail-item">
|
||||||
|
<view class="key">章节</view>
|
||||||
|
<view class="value">{{subject.stages_count}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="detail-item">
|
||||||
|
<view class="key">实训</view>
|
||||||
|
<view class="value">{{subject.shixuns_count}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="detail-item">
|
||||||
|
<view class="key">关卡</view>
|
||||||
|
<view class="value">{{subject.challenges_count}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="detail-item">
|
||||||
|
<view class="key">经验值</view>
|
||||||
|
<view class="value">{{subject.subject_score}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="detail-item">
|
||||||
|
<view class="key">学习人数</view>
|
||||||
|
<view class="value">{{subject.member_count}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="progress-wrp">
|
||||||
|
<progress class="score-progress" stroke-width="9" percent="{{progress.my_score/progress.all_score*100}}" border-radius="10" backgroundColor="#dddddd" activeColor="#00b0f0">
|
||||||
|
<text class="score">已学:{{progress.my_score}}/{{progress.all_score}}</text>
|
||||||
|
</progress>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<nav-bar bar-class="nav-bar" bindchange="onSwitch" current="{{current}}" type="line" list="{{cates}}" />
|
||||||
|
<swiper class="body" current="{{current}}" bindchange="onSwitch">
|
||||||
|
<swiper-item>
|
||||||
|
<scroll-view class="cate-body" scroll-y="1" bindscroll="{{handler.scroll}}">
|
||||||
|
<view class="stages-list">
|
||||||
|
<view class="stage" wx:for="{{stages}}" wx:for-item="stage" wx:key="stage_id">
|
||||||
|
<view class="stage_name cate-header">
|
||||||
|
<text class="square"/><text class="cate-name">{{stage.stage_name}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="shixuns-list">
|
||||||
|
<navigator class="shixun {{shixun.allow_visit?'':'forbidden'}}" hover-class="{{shixun.allow_visit?'navigator-hover':'none'}}"
|
||||||
|
wx:for="{{stage.shixuns_list}}" wx:for-item="shixun" wx:key="identifier"
|
||||||
|
url="{{shixun.allow_visit?('/shixun/pages/shixun/shixun?identifier='+shixun.identifier):''}}"
|
||||||
|
data-allow_visit="{{shixun.allow_visit}}" bindtap="onEnterShixun">
|
||||||
|
<icon wx:if="{{shixun.complete_status}}" type="success" class="shixun-icon" size="18" color="#00b0f0"/>
|
||||||
|
<mp-icon wx:else extClass="shixun-icon" icon="play2" size="18" color="#dedede" type="field"/>
|
||||||
|
<view class="shixun-name">
|
||||||
|
<text class="shixun-index">{{stage.stage_position}}-{{index+1}}</text>
|
||||||
|
{{shixun.shixun_name}}
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</swiper-item>
|
||||||
|
<swiper-item>
|
||||||
|
<scroll-view class="cate-body" scroll-y="1" bindscroll="{{handler.scroll}}">
|
||||||
|
<view class="cate-header">
|
||||||
|
<text class="square"/><text class="cate-name">简介</text>
|
||||||
|
</view>
|
||||||
|
<rich-md nodes="{{subject.description}}" type="markdown" />
|
||||||
|
<view class="cate-header">
|
||||||
|
<text class="square"/><text class="cate-name">课程须知</text>
|
||||||
|
</view>
|
||||||
|
<rich-md nodes="{{subject.learning_notes}}" type="markdown" />
|
||||||
|
<view class="cate-header">
|
||||||
|
<text class="square"/><text class="cate-name">技能标签</text>
|
||||||
|
</view>
|
||||||
|
<view class="tags-list">
|
||||||
|
<view class="tag {{item.status?'active':''}}" wx:for="{{tags}}">
|
||||||
|
{{item.tag_name}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
<view class="operations">
|
||||||
|
<button type="main" plain bindtap="collect" class="collect">{{subject.is_collect?'已收藏':'收藏'}}</button>
|
||||||
|
</view>
|
@ -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
|
||||||
|
}
|
@ -1 +1,103 @@
|
|||||||
/* miniprogram/path/pages/path/path.wxss */
|
|
||||||
|
.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;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue