diff --git a/config/index.js b/config/index.js index 4d05fbb6161bd9fa978e2037d76e6d06ec642a1b..a0325b196a0c4f710414500e5f6b4cdab8b49171 100644 --- a/config/index.js +++ b/config/index.js @@ -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, // 如果接å£è·¨åŸŸï¼Œéœ€è¦è¿›è¡Œè¿™ä¸ªå‚æ•°é…ç½® } }, diff --git a/src/components/user/detail.vue b/src/components/user/detail.vue index a66e64e491c06b981a2c0f88af6121ff78bd3fb0..d7785d10e19fe80a5673f29ae8a703c89aaba05d 100644 --- a/src/components/user/detail.vue +++ b/src/components/user/detail.vue @@ -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() } } } diff --git a/src/components/user/dialog.vue b/src/components/user/dialog.vue new file mode 100644 index 0000000000000000000000000000000000000000..d969d66962c750654fe91d47bcf985fbcd906074 --- /dev/null +++ b/src/components/user/dialog.vue @@ -0,0 +1,74 @@ +<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> diff --git a/src/components/user/index.vue b/src/components/user/index.vue index e63c99055cc1c48f66d2482823fb46d102f74df9..daaf02589a46891fb98c2ca0e69a3295788ef1c5 100644 --- a/src/components/user/index.vue +++ b/src/components/user/index.vue @@ -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> diff --git a/src/components/weChat/focusReply.vue b/src/components/weChat/focusReply.vue index 8db75d5aa84f15f3d38902f4864d62f9198494c0..3220afefd09d04223ad76a38cd673ecb4693cc30 100644 --- a/src/components/weChat/focusReply.vue +++ b/src/components/weChat/focusReply.vue @@ -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 } diff --git a/src/components/weChat/focusReplyDialog.vue b/src/components/weChat/focusReplyDialog.vue index e6f9a41ad433e4bb924793dca78658f9c71b84a9..c25e92fa4a5e5b77df33f0b944d8f510ecf529cd 100644 --- a/src/components/weChat/focusReplyDialog.vue +++ b/src/components/weChat/focusReplyDialog.vue @@ -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=>{ diff --git a/src/components/weChat/index.vue b/src/components/weChat/index.vue index 12f99dd48a93c6e58985106f5283759576999065..5ed987a9080f3f8b3d216c5cec1f5e1d36e621d5 100644 --- a/src/components/weChat/index.vue +++ b/src/components/weChat/index.vue @@ -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 { diff --git a/src/service/api.js b/src/service/api.js index bd4dcc716d28b6133233e7768cc8cd33d9872149..704eb1e381a3727a897dce0711827a0883636046 100644 --- a/src/service/api.js +++ b/src/service/api.js @@ -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) +}; diff --git a/src/service/index.js b/src/service/index.js index b10a09596fca04244dfde3fcf7c5946079bb3e38..386b42cc942935b523488f30939d92e304ec642e 100644 --- a/src/service/index.js +++ b/src/service/index.js @@ -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 拦截器