ResourceSharingDetailsPreview.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. <template>
  2. <div class="autoBox box" style="min-height: 900px;position: relative;">
  3. <div class="crumbs">
  4. <div style="overflow: hidden">
  5. <el-breadcrumb separator-class="el-icon-arrow-right" style="float: left">
  6. <el-breadcrumb-item :to="{ path: 'home' }">{{$t('common.Home')}}</el-breadcrumb-item>
  7. <el-breadcrumb-item :to="{ path: 'realTimeInfo1' }" class="pointer">{{$t('common.NewsData')}}</el-breadcrumb-item>
  8. <el-breadcrumb-item>{{$t('common.InfomationResults')}}</el-breadcrumb-item>
  9. </el-breadcrumb>
  10. <el-breadcrumb separator="/" style="float: right;">
  11. <span :class="screenIndex==index?'secNavActive':''"
  12. class="pointer"
  13. @click="screenChange(item,index)"
  14. v-for="(item,index) in resourceSharingScreen">
  15. &nbsp;&nbsp;{{ $t("common.InfomationResults")}} &nbsp;&nbsp;
  16. <span v-if="index+1!==resourceSharingScreen.length" style="color: #2c3e50">/</span></span>
  17. </el-breadcrumb>
  18. </div>
  19. </div>
  20. <div class="mainBody">
  21. <h4 style="color: #2C558A;font-size: 30px;margin: 64px 20px 30px 20px ">{{bookContent.name}}</h4>
  22. <div style="margin: 0 20px;background-color: #eff5fd;height: 40px;vertical-align: middle;">
  23. <div style="float: left">
  24. <span style="margin-left: 30px;font-size: 16px;line-height: 40px;color: #333333;">{{$t('common.resourceDetailsTheCategory')}}:{{bookContent.researchResultType}}</span>
  25. </div>
  26. <div style="float: right">
  27. <span style="margin-right: 30px;font-size: 16px;line-height: 40px;color: #333333;">{{$t('common.resourceDetailsReleaseTime')}}:{{bookContent.updateDate}}</span>
  28. </div>
  29. <div style="clear: both"></div>
  30. </div>
  31. <!-- 显示pdf-->
  32. <!-- <iframe :src="srcPdf" scrolling="no" frameborder="0" style="width: 100%;height: 1000px"></iframe>-->
  33. <!-- 显示图片-->
  34. <div v-if="bookImg['fileAddress']==undefined||bookImg.fileAddress==false||bookImg.fileAddress==''||bookImg.fileAddress=='null'||bookImg.fileAddress==null">
  35. <div style="text-align: center;height: 100px;border-bottom: 1px solid #eee;border-top: 1px solid #eee;">
  36. <span v-show="$i18n.locale=='en'" style="line-height: 100px;">no data</span>
  37. <span v-show="$i18n.locale=='zh'" style="line-height: 100px;">暂无数据</span>
  38. </div>
  39. </div>
  40. <div v-else>
  41. <div style="width: 100%;margin: 30px 0 0 0;text-align: center;">
  42. <img v-show="currentPage<=fileVisiblePages" :src="'api/file/pub/'+ bookImg.fileAddress + '\\' + currentPage +'.png'" alt="" style="min-width: 600px;max-width:900px;">
  43. <img v-show="currentPage>fileVisiblePages && isVip==true && isLogin==true" :src="'api/file/pub/'+ bookImg.fileAddress + '\\' + currentPage +'.png'" alt="" style="min-width: 600px;max-width:900px;">
  44. <div v-show="currentPage>=fileVisiblePages && isLogin==false && currentPage!=pageTotal" style="width: 100%;height: 100%">
  45. <span style="font-size: 20px;font-weight: 700">{{$t('common.resourceDetailsTryRead')}}</span>
  46. <div style="width: 190px;height: 37px;background-color: rgba(24, 144, 255, 1);margin: 15px auto;cursor: pointer;" @click="toLogin">
  47. <span style="font-size: 18px;font-weight: 400;color: #FFFFFF;line-height: 38px;" >{{$t('common.resourceLogIn')}}</span>
  48. </div>
  49. </div>
  50. <div v-show="currentPage>=fileVisiblePages && isVip==false && isLogin==true && currentPage!=pageTotal" style="width: 100%;height: 100%">
  51. <span style="font-size: 20px;font-weight: 700">{{$t('common.resourceDetailsTryRead')}}</span>
  52. <div style="width: 190px;height: 37px;background-color: rgba(24, 144, 255, 1);margin: 15px auto;">
  53. <span style="font-size: 18px;font-weight: 400;color: #FFFFFF;line-height: 38px;">{{$t('common.resourceDetailsVIP')}}</span>
  54. </div>
  55. </div>
  56. <div v-show="currentPage>=fileVisiblePages && currentPage==pageTotal" style="width: 100%;height: 100%;cursor: pointer;" @click="toDevelopmentCooperation">
  57. <span style="font-size: 20px;font-weight: 700">
  58. {{$i18n.locale=='zh'?'本文浏览结束,如需了解更多信息,请联系平台管理人员':'You have finished the reading of this article. For more information, please contact the customer manager.'}}
  59. </span>
  60. </div>
  61. </div>
  62. <div style="height: 100px;overflow: hidden;vertical-align: middle;margin: 0 auto 30px;">
  63. <div style="overflow:hidden;padding: 50px 400px 0; height: 100px;">
  64. <div style="min-width:30%; float: left;color: #333333;height: 100%;padding-top: 2px;box-sizing: border-box;">
  65. <!--下载-->
  66. <!-- <img src="../../assets/img/ResourceSharing/download.png" @click="downloads" alt="" style="margin-right: 3px;vertical-align: middle;cursor: pointer;width: 16px">
  67. <span style="margin-right: 20px;vertical-align: middle;cursor: pointer;" @click="downloads">{{$t('common.resourceDetailsDownload')}}</span>-->
  68. <!-- <img src="@/assets/img/ResourceSharing/heat.png" alt="" style="width: 16px;height: 16px;margin-right: 3px;vertical-align: middle;">-->
  69. <!-- <i class="el-icon-star-off" style="margin-right: 3px;vertical-align: middle;cursor: pointer;"></i>-->
  70. <!-- <img src="../../assets/img/ResourceSharing/collect.png" alt=""-->
  71. <!-- style="margin-right: 3px;vertical-align: middle;cursor: pointer;width: 16px;"-->
  72. <!-- :style="ifcommon?'backfround-color: #66b1ff;':''"-->
  73. <!-- @click="shareChange()"-->
  74. <!-- >-->
  75. <i class="el-icon-star-off" style="margin-right: 3px;vertical-align: middle;cursor: pointer;font-size: 18px"
  76. :style="ifcommon?'color: #66b1ff;':''"
  77. @click="shareChange()"></i>
  78. <span style="margin-right: 30px;vertical-align: middle;cursor: pointer;"
  79. :style="ifcommon?'color: #66b1ff;':''"
  80. @click="shareChange()"
  81. >{{$i18n.locale=='zh'?ifcommon?"已关注" : "关注":ifcommon?"Already collected":" Collection"}}</span>
  82. <!-- <span class="share cursor"-->
  83. <!-- :style="ifcommon?'color: #66b1ff;':''"-->
  84. <!-- style="margin-right: 20px;float: right;"-->
  85. <!-- @click="shareChange()">-->
  86. <!-- <i class="el-icon-star-off" :style="ifcommon?'color: #66b1ff;':''"></i>-->
  87. <!-- {{$i18n.locale=='zh'?ifcommon?"已收藏":"收藏":ifcommon?"Favorites":"Favorites"}}-->
  88. <!-- </span>-->
  89. </div>
  90. <div style="display: inline-block;width:154px; height: 100%;text-align: center;position: relative;" class="bottomPage">
  91. <button style="display: inline-block;width: 32px;height: 32px;background-color: white;border: 1px solid #ddd;position: absolute;top: 0;left: 0;cursor: pointer"
  92. @click="handleCurrentChangeLeft"><</button>
  93. <div style="display: inline-block;border: 1px solid #ddd;width: 86px;height: 30px;line-height: 30px;position: absolute;top: 0;left: 33px;">
  94. <!-- <span style="display: inline-block;width: 23px;height: 23px;text-align: center;line-height: 23px;background-color: #0091FF;border-radius: 6px;color: white">-->
  95. <!-- {{currentPage}}-->
  96. <!-- </span>-->
  97. <span style="display: inline-block;width: 23px;height: 23px;">
  98. <!-- <span style="display: inline-block;width: 23px;height: 23px;text-align: center;line-height: 23px;background-color: #0091FF;border-radius: 6px;color: white">-->
  99. <!-- {{currentPage}}-->
  100. <input type="text" v-model="inputPage" @change="inputPageChange()"
  101. style="width: 23px;height: 23px;border: none;padding: 0;background-color: #0091FF;text-align: center;line-height: 23px;border-radius: 6px;color: white"></input>
  102. </span>
  103. <span style="display: inline-block;width: 23px;height: 23px;text-align: center;line-height: 23px;">/</span>
  104. <span style="display: inline-block;width: 23px;height: 23px;text-align: center;line-height: 23px;">{{pageTotal}}</span>
  105. </div>
  106. <button style="display: inline-block;width: 32px;height: 32px;background-color: white;border: 1px solid #ddd;position: absolute;top: 0;left: 121px;cursor: pointer"
  107. @click="handleCurrentChangeRight">></button>
  108. </div>
  109. <!--<el-pagination
  110. background
  111. style="width:60%;float: left;height: 80px;margin-top:25px;"
  112. @current-change="handleCurrentChange"
  113. :current-page="currentPage"
  114. :page-size="1"
  115. layout="prev, pager, next"
  116. :total="pageTotal-0"
  117. ></el-pagination>-->
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. <!-- 登录提示-->
  123. <el-dialog
  124. :title="$i18n.locale=='zh'?'提示':'Reminder'"
  125. :visible.sync="toViewLogin"
  126. :width="$i18n.locale=='zh'?'500px':'750px'"
  127. :height="$i18n.locale=='zh'?'300px':'386px'"
  128. :before-close="toViewLoginChange"
  129. >
  130. <div style="width: 100%;height: 100%;">
  131. <img src="@/assets/img/loginTips.png" alt="" style="width: 180px;height: 180px;margin-left: 20px;">
  132. <div style="float: right;margin-right: 20px;" :style="$i18n.locale=='zh'?'width: 49%;margin-top: 10px;':'width: 453px;margin-top: -25px;'">
  133. <div style="font-size: 20px;font-weight: normal;color: #333333;
  134. font-family: HiraginoSansGB-W3, HiraginoSansGB;
  135. line-height: 40px;">
  136. {{$t('common.ReminderFirst')}}
  137. </div>
  138. <div style="font-size: 16px;font-family: HiraginoSansGB-W3, HiraginoSansGB;
  139. font-weight: normal;color: #666666;line-height: 30px;">
  140. {{$t('common.ReminderSecond')}} <span style="color: #0091FF;font-size: 18px;">{{num}}</span> {{$t('common.ReminderThird')}}
  141. </div>
  142. <div style="font-size: 14px;font-family: HiraginoSansGB-W3, HiraginoSansGB;
  143. font-weight: normal;color: #666666;line-height: 30px;">
  144. {{$t('common.ReminderForth')}}
  145. </div>
  146. <div style="font-size: 14px;font-family: HiraginoSansGB-W3, HiraginoSansGB;
  147. height:33px;line-height:60px;font-weight: normal;color: #0091FF;">
  148. <span style="margin-left: 40px;" class="cursor" @click="toView('login')">
  149. {{$t('common.ReminderFifth')}}
  150. </span>
  151. <span style="margin-left: 10px;" class="cursor" @click="toView('Register')">
  152. {{$t('common.ReminderSixth')}}
  153. </span>
  154. </div>
  155. </div>
  156. </div>
  157. </el-dialog>
  158. </div>
  159. </template>
  160. <script>
  161. import { downloadDeductingIntegral } from "@/api/user";
  162. import Base from "@/views/base/Base";
  163. import { getDicts, getDictByTypeValue } from "@/api/dict";
  164. import {
  165. getBaseResearchResultViews,
  166. gateResearchResultViewById,
  167. gateResearchResultFileById,
  168. } from "@/api/research/baseResearchResultView";
  169. import { formatDate } from "@/utils/formatUtils";
  170. import { getToken, resetToken } from "@/utils/auth";
  171. import { getFollowModeNumlByModelIdAndUserId } from "@/api/operation/basePortalModelFollowInfo";
  172. import {
  173. getFollowModeNumlByModelId,
  174. getFollowModelNumByUser,
  175. saveFollowModel,
  176. } from "@/api/operation/basePortalModelFollowInfo";
  177. export default {
  178. name: "resourceSharingDetailsPreview",
  179. extends: Base,
  180. data() {
  181. return {
  182. ifcommon: false,
  183. isVip: false,
  184. isLogin: false,
  185. num: 5,
  186. timer: "",
  187. toViewLogin: false,
  188. currentPage: 1,
  189. inputPage: 1,
  190. pageTotal: "",
  191. fileVisiblePages: 0,
  192. params: {
  193. pageNo: 1,
  194. pageSize: 1,
  195. language: "",
  196. },
  197. screenIndex: 0, //研究成果、调研资源选中
  198. resourceSharingScreen: [
  199. {
  200. lable: "common.resource",
  201. value: "0",
  202. },
  203. // {
  204. // lable: "common.researchResource",
  205. // value: "1",
  206. // },
  207. ],
  208. bookContent: {},
  209. bookImg: {},
  210. };
  211. },
  212. mounted() {
  213. if (this.$route.query.key) {
  214. this.initData();
  215. } else {
  216. this.toView("resourceSharing", 0);
  217. }
  218. },
  219. watch: {
  220. "$i18n.locale"() {
  221. this.initData();
  222. },
  223. },
  224. methods: {
  225. initData() {
  226. this.getData();
  227. this.getMyCollecModel(); // 获取用户是否收藏
  228. },
  229. getMyCollecModel() {
  230. const that = this;
  231. if (this.$Cookies.get("token")) {
  232. let user = window.localStorage.getItem("user");
  233. var users = JSON.parse(user);
  234. let MyCollecModel = {
  235. modelType: "researchResult",
  236. userId: users.userId,
  237. modelEntityId: JSON.parse(that.$route.query.key).entityId,
  238. };
  239. getFollowModeNumlByModelIdAndUserId(
  240. JSON.parse(that.$route.query.key).entityId,
  241. "researchResult",
  242. this.userId
  243. ).then((res) => {
  244. this.ifcommon = res.data;
  245. });
  246. }
  247. },
  248. //收藏
  249. shareChange() {
  250. // if (this.ifcommon) {
  251. // this.Collection("uncollect");
  252. // } else {
  253. // this.Collection("collect");
  254. // }
  255. if (this.ifcommon) {
  256. this.saveFollowModelDo("unfollow");
  257. } else {
  258. this.saveFollowModelDo("follow");
  259. }
  260. },
  261. //关注操作方法
  262. saveFollowModelDo: function (followType) {
  263. let user = window.localStorage.getItem("user");
  264. if (!this.$Cookies.get("token")) {
  265. // this.$message.warning("请先登录");
  266. // this.$confirm('检测到您未登录,是否登录')
  267. // .then(_ => {
  268. // this.toView('login');
  269. // })
  270. // .catch(_ => {});
  271. this.toViewLogin = true;
  272. } else {
  273. var users = JSON.parse(user);
  274. var token = "" + getToken();
  275. var projectId = JSON.parse(this.$route.query.key).entityId;
  276. var userId = users.userId;
  277. // 接口逻辑
  278. this.submitHandler((token) => {
  279. saveFollowModel(
  280. projectId,
  281. "researchResult",
  282. userId,
  283. followType,
  284. token
  285. )
  286. .then((result) => {
  287. // console.log(result);
  288. /*if(followType=='unfollow'){
  289. if(this.$i18n.locale=='zh'){
  290. this.$message({
  291. message: '取消收藏',
  292. type: "success",
  293. });
  294. }else{
  295. this.$message({
  296. message: 'cancel coilection',
  297. type: "success",
  298. });
  299. }
  300. }else{
  301. if(this.$i18n.locale=='zh'){
  302. this.$message({
  303. message: '已收藏',
  304. type: "success",
  305. });
  306. }else{
  307. this.$message({
  308. message: 'Already collected',
  309. type: "success",
  310. });
  311. }
  312. }*/
  313. if (followType == "unfollow") {
  314. if (this.$i18n.locale == "zh") {
  315. this.$message({
  316. message: "取消关注",
  317. type: "success",
  318. });
  319. } else {
  320. this.$message({
  321. message: "Cancel concerned",
  322. type: "success",
  323. });
  324. }
  325. } else {
  326. if (this.$i18n.locale == "zh") {
  327. this.$message({
  328. message: "已关注",
  329. type: "success",
  330. });
  331. } else {
  332. this.$message({
  333. message: "Already concerned",
  334. type: "success",
  335. });
  336. }
  337. }
  338. this.ifcommon = !this.ifcommon;
  339. this.resetToken();
  340. })
  341. .catch((error) => {
  342. // 此处你的业务代码
  343. });
  344. });
  345. }
  346. },
  347. /*handleCurrentChange(val) {
  348. const that = this;
  349. that.currentPage = val;
  350. // if(that.bookImg.fileVisibleStatus == 'Y'){
  351. // that.pageTotal = that.bookImg.fileVisiblePages;
  352. // }
  353. },*/
  354. handleCurrentChangeLeft() {
  355. const that = this;
  356. if (that.currentPage > 1) {
  357. --that.currentPage;
  358. --that.inputPage;
  359. }
  360. },
  361. handleCurrentChangeRight() {
  362. const that = this;
  363. if (
  364. that.currentPage < that.pageTotal &&
  365. that.currentPage < that.fileVisiblePages
  366. ) {
  367. ++that.currentPage;
  368. ++that.inputPage;
  369. }
  370. },
  371. inputPageChange() {
  372. if (0 < this.inputPage - 0 < this.fileVisiblePages - 0) {
  373. this.currentPage = this.inputPage - 0;
  374. } else {
  375. this.inputPage = this.currentPage + "";
  376. }
  377. },
  378. screenChange(item, index) {
  379. this.toView("resourceSharing", item.value);
  380. },
  381. toDevelopmentCooperation() {
  382. this.toView("developmentCooperation");
  383. },
  384. toView(router, json) {
  385. if (router == "login" || router == "Register") {
  386. clearInterval(this.timer);
  387. }
  388. this.$router.push({ name: router, params: { key: json } });
  389. },
  390. getData() {
  391. let that = this;
  392. let param1 = {
  393. pageNo: 1,
  394. pageSize: 1,
  395. language: "",
  396. };
  397. let param2 = {
  398. pageNo: 1,
  399. pageSize: 1,
  400. language: "",
  401. };
  402. if (this.$i18n.locale.toUpperCase() == "ZH") {
  403. param1.language = "ZH";
  404. param2.language = "ZH";
  405. } else if (this.$i18n.locale.toUpperCase() == "EN") {
  406. param1.language = "EN";
  407. param2.language = "EN";
  408. }
  409. if (that.$route.query.key) {
  410. param1.entityId = JSON.parse(that.$route.query.key).entityId;
  411. param2.entityId = JSON.parse(that.$route.query.key).entityId;
  412. }
  413. gateResearchResultViewById(param1).then((resulet) => {
  414. let data = resulet.data;
  415. if (data.baseResearchResultView) {
  416. that.bookContent = data.baseResearchResultView;
  417. that.bookContent.updateDate = that.bookContent.updateDate
  418. ? formatDate(that.bookContent.updateDate, "YYYY-MM-DD")
  419. : "";
  420. that.getDictValue();
  421. }
  422. });
  423. if (that.$route.query.key) {
  424. param2.researchResultFileId = JSON.parse(
  425. that.$route.query.key
  426. ).researchResultFileId;
  427. }
  428. gateResearchResultFileById(param2).then((resulet) => {
  429. let that = this;
  430. let data = resulet.data;
  431. if (data.baseResearchResultFile) {
  432. that.bookImg = data.baseResearchResultFile;
  433. that.bookImg.updateDate = that.bookImg.updateDate
  434. ? formatDate(that.bookContent.updateDate, "YYYY-MM-DD")
  435. : "";
  436. // if(that.bookImg.fileVisibleStatus == 'Y'){
  437. // that.pageTotal = that.bookImg.filePages;
  438. // }else{
  439. // that.pageTotal = that.bookImg.fileVisiblePages;
  440. // }
  441. that.pageTotal = that.bookImg.filePages;
  442. if (that.bookImg.fileVisibleStatus == "Y") {
  443. if (that.bookImg.fileVisiblePages == 0) {
  444. that.fileVisiblePages = that.pageTotal;
  445. } else {
  446. that.fileVisiblePages = that.bookImg.fileVisiblePages;
  447. if (this.$Cookies.get("token")) {
  448. that.isLogin = true;
  449. // let userType = JSON.parse(window.localStorage.getItem('user')).umsUser.userUsertype
  450. // if(userType == "普通用户账号"){
  451. // that.isVip = false;
  452. // console.log(that.bookImg.fileVisiblePages)
  453. // that.fileVisiblePages = that.bookImg.fileVisiblePages;
  454. // }else{
  455. that.isVip = true;
  456. that.fileVisiblePages = that.pageTotal;
  457. // }
  458. } else {
  459. that.isLogin = false;
  460. }
  461. }
  462. } else if (that.bookImg.fileVisibleStatus == "N") {
  463. that.fileVisiblePages = that.pageTotal;
  464. }
  465. }
  466. });
  467. if (this.$Cookies.get("token")) {
  468. that.isLogin = true;
  469. // let userType = JSON.parse(window.localStorage.getItem('user')).umsUser.userUsertype
  470. // if(userType == "普通用户账号"){
  471. // that.isVip = false;
  472. // console.log(that.bookImg.fileVisiblePages)
  473. // that.fileVisiblePages = that.bookImg.fileVisiblePages;
  474. // }else{
  475. that.isVip = true;
  476. that.fileVisiblePages = that.pageTotal;
  477. // }
  478. } else {
  479. that.isLogin = false;
  480. }
  481. },
  482. getDictValue() {
  483. const that = this;
  484. let aa = {
  485. typeCode:
  486. this.$i18n.locale == "zh"
  487. ? "RESEARCH_RESULT_TYPE_DICT"
  488. : "RESEARCH_RESULT_TYPE_DICT_EN",
  489. value: that.bookContent.researchResultType,
  490. };
  491. getDictByTypeValue(aa.typeCode, aa.value).then((resulet) => {
  492. // if (!resulet.data){
  493. // that.getDictValue()
  494. // }
  495. that.bookContent.researchResultType = resulet.data[0].label;
  496. });
  497. },
  498. /*downloads(path,fileName){
  499. const that = this;
  500. if(that.bookContent.securityStatus == 'N'){
  501. if(this.$Cookies.get('token')){
  502. let user = window.localStorage.getItem("user");
  503. var users = JSON.parse(user);
  504. var userId = users.userId;
  505. if(that.bookContent.informationVisibleStatus=='Y'){
  506. if(users.umsUser.userUsertype=="普通用户账号"){
  507. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  508. this.$message({
  509. message: '该文件仅供会员可下载',
  510. type: 'warning'
  511. });
  512. } else {
  513. // alert('This file is not supported for download');
  514. this.$message({
  515. message: 'This document is downloadable by members only',
  516. type: 'warning'
  517. });
  518. }
  519. }else{
  520. const link = document.createElement('a');
  521. link.href = "api/file/pub/" + this.bookContent.researchResultFile;
  522. link.download = this.bookContent.name; //下载的文件名
  523. link.click();
  524. }
  525. }else{
  526. const link = document.createElement('a');
  527. link.href = "api/file/pub/" + this.bookContent.researchResultFile;
  528. link.download = this.bookContent.name; //下载的文件名
  529. link.click();
  530. }
  531. }else{
  532. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  533. // alert('该文件暂不支持下载');
  534. this.$message({
  535. message: '请登录后下载',
  536. type: 'warning'
  537. });
  538. } else {
  539. // alert('This file is not supported for download');
  540. this.$message({
  541. message: 'Please log in and download',
  542. type: 'warning'
  543. });
  544. }
  545. }
  546. }else{
  547. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  548. // alert('该文件暂不支持下载');
  549. this.$message({
  550. message: '该文件暂不支持下载',
  551. type: 'warning'
  552. });
  553. } else {
  554. // alert('This file is not supported for download');
  555. this.$message({
  556. message: 'This file is not supported for download',
  557. type: 'warning'
  558. });
  559. }
  560. }
  561. },*/
  562. downloads(path, fileName) {
  563. const that = this;
  564. //资源是否保密
  565. if (that.bookContent.securityStatus == "N") {
  566. /*if(that.bookContent.fileVisibleStatus == 'N'){
  567. that.downfile();
  568. }else{
  569. if(this.$Cookies.get('token')){
  570. let user = window.localStorage.getItem("user");
  571. let users = JSON.parse(user);
  572. let userId = users.userId;
  573. that.downfile();
  574. }else{
  575. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  576. this.$message({
  577. message: '请登录后下载',
  578. type: 'warning'
  579. });
  580. } else {
  581. // alert('This file is not supported for download');
  582. this.$message({
  583. message: 'Please log in and download',
  584. type: 'warning'
  585. });
  586. }
  587. }
  588. }*/
  589. if (this.$Cookies.get("token")) {
  590. let user = window.localStorage.getItem("user");
  591. let users = JSON.parse(user);
  592. let userId = users.userId;
  593. that.downfile();
  594. } else {
  595. if (this.$i18n.locale.toUpperCase() == "ZH") {
  596. this.$message({
  597. message: "请登录后下载",
  598. type: "warning",
  599. });
  600. } else {
  601. // alert('This file is not supported for download');
  602. this.$message({
  603. message: "Please log in and download",
  604. type: "warning",
  605. });
  606. }
  607. }
  608. } else {
  609. if (this.$i18n.locale.toUpperCase() == "ZH") {
  610. // alert('该文件暂不支持下载');
  611. this.$message({
  612. message: "该文件暂不支持下载",
  613. type: "warning",
  614. });
  615. } else {
  616. // alert('This file is not supported for download');
  617. this.$message({
  618. message: "This file is not supported for download",
  619. type: "warning",
  620. });
  621. }
  622. }
  623. this.downloadMinusIntegral()
  624. },
  625. downfile() {
  626. const that = this;
  627. // if(that.bookContent.researchResultFile){
  628. const link = document.createElement("a");
  629. console.log("pdf");
  630. console.log(that.bookContent.researchResultFile);
  631. link.href = "api/file/pub/" + this.bookContent.researchResultFile;
  632. link.download = this.bookContent.name; //下载的文件名
  633. link.click();
  634. /*if(users.umsUser.userUsertype=="普通用户账号"){
  635. const link = document.createElement('a');
  636. link.href = "api/file/pub/" + this.bookContent.researchResultFile;
  637. link.download = this.bookContent.name; //下载的文件名
  638. link.click();
  639. }else{
  640. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  641. // alert('该文件暂不支持下载');
  642. this.$message({
  643. message: '该文件仅供会员可下载',
  644. type: 'warning'
  645. });
  646. } else {
  647. // alert('This file is not supported for download');
  648. this.$message({
  649. message: 'This document is downloadable by members only',
  650. type: 'warning'
  651. });
  652. }
  653. }*/
  654. // }else{
  655. // if (this.$i18n.locale.toUpperCase() == 'ZH') {
  656. // this.$message({
  657. // message: '暂无文件',
  658. // type: 'warning'
  659. // });
  660. // } else {
  661. // // alert('This file is not supported for download');
  662. // this.$message({
  663. // message: 'No file',
  664. // type: 'warning'
  665. // });
  666. // }
  667. // }
  668. },
  669. toLogin() {
  670. this.toView("login");
  671. },
  672. toView(router, json) {
  673. this.$router.push({ name: router, params: { key: json } });
  674. },
  675. // 判断未登录跳转是否关闭
  676. toViewLoginChange(done) {
  677. this.toViewLogin = false;
  678. this.num = 5;
  679. clearInterval(this.timer);
  680. },
  681. loginTipsChange() {
  682. const that = this;
  683. this.num = 5;
  684. // clearInterval(timer_interval);
  685. this.timer = setInterval(function () {
  686. if (that.num > 0) {
  687. that.num--;
  688. } else {
  689. if (that.toViewLogin == true) {
  690. clearInterval(that.timer);
  691. that.toView("login");
  692. } else {
  693. clearInterval(that.timer);
  694. }
  695. }
  696. }, 1000);
  697. },
  698. },
  699. };
  700. </script>
  701. <style scoped>
  702. .pointer:hover {
  703. cursor: pointer;
  704. }
  705. .box {
  706. margin-top: 10px;
  707. background: #fff;
  708. /* height: 500px; */
  709. padding: 20px 0;
  710. }
  711. .crumbs {
  712. margin: 0 20px;
  713. }
  714. .secNavActive {
  715. color: #0091ff;
  716. }
  717. .mainBody {
  718. width: 100%;
  719. margin-top: 10px;
  720. box-sizing: border-box;
  721. }
  722. .bottomPage button:active {
  723. border-color: #0ab8ed;
  724. outline: 1px solid #0ab8ed;
  725. }
  726. .bottomPage button:focus {
  727. border-color: #0ab8ed;
  728. outline: 1px solid #0ab8ed;
  729. }
  730. .bottomPage input:focus {
  731. outline: none;
  732. border: none;
  733. box-shadow: none;
  734. }
  735. </style>