diff --git a/src/App.vue b/src/App.vue index 566ea6a..89f6568 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2106,6 +2106,11 @@ textarea::-webkit-input-placeholder{ width: 4rem; height: 3rem; border: .02rem dashed #dedede; + overflow: hidden; +} +.cover-img img{ + width: 4rem; + min-height: 3rem; } .cover-btn{ width: 1.5rem; @@ -2117,6 +2122,19 @@ textarea::-webkit-input-placeholder{ color: #FFFFFF; text-align: center; margin-left: .5rem; + position: relative; +} + +.cover-btn>input{ + display: block; + width: 1.5rem; + height: .6rem; + opacity: 0; + border-radius: .1rem; + position: absolute; + left: 0; + top: 0; + z-index: 1; } .case-msg{ padding: .2rem .25rem; @@ -2190,6 +2208,11 @@ textarea::-webkit-input-placeholder{ width: 4rem; height: 4.25rem; border: .02rem dashed #dedede; + overflow: hidden; +} +.personal-photo img{ + width: 4rem; + min-height: 4.25rem; } .personal-photo>span{ display: block; @@ -2208,6 +2231,18 @@ textarea::-webkit-input-placeholder{ border-radius: .1rem; text-align: center; color: #FFFFFF; + position: relative; +} +.edit-btn input{ + display: block; + width: 1.5rem; + height: .6rem; + border-radius: .1rem; + opacity: 0; + position: absolute; + left: 0; + top: 0; + z-index: 1; } .personal-item .left{ display: flex; diff --git a/src/views/consultant/case.vue b/src/views/consultant/case.vue index d4a0c4e..00c58c9 100644 --- a/src/views/consultant/case.vue +++ b/src/views/consultant/case.vue @@ -1,100 +1,213 @@ <template> - <div class="content my-content"> + <div class="content my-content"> <!-- 头部 --> <div :class="{'header':true,'scroll white':isScrollTop,'white':true}"> <div class="back" @click="$router.go(-1)"><img src="../../assets/images/home/expert/back.png" alt=""></div> - <div class="header-title">我的案例</div> + <div class="header-title">{{title}}</div> </div> <div class="case pull-content"> <div class="case-cover"> <p>封面图:</p> <div class="cover-img"> - + <img v-if="myAvatar" :src="host + myAvatar"> + <img v-else-if="headImg" :src="host + headImg"> </div> - <div class="cover-btn">上传</div> + + <button class="cover-btn" @change="imgIny($event)"> + <input class="inputB" @change="imgIny($event)" type="file" /> + 上传 + </button> </div> <ul class="case-msg"> <li> <p>标题:</p> - <input type="text" v-model="gName" placeholder="请输入标题"/> + <input type="text" v-model="caseTitle" placeholder="请输入标题" /> </li> <li> <p>学生姓名:</p> - <input type="text" v-model="gPhone" placeholder="请输入学生姓名"/> + <input type="text" v-model="student_name" placeholder="请输入学生姓名" /> </li> <li> <p>是否主案例</p> <div class="course-list key-list"> - <span :class="{'checked':index==checkedIndex}" v-for="(item,index) in caseData" :key="index" @click="changeCase(index)">{{item.title}}</span> + <span :class="{'checked':isIndex==1}" @click="isIndex=1">是</span> + <span :class="{'checked':isIndex!==1}" @click="isIndex=0">否</span> </div> </li> <li> <p>录取结果:</p> - <textarea placeholder="请输入录取结果"></textarea> + <textarea v-model="result_remarks" placeholder="请输入录取结果"></textarea> </li> <li> <p>专业定位:</p> - <textarea placeholder="请输入专业定位"></textarea> + <textarea v-model="location_remarks" placeholder="请输入专业定位"></textarea> </li> <li> <p>其他说明:</p> - <textarea placeholder="请输入其他说明"></textarea> + <textarea v-model="other_remarks" placeholder="请输入其他说明"></textarea> </li> <li> <p>客户反馈:</p> - <textarea placeholder="请输入客户反馈"></textarea> + <textarea v-model="account_remarks" placeholder="请输入客户反馈"></textarea> </li> </ul> - <div class="case-btn">确认</div> + <div class="case-btn" @click="addCase()">确认</div> </div> - </div> + </div> </template> <script> - export default { - name: "case", - data(){ - return { + export default { + name: "case", + data() { + return { isScrollTop: false, + title: '', + myAvatar: '', gName: '', gPhone: '', - caseData: [ - {title:'是'}, - {title:'否'} + caseData: [{ + title: '是' + }, + { + title: '否' + } ], checkedIndex: 0, - } + headImg: '', //案例封面图 + caseTitle: '', //案例标题 + student_name: '', //考生姓名(限制:100字) + result_remarks: '', //录取结果 + location_remarks: '', //专业定位 + other_remarks: '', //其他说明 + account_remarks: '', //客户反馈 + isIndex: 1, //是否为主案例(咨询师详情页展示案例),0否,1是。 + id: '' //案例id + } }, created() { this.isScroll = true; window.addEventListener("scroll", this.eventScrollTop); }, - methods:{ - // 选择是否主案例 - changeCase(index){ - this.checkedIndex = index + mounted() { + let anliObj = (JSON.parse(localStorage.getItem("anliObj"))); + console.log(anliObj, 1234) + if (anliObj) { + this.id = anliObj.id, + this.isIndex = anliObj.is_main, + this.caseTitle = anliObj.title, + this.headImg = anliObj.cover, + this.student_name = anliObj.student_name, + this.result_remarks = anliObj.result_remarks, + this.location_remarks = anliObj.location_remarks, + this.other_remarks = anliObj.other_remarks, + this.account_remarks = anliObj.account_remarks, + this.title = '编辑案例' + } else { + this.title = '新增案例' + } + + }, + methods: { + // 上传封面图 + imgIny(e) { + let that = this; + const files = e.target.files; + console.log(files[0]); + console.log({ + image: files[0] + }); + var fromdata = new FormData(); + fromdata.append("image", files[0]); + this.axios + .post(this.HOME + "/api/file/upload/image", fromdata, { + headers: { + "Content-Type": "multipart/form-data", + }, + }) + .then(function(res) { + that.myAvatar = res.data.data.src; + console.log(that.myAvatar, 123); + }) + .catch(function(error) { + console.log(error); + }); }, - // 页面跳转 - goPage(path){ - this.$router.push(path); + + // 编辑案例 + editEv() { + let that = this; + that.headImg = that.myAvatar; + this.axios + .post(this.HOME + "/api/expert/edit-expert-case", { + id: that.id, // 当前需要编辑的案例ID + title: that.caseTitle, //标题 + cover: that.headImg, //封面图地址(限制:250字),有图片上传接口获取 + is_main: that.isIndex, //是否为主案例(咨询师详情页展示案例),0否,1是。 + student_name: that.student_name, //考生姓名(限制:100字) + result_remarks: that.result_remarks, //录取结果 + location_remarks: that.location_remarks, //专业定位 + other_remarks: that.other_remarks, //其他说明 + account_remarks: that.account_remarks //客户反馈 + }) + .then(function(res) { + alert("编辑案例成功"); + that.$router.push('/consultant'); + console.log(res); + }) + .catch(function(error) { + console.log(error); + }); }, - // 滚动改变样式 - eventScrollTop() { - let scrollTop = document.body.scrollTop || document.documentElement.scrollTop; - if (scrollTop >= 5) { - if (this.isScroll) { - this.isScroll = false; - this.isScrollTop = true; - } + + // 新增案例 + addCase() { + let that = this; + if (that.id) { + that.editEv(); } else { - if (!this.isScroll) { - this.isScroll = true; - this.isScrollTop = false; - } + that.headImg = that.myAvatar; + this.axios + .post(this.HOME + "/api/expert/add-expert-case", { + title: that.caseTitle, //标题 + cover: that.headImg, //封面图地址(限制:250字),有图片上传接口获取 + is_main: that.isIndex, //是否为主案例(咨询师详情页展示案例),0否,1是。 + student_name: that.student_name, //考生姓名(限制:100字) + result_remarks: that.result_remarks, //录取结果 + location_remarks: that.location_remarks, //专业定位 + other_remarks: that.other_remarks, //其他说明 + account_remarks: that.account_remarks //客户反馈 + }) + .then(function(res) { + alert("新增案例成功"); + that.$router.push('/consultant'); + console.log(res); + }) + .catch(function(error) { + console.log(error); + }); } } - }, - destroyed() { + }, + + + // 滚动改变样式 + eventScrollTop() { + let scrollTop = document.body.scrollTop || document.documentElement.scrollTop; + if (scrollTop >= 5) { + if (this.isScroll) { + this.isScroll = false; + this.isScrollTop = true; + } + } else { + if (!this.isScroll) { + this.isScroll = true; + this.isScrollTop = false; + } + } + }, + + destroyed() { window.removeEventListener("scroll", this.eventScrollTop); }, //keep-alive进入时触发 @@ -106,9 +219,9 @@ deactivated() { window.removeEventListener("scroll", this.eventScrollTop); } - } + } </script> <style scoped> - -</style> \ No newline at end of file + +</style> diff --git a/src/views/consultant/edit.vue b/src/views/consultant/edit.vue index 9ca8d36..c957289 100644 --- a/src/views/consultant/edit.vue +++ b/src/views/consultant/edit.vue @@ -8,18 +8,22 @@ <div class="edit pull-content"> <div class="edit-list"> <div class="personal-item"> - <p>姓名:<span>李四</span></p> - <p>等级:<span>金牌咨询师</span></p> + <p>姓名:<span>{{name}}</span></p> + <p>等级:<span>{{tags_text}}</span></p> </div> <!-- 形象照 --> <div class="personal-item"> <p>形象照</p> <div class="personal-txt"> <div class="personal-photo"> - <span>上传图片的区域,照片必须使用固定的宽高比16:17,比如宽400像素,高425像素,或其它同等比例</span> - <!-- <img src="" alt=""> --> + <img v-if="myAvatar" :src="host + myAvatar"> + <img v-else-if="handImg" :src="host + handImg"> + <span v-else>上传图片的区域,照片必须使用固定的宽高比16:17,比如宽400像素,高425像素,或其它同等比例</span> + </div> + <div class="edit-btn"> + <input class="inputB" @change="imgIny($event)" type="file" /> + 上传 </div> - <div class="edit-btn">上传</div> </div> </div> <!-- 关键特征 --> @@ -241,6 +245,8 @@ data(){ return { isScrollTop: false, + name:'', + tags_text: '', sloganData: '', bodyData: '', explainData: '', @@ -297,13 +303,44 @@ isPrice4: false, //价格列表是否显示 priceIndex4: 0, priceValue4:'', //选择价格值 + handImg: '' ,//头像 + + myAvatar: '' + } }, created() { this.isScroll = true; window.addEventListener("scroll", this.eventScrollTop); }, + mounted() { + this.checkExperInfo(); + }, methods:{ + // 上传形象照 + imgIny(e) { + let that = this; + const files = e.target.files; + console.log(files[0]); + console.log({ + image: files[0] + }); + var fromdata = new FormData(); + fromdata.append("image", files[0]); + this.axios + .post(this.HOME + "/api/file/upload/image", fromdata, { + headers: { + "Content-Type": "multipart/form-data", + }, + }) + .then(function(res) { + that.myAvatar = res.data.data.src; + console.log(that.myAvatar, 123); + }) + .catch(function(error) { + console.log(error); + }); + }, // 城市选择 openCity1(){ this.isCity1=!this.isCity1; @@ -363,10 +400,30 @@ this.isPrice4=false; }, + + // 查询咨询师信息 + checkExperInfo(){ + let that =this; + this.axios + .post(this.HOME + "/api/user/center-info", { + + }) + .then(function(res) { + let newArray = res.data.data.expert; + that.handImg = newArray.avatar; + that.name = newArray.name; + that.tags_text = newArray.tags_text; + that.sloganData = newArray.slogan; + console.log(res.data.data.expert,123); + }); + }, + + // 页面跳转 goPage(path){ this.$router.push(path); }, + // 滚动改变样式 eventScrollTop() { let scrollTop = document.body.scrollTop || document.documentElement.scrollTop; diff --git a/src/views/consultant/index.vue b/src/views/consultant/index.vue index 7f783d7..0d977e0 100644 --- a/src/views/consultant/index.vue +++ b/src/views/consultant/index.vue @@ -1,5 +1,5 @@ <template> - <div class="content my-content"> + <div class="content my-content"> <!-- 头部 --> <div :class="{'header':true,'scroll white':isScrollTop,'white':true}"> <div class="back"></div> @@ -38,7 +38,9 @@ </li> <li v-for="(item,index) in expertCase" :key="index"> <span><img :src="host + item.cover"></span> - <span><p>{{item.title}}</p></span> + <span> + <p>{{item.title}}</p> + </span> <span>{{item.is_main==1?"是":"否"}}</span> <span> <ins> @@ -49,23 +51,23 @@ </li> </ul> </div> - </div> + </div> </template> <script> - export default { - name: "consultant", - data(){ - return { + export default { + name: "consultant", + data() { + return { isScrollTop: false, id: '', - page: 1,//页数 - size: 10,//条数 - is_main: -1,//主案件筛选 - allowLoad:true,//是否允许加载 默认:允许 - experObj: [],//咨询师详情 - expertCase: [],//咨询师案例 - } + page: 1, //页数 + size: 10, //条数 + is_main: -1, //主案件筛选 + allowLoad: true, //是否允许加载 默认:允许 + experObj: [], //咨询师详情 + expertCase: [], //咨询师案例 + } }, created() { this.isScroll = true; @@ -74,85 +76,97 @@ mounted() { this.checkExperInfo(); }, - methods:{ + methods: { // 查询咨询师信息 - checkExperInfo(){ - let that = this; - this.axios - .post(this.HOME + "/api/user/center-info", { - }) - .then(function(res) { - console.log(res,123) + checkExperInfo() { + let that = this; + this.axios + .post(this.HOME + "/api/user/center-info", {}) + .then(function(res) { + console.log(res, 123) that.experObj = res.data.data.expert - // that.id = that.experObj.id; + that.id = that.experObj.id; // 查询咨询师案例 that.getExpertCase(that.id) - }); - }, - + }); + }, + // 获取案例列表 - getExpertCase(id){ + getExpertCase(id) { let that = this; let anId = id; this.axios .post(this.HOME + "/api/expert/get-expert-case-list", { page: that.page, - size: that.size, - expert_id: anId, - is_main: that.is_main + size: that.size, + expert_id: anId, + is_main: that.is_main }) .then(function(res) { let list = res.data.data.list; let newArray = []; that.expertCase = []; - list.forEach(item=>{ - let obj = { - id:item.id, - cover: item.cover, - title: item.title, - result_remarks: item.result_remarks, - location_remarks: item.location_remarks, - other_remarks: item.other_remarks, - account_remarks: item.account_remarks, - is_main:item.is_main, - student_name:item.student_name - } - newArray.push(obj); + list.forEach(item => { + let obj = { + id: item.id, + cover: item.cover, + title: item.title, + result_remarks: item.result_remarks, + location_remarks: item.location_remarks, + other_remarks: item.other_remarks, + account_remarks: item.account_remarks, + is_main: item.is_main, + student_name: item.student_name + } + newArray.push(obj); }) that.expertCase = that.expertCase.concat(newArray); }); }, - + // 编辑案例 - editCase(index){ - let editIndex = index; - localStorage.anliObj = JSON.stringify(editIndex); - this.$router.push('/case'); - }, - - - // 删除案例 - deleteCase(idk){ - let that = this; + editCase(index) { + let editIndex = index; + localStorage.anliObj = JSON.stringify(this.expertCase[editIndex]); + this.$router.push('/case'); + }, + + + // 删除案例 + deleteCase(idk) { + let that = this; let anId = idk; - this.axios - .post(this.HOME + "/api/expert/get-expert-case-list", { - ids:anId - }) - .then(function(res) { - console.log(res,2525) + this.axios + .post(this.HOME + "/api/expert/delete-expert-case", { + ids: anId + }) + .then(function(res) { + console.log(res, 2525) alert('删除成功'); - that.getExpertCase(that.id); - }); - }, - + that.getExpertCase(that.id); + }); + }, + // 修改基本资料 - editInformation(){ + editInformation() { this.$router.push('/edit'); }, + + // 新增案例 + addCase() { + localStorage.anliObj = JSON.stringify(""); + this.$router.push({ + path: '/case', + name: 'case', + query: { + id: this.id + }, + }); + }, + // 页面跳转 - goPage(path){ - this.$router.push(path); + goPage(path) { + this.$router.push(path); }, // 滚动改变样式 eventScrollTop() { @@ -169,7 +183,7 @@ } } } - }, + }, destroyed() { window.removeEventListener("scroll", this.eventScrollTop); }, @@ -182,9 +196,9 @@ deactivated() { window.removeEventListener("scroll", this.eventScrollTop); } - } + } </script> <style scoped> - -</style> \ No newline at end of file + +</style> diff --git a/src/views/user/information/index.vue b/src/views/user/information/index.vue index 81b57ef..c481733 100644 --- a/src/views/user/information/index.vue +++ b/src/views/user/information/index.vue @@ -355,7 +355,7 @@ // 获取考生信息 setStudentInfo() { let that =this; - if(this.temporaryCode.length != this.addrData[this.addrIndex].subject_max){ + if(that.temporaryCode.length != that.addrData[that.addrIndex].subject_max){ console.log('弹框提示,必须选择多少个科目'); } else { let data = { @@ -363,7 +363,7 @@ student_gender: that.sexIndex==0 ? 1 : 2,//性别 student_native: that.addrData[that.addrIndex].code, //考籍(省级)编号 student_native_str: that.addrData[that.addrIndex].name,//考籍(省级)名称 - // student_subject: this.temporaryCode.join(','),//选科组合(选科ID,多个用英文逗号分割) + student_subject: that.temporaryCode.join(','),//选科组合(选科ID,多个用英文逗号分割) student_exam_year: that.dateValue,//高考年份 is_art: that.dateIndex==1?1:0,//是否是艺考生 is_PE:that.dateIndex==2?1:0,//是否是体考生 @@ -371,7 +371,7 @@ province_ranking: that.provinceRanking,//预估/省内排名 achievement_high: '',//高考成绩,-1表示未考(用户留空时默认传值为-1) } - console.log(data) + console.log(data,2525) } // let that = this; // this.axios