zycp-demo/src/views/user/ucenter/index.vue

206 lines
5.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div class="content my-content main-content">
<!-- 头部 -->
<div :class="{ header: true, 'scroll white': isScrollTop }">
<div class="back"></div>
<div class="header-title">我的</div>
</div>
<!-- 轮播图 -->
<div class="banner my-banner">
<img src="../../../assets/images/user/banner.jpg" alt="" />
<div class="my-photo">
<span>
<img v-if="userData.avatar" :src="userData.avatar" />
<img v-else src="../../../assets/images/user/photo.png" />
</span>
<p v-if="userData.nick_name">{{ userData.nick_name }}</p>
<p v-else>未填写个人信息</p>
</div>
</div>
<!-- 免费咨询卡 -->
<div class="user-receive" @click="toPage()" v-if="isUse == 0">
<img src="../../../assets/images/user/card.png" alt="" />
<div class="receive-txt">
<span class="use-btn" v-if="isReceive == 1">立即使用</span>
<span class="receive-btn" v-if="isReceive == 0">立即领取</span>
<p>有效期2022.2.1-2022.2.15</p>
</div>
</div>
<div class="line" v-if="isReceive == 1"></div>
<ul class="student-information">
<li v-if="userData.mobile">
<span
><img src="../../../assets/images/user/icon-phone.png" alt=""
/></span>
<p>
手机号<em>{{ userData.mobile }}</em>
</p>
</li>
<li @click="goPage('/bind')" v-else>
<span
><img src="../../../assets/images/user/icon-phone.png" alt=""
/></span>
<p>
手机号<em>{{ userData.mobile }}</em>
</p>
<img src="../../../assets/images/home/expert/arrow-right.png" alt="" />
</li>
<li @click="goPage('/info')">
<span
><img src="../../../assets/images/user/icon-student.png" alt=""
/></span>
<p>考生信息</p>
<img src="../../../assets/images/home/expert/arrow-right.png" alt="" />
</li>
</ul>
<div class="feedback" @click="goPage('/feedback')">
<span
><img src="../../../assets/images/user/icon-feedback.png" alt=""
/></span>
<p>意见和反馈</p>
<img src="../../../assets/images/home/expert/arrow-right.png" alt="" />
</div>
<div :class="{ 'my-report': true, open: isOpen }" @click="isOpen = !isOpen">
<span
><img src="../../../assets/images/user/icon-report.png" alt=""
/></span>
<p>我的报告</p>
<img src="../../../assets/images/home/expert/arrow-right.png" alt="" />
</div>
<ul :class="{ 'report-list': true, open: isOpen }">
<li v-for="(item,index) in dataList" :key="index" @click="goPage(item.id)">
<p>{{item.title}}</p>
<span>{{item.done_at}}</span>
</li>
</ul>
<div class="feedback-btn">退出登录</div>
<tabbar :current="4"></tabbar>
</div>
</template>
<script>
import tabbar from "../../../components/tabbar.vue";
export default {
name: "expert",
components: {
tabbar,
},
data() {
return {
centerUserData: {
mobile: "",
},
dataList:[],
isScrollTop: false,
isReceive: 1, //是否领取咨询机会
isUse: 0, //是否使用
isOpen: false,
userData: {
avatar: "",
consult_amount: 0,
create_time: "",
ding_code: "",
expert_id: 0,
gender: 0,
id: 31,
im_uid: "",
lat: "",
lng: "",
login_time: "",
mobile: "",
nick_name: "",
open_id: "",
real_name: "",
tags: "",
tel: "",
type: 0,
unionid: "",
update_time: "",
user_code: "",
},
};
},
created() {
this.isScroll = true;
window.addEventListener("scroll", this.eventScrollTop);
this.getUserData();
this.getevaluationList()
},
methods: {
getevaluationList(){
let that=this
this.axios.post(this.HOME + "/api/evaluation/evaluation-list",{
page:"1",
size:"100",
status:""
}).then(function (res) {
that.dataList=res.data.data.list
});
},
// 判断跳转方式
toPage() {
if (this.isReceive == 1) {
this.$router.push("/expert");
} else if (this.isReceive == 0) {
this.$router.push("/information");
} else {
return false;
}
},
// 页面跳转
goPage(id) {
this.$router.push({
path: "/report",
query: {
id:id
},
});
},
// 获取用户信息
getUserData() {
let that = this;
this.axios.post(this.HOME + "/api/user/center-info").then(function (res) {
that.userData = res.data.data;
location.centerUserData = JSON.stringify(that.userData);
});
},
// 滚动改变样式
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进入时触发
activated() {
this.isScroll = true;
window.addEventListener("scroll", this.eventScrollTop);
},
//keep-alive离开时触发
deactivated() {
window.removeEventListener("scroll", this.eventScrollTop);
},
};
</script>
<style scoped>
.banner,
.banner img {
width: 100%;
}
</style>