Browse Source

add api

master
刘嘉炜 4 years ago
parent
commit
3300aea063
  1. 65
      src/pages/course/class_list/class_list.vue
  2. 6
      src/pages/course/list/list.vue
  3. 54
      src/pages/course/student_list/student_list.vue

65
src/pages/course/class_list/class_list.vue

@ -1,19 +1,28 @@
<template>
<view class="class-list">
<picker>
<view class="cl-bar"><text>12</text></view>
<picker disabled>
<view class="cl-bar"><text>{{optionsQuery.course_name || '-'}}</text></view>
</picker>
<view class="cl-list">
<view class="cl-item" v-for="i in 10" :key="i">
<view class="cl-item" v-for="(e, i) in classList" :key="i">
<view class="ci-name">
<view>二班</view>
<view :class="[i==2?'active':'']">已成班</view>
<view>{{ e.class_name }}</view>
<view :class="[ e.class_status == 1? '' : 'active']">
{{
e.class_status == 0 ? '未成班' :
e.class_status == 1 ? '已成班' : '-'
}}
</view>
</view>
<view class="ci-line"><text>学员人数:</text>10</view>
<view class="ci-line"><text>学员人数:</text>{{ e.total_member }}</view>
<view class="ci-btns">
<view hover-class="hover-active">点名</view>
<view hover-class="hover-active">学员</view>
<view hover-class="hover-active">作业</view>
<view hover-class="hover-active" @click="toStudentLst(e)">学员</view>
<block v-if="e.class_status == 1 || true">
<view hover-class="hover-active">点名</view>
<view hover-class="hover-active">作业</view>
</block>
</view>
</view>
</view>
@ -21,8 +30,46 @@
</template>
<script>
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
import util from '../../../utils/util'
export default {
data(){
return {
optionsQuery: {},
classList: [],
}
},
onLoad(options){
let _query = util.jsonPar(options.query);
this.optionsQuery = _query;
console.warn(_query);
this.getClassList(_query.course_id)
},
methods: {
toStudentLst(e){
let { optionsQuery } = this;
let _query = {
...optionsQuery,
class_id: e.id,
class_name: e.class_name,
}
util.routeTo(`/pages/course/student_list/student_list?query=${util.jsonStr(_query)}`, 'nT');
},
getClassList( course_id ){
servers.get({
url: API.course.getClassList,
data: { course_id },
failMsg: '加载失败!'
})
.then(res=>{
let _list = res || [];
this.classList = _list;
console.warn(res);
})
}
}
}
</script>

6
src/pages/course/list/list.vue

@ -32,7 +32,7 @@
</view>
<view class="ei-line"><text>预约人数:</text>{{e.experience_person_number || 0}}</view>
<view class="ei-btns">
<view hover-class="hover-active">查看详情</view>
<view hover-class="hover-active" @click="toExInfo">查看详情</view>
</view>
</view>
</block>
@ -106,6 +106,10 @@ export default {
this.getCourseList({});
},
methods: {
//
toExInfo(){
util.routeTo(`/pages/course/experience/experience`, 'nT');
},
toClass(e){
console.warn(e);
let _query = {

54
src/pages/course/student_list/student_list.vue

@ -1,24 +1,24 @@
<template>
<view class="student-list">
<picker>
<view class="top-bar"><text>12</text></view>
<picker disabled>
<view class="top-bar"><text>{{optionsQuery.course_name || '-'}}</text></view>
</picker>
<view class="sl-list">
<view class="sl-item" v-for="i in 10" :key="i">
<view class="sl-item" v-for="(e, i) in studentList" :key="i">
<view class="si-content">
<image></image>
<image mode="aspectFit"></image>
<view>
<view class="sc-info">
<view class="si-name">
<view>Adjoin</view>
<view>{{e.name }} {{e.gender}}</view>
<image></image>
</view>
<view class="si-phone">
<view>123453</view>
<view>{{e.mobile || '-'}}</view>
<image></image>
</view>
</view>
<view class="sc-lave">剩余次数: 10</view>
<view class="sc-lave">剩余次数: {{e.number || 0}}</view>
</view>
</view>
<view class="si-btns">
@ -27,7 +27,7 @@
</view>
</view>
</view>
<view class="l-mask">
<view class="l-mask" v-if="false">
<view class="m-modal">
<view class="m-tit">确定点名吗? 学员信息如下</view>
<view class="m-line"><text>学员: </text>张三</view>
@ -43,8 +43,44 @@
</template>
<script>
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
import util from '../../../utils/util'
export default {
data(){
return {
optionsQuery: {},
studentList: [],
}
},
onLoad(options){
let _query = util.jsonPar(options.query);
this.optionsQuery = _query;
this.getStudentList({
course_id: _query.course_id,
class_id: _query.class_id,
})
},
methods: {
getStudentList({
course_id,
class_id,
}){
servers.get({
url: API.course.getCourseStudentList,
data: {
course_id,
class_id,
},
failMsg: '加载失败!',
})
.then(res=>{
let _list = res.list || [];
this.studentList = _list;
console.warn(res);
})
},
}
}
</script>

Loading…
Cancel
Save