expertList.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <div class="prescription-list">
  3. <custom-header v-if="!isShowHeader" :name="isToSelect ? '选择专家' : '咨询专家'"></custom-header>
  4. <div class="prescription-filter">
  5. <div class="filter-search">
  6. <el-input v-model="keyword" style="width: 100%" placeholder="搜索位置" :prefix-icon="Search" />
  7. </div>
  8. <div class="select-box">
  9. <div class="select-item width-30">
  10. <el-select v-model="typeVal" placeholder="品种" @change="getList">
  11. <el-option v-for="item in typeOptions" :key="item.id" :label="item.name" :value="item.id" />
  12. </el-select>
  13. </div>
  14. <div class="select-item width-20">
  15. <el-select v-model="regionVal" placeholder="城市">
  16. <el-option
  17. v-for="item in regionOptions"
  18. :key="item.value"
  19. :label="item.label"
  20. :value="item.value"
  21. />
  22. </el-select>
  23. </div>
  24. <div class="select-item width-30">
  25. <el-select v-model="levelVal" placeholder="专家擅长">
  26. <el-option
  27. v-for="item in levelOptions"
  28. :key="item.value"
  29. :label="item.label"
  30. :value="item.value"
  31. />
  32. </el-select>
  33. </div>
  34. <div class="select-item width-20">
  35. <el-select v-model="levelVal" placeholder="筛选">
  36. <el-option
  37. v-for="item in levelOptions"
  38. :key="item.value"
  39. :label="item.label"
  40. :value="item.value"
  41. />
  42. </el-select>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="prescription-content">
  47. <div class="list">
  48. <div class="list-item" v-for="(item, index) in list" :key="index">
  49. <div class="list-top">
  50. <div class="user">
  51. <!-- <img :src="item.pic" alt="" /> -->
  52. <img v-show="index === 0" :src="require(`@/assets/img/home/zj-1.png`)" alt="" />
  53. <img v-show="index === 1" :src="require(`@/assets/img/home/zj-2.png`)" alt="" />
  54. <img v-show="index === 2" :src="require(`@/assets/img/home/zj-3.png`)" alt="" />
  55. <!-- <div class="checkbox" @click.stop="handleCheck(item)">
  56. <el-icon class="icon" v-if="item.isDefault"><Select /></el-icon>
  57. <el-icon class="icon rotate" v-else><CloseBold /></el-icon>
  58. </div> -->
  59. </div>
  60. <div class="info">
  61. <div class="text">
  62. <div class="info-flex">
  63. <span class="name">{{ item.name }}</span>
  64. <!-- <span class="expert-tag">
  65. <img class="expert-img" src="@/assets/img/home/expert-icon.png" alt="">
  66. 专家
  67. </span> -->
  68. <div class="fruit-tag" v-for="(ele, eleIndex) in item.tagList" :key="eleIndex">
  69. {{ ele.name }}
  70. </div>
  71. </div>
  72. <div class="add-btn">
  73. <el-icon size="16" color="#fff"><Plus /></el-icon>
  74. </div>
  75. </div>
  76. <div class="van-multi-ellipsis--l2 ellipsis">擅长:{{ item.strongPoint }}</div>
  77. <div class="list-btn">
  78. <div class="btn-primary" @click.stop="toPage(item)">
  79. <span>免费咨询</span>
  80. </div>
  81. <div class="btn-plain" @click.stop="handlePage(item)">查看处方</div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <empty
  87. v-show="list.length < 1"
  88. image="https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
  89. image-size="80"
  90. description="暂无数据"
  91. />
  92. </div>
  93. </div>
  94. </div>
  95. </template>
  96. <script setup>
  97. import customHeader from "@/components/customHeader.vue";
  98. import { Empty } from "vant";
  99. import { onMounted, ref } from "vue";
  100. import { useRouter, useRoute } from "vue-router";
  101. import { useStore } from "vuex";
  102. import { ElMessage } from "element-plus";
  103. import { Search } from "@element-plus/icons-vue";
  104. const store = useStore();
  105. const router = useRouter();
  106. const route = useRoute();
  107. const props = defineProps({
  108. isShowHeader: {
  109. type: Boolean,
  110. default: false,
  111. },
  112. });
  113. const isToSelect = route.query.isToSelect ? true : false;
  114. const handlePage = ({ isDefault, userId }) => {
  115. if (isDefault == null) {
  116. console.log("isDefault", isDefault);
  117. // router.push(`/expert_prescription?userId=${userId}&disabled=true`)
  118. } else {
  119. router.push("/expert_prescription");
  120. }
  121. };
  122. const typeOptions = ref([]);
  123. function getSpecieList() {
  124. VE_API.farm.fetchSpecieList().then(({ data }) => {
  125. typeOptions.value = data;
  126. // getList(data[0].id);
  127. });
  128. }
  129. const list = ref([
  130. {
  131. containerId: "9",
  132. expertId: "739294587868155904",
  133. name: "冼继东",
  134. strongPoint: "擅长:长期从事农业昆虫与害虫防治教学与研究工作。取得成果和奖励10项,发表学术论文50余篇。多年来一直致力于果树、蔬菜以及水稻主要病虫害非化学防控技术的推广工作,为有机荔枝龙眼、稻米、蔬菜以及多种水果的高效、安全生产提供技术指导。",
  135. tagList: [
  136. {
  137. id: 825,
  138. name: "荔枝",
  139. remark: "花穗生长速度过慢",
  140. },
  141. {
  142. id: 829,
  143. name: "病虫害",
  144. remark: "防止落果",
  145. },
  146. ],
  147. userId: 81881,
  148. },
  149. {
  150. containerId: "9",
  151. expertId: "739294587868155904",
  152. name: "韦帮稳",
  153. pic: "https://birdseye-img-ali-cdn.sysuimars.com//expert/1757473957076.png",
  154. strongPoint: "擅长:深耕果树栽培领域达30年,在荔枝、龙眼、柑橘、番茄、木瓜等多个品类果树具有非常丰富的种植栽培经验;自管荔枝果园超2000亩,每年指导海南、湛江、茂名、广州、汕尾、惠州、广西等多地的种植户超百户,面积超1万亩!",
  155. tagList: [
  156. {
  157. id: 825,
  158. name: "荔枝",
  159. remark: "花穗生长速度过慢",
  160. },
  161. {
  162. id: 829,
  163. name: "龙眼",
  164. remark: "防止落果",
  165. },
  166. ],
  167. userId: 81881,
  168. },
  169. {
  170. containerId: "9",
  171. expertId: "739294587868155904",
  172. name: "黄旭明",
  173. pic: "https://birdseye-img-ali-cdn.sysuimars.com//expert/1757473957076.png",
  174. strongPoint: "擅长:长期从事南方果树生理学研究,研究领域包括常绿果树枝梢生长节奏及调控、具假种皮果实果皮发育、细胞壁代谢和钙营养与生理病害发生关系、果实膨大生长与水分关系等。研究方向为果树生态生理学。1998年获华南农业大学植物生理学博士学位,现任南方果树研究室主任。",
  175. tagList: [
  176. {
  177. id: 825,
  178. name: "荔枝",
  179. remark: "花穗生长速度过慢",
  180. },
  181. {
  182. id: 829,
  183. name: "龙眼",
  184. remark: "防止落果",
  185. },
  186. ],
  187. userId: 81881,
  188. },
  189. ]);
  190. const getList = (speciesId) => {
  191. VE_API.home.fetchExpertList({ speciesId }).then(({ data }) => {
  192. list.value = data || [];
  193. });
  194. };
  195. onMounted(() => {
  196. getSpecieList();
  197. });
  198. function toPage({ containerId, userId, name }) {
  199. if (isToSelect) {
  200. router.push(`/expert_homepage?containerId=${containerId}`);
  201. // router.replace(`/expert_homepage?containerId=${containerId}`)
  202. } else {
  203. router.push(`/chat_frame?userId=${userId}`);
  204. }
  205. }
  206. // 搜索
  207. const keyword = ref(null);
  208. const typeVal = ref(null);
  209. const regionVal = ref(null);
  210. const levelVal = ref(null);
  211. const regionOptions = ref([
  212. {
  213. label: "全部",
  214. value: "all",
  215. },
  216. {
  217. label: "区域1",
  218. value: "1",
  219. },
  220. {
  221. label: "区域2",
  222. value: "2",
  223. },
  224. {
  225. label: "区域3",
  226. value: "3",
  227. },
  228. ]);
  229. const levelOptions = ref([
  230. { label: "全部", value: "all" },
  231. { label: "荔枝", value: "1" },
  232. { label: "龙眼", value: "2" },
  233. { label: "枇杷", value: "3" },
  234. ]);
  235. </script>
  236. <style lang="scss" scoped>
  237. .prescription-list {
  238. position: relative;
  239. width: 100%;
  240. height: 100vh;
  241. background-color: #f5f7fb;
  242. .prescription-filter {
  243. padding: 12px 12px 0 12px;
  244. .filter-search {
  245. padding-bottom: 6px;
  246. ::v-deep {
  247. .el-input__wrapper {
  248. box-shadow: 0 0 0 1px #fff inset;
  249. border-radius: 20px;
  250. }
  251. }
  252. }
  253. .select-box {
  254. width: 100%;
  255. display: flex;
  256. justify-content: space-around;
  257. .select-item {
  258. width: fit-content;
  259. ::v-deep {
  260. .el-input__wrapper {
  261. background: none;
  262. box-shadow: none;
  263. }
  264. .el-input__inner {
  265. font-size: 14px;
  266. color: rgba(0, 0, 0, 0.5);
  267. }
  268. .el-select__wrapper {
  269. background: none;
  270. box-shadow: none;
  271. gap: 2px;
  272. padding: 4px 2px;
  273. justify-content: center;
  274. }
  275. .el-select__selection {
  276. flex: none;
  277. width: fit-content;
  278. }
  279. .el-select__placeholder {
  280. color: rgba(0, 0, 0, 0.5);
  281. position: static;
  282. transform: none;
  283. width: fit-content;
  284. }
  285. }
  286. }
  287. .width-30 {
  288. width: 30%;
  289. }
  290. .width-20 {
  291. width: 20%;
  292. }
  293. }
  294. }
  295. .prescription-content {
  296. overflow-y: auto;
  297. height: calc(100% - 40px);
  298. padding: 6px 12px 12px;
  299. box-sizing: border-box;
  300. width: 100%;
  301. .list {
  302. position: relative;
  303. .list-item {
  304. background: #fff;
  305. padding: 16px 12px 12px;
  306. border-radius: 8px;
  307. .user {
  308. width: 68px;
  309. height: 68px;
  310. margin-right: 12px;
  311. position: relative;
  312. img {
  313. width: 100%;
  314. height: 100%;
  315. border-radius: 8px;
  316. object-fit: scale-down;
  317. }
  318. .checkbox {
  319. position: absolute;
  320. bottom: -2px;
  321. right: -1px;
  322. width: 25px;
  323. height: 25px;
  324. background: #2199f8;
  325. border-radius: 50%;
  326. display: flex;
  327. align-items: center;
  328. justify-content: center;
  329. .icon {
  330. color: #fff;
  331. font-size: 16px;
  332. }
  333. .rotate {
  334. transform: rotate(45deg);
  335. }
  336. }
  337. }
  338. .list-top {
  339. display: flex;
  340. img{
  341. border-radius: 50%;
  342. object-fit: cover;
  343. }
  344. }
  345. .list-btn {
  346. display: flex;
  347. // justify-content: center;
  348. font-size: 12px;
  349. margin-top: 8px;
  350. .btn-primary {
  351. background: rgba(33, 153, 248, 0.12);
  352. padding: 0 12px;
  353. color: #2199f8;
  354. border-radius: 20px;
  355. height: 32px;
  356. line-height: 32px;
  357. display: flex;
  358. span {
  359. margin-left: 3px;
  360. }
  361. }
  362. .btn-plain {
  363. background: rgba(162, 162, 162, 0.12);
  364. color: rgba(0, 0, 0, 0.5);
  365. padding: 0px 12px;
  366. border-radius: 20px;
  367. height: 32px;
  368. line-height: 32px;
  369. margin-left: 8px;
  370. }
  371. }
  372. .info {
  373. width: calc(100% - 78px);
  374. line-height: 1.6;
  375. .ellipsis {
  376. max-width: 255px;
  377. color: #666666;
  378. }
  379. .text {
  380. display: flex;
  381. color: #666666;
  382. align-items: center;
  383. justify-content: space-between;
  384. .info-flex {
  385. display: flex;
  386. align-items: center;
  387. }
  388. .add-btn {
  389. width: 26px;
  390. height: 26px;
  391. border-radius: 50%;
  392. background: #2199f8;
  393. text-align: center;
  394. display: flex;
  395. align-items: center;
  396. justify-content: center;
  397. }
  398. .name {
  399. color: #000;
  400. font-size: 16px;
  401. font-weight: bold;
  402. }
  403. .expert-tag {
  404. height: 20px;
  405. width: 48px;
  406. display: flex;
  407. align-items: center;
  408. justify-content: center;
  409. color: #c77d05;
  410. background: #ffecad;
  411. border-radius: 4px;
  412. font-size: 12px;
  413. margin-left: 8px;
  414. line-height: 20px;
  415. .expert-img {
  416. width: 12px;
  417. padding-right: 2px;
  418. }
  419. }
  420. .btn-text {
  421. font-size: 12px;
  422. color: #a8a8a8;
  423. padding: 2px 12px;
  424. border-radius: 20px;
  425. border: 1px solid #a8a8a8;
  426. background: rgba(220, 220, 220, 0.1);
  427. &.actice {
  428. color: #f3c11d;
  429. border-color: #f3c11d;
  430. background: rgba(243, 193, 29, 0.1);
  431. }
  432. }
  433. }
  434. .fruit-tag {
  435. margin-left: 5px;
  436. padding: 0 8px;
  437. height: 20px;
  438. line-height: 20px;
  439. background: #cae7ff;
  440. border-radius: 2px;
  441. font-size: 12px;
  442. color: #2199f8;
  443. // &.pest {
  444. // background: #eedaff;
  445. // color: #ac4dff;
  446. // }
  447. &:nth-child(3) {
  448. background: #eedaff;
  449. color: #ac4dff;
  450. }
  451. }
  452. .ellipsis {
  453. font-size: 12px;
  454. color: #999;
  455. margin-top: 4px;
  456. }
  457. }
  458. }
  459. .list-item + .list-item {
  460. margin-top: 16px;
  461. padding-top: 16px;
  462. border-top: 1px solid #f5f5f5;
  463. }
  464. }
  465. }
  466. }
  467. </style>