ThinkTankArticleDetail.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <template>
  2. <div class="autoBox box">
  3. <div class="crumbs">
  4. <el-breadcrumb separator="/" style="margin:15px ">
  5. <el-breadcrumb-item :to="{ path: 'home' }">{{ $t('common.Home') }}</el-breadcrumb-item>
  6. <el-breadcrumb-item :to="{ path: 'ThinkTankConsulting2' }">{{ $t('common.ThinkTankConsulting') }}</el-breadcrumb-item>
  7. <el-breadcrumb-item>{{ articleDetail.title }}</el-breadcrumb-item>
  8. </el-breadcrumb>
  9. </div>
  10. <div style="margin-top: 15px;padding: 0 20px">
  11. <div class="leftBox">
  12. <div class="title">{{ articleDetail.title }}</div>
  13. <div class="tip">
  14. <div class="detailTip" v-for="(item,index) in articleDetail.tip">
  15. {{ item.title }}
  16. </div>
  17. </div>
  18. <div class="time">
  19. <div style="float: left;font-size: 15px">
  20. {{ $t('common.ReleaseTime') }}:
  21. <span>{{ formatDate(articleDetail.createDate) }}</span>
  22. | {{ $t('common.Source') }}:
  23. <span>{{ articleDetail.auther }}</span>
  24. </div>
  25. <!-- 收藏-->
  26. <div style="float:right;">
  27. <span class="share cursor"
  28. :style="ifcommon?'color: #66b1ff;':''"
  29. style="margin-right: 20px;float: right;"
  30. @click="shareChange">
  31. <i class="el-icon-star-off"
  32. :style="ifcommon?'color: #66b1ff;':''"></i>
  33. {{ $i18n.locale == 'zh' ? ifcommon ? "已收藏" : "收藏" : ifcommon ? "Already collected" : "Collection" }}
  34. </span>
  35. </div>
  36. <div style="clear: both"></div>
  37. </div>
  38. <div class="articleContent" v-html="articleDetail.contentHtml"></div>
  39. <div style="margin:10px 20px 0 0;line-height: 24px;color:#888;padding-top: 10px; font-size: 14px;vertical-align: top;border-top: 1px dashed #000;">
  40. {{ $t('common.contentisreproduced') }}
  41. </div>
  42. <!--留言框-->
  43. <div class="messageBox">
  44. <div class="messageTitle">
  45. <div class="squireBox"></div>
  46. <div class="titleSty" v-if="isLogin">
  47. {{ $t('common.Message') }}(<span>{{ messageTotal }}</span>)
  48. </div>
  49. <div class="titleSty" v-else>
  50. {{ $t('common.Message') }}(0)
  51. </div>
  52. </div>
  53. <!--已登录-->
  54. <div class="loginPublished" v-if="isLogin">
  55. <div class="messagesList" v-for="(messItem,messIndex) in messageList" :key="messIndex">
  56. <!-- 留言信息-->
  57. <div style="margin-top: 20px;">
  58. <div class="messName">
  59. <div class="messUnit">
  60. <div class="messPhoto">
  61. <img :src="'./api/file/pub/' + messItem.imagesPath" alt="" style="width: 100%;height: 100%">
  62. </div>
  63. <div style="float: left;margin-right: 20px;">
  64. {{ messItem.senderName }}
  65. <span style="color: #666" v-if="messItem.userUsertype == '会员用户'">【{{ $i18n.locale == 'zh' ? 'VIP会员' : 'VIP member' }} 】</span>
  66. </div>
  67. <div style="float: right;color: #ccc">
  68. <span>{{ $t('common.MessageTime') }} : </span>
  69. <span>{{ formatDate(messItem.createDate) }}</span>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="messContent" v-html="messItem.content"></div>
  74. </div>
  75. <!--回复信息-->
  76. <div class="replyMessage" v-if="messItem.interactiveMessageWeatherInfo">
  77. <div class="messName">
  78. <div class="messUnit">
  79. <div class="messPhoto">
  80. <img :src="'./api/file/pub/' + messItem.interactiveMessageWeatherInfo.imagesPath" alt="" style="width: 100%;height: 100%">
  81. </div>
  82. <div style="float: left;margin-right: 20px;">
  83. {{ messItem.interactiveMessageWeatherInfo.senderName }}
  84. </div>
  85. <div style="float: right;color: #ccc">
  86. <span>{{ $t('common.ReplyTime') }} : </span>
  87. <span>{{ formatDate(messItem.interactiveMessageWeatherInfo.createDate) }}</span>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="messContent" v-html="messItem.interactiveMessageWeatherInfo.content"></div>
  92. </div>
  93. </div>
  94. <!-- 分页 -->
  95. <div style="width: 100%;height: 80px;text-align: center;margin-top: 20px;" v-if="messageTotal > 0">
  96. <el-pagination
  97. class="pagination"
  98. background
  99. layout="prev, pager, next"
  100. :total="messageTotal"
  101. @current-change="handleCurrentChange"
  102. :page-size=5>
  103. </el-pagination>
  104. </div>
  105. <!--留言框-->
  106. <div class="messOutBox">
  107. <el-input
  108. v-model="input1"
  109. type="textarea"
  110. maxlength="1000"
  111. show-word-limit
  112. :autosize="{ minRows: 2, maxRows: 5}"
  113. :placeholder="$t('common.SaySomething')"
  114. class="setMessage">
  115. </el-input>
  116. <div class="subBox" style="">
  117. <div class="userName">
  118. <div class="messPhoto" style="margin: 5px 10px 0 10px;">
  119. <img :src="'./api/file/pub/' + user.umsUser.userPic" alt="" style="width: 100%;height: 100%">
  120. </div>
  121. <span>{{ user.umsUser.userName }}</span>
  122. <div style="clear: both"></div>
  123. </div>
  124. <el-button type="primary" class="messBtn" @click="submit"> {{ $t('common.release') }}</el-button>
  125. <div style="clear: both"></div>
  126. </div>
  127. </div>
  128. <div style="color: #67c23a;margin-top: 10px;">
  129. {{ $i18n.locale == 'zh' ? '提示:您的留言需要平台工作人员审核后才可以对外展示,请耐心等待。' : 'Tips:Your message needs to be reviewed by the platform staff before it can be displayed. Please wait patiently.' }}
  130. </div>
  131. </div>
  132. <!-- 未登录-->
  133. <div class="loginPublished" v-else>
  134. <el-input v-model="input2" :placeholder="$t('common.SaySomething')" :disabled="true" class="messInput"></el-input>
  135. <el-button type="primary" class="messBtn" @click="confLogin(2)">{{ $t('common.LoginAndRelease') }}</el-button>
  136. <div style="clear: both"></div>
  137. </div>
  138. </div>
  139. </div>
  140. <!--碳中和相关资讯-->
  141. <div class="rightBox">
  142. <div class="informationTitle informationTitleAfter">
  143. <img src="@/assets/img/cooperationExchange/20200608_03.gif" alt="" style="height: 20px;vertical-align: middle;">
  144. {{ $t('common.InformationOnCarbon') }}
  145. </div>
  146. <div >
  147. <ul>
  148. <li v-for="(item,index) in articleInfo" class="infoList" @click="toView('realTimeInfoItemdetails',item.baseEntityId)">
  149. {{ item.title }}
  150. </li>
  151. </ul>
  152. </div>
  153. </div>
  154. <div style="clear: both"></div>
  155. </div>
  156. <!-- 登录提示-->
  157. <el-dialog
  158. :title="$i18n.locale=='zh'?'提示':'Reminder'"
  159. :visible.sync="toViewLogin"
  160. :width="$i18n.locale=='zh'?'500px':'750px'"
  161. :height="$i18n.locale=='zh'?'300px':'386px'"
  162. :before-close="toViewLoginChange">
  163. <div style="width: 100%;height: 100%;">
  164. <img src="@/assets/img/loginTips.png" alt="" style="width: 180px;height: 180px;margin-left: 20px;">
  165. <div style="float: right;margin-right: 20px;" :style="$i18n.locale=='zh'?'width: 49%;margin-top: 10px;':'width: 453px;margin-top: -25px;'">
  166. <div style="font-size: 20px;font-weight: normal;color: #333333;
  167. font-family: HiraginoSansGB-W3, HiraginoSansGB;
  168. line-height: 40px;">
  169. {{ $t('common.ReminderFirst') }}
  170. </div>
  171. <div style="font-size: 16px;font-family: HiraginoSansGB-W3, HiraginoSansGB;
  172. font-weight: normal;color: #666666;line-height: 30px;">
  173. {{ $t('common.ReminderSecond') }} <span style="color: #0091FF;font-size: 18px;">{{ num }}</span> {{ $t('common.ReminderThird') }}
  174. </div>
  175. <div style="font-size: 14px;font-family: HiraginoSansGB-W3, HiraginoSansGB;font-weight: normal;color: #666666;line-height: 30px;">
  176. {{ $t('common.ReminderForth') }}
  177. </div>
  178. <div style="font-size: 14px;font-family: HiraginoSansGB-W3, HiraginoSansGB;height:33px;line-height:60px;font-weight: normal;color: #0091FF;">
  179. <span style="margin-left: 40px;" class="cursor" @click="toView('login')">
  180. {{ $t('common.ReminderFifth') }}
  181. </span>
  182. <span style="margin-left: 10px;" class="cursor" @click="toView('Register')">
  183. {{ $t('common.ReminderSixth') }}
  184. </span>
  185. </div>
  186. </div>
  187. </div>
  188. </el-dialog>
  189. </div>
  190. </template>
  191. <script>
  192. import {weatherArticleDetail} from '@/api/cms/cmsInformationEntity';
  193. import {weatherArticle} from '@/api/cms/cmsInformationEntity';
  194. import {addCollectInfo} from "@/api/baseUnitView";
  195. import {getPortalMyCollectModelByResearch} from "@/api/operation/basePortalModelFollowInfo";
  196. import {getInteractiveMessageWeatherInfosList, saveInteractiveMessage} from '@/api/operation/interactiveMessageWeatherInfo';
  197. import {getToken, resetToken} from "@/utils/auth";
  198. import Base from "@/views/base/Base";
  199. import {carbonNeutralList} from "@/api/financialService/cmsInformationViews";
  200. export default {
  201. name: 'ThinkTankArticleDetail',
  202. extends: Base,
  203. data() {
  204. return {
  205. ifcommon: false,
  206. messageNum: 0,
  207. isLogin: false,
  208. input1: '',
  209. input2: '',
  210. toViewLogin: false,
  211. num: 5,
  212. articleDetail: {},
  213. articleInfo: [],
  214. messageList: [],
  215. user: {},
  216. userName: '',
  217. aaaaa: {},
  218. params: {},
  219. interactiveMessageWeatherInfo: {
  220. content: '',
  221. replyStatus: '否',
  222. replyStatusDict: 'N',
  223. bizObjectType: '0',
  224. approveStatusDict: '0',
  225. columnCode: this.$route.query.key,
  226. userUsertype: ''
  227. },
  228. messageTotal: '',
  229. }
  230. },
  231. watch: {
  232. '$i18n.locale'() {
  233. this.getetails()
  234. this.getInfomationList()
  235. this.getMyCollect()
  236. },
  237. "toViewLogin"() {
  238. if (this.toViewLogin == true) {
  239. this.loginTipsChange()
  240. }
  241. }
  242. },
  243. mounted() {
  244. this.confLogin('1')
  245. this.getInfomationList();
  246. this.getetails();
  247. },
  248. methods: {
  249. /*
  250. * 登录相关方法
  251. * */
  252. loginTipsChange() {
  253. const that = this;
  254. this.num = 5;
  255. this.timer = setInterval(function () {
  256. if (that.num > 0) {
  257. that.num--;
  258. } else {
  259. if (that.toViewLogin == true) {
  260. clearInterval(that.timer);
  261. that.toView('login');
  262. } else {
  263. clearInterval(that.timer);
  264. }
  265. }
  266. }, 1000)
  267. },
  268. confLogin(i) {
  269. if (!this.$Cookies.get('token')) {
  270. this.isLogin = false;
  271. if (i == '2') {
  272. this.toViewLogin = true;
  273. }
  274. } else {
  275. this.isLogin = true;
  276. this.getMessage()
  277. }
  278. },
  279. // 判断未登录跳转是否关闭
  280. toViewLoginChange(done) {
  281. this.toViewLogin = false;
  282. this.num = 5;
  283. clearInterval(this.timer);
  284. },
  285. //跳转
  286. toView(router, json) {
  287. if (router == 'ThinkTankArticleDetail') {
  288. window.localStorage.setItem('router', router);
  289. const {href} = this.$router.resolve({
  290. name: router,
  291. query: {
  292. key: json
  293. }
  294. });
  295. window.open(href, '_blank');
  296. } else {
  297. clearInterval(this.timer);
  298. this.$router.push({
  299. name: router,
  300. query: {
  301. key: json,
  302. }
  303. });
  304. }
  305. },
  306. //获取收藏初始状态
  307. getMyCollect() {
  308. const that = this;
  309. if (this.$Cookies.get('token')) {
  310. let user = window.localStorage.getItem('user');
  311. var users = JSON.parse(user);
  312. var modelType = 'message';
  313. var userId = users.userId;
  314. var modelId = that.articleDetail.baseEntityId;
  315. getPortalMyCollectModelByResearch(modelId, modelType, userId).then(res => {
  316. that.ifcommon = res.data.result;
  317. })
  318. }
  319. },
  320. //点击收藏按钮
  321. shareChange() {
  322. if (!this.ifcommon) {
  323. this.Collection("collect");
  324. } else {
  325. this.Collection("uncollect");
  326. }
  327. },
  328. //收藏
  329. Collection(stasus) {
  330. let user = window.localStorage.getItem("user");
  331. if (!this.$Cookies.get('token')) {
  332. this.toViewLogin = true
  333. } else {
  334. let users = JSON.parse(user);
  335. let token = "" + getToken();
  336. // this.userId = users.userId;
  337. let modeId = this.articleDetail.baseEntityId;
  338. this.submitHandler((token) => {
  339. addCollectInfo(modeId, "message", users.userId, stasus, token).then((res) => {
  340. if (res.status == 200) {
  341. if (!this.ifcommon) {
  342. this.$message({
  343. message: this.$i18n.locale == 'zh' ? "已收藏" : "Liked of success",
  344. type: 'success'
  345. });
  346. } else if (this.ifcommon) {
  347. this.$message({
  348. message: this.$i18n.locale == 'zh' ? "取消收藏" : "Cancel the like",
  349. type: 'success'
  350. });
  351. }
  352. }
  353. this.ifcommon = !this.ifcommon;
  354. this.resetToken();
  355. }).catch(error => {
  356. this.resetToken();
  357. });
  358. })
  359. }
  360. },
  361. //获取碳中和资讯列表信息
  362. getInfomationList() {
  363. /* let params = {
  364. language: this.$i18n.locale.toUpperCase(),
  365. pageNo: '1',
  366. pageSize: '10'
  367. }
  368. weatherArticle(params).then((res) => {
  369. let result = res.data
  370. if (result) {
  371. this.articleInfo = result.weatherArticle
  372. }
  373. })*/
  374. const that = this;
  375. let hotList = {
  376. pageSize: 5,
  377. pageNo: 1,
  378. language: ''
  379. }
  380. hotList.language = this.$i18n.locale.toUpperCase();
  381. carbonNeutralList(hotList).then((res) => {
  382. if (res.data.length > 0) {
  383. this.articleInfo = res.data;
  384. } else {
  385. hotList.pageNo = 1;
  386. this.getHotFocus();
  387. }
  388. });
  389. },
  390. //获取详情内容
  391. getetails() {
  392. let prams = {
  393. language: this.$i18n.locale.toUpperCase(),
  394. id: this.$route.query.key,
  395. pageNo: '1',
  396. pageSize: '1'
  397. }
  398. this.params = prams
  399. weatherArticleDetail(prams).then((res) => {
  400. if (res.data.weatherArticleDetail) {
  401. this.articleDetail = res.data.weatherArticleDetail[0];
  402. this.getMyCollect();
  403. } else {
  404. this.$message.warning(this.$i18n.locale == 'zh' ? "暂无此版本" : "This version is not available yet");
  405. }
  406. })
  407. },
  408. //获取留言内容
  409. getMessage(page) {
  410. let user = window.localStorage.getItem("user");
  411. this.user = JSON.parse(user)
  412. let params = {
  413. columnCode: this.$route.query.key,
  414. pageSize: 5,
  415. bizObjectType: 0,
  416. approveStatusDict: 2,
  417. pageNo: page || 1
  418. }
  419. getInteractiveMessageWeatherInfosList(params).then((res) => {
  420. if (res) {
  421. this.messageList = res.data.interactiveMessageWeatherInfos || []
  422. this.messageNum = this.messageList.length || 0;
  423. this.messageTotal = Number(res.data.page.totalCount)
  424. }
  425. })
  426. },
  427. //提交留言
  428. submit() {
  429. if (!this.input1) {
  430. this.$message({
  431. message: this.$i18n.locale == "en" ? 'Please enter the message content and publish it' : '请输入留言内容后发布',
  432. type: 'info',
  433. });
  434. return
  435. } else {
  436. let user = JSON.parse(window.localStorage.getItem("user"));
  437. this.interactiveMessageWeatherInfo.content = this.input1;
  438. this.interactiveMessageWeatherInfo.userUsertype = user.umsUser.userUsertype;
  439. console.log('this.interactiveMessageWeatherInfo', this.interactiveMessageWeatherInfo)
  440. let token = getToken();
  441. this.submitHandler((token) => {
  442. saveInteractiveMessage(JSON.stringify(this.interactiveMessageWeatherInfo), token).then((res) => {
  443. if (res && res.status == "200") {
  444. this.$message({
  445. message: this.$i18n.locale == "en" ? 'Message success, please wait for the platform staff reply' : '留言成功,请等待平台工作人员回复',
  446. type: 'success',
  447. });
  448. }
  449. this.input1 = ""
  450. this.resetToken();
  451. this.getMessage()
  452. }).catch(error => {
  453. this.resetToken();
  454. closeLoading();
  455. });
  456. })
  457. }
  458. },
  459. handleCurrentChange(val) {
  460. console.log(`当前页: ${val}`);
  461. this.getMessage(val)
  462. },
  463. }
  464. }
  465. </script>
  466. <style scoped>
  467. .box {
  468. margin-top: 10px;
  469. background: #fff;
  470. /* height: 500px; */
  471. padding: 20px 0;
  472. }
  473. .autoBox {
  474. }
  475. .leftBox {
  476. width: 70%;
  477. float: left;
  478. }
  479. .title {
  480. line-height: 50px;
  481. font-size: 28px;
  482. color: #666;
  483. font-weight: 700;
  484. text-align: center;
  485. }
  486. .detailTip {
  487. width: 84px;
  488. height: 24px;
  489. border-radius: 15px;
  490. background: #c9f1fb;
  491. display: inline-block;
  492. margin: 10px 10px;
  493. color: #666;
  494. text-align: center;
  495. line-height: 24px;
  496. font-size: 14px;
  497. }
  498. .time {
  499. margin: 10px 0;
  500. font-size: 16px;
  501. color: #666;
  502. line-height: 35px;
  503. height: 40px;
  504. border-bottom: 1px solid #000;
  505. }
  506. .rightBox {
  507. width: 28%;
  508. float: right;
  509. }
  510. .informationTitle {
  511. border-bottom: 1px solid #2C558A;
  512. padding: 0 0 10px 0;
  513. font-weight: 600;
  514. font-size: 20px;
  515. opacity: 0.9;
  516. }
  517. .informationTitleAfter {
  518. position: relative;
  519. }
  520. .infoList {
  521. margin: 10px 0;
  522. line-height: 25px;
  523. font-size: 15px;
  524. cursor: pointer;
  525. overflow: hidden;
  526. white-space: nowrap;
  527. text-overflow: ellipsis;
  528. }
  529. ul {
  530. list-style: inside disc;
  531. }
  532. .messageBox {
  533. margin: 50px 0;
  534. }
  535. .messageTitle {
  536. line-height: 30px;
  537. border-bottom: 1px solid #ccc;
  538. }
  539. .squireBox {
  540. width: 4px;
  541. height: 16px;
  542. background: #e2cc1e;
  543. display: inline-block;
  544. margin: 0 10px 0 0;
  545. }
  546. .titleSty {
  547. display: inline-block;
  548. }
  549. .loginPublished {
  550. width: 100%;
  551. margin-top: 50px;
  552. }
  553. .messInput {
  554. width: 85%;
  555. display: inline-block;
  556. }
  557. .messBtn {
  558. width: 15%;
  559. float: right;
  560. background: #0e4892;
  561. border-radius: unset;
  562. padding: 0 5px;
  563. height: 40px;
  564. }
  565. .subBox {
  566. width: 100%;
  567. height: 40px;
  568. background: #f5f5f5;
  569. }
  570. .messPhoto {
  571. width: 25px;
  572. height: 25px;
  573. box-sizing: border-box;
  574. float: left;
  575. margin-right: 10px;
  576. }
  577. .messUnit {
  578. width: 100%;
  579. color: #0e4891;
  580. font-size: 16px;
  581. display: inline-block;
  582. }
  583. .messContent {
  584. margin: 20px 0;
  585. line-height: 15px;
  586. color: #666;
  587. }
  588. .userName {
  589. float: left;
  590. line-height: 40px;
  591. }
  592. .messOutBox {
  593. border: 1px solid #DCDFE6;
  594. margin-top: 20px;
  595. }
  596. .setMessage {
  597. border-radius: unset
  598. }
  599. /deep/ .setMessage .el-textarea__inner {
  600. resize: none;
  601. border: none;
  602. }
  603. .articleContent {
  604. width: 100%;
  605. line-height: 40px;
  606. }
  607. /deep/ .articleContent p img {
  608. width: 100%;
  609. }
  610. .messagesList {
  611. border-bottom: 1px solid #ccc;
  612. }
  613. </style>