YingXingAI/pages/my/TeacherList/TeacherList.vue

318 lines
7.8 KiB
Vue

<template>
<view @tap="btnShow = false">
<u-navbar title="任职院校" :custom-back="router"></u-navbar>
<view class="list">
<view :class="{'item-selsect': item.isSelected}" class="flex-col list-item" v-for="(item, index) in schoolList" :key="index" @click="teacherIdx(item)">
<view class="flex-col section_2">
<view class="justify-between section_3 view_8">
<view class="flex-row">
<image :src="$u.http.config.imgUrl + item.logo.slice(1)" class="image_2" />
<text class="text_1 text_23">{{ item.school }}</text>
</view>
<u-button
v-if="item.certifyStatus == 0"
disabled
class="text-wrapper"
type="success"
plain
size="mini"
shape="circle"
>待审核</u-button
>
<u-button
v-if="item.certifyStatus == 2"
disabled
class="text-wrapper"
type="error"
plain
size="mini"
shape="circle"
>不通过</u-button
>
<!-- @click="toAuthentication(item)" -->
<u-button
v-if="item.certifyStatus == 1"
class="text-wrapper"
type="primary"
size="mini"
shape="circle"
ripple
>通过</u-button
>
<!-- <navigator url='#' class="flex-col items-center text-wrapper view_9"><text class="text_3 text_24">去认证</text></navigator> -->
</view>
<view class="group_3">
<text class="text_5">教师</text>
<text class="text_7"></text>
</view>
<!-- <view class="group_3">
<text class="text_5">学历:</text>
<text class="text_7">{{ item.educationStr }}</text>
</view>
<view class="group_3">
<text class="text_5">学院:</text>
<text class="text_7">{{ item.college }}</text>
</view>
<view class="group_3">
<text class="text_5">专业:</text>
<text class="text_7">{{ item.major }}</text>
</view>
<view class="group_3">
<text class="text_5">时间:</text>
<text class="text_7">{{ item.startYear }}-{{ item.endYear }}</text>
</view> -->
<view
class="flex-row justify-end"
style="margin-right: 0.2rem; position: relative"
v-if="item.certifyStatus === 2 && schoolList.length > 1"
@tap.stop="
isindex = index;
btnShow = !btnShow;
"
>
<u-icon name="more-dot-fill" color="#ccc" size="28"></u-icon>
<view class="btns" v-show="isindex == index && btnShow">
<view class="item" @tap="onDelete(item)">删除</view>
</view>
</view>
</view>
<!-- <text class="text_21">已有10000名校友加入</text> -->
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
export default {
data() {
return {
isindex: -1,
btnShow: false,
schoolList: [], //教育经历列表
};
},
onLoad() {
// this.onSchoolData()
},
onShow() {
this.onSchoolData();
},
methods: {
toAuthentication(item) {
this.$u.route({
url: "pages/my/shoolAuthentication/shoolAuthentication",
params: {
educationId: item.id,
},
});
},
onSchoolData() {
const data = {
userId: this.vuex_user.id,
};
this.$u.apiList.MyPage(data).then((res) => {
// console.log(JSON.parse(JSON.stringify(res)), "res");
this.schoolList = res.edcationList;
});
return;
this.$u.apiList.MyEducations(data).then((res) => {
this.schoolList = res;
});
},
//删除
async onDelete(item) {
console.log(item,'item--');
const req = {
userId: this.vuex_user.id,
}
const res = await this.$u.apiList.MyPage(req)
const edcationList = res.edcationList
console.log(JSON.parse(JSON.stringify(edcationList)),'res')
if(!edcationList.length){
this.$refs.uToast.show({
title: "至少保留一条教育经历",
type: "error",
});
return
}
const findRow = edcationList.find(x=>x.isSelected === true);
console.log(findRow,'findRow')
if(findRow.id === item.id){
this.$refs.uToast.show({
title: "不可删除当前选中院校",
type: "error",
});
return
}
// return
this.$u.apiList
.DeleteJZGApi({
id: item.id,
})
.then((res) => {
this.$refs.uToast.show({
title: "删除成功",
type: "success",
});
this.onSchoolData();
});
},
// 选择学校
async teacherIdx(item) {
console.log(item, "item--");
if (item.isSelected) {
this.$refs.uToast.show({
title: "已选择该学校",
type: "warning",
});
// this.$tips( "已选择该学校","warning");
return;
}
const req = {
userId: this.vuex_user.id,
educationId: item.id,
};
const res = await this.$u.apiList.SelectJZGApi(req);
console.log(res, "res--选择学校");
this.$u.vuex("vuex_token", res.token);
this.$u.vuex("vuex_glyType", res.glyType);
this.glyType = res.glyType;
this.$refs.uToast.show({
title: "绑定学校成功",
type: "success",
});
this.onSchoolData();
// this.$tips( "绑定学校成功","success");
this.$u.vuex("vuex_user", res.user);
},
//返回上一级
router() {
uni.switchTab({
url: "../../my/my/my",
});
},
},
};
</script>
<style lang="scss" scoped>
.btns {
background-color: #fff;
box-shadow: 0 0 0.05rem #ccc;
border-radius: 0.05rem;
position: absolute;
bottom: 150%;
.item {
line-height: 2;
padding: 0 0.1rem;
}
}
.item-selsect{
border-color: #2e9bff!important;
}
.list {
padding: 0.18rem 0.15rem 0;
.list-item {
margin-bottom: 0.18rem;
border: 2rpx solid #fff;
border-radius: 0.1rem;
}
.section_2 {
padding-bottom: 0.2rem;
background-color: #ffffff;
border-radius: 0.1rem;
}
.text_21 {
margin-left: 0.03rem;
margin-top: 0.085rem;
align-self: flex-start;
color: #a0a2ac;
font-size: 0.14rem;
font-family: PingFang;
line-height: 0.14rem;
}
.section_3 {
padding: 0.05rem 0.15rem 0.05rem 0.23rem;
background-color: #ffffff;
box-shadow: 0.0002rem 0.005rem #1d262e14;
border-radius: 0.1rem 0.1rem 0px 0px;
}
.group_3 {
margin-left: 0.26rem;
margin-top: 0.15rem;
align-self: flex-start;
line-height: 0.14rem;
}
.text-wrapper {
margin: 0.025rem 0;
width: 0.75rem;
height: 0.25rem;
}
.text_5 {
color: #373b48;
font-size: 0.15rem;
font-family: PingFang;
line-height: 0.14rem;
}
.text_7 {
color: #373b48;
font-size: 0.15rem;
font-family: PingFang;
line-height: 0.14rem;
}
.image_2 {
flex-shrink: 0;
width: 0.3rem;
height: 0.3rem;
}
.text_1 {
margin-left: 0.07rem;
align-self: center;
color: #373b48;
font-size: 0.15rem;
font-family: PingFang;
line-height: 0.14rem;
}
.text_3 {
color: #15c349;
font-size: 0.13rem;
font-family: PingFang;
line-height: 0.13rem;
}
.view_8 {
padding: 0.05rem 0.14rem 0.05rem 0.23rem;
}
.view_9 {
padding: 0.06rem 0 0.065rem;
background-color: #2e9bff;
box-sizing: border-box;
}
.text_23 {
margin-left: 0.075rem;
line-height: 0.16rem;
}
.text_24 {
color: #ffffff;
}
}
</style>