enterpriseDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <template>
  2. <view style="margin:0 0px;background-color: #fff;">
  3. <u-toast ref="uToast" />
  4. <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff"
  5. :title="i18n('EnterpriseShow')" :background="background">
  6. <view slot="right" style="margin-right:20upx">
  7. <u-icon name="share-fill" style="margin-right: 30upx;" color="white" size="50" @click="share"></u-icon>
  8. <u-icon name="heart-fill" color="#fff" size="36" @click="follow" v-if="ifcommon"></u-icon>
  9. <u-icon name="heart" color="#fff" size="36" @click="follow" v-if="!ifcommon"></u-icon>
  10. </view>
  11. </u-navbar>
  12. <view style="">
  13. <view class="uni-margin-wrap">
  14. <swiper class="swiper" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
  15. :duration="duration">
  16. <swiper-item v-for="(item,index) in photos" v-if="photos.length>0">
  17. <view class="swiper-item uni-bg-red" style="height: 100%;">
  18. <image style="width: 100%;height: 100%;" class="swiper-img" :src="websiteUrl+item"
  19. v-if="item"></image>
  20. </view>
  21. </swiper-item>
  22. <swiper-item v-if="photos.length<=0">
  23. <view class="swiper-item uni-bg-red" style="height: 100%;">
  24. <image style="width: 100%;height: 100%;" class="swiper-img"
  25. :src="websiteUrl+'/def/projectdefault.png'"></image>
  26. </view>
  27. </swiper-item>
  28. </swiper>
  29. </view>
  30. </view>
  31. <view>
  32. <img :src="websiteUrl+ enterpriseInfo.photo" alt="" v-if="enterpriseInfo.photo"
  33. style="width: 200upx;height: 150upx;">
  34. <img :src="'api/file/pub/'+'/def/projectdefault.png'" alt="" v-else style="width: 200upx;height: 150upx;">
  35. <view class="recommend-bottom">
  36. <text class="recommend-bottom-name">{{enterpriseInfo.unitName}}</text>
  37. <text class="tabs" v-if="enterpriseInfo.recommendFlag=='y'">{{i18n('recommend2')}}</text>
  38. <!-- <view>{{enterpriseInfo.unitCountryDict}} - {{enterpriseInfo.unitRegion}} -->
  39. <view>
  40. <text>
  41. {{$i18n.locale === 'zh'?enterpriseInfo.unitCountry:enterpriseInfo.unitCountryDict.charAt(0).toUpperCase() + enterpriseInfo.unitCountryDict.slice(1)}}
  42. </text>
  43. <text v-show="enterpriseInfo.unitRegion"> - </text>
  44. <text>{{enterpriseInfo.unitRegion}}</text>
  45. </view>
  46. </view>
  47. <view style="font-weight: bold;margin: 20upx 0 0 20upx;">
  48. {{i18n('EnterpriseIntroduction')}}
  49. </view>
  50. <view style="margin: 20upx 20upx 0 20upx;">
  51. {{enterpriseInfo.projectPerformance}}
  52. </view>
  53. <text v-for="(enterpriseInfo,index) in enterpriseInfo.labelList">
  54. <u-tag :text="enterpriseInfo" mode="light" style="margin:10px 15upx 15upx 0upx;" />
  55. </text>
  56. </view>
  57. <scroll-view scroll-x class="index-cate">
  58. <view style="display: inline-block;width: 100%;">
  59. <view class="index-cate-item" style="color: #000;"
  60. :class="tabCurrentIndex === 1 ? `text-${themeColor.name} active` : ''" @tap.stop="tabClick(1)">
  61. {{$t('common.ProductInformation') }}
  62. </view>
  63. <view class="index-cate-item" style="color: #000;"
  64. :class="tabCurrentIndex === 2 ? `text-${themeColor.name} active` : ''" @tap.stop="tabClick(2)">
  65. {{ $t('common.CoreTechnology') }}
  66. </view>
  67. <view class="index-cate-item" style="color: #000;"
  68. :class="tabCurrentIndex === 3 ? `text-${themeColor.name} active` : ''" @tap.stop="tabClick(3)">
  69. {{ $t('common.ProjectPerformance') }}
  70. </view>
  71. <view class="index-cate-item" style="color: #000;"
  72. :class="tabCurrentIndex === 4 ? `text-${themeColor.name} active` : ''" @tap.stop="tabClick(4)">
  73. {{ $t('common.LatestDevelopment') }}
  74. </view>
  75. </view>
  76. </scroll-view>
  77. <view v-if="tabCurrentIndex==1" style="margin-left: 20upx;margin-top: 20upx;">
  78. <view v-if="info1 && info1.length!=0">
  79. <view v-for="(item,index) in info1" :key="index"
  80. @click="navToList('/pages/country/countryList/countryInformationDetails',item.baseEntityId)">
  81. <text class="text-title">{{item.title}}</text>
  82. <text style="float: right;margin-right: 20upx;"
  83. class="title-time">{{formatDate(item.createDate)}}</text>
  84. </view>
  85. </view>
  86. <view v-else>
  87. <text class="text-NoData">{{i18n('Nodataavailable')}}</text>
  88. </view>
  89. </view>
  90. <view v-if="tabCurrentIndex==2" style="margin-left: 10px;margin-top: 10px;">
  91. <view v-if="info2 && info2.length!=0">
  92. <view v-for="(item,index) in info2" :key="index"
  93. @click="navToList('/pages/country/countryList/countryInformationDetails',item.baseEntityId)">
  94. <text class="text-title">{{item.title}}</text>
  95. <text style="float: right;margin-right: 20upx;"
  96. class="title-time">{{formatDate(item.createDate)}}</text>
  97. </view>
  98. </view>
  99. <view v-else>
  100. <text class="text-NoData">{{i18n('Nodataavailable')}}</text>
  101. </view>
  102. </view>
  103. <view v-if="tabCurrentIndex==3" style="margin-left: 10px;margin-top: 10px;">
  104. <view v-if="info3 && info3.length!=0">
  105. <view v-for="(item,index) in info3" :key="index"
  106. @click="navToList('/pages/country/countryList/countryInformationDetails',item.baseEntityId)">
  107. <text class="text-title">{{item.title}}</text>
  108. <text style="float: right;margin-right: 20upx;"
  109. class="title-time">{{formatDate(item.createDate)}}</text>
  110. </view>
  111. </view>
  112. <view v-else>
  113. <text class="text-NoData">{{i18n('Nodataavailable')}}</text>
  114. </view>
  115. </view>
  116. <view v-if="tabCurrentIndex==4" style="margin-left: 10px;margin-top: 10px;">
  117. <!-- <view v-for="(item,index) in newsInfos"
  118. @click="navToList('/pages/country/countryList/countryInformationDetails',item.baseEntityId)">
  119. <view class="media-item view">
  120. <view class="infoList">
  121. <view class="leftImg" v-if="item.pictureUrl">
  122. <image class="img" :src="websiteUrl+item.pictureUrl" mode=""></image>
  123. </view>
  124. <view class="rightCont" :style="{ width: item.pictureUrl?'460upx':'100%' }">
  125. <view class="title">{{ item.title }}</view>
  126. <view class="info-cont">
  127. {{ item.content }}
  128. </view>
  129. <view class="title-base">
  130. <text>{{ item.auther }}</text>
  131. <text class="time">{{ formatDate(item.publishDate) }}</text>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. </view> -->
  137. <view v-if="newsInfos && newsInfos.length!=0">
  138. <view v-for="(item,index) in newsInfos" :key="index"
  139. @click="navToList('/pages/country/countryList/countryInformationDetails',item.baseEntityId)">
  140. <text class="text-title">{{item.title}}</text>
  141. <text style="float: right;margin-right: 20upx;"
  142. class="title-time">{{formatDate(item.createDate)}}</text>
  143. </view>
  144. </view>
  145. <view v-else>
  146. <text class="text-NoData">{{i18n('Nodataavailable')}}</text>
  147. </view>
  148. </view>
  149. <!-- 8.8.20.112:19001 -->
  150. <share v-show="ifShare == true" @closeShare="share" :show="ifShare"
  151. :title="i18n('Enterprise') + '->' + i18n('EnterpriseShow')" :summary="enterpriseInfo.unitName"
  152. :href="'https://m.geidcp.com/#/pages/country/enterprise/enterpriseDetail?' + 'baseEntityId=' + baseEntityId + '&language=' + $i18n.locale"
  153. :imageUrl="photos && photos[0]?websiteUrl+ photos[0] + '?custom=370_220':
  154. 'https://geidcp.com/api/file/pub/defaultCutPic/shareLogo.png'">
  155. </share>
  156. <!-- #ifdef H5 -->
  157. <rf-back-home></rf-back-home>
  158. <!-- #endif -->
  159. </view>
  160. </template>
  161. <script>
  162. import {
  163. addIntegral
  164. } from '@/components/addPointDetailByTaskDict.js'
  165. import share from '@/components/share'
  166. export default {
  167. components: {
  168. share,
  169. addIntegral
  170. },
  171. data() {
  172. return {
  173. baseEntityId: '',
  174. background: {
  175. backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
  176. },
  177. backStyle: {
  178. color: '#fff'
  179. },
  180. enterpriseInfo: Object,
  181. photos: [],
  182. tabCurrentIndex: 1,
  183. info1: [],
  184. info2: [],
  185. info3: [],
  186. indicatorDots: true,
  187. autoplay: true,
  188. interval: 2000,
  189. duration: 500,
  190. // 收藏
  191. ifcommon: false,
  192. // 用户信息
  193. Storage_data: '',
  194. AuthToken: '',
  195. ifShare: false,
  196. newsInfos: [],
  197. }
  198. },
  199. onLoad(option) {
  200. console.log(option);
  201. console.log(option.baseEntityId);
  202. this.baseEntityId = option.baseEntityId;
  203. if (option.language) {
  204. uni.setStorageSync("language", option.language);
  205. this._i18n.locale = option.language;
  206. }
  207. },
  208. async onReady() {
  209. // 获取登录状态和用户信息 开始
  210. this.AuthToken = uni.getStorageSync('Auth-Token');
  211. if (this.AuthToken) {
  212. this.Storage_data = JSON.parse(uni.getStorageSync('user'));
  213. }
  214. // 获取登录状态和用户信息 结束
  215. await this.getEnterpriseInfo();
  216. await this.getCmsInfos();
  217. // 获取关注状态 开始
  218. await this.getMyCollecModel();
  219. await this.getNewsInfo(null);
  220. // 获取关注状态 结束
  221. },
  222. computed: {
  223. token() {
  224. return 'Bearer ' + uni.getStorageSync('Auth-Token');
  225. }
  226. },
  227. methods: {
  228. share() {
  229. this.ifShare = !this.ifShare;
  230. },
  231. i18n(data) {
  232. return this.$t('common.' + data);
  233. },
  234. async getEnterpriseInfo(baseEntityId) {
  235. const res = await this.$myRequest({
  236. url: '/project/baseUnitViews/',
  237. data: {
  238. baseEntityId: this.baseEntityId,
  239. language: this.$i18n.locale.toUpperCase()
  240. }
  241. });
  242. if (res.data) {
  243. this.enterpriseInfo = res.data.baseUnitViews[0];
  244. if (this.enterpriseInfo.unitLabel) {
  245. this.enterpriseInfo["labelList"] = this.enterpriseInfo.unitLabel.split(",");
  246. } else {
  247. this.enterpriseInfo["labelList"] = []
  248. }
  249. // this.photos = this.countryInfo.photo?this.countryInfo.photo.split(","):[];
  250. }
  251. console.log(123, res)
  252. },
  253. tabClick(index) {
  254. this.tabCurrentIndex = index
  255. },
  256. navToList(src, data) {
  257. this.$mRouter.push({
  258. route: src + '?id=' + data
  259. });
  260. },
  261. async getCmsInfos(baseEntityId) {
  262. const res = await this.$myRequest({
  263. url: '/cms/cmsInformationViews/getInformationList/',
  264. data: {
  265. businessType: 'unitShow',
  266. businessId: this.baseEntityId,
  267. language: this.$i18n.locale.toUpperCase()
  268. }
  269. });
  270. if (res.data) {
  271. this.info1 = res.data["1"];
  272. this.info2 = res.data["2"];
  273. this.info3 = res.data["3"];
  274. this.photos = [];
  275. if (this.info1) {
  276. this.info1.forEach((item, index) => {
  277. if (item.pictureUrl && index <= 3) {
  278. this.photos.push(item.pictureUrl);
  279. }
  280. })
  281. }
  282. if (this.info2) {
  283. this.info2.forEach((item, index) => {
  284. if (item.pictureUrl && index <= 3) {
  285. this.photos.push(item.pictureUrl);
  286. }
  287. })
  288. }
  289. if (this.info3) {
  290. this.info3.forEach((item, index) => {
  291. if (item.pictureUrl && index <= 3) {
  292. this.photos.push(item.pictureUrl);
  293. }
  294. })
  295. }
  296. }
  297. },
  298. //收藏
  299. follow() {
  300. if (this.AuthToken) {
  301. this.shareChange()
  302. } else {
  303. if (this.$i18n.locale == 'zh') {
  304. this.$refs.uToast.show({
  305. title: '请登录',
  306. type: 'warning',
  307. url: '/pages/public/login',
  308. params: {
  309. back: 1
  310. }
  311. })
  312. } else {
  313. this.$refs.uToast.show({
  314. title: 'please log in',
  315. type: 'warning',
  316. url: '/pages/public/login',
  317. params: {
  318. back: 1
  319. }
  320. })
  321. }
  322. }
  323. },
  324. async getMyCollecModel() {
  325. const that = this;
  326. if (this.AuthToken) {
  327. var users = this.Storage_data;
  328. let MyCollecModel = {
  329. modelType: 'enterprise',
  330. userId: users.id,
  331. modelEntityId: this.enterpriseInfo.baseEntityId,
  332. }
  333. const res = await this.$myRequest({
  334. url: '/op/basePortalModelFollowInfos/followModelStatusByModelIdAndUserId',
  335. data: {
  336. modelId: this.enterpriseInfo.baseEntityId,
  337. modelType: 'enterprise',
  338. userId: users.id,
  339. }
  340. });
  341. if (res) {
  342. this.ifcommon = res.data;
  343. }
  344. }
  345. },
  346. // 关注操作方法
  347. shareChange() {
  348. if (this.ifcommon) {
  349. this.saveFollowModelDo("unfollow");
  350. } else {
  351. this.saveFollowModelDo("follow");
  352. }
  353. },
  354. async saveFollowModelDo(followType) {
  355. if (!this.AuthToken) {
  356. // 登录
  357. } else {
  358. var users = this.Storage_data;
  359. let MyCollecModel = {
  360. followType: followType,
  361. modelId: this.enterpriseInfo.baseEntityId,
  362. modelType: 'enterprise',
  363. userId: users.id,
  364. };
  365. const res = await this.$myRequest({
  366. url: '/op/basePortalModelFollowInfos/followModel',
  367. method: 'post',
  368. headers: {
  369. token: this.token
  370. },
  371. data: {
  372. followType: followType,
  373. modelId: this.enterpriseInfo.baseEntityId,
  374. modelType: 'enterprise',
  375. userId: users.id,
  376. }
  377. });
  378. if (res) {
  379. if (followType == 'unfollow') {
  380. if (this.$i18n.locale == 'zh') {
  381. this.$refs.uToast.show({
  382. title: '取消关注',
  383. type: 'success',
  384. })
  385. } else {
  386. this.$refs.uToast.show({
  387. title: 'Cancel concerned',
  388. type: 'success',
  389. })
  390. }
  391. } else {
  392. if (this.$i18n.locale == 'zh') {
  393. this.$refs.uToast.show({
  394. title: '已关注',
  395. type: 'success',
  396. })
  397. } else {
  398. this.$refs.uToast.show({
  399. title: 'Already concerned',
  400. type: 'success',
  401. })
  402. }
  403. addIntegral('point_task_attention', '1')
  404. }
  405. this.ifcommon = !this.ifcommon;
  406. }
  407. }
  408. },
  409. //最新动态
  410. async getNewsInfo(page) {
  411. const res = await this.$myRequest({
  412. url: '/cms/cmsInformationViews/getCountryDynamicInfos',
  413. data: {
  414. pageNo: 1,
  415. pageSize: 10,
  416. language: this.$i18n.locale.toUpperCase(),
  417. }
  418. });
  419. if (res.data) {
  420. this.newsInfos = res.data;
  421. }
  422. },
  423. },
  424. }
  425. </script>
  426. <style lang="scss" scoped>
  427. page {
  428. background-color: #fff;
  429. }
  430. .recommend-bottom {
  431. float: right;
  432. height: 160upx;
  433. width: 488upx;
  434. position: relative;
  435. }
  436. .list-cell {
  437. display: flex;
  438. box-sizing: border-box;
  439. width: 100%;
  440. padding: 10px 24upx;
  441. overflow: hidden;
  442. color: #323233;
  443. font-size: 14px;
  444. line-height: 24px;
  445. background-color: #fff;
  446. }
  447. .tabs {
  448. padding: 5upx 10upx;
  449. border-radius: 10upx;
  450. color: #fff;
  451. position: absolute;
  452. top: 8upx;
  453. right: 10upx;
  454. font-size: 24upx;
  455. margin-top: 10upx;
  456. background-color: #fab019;
  457. }
  458. .tabs2 {
  459. padding: 10upx 20upx;
  460. border: #2B85E4 1px solid;
  461. border-radius: 10upx;
  462. color: #2B85E4;
  463. margin-top: 10upx;
  464. font-size: 1px;
  465. margin-left: 1upx;
  466. }
  467. .recommend-bottom-name {
  468. font-size: 30upx;
  469. font-family: PingFangSC-Medium, PingFang SC;
  470. font-weight: 500;
  471. overflow: hidden;
  472. -webkit-line-clamp: 2;
  473. text-overflow: ellipsis;
  474. display: -webkit-box;
  475. width: 400upx;
  476. -webkit-box-orient: vertical;
  477. color: #0B0B11;
  478. line-height: 45upx;
  479. margin-top: 30upx;
  480. vertical-align: top;
  481. }
  482. .index-cate .index-cate-item {
  483. //margin: 0 4upx 10upx;
  484. width: 30%;
  485. display: inline-block;
  486. }
  487. .text-title {
  488. float: left;
  489. width: 400upx;
  490. white-space: nowrap;
  491. overflow: hidden;
  492. text-overflow: ellipsis;
  493. height: 100upx;
  494. line-height: 100upx;
  495. }
  496. .title-time {
  497. height: 100upx;
  498. line-height: 100upx;
  499. }
  500. .text-NoData {
  501. font-size: 50upx;
  502. height: 200upx;
  503. display: flex;
  504. justify-content: center;
  505. align-items: center;
  506. color: #767676;
  507. }
  508. </style>