countryDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <template>
  2. <view class="rf-category">
  3. <!--<u-navbar :back-text="i18n('Back')" :back-text-style="backStyle"
  4. back-icon-color="#fff" title-color="#fff"
  5. :title="i18n('CountryDetails')"
  6. :background="background">
  7. </u-navbar>-->
  8. <u-navbar :is-back="true" :back-icon-color="'#fff'" :background="{'background':'#1777FE'}" :border-bottom="true"
  9. :back-text="$t('common.Back')" :title-color="'#fff'" :back-text-style="{color:'#fff'}">
  10. <view slot="right" style="margin-right:20upx">
  11. <u-icon name="share-fill" style="margin-right: 30upx;" color="white" size="50" @click="share"></u-icon>
  12. <u-icon name="heart-fill" color="#fff" size="36" @click="saveFollowModel(followed)"
  13. v-if="this.followed"></u-icon>
  14. <u-icon name="heart" color="#fff" size="36" @click="saveFollowModel(followed)" v-if="!this.followed">
  15. </u-icon>
  16. </view>
  17. </u-navbar>
  18. <view class="uni-margin-wrap">
  19. <swiper class="swiper" circular :indicator-dots="true" indicator-active-color="#333" :autoplay="false"
  20. :interval="2000" :duration="500">
  21. <swiper-item v-for="(item,index) in photos" :key="index">
  22. <navigator>
  23. <image class="swiper-img" :src="websiteUrl+item"></image>
  24. </navigator>
  25. </swiper-item>
  26. </swiper>
  27. </view>
  28. <view style="margin-left: 10px;">
  29. <view style="font-weight: bold;">{{countryInfo.zhName}}</view>
  30. <view style="margin-top: 10px;">{{$t('common.EnglishName') }}:{{countryInfo.enName}}</view>
  31. <view style="margin-top: 10px;">{{$t('common.State') }}:{{areMap[countryInfo.areDict]}}</view>
  32. <view style="margin-top: 10px;">{{$t('common.Basicsituation') }}:</view>
  33. <view>{{countryInfo.basicProfile}}</view>
  34. </view>
  35. <view style="margin-top: 10px;">
  36. <scroll-view scroll-x class="index-cate">
  37. <view style="display: inline-block;width: 100%;" :style="$i18n.locale=='en'?
  38. 'display: flex;justify-content: space-between;':''">
  39. <view class="index-cate-item2" :style="$i18n.locale=='zh'?
  40. 'width:30%;':''" style="color: #000;" :class="tabCurrentIndex === 1 ? `text-${themeColor.name} active` : ''"
  41. @tap.stop="tabClick(1)">
  42. {{$t('common.Resources') }}
  43. </view>
  44. <view :style="$i18n.locale=='zh'?
  45. 'width:30%;':''" class="index-cate-item2" style="color: #000;"
  46. :class="tabCurrentIndex === 2 ? `text-${themeColor.name} active` : ''" @tap.stop="tabClick(2)">
  47. {{ $t('common.EnergyDevelopmentPlanning') }}
  48. </view>
  49. <view :style="$i18n.locale=='zh'?
  50. 'width:30%;':''" class="index-cate-item2" style="color: #000;"
  51. :class="tabCurrentIndex === 3 ? `text-${themeColor.name} active` : ''" @tap.stop="tabClick(3)">
  52. {{ $t('common.ProjectDevelopmentGuide') }}
  53. </view>
  54. <view :style="$i18n.locale=='zh'?
  55. 'width:30%;':''" class="index-cate-item2" style="color: #000;"
  56. :class="tabCurrentIndex === 4 ? `text-${themeColor.name} active` : ''" @tap.stop="tabClick(4)">
  57. {{ $t('common.LawsRegulations') }}
  58. </view>
  59. </view>
  60. </scroll-view>
  61. <view v-if="tabCurrentIndex==1" style="margin-left: 10px;margin-top: 10px;">
  62. <view v-html="info1.contentHtml"></view>
  63. <view v-if="info1.contentHtml == '' || info1.contentHtml == null " style="text-align: center">{{$t('common.Nodataavailable')}}</view>
  64. </view>
  65. <view v-if="tabCurrentIndex==2 && isLogin" style="margin-left: 10px;margin-top: 10px;">
  66. <view v-html="info2.contentHtml"></view>
  67. <view v-if="info2.contentHtml == '' || info2.contentHtml == null " style="text-align: center">{{$t('common.Nodataavailable')}}</view>
  68. </view>
  69. <view v-if="tabCurrentIndex==3 && isLogin" style="margin-left: 10px;margin-top: 10px;">
  70. <view v-html="info3.contentHtml"></view>
  71. <view v-if="info3.contentHtml == '' || info3.contentHtml == null " style="text-align: center">{{$t('common.Nodataavailable')}}</view>
  72. </view>
  73. <view v-if="tabCurrentIndex==4 && isLogin" style="margin-left: 10px;margin-top: 10px;">
  74. <view v-html="info4.contentHtml"></view>
  75. <Regulations :pdfUrl="pdfUrl" :baseEntityId="baseEntityId"></Regulations>
  76. </view>
  77. </view>
  78. <!-- 8.8.20.112:19001
  79. -->
  80. <share v-show="ifShare == true" :show="ifShare" @closeShare="share"
  81. :title="i18n('Country') + '->' + i18n('CountryInformation')" :summary="$i18n.locale=='zh'? countryInfo.zhName : countryInfo.enName "
  82. :href="'https://m.geidcp.com/#/pages/country/countryList/countryDetail?' + 'baseEntityId=' + baseEntityId + '&language=' + $i18n.locale"
  83. :imageUrl="photos && photos[0]?websiteUrl+ photos[0] + '?custom=370_220':
  84. 'https://geidcp.com/api/file/pub/defaultCutPic/shareLogo.png'">
  85. </share>
  86. <!-- #ifdef H5 -->
  87. <rf-back-home></rf-back-home>
  88. <!-- #endif -->
  89. <u-toast ref="uToast" />
  90. </view>
  91. </template>
  92. <script>
  93. import {
  94. addIntegral
  95. } from '@/components/addPointDetailByTaskDict.js'
  96. import UNavbar from '@/components/uni-nav-bar/uni-nav-bar.vue'
  97. import mSearch from '@/components/rf-search/rf-search';
  98. import newsItem from '@/pages/information/news-item'
  99. import share from '@/components/share'
  100. import Regulations from './regulations'
  101. export default {
  102. data() {
  103. return {
  104. tabCurrentIndex: 1,
  105. baseEntityId: '',
  106. countryInfo: Object,
  107. photos: [],
  108. info1: Object,
  109. info2: Object,
  110. info3: Object,
  111. info4: Object,
  112. areDict: [],
  113. ifShare: false,
  114. background: {
  115. backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
  116. },
  117. backStyle: {
  118. color: '#fff'
  119. },
  120. followed: '',
  121. modelType: 'country',
  122. pdfUrl: '',
  123. // token:'',
  124. isLogin: false,
  125. }
  126. },
  127. components: {
  128. UNavbar,
  129. mSearch,
  130. newsItem,
  131. share,
  132. Regulations,
  133. addIntegral
  134. },
  135. computed: {
  136. areMap() {
  137. let obj = {
  138. }
  139. this.areDict.forEach(item => {
  140. obj[item.value] = item.label
  141. })
  142. return obj;
  143. }
  144. },
  145. onLoad(option) {
  146. this.baseEntityId = option.baseEntityId;
  147. if (option.language) {
  148. uni.setStorageSync("language", option.language);
  149. this._i18n.locale = option.language;
  150. }
  151. },
  152. onReady() {
  153. this.token = uni.getStorageSync('Auth-Token') ? ('Bearer ' + uni.getStorageSync('Auth-Token')) : '';
  154. console.log('this.token')
  155. console.log(this.token)
  156. this.userId = uni.getStorageSync('user') ? (JSON.parse(uni.getStorageSync('user')).id) : '';
  157. this.cofLogin();
  158. this.getCountryInfo()
  159. this.tab1()
  160. this.tab2()
  161. this.tab3()
  162. this.tab4()
  163. this.dict()
  164. this.getFollowModelStatusByModelIdAndUserId()
  165. },
  166. methods: {
  167. // //判断登录
  168. cofLogin() {
  169. if (this.token == '' && uni.getStorageSync('user') == '') {
  170. this.isLogin = false;
  171. } else {
  172. this.isLogin = true;
  173. }
  174. },
  175. //跳转链接
  176. navTo(route) {
  177. if (this.$i18n.locale == 'zh') {
  178. this.$refs.uToast.show({
  179. title: '请登录',
  180. type: 'warning',
  181. url: '/pages/public/login',
  182. duration: 800,
  183. params: {
  184. back: 1
  185. }
  186. })
  187. } else {
  188. this.$refs.uToast.show({
  189. title: 'please log in',
  190. type: 'warning',
  191. url: '/pages/public/login',
  192. duration: 800,
  193. params: {
  194. back: 1
  195. }
  196. })
  197. }
  198. },
  199. share() {
  200. this.ifShare = !this.ifShare;
  201. },
  202. i18n(data) {
  203. return this.$t('common.' + data);
  204. },
  205. tabClick(index) {
  206. this.tabCurrentIndex = index;
  207. if (index != 1) {
  208. if (this.token == '' && uni.getStorageSync('user') == '') {
  209. this.isLogin = false;
  210. this.toLogin()
  211. }else {
  212. this.isLogin = true;
  213. }
  214. }
  215. },
  216. //登录跳转
  217. toLogin() {
  218. if (this.$i18n.locale == 'zh') {
  219. this.$refs.uToast.show({
  220. title: '请登录',
  221. type: 'warning',
  222. url: '/pages/public/login',
  223. duration: 800,
  224. params: {
  225. back: 1
  226. }
  227. })
  228. } else {
  229. this.$refs.uToast.show({
  230. title: 'please log in',
  231. type: 'warning',
  232. url: '/pages/public/login',
  233. duration: 800,
  234. params: {
  235. back: 1
  236. }
  237. })
  238. }
  239. },
  240. async getCountryInfo(baseEntityId) {
  241. const res = await this.$myRequest({
  242. url: '/project/baseCountryViews/',
  243. data: {
  244. baseEntityId: this.baseEntityId,
  245. language: this.$i18n.locale.toUpperCase()
  246. }
  247. });
  248. this.id = res.baseEntityId;
  249. if (res.data) {
  250. this.countryInfo = res.data.baseCountryViews[0];
  251. this.photos = this.countryInfo.photo.split(",")
  252. }
  253. },
  254. async tab1(baseEntityId) {
  255. const res = await this.$myRequest({
  256. url: '/cms/cmsInformationViews/getInformationList/',
  257. data: {
  258. pageSize: 5,
  259. pageNo: 1,
  260. businessType: 'countryShow',
  261. businessId: this.baseEntityId,
  262. typeDict: 2,
  263. language: this.$i18n.locale.toUpperCase()
  264. }
  265. });
  266. if (res.data.allDataList.length != 0) {
  267. this.info1 = res.data.allDataList[0];
  268. }
  269. },
  270. async tab2(baseEntityId) {
  271. const res = await this.$myRequest({
  272. url: '/cms/cmsInformationViews/getInformationList/',
  273. data: {
  274. pageSize: 5,
  275. pageNo: 1,
  276. businessType: 'countryShow',
  277. businessId: this.baseEntityId,
  278. typeDict: 3,
  279. language: this.$i18n.locale.toUpperCase()
  280. }
  281. });
  282. if (res.data.allDataList.length != 0) {
  283. this.info2 = res.data.allDataList[0];
  284. }
  285. },
  286. async tab3(baseEntityId) {
  287. const res = await this.$myRequest({
  288. url: '/cms/cmsInformationViews/getInformationList/',
  289. data: {
  290. pageSize: 5,
  291. pageNo: 1,
  292. businessType: 'countryShow',
  293. businessId: this.baseEntityId,
  294. typeDict: 5,
  295. language: this.$i18n.locale.toUpperCase()
  296. }
  297. });
  298. if (res.data.allDataList.length != 0) {
  299. this.info3 = res.data.allDataList[0];
  300. }
  301. },
  302. async tab4(baseEntityId) {
  303. const res = await this.$myRequest({
  304. url: '/cms/cmsInformationViews/getInformationList/',
  305. data: {
  306. pageSize: 5,
  307. pageNo: 1,
  308. businessType: 'countryShow',
  309. businessId: this.baseEntityId,
  310. typeDict: 8,
  311. language: this.$i18n.locale.toUpperCase()
  312. }
  313. });
  314. if (res.data.allDataList.length != 0) {
  315. this.info4 = res.data ? res.data.allDataList[0] : [];
  316. this.pdfUrl = this.info4?.pdfPath ? 'api/file/pub/' + this.info4?.pdfPath : '';
  317. }
  318. },
  319. async dict() {
  320. const res = await this.$myRequest({
  321. url: '/sys/sysDicts',
  322. data: {
  323. type: this.$i18n.locale == 'en' ? "CONTINENT_CODE_DICT_EN" : "CONTINENT_CODE_DICT"
  324. }
  325. });
  326. if (res.data) {
  327. this.areDict = res.data[0]
  328. }
  329. },
  330. // 是否被关注
  331. async getFollowModelStatusByModelIdAndUserId() {
  332. let res = await this.$myRequest({
  333. url: '/op/basePortalModelFollowInfos/followModelStatusByModelIdAndUserId',
  334. data: {
  335. modelId: this.baseEntityId,
  336. modelType: this.modelType,
  337. userId: this.userId
  338. }
  339. })
  340. this.followed = res.data;
  341. },
  342. // 关注或取消关注
  343. async saveFollowModel(flag) {
  344. if (this.token.length <= 7) {
  345. uni.navigateTo({
  346. url: '/pages/public/login?back=1'
  347. })
  348. } else {
  349. let [type, msg, followfailmsg] = [];
  350. if (!flag) {
  351. type = "follow";
  352. addIntegral('point_task_attention', '1')
  353. msg = this.$i18n.locale == 'zh' ? '关注成功' : 'fowllow success'
  354. followfailmsg = this.$i18n.locale == 'zh' ? '关注失败' : 'fowllow fail'
  355. } else {
  356. type = "unfollow"
  357. msg = this.$i18n.locale == 'zh' ? '取消关注成功' : 'cancel fowllow success'
  358. followfailmsg = this.$i18n.locale == 'zh' ? '取消关注失败' : 'cnacel fowllow fail'
  359. }
  360. let res = await this.$myRequest({
  361. url: '/op/basePortalModelFollowInfos/followModel',
  362. method: 'post',
  363. headers: {
  364. token: this.token
  365. },
  366. data: {
  367. modelId: this.baseEntityId,
  368. modelType: this.modelType,
  369. userId: this.userId,
  370. followType: type,
  371. }
  372. })
  373. if (!flag) {
  374. if (res.status == '200' && res.msg == 'ok') {
  375. this.$refs.uToast.show({
  376. title: msg,
  377. type: 'success'
  378. })
  379. this.followed = !this.followed;
  380. } else this.$refs.uToast.show({
  381. title: followfailmsg,
  382. type: 'error'
  383. })
  384. } else {
  385. if (res.status == '200' && res.msg == 'ok') {
  386. this.$refs.uToast.show({
  387. title: msg,
  388. type: 'success'
  389. })
  390. this.followed = !this.followed;
  391. } else this.$refs.uToast.show({
  392. title: followfailmsg,
  393. type: 'error'
  394. })
  395. }
  396. }
  397. },
  398. }
  399. }
  400. </script>
  401. <style lang="scss" scoped>
  402. .rf-category {
  403. background-color: $color-white;
  404. }
  405. .recommend-bottom {
  406. float: right;
  407. height: 200upx;
  408. width: 488upx;
  409. }
  410. .index-cate .index-cate-item2 {
  411. display: inline-block;
  412. height: 75upx;
  413. line-height: 75upx;
  414. margin: 0 15upx 10upx;
  415. text-align: center;
  416. font-size: $font-base;
  417. color: $color-white;
  418. }
  419. .infoList {
  420. padding-top: 20upx;
  421. display: flex;
  422. flex-direction: initial;
  423. justify-content: space-between;
  424. }
  425. .leftImg {
  426. width: 185upx;
  427. height: 140upx;
  428. }
  429. .img {
  430. width: 100%;
  431. height: 100%;
  432. }
  433. .rightCont {
  434. width: 460upx;
  435. padding-bottom: 20upx;
  436. border-bottom: 1px solid #F1F1F1;
  437. }
  438. .title {
  439. color: #333333;
  440. font-size: 32upx;
  441. font-weight: 700;
  442. overflow: hidden;
  443. text-overflow: ellipsis;
  444. display: -webkit-box;
  445. -webkit-line-clamp: 2;
  446. -webkit-box-orient: vertical;
  447. }
  448. .title-base {
  449. font-size: 24upx;
  450. color: #999999;
  451. margin-top: 10upx;
  452. display: flex;
  453. flex-direction: initial;
  454. }
  455. .time {
  456. margin-left: 30upx;
  457. }
  458. .info-cont {
  459. margin-top: 10upx;
  460. font-size: 28upx;
  461. overflow: hidden;
  462. text-overflow: ellipsis;
  463. display: -webkit-box;
  464. -webkit-line-clamp: 2;
  465. -webkit-box-orient: vertical;
  466. }
  467. .view {
  468. flex-direction: column;
  469. }
  470. .flex-row {
  471. flex-direction: row;
  472. }
  473. .flex-col {
  474. flex-direction: column;
  475. }
  476. .list-cell {
  477. padding: 0 15px;
  478. }
  479. .uni-list-cell-hover {
  480. background-color: #eeeeee;
  481. }
  482. .media-item {
  483. position: relative;
  484. flex: 1;
  485. flex-direction: column;
  486. padding: 0 30upx;
  487. }
  488. .media-item-line {
  489. position: absolute;
  490. left: 15px;
  491. right: 15px;
  492. bottom: 0;
  493. height: 1px;
  494. background-color: #ebebeb;
  495. }
  496. .media-image-right {
  497. flex-direction: row;
  498. }
  499. .media-image-left {
  500. flex-direction: row-reverse;
  501. }
  502. .media-title {
  503. flex: 1;
  504. }
  505. .media-title {
  506. lines: 3;
  507. text-overflow: ellipsis;
  508. font-size: 15px;
  509. color: #555555;
  510. }
  511. .media-title2 {
  512. flex: 1;
  513. margin-top: 3px;
  514. line-height: 20px;
  515. }
  516. .image-section {
  517. margin-top: 10px;
  518. flex-direction: row;
  519. justify-content: space-between;
  520. }
  521. .image-section-right {
  522. margin-top: 0;
  523. margin-left: 5px;
  524. width: 112px;
  525. height: 73px;
  526. }
  527. .image-section-left {
  528. margin-top: 0;
  529. margin-right: 5px;
  530. width: 112px;
  531. height: 73px;
  532. }
  533. .image-list1 {
  534. height: 240px;
  535. }
  536. .image-list2 {
  537. width: 112px;
  538. height: 73px;
  539. }
  540. .image-list3 {
  541. width: 112px;
  542. height: 73px;
  543. }
  544. .media-info {
  545. flex-direction: row;
  546. align-items: center;
  547. }
  548. .info-text {
  549. margin-right: 10px;
  550. color: #999999;
  551. font-size: 12px;
  552. }
  553. .media-foot {
  554. margin-top: 12px;
  555. flex-direction: row;
  556. align-items: center;
  557. justify-content: space-between;
  558. }
  559. .close-view {
  560. position: relative;
  561. align-items: center;
  562. flex-direction: row;
  563. width: 20px;
  564. height: 15px;
  565. line-height: 15px;
  566. border-width: 1upx;
  567. border-style: solid;
  568. border-color: #aaaaaa;
  569. border-radius: 4px;
  570. justify-content: center;
  571. text-align: center;
  572. }
  573. .close-l {
  574. position: absolute;
  575. width: 9px;
  576. height: 1px;
  577. background-color: #aaaaaa;
  578. }
  579. .close-h {
  580. transform: rotate(45deg);
  581. }
  582. .close-v {
  583. transform: rotate(-45deg);
  584. }
  585. .uni-margin-wrap {}
  586. .swiper {
  587. width: 100%;
  588. height: 310upx;
  589. }
  590. .swiper-img {
  591. width: 100%;
  592. height: 310upx;
  593. }
  594. .recommend-bottom-name {
  595. font-size: 35upx;
  596. font-family: PingFangSC-Medium, PingFang SC;
  597. font-weight: 500;
  598. color: #0B0B11;
  599. line-height: 65upx;
  600. margin-top: 30upx;
  601. overflow: hidden;
  602. text-overflow: ellipsis;
  603. white-space: nowrap;
  604. }
  605. </style>