General.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <template>
  2. <div
  3. class="general"
  4. >
  5. <h1
  6. v-if="activeCorpInfo"
  7. :title="activeCorpInfo.name"
  8. >
  9. {{ activeCorpInfo.name }}
  10. </h1>
  11. <form @submit="onSearch">
  12. <input
  13. v-model="filterKeyword"
  14. type="text"
  15. placeholder="请输入企业名称"
  16. >
  17. <button type="submit">
  18. <img
  19. class=""
  20. src="@/assets/images/icon_search.png"
  21. alt=""
  22. draggable="false"
  23. >
  24. </button>
  25. </form>
  26. <ul>
  27. <li
  28. v-for="(decade) in corpListMap.keys()"
  29. :key="decade"
  30. >
  31. <h2>
  32. <img
  33. class=""
  34. src="@/assets/images/decade-decorator-left.png"
  35. alt=""
  36. draggable="false"
  37. >
  38. <span>{{ decade }}</span>
  39. <img
  40. class=""
  41. src="@/assets/images/decade-decorator-right.png"
  42. alt=""
  43. draggable="false"
  44. >
  45. </h2>
  46. <div
  47. v-for="(corpItem) in corpListMap.get(decade)"
  48. :id="`corp-item-${corpItem.id}`"
  49. :key="corpItem.id"
  50. class="corp-item"
  51. :class="{
  52. active: activeCorpId === corpItem.id
  53. }"
  54. @click="onClickCorpItem(corpItem.id)"
  55. >
  56. <div class="item-icon" />
  57. <div class="verticle-line" />
  58. <span
  59. class="corp-name"
  60. :title="corpItem.name"
  61. >
  62. {{ corpItem.name }}
  63. </span>
  64. <span class="corp-time">
  65. {{ corpItem.createTime }}
  66. </span>
  67. </div>
  68. </li>
  69. </ul>
  70. <article v-if="activeCorpInfo && isShowDesc">
  71. <button
  72. class="close"
  73. @click="isShowDesc = false"
  74. />
  75. <h2>{{ activeCorpInfo.name }}</h2>
  76. <img
  77. class="splitter"
  78. src="@/assets/images/splitter.png"
  79. alt=""
  80. draggable="false"
  81. >
  82. <img
  83. class="banner"
  84. src="@/assets/images/for-dev.jpg"
  85. alt=""
  86. draggable="false"
  87. >
  88. <div
  89. class="txt"
  90. v-html="activeCorpInfo.content || ''"
  91. />
  92. </article>
  93. </div>
  94. </template>
  95. <script>
  96. import {
  97. computed,
  98. onMounted,
  99. watch,
  100. reactive,
  101. ref,
  102. } from 'vue'
  103. import deepClone from 'lodash/cloneDeep'
  104. import corpInfo from '@/assets/mock/corp-info.json'
  105. export default {
  106. name: 'GeneralView',
  107. components: {
  108. },
  109. setup () {
  110. const filterKeyword = ref('')
  111. const corpListRaw = reactive(corpInfo.data)
  112. const corpListMap = computed(() => {
  113. const corpListFiltered = corpListRaw.filter((item) => {
  114. return !filterKeyword.value || item.name.includes(filterKeyword.value)
  115. })
  116. const afterSort = deepClone(corpListFiltered)
  117. afterSort.sort((a, b) => {
  118. return Date.parse(b.createTime) - Date.parse(a.createTime)
  119. })
  120. const ret = new Map()
  121. afterSort.forEach(element => {
  122. const t = element.createTime[2]
  123. const decade = Number(t) < 3 ? `本世纪${t}0年代` : `上世纪${t}0年代`
  124. if (!ret.get(decade)) {
  125. ret.set(decade, [])
  126. }
  127. ret.get(decade).push(element)
  128. })
  129. return ret
  130. })
  131. const activeCorpId = ref(null)
  132. const activeCorpInfo = computed(() => {
  133. return corpListRaw.find((item) => {
  134. return item.id === activeCorpId.value
  135. })
  136. })
  137. function onClickCorpItem(id) {
  138. if ((typeof activeCorpId.value === 'number')) {
  139. gUnityInst.SendMessage('Panel1', 'SetEnterpriseUnSelected', activeCorpId.value) //设置id为1的企业为未选中状态(此id需要是已显示的)
  140. }
  141. gUnityInst.SendMessage('Panel1', 'SetEnterpriseSelected', id) //设置id为1的企业为选中状态(此id需要是已显示的)
  142. activeCorpId.value = id
  143. isShowDesc.value = true
  144. console.log(`corp-item-${id}`)
  145. const clickedElement = document.querySelector(`#corp-item-${id}`)
  146. if (clickedElement) {
  147. clickedElement.scrollIntoView()
  148. }
  149. }
  150. window.onCorpOnMapClicked = onClickCorpItem
  151. const isShowDesc = ref(true)
  152. return {
  153. filterKeyword,
  154. corpListMap,
  155. activeCorpId,
  156. activeCorpInfo,
  157. onClickCorpItem,
  158. isShowDesc,
  159. }
  160. },
  161. data() {
  162. return {
  163. }
  164. },
  165. computed: {
  166. ...mapState([
  167. ]),
  168. },
  169. mounted() {
  170. // this.$mitt.emit('test', { msg: 'home mounted' })
  171. },
  172. beforeUnmount() {
  173. },
  174. unmounted() {
  175. },
  176. methods: {
  177. ...mapMutations([
  178. ]),
  179. onSearch() {
  180. console.log('search!')
  181. }
  182. },
  183. }
  184. </script>
  185. <style lang="less" scoped>
  186. .general {
  187. >h1 {
  188. position: absolute;
  189. top: 51px;
  190. left: 81px;
  191. max-width: 50%;
  192. overflow: hidden;
  193. white-space: pre;
  194. text-overflow: ellipsis;
  195. font-size: 48px;
  196. font-family: Source Han Sans CN-Heavy, Source Han Sans CN;
  197. font-weight: 800;
  198. color: #FFFFFF;
  199. padding-top: 20px;
  200. padding-bottom: 20px;
  201. border-top: 1px solid rgba(217, 217, 217, 0.2);
  202. border-bottom: 1px solid rgba(217, 217, 217, 0.2);
  203. }
  204. >form {
  205. position: absolute;
  206. top: 196px;
  207. left: 81px;
  208. display: flex;
  209. align-items: center;
  210. >input {
  211. background: rgba(255,255,255,0.1);
  212. border-radius: 3px 3px 3px 3px;
  213. border: 1px solid rgba(255, 255, 255, 0.5);
  214. width: 220px;
  215. height: 40px;
  216. padding-left: 13px;
  217. padding-right: 13px;
  218. font-size: 16px;
  219. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  220. font-weight: 400;
  221. color: #FFFFFF;
  222. &:focus {
  223. border: 1px solid rgba(255, 255, 255, 1);
  224. }
  225. &::placeholder {
  226. font-size: 16px;
  227. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  228. font-weight: 400;
  229. color: rgba(255, 255, 255, 0.5);
  230. }
  231. }
  232. >button {
  233. margin-left: 8px;
  234. width: 40px;
  235. height: 40px;
  236. background: rgba(255,255,255,0.3);
  237. border-radius: 3px 3px 3px 3px;
  238. opacity: 1;
  239. border: 1px solid #FFFFFF;
  240. &:hover {
  241. background: rgba(255,255,255,0.5);
  242. }
  243. >img {
  244. width: 100%;
  245. height: 100%;
  246. }
  247. }
  248. }
  249. >ul {
  250. position: absolute;
  251. top: 272px;
  252. left: 81px;
  253. max-height: 520px;
  254. overflow: auto;
  255. >li {
  256. display: block;
  257. color: #fff;
  258. >h2 {
  259. width: 323px;
  260. height: 47px;
  261. background: linear-gradient(92deg, rgba(176,161,121,0) 0%, rgba(176,161,121,0.3) 50%, rgba(176,161,121,0) 100%);
  262. // border-radius: 3px;
  263. font-size: 16px;
  264. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  265. font-weight: bold;
  266. color: #FFFFFF;
  267. text-shadow: 0px 0px 5px #FFD15B;
  268. display: flex;
  269. justify-content: center;
  270. align-items: center;
  271. margin-bottom: 17px;
  272. >span {
  273. margin-left: 13px;
  274. margin-right: 13px;
  275. }
  276. >img {
  277. width: 60px;
  278. height: 15px;
  279. }
  280. }
  281. >.corp-item {
  282. position: relative;
  283. width: 363px;
  284. height: 50px;
  285. background: linear-gradient(90deg, #3A454F 0%, rgba(22,28,33,0) 100%);
  286. backdrop-filter: blur(3px);
  287. border-radius: 3px 3px 3px 3px;
  288. opacity: 1;
  289. border: 1px solid;
  290. border-right: none;
  291. border-image: linear-gradient(98deg, rgba(78, 96, 112, 1), rgba(78, 96, 112, 0)) 1 1;
  292. padding-left: 72px;
  293. display: flex;
  294. flex-direction: column;
  295. justify-content: space-around;
  296. align-items: flex-start;
  297. margin-bottom: 24px;
  298. cursor: pointer;
  299. >.item-icon {
  300. position: absolute;
  301. border-radius: 50%;
  302. left: 35px;
  303. top: 50%;
  304. transform: translateY(-50%);
  305. width: 8px;
  306. height: 8px;
  307. background: #6D9DC6;
  308. z-index: 2;
  309. }
  310. >.verticle-line {
  311. position: absolute;
  312. top: -1px;
  313. left: 38px;
  314. width: 2px;
  315. height: 75px;
  316. background: #B0A179 50%;
  317. z-index: 1;
  318. }
  319. &:first-of-type {
  320. >.verticle-line {
  321. top: 50%;
  322. }
  323. }
  324. &:last-of-type {
  325. >.verticle-line {
  326. top: initial;
  327. bottom: 50%;
  328. }
  329. }
  330. &:first-of-type:last-of-type {
  331. >.verticle-line {
  332. display: none;
  333. }
  334. }
  335. >span.corp-name {
  336. display: block;
  337. font-size: 16px;
  338. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  339. font-weight: bold;
  340. color: #FFFFFF;
  341. overflow: hidden;
  342. white-space: pre;
  343. text-overflow: ellipsis;
  344. }
  345. &.active {
  346. >span.corp-name {
  347. font-size: 20px;
  348. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  349. text-shadow: 0px 0px 16px #BD9D48;
  350. }
  351. }
  352. >span.corp-time {
  353. display: block;
  354. font-size: 16px;
  355. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  356. font-weight: 400;
  357. color: #FFFFFF;
  358. }
  359. &:hover {
  360. background: linear-gradient(90deg, #B0A179 0%, rgba(255,209,91,0) 100%);
  361. border-image: linear-gradient(98deg, rgba(176, 161, 121, 1), rgba(176, 161, 121, 0)) 1 1;
  362. }
  363. &.active {
  364. background: linear-gradient(90deg, #B0A179 0%, rgba(255,209,91,0) 100%);
  365. border-image: linear-gradient(98deg, rgba(176, 161, 121, 1), rgba(176, 161, 121, 0)) 1 1;
  366. >.item-icon {
  367. background: #FFFFFF;
  368. box-shadow: 0px 0px 12px 0px #FFD15B, 0px 0px 8px 0px #FFD15B, 0px 0px 10px 0px #FFD15B, 0px 0px 5px 0px #FFD15B;
  369. }
  370. }
  371. }
  372. }
  373. &::-webkit-scrollbar { background: transparent; width: 4px; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
  374. &::-webkit-scrollbar-thumb {
  375. background: transparent;
  376. border-radius: 2px;
  377. }
  378. &:hover {
  379. &::-webkit-scrollbar-thumb {
  380. background: rgba(220, 231, 240, 0.2);
  381. }
  382. }
  383. }
  384. >article {
  385. position: absolute;
  386. top: 74px;
  387. right: 0;
  388. width: 653px;
  389. height: calc(100% - 74px - 112px - 50px);
  390. backdrop-filter: blur(5px);
  391. background-image: url(@/assets/images/general-article-bg.png);
  392. background-size: 100% auto;
  393. background-repeat: no-repeat;
  394. background-position: left top;
  395. padding: 32px 50px 50px 50px;
  396. display: flex;
  397. flex-direction: column;
  398. >button.close {
  399. position: absolute;
  400. top: 30px;
  401. right: 50px;
  402. width: 32px;
  403. height: 32px;
  404. background-image: url(@/assets/images/icon-close.png);
  405. background-size: cover;
  406. background-repeat: no-repeat;
  407. background-position: center center;
  408. }
  409. >h2 {
  410. flex: 0 0 auto;
  411. font-size: 24px;
  412. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  413. font-weight: bold;
  414. color: #FFFFFF;
  415. margin-bottom: 21px;
  416. }
  417. >img.splitter {
  418. flex: 0 0 auto;
  419. width: 100%;
  420. margin-bottom: 37px;
  421. }
  422. >img.banner {
  423. flex: 0 0 auto;
  424. width: 100%;
  425. height: 34.8%;
  426. object-fit: contain;
  427. margin-bottom: 20px;
  428. }
  429. >.txt {
  430. flex: 1 0 1px;
  431. font-size: 20px;
  432. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  433. font-weight: 400;
  434. color: rgba(255, 255, 255, 0.8);
  435. line-height: 23px;
  436. overflow: auto;
  437. padding-right: 10px;
  438. margin-right: -10px;
  439. &::-webkit-scrollbar { background: transparent; width: 4px; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
  440. &::-webkit-scrollbar-thumb {
  441. background: rgba(220, 231, 240, 0.2);
  442. border-radius: 2px;
  443. }
  444. }
  445. }
  446. }
  447. </style>