Files
yuxingu-Miniprogram-dev/pages/my-focus/my-focus.vue
T
2026-03-23 11:52:05 +08:00

169 lines
4.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="content">
<myNav title="我关注的咨询师" bgColor="#fff" titleColor="#614D49" :backIcon="true" :backHome="false" :flex="false">
</myNav>
<view style="margin: 40rpx;display: flex;flex-direction: column;align-items: center;overflow-y: auto;" v-if="focusList.length>0">
<view style="width: 100%;padding: 40rpx;box-sizing: border-box;background-color: #fff;
display: flex;flex-direction: column;border-radius: 10rpx;margin-top: auto;" >
<text style="font-size: 28rpx;color: #9B918C;">已关注{{focusList.length}}</text>
<view v-for="(item,index) in focusList" :key="index" >
<view style="margin-top: 40rpx;display: flex; justify-content: space-between;">
<image src="/static/n-main/child.png"
style="width: 100rpx;height: 100rpx;border-radius: 10rpx;">
</image>
<view style="display: flex;flex-direction: column; width: 294rpx;">
<view style="display: flex;align-items: baseline;justify-content: flex-start;">
<text style="font-size: 28rpx;font-family: SourceHanSansBold;color: #614D49;">{{item.name}}</text>
<text style="font-size: 20rpx;;color: #614D49;margin-left: 20rpx;">{{item.showServiceNum}}+咨询*从业{{item.workNum}}+</text>
</view>
<view style="display: flex;">
<text class="text-ellipsis"
style="font-size: 20rpx;;color: #9B918C;line-height: normal;letter-spacing: 0px;">{{item.introduction}}</text>
</view>
</view>
<view style="display: flex;flex-direction: column;align-items: center;">
<view style="width: 136rpx;height: 56rpx;border-radius: 2002rpx;display: flex;justify-content: center;align-items: center;
background: linear-gradient(180deg, #FF9079 0%, #F37155 100%);" @click="toConsult(item)">
<text class="btn-text">预约</text>
</view>
<view>
<text class="rmb-text">¥{{advancedFormat(item.price)}}</text><text class="rmb-text-mini">/</text>
</view>
</view>
</view>
<view class="line" v-if="index<focusList.length-1"></view>
</view>
</view>
</view>
<view style="display:flex;align-items:center;flex-direction:column;width: 100%;height: 100%;
display: flex;align-items: center;justify-content: center"
v-if="focusList.length==0">
<text style="font-size: 30rpx;font-family: SourceHanSansBold;color: #EA4E2D">暂无关注信息</text>
</view>
</view>
</template>
<script setup>
import myNav from '@/components/my-nav.vue'
import {
urls
} from '@/util/apiUrl.js'
import dohttp from '@/util/requestConfig.js'
onLoad((option) => {
if (option.num && option.num > 0) {
toFocusRead()
}
focusAll()
})
const toFocusRead = () => {
dohttp.post(urls.focusToRead).then((result) => {})
}
const focusList = ref([])
const focusAll = () => {
dohttp.post(urls.focusAll).then((result) => {
focusList.value = result
})
}
const advancedFormat = (num) => {
const divided = Number(num) / 100;
// 转换为字符串处理科学计数法(如1e-7)
const str = divided.toLocaleString('en-US', {
maximumFractionDigits: 2,
useGrouping: false
});
return str.replace(/(\.\d*?[1-9])0+$/, '$1').replace(/\.$/, '');
}
const toConsult = (item)=>{
dohttp.navigateTo("/pages/consult-detail/consult-detail?id=" + item.id)
}
const onShareAppMessage = () => {
return {
title: '快来体验一下吧~',
path: '/pages/index/index', // 分享的路径
};
};
const onShareTimeline = () => {
return {
title: '快来体验一下吧~',
query: 'id=7', // 分享路径的参数
};
};
</script>
<style scoped>
.content {
width: 100vw;
height: 100vh;
background-color: #F9F6F5;
display: flex;
flex-direction: column;
font-family: SourceHanSans;
}
.btn-text {
/* 按钮/按钮文本中号加粗 */
font-family: SourceHanSansBold;
font-size: 28rpx;
line-height: normal;
letter-spacing: 0px;
font-variation-settings: "opsz" auto;
/* 正文色/正文色 */
color: #FFFFFF;
}
.rmb-text {
font-family: SourceHanSans;
font-size: 24rpx;
font-weight: 700;
line-height: normal;
letter-spacing: 0px;
color: #F37155;
}
.rmb-text-mini {
font-family: SourceHanSans;
font-size: 16rpx;
font-weight: normal;
line-height: normal;
letter-spacing: 0px;
color: #F37155;
}
.text-ellipsis {
overflow: hidden;
/* 溢出内容隐藏 */
text-overflow: ellipsis;
/* 显示省略号 */
display: -webkit-box;
/* 使用WebKit弹性盒子模型 */
-webkit-line-clamp: 2;
/* 限制显示行数(此处为2行) */
-webkit-box-orient: vertical;
/* 文本垂直排列 */
}
.line {
width: 100%;
height: 2rpx;
border-radius: 36rpx;
background: #DFD6D3;
margin-top: 30rpx;
}
</style>