expert-detail.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view class="expert-detail-container">
  3. <!-- 专家基本信息卡片 -->
  4. <view class="expert-info-card">
  5. <view class="expert-header">
  6. <view class="avatar-section">
  7. <view class="avatar-container">
  8. <image class="expert-avatar" :src="expertInfo.avatar" mode="aspectFill"></image>
  9. <view class="online-status" v-if="expertInfo.isOnline"></view>
  10. </view>
  11. </view>
  12. <view class="basic-info">
  13. <view class="expert-name">{{ expertInfo.name }}</view>
  14. <view class="expert-title">{{ expertInfo.title }}</view>
  15. <view class="expert-unit">{{ expertInfo.unit }}</view>
  16. <view class="stats-row">
  17. <view class="stat-item">
  18. <text class="stat-number">{{ expertInfo.rating }}</text>
  19. <text class="stat-label">评分</text>
  20. </view>
  21. <view class="stat-item">
  22. <text class="stat-number">{{ expertInfo.consultCount }}</text>
  23. <text class="stat-label">咨询数</text>
  24. </view>
  25. <view class="stat-item">
  26. <text class="stat-number">{{ expertInfo.experience }}</text>
  27. <text class="stat-label">从业年限</text>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 擅长领域 -->
  34. <view class="expertise-card">
  35. <view class="card-title">
  36. <text>擅长领域</text>
  37. </view>
  38. <view class="expertise-tags">
  39. <view
  40. class="expertise-tag"
  41. v-for="(tag, index) in expertInfo.expertise"
  42. :key="index"
  43. >
  44. {{ tag }}
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 专家简介 -->
  49. <view class="introduction-card">
  50. <view class="card-title">
  51. <text>专家简介</text>
  52. </view>
  53. <view class="introduction-content">
  54. <text class="introduction-text">{{ expertInfo.introduction }}</text>
  55. </view>
  56. </view>
  57. <!-- 服务时间 -->
  58. <view class="service-time-card">
  59. <view class="card-title">
  60. <text>服务时间</text>
  61. </view>
  62. <view class="service-time-content">
  63. <view class="time-item">
  64. <text class="time-label">工作日:</text>
  65. <text class="time-value">{{ expertInfo.serviceTime.weekday }}</text>
  66. </view>
  67. <view class="time-item">
  68. <text class="time-label">周末:</text>
  69. <text class="time-value">{{ expertInfo.serviceTime.weekend }}</text>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 底部咨询按钮 -->
  74. <view class="bottom-action-bar">
  75. <view class="action-btn" @click="startConsult">
  76. <text class="btn-text">在线咨询</text>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. export default {
  83. data() {
  84. return {
  85. expertId: '',
  86. expertInfo: {
  87. id: '',
  88. name: '',
  89. title: '',
  90. unit: '',
  91. avatar: '',
  92. expertise: [],
  93. introduction: '',
  94. isOnline: false,
  95. rating: 0,
  96. consultCount: 0,
  97. experience: 0,
  98. serviceTime: {
  99. weekday: '',
  100. weekend: ''
  101. }
  102. }
  103. }
  104. },
  105. onLoad(options) {
  106. if (options.id) {
  107. this.expertId = options.id;
  108. this.loadExpertDetail();
  109. }
  110. },
  111. methods: {
  112. // 加载专家详情
  113. loadExpertDetail() {
  114. uni.showLoading({ title: '加载中...' });
  115. // 模拟API调用,实际应用中需要根据expertId从API获取数据
  116. setTimeout(() => {
  117. const mockData = {
  118. id: this.expertId,
  119. name: '张教授',
  120. title: '研究员',
  121. unit: '农业科学院植物保护研究所',
  122. avatar: '/static/icons/professor.png',
  123. expertise: ['水稻种植', '病虫害防治', '土壤改良', '绿色防控', '有机农业'],
  124. introduction: '农业技术推广研究员,从事农作物病虫害防治和绿色种植技术研究20余年。主持完成国家和省部级科研项目10余项,发表学术论文50多篇,获得农业技术推广奖3项。擅长水稻、小麦等主要粮食作物的病虫害综合防治,在生物防治、绿色防控等方面有丰富的实践经验。',
  125. isOnline: true,
  126. rating: 4.9,
  127. consultCount: 156,
  128. experience: 20,
  129. serviceTime: {
  130. weekday: '09:00-18:00',
  131. weekend: '09:00-17:00'
  132. }
  133. };
  134. this.expertInfo = mockData;
  135. // 设置页面标题
  136. uni.setNavigationBarTitle({
  137. title: `${mockData.name} - 专家详情`
  138. });
  139. uni.hideLoading();
  140. }, 1000);
  141. },
  142. // 开始咨询
  143. startConsult() {
  144. uni.navigateTo({
  145. url: `/pages/service/expert-chat?expertId=${this.expertInfo.id}&expertName=${encodeURIComponent(this.expertInfo.name)}`
  146. });
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss">
  152. .expert-detail-container {
  153. min-height: 100vh;
  154. background-color: #f5f5f5;
  155. padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
  156. }
  157. // 专家信息卡片
  158. .expert-info-card {
  159. margin: 20rpx;
  160. background-color: #fff;
  161. border-radius: 16rpx;
  162. padding: 30rpx;
  163. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  164. }
  165. .expert-header {
  166. display: flex;
  167. align-items: center;
  168. gap: 24rpx;
  169. }
  170. .avatar-section {
  171. flex-shrink: 0;
  172. }
  173. .avatar-container {
  174. position: relative;
  175. }
  176. .expert-avatar {
  177. width: 120rpx;
  178. height: 120rpx;
  179. border-radius: 60rpx;
  180. border: 4rpx solid #f0f0f0;
  181. }
  182. .online-status {
  183. position: absolute;
  184. bottom: 0;
  185. right: 0;
  186. width: 32rpx;
  187. height: 32rpx;
  188. background-color: #52c41a;
  189. border-radius: 16rpx;
  190. border: 4rpx solid #fff;
  191. }
  192. .basic-info {
  193. flex: 1;
  194. }
  195. .expert-name {
  196. font-size: 36rpx;
  197. font-weight: bold;
  198. color: #333;
  199. margin-bottom: 8rpx;
  200. }
  201. .expert-title {
  202. font-size: 28rpx;
  203. color: #4CAF50;
  204. margin-bottom: 4rpx;
  205. }
  206. .expert-unit {
  207. font-size: 26rpx;
  208. color: #666;
  209. margin-bottom: 16rpx;
  210. }
  211. .stats-row {
  212. display: flex;
  213. gap: 24rpx;
  214. }
  215. .stat-item {
  216. display: flex;
  217. flex-direction: column;
  218. align-items: center;
  219. }
  220. .stat-number {
  221. font-size: 28rpx;
  222. font-weight: bold;
  223. color: #4CAF50;
  224. }
  225. .stat-label {
  226. font-size: 22rpx;
  227. color: #999;
  228. margin-top: 4rpx;
  229. }
  230. // 通用卡片样式
  231. .expertise-card,
  232. .introduction-card,
  233. .service-time-card {
  234. margin: 0 20rpx 20rpx;
  235. background-color: #fff;
  236. border-radius: 16rpx;
  237. padding: 30rpx;
  238. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  239. }
  240. .card-title {
  241. font-size: 30rpx;
  242. font-weight: bold;
  243. color: #333;
  244. margin-bottom: 20rpx;
  245. padding-bottom: 16rpx;
  246. border-bottom: 2rpx solid #f5f5f5;
  247. }
  248. // 擅长领域
  249. .expertise-tags {
  250. display: flex;
  251. flex-wrap: wrap;
  252. gap: 12rpx;
  253. }
  254. .expertise-tag {
  255. padding: 8rpx 16rpx;
  256. background-color: #e6f7ff;
  257. color: #1890ff;
  258. font-size: 26rpx;
  259. border-radius: 16rpx;
  260. white-space: nowrap;
  261. }
  262. // 专家简介
  263. .introduction-content {
  264. padding: 20rpx;
  265. background-color: #f8f9fa;
  266. border-radius: 12rpx;
  267. border-left: 4rpx solid #4CAF50;
  268. }
  269. .introduction-text {
  270. font-size: 28rpx;
  271. color: #666;
  272. line-height: 1.6;
  273. }
  274. // 服务时间
  275. .service-time-content {
  276. display: flex;
  277. flex-direction: column;
  278. gap: 16rpx;
  279. }
  280. .time-item {
  281. display: flex;
  282. align-items: center;
  283. }
  284. .time-label {
  285. font-size: 28rpx;
  286. color: #666;
  287. width: 120rpx;
  288. }
  289. .time-value {
  290. font-size: 28rpx;
  291. color: #333;
  292. font-weight: 500;
  293. }
  294. // 底部操作按钮
  295. .bottom-action-bar {
  296. position: fixed;
  297. bottom: 0;
  298. left: 0;
  299. right: 0;
  300. padding: 20rpx 30rpx;
  301. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  302. background-color: #fff;
  303. border-top: 1rpx solid #f0f0f0;
  304. z-index: 100;
  305. box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.05);
  306. }
  307. .action-btn {
  308. width: 100%;
  309. height: 88rpx;
  310. background-color: #4CAF50;
  311. border-radius: 44rpx;
  312. display: flex;
  313. align-items: center;
  314. justify-content: center;
  315. transition: background-color 0.2s ease;
  316. &:active {
  317. background-color: #45a049;
  318. }
  319. }
  320. .btn-text {
  321. font-size: 32rpx;
  322. color: #fff;
  323. font-weight: bold;
  324. }
  325. </style>