resourceInfoDetail.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  1. <template>
  2. <view class="rf-category" style="position: relative;">
  3. <u-toast ref="uToast" />
  4. <view style="">
  5. <!--搜索导航栏-->
  6. <view class="icoStyle">
  7. <!--<view class="leftArrow" @tap="back">
  8. <u-icon name="arrow-left" color="#fff" size="36"></u-icon>
  9. </view>
  10. <view style="width:90%;height:99upx">
  11. <rf-search-bar @search="navToSearch" icon="iconkuaijiecaidan" />
  12. </view>-->
  13. <u-navbar :back-text="i18n('Back')" :title="i18n('ResearchResults')+i18n('resourceDetails')"
  14. :background="barBackground" back-icon-color="white" title-color="white"
  15. :back-text-style="backStyle">
  16. <view slot="right" style="margin-right:20upx">
  17. <u-icon name="share-fill" style="margin-right: 30upx;" color="white" size="50" @click="share">
  18. </u-icon>
  19. </view>
  20. </u-navbar>
  21. </view>
  22. <view class="content">
  23. <!--信息-->
  24. <view style="width: 100%;height: 320upx;margin-top: 10upx;padding: 20upx;background-color: white;">
  25. <view style="width: 218upx;height: 280upx;float: left;">
  26. <image
  27. v-if="details.researchResultCover!='null'&&details.researchResultCover!=null&&details.researchResultCover!=''&&details.researchResultCover!=undefined"
  28. :src="websiteUrl+details.researchResultCover" mode="" style="width: 100%;height: 100%;">
  29. </image>
  30. <image v-else src="@/static/img/resourceSharing/backImage.png" mode=""
  31. style="width: 100%;height: 100%;"></image>
  32. </view>
  33. <view style="width: 452upx;height: 100%;float: left;position: relative;margin-left: 27upx;">
  34. <view v-show="details.name">
  35. <text style="font-size: 30upx; color: #0B0B11;" class="fourLine">
  36. {{details.name}}
  37. </text>
  38. </view>
  39. <view style="margin-top: 13upx;" v-show="details.researchResultType">
  40. <text style="font-size: 26upx; padding: 0 13upx; border: 2px solid #1777FE;
  41. display: inline-block;border-radius: 32upx;color: #1777FE;">
  42. {{details.researchResultType}}
  43. </text>
  44. </view>
  45. </view>
  46. <view style="clear: both;"></view>
  47. </view>
  48. <!--摘要-->
  49. <view style="padding: 0 20upx;" v-show="details.researchResultAbstract">
  50. <!--摘要 >> 标题-->
  51. <view style="height: 102upx;padding: 20upx 0">
  52. <view style="height: 30upx;width: 10upx;margin-top: 6upx;background-color: #6DD400;float: left">
  53. </view>
  54. <view style="height: 100%;float: left;margin-left: 15upx;">
  55. <text
  56. style="font-size: 30upx;color: #0B0B11;line-height: 42upx;">{{i18n('resourceAbstract')}}</text>
  57. </view>
  58. <view style="clear: both;"></view>
  59. </view>
  60. <!--摘要 >> 正文-->
  61. <view style="padding:0 0 30upx 0">
  62. <text>{{details.researchResultAbstract}}</text>
  63. </view>
  64. </view>
  65. <!--目录-->
  66. <view style="padding: 0 20upx;margin-top: 30upx"
  67. v-show="details.resourceDirectory!=''&&details.resourceDirectory!=null&&details.resourceDirectory!='null'&&details.resourceDirectory!=undefined">
  68. <!--目录 >> 标题-->
  69. <view style="height: 42upx;">
  70. <view style="height: 30upx;width: 10upx;margin-top: 6upx;background-color: #6DD400;float: left">
  71. </view>
  72. <view style="height: 100%;float: left;margin-left: 15upx;">
  73. <text
  74. style="font-size: 30upx;color: #0B0B11;line-height: 42upx;">{{i18n('resourceDirectory')}}</text>
  75. </view>
  76. </view>
  77. <!--目录 >> 正文-->
  78. <view style="width: 100%;">
  79. <view>
  80. <image src="" mode="" style="width: 100%"></image>
  81. </view>
  82. </view>
  83. </view>
  84. <!--预览-->
  85. <view style="padding: 0 20upx;margin-top: 30upx">
  86. <view style="width: 100%;">
  87. <view style="width: 100%" v-for="(item,index) in moreImgShow-0" :key="index">
  88. <image :src="websiteUrl+ bookImg.fileAddress + '/' + item +'.png'" mode="widthFix"
  89. style="width: 100%;"></image>
  90. </view>
  91. </view>
  92. <view style="width: 100%;height: 72upx;padding-bottom: 30upx" v-show="reading">
  93. <view style="text-align: center;cursor: pointer;">
  94. <text
  95. style="font-size: 30upx;color: #0091FF;line-height: 42upx;margin-right: 15upx;cursor: pointer;"
  96. @click="fileProcessingReading">
  97. {{$i18n.locale=='zh'?'继续阅读':'Continue reading'}}
  98. </text>
  99. <u-icon name="arrow-down" color="#0091FF" size="30" style="cursor: pointer;"
  100. @click="fileProcessingReading"></u-icon>
  101. </view>
  102. </view>
  103. <view style="width: 100%;height: 72upx;padding-bottom: 30upx" v-show="more">
  104. <view style="text-align: center;" class="readEnd">
  105. <text
  106. style="font-size: 30upx;color: #0091FF;line-height: 42upx;margin-right: 15upx;cursor: pointer;"
  107. @click="fileProcessingEnd">
  108. {{$i18n.locale=='zh'?'试读结束':'End trial'}}
  109. </text>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="recommend">
  115. <view style="width: 100%;height: 83upx;padding: 0 30upx;">
  116. <text style="font-size: 26upx;font-weight: 600;line-height: 83upx;color: #333333;">
  117. {{$i18n.locale=='zh'?'相关成果':'related recommendation'}}
  118. </text>
  119. </view>
  120. <!-- 列表 -->
  121. <view style="width: 100%;">
  122. <view style="width: 100%;">
  123. <view v-for="(item,index) in recommendList" :key="index"
  124. style="width: 100%;height: 340upx;margin-bottom: 20upx;padding: 30upx;background-color: white;"
  125. @click="toDetaile(item.entityId)">
  126. <view
  127. style="width: 218upx;height: 280upx;float: left;border: 1px solid #979797;margin-right: 20upx">
  128. <image
  129. v-if="item.researchResultCover!='null'&&item.researchResultCover!=null&&item.researchResultCover!=''&&item.researchResultCover!=undefined"
  130. :src="websiteUrl+item.researchResultCover" mode=""
  131. style="width: 100%;height: 100%;"></image>
  132. <image v-else src="@/static/img/resourceSharing/backImage.png" mode=""
  133. style="width: 100%;height: 100%;"></image>
  134. </view>
  135. <view style="width: 452upx;height: 100%;float: left;position: relative;">
  136. <view>
  137. <text style="font-size: 30upx; color: #0B0B11;" class="twoLine">
  138. {{item.name}}
  139. </text>
  140. </view>
  141. <view style="margin-top: 13upx;">
  142. <text style="font-size: 26upx; padding: 0 13upx; border: 2px solid #1777FE;
  143. display: inline-block;border-radius: 32upx;color: #1777FE;">
  144. {{item.researchResultType}}
  145. </text>
  146. </view>
  147. <view v-show="item.informationVisibleStatus=='Y'" style="margin-top: 13upx;">
  148. <text style="font-size: 26upx; padding: 0 13upx; display: inline-block;
  149. border-radius: 12upx;background-color: rgba(61,127,255,0.1);color: #3D7FFF;">
  150. {{i18n('resourcevip')}}
  151. </text>
  152. </view>
  153. <view style="position: absolute;bottom: 0;width: 100%;height: 35upx;color: #666;">
  154. <view style="float: left;height: 100%">
  155. <text style="font-size: 28upx;">{{item.createDate}}</text>
  156. </view>
  157. <view style="float: right;">
  158. <view style="float: left;font-size: 28upx;font-weight: 400;">
  159. <u-icon name="heart" color="#848485" size="28" style="margin-right: 6upx">
  160. </u-icon>
  161. <text style="color: #666;">
  162. {{item.num=='null'?'0':item.num}}
  163. </text>
  164. </view>
  165. <!--<view style="float: left;font-size: 28upx;font-weight: 400;margin-left: 70upx;">
  166. <u-icon name="arrow-right" color="#848485" size="28" style="margin-right: 6upx"></u-icon>
  167. <text style="color: #666;">
  168. 888
  169. </text>
  170. </view>-->
  171. </view>
  172. <view style="clear: both;"></view>
  173. </view>
  174. </view>
  175. <view style="clear: both;"></view>
  176. </view>
  177. <view style="margin-top: 20rpx;">
  178. <u-loadmore :status="status" :load-text="loadText" />
  179. </view>
  180. </view>
  181. </view>
  182. </view>
  183. <rf-back-top :scrollTop="scrollTop"></rf-back-top>
  184. </view>
  185. <view>
  186. <u-popup v-model="popupShow" mode="center" border-radius="24" width="610upx" heigth="446upx">
  187. <view>
  188. <view style="text-align: center;">
  189. <view style="margin-top: 72upx;">
  190. <u-icon name="warning" color="#FFA033" size="60"></u-icon>
  191. </view>
  192. <view style="color: #333333;font-size: 32upx;font-weight: 500;margin-top: 24upx;">
  193. <text>{{$i18n.locale=='zh'?'会员专享 免费下载':'Free download for members only'}}</text>
  194. </view>
  195. <view style="color: #999999;font-size: 28upx;font-weight: 400;margin-top: 24upx;">
  196. <text>{{$i18n.locale=='zh'?'实时查看最新项目资源':'View the latest project resources in real time'}}</text>
  197. </view>
  198. <view style="color: #999999;font-size: 28upx;font-weight: 400;">
  199. <text>{{$i18n.locale=='zh'?'允许下载最新资源成果':'Allows you to download the latest resource results'}}</text>
  200. </view>
  201. <view style="margin-top: 52upx;display: flex;">
  202. <view
  203. style="width: 304upx;height: 84upx;border: 1px solid #E6E9ED;flex: 1;text-align: center;">
  204. <text style="line-height: 84upx;color: #999999;cursor: pointer;"
  205. @click="popupShow=false">{{$i18n.locale=='zh'?'稍后考虑':'Consider later'}}</text>
  206. </view>
  207. <view
  208. style="width: 304upx;height: 84upx;border: 1px solid #E6E9ED;flex: 1;text-align: center;">
  209. <text style="line-height: 84upx;color: #3D7FFF;cursor: pointer;"
  210. @click="toRgister">{{$i18n.locale=='zh'?'注册会员':'Register member'}}</text>
  211. </view>
  212. </view>
  213. </view>
  214. </view>
  215. </u-popup>
  216. </view>
  217. <!-- 8.8.20.112:19001 -->
  218. <share v-show="ifShare == true" :show="ifShare" @closeShare="share"
  219. :title="i18n('ResourceSharing') + '->' + i18n('resource')"
  220. :summary="details.researchResultAbstract ? details.researchResultAbstract:i18n('ResourceSharing')+i18n('resource')"
  221. :href="'https://m.geidcp.com/#/pages/resourceSharing/resourceInfoDetail/resourceInfoDetail?' + 'entityId=' + entityId + '&language=' + $i18n.locale"
  222. :imageUrl="bannerImg && bannerImg[0]?' bannerImg[0]':'https://geidcp.com/api/file/pub/defaultCutPic/shareLogo.png'">
  223. </share>
  224. <!-- #ifdef H5 -->
  225. <rf-back-home></rf-back-home>
  226. <!-- #endif -->
  227. <u-tabbar v-model="current" :list="bottombar" inactive-color="#B3BCCC" active-color="#4E79ED"
  228. @change="bottombarChange"></u-tabbar>
  229. </view>
  230. </template>
  231. <script>
  232. import rfSearchBar from '@/components/rf-search-bar';
  233. import qs from 'qs'
  234. import share from '@/components/share'
  235. export default {
  236. data() {
  237. return {
  238. // bar
  239. bannerImg: [],
  240. ifShare: false,
  241. barBackground: {
  242. backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
  243. },
  244. backStyle: {
  245. color: '#fff'
  246. },
  247. //
  248. entityId: '',
  249. details: {},
  250. recommendList: [],
  251. pageNo: 0,
  252. totalPage: 1,
  253. status: 'loading',
  254. isLoading: true,
  255. loadText: {
  256. loading: this.$i18n.locale == 'zh' ? '加载中' : 'Loading',
  257. nomore: this.$i18n.locale == 'zh' ? '没有更多数据了' : 'No more'
  258. },
  259. // 预览
  260. isVip: false,
  261. isLogin: false,
  262. reading: false,
  263. more: false,
  264. pageTotal: '',
  265. fileVisiblePages: 0,
  266. bookImg: '',
  267. moreImgShow: '',
  268. // 返回顶部
  269. scrollTop: 0,
  270. // 字典
  271. classify1: '',
  272. classify2: '',
  273. // 用户信息
  274. Storage_data: '',
  275. AuthToken: '',
  276. // 收藏
  277. ifcommon: false,
  278. // 底部导航栏
  279. current: 2,
  280. bottombar: [{
  281. iconPath: "heart-fill",
  282. selectedIconPath: "heart-fill",
  283. text: '',
  284. isDot: false,
  285. customIcon: false,
  286. },
  287. /*{
  288. iconPath: "share-fill",
  289. selectedIconPath: "share-fill",
  290. text: '',
  291. isDot: false,
  292. customIcon: false,
  293. },
  294. {
  295. iconPath: "download",
  296. selectedIconPath: "download",
  297. text: '',
  298. isDot: false,
  299. customIcon: false,
  300. },*/
  301. ],
  302. //
  303. popupShow: false,
  304. }
  305. },
  306. components: {
  307. rfSearchBar,
  308. share
  309. },
  310. onLoad: function(options) {
  311. this.entityId = options.entityId;
  312. console.log(this.entityId, '你好啊');
  313. if (options.language) {
  314. uni.setStorageSync("language", options.language);
  315. this._i18n.locale = options.language;
  316. }
  317. },
  318. onPageScroll(e) {
  319. this.scrollTop = e.scrollTop;
  320. },
  321. onReachBottom() { //页面拉到底部加载
  322. if (this.isLoading) {
  323. this.getDataList();
  324. }
  325. },
  326. async onShow() {
  327. this.popupShow = false;
  328. this.isVip = false;
  329. this.isLogin = false;
  330. this.reading = false;
  331. this.more = false;
  332. this.recommendList = [];
  333. this.details = {};
  334. this.bottombarInit()
  335. await this.getDict();
  336. await this.getData();
  337. await this.getFile();
  338. await this.getDataList();
  339. await this.getMyCollecModel();
  340. },
  341. watch: {
  342. current() {
  343. this.current = 2;
  344. },
  345. ifcommon() {
  346. this.bottombarInit()
  347. },
  348. },
  349. computed: {
  350. token() {
  351. return 'Bearer ' + uni.getStorageSync('Auth-Token');
  352. }
  353. },
  354. methods: {
  355. share() {
  356. this.ifShare = !this.ifShare;
  357. },
  358. async getDict() {
  359. this.AuthToken = uni.getStorageSync('Auth-Token');
  360. if (this.AuthToken) {
  361. this.Storage_data = JSON.parse(uni.getStorageSync('user'));
  362. } else {
  363. this.popupShow = true;
  364. }
  365. const res = await this.$myRequest({
  366. url: '/sys/sysDicts',
  367. data: {
  368. type: this.$i18n.locale == "zh" ?
  369. 'RESEARCH_RESULT_TYPE_DICT,RESEARCH_RESOURCE_TYPE_DICT' :
  370. 'RESEARCH_RESULT_TYPE_DICT_EN,RESEARCH_RESOURCE_TYPE_DICT_EN',
  371. }
  372. });
  373. if (res.data) {
  374. let both = {
  375. label: this.$t('common.All'),
  376. value: null
  377. };
  378. this.classify1 = res.data[0];
  379. this.classify2 = res.data[1];
  380. this.classify1.unshift(both);
  381. this.classify2.unshift(both);
  382. }
  383. },
  384. async getData() {
  385. const that = this;
  386. let params = {
  387. entityId: this.entityId,
  388. pageNo: '',
  389. pageSize: '',
  390. language: this.$i18n.locale.toUpperCase(),
  391. researchResultFileId: '',
  392. reserveTwo: 'Y',
  393. };
  394. const res = await this.$myRequest({
  395. url: '/resourceshare/baseResearchResultViews/gateBaseResearchResultView',
  396. data: {
  397. ...params
  398. }
  399. })
  400. if (res.data && res.data.baseResearchResultView) {
  401. that.details = res.data.baseResearchResultView;
  402. that.details.updateDate = that.details.updateDate ? this.formatDate(that.details.updateDate,
  403. "YYYY-MM-DD") : "";
  404. if (that.details.researchResultCover) {
  405. that.details.researchResultCover = that.details
  406. .researchResultCover;
  407. }
  408. for (let o = 0; o < that.classify1.length; o++) {
  409. if (that.details.researchResultType == that.classify1[o].value) {
  410. that.details.researchResultType = that.classify1[o].label;
  411. }
  412. }
  413. }
  414. },
  415. async getFile() {
  416. const that = this;
  417. let params = {
  418. pageNo: 1,
  419. pageSize: 1,
  420. language: '',
  421. researchResultFileId: that.details.researchResultFileId
  422. }
  423. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  424. params.language = 'ZH';
  425. } else if (this.$i18n.locale.toUpperCase() == 'EN') {
  426. params.language = 'EN';
  427. }
  428. const res = await this.$myRequest({
  429. url: '/resourceshare/baseResearchResultViews/gateResearchResultFile',
  430. data: {
  431. ...params
  432. }
  433. })
  434. if (res.data && res.data.baseResearchResultFile !== '无数据') {
  435. that.bookImg = res.data.baseResearchResultFile;
  436. that.bookImg.updateDate = that.bookImg.updateDate ? that.formatDate(that.bookImg.updateDate,
  437. "YYYY-MM-DD") : "";
  438. that.pageTotal = that.bookImg.filePages;
  439. if (that.bookImg.fileVisibleStatus == 'Y') {
  440. if (that.bookImg.fileVisiblePages == 0) {
  441. that.fileVisiblePages = that.pageTotal;
  442. } else {
  443. that.fileVisiblePages = that.bookImg.fileVisiblePages;
  444. if (that.AuthToken) {
  445. that.isLogin = true;
  446. // let userType = JSON.parse(window.localStorage.getItem('user')).umsUser.userUsertype
  447. // if(userType == "普通用户账号"){
  448. // that.isVip = false;
  449. // console.log(that.bookImg.fileVisiblePages)
  450. // that.fileVisiblePages = that.bookImg.fileVisiblePages;
  451. // }else{
  452. that.isVip = true;
  453. that.fileVisiblePages = that.pageTotal;
  454. // }
  455. } else {
  456. that.isVip = false;
  457. that.isLogin = false;
  458. }
  459. }
  460. } else if (that.bookImg.fileVisibleStatus == 'N') {
  461. that.fileVisiblePages = that.pageTotal;
  462. }
  463. console.log(that.bookImg)
  464. console.log(typeof that.bookImg)
  465. that.bookImg.fileAddress = that.bookImg.fileAddress.replace('\\', '/');
  466. } else {
  467. this.status = 'nomore'
  468. }
  469. this.fileProcessing()
  470. },
  471. // 无会员体系预览判断
  472. async fileProcessing() {
  473. if (this.bookImg) {
  474. if (this.isLogin) {
  475. if (this.pageTotal > 4) {
  476. this.reading = true;
  477. this.moreImgShow = 5;
  478. } else {
  479. this.moreImgShow = this.pageTotal;
  480. }
  481. } else {
  482. if (this.fileVisiblePages < 5) {
  483. this.more = true;
  484. this.moreImgShow = this.fileVisiblePages;
  485. } else {
  486. this.reading = true;
  487. this.moreImgShow = 5;
  488. }
  489. }
  490. }
  491. console.log(this)
  492. },
  493. // 暂时弃用
  494. /*async fileProcessing(){
  495. if (this.bookImg){
  496. if(this.fileVisiblePages < 5){
  497. if(this.bookImg.fileVisiblePages < this.pageTotal){
  498. if(this.isVip){
  499. this.reading = true;
  500. }else{
  501. this.more = true;
  502. }
  503. }
  504. this.moreImgShow = this.fileVisiblePages;
  505. }else{
  506. if(this.fileVisiblePages < this.pageTotal){
  507. if(this.isVip){
  508. this.reading = true;
  509. }else{
  510. this.more = true;
  511. }
  512. }
  513. this.moreImgShow = 5;
  514. }
  515. }
  516. },*/
  517. fileProcessingReading() {
  518. console.log("this.isLogin",this.isLogin);
  519. if (this.isLogin) {
  520. this.moreImgShow = this.pageTotal;
  521. } else {
  522. this.moreImgShow = this.fileVisiblePages;
  523. }
  524. this.reading = false;
  525. },
  526. fileProcessingEnd() {
  527. this.popupShow = true;
  528. },
  529. async getDataList() {
  530. const that = this;
  531. let params = {
  532. pageNo: '',
  533. pageSize: 10,
  534. language: this.$i18n.locale.toUpperCase(),
  535. status: 0,
  536. descStatus: 0,
  537. reserveTwo: 'Y',
  538. }
  539. if (this.pageNo >= this.totalPage) {
  540. this.isLoading = false;
  541. this.status = 'nomore';
  542. } else {
  543. this.isLoading = true;
  544. this.pageNo++;
  545. params.pageNo = this.pageNo;
  546. const res = await this.$myRequest({
  547. url: '/resourceshare/baseResearchResultViews/',
  548. data: {
  549. ...params
  550. }
  551. })
  552. if (res.data) {
  553. let data = res.data.baseResearchResultViews;
  554. data.forEach((i) => {
  555. i.createDate = i.createDate ? this.formatDate(i.createDate, "YYYY-MM-DD") : "";
  556. })
  557. for (let i = 0; i < data.length; i++) {
  558. for (let o = 0; o < that.classify1.length; o++) {
  559. if (data[i].researchResultType == that.classify1[o].value) {
  560. data[i].researchResultType = that.classify1[o].label;
  561. }
  562. }
  563. }
  564. that.recommendList = [...that.recommendList, ...data]
  565. this.totalPage = res.data.page.totalPage;
  566. if (that.totalPage == 1) {
  567. this.isLoading = false;
  568. this.status = 'nomore';
  569. }
  570. let flag = false;
  571. for (let j = 0; j < that.recommendList.length; j++) {
  572. if (that.recommendList[j].name == that.details.name) {
  573. flag = j;
  574. }
  575. }
  576. if (flag === 0 || flag != false) {
  577. that.recommendList.splice(flag, 1)
  578. }
  579. }
  580. }
  581. },
  582. //收藏
  583. async getMyCollecModel() {
  584. const that = this;
  585. if (this.AuthToken) {
  586. var users = this.Storage_data;
  587. let MyCollecModel = {
  588. modelType: 'researchResult',
  589. userId: users.userId,
  590. modelEntityId: this.entityId,
  591. }
  592. const res = await this.$myRequest({
  593. url: '/op/basePortalModelFollowInfos/followModelStatusByModelIdAndUserId',
  594. data: {
  595. modelId: this.entityId,
  596. modelType: 'researchResult',
  597. userId: users.id,
  598. },
  599. });
  600. if (res) {
  601. this.ifcommon = res.data;
  602. }
  603. }
  604. },
  605. shareChange() {
  606. if (this.ifcommon) {
  607. this.saveFollowModelDo("unfollow");
  608. } else {
  609. this.saveFollowModelDo("follow");
  610. }
  611. },
  612. // ***** 关注操作方法
  613. async saveFollowModelDo(followType) {
  614. if (!this.AuthToken) {
  615. // 登录
  616. } else {
  617. var users = this.Storage_data;
  618. let MyCollecModel = {
  619. followType: followType,
  620. modelId: this.entityId,
  621. modelType: 'researchResult',
  622. userId: users.id,
  623. }
  624. const res = await this.$myRequest({
  625. url: '/op/basePortalModelFollowInfos/followModel',
  626. method: 'post',
  627. headers: {
  628. token: this.token
  629. },
  630. data: {
  631. followType: followType,
  632. modelId: this.entityId,
  633. modelType: 'researchResult',
  634. userId: users.id,
  635. }
  636. });
  637. if (res) {
  638. if (followType == 'unfollow') {
  639. if (this.$i18n.locale == 'zh') {
  640. this.$refs.uToast.show({
  641. title: '取消关注',
  642. type: 'success',
  643. })
  644. } else {
  645. this.$refs.uToast.show({
  646. title: 'Cancel concerned',
  647. type: 'success',
  648. })
  649. }
  650. } else {
  651. if (this.$i18n.locale == 'zh') {
  652. this.$refs.uToast.show({
  653. title: '已关注',
  654. type: 'success',
  655. })
  656. } else {
  657. this.$refs.uToast.show({
  658. title: 'Already concerned',
  659. type: 'success',
  660. })
  661. }
  662. }
  663. this.ifcommon = !this.ifcommon;
  664. }
  665. }
  666. },
  667. toDetaile(entityId) {
  668. uni.redirectTo({
  669. url: `/pages/resourceSharing/resourceInfoDetail/resourceInfoDetail?entityId=${entityId}`,
  670. });
  671. },
  672. // 底部bar事件
  673. bottombarInit() {
  674. this.bottombar[0].text = this.$i18n.locale == 'zh' ? (this.ifcommon === true ? "已关注" : "关注") : (this
  675. .ifcommon === true ? "Concerned" : " Follow")
  676. // this.bottombar[1].text = this.i18n('resourceDetailsShare')
  677. // this.bottombar[2].text = this.i18n('resourceDetailsDownload')
  678. },
  679. bottombarChange(index) {
  680. if (index == 0) {
  681. // 收藏
  682. if (this.AuthToken) {
  683. this.shareChange()
  684. } else {
  685. if (this.$i18n.locale == 'zh') {
  686. this.$refs.uToast.show({
  687. title: '请登录',
  688. type: 'warning',
  689. url: '/pages/public/login',
  690. params: {
  691. back: 1
  692. }
  693. })
  694. } else {
  695. this.$refs.uToast.show({
  696. title: 'please log in',
  697. type: 'warning',
  698. url: '/pages/public/login',
  699. params: {
  700. back: 1
  701. }
  702. })
  703. }
  704. }
  705. } else if (index == 1) {
  706. // 分享
  707. } else if (index == 2) {
  708. // 下载
  709. const that = this;
  710. if (this.AuthToken) {
  711. if (that.AuthToken) {
  712. this.Download()
  713. } else {
  714. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  715. this.$refs.uToast.show({
  716. title: '该文件暂不支持下载',
  717. type: 'warning',
  718. })
  719. } else {
  720. this.$refs.uToast.show({
  721. title: 'This file is not supported for download',
  722. type: 'warning',
  723. })
  724. }
  725. }
  726. } else {
  727. if (this.$i18n.locale == 'zh') {
  728. this.$refs.uToast.show({
  729. title: '请登录',
  730. type: 'warning',
  731. url: '/pages/public/login',
  732. params: {
  733. back: 1
  734. }
  735. })
  736. } else {
  737. this.$refs.uToast.show({
  738. title: 'please log in',
  739. type: 'warning',
  740. url: '/pages/public/login',
  741. params: {
  742. back: 1
  743. }
  744. })
  745. }
  746. }
  747. }
  748. },
  749. Download() {
  750. let pdfUrl = this.details.researchResultFile;
  751. uni.downloadFile({
  752. url: 'https://m.geidcp.com/api/file/pub/' + pdfUrl, //下载地址接口返回
  753. success: (data) => {
  754. if (data.statusCode === 200) {
  755. //文件保存到本地
  756. uni.saveFile({
  757. tempFilePath: data.tempFilePath, //临时路径
  758. success: function(res) {
  759. uni.showToast({
  760. icon: 'none',
  761. mask: true,
  762. title: '文件已保存:' + res.savedFilePath, //保存路径
  763. duration: 3000,
  764. });
  765. setTimeout(() => {
  766. //打开文档查看
  767. uni.openDocument({
  768. filePath: res.savedFilePath,
  769. success: function(res) {
  770. // console.log('打开文档成功');
  771. }
  772. });
  773. }, 3000)
  774. }
  775. });
  776. }
  777. },
  778. fail: (err) => {
  779. console.log(err);
  780. uni.showToast({
  781. icon: 'none',
  782. mask: true,
  783. title: '失败请重新下载',
  784. });
  785. },
  786. });
  787. },
  788. back() {
  789. uni.navigateBack();
  790. },
  791. toRgister() {
  792. this.$mRouter.push({
  793. route: `/pages/public/login?back=1`,
  794. });
  795. },
  796. //中英文切换
  797. i18n(data) {
  798. return this.$t('common.' + data);
  799. },
  800. }
  801. }
  802. </script>
  803. <style lang="scss" scoped>
  804. .rf-category {
  805. background-color: #F3F4F5;
  806. /* #ifdef APP-PLUS */
  807. /*margin-top: calc(20upx + var(--status-bar-height));*/
  808. /* #endif */
  809. .icoStyle {
  810. display: flex;
  811. align-items: center;
  812. .leftArrow {
  813. width: 36upx;
  814. height: 36upx;
  815. position: fixed;
  816. z-index: 99;
  817. /* #ifdef APP-PLUS */
  818. padding-top: calc(20upx + var(--status-bar-height));
  819. /* #endif */
  820. }
  821. }
  822. .content {
  823. background-color: white;
  824. .readEnd {
  825. position: relative;
  826. &::before {
  827. content: "";
  828. position: absolute;
  829. left: 0;
  830. top: 50%;
  831. width: 255upx;
  832. height: 1upx;
  833. background-color: #979797;
  834. }
  835. &::after {
  836. content: "";
  837. position: absolute;
  838. right: 0;
  839. top: 50%;
  840. width: 255upx;
  841. height: 1upx;
  842. background-color: #979797;
  843. }
  844. }
  845. }
  846. .recommend {
  847. background-color: white;
  848. margin-top: 20upx;
  849. width: 100%;
  850. }
  851. .oneLine {
  852. /* 隐藏溢出元素 */
  853. overflow: hidden;
  854. /* 单行显示 */
  855. white-space: nowrap;
  856. /* 溢出显示省略号 */
  857. text-overflow: ellipsis;
  858. }
  859. .twoLine {
  860. overflow: hidden;
  861. text-overflow: ellipsis;
  862. display: -webkit-box;
  863. -webkit-line-clamp: 2;
  864. -webkit-box-orient: vertical;
  865. }
  866. .threeLine {
  867. overflow: hidden;
  868. text-overflow: ellipsis;
  869. display: -webkit-box;
  870. -webkit-line-clamp: 3;
  871. -webkit-box-orient: vertical;
  872. }
  873. .fourLine {
  874. overflow: hidden;
  875. text-overflow: ellipsis;
  876. display: -webkit-box;
  877. -webkit-line-clamp: 4;
  878. -webkit-box-orient: vertical;
  879. }
  880. }
  881. </style>