Commit 9abf529c authored by 王's avatar

bug fix

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