detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
  5. <div class="w_1200">
  6. <el-col :span="24" class="one">
  7. <el-row :span="24" class="one_1">
  8. <el-col :span="20" class="title">{{ info.name || '暂无标题' }}</el-col>
  9. <el-col :span="4" class="file" @click="toCollection">
  10. <el-icon><Star /></el-icon>
  11. 收藏
  12. </el-col>
  13. </el-row>
  14. </el-col>
  15. <el-col :span="24" class="two">
  16. <a-descriptions bordered>
  17. <a-descriptions-item label="行业分类">
  18. {{ getDict(info.type, 'type') }}
  19. </a-descriptions-item>
  20. <a-descriptions-item label="成熟度">
  21. {{ getDict(info.maturity, 'maturity') }}
  22. </a-descriptions-item>
  23. <a-descriptions-item label="技术类型">
  24. {{ getDict(info.skill, 'skill') }}
  25. </a-descriptions-item>
  26. <a-descriptions-item label="行业领域">
  27. {{ getDict(info.field, 'field') }}
  28. </a-descriptions-item>
  29. <a-descriptions-item label="合作类型">
  30. {{ getDict(info.cooperate, 'cooperate') }}
  31. </a-descriptions-item>
  32. <a-descriptions-item label="项目地区">
  33. {{ getArea(info.area) }}
  34. </a-descriptions-item>
  35. <a-descriptions-item label="发布时间">
  36. {{ info.time }}
  37. </a-descriptions-item>
  38. </a-descriptions>
  39. </el-col>
  40. <el-col :span="24" class="pointer">
  41. <div class="money">
  42. 价格:<span> {{ info.money || '面议' }} </span>
  43. </div>
  44. <a-button type="primary" @click="toDocking"> 我要对接 </a-button>
  45. </el-col>
  46. <el-col :span="24" class="pointer" v-if="!user && !user._id">
  47. 提醒:您还没有登录,登录成功后再对接
  48. </el-col>
  49. <el-col :span="24" class="thr">
  50. <el-col :span="24" class="thr_1">
  51. <p>单位信息</p>
  52. </el-col>
  53. <el-row :span="24" class="thr_2">
  54. <el-col :span="17" class="left">
  55. <el-col :span="24" class="name">
  56. {{ unit.name || '暂无' }}
  57. </el-col>
  58. <el-col :span="24" class="other">
  59. <span>联系人</span>
  60. {{ unit.contacts || '暂无' }}
  61. </el-col>
  62. </el-col>
  63. <el-col :span="4" class="right">
  64. <a-button type="primary" @click="toChat">
  65. <template #icon>
  66. <MessageOutlined />
  67. </template>
  68. 点击在线洽谈
  69. </a-button>
  70. </el-col>
  71. </el-row>
  72. </el-col>
  73. <a-divider />
  74. <el-col :span="24" class="four">
  75. <el-col :span="24" class="four_1">
  76. <p>项目简介</p>
  77. </el-col>
  78. <el-col :span="24" class="four_2">{{ info.brief || '暂无' }}</el-col>
  79. </el-col>
  80. <el-col :span="24" class="four">
  81. <el-col :span="24" class="four_1">
  82. <p>相关推荐</p>
  83. </el-col>
  84. <el-col :span="24" class="four_3">
  85. <a-list :loading="loading" :grid="{ gutter: 16, column: 4 }" :data-source="list">
  86. <template #renderItem="{ item }">
  87. <el-col :span="24" class="list">
  88. <el-col :span="24" class="name textOver">
  89. <el-tooltip effect="dark" :content="item.name" placement="top">
  90. {{ item.name || '暂无名称' }}
  91. </el-tooltip>
  92. </el-col>
  93. <el-col :span="24" class="two_1">
  94. <span>技术领域:</span>{{ getDict(item.field || '暂无技术领域', 'field') }}
  95. </el-col>
  96. <el-col :span="24" class="two_1">
  97. <span>成果地区:</span>{{ getArea(item.area) }}
  98. </el-col>
  99. <el-col :span="24" class="two_1">
  100. <span>单位:</span>{{ item.user || '暂无单位' }}
  101. </el-col>
  102. <el-col :span="24" class="bottom">
  103. <a-button size="small" type="primary" @click="toView(item)">
  104. 查看详情
  105. </a-button>
  106. </el-col>
  107. </el-col>
  108. </template>
  109. </a-list>
  110. <el-col :span="24" class="page">
  111. <el-pagination
  112. background
  113. layout="total, prev, pager, next"
  114. :page-sizes="[10, 20, 50, 100, 200]"
  115. :total="total"
  116. :page-size="limit"
  117. v-model:current-page="currentPage"
  118. @current-change="changePage"
  119. @size-change="sizeChange"
  120. >
  121. </el-pagination>
  122. </el-col>
  123. </el-col>
  124. </el-col>
  125. </div>
  126. </el-col>
  127. </el-row>
  128. </div>
  129. </template>
  130. <script setup>
  131. // 基础
  132. import { MessageOutlined } from '@ant-design/icons-vue'
  133. import { get } from 'lodash-es'
  134. const $checkRes = inject('$checkRes')
  135. // 接口
  136. import { ProjectStore } from '@/store/api/platform/project'
  137. import { AchievementStore } from '@/store/api/platform/achievement'
  138. import { DictDataStore } from '@/store/api/system/dictData'
  139. const store = ProjectStore()
  140. const achievementStore = AchievementStore()
  141. const dictDataStore = DictDataStore()
  142. import { UserStore } from '@/store/user'
  143. const userStore = UserStore()
  144. const user = computed(() => userStore.user)
  145. // 路由
  146. const route = useRoute()
  147. const router = useRouter()
  148. // 加载中
  149. const loading = ref(false)
  150. const info = ref({})
  151. const unit = ref({ name: '吉林大学', contacts: '陈老师' })
  152. // 字典表
  153. const fieldList = ref([])
  154. const typeList = ref([])
  155. const maturityList = ref([])
  156. const skillList = ref([])
  157. const cooperateList = ref([])
  158. // 成果列表
  159. const list = ref([])
  160. let skip = 0
  161. let limit = inject('limit')
  162. const total = ref(0)
  163. // 请求
  164. onMounted(async () => {
  165. loading.value = true
  166. await searchOther()
  167. await search()
  168. await searchAchieve({ skip, limit })
  169. loading.value = false
  170. })
  171. const search = async () => {
  172. let id = route.query.id
  173. if (id) {
  174. let res = await store.fetch(id)
  175. if (res.errcode == '0') info.value = res.data
  176. }
  177. }
  178. const searchAchieve = async (query = { skip: 0, limit }) => {
  179. const info = {
  180. skip: query.skip,
  181. limit: query.limit,
  182. is_use: '0',
  183. status: '1'
  184. }
  185. const res = await achievementStore.query(info)
  186. if (res.errcode == '0') {
  187. list.value = res.data
  188. total.value = res.total
  189. }
  190. }
  191. const searchOther = async () => {
  192. let result
  193. // 行业分类
  194. result = await dictDataStore.query({ code: 'industry', is_use: '0' })
  195. if ($checkRes(result)) typeList.value = result.data
  196. // 成熟度
  197. result = await dictDataStore.query({ code: 'projectMaturity', is_use: '0' })
  198. if ($checkRes(result)) maturityList.value = result.data
  199. // 技术领域
  200. result = await dictDataStore.query({ code: 'field', is_use: '0' })
  201. if ($checkRes(result)) fieldList.value = result.data
  202. // 技术类型
  203. result = await dictDataStore.query({ code: 'technology', is_use: '0' })
  204. if ($checkRes(result)) skillList.value = result.data
  205. // 合作类型
  206. result = await dictDataStore.query({ code: 'projectType', is_use: '0' })
  207. if ($checkRes(result)) cooperateList.value = result.data
  208. }
  209. // 字典数据转换
  210. const getDict = (data, model) => {
  211. let res
  212. if (model == 'skill') res = skillList.value.find((f) => f.value == data)
  213. else if (model == 'cooperate') res = cooperateList.value.find((f) => f.value == data)
  214. else if (model == 'field') res = fieldList.value.find((f) => f.value == data)
  215. else if (model == 'maturity') res = maturityList.value.find((f) => f.value == data)
  216. else if (model == 'type') res = typeList.value.find((f) => f.value == data)
  217. return get(res, 'label')
  218. }
  219. // 地区
  220. const getArea = (data) => {
  221. if (data) return data.join(',')
  222. else return '暂无地区'
  223. }
  224. // 在线洽谈
  225. const toChat = () => {
  226. router.push({ path: '/chat', query: { id: info.value.id || info.value._id } })
  227. }
  228. // 我要对接
  229. const toDocking = () => {
  230. console.log('我要对接')
  231. }
  232. // 收藏
  233. const toCollection = () => {
  234. console.log('收藏')
  235. }
  236. // 查看
  237. const toView = (item) => {
  238. router.push({ path: '/achievement/detail', query: { id: item.id || item._id } })
  239. }
  240. const currentPage = ref(1)
  241. // 分页
  242. const changePage = (page = currentPage.value) => {
  243. searchAchieve({ skip: (page - 1) * limit, limit: limit })
  244. }
  245. const sizeChange = (limits) => {
  246. console.log(limits)
  247. limit = limits
  248. currentPage.value = 1
  249. searchAchieve({ skip: 0, limit: limit })
  250. }
  251. </script>
  252. <style scoped lang="scss">
  253. .main {
  254. .one {
  255. margin: 10px 0 0 0;
  256. background: #f7f7f7;
  257. padding: 24px;
  258. border-top: 6px solid #2374ff;
  259. overflow: hidden;
  260. border-radius: 0 0 5px 5px;
  261. .one_1 {
  262. margin: 0 0 10px 0;
  263. .title {
  264. font-size: 18px;
  265. font-weight: 700;
  266. color: #383b40;
  267. }
  268. .file {
  269. display: flex;
  270. align-items: center;
  271. justify-content: end;
  272. font-family: PingFangSC-Regular;
  273. font-size: 14px;
  274. color: #2374ff;
  275. text-align: right;
  276. }
  277. }
  278. .one_2 {
  279. display: inline-block;
  280. font-size: 12px;
  281. background: rgba(18, 172, 117, 0.05);
  282. color: #12ac75;
  283. padding: 0 15px;
  284. height: 20px;
  285. line-height: 20px;
  286. border-radius: 10px;
  287. margin-bottom: 2px;
  288. }
  289. }
  290. .two {
  291. background: #f9fafb;
  292. border-radius: 2px;
  293. padding: 30px;
  294. margin: 34px 0 20px;
  295. font-family: PingFangSC-Medium;
  296. font-size: 14px;
  297. color: #383b40;
  298. line-height: 14px;
  299. }
  300. .thr {
  301. margin: 0 0 10px 0;
  302. .thr_1 {
  303. width: 100%;
  304. height: 40px;
  305. line-height: 40px;
  306. border-bottom: 2px solid #2374ff;
  307. margin: 20px 0;
  308. background: #f7f7f7;
  309. p {
  310. float: left;
  311. padding: 0 20px;
  312. height: 40px;
  313. border-bottom: 2px solid #2374ff;
  314. color: #fff;
  315. font-size: 18px;
  316. background: #2374ff;
  317. }
  318. }
  319. .thr_2 {
  320. display: flex;
  321. justify-content: space-between;
  322. align-items: center;
  323. background: #fff;
  324. border: 1px solid #edeff2;
  325. box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.03);
  326. border-radius: 2px;
  327. padding: 30px 20px;
  328. .left {
  329. .name {
  330. height: 20px;
  331. font-family: PingFangSC-Semibold;
  332. font-size: 18px;
  333. color: #383b40;
  334. line-height: 20px;
  335. font-weight: 700;
  336. margin-bottom: 8px;
  337. }
  338. .other {
  339. height: 14px;
  340. font-family: PingFangSC-Medium;
  341. font-size: 14px;
  342. color: #383b40;
  343. line-height: 14px;
  344. font-weight: 700;
  345. span {
  346. height: 14px;
  347. font-family: PingFangSC-Regular;
  348. font-size: 14px;
  349. color: #7e8288;
  350. line-height: 14px;
  351. font-weight: 400;
  352. margin-right: 16px;
  353. }
  354. }
  355. }
  356. .right {
  357. display: flex;
  358. justify-content: space-between;
  359. }
  360. }
  361. }
  362. .four {
  363. margin: 0 0 10px 0;
  364. .four_1 {
  365. width: 100%;
  366. height: 40px;
  367. line-height: 40px;
  368. border-bottom: 2px solid #2374ff;
  369. margin: 20px 0;
  370. background: #f7f7f7;
  371. p {
  372. float: left;
  373. padding: 0 20px;
  374. height: 40px;
  375. border-bottom: 2px solid #2374ff;
  376. color: #fff;
  377. font-size: 18px;
  378. background: #2374ff;
  379. }
  380. }
  381. .four_3 {
  382. margin: 20px;
  383. .list {
  384. border: 1px solid #edeff2;
  385. background: #fff;
  386. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.03);
  387. border-radius: 2px;
  388. width: 280px;
  389. height: 180px;
  390. margin-bottom: 15px;
  391. cursor: pointer;
  392. transition: all 0.3s;
  393. padding: 15px;
  394. .name {
  395. font-size: 16px;
  396. color: #121834;
  397. height: 16px;
  398. line-height: 13px;
  399. font-weight: 500;
  400. margin: 10px 0;
  401. }
  402. .name:hover {
  403. color: #2374ff;
  404. }
  405. .two_1 {
  406. font-size: 12px;
  407. text-align: justify;
  408. line-height: 12px;
  409. font-weight: 400;
  410. letter-spacing: 0;
  411. color: #8f97a3;
  412. margin-top: 15px;
  413. span:last-child {
  414. color: #525a68;
  415. }
  416. }
  417. .bottom {
  418. text-align: right;
  419. }
  420. }
  421. .list:hover {
  422. background: #f0f7ff;
  423. box-shadow: 0 0 16px rgba(205, 205, 205, 0.6);
  424. }
  425. .page {
  426. display: flex;
  427. flex-direction: row-reverse;
  428. padding: 20px;
  429. }
  430. }
  431. }
  432. .pointer {
  433. display: flex;
  434. align-items: center;
  435. justify-content: flex-end;
  436. font-family: PingFangSC-Regular;
  437. font-size: 14px;
  438. color: #7e8288;
  439. margin: 10px 0 0 0;
  440. .money {
  441. margin: 0 10px 0 0;
  442. span {
  443. font-family: PingFangSC-Semibold;
  444. font-size: 20px;
  445. color: #e94643;
  446. line-height: 20px;
  447. }
  448. }
  449. }
  450. }
  451. </style>