expertDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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="infoName">
  8. <el-image class="image" :src="userLogo" fit="fill" />
  9. <div class="other_1">
  10. <div class="info_title">
  11. <div class="name">{{ info.name || '暂无' }}</div>
  12. <div class="collect iscollect" @click="toCollect" v-if="info.is_collection">
  13. <el-icon :size="24" color="#1073ff"><StarFilled /></el-icon>
  14. <span>已收藏</span>
  15. </div>
  16. <div class="collect" v-else @click="toCollect">
  17. <el-icon :size="24"><Star /></el-icon>
  18. <span>收藏</span>
  19. </div>
  20. </div>
  21. <div class="brief">
  22. <span>{{ info.title || '暂无' }}</span>
  23. <span v-if="info.area">{{ info.area || '暂无' }}</span>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="infoButton">
  28. <div class="button" @click="toChat">获取联系方式</div>
  29. </div>
  30. <div class="infoBrief">
  31. <div class="Brief_1">
  32. <span>所属产业:</span>
  33. <span>{{ info.industry || '暂无' }}</span>
  34. </div>
  35. <div class="Brief_2" v-if="info.work">
  36. <span>工作单位:</span>
  37. <span>{{ info.work || '暂无' }}</span>
  38. </div>
  39. <div class="Brief_2" v-if="info.direction">
  40. <span>研究方向:</span>
  41. <span>{{ info.direction || '暂无' }}</span>
  42. </div>
  43. </div>
  44. <div class="infoOther">
  45. <div class="title">合作信息</div>
  46. <div class="content">
  47. <el-table :data="tableData" stripe style="width: 100%" :header-cell-style="{ backgroundColor: 'rgba(194, 209, 225, 0.5)', color: '#ffffff', fontSize: '16px', textAlign: 'center' }" :cell-style="{ fontSize: '16px', textAlign: 'center' }" :row-style="{ fontSize: '16px', textAlign: 'center' }">
  48. <el-table-column prop="company" label="合作单位" />
  49. <el-table-column prop="num" label="合作论文数量" />
  50. </el-table>
  51. </div>
  52. </div>
  53. <div class="infoOther">
  54. <div class="title">荣誉&成就</div>
  55. <div class="content">{{ info.title || '暂无' }}</div>
  56. </div>
  57. <div class="infoOther">
  58. <div class="title">科研成果</div>
  59. <div class="content">
  60. <div class="content_1">
  61. <div class="menu" :class="[active == '1' ? 'menuTrue' : '']" @click="toActive('1')">
  62. <span>期刊论文</span>
  63. </div>
  64. <div class="menu" :class="[active == '2' ? 'menuTrue' : '']" @click="toActive('2')">
  65. <span>科技成果</span>
  66. </div>
  67. <div class="menu" :class="[active == '3' ? 'menuTrue' : '']" @click="toActive('3')">
  68. <span>专利</span>
  69. </div>
  70. </div>
  71. <div class="content_2">
  72. <div class="brief">
  73. {{ info.brief || '暂无' }}
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </el-col>
  81. </custom-layout>
  82. </template>
  83. <script setup>
  84. import userLogo from '/images/userLogo.png'
  85. import { ExpertStore } from '@/store/api/user/expert'
  86. import { ContactApplyStore } from '@/store/api/user/contactApply'
  87. const contactApplyStore = ContactApplyStore()
  88. const store = ExpertStore()
  89. // 收藏
  90. import moment from 'moment'
  91. import { CollectionStore } from '@/store/api/platform/collection'
  92. const collectionStore = CollectionStore()
  93. import { UserStore } from '@/store/user'
  94. const userStore = UserStore()
  95. const user = computed(() => userStore.user)
  96. // 加载中
  97. const loading = ref(false)
  98. // 路由
  99. const route = useRoute()
  100. const tableData = ref([
  101. // { company: '中国科学院固定物理研究所', num: '45' },
  102. // { company: '中国汽车工程学会', num: '30' },
  103. // { company: '清华大学车辆与运载学院', num: '27' },
  104. // { company: '原一汽技术中心技术中心', num: '23' }
  105. ])
  106. const active = ref('1')
  107. const info = ref({})
  108. // 请求
  109. onMounted(async () => {
  110. loading.value = true
  111. await searchOther()
  112. await search()
  113. loading.value = false
  114. })
  115. const search = async () => {
  116. let id = route.query.id
  117. if (id) {
  118. let res = await store.detail(id)
  119. if (res.errcode == '0') info.value = res.data
  120. }
  121. }
  122. const searchOther = async () => {
  123. // let result
  124. // // 成熟度
  125. // result = await dictDataStore.query({ code: 'mature', is_use: '0' })
  126. // if ($checkRes(result)) matureList.value = result.data
  127. // // 出让方式
  128. // result = await dictDataStore.query({ code: 'sell', is_use: '0' })
  129. // if ($checkRes(result)) sellList.value = result.data
  130. // // 技术领域
  131. // result = await dictDataStore.query({ code: 'field', is_use: '0' })
  132. // if ($checkRes(result)) fieldList.value = result.data
  133. // // 属性
  134. // result = await dictDataStore.query({ code: 'attribute', is_use: '0' })
  135. // if ($checkRes(result)) attributeList.value = result.data
  136. // // 技术分类
  137. // result = await dictDataStore.query({ code: 'technology', is_use: '0' })
  138. // if ($checkRes(result)) technologyList.value = result.data
  139. }
  140. const toActive = (item) => {
  141. active.value = item
  142. }
  143. const toChat = () => {
  144. if (user.value.id) {
  145. ElMessageBox.confirm(`您确认要获取联系方式?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
  146. .then(async () => {
  147. let source_id = route.query.id
  148. let source = 'expert'
  149. let apply_user = user.value.id
  150. const obj = { source_id, source, apply_user }
  151. await contactApplyStore.create(obj)
  152. ElMessage({ message: `获取联系方式成功等待消息通知`, type: 'success' })
  153. })
  154. .catch(() => {})
  155. } else ElMessage({ message: '未登录!', type: 'error' })
  156. }
  157. const toCollect = async () => {
  158. if (user.value.id) {
  159. info.value.is_collection = !info.value.is_collection
  160. let res
  161. let message
  162. const data = {
  163. user: user.value.id,
  164. source: info.value.id,
  165. type: 'expert',
  166. time: moment().format('YYYY-MM-DD')
  167. }
  168. if (info.value.is_collection) {
  169. message = '收藏成功'
  170. res = await collectionStore.create(data)
  171. } else {
  172. message = '取消收藏成功'
  173. res = await collectionStore.cancel(data)
  174. }
  175. if (res.errcode === 0) {
  176. ElMessage({ message, type: 'success' })
  177. await search()
  178. }
  179. } else ElMessage({ message: '未登录!', type: 'error' })
  180. }
  181. </script>
  182. <style scoped lang="scss">
  183. .main {
  184. .one {
  185. background: url(/images/expertBg.png) no-repeat;
  186. background-position: center top;
  187. .info_1 {
  188. padding: 30px 0;
  189. }
  190. .info_2 {
  191. border-radius: 5px;
  192. padding-right: 30px;
  193. padding: 50px;
  194. background: url(/images/userbg.png) no-repeat;
  195. background-position: center top;
  196. .infoName {
  197. display: flex;
  198. align-items: center;
  199. justify-content: center;
  200. .other_1 {
  201. margin: 0 0 0 10px;
  202. width: 20%;
  203. .info_title {
  204. display: flex;
  205. justify-content: space-between;
  206. align-items: center;
  207. .name {
  208. font-size: $global-font-size-22;
  209. font-weight: bold;
  210. }
  211. .collect {
  212. display: flex;
  213. align-items: center;
  214. justify-content: flex-end;
  215. font-size: $global-font-size-20;
  216. width: 45%;
  217. color: #929292;
  218. cursor: default;
  219. span {
  220. margin: 0 0 0 5px;
  221. }
  222. }
  223. .iscollect {
  224. color: #1073ff;
  225. }
  226. }
  227. .brief {
  228. font-size: $global-font-size-18;
  229. color: $global-color-595;
  230. margin: 5px 0 0 0;
  231. span {
  232. margin: 0 5px 0 0;
  233. }
  234. }
  235. }
  236. }
  237. .infoButton {
  238. display: flex;
  239. justify-content: center;
  240. margin: 10px 0 0 0;
  241. .button {
  242. width: 152px;
  243. height: 36px;
  244. background: #3278f4;
  245. border-radius: 18px;
  246. font-size: $global-font-size-14;
  247. font-weight: 500;
  248. color: #ffffff;
  249. text-align: center;
  250. line-height: 36px;
  251. cursor: pointer;
  252. }
  253. }
  254. .infoBrief {
  255. background: rgba(194, 209, 225, 0.5);
  256. padding: 20px;
  257. margin: 20px 0;
  258. border-radius: 5px;
  259. font-size: $global-font-size-18;
  260. .Brief_1 {
  261. margin: 10px 0;
  262. span:first-child {
  263. margin: 0 5px 0 0;
  264. }
  265. span:last-child {
  266. color: #dc4900;
  267. margin: 0 5px 0 0;
  268. }
  269. }
  270. .Brief_2 {
  271. margin: 10px 0;
  272. span:first-child {
  273. margin: 0 5px 0 0;
  274. }
  275. span:last-child {
  276. margin: 0 5px 0 0;
  277. }
  278. }
  279. }
  280. .infoOther {
  281. margin: 20px 0;
  282. border-radius: 5px;
  283. padding: 10px;
  284. background: #ffffff;
  285. box-shadow: 0 2px 5px 0 rgba(159, 158, 158, 0.3);
  286. .title {
  287. margin: 10px 0 10px;
  288. padding-left: 10px;
  289. height: 18px;
  290. line-height: 18px;
  291. font-size: 16px;
  292. font-weight: bold;
  293. color: #1073ff;
  294. border-left: 3px solid #1073ff;
  295. }
  296. .content {
  297. padding: 20px;
  298. font-size: $global-font-size-18;
  299. .content_1 {
  300. display: flex;
  301. align-items: center;
  302. .menu {
  303. padding: 10px 20px;
  304. margin: 0 10px 0 0;
  305. color: #666666;
  306. border: 1px solid #bbbbbb;
  307. cursor: default;
  308. }
  309. .menuTrue {
  310. color: $global-color-fff;
  311. background: #1073ff;
  312. border: none;
  313. cursor: default;
  314. }
  315. }
  316. .content_2 {
  317. margin: 10px 0;
  318. .brief {
  319. margin: 10px 0;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. }
  326. }
  327. </style>