baseDetail.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <custom-layout class="main">
  3. <el-col :span="24" class="one">
  4. <div class="w_1300">
  5. <div class="info_1"></div>
  6. <div class="info_2">
  7. <div class="top">
  8. <div class="info_left">
  9. <el-carousel height="260px">
  10. <el-carousel-item v-for="(item, index) in info.logo" :key="index">
  11. <el-image class="image" :src="getUrl(item.uri)" fit="fill" />
  12. </el-carousel-item>
  13. </el-carousel>
  14. </div>
  15. <div class="info_right">
  16. <div class="info_title">
  17. <div class="name">{{ info.name || '暂无' }}</div>
  18. <div class="collect iscollect" @click="toCollect" v-if="info.is_collection">
  19. <el-icon :size="24" color="#1073ff"><StarFilled /></el-icon>
  20. <span>已收藏</span>
  21. </div>
  22. <div class="collect" v-else @click="toCollect">
  23. <el-icon :size="24"><Star /></el-icon>
  24. <span>收藏</span>
  25. </div>
  26. </div>
  27. <el-col :span="24" class="other_1">
  28. <span>负责人姓名:</span>
  29. {{ info.person || '暂无' }}
  30. </el-col>
  31. <el-col :span="24" class="other_1">
  32. <span>是否和平台合作标识:</span>
  33. {{ getDict(info.cooperate, 'cooperate') || '暂无' }}
  34. </el-col>
  35. <el-col :span="24" class="other_1">
  36. <span>所在地区:</span>
  37. {{ getArea(info.area) || '暂无' }}
  38. </el-col>
  39. </div>
  40. </div>
  41. <div class="center">
  42. <div class="title">简介</div>
  43. <div class="content">
  44. <div v-if="info.brief" v-html="info.brief"></div>
  45. </div>
  46. </div>
  47. <div class="bottom">
  48. <div class="title">相关孵化基地</div>
  49. <div class="content">
  50. <el-row :gutter="16">
  51. <el-col :span="12" v-for="(item, index) in list" :key="index" @click="toView(item)">
  52. <div class="list">
  53. <el-col :span="24" class="name textOne">
  54. <el-tooltip effect="dark" :content="item.name" placement="top">
  55. {{ item.name || '暂无名称' }}
  56. </el-tooltip>
  57. </el-col>
  58. <el-col :span="24" class="other">
  59. <el-col :span="24" class="other_1">
  60. <span>负责人姓名:</span>
  61. {{ item.field || '暂无' }}
  62. </el-col>
  63. <el-col :span="24" class="other_1">
  64. <span>所在地区:</span>
  65. {{ getArea(item.area) || '暂无' }}
  66. </el-col>
  67. </el-col>
  68. </div>
  69. </el-col>
  70. </el-row>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </el-col>
  76. </custom-layout>
  77. </template>
  78. <script setup>
  79. const $checkRes = inject('$checkRes')
  80. import { get } from 'lodash-es'
  81. // 接口
  82. import { IncubatorStore } from '@/store/api/user/incubator'
  83. import { DictDataStore } from '@/store/api/system/dictData'
  84. const store = IncubatorStore()
  85. const dictDataStore = DictDataStore()
  86. import { UserStore } from '@/store/user'
  87. const userStore = UserStore()
  88. const user = computed(() => userStore.user)
  89. // 收藏
  90. import moment from 'moment'
  91. import { CollectionStore } from '@/store/api/platform/collection'
  92. const collectionStore = CollectionStore()
  93. // 加载中
  94. const loading = ref(false)
  95. // 路由
  96. const router = useRouter()
  97. const route = useRoute()
  98. const info = ref({})
  99. // 列表
  100. const list = ref([])
  101. const isUseList = ref([])
  102. // 请求
  103. onMounted(async () => {
  104. loading.value = true
  105. await searchOther()
  106. await search()
  107. loading.value = false
  108. })
  109. const searchOther = async () => {
  110. const data = { skip: 0, limit: 3, status: '1', is_show: '0' }
  111. let res
  112. res = await store.query(data)
  113. if (res.errcode == '0') list.value = res.data
  114. // 是否使用
  115. const result = await dictDataStore.query({ code: 'isUse', is_use: '0' })
  116. if ($checkRes(result)) isUseList.value = result.data
  117. }
  118. const search = async () => {
  119. let id = route.query.id
  120. if (id) {
  121. let res = await store.detail(id)
  122. if (res.errcode == '0') info.value = res.data
  123. }
  124. }
  125. // 查看
  126. const toView = (item) => {
  127. router.push({ path: '/base/detail', query: { id: item.id || item._id } })
  128. }
  129. const getUrl = (item) => {
  130. if (item) return `${import.meta.env.VITE_APP_HOST}${item}`
  131. }
  132. // 字典数据转换
  133. const getDict = (data, model) => {
  134. let res
  135. if (model == 'cooperate') res = isUseList.value.find((f) => f.value == data)
  136. return get(res, 'label')
  137. }
  138. // 地区
  139. const getArea = (data) => {
  140. if (data) return data.join('-')
  141. else return '暂无地区'
  142. }
  143. const toCollect = async () => {
  144. if (user.value.id) {
  145. info.value.is_collection = !info.value.is_collection
  146. let res
  147. let message
  148. const data = {
  149. user: user.value.id,
  150. source: info.value.id,
  151. type: 'incubator',
  152. time: moment().format('YYYY-MM-DD')
  153. }
  154. if (info.value.is_collection) {
  155. message = '收藏成功'
  156. res = await collectionStore.create(data)
  157. } else {
  158. message = '取消收藏成功'
  159. res = await collectionStore.cancel(data)
  160. }
  161. if (res.errcode === 0) {
  162. ElMessage({ message, type: 'success' })
  163. await search()
  164. }
  165. } else ElMessage({ message: '未登录!', type: 'error' })
  166. }
  167. </script>
  168. <style scoped lang="scss">
  169. .main {
  170. .one {
  171. padding-bottom: 40px;
  172. background: #f9faff url(/images/fw-det-bg.jpg) center top no-repeat;
  173. .info_1 {
  174. padding: 30px 0;
  175. }
  176. .info_2 {
  177. background-color: #fff;
  178. box-shadow: 0 0 13px 0 rgba(14, 5, 10, 0.16);
  179. padding: 27px;
  180. margin-bottom: 20px;
  181. .top {
  182. display: flex;
  183. .info_left {
  184. width: 460px;
  185. height: 260px;
  186. .image {
  187. height: 100%;
  188. width: 100%;
  189. }
  190. }
  191. .info_right {
  192. margin-left: 40px;
  193. width: 740px;
  194. .info_title {
  195. display: flex;
  196. justify-content: space-between;
  197. align-items: center;
  198. margin-bottom: 30px;
  199. .name {
  200. color: #22284e;
  201. font-size: $global-font-size-26;
  202. line-height: 26px;
  203. }
  204. .collect {
  205. display: flex;
  206. align-items: center;
  207. justify-content: flex-end;
  208. width: 35%;
  209. font-size: $global-font-size-20;
  210. color: #929292;
  211. cursor: default;
  212. span {
  213. margin: 0 0 0 5px;
  214. }
  215. }
  216. .iscollect {
  217. color: #1073ff;
  218. }
  219. }
  220. .other_1 {
  221. font-size: $global-font-size-18;
  222. margin: 10px 0;
  223. span {
  224. color: #686f7b;
  225. margin-left: 0;
  226. margin-right: 15px;
  227. }
  228. }
  229. }
  230. }
  231. .center {
  232. margin: 20px 0 0 0;
  233. .title {
  234. color: #000;
  235. display: inline-block;
  236. margin-right: 80px;
  237. padding-bottom: 20px;
  238. font-size: $global-font-size-20;
  239. color: #000000;
  240. border-bottom: 5px solid #378cff;
  241. cursor: pointer;
  242. }
  243. .content {
  244. padding: 20px;
  245. font-size: $global-font-size-16;
  246. }
  247. }
  248. .bottom {
  249. margin: 20px 0 0 0;
  250. .title {
  251. color: #000;
  252. display: inline-block;
  253. margin-right: 80px;
  254. padding-bottom: 20px;
  255. font-size: $global-font-size-20;
  256. color: #000000;
  257. border-bottom: 5px solid #378cff;
  258. cursor: pointer;
  259. }
  260. .content {
  261. padding: 20px 0;
  262. .list {
  263. float: left;
  264. width: 565px;
  265. height: 159px;
  266. border: solid 1px #cedbe7;
  267. background: url(/images/bg-teclist.jpg) no-repeat right;
  268. padding: 25px 0 0;
  269. margin: 10px 5px;
  270. .name {
  271. font-size: $global-font-size-20;
  272. font-weight: bold;
  273. display: inline-block;
  274. margin: 0 0 20px 7px;
  275. }
  276. .name:hover {
  277. color: #2374ff;
  278. cursor: pointer;
  279. }
  280. .other {
  281. .other_1 {
  282. margin: 10px 0;
  283. width: 100%;
  284. font-family: 'PingFangSC-Light', 'Microsoft YaHei', 'WenQuanYi Micro Hei', arial, sans-serif;
  285. font-size: $global-font-size-18;
  286. font-weight: normal;
  287. color: #666;
  288. }
  289. .other_1:hover {
  290. color: #2374ff;
  291. cursor: pointer;
  292. }
  293. }
  294. }
  295. }
  296. }
  297. }
  298. }
  299. }
  300. </style>