You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

739 lines
19 KiB

<template>
<view class="container">
<image class="cbg" :src="base.imgHost('common_bg.png')"></image>
<!-- <view class="map-btn" @click="goToMap">
<u-icon name="map" color="#fff" size="32"></u-icon>
<text class="map-text">校友地图</text>
<view>按照姓名首字母顺序排列,排名不分先后</view>
<view>如需校友联系方式,可咨询班主任</view>
</view> -->
<view class="search">
<view class="search-icon" @click="showSearch=!showSearch">
<image :src="base.imgHost('search.png')"></image>
</view>
<view class="search-tab">
<u-tabs :bg-color="'#f0f7fc'" active-color="#b89155" :list="selectArr.company_industry" name="value"
:is-scroll="true" :current="current" @change="changeSearch"></u-tabs>
</view>
</view>
<!-- 字母 -->
<view class="next-scroll-right">
<view :class="{'next-scroll-right-name':true,'next-scroll-right-select':select.letter==''}"
@click.stop="changeLetter('All')">
All
</view>
<view :class="{'next-scroll-right-name':true,'next-scroll-right-select':select.letter===item}"
v-for="(item,index) in letterList" :key="index" @click.stop="changeLetter(item)">{{item}}
</view>
</view>
<view class="wrap">
<view v-if="hasData">
<view class="tips">
<view class="map-btn" @click="goToMap">
<u-icon name="map" color="#fff" size="32"></u-icon>
<text class="map-text">校友地图</text>
</view>
<view class="map-btn map-setting" @click="showSetting=true">
<u-icon name="setting" color="#fff" size="32"></u-icon>
<text class="map-text">设置</text>
</view>
</view>
<scroll-view style="height:100vh" :scroll-y="true" @scrolltolower="scrollGet" class="list">
<view class="left-item-card" v-for="(mess,inx) in list" :key="inx">
<view class="left-item-card-info">
<view class="left-item-card-name">
<view>
<text style="font-size:32rpx;color:#000">{{mess.name}}</text>
</view>
</view>
<view v-if="mess['company_name']" style="font-size:28rpx;color:#666;margin-bottom:10rpx">
{{mess['company_name']?'公司:'+mess['company_name']:''}}</view>
<view v-if="mess['company_position']"
style="font-size:28rpx;color:#666;margin-bottom:10rpx">
{{mess['company_position']?'职务:'+mess['company_position']:''}}
</view>
<view v-if="mess['open_mobile']"
style="font-size:28rpx;color:#666;margin-bottom:10rpx">
{{mess['mobile']?'联系方式:'+mess['mobile']:''}}
</view>
<view v-if="mess['company_product']"
style="font-size:28rpx;color:#666;margin-bottom:10rpx">
{{mess['company_product']?"主营业务:"+mess['company_product']:''}}
</view>
<view v-if="mess['course_signs'].length>0"
style="font-size:28rpx;color:#666;margin-bottom:10rpx">
<block v-if="mess['course_signs'][0].course">
<view>班级:{{mess['course_signs'][0].course.year?mess['course_signs'][0].course.year+'年':''}}{{mess['course_signs'][0].course.type_detail?mess['course_signs'][0].course.type_detail.name+'|':''}}{{mess['course_signs'][0].course.name||''}}</view>
</block>
</view>
</view>
</view>
<!-- <nextIndexedXlist :dataList="list" :show-avatar="false">
</nextIndexedXlist> -->
</scroll-view>
</view>
<view class="nodata" v-else>
<u-empty mode="data"></u-empty>
</view>
</view>
<view class="modal" v-if="showSearch">
<view>
<text>姓名:</text>
<u-input v-model="select.name" border placeholder="请输入姓名"></u-input>
</view>
<view>
<text>公司名称:</text>
<u-input v-model="select.company_name" border placeholder="请输入公司名称"></u-input>
</view>
<!-- <view>
<text>职务:</text>
<u-input v-model="select.company_position" type="select" @click="showPosition=true" border
placeholder="请选择"></u-input>
</view> -->
<view>
<text>企业性质:</text>
<u-input v-model="select.company_type" type="select" @click="showType=true" border
placeholder="请选择"></u-input>
</view>
<view>
<text>所属行业:</text>
<u-input v-model="select.company_industry" type="select" @click="showIndustry=true" border
placeholder="请选择"></u-input>
</view>
<view>
<text>所属区域:</text>
<u-input v-model="select.company_area" type="select" @click="showArea=true" border
placeholder="请选择"></u-input>
</view>
<view class="modal-btn">
<view @click="resetSearch">重置</view>
<view class="modal-btn-search" @click="confirmSearch">检索</view>
</view>
</view>
<!-- <u-picker @confirm="selectPosition" v-model="showPosition" :range="selectArr.company_position" range-key="value"
mode="selector"></u-picker> -->
<u-picker @confirm="selectArea" v-model="showArea" :range="selectArr.company_area" range-key="value"
mode="selector"></u-picker>
<u-picker @confirm="selectType" v-model="showType" :range="selectArr.company_type" range-key="value"
mode="selector"></u-picker>
<u-picker @confirm="selectIndustry" v-model="showIndustry" :range="selectArr.company_industry" range-key="value"
mode="selector"></u-picker>
<!-- 设置弹窗 -->
<u-popup v-model="showSetting" mode="center" border-radius="20" width="80%">
<view class="setting-popup">
<view class="setting-title">设置</view>
<view class="setting-tip">您想给哪些校友展示联系电话?</view>
<view class="setting-list">
<!-- 同班同学 - 固定项 -->
<view class="setting-item setting-item-fixed">
<view class="setting-item-name">同班同学</view>
<u-checkbox
:value="true"
active-color="#b89155"
:disabled="true"
></u-checkbox>
</view>
<!-- 其他课程类型 -->
<view
v-for="item in courseType"
:key="item.id"
class="setting-item"
@click="toggleCourseType(item.id)"
>
<view class="setting-item-name">{{ item.name }}</view>
<u-checkbox
:value="selectedCourseTypes.includes(item.id)"
active-color="#b89155"
></u-checkbox>
</view>
</view>
<view class="setting-buttons">
<view class="setting-btn setting-btn-cancel" @click="showSetting=false">取消</view>
<view class="setting-btn setting-btn-confirm" @click="saveSettings">确定</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import nextIndexedXlist from '@/components/next-indexed-xlist/components/next-indexed-xlist/next-indexed-xlist.vue';
export default {
components: {
nextIndexedXlist
},
data() {
return {
showSearch: false,
showPosition: false,
showArea: false,
showType: false,
showIndustry: false,
selectArr: {
// company_position: [],
company_area: [],
company_type: [],
company_industry: [{
value: '全部'
}],
},
select: {
name: '',
company_name: '',
// company_position: '',
company_area: '',
company_type: '',
company_industry: '',
letter:''
},
current: 0,
list: [],
current_page: 1,
total_page: 0,
hasData: true,
letterList:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],
courseType: [],
showSetting: false,
selectedCourseTypes: [] // 选中的课程类型ID数组
}
},
onLoad() {
this.getUserInfo()
this.getMyCourseTxl()
this.getIndustry()
this.getCourseType()
},
methods: {
// 获取可授权的课程体系
async getCourseType() {
const res = await this.$u.api.otherConfig()
if(res.course_types_open_mobile && res.course_types_open_mobile.length>0){
this.courseType = res.course_types_open_mobile
}
},
async getUserInfo() {
const res = await this.$u.api.user()
this.$u.vuex('vuex_user', res.user)
// 设置初始选中状态
if(res.user.open_course_types) {
this.selectedCourseTypes = res.user.open_course_types.split(',').map(id => parseInt(id)).filter(id => !isNaN(id))
} else {
this.selectedCourseTypes = []
}
if(res.user.open_course_types){
this.showSetting = false
}else{
this.showSetting = true
}
},
goToMap() {
uni.navigateTo({
url: '/packages/schoolmate/map'
})
},
scrollGet() {
if (!this.hasData) {
return
}
if (this.current_page > this.total_page) {
this.base.toast('没有更多了')
return
}
this.current_page = this.current_page + 1
this.getMyCourseTxl()
},
changeLetter(e){
if(e==='All'){
this.select.letter = ''
}else{
this.select.letter = e
}
this.current_page = 1
this.total_page = 0
this.hasData = true
this.list = []
this.getMyCourseTxl()
},
async getMyCourseTxl() {
uni.showLoading({
title: "...",
icon: 'none'
})
const res = await this.$u.api.courseUserList({
// course_id: id,
name: this.select.name,
company_name: this.select.company_name,
// company_position: this.select.company_position,
company_area: this.select.company_area,
company_type: this.select.company_type,
company_industry: this.select.company_industry,
type: 1,
page: this.current_page,
letter: this.select.letter
})
this.total_page = res.list.last_page
if (res.list.data.length === 0 && this.current_page === 1) {
this.hasData = false
}
this.list.push(...res.list.data)
this.showSearch = false
console.log("qwe",this.list)
uni.hideLoading()
},
selectIndex(e) {
console.log("e", e)
},
getIndustry() {
this.$u.api.getparameter({
'number[0]': 'company_industry',
// 'number[1]': 'company_position',
'number[2]': 'company_area',
'number[3]': 'company_type',
}).then(res => {
res.map(item => {
if (item.number == 'company_industry') {
this.selectArr[item.number].push(...item.detail)
} else {
this.selectArr[item.number] = item.detail
}
})
console.log("123", this.selectArr)
// this.industryList.push(...res.detail)
})
},
changeSearch(e) {
console.log(e)
this.current = e
if (e > 0) {
this.select.company_industry = this.selectArr.company_industry[e]['value']
} else {
this.select.company_industry = ''
}
this.current_page = 1
this.total_page = 0
this.list = []
this.hasData = true
this.select.letter = ""
this.getMyCourseTxl()
},
// selectPosition(e) {
// this.select.company_position = this.selectArr.company_position[e[0]]['value']
// },
selectArea(e) {
this.select.company_area = this.selectArr.company_area[e[0]]['value']
},
selectType(e) {
this.select.company_type = this.selectArr.company_type[e[0]]['value']
},
selectIndustry(e) {
this.select.company_industry = this.selectArr.company_industry[e[0]]['value']
},
resetSearch() {
this.select = {
name: '',
company_name: '',
// company_position: '',
company_area: '',
company_type: '',
company_industry: '',
letter:''
}
this.current = 0
this.current_page = 1
this.total_page = 0
this.list = []
this.hasData = true
this.getMyCourseTxl()
},
confirmSearch() {
this.current = 0
this.current_page = 1
this.total_page = 0
this.list = []
this.hasData = true
this.getMyCourseTxl()
},
// 切换课程类型选择
toggleCourseType(courseId) {
const index = this.selectedCourseTypes.indexOf(courseId)
if (index > -1) {
this.selectedCourseTypes.splice(index, 1)
} else {
this.selectedCourseTypes.push(courseId)
}
},
// 保存设置
async saveSettings() {
try {
const open_course_types = this.selectedCourseTypes.join(',')
await this.$u.api.saveUser({
open_course_types: open_course_types
})
uni.showToast({
title: '设置保存成功',
icon: 'success'
})
this.showSetting = false
// 保存成功后重新获取用户信息
await this.getUserInfo()
await this.getMyCourseTxl()
} catch (error) {
console.error('保存设置失败:', error)
uni.showToast({
title: '保存失败,请重试',
icon: 'none'
})
}
}
}
}
</script>
<style scoped lang="scss">
.container {
padding: 30rpx;
width: 100%;
height: 100vh;
overflow: scroll;
.cbg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
}
.map-btn{
// position: fixed;
// top: 110rpx;
// right: 20rpx;
z-index: 999;
background-color: #EB0432;
padding: 15rpx 20rpx;
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
width:60%;
}
.map-setting{
width:30%;
background-color: #b89155;
}
.map-text{
font-size: 28rpx;
color: #fff;
margin-left: 10rpx;
}
.search {
width: 100%;
position: fixed;
top: 0;
left: 0;
height: 100rpx;
padding: 20rpx 0;
background-color: #f0f7fc;
box-shadow: 1rpx -4rpx 15rpx 0 #333;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 999;
&-tab {
width: calc(100% - 100rpx);
}
&-icon {
width: 100rpx;
height: 100rpx;
background-color: #eaedeb;
display: flex;
justify-content: center;
align-items: center;
image {
width: 39rpx;
height: 31rpx;
}
}
}
.wrap {
position: relative;
padding-top: 100rpx;
height: 100%;
overflow: scroll;
padding-right: 60rpx;
.nodata {
height: calc(100vh - 160rpx);
}
.tips{
font-size: 24rpx;
text-align: left;
// padding-left:30rpx;
color:#999999;
margin-bottom:30rpx;
border-bottom:1rpx solid #cfd5d9;
padding-bottom:20rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.left-item-card {
width: 100%;
// height: 112rpx;
background-color: #FFFFFF;
box-sizing: border-box;
// padding-left: 24rpx;
display: flex;
align-items: center;
justify-content: flex-start;
margin-bottom: 30rpx;
padding: 24rpx;
background-color: #fff;
border-radius: 20rpx;
.left-item-card-img {
width: 80rpx;
min-width: 80rpx;
height: 80rpx;
background-color: #CFCFCF;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: bold;
color: #FFFFFF;
}
.img-info {
background: none;
border: solid #f0f0f0 1rpx;
}
.left-item-card-info {
width: 100%;
// margin-left: 32rpx;
height: 100%;
display: flex;
align-items: flex-start;
justify-content: center;
flex-direction: column;
&>view {
margin-bottom: 10rpx;
}
.left-item-card-name {
font-size: 32rpx;
color: #333;
.courseName {
color: #b89155;
margin: 0 10rpx;
font-size: 28rpx;
}
}
.left-item-card-phone {
margin-top: 14rpx;
font-size: 28rpx;
line-height: 28rpx;
color: #999999;
}
}
}
}
.next-scroll-right {
position: fixed;
right: 10rpx;
top: 51%;
transform: translateY(-47%);
z-index: 999 !important;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.next-scroll-right-name {
width: 40rpx;
height: 40rpx;
font-size: 32rpx;
color: #333333;
line-height: 40rpx;
margin: 6rpx 10rpx;
margin-top:0;
display: flex;
align-items: center;
justify-content: center;
}
.next-scroll-right-select {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background: #b89155;
color: #FFFFFF;
font-size: 24rpx;
line-height: 40rpx;
margin: 0 10rpx;
}
}
.modal {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 1000;
// z-index: 999999;
background-color: #fff;
padding: 30rpx 60rpx;
// padding-top: 130rpx;
overflow: scroll;
&>view {
display: flex;
align-items: center;
margin-bottom: 30rpx;
&>text:first-child {
width: 140rpx;
}
u-input {
width: calc(100% - 140rpx)
}
}
&-btn {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 60rpx;
&>view {
width: 45%;
text-align: center;
margin: 0 auto;
color: #fff;
background: linear-gradient(to right, #5e5fbc, #0d0398);
border-radius: 10rpx;
padding: 20rpx;
}
&-search {
background: linear-gradient(to right, #e4cdb4, #c69c6d) !important;
}
}
}
// 设置弹窗样式
.setting-popup {
padding: 40rpx;
background: #fff;
border-radius: 20rpx;
.setting-title {
font-size: 36rpx;
font-weight: 600;
color: #333;
text-align: center;
margin-bottom: 20rpx;
}
.setting-tip {
font-size: 28rpx;
color: #666;
text-align: center;
margin-bottom: 40rpx;
line-height: 1.5;
}
.setting-list {
max-height: 500rpx;
overflow-y: auto;
margin-bottom: 40rpx;
.setting-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 0;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
&.setting-item-fixed {
background: #f8f9fa;
padding: 24rpx 20rpx;
margin: 0 -20rpx 0 -20rpx;
border-radius: 12rpx 12rpx 0 0;
border-bottom: 2rpx solid #e9ecef;
.setting-item-name {
color: #666;
font-weight: 500;
}
}
.setting-item-name {
font-size: 30rpx;
color: #333;
flex: 1;
}
}
}
.setting-buttons {
display: flex;
justify-content: space-between;
gap: 20rpx;
.setting-btn {
flex: 1;
text-align: center;
padding: 24rpx;
border-radius: 12rpx;
font-size: 30rpx;
font-weight: 500;
&-cancel {
background: #f5f5f5;
color: #666;
}
&-confirm {
background: linear-gradient(to right, #e4cdb4, #c69c6d);
color: #fff;
}
}
}
}
}
</style>