Commit d25e3bd0 authored by 王's avatar

期数列表标题链接到班级

parent d219f747
......@@ -12,8 +12,8 @@ module.exports = {
//本地代理设置
proxyTable: {
'/api': {
target: 'http://local.base-api.sing.com', // 接口的域名
// target: 'http://wechat.test.singsingenglish.com/',
// target: 'http://local.base-api.sing.com', // 接口的域名
target: 'http://wechat.test.singsingenglish.com/',
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
}
},
......
......@@ -8,6 +8,7 @@
:props="{value:'id',label:'name'}"
@active-item-change="handleItemChange"
@change="changePeriods"
v-model="selectedGoods"
>
</el-cascader>
</el-form-item>
......@@ -110,6 +111,7 @@
type:0,
id:0
},
selectedGoods: []
}
},
components:{
......@@ -118,25 +120,37 @@
page
},
mounted(){
this.initPage()
this.initPage();
},
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(){
getGoodsListApi().then(res=>{
res.list.forEach(i=>{
i.children = [];
});
this.goodsList = res.list;
if(!this.periods) {
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()
}
this.initQuery();
});
},
showUser(data){
......
......@@ -36,13 +36,14 @@
<el-table
:data="periodList"
style="width: 100%">
<el-table-column
prop="id"
label="期数ID">
</el-table-column>
<el-table-column
prop="title"
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
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