A 实训项目多选功能

master
educoder_weapp 5 years ago
parent 82569ce5a0
commit d7a7746840

@ -84,4 +84,17 @@ button[type=cap][disabled],button[type=main][disabled]{
}
button[plain][disabled]{
background: transparent;
}
button[type=secondary]{
color: #00b0f0;
background: #f0f0f0;
}
button[type=error]{
background: #fa5151;
color: white;
}
button[type=error][plain]{
color: #fa5151;
border: 1px solid #fa5151;
background-color: transparent;
}

@ -64,6 +64,7 @@
<error-page status="{{status}}" config="{{scenes}}" bindrefresh="onTapError" />
<join-course hidden="{{!show_join_course}}" bindsuccess="refresh" auto_navigate="0" />
<mp-halfScreenDialog show="{{showModules}}">
<text slot="title">课堂模块</text>
<view slot="desc" class="modules">
<view class="module-item" wx:for="{{course_modules}}" bindtap="onModuleTap" data-type="{{item.type}}">
<image class="module-img" mode="aspectFit" src="/course/images/svg/{{item.type}}_select.svg"></image>

@ -6,7 +6,8 @@ Page({
*/
data: {
scrollTop:0,
re:false
re:false,
type:"secondary"
},
onScanCode(e){
console.log(e);

@ -1,3 +1,4 @@
<scroll-view class="scroll" scroll-top="scrollTop" refresher-triggered="{{re}}" refresher-enabled="1">
<button>撒</button>
</scroll-view>
<view>
<button type="{{type}}" plain size="mini">登录</button>
</view>

@ -1,8 +1,3 @@
#cam{
width: 100%;
height: 40vh;
}
.scroll{
background: red;
height: 72vh;
page{
background: white;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

@ -6,7 +6,7 @@
<text class="title">{{title}}</text>
</view>
<view class="navbar" bindtap="switchNav">
<view class="navitem {{current==index?'active':''}}" wx:for="{{list}}" data-current="{{index}}">
<view class="navitem {{current==index?'active':''}}" wx:for="{{list}}" wx:key="text" data-current="{{index}}">
{{item.text}}
</view>
</view>

@ -39,7 +39,7 @@ courses:{ url:{_:"*", DELETE:"*/{course_id}",PUT:"*/{course_id}"},query, form:{_
top_banner:{url:"{course_id}/*", query},
set_invite_code_halt:{url:"{course_id}/*", query, config, disp:"停用或启用邀请码"},
students:{url:"{course_id}/*",query, form:{order:1,sort:"asc",page:1, limit:20, course_group_id:""}},
search_slim:{},
search_slim:{query, form:{page:1, limit:10}},
switch_to_assistant: { url: "{course_id}/*", query ,config},
switch_to_student:{url:"{course_id}/*",query, config},
switch_to_teacher:{url:"{course_id}/*",query, config},
@ -117,6 +117,7 @@ search:{query,form:{type:null, keyword:null, page:1, per_page:20}, data:{type:"s
shixun_lists: { query, form:{type:"all", status:"published",keyword:"",diff:0,order:"desc",page:1,limit:10,sort:"wechat_myshixuns_count", no_jupyter:1}},
shixuns:{url:"*/{identifier}", query, res:{tpm_modified:"代码库是否有更新"},
batch_send_to_course:{query, config, form:{course_id:null, shixun_ids:null}},
challenges:{url:"{identifier}/*", query},
show_right:{url:""},
shixun_exec:{url:"{identifier}/*", query},

@ -1,5 +1,5 @@
<navigator class="path-item" url="/path/pages/path/path?subject_id={{data.id}}">
<image class="image" src="{{eduUrl}}/{{data.image_url}}"></image>
<image class="image" lazy-load src="{{eduUrl}}/{{data.image_url}}"></image>
<view class="detail">
<view class="name">{{data.name}}</view>
</view>

@ -78,7 +78,6 @@ Component({
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"});
@ -87,10 +86,10 @@ Component({
this.pullSubjects({refresh:1});
},
onSubCateChange({detail}){
console.log(detail);
let {current, value, source} = detail;
if(source!="touch")
return;
this.setData({subCurrent:current});
if(value.id)
this.options.sub_discipline_id = value.id;
else

@ -1,14 +1,37 @@
Component({
properties: {
data:Object
data:Object,
select: {
type: Boolean,
value: false,
observer: function(v){
//console.log("observer select change", v);
if(!v){
this.setData({value: false});
//console.log(this.data);
}
}
}
},
behaviors: ['wx://form-field'],
data: {
eduUrl: global.config.eduUrl
},
methods: {
onTap(){
if(this.data.select){
this.select({from:"body"})
}
},
select({from}){
this.setData({value: !this.data.value});
let {data:{id:name}, value} = this.data;
this.triggerEvent("select", {name, value, from}, {bubbles:true});
},
onTapRadio(){
this.select({from:"radio"})
}
}
})

@ -1,7 +1,12 @@
<navigator class="shixun-item" url="/shixun/pages/shixun/shixun?identifier={{data.identifier}}">
<image class="image" src="{{eduUrl}}/{{data.pic}}"></image>
<navigator bindtap="onTap" hover-class="{{select?'none':'navigator-hover'}}" class="shixun-item" url="{{select?'':('/shixun/pages/shixun/shixun?identifier='+data.identifier)}}">
<image class="image" lazy-load src="{{eduUrl}}/{{data.pic}}"></image>
<view class="detail">
<view class="name"><rich-text nodes="{{data.title}}"/></view>
<view class="level">初级</view>
</view>
<view class="radio-wrp">
<view class="icon-wrp" catchtap="onTapRadio" >
<icon class="icon" color="{{select&&value?'#00b0f0':'dimgrey'}}" type="{{value?'success':'circle'}}" size="{{select?20:12}}"></icon>
</view>
</view>
</navigator>

@ -15,10 +15,24 @@
display: flex;
flex-direction: column;
justify-content: space-between;
flex: auto;
}
.level{
font-size: 12px;
}
.highlight{
color: #00b0f0;
}
.radio-wrp,.icon-wrp{
display: flex;
align-items: center;
justify-content: center;
}
.radio-wrp{
width: 22px;
flex: none;
}
.icon-wrp{
width: 100%;
height: 30px;
}

@ -11,6 +11,7 @@ Component({
attached(){
this.options = {page:1, limit: 10};
this.pullShixuns({refresh:1});
this.selects = {};
},
methods: {
clear(){
@ -27,7 +28,59 @@ Component({
}
},
onChange(e){
console.log(e);
},
onSelect(e){
let {detail} = e;
console.log(detail);
this.selects[detail.name] = detail.value;
if(detail.value&&!this.data.select)
this.setData({select: true});
else if(!detail.value&&!this.data.select){
console.error("!!!!!!!!!!!!!!!");
}
else if(detail.from=='radio'){
let length = 0;
for(var i in this.selects){
if(this.selects[i])
length++;
}
console.log("length", length);
if(length==0){
this.setData({select: false});
this.selects = {};
}
}
},
onReset(e){
console.log(e, e.detail);
this.setData({select:false});
this.selects = {}
},
onSubmit(e){
console.log(e,e.detail);
if(!this.data.select)
this.setData({select: true});
else{
let shixun_ids = [];
for(var i in this.selects){
if(this.selects[i])
shixun_ids.push(i);
}
console.log("selected shixuns", shixun_ids);
if(shixun_ids.length==0){
wx.showToast({
title: '请选择实训',icon:"none"
})
}else{
this.select_shixun_ids = shixun_ids;
this.setData({showSendDialog: true});
}
}
},
search(e){
console.log(e)
let {detail:{value}} = e;
if(this.options.keyword!=value){
@ -66,7 +119,10 @@ Component({
}
this.setData({ shixun_list, status}, wx.hideNavigationBarLoading);
}).catch(e=>{
this.setData({ shixun_list:[], status:e.code}, wx.hideNavigationBarLoading);
if(refresh)
this.setData({ shixun_list:[], status:e.code}, wx.hideNavigationBarLoading);
else
this.setData({status:e.code}, wx.hideNavigationBarLoading);
})
}
}

@ -4,14 +4,23 @@
<view>
<view class="header">
<view class="input-wrp">
<input class="input" value="{{keyword}}" bindinput="onInput" bindblur="onSubmit" bindconfirm="onSubmit" confirm-type="search" placeholder="输入实训关键词进行搜索"></input>
<input class="input" value="{{keyword}}" bindinput="onInput" bindblur="search" bindconfirm="search" 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>
<form bindsubmit="onSubmit" bindselect="onSelect" bindreset="onReset">
<view class="sticky-top list-header">
<view class="subtitle">实训列表</view>
<view class="select-operations">
<button wx:if="{{select}}" class="operation-btn cancel-select" form-type="reset">取消</button>
<button class="operation-btn submit-select" form-type="submit">{{select?'发送到':'发送'}}</button>
</view>
</view>
<view wx:for="{{shixun_list}}" wx:key="id" class="shixun-wrp">
<shixun-item data="{{item}}" name="{{item.id}}" select="{{select}}"/>
</view>
</form>
<empty-page show="{{status==205}}" title="暂无相关内容" desc="获取更多请进入EduCoder官网"/>
</view>
</scroll-view>

@ -1,9 +1,11 @@
.shixun-body{
height: 100%;
}
.header{
.sticky-top{
top: 0;
position: sticky;
}
.header{
background: white;
padding: 4px 12px;
}
@ -19,6 +21,30 @@
.icon{
flex: none;
}
.list-header,.select-operations{
display: flex;
align-items: center;
}
.list-header{
background: white;
padding: 4px 12px;
border-bottom: #eee 1px solid;
margin-bottom: 2px;
}
.subtitle{
font-weight: bold;
white-space: pre;
flex: auto;
}
.operation-btn{
padding: 4px 10px;
width: auto!important;
background: transparent;
font-size: 14px;
}
.submit-select{
color: #00b0f0;
}
.shixun-wrp{
margin-bottom: 2px;

@ -72,7 +72,7 @@
<view>
<button class="login" type="main" wx:if="{{!user.id||user.id==2}}" bindtap="enter_login">登录</button>
<button class="login logout" wx:elif="{{user.id!=2}}" bindtap="logout">退出登录</button>
<button class="login logout" type="error" wx:elif="{{user.id!=2}}" bindtap="logout">退出登录</button>
</view>
<view class="version">

@ -149,6 +149,12 @@
"pathName": "pages/findmore/findmore",
"query": "identifier=8bu9zmjy",
"scene": null
},
{
"id": -1,
"name": "dev/pages/dev/dev",
"pathName": "dev/pages/dev/dev",
"scene": null
}
]
}

Loading…
Cancel
Save