countryInformationDetails.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <template>
  2. <div class="autoBox box">
  3. <div class="crumbs">
  4. <el-breadcrumb separator="/">
  5. <el-breadcrumb-item :to="{ path: 'home' }">{{ $t('common.Home') }}</el-breadcrumb-item>
  6. <el-breadcrumb-item :to="{ path: 'countryInformation' }">{{ $t('common.CountryInformation') }}</el-breadcrumb-item>
  7. <el-breadcrumb-item>{{ $t('common.InformationDetails') }}</el-breadcrumb-item>
  8. </el-breadcrumb>
  9. </div>
  10. <div style="margin-top: 30px;width: 100%;">
  11. <div style="padding:0 100px;text-align: center;line-height: 50px;color: #666;font-size: 28px;font-weight: 700;">{{ list.title }}</div>
  12. <div style="margin: 0 20px;padding: 0 10px; line-height: 50px;color: #bcbcbc;font-size: 15px;border-bottom: 1px solid #bcbcbc;">
  13. <span>{{ $t('common.ReleaseTime') }}:{{ formatDate(list.publishDate) }} | {{ $t('common.Source') }}:{{ list.auther }}</span>
  14. <!-- 收藏按钮-->
  15. <!-- <span style="float: right;cursor: pointer;" @click="Collection">{{$t('common.Collection')}}</span>-->
  16. <span class="share cursor"
  17. :style="ifcommon?'color: #66b1ff;':''"
  18. style="margin-right: 20px;float: right;"
  19. @click="shareChange()">
  20. <i class="el-icon-star-off"
  21. :style="ifcommon?'color: #66b1ff;':''"></i>
  22. {{ $i18n.locale == 'zh' ? ifcommon ? "已收藏" : "收藏" : ifcommon ? "Already collected" : "Collection" }}
  23. </span>
  24. <!-- Collected -->
  25. </div>
  26. <div style="padding:0 50px;line-height: 40px;font-size: #666;" v-html="list.contentHtml"></div>
  27. <div style="padding:0 50px;line-height: 40px;font-size: #666;margin-top: 30px;">
  28. <div v-if="cmsInfoAttachments.length > 0" class="content">
  29. <div v-for="(item,index) in cmsInfoAttachments">
  30. <span>{{ $t('common.enclosure') }} {{ index + 1 }} :</span>
  31. <a style="cursor: pointer" @click="downloadEnclosure(item.attachmentName,item.attachmentSavePath)">{{ item.attachmentName }}</a>
  32. <div style="display:inline-block;height: 50px;background-color: #fff;margin-left: 20px">
  33. <a class="func example" style="margin-right: 15px;color: #0c27ff" @click="downloadEnclosure(item.attachmentName,item.attachmentSavePath)">{{$t('common.download')}}</a>
  34. <a class="func" @click="downloadP(item.attachmentSavePath)" style="color: #0c27ff">{{$t('common.preview')}}</a>
  35. </div>
  36. </div>
  37. </div>
  38. <div v-else>
  39. <div v-for="(item,index) in enclosureName" class="content">
  40. <div v-if="enclosureName.length >0">
  41. <span>{{ $t('common.enclosure') }} {{ index + 1 }} :</span>
  42. <a style="cursor: pointer" @click="downloadEnclosure()">{{ item }}</a>
  43. <div style="display:inline-block;height: 50px;background-color: #fff;margin-left: 20px">
  44. <a class="func example" style="margin-right: 15px;color: #0c27ff" @click="downloadEnclosure()">{{$t('common.download')}}</a>
  45. <a class="func" @click="downloadEnclosure()" style="color: #0c27ff">{{$t('common.preview')}}</a>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. <!--登录-->
  53. <el-dialog
  54. :title="$i18n.locale == 'zh' ? '提示' : 'Reminder'"
  55. :visible.sync="toViewLogin"
  56. :width="$i18n.locale == 'zh' ? '30%' : '40%'"
  57. :height="$i18n.locale == 'zh' ? '300px' : '386px'"
  58. :before-close="toViewLoginChange"
  59. >
  60. <div style="width: 100%; height: 100%">
  61. <img src="@/assets/img/loginTips.png" alt="" style="width: 180px; height: 180px; margin-left: 20px"/>
  62. <div style="float: right; margin-right: 20px" :style=" $i18n.locale == 'zh' ? 'width: 49%;margin-top: 10px;' : 'width: 453px;margin-top: -25px;'">
  63. <div style="
  64. font-size: 20px;
  65. font-weight: normal;
  66. color: #333333;
  67. font-family: HiraginoSansGB-W3, HiraginoSansGB;
  68. line-height: 40px;">
  69. {{ $t("common.ReminderFirst") }}
  70. </div>
  71. <div style="
  72. font-size: 16px;
  73. font-family: HiraginoSansGB-W3, HiraginoSansGB;
  74. font-weight: normal;
  75. color: #666666;
  76. line-height: 30px;">
  77. {{ $t("common.ReminderSecond") }}
  78. <span style="color: #0091ff; font-size: 18px">{{ num }}</span>
  79. {{ $t("common.ReminderThird") }}
  80. </div>
  81. <div style="
  82. font-size: 14px;
  83. font-family: HiraginoSansGB-W3, HiraginoSansGB;
  84. font-weight: normal;
  85. color: #666666;
  86. line-height: 30px;">
  87. {{ $t("common.ReminderForth") }}
  88. </div>
  89. <div style="
  90. font-size: 14px;
  91. font-family: HiraginoSansGB-W3, HiraginoSansGB;
  92. height: 33px;
  93. line-height: 60px;
  94. font-weight: normal;
  95. color: #0091ff;">
  96. <span
  97. style="margin-left: 40px"
  98. class="cursor"
  99. @click="toViewLoginCh('login')">
  100. {{ $t("common.ReminderFifth") }}
  101. </span>
  102. <span
  103. style="margin-left: 10px"
  104. class="cursor"
  105. @click="toView('Register')">
  106. {{ $t("common.ReminderSixth") }}
  107. </span>
  108. </div>
  109. </div>
  110. </div>
  111. </el-dialog>
  112. </div>
  113. </template>
  114. <script>
  115. import {getInformationById} from '@/api/country/countryList'
  116. import {addCollectInfo} from "@/api/baseUnitView";
  117. import {getPortalMyCollectModelByResearch} from "@/api/operation/basePortalModelFollowInfo";
  118. import {getToken} from "@/utils/auth";
  119. import {getAttaments, download} from '@/api/file'
  120. export default {
  121. name: 'countryInformationDetails',
  122. data() {
  123. return {
  124. listId: this.$route.query.key,
  125. list: {},
  126. ifcommon: false,
  127. toViewLogin: false,
  128. timer: "",
  129. num: 0,
  130. cmsInfoAttachments: [],
  131. isLogin: false,
  132. enclosureName: [],
  133. }
  134. },
  135. mounted() {
  136. this.isLogin = this.$Cookies.get('token') ? true : false;
  137. this.getList();
  138. // this.getMyCollecModel()
  139. },
  140. watch: {
  141. '$i18n.locale'() {
  142. this.getList();
  143. },
  144. toViewLogin() {
  145. if (this.toViewLogin == true) {
  146. this.loginTipsChange();
  147. }
  148. },
  149. },
  150. methods: {
  151. //登录方法
  152. toViewLoginCh(router) {
  153. clearInterval(this.timer);
  154. this.$router.push(router);
  155. },
  156. // 未登录跳转
  157. loginTipsChange() {
  158. const that = this;
  159. this.num = 5;
  160. clearInterval(that.timer);
  161. this.timer = setInterval(function () {
  162. if (that.num > 0) {
  163. that.num--;
  164. console.log(that.num)
  165. } else {
  166. if (that.toViewLogin == true) {
  167. clearInterval(that.timer);
  168. that.toViewLoginCh("login");
  169. } else {
  170. clearInterval(that.timer);
  171. }
  172. }
  173. }, 1000);
  174. },
  175. // 判断未登录跳转是否关闭
  176. toViewLoginChange(done) {
  177. this.toViewLogin = false;
  178. this.num = 5;
  179. clearInterval(this.timer);
  180. this.$emit('LoginBack', false)
  181. },
  182. //下载附件
  183. downloadEnclosure(fileName, path) {
  184. if (this.isLogin) {
  185. if (fileName && path) {
  186. const link = document.createElement('a');
  187. link.href = "api/file/pub/" + path;
  188. link.download = fileName; //下载的文件名
  189. link.click();
  190. }
  191. } else {
  192. this.toViewLogin = true;
  193. }
  194. },
  195. downloadP(url){
  196. let a = document.createElement('a');
  197. a.href ="api/file/pub/" + url;
  198. a.click();
  199. },
  200. //获取附件
  201. getEnclosureList() {
  202. getAttaments({
  203. attachmentBusinessId: this.list.id,
  204. attachmentBusinessType: 'cms_information_info'
  205. }).then(res => {
  206. var data = res.data;
  207. if (data && data.attachmentInfos) {
  208. let attachments = [];
  209. data.attachmentInfos.forEach((element, index) => {
  210. attachments.push({
  211. attachmentBusinessId: element.attachmentBusinessId,
  212. attachmentId: element.id,
  213. attachmentName: element.attachmentName,
  214. attachmentSize: element.attachmentSize,
  215. attachmentStatement: element.attachmentStatement,
  216. attachmentSavePath: element.attachmentSavePath,
  217. fileFunctionTypeDict: element.fileFunctionTypeDict,
  218. sort: index,
  219. status: element.status,
  220. createBy: element.createBy,
  221. createDate: element.createDate,
  222. });
  223. });
  224. this.cmsInfoAttachments = attachments;
  225. }
  226. });
  227. },
  228. getList() {
  229. let list = {
  230. baseId: this.listId,
  231. language: this.$i18n.locale.toUpperCase()
  232. }
  233. getInformationById(list).then(res => {
  234. if (res.data.cmsInformationView) {
  235. this.list = res.data.cmsInformationView;
  236. this.enclosureName = this.list.remark ? this.list.remark.split(',,') : [];
  237. this.getMyCollecModel();
  238. let tokenDetaile = this.$Cookies.get('token');
  239. if (tokenDetaile) {
  240. this.getEnclosureList();
  241. }
  242. console.log('当前页面数据')
  243. console.log(this.list)
  244. } else {
  245. this.$message({
  246. message: this.$i18n.locale == 'zh' ? "暂无此版本" : "This version is not available yet",
  247. });
  248. return
  249. }
  250. })
  251. },
  252. getIconUrl(url) {
  253. return require("@/assets/img/realTimeInfo/" + url);
  254. },
  255. toView(router, json) {
  256. this.$router.push({name: router, params: json})
  257. },
  258. screenBack(data) {
  259. console.log(data, 'screenBackscreenBackscreenBackscreenBack')
  260. },
  261. screen(i) {
  262. this.index = i
  263. },
  264. getInformation(num) {
  265. this.informationsClass = num
  266. },
  267. //查询是否收藏
  268. getMyCollecModel() {
  269. const that = this;
  270. if (this.$Cookies.get('token')) {
  271. let user = window.localStorage.getItem('user');
  272. let users = JSON.parse(user);
  273. let modelType = 'message';
  274. let userId = users.userId;
  275. let modelId = that.list.baseEntityId;
  276. getPortalMyCollectModelByResearch(modelId, modelType, userId).then(res => {
  277. that.ifcommon = res.data.result;
  278. console.log('收藏状态')
  279. console.log(res.data)
  280. })
  281. }
  282. },
  283. // 项目收藏改变
  284. shareChange() {
  285. if (!this.ifcommon) {
  286. this.Collection("collect");
  287. } else {
  288. this.Collection("uncollect");
  289. }
  290. },
  291. //收藏
  292. Collection(collectType) {
  293. let user = window.localStorage.getItem('user');
  294. let tokenDetaile = this.$Cookies.get('token');
  295. console.log(tokenDetaile)
  296. if (!tokenDetaile) {
  297. this.toViewLogin = true;
  298. } else {
  299. var users = JSON.parse(user);
  300. this.userId = users.userId;
  301. let modelId = this.list.baseEntityId;
  302. let modelType = "message";
  303. let userId = users.userId;
  304. // let collectType= "collect";
  305. var token = "" + getToken();
  306. addCollectInfo(modelId, modelType, userId, collectType, token).then(res => {
  307. if (res.status == 200) {
  308. if (!this.ifcommon) {
  309. this.$message({
  310. message: this.$i18n.locale == 'zh' ? "已收藏" : "Collection of success",
  311. type: 'success'
  312. });
  313. } else if (this.ifcommon) {
  314. this.$message({
  315. message: this.$i18n.locale == 'zh' ? "取消收藏" : "Cancel the collect",
  316. type: 'success'
  317. });
  318. }
  319. }
  320. this.ifcommon = !this.ifcommon;
  321. }).catch(error => {
  322. });
  323. }
  324. },
  325. }
  326. }
  327. </script>
  328. <!-- Add "scoped" attribute to limit CSS to this component only -->
  329. <style scoped>
  330. .content{
  331. vertical-align: center;
  332. margin-top: 20px;
  333. padding:0 30px;
  334. cursor: pointer;
  335. width: 100%;
  336. }
  337. .box {
  338. margin-top: 10px;
  339. background: #fff;
  340. /* height: 500px; */
  341. padding: 20px 0;
  342. }
  343. .crumbs {
  344. margin-left: 20px;
  345. }
  346. body {
  347. margin: 0;
  348. }
  349. .swipers {
  350. position: absolute;
  351. top: 30px;
  352. left: 100px;
  353. width: 460px;
  354. height: 390px;
  355. }
  356. .details {
  357. position: absolute;
  358. top: 30px;
  359. left: 600px;
  360. width: 460px;
  361. height: 390px;
  362. }
  363. .swiper-container {
  364. width: 100%;
  365. height: 300px;
  366. margin-left: auto;
  367. margin-right: auto;
  368. }
  369. .swiper-slide {
  370. background-size: cover;
  371. background-position: center;
  372. }
  373. .gallery-top {
  374. height: 80%;
  375. width: 100%;
  376. }
  377. .gallery-thumbs {
  378. height: 20%;
  379. box-sizing: border-box;
  380. padding: 10px 0;
  381. }
  382. .gallery-thumbs .swiper-slide {
  383. width: 25%;
  384. height: 100%;
  385. opacity: 0.4;
  386. }
  387. .gallery-thumbs .swiper-slide-thumb-active {
  388. opacity: 1;
  389. }
  390. .initData_label {
  391. color: #6c8c9d;
  392. font-weight: 700;
  393. font-size: 18px;
  394. line-height: 42px;
  395. }
  396. .enterprise_style {
  397. line-height: 40px;
  398. color: #6C819D;
  399. /* padding-left: 100px; */
  400. font-size: 18px;
  401. /* font-weight: 700; */
  402. margin-top: 5px;
  403. margin-left: 100px;
  404. border-bottom: 1px solid #95d13e;
  405. }
  406. .enterprise_style_span {
  407. padding: 10px;
  408. text-align: center;
  409. height: 100%;
  410. background: #95d13e;
  411. color: #fff;
  412. /* border-bottom: 2px solid #6699ff; */
  413. }
  414. .enterprise_style_product tr {
  415. line-height: 30px;
  416. width: 100%;
  417. display: inline-block;
  418. border-bottom: 1px dashed #ccc;
  419. font-size: 14px;
  420. color: #6C819D;
  421. margin-bottom: 5px;
  422. }
  423. .recommend {
  424. margin-top: 15px;
  425. margin-left: 100px;
  426. }
  427. .recommend li {
  428. display: inline-block;
  429. width: 170px;
  430. /* height: 130px; */
  431. text-align: center;
  432. margin-right: 15px;
  433. }
  434. .information1 {
  435. display: inline-block;
  436. width: 123px;
  437. height: 100%;
  438. border: 1px solid rgba(228, 228, 228, 1);
  439. text-align: center;
  440. background: #f9f9f9;
  441. color: #999;
  442. }
  443. .information2 {
  444. display: inline-block;
  445. width: 123px;
  446. height: 100%;
  447. border-top: 3px solid #2c5589;
  448. text-align: center;
  449. color: #2c5589;
  450. }
  451. .information1:hover {
  452. color: #FF0036;
  453. }
  454. </style>