Commit d25e3bd0 authored by 王's avatar

期数列表标题链接到班级

parent d219f747
...@@ -12,8 +12,8 @@ module.exports = { ...@@ -12,8 +12,8 @@ module.exports = {
//本地代理设置 //本地代理设置
proxyTable: { proxyTable: {
'/api': { '/api': {
target: 'http://local.base-api.sing.com', // 接口的域名 // target: 'http://local.base-api.sing.com', // 接口的域名
// target: 'http://wechat.test.singsingenglish.com/', target: 'http://wechat.test.singsingenglish.com/',
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置 changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
} }
}, },
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
:props="{value:'id',label:'name'}" :props="{value:'id',label:'name'}"
@active-item-change="handleItemChange" @active-item-change="handleItemChange"
@change="changePeriods" @change="changePeriods"
v-model="selectedGoods"
> >
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
...@@ -110,6 +111,7 @@ ...@@ -110,6 +111,7 @@
type:0, type:0,
id:0 id:0
}, },
selectedGoods: []
} }
}, },
components:{ components:{
...@@ -118,25 +120,37 @@ ...@@ -118,25 +120,37 @@
page page
}, },
mounted(){ mounted(){
this.initPage() this.initPage();
}, },
methods:{ methods:{
initQuery(){
let _query = this.$route.query;
if (_query && _query.goods_id && _query.periods_id) {
this.selectedGoods = [parseInt(_query.goods_id),parseInt(_query.periods_id)];
getPeriodsApi({goods_id:this.selectedGoods[0]}).then(res=>{
res.list.forEach(i=>{i.name = i.title});
this.goodsList.find(i=>{return i.id === this.selectedGoods[0]}).children = res.list
let nowGoods = this.goodsList.find(i=>{return i.id === this.selectedGoods[0]});
this.periods = nowGoods.children.find(i=>{return i.id === this.selectedGoods[1]});
this.teacher_id = '';
this.getClassList()
})
} else {
getPeriodsApi({goods_id:this.goodsList[0].id}).then(res=>{
res.list.forEach(i=>{i.name = i.title});
this.goodsList[0].children = res.list;
this.periods = res.list[0]
})
}
},
initPage(){ initPage(){
getGoodsListApi().then(res=>{ getGoodsListApi().then(res=>{
res.list.forEach(i=>{ res.list.forEach(i=>{
i.children = []; i.children = [];
}); });
this.goodsList = res.list; this.goodsList = res.list;
if(!this.periods) { this.initQuery();
getPeriodsApi({goods_id:this.goodsList[0].id}).then(res=>{
res.list.forEach(i=>{i.name = i.title});
this.goodsList[0].children = res.list;
this.periods = res.list[0]
})
}
if(this.periods){
getClassListApi()
}
}); });
}, },
showUser(data){ showUser(data){
......
...@@ -36,13 +36,14 @@ ...@@ -36,13 +36,14 @@
<el-table <el-table
:data="periodList" :data="periodList"
style="width: 100%"> style="width: 100%">
<el-table-column
prop="id"
label="期数ID">
</el-table-column>
<el-table-column <el-table-column
prop="title" prop="title"
label="期数标题"> label="期数标题">
<template slot-scope="scope">
<router-link :to="{name:'class', query: { goods_id: scope.row.goods_id, periods_id: scope.row.id}}" >
{{scope.row.title}}
</router-link>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="goods_name" prop="goods_name"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment