Commit 9abf529c authored by 王's avatar

bug fix

parent cc0d45bc
...@@ -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, // 如果接口跨域,需要进行这个参数配置
} }
}, },
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
<el-dialog <el-dialog
title="用户详情" title="用户详情"
center center
append-to-body :visible.sync="dialogObj.show"
:visible.sync="show"
width="800px"> width="800px">
<el-row align="middle" type="flex"> <el-row align="middle" type="flex">
<el-col :span="4"><label>头像</label></el-col> <el-col :span="4"><label>头像</label></el-col>
...@@ -45,29 +44,36 @@ ...@@ -45,29 +44,36 @@
export default { export default {
name: "detail", name: "detail",
props:[ props:[
'showDetail', 'dialogObj'
'showId'
], ],
data(){ data(){
return { return {
userDetail:{}, userDetail:{},
show:this.showDetail show:false
} }
}, },
methods:{ methods:{
getDetail(){ getDetail(){
getUserDetailApi(this.showId).then(res=>{ if(!this.dialogObj.id) return;
getUserDetailApi(this.dialogObj.id).then(res=>{
this.userDetail = res this.userDetail = res
}) })
},
initDialog(){
this.getDetail();
this.show = this.dialogObj.show;
} }
}, },
watch:{ watch:{
dialogObj:{
handler: function () {
this.loading = true;
this.initDialog()
},
deep: true
},
show(value){ show(value){
this.$emit("changeShow",value); this.$emit("changeShow",value);
},
showDetail(value){
this.show = value
this.getDetail()
} }
} }
} }
......
<template>
<el-dialog
:title="dialogObj.title"
:visible.sync="dialogObj.show"
>
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="老师">
<el-select v-model="form.teacher_id" placeholder="请选择">
<el-option
v-for="(data,index) in teacherList"
:key="index"
:label="data.name"
:value="data.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogObj.show = false">取 消</el-button>
<el-button type="primary" @click="onSave">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import {getTeacherListApi,addRelatedTeacherApi} from "../../service/api";
export default {
props:[
'dialogObj'
],
data(){
return{
form:{
id: '',
teacher_id:'',
},
teacherList:[],
}
},
methods:{
initPage(){
getTeacherListApi().then(res=>{
this.teacherList = res.list
});
this.form = {
id: this.dialogObj.id,
teacher_id: this.dialogObj.teacher_id ? this.dialogObj.teacher_id : ''
};
},
onSave(){
let json = {
teacher_id: this.form.teacher_id ? this.form.teacher_id : 0
};
addRelatedTeacherApi(this.form.id, json).then(res => {
this.$message({
type: 'success',
message: '绑定成功!'
});
this.$emit("reflash");
this.dialogObj.show = false;
})
}
},
watch:{
'dialogObj'(value){
this.initPage()
}
}
}
</script>
<style scoped>
</style>
...@@ -63,8 +63,12 @@ ...@@ -63,8 +63,12 @@
label="最后登录时间"> label="最后登录时间">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="操作"> label="操作"
width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" plain type="primary" @click="bindTeacher(scope.row)">
绑定老师
</el-button>
<el-button size="mini" plain type="primary" @click="detail(scope.row)"> <el-button size="mini" plain type="primary" @click="detail(scope.row)">
查看详情 查看详情
</el-button> </el-button>
...@@ -72,7 +76,8 @@ ...@@ -72,7 +76,8 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<page :total="total" v-model="nowPage"/> <page :total="total" v-model="nowPage"/>
<detail-dialog :showDetail = "showDetail" :showId="showId" /> <detail-dialog :dialogObj="dialogDetailObj" @changeShow="changeShow"/>
<teacher-dialog :dialogObj="dialogObj" @reflash="getUser"></teacher-dialog>
</div> </div>
</template> </template>
...@@ -80,6 +85,7 @@ ...@@ -80,6 +85,7 @@
import {getUserListApi} from "../../service/api"; import {getUserListApi} from "../../service/api";
import page from '../framework/page' import page from '../framework/page'
import detailDialog from './detail' import detailDialog from './detail'
import teacherDialog from './dialog'
export default { export default {
name: "index", name: "index",
data(){ data(){
...@@ -93,12 +99,23 @@ ...@@ -93,12 +99,23 @@
total:0, total:0,
nowPage:0, nowPage:0,
showDetail:false, showDetail:false,
showId:'' showId:'',
dialogObj:{
show:false,
title:'绑定老师',
id:0,
teacher_id: 0
},
dialogDetailObj: {
show: false,
id: ''
}
} }
}, },
components:{ components:{
page, page,
detailDialog detailDialog,
teacherDialog
}, },
mounted(){ mounted(){
this.getUser() this.getUser()
...@@ -111,13 +128,22 @@ ...@@ -111,13 +128,22 @@
}) })
}, },
detail(data){ detail(data){
this.showId = data.user_id; this.dialogDetailObj = {
this.showDetail = true show: true,
id: data.user_id
}
}, },
changeShow(data){ changeShow(data){
this.showDetail=data this.dialogDetailObj.show=data
},
bindTeacher(data){
this.dialogObj = {
show:true,
title:'绑定老师',
id:data.user_id,
teacher_id: data.teacher_id
}
} }
} }
} }
</script> </script>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
label="类型" label="类型"
width="150"> width="150">
<template slot-scope="scope"> <template slot-scope="scope">
{{type | typeFilter}} {{scope.row.type | typeFilter}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -235,27 +235,28 @@ ...@@ -235,27 +235,28 @@
}, },
getList(){ getList(){
getConfigListApi({key: 'focus_reply'}).then(res => { getConfigListApi({key: 'focus_reply'}).then(res => {
if (res.total > 0) { if (res.list.length > 0) {
this.id = res.list[0].id; this.id = res.list[0].id;
console.log('res.list[0].desc', res.list[0].desc)
let _desc = JSON.parse(res.list[0].desc); let _desc = JSON.parse(res.list[0].desc);
this.list = _desc || []; this.list = _desc || [];
this.type = _desc[0].type; // this.type = _desc[0].type;
if (this.type === 'text') { // if (this.type === 'text') {
this.content = _desc[0].content // this.content = _desc[0].content
} else if (this.type === 'image') { // } else if (this.type === 'image') {
this.imageContent = { // this.imageContent = {
type: 'image', // type: 'image',
content: _desc[0].content, // content: _desc[0].content,
media_id: _desc[0].media_id // media_id: _desc[0].media_id
} // }
} // }
} }
}) })
}, },
add(){ add(){
this.dialogObj = { this.dialogObj = {
show: true, show: true,
id: null, id: this.id ? this.id : null,
index: -1, index: -1,
list: this.list list: this.list
} }
......
...@@ -131,13 +131,12 @@ ...@@ -131,13 +131,12 @@
}, },
methods:{ methods:{
initDialog(){ initDialog(){
console.log('initDialog',this.dialogObj )
this.show = this.dialogObj.show; this.show = this.dialogObj.show;
if (this.dialogObj.id) { if (this.dialogObj.id) {
this.id = this.dialogObj.id; this.id = this.dialogObj.id;
} }
this.index = this.dialogObj.index this.index = this.dialogObj.index
this.list = this.dialogObj.list this.list = this.dialogObj.list || []
if (this.index === -1) { if (this.index === -1) {
this.type = 'text' this.type = 'text'
this.content = '' this.content = ''
...@@ -160,7 +159,7 @@ ...@@ -160,7 +159,7 @@
}, },
save(){ save(){
let json = this.form let json = this.form
let _desc = this.list; let _desc = this.list || [];
if (this.type === 'text') { if (this.type === 'text') {
if (!this.content) { if (!this.content) {
this.$message({ this.$message({
...@@ -173,12 +172,15 @@ ...@@ -173,12 +172,15 @@
type : this.type, type : this.type,
content: this.content content: this.content
}; };
if (this.id){ console.log('index', this.index)
if (this.index > -1) {
_desc[this.index] = obj _desc[this.index] = obj
} else { } else {
_desc.push(obj) _desc.push(obj)
} }
console.log('save contennt _desc', _desc);
} else if (this.type === 'image') { } else if (this.type === 'image') {
console.log('image');
if (!this.imageContent) { if (!this.imageContent) {
this.$message({ this.$message({
showClose: true, showClose: true,
...@@ -186,12 +188,13 @@ ...@@ -186,12 +188,13 @@
}); });
return return
} }
if (this.id){ if (this.index > -1) {
_desc[this.index] = this.imageContent _desc[this.index] = this.imageContent
} else { } else {
_desc.push(this.imageContent) _desc.push(this.imageContent)
} }
} }
console.log('save contennt _desc', _desc);
json.desc = JSON.stringify(_desc) json.desc = JSON.stringify(_desc)
if (this.id) { if (this.id) {
updateConfigApi(this.id,json).then(res=>{ updateConfigApi(this.id,json).then(res=>{
......
...@@ -172,13 +172,15 @@ ...@@ -172,13 +172,15 @@
</div> </div>
</div> </div>
</div> </div>
<div class="tool_bar tc js_editBox"> <div class="order-btn">
<span class="btn btn_input btn_default" v-if="!showOrder"> <span class="btn btn_input btn_default" v-if="!showOrder">
<button @click="showOrder=true">排序</button> <button @click="showOrder=true">排序</button>
</span> </span>
<span class="btn btn_input btn_default" v-if="showOrder"> <span class="btn btn_input btn_default" v-if="showOrder">
<button @click="onSave">完成</button> <button @click="showOrder=false">完成</button>
</span> </span>
</div>
<div class="tool_bar tc js_editBox">
<span class="btn btn_input btn_primary" v-if="!showOrder"> <span class="btn btn_input btn_primary" v-if="!showOrder">
<button @click="onSave">保存并发布</button> <button @click="onSave">保存并发布</button>
</span> </span>
...@@ -330,6 +332,10 @@ ...@@ -330,6 +332,10 @@
.hideMenu { .hideMenu {
display: none !important; display: none !important;
} }
.order-btn {
margin-left: 132px;
margin-top: 20px;
}
.order { .order {
text-align: center; text-align: center;
padding-top: 200px; padding-top: 200px;
...@@ -466,7 +472,7 @@ ...@@ -466,7 +472,7 @@
padding-top: 20px; padding-top: 20px;
} }
.tool_bar { .tool_bar {
margin-top: 40px; /*margin-top: 40px;*/
padding-top: 20px; padding-top: 20px;
} }
.tool_bar.tc .btn { .tool_bar.tc .btn {
......
...@@ -467,7 +467,10 @@ const addBoxTypeUrl = `${_baseUrl}api/admin/category/add/1`; ...@@ -467,7 +467,10 @@ const addBoxTypeUrl = `${_baseUrl}api/admin/category/add/1`;
export const addBoxTypeApi = function (json) { export const addBoxTypeApi = function (json) {
return Vue.prototype.$post(addBoxTypeUrl, json) return Vue.prototype.$post(addBoxTypeUrl, json)
}; };
// // 用户关联老师
const addRelatedTeacherUrl = `${_baseUrl}api/admin/student/bind/`;
export const addRelatedTeacherApi = function (id,json) {
return Vue.prototype.$put(`${addRelatedTeacherUrl}/${id}`,json)
};
...@@ -5,7 +5,7 @@ import { MessageBox ,Message } from 'element-ui'; ...@@ -5,7 +5,7 @@ import { MessageBox ,Message } from 'element-ui';
import router from '../router' import router from '../router'
import Cookie from '../util/cookie' import Cookie from '../util/cookie'
// 默认超时设置 // 默认超时设置
axios.defaults.timeout = 5000; axios.defaults.timeout = 50000;
// 相对路径设置 // 相对路径设置
axios.defaults.baseURL =''; axios.defaults.baseURL ='';
//http request 拦截器 //http request 拦截器
......
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