123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898 |
- <template>
- <view class="rf-category" style="position: relative;">
- <u-toast ref="uToast" />
- <view style="">
- <!--搜索导航栏-->
- <view class="icoStyle">
- <!--<view class="leftArrow" @tap="back">
- <u-icon name="arrow-left" color="#fff" size="36"></u-icon>
- </view>
- <view style="width:90%;height:99upx">
- <rf-search-bar @search="navToSearch" icon="iconkuaijiecaidan" />
- </view>-->
- <u-navbar :back-text="i18n('Back')" :title="i18n('ResearchResults')+i18n('resourceDetails')"
- :background="barBackground" back-icon-color="white" title-color="white"
- :back-text-style="backStyle">
- <view slot="right" style="margin-right:20upx">
- <u-icon name="share-fill" style="margin-right: 30upx;" color="white" size="50" @click="share">
- </u-icon>
- </view>
- </u-navbar>
- </view>
- <view class="content">
- <!--信息-->
- <view style="width: 100%;height: 320upx;margin-top: 10upx;padding: 20upx;background-color: white;">
- <view style="width: 218upx;height: 280upx;float: left;">
- <image
- v-if="details.researchResultCover!='null'&&details.researchResultCover!=null&&details.researchResultCover!=''&&details.researchResultCover!=undefined"
- :src="websiteUrl+details.researchResultCover" mode="" style="width: 100%;height: 100%;">
- </image>
- <image v-else src="@/static/img/resourceSharing/backImage.png" mode=""
- style="width: 100%;height: 100%;"></image>
- </view>
- <view style="width: 452upx;height: 100%;float: left;position: relative;margin-left: 27upx;">
- <view v-show="details.name">
- <text style="font-size: 30upx; color: #0B0B11;" class="fourLine">
- {{details.name}}
- </text>
- </view>
- <view style="margin-top: 13upx;" v-show="details.researchResultType">
- <text style="font-size: 26upx; padding: 0 13upx; border: 2px solid #1777FE;
- display: inline-block;border-radius: 32upx;color: #1777FE;">
- {{details.researchResultType}}
- </text>
- </view>
- </view>
- <view style="clear: both;"></view>
- </view>
- <!--摘要-->
- <view style="padding: 0 20upx;" v-show="details.researchResultAbstract">
- <!--摘要 >> 标题-->
- <view style="height: 102upx;padding: 20upx 0">
- <view style="height: 30upx;width: 10upx;margin-top: 6upx;background-color: #6DD400;float: left">
- </view>
- <view style="height: 100%;float: left;margin-left: 15upx;">
- <text
- style="font-size: 30upx;color: #0B0B11;line-height: 42upx;">{{i18n('resourceAbstract')}}</text>
- </view>
- <view style="clear: both;"></view>
- </view>
- <!--摘要 >> 正文-->
- <view style="padding:0 0 30upx 0">
- <text>{{details.researchResultAbstract}}</text>
- </view>
- </view>
- <!--目录-->
- <view style="padding: 0 20upx;margin-top: 30upx"
- v-show="details.resourceDirectory!=''&&details.resourceDirectory!=null&&details.resourceDirectory!='null'&&details.resourceDirectory!=undefined">
- <!--目录 >> 标题-->
- <view style="height: 42upx;">
- <view style="height: 30upx;width: 10upx;margin-top: 6upx;background-color: #6DD400;float: left">
- </view>
- <view style="height: 100%;float: left;margin-left: 15upx;">
- <text
- style="font-size: 30upx;color: #0B0B11;line-height: 42upx;">{{i18n('resourceDirectory')}}</text>
- </view>
- </view>
- <!--目录 >> 正文-->
- <view style="width: 100%;">
- <view>
- <image src="" mode="" style="width: 100%"></image>
- </view>
- </view>
- </view>
- <!--预览-->
- <view style="padding: 0 20upx;margin-top: 30upx">
- <view style="width: 100%;">
- <view style="width: 100%" v-for="(item,index) in moreImgShow-0" :key="index">
- <image :src="websiteUrl+ bookImg.fileAddress + '/' + item +'.png'" mode="widthFix"
- style="width: 100%;"></image>
- </view>
- </view>
- <view style="width: 100%;height: 72upx;padding-bottom: 30upx" v-show="reading">
- <view style="text-align: center;cursor: pointer;">
- <text
- style="font-size: 30upx;color: #0091FF;line-height: 42upx;margin-right: 15upx;cursor: pointer;"
- @click="fileProcessingReading">
- {{$i18n.locale=='zh'?'继续阅读':'Continue reading'}}
- </text>
- <u-icon name="arrow-down" color="#0091FF" size="30" style="cursor: pointer;"
- @click="fileProcessingReading"></u-icon>
- </view>
- </view>
- <view style="width: 100%;height: 72upx;padding-bottom: 30upx" v-show="more">
- <view style="text-align: center;" class="readEnd">
- <text
- style="font-size: 30upx;color: #0091FF;line-height: 42upx;margin-right: 15upx;cursor: pointer;"
- @click="fileProcessingEnd">
- {{$i18n.locale=='zh'?'试读结束':'End trial'}}
- </text>
- </view>
- </view>
- </view>
- </view>
- <view class="recommend">
- <view style="width: 100%;height: 83upx;padding: 0 30upx;">
- <text style="font-size: 26upx;font-weight: 600;line-height: 83upx;color: #333333;">
- {{$i18n.locale=='zh'?'相关成果':'related recommendation'}}
- </text>
- </view>
- <!-- 列表 -->
- <view style="width: 100%;">
- <view style="width: 100%;">
- <view v-for="(item,index) in recommendList" :key="index"
- style="width: 100%;height: 340upx;margin-bottom: 20upx;padding: 30upx;background-color: white;"
- @click="toDetaile(item.entityId)">
- <view
- style="width: 218upx;height: 280upx;float: left;border: 1px solid #979797;margin-right: 20upx">
- <image
- v-if="item.researchResultCover!='null'&&item.researchResultCover!=null&&item.researchResultCover!=''&&item.researchResultCover!=undefined"
- :src="websiteUrl+item.researchResultCover" mode=""
- style="width: 100%;height: 100%;"></image>
- <image v-else src="@/static/img/resourceSharing/backImage.png" mode=""
- style="width: 100%;height: 100%;"></image>
- </view>
- <view style="width: 452upx;height: 100%;float: left;position: relative;">
- <view>
- <text style="font-size: 30upx; color: #0B0B11;" class="twoLine">
- {{item.name}}
- </text>
- </view>
- <view style="margin-top: 13upx;">
- <text style="font-size: 26upx; padding: 0 13upx; border: 2px solid #1777FE;
- display: inline-block;border-radius: 32upx;color: #1777FE;">
- {{item.researchResultType}}
- </text>
- </view>
- <view v-show="item.informationVisibleStatus=='Y'" style="margin-top: 13upx;">
- <text style="font-size: 26upx; padding: 0 13upx; display: inline-block;
- border-radius: 12upx;background-color: rgba(61,127,255,0.1);color: #3D7FFF;">
- {{i18n('resourcevip')}}
- </text>
- </view>
- <view style="position: absolute;bottom: 0;width: 100%;height: 35upx;color: #666;">
- <view style="float: left;height: 100%">
- <text style="font-size: 28upx;">{{item.createDate}}</text>
- </view>
- <view style="float: right;">
- <view style="float: left;font-size: 28upx;font-weight: 400;">
- <u-icon name="heart" color="#848485" size="28" style="margin-right: 6upx">
- </u-icon>
- <text style="color: #666;">
- {{item.num=='null'?'0':item.num}}
- </text>
- </view>
- <!--<view style="float: left;font-size: 28upx;font-weight: 400;margin-left: 70upx;">
- <u-icon name="arrow-right" color="#848485" size="28" style="margin-right: 6upx"></u-icon>
- <text style="color: #666;">
- 888
- </text>
- </view>-->
- </view>
- <view style="clear: both;"></view>
- </view>
- </view>
- <view style="clear: both;"></view>
- </view>
- <view style="margin-top: 20rpx;">
- <u-loadmore :status="status" :load-text="loadText" />
- </view>
- </view>
- </view>
- </view>
- <rf-back-top :scrollTop="scrollTop"></rf-back-top>
- </view>
- <view>
- <u-popup v-model="popupShow" mode="center" border-radius="24" width="610upx" heigth="446upx">
- <view>
- <view style="text-align: center;">
- <view style="margin-top: 72upx;">
- <u-icon name="warning" color="#FFA033" size="60"></u-icon>
- </view>
- <view style="color: #333333;font-size: 32upx;font-weight: 500;margin-top: 24upx;">
- <text>{{$i18n.locale=='zh'?'会员专享 免费下载':'Free download for members only'}}</text>
- </view>
- <view style="color: #999999;font-size: 28upx;font-weight: 400;margin-top: 24upx;">
- <text>{{$i18n.locale=='zh'?'实时查看最新项目资源':'View the latest project resources in real time'}}</text>
- </view>
- <view style="color: #999999;font-size: 28upx;font-weight: 400;">
- <text>{{$i18n.locale=='zh'?'允许下载最新资源成果':'Allows you to download the latest resource results'}}</text>
- </view>
- <view style="margin-top: 52upx;display: flex;">
- <view
- style="width: 304upx;height: 84upx;border: 1px solid #E6E9ED;flex: 1;text-align: center;">
- <text style="line-height: 84upx;color: #999999;cursor: pointer;"
- @click="popupShow=false">{{$i18n.locale=='zh'?'稍后考虑':'Consider later'}}</text>
- </view>
- <view
- style="width: 304upx;height: 84upx;border: 1px solid #E6E9ED;flex: 1;text-align: center;">
- <text style="line-height: 84upx;color: #3D7FFF;cursor: pointer;"
- @click="toRgister">{{$i18n.locale=='zh'?'注册会员':'Register member'}}</text>
- </view>
- </view>
- </view>
- </view>
- </u-popup>
- </view>
- <!-- 8.8.20.112:19001 -->
- <share v-show="ifShare == true" :show="ifShare" @closeShare="share"
- :title="i18n('ResourceSharing') + '->' + i18n('resource')"
- :summary="details.researchResultAbstract ? details.researchResultAbstract:i18n('ResourceSharing')+i18n('resource')"
- :href="'https://m.geidcp.com/#/pages/resourceSharing/resourceInfoDetail/resourceInfoDetail?' + 'entityId=' + entityId + '&language=' + $i18n.locale"
- :imageUrl="bannerImg && bannerImg[0]?' bannerImg[0]':'https://geidcp.com/api/file/pub/defaultCutPic/shareLogo.png'">
- </share>
- <!-- #ifdef H5 -->
- <rf-back-home></rf-back-home>
- <!-- #endif -->
- <u-tabbar v-model="current" :list="bottombar" inactive-color="#B3BCCC" active-color="#4E79ED"
- @change="bottombarChange"></u-tabbar>
- </view>
- </template>
- <script>
- import rfSearchBar from '@/components/rf-search-bar';
- import qs from 'qs'
- import share from '@/components/share'
- export default {
- data() {
- return {
- // bar
- bannerImg: [],
- ifShare: false,
- barBackground: {
- backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
- },
- backStyle: {
- color: '#fff'
- },
- //
- entityId: '',
- details: {},
- recommendList: [],
- pageNo: 0,
- totalPage: 1,
- status: 'loading',
- isLoading: true,
- loadText: {
- loading: this.$i18n.locale == 'zh' ? '加载中' : 'Loading',
- nomore: this.$i18n.locale == 'zh' ? '没有更多数据了' : 'No more'
- },
- // 预览
- isVip: false,
- isLogin: false,
- reading: false,
- more: false,
- pageTotal: '',
- fileVisiblePages: 0,
- bookImg: '',
- moreImgShow: '',
- // 返回顶部
- scrollTop: 0,
- // 字典
- classify1: '',
- classify2: '',
- // 用户信息
- Storage_data: '',
- AuthToken: '',
- // 收藏
- ifcommon: false,
- // 底部导航栏
- current: 2,
- bottombar: [{
- iconPath: "heart-fill",
- selectedIconPath: "heart-fill",
- text: '',
- isDot: false,
- customIcon: false,
- },
- /*{
- iconPath: "share-fill",
- selectedIconPath: "share-fill",
- text: '',
- isDot: false,
- customIcon: false,
- },
- {
- iconPath: "download",
- selectedIconPath: "download",
- text: '',
- isDot: false,
- customIcon: false,
- },*/
- ],
- //
- popupShow: false,
- }
- },
- components: {
- rfSearchBar,
- share
- },
- onLoad: function(options) {
- this.entityId = options.entityId;
- console.log(this.entityId, '你好啊');
- if (options.language) {
- uni.setStorageSync("language", options.language);
- this._i18n.locale = options.language;
- }
- },
- onPageScroll(e) {
- this.scrollTop = e.scrollTop;
- },
- onReachBottom() { //页面拉到底部加载
- if (this.isLoading) {
- this.getDataList();
- }
- },
- async onShow() {
- this.popupShow = false;
- this.isVip = false;
- this.isLogin = false;
- this.reading = false;
- this.more = false;
- this.recommendList = [];
- this.details = {};
- this.bottombarInit()
- await this.getDict();
- await this.getData();
- await this.getFile();
- await this.getDataList();
- await this.getMyCollecModel();
- },
- watch: {
- current() {
- this.current = 2;
- },
- ifcommon() {
- this.bottombarInit()
- },
- },
- computed: {
- token() {
- return 'Bearer ' + uni.getStorageSync('Auth-Token');
- }
- },
- methods: {
- share() {
- this.ifShare = !this.ifShare;
- },
- async getDict() {
- this.AuthToken = uni.getStorageSync('Auth-Token');
- if (this.AuthToken) {
- this.Storage_data = JSON.parse(uni.getStorageSync('user'));
- } else {
- this.popupShow = true;
- }
- const res = await this.$myRequest({
- url: '/sys/sysDicts',
- data: {
- type: this.$i18n.locale == "zh" ?
- 'RESEARCH_RESULT_TYPE_DICT,RESEARCH_RESOURCE_TYPE_DICT' :
- 'RESEARCH_RESULT_TYPE_DICT_EN,RESEARCH_RESOURCE_TYPE_DICT_EN',
- }
- });
- if (res.data) {
- let both = {
- label: this.$t('common.All'),
- value: null
- };
- this.classify1 = res.data[0];
- this.classify2 = res.data[1];
- this.classify1.unshift(both);
- this.classify2.unshift(both);
- }
- },
- async getData() {
- const that = this;
- let params = {
- entityId: this.entityId,
- pageNo: '',
- pageSize: '',
- language: this.$i18n.locale.toUpperCase(),
- researchResultFileId: '',
- reserveTwo: 'Y',
- };
- const res = await this.$myRequest({
- url: '/resourceshare/baseResearchResultViews/gateBaseResearchResultView',
- data: {
- ...params
- }
- })
- if (res.data && res.data.baseResearchResultView) {
- that.details = res.data.baseResearchResultView;
- that.details.updateDate = that.details.updateDate ? this.formatDate(that.details.updateDate,
- "YYYY-MM-DD") : "";
- if (that.details.researchResultCover) {
- that.details.researchResultCover = that.details
- .researchResultCover;
- }
- for (let o = 0; o < that.classify1.length; o++) {
- if (that.details.researchResultType == that.classify1[o].value) {
- that.details.researchResultType = that.classify1[o].label;
- }
- }
- }
- },
- async getFile() {
- const that = this;
- let params = {
- pageNo: 1,
- pageSize: 1,
- language: '',
- researchResultFileId: that.details.researchResultFileId
- }
- if (this.$i18n.locale.toUpperCase() == 'ZH') {
- params.language = 'ZH';
- } else if (this.$i18n.locale.toUpperCase() == 'EN') {
- params.language = 'EN';
- }
- const res = await this.$myRequest({
- url: '/resourceshare/baseResearchResultViews/gateResearchResultFile',
- data: {
- ...params
- }
- })
- if (res.data && res.data.baseResearchResultFile !== '无数据') {
- that.bookImg = res.data.baseResearchResultFile;
- that.bookImg.updateDate = that.bookImg.updateDate ? that.formatDate(that.bookImg.updateDate,
- "YYYY-MM-DD") : "";
- that.pageTotal = that.bookImg.filePages;
- if (that.bookImg.fileVisibleStatus == 'Y') {
- if (that.bookImg.fileVisiblePages == 0) {
- that.fileVisiblePages = that.pageTotal;
- } else {
- that.fileVisiblePages = that.bookImg.fileVisiblePages;
- if (that.AuthToken) {
- that.isLogin = true;
- // let userType = JSON.parse(window.localStorage.getItem('user')).umsUser.userUsertype
- // if(userType == "普通用户账号"){
- // that.isVip = false;
- // console.log(that.bookImg.fileVisiblePages)
- // that.fileVisiblePages = that.bookImg.fileVisiblePages;
- // }else{
- that.isVip = true;
- that.fileVisiblePages = that.pageTotal;
- // }
- } else {
- that.isVip = false;
- that.isLogin = false;
- }
- }
- } else if (that.bookImg.fileVisibleStatus == 'N') {
- that.fileVisiblePages = that.pageTotal;
- }
- console.log(that.bookImg)
- console.log(typeof that.bookImg)
- that.bookImg.fileAddress = that.bookImg.fileAddress.replace('\\', '/');
- } else {
- this.status = 'nomore'
- }
- this.fileProcessing()
- },
- // 无会员体系预览判断
- async fileProcessing() {
- if (this.bookImg) {
- if (this.isLogin) {
- if (this.pageTotal > 4) {
- this.reading = true;
- this.moreImgShow = 5;
- } else {
- this.moreImgShow = this.pageTotal;
- }
- } else {
- if (this.fileVisiblePages < 5) {
- this.more = true;
- this.moreImgShow = this.fileVisiblePages;
- } else {
- this.reading = true;
- this.moreImgShow = 5;
- }
- }
- }
- console.log(this)
- },
- // 暂时弃用
- /*async fileProcessing(){
- if (this.bookImg){
- if(this.fileVisiblePages < 5){
- if(this.bookImg.fileVisiblePages < this.pageTotal){
- if(this.isVip){
- this.reading = true;
- }else{
- this.more = true;
- }
- }
- this.moreImgShow = this.fileVisiblePages;
- }else{
- if(this.fileVisiblePages < this.pageTotal){
- if(this.isVip){
- this.reading = true;
- }else{
- this.more = true;
- }
- }
- this.moreImgShow = 5;
- }
- }
- },*/
- fileProcessingReading() {
- console.log("this.isLogin",this.isLogin);
- if (this.isLogin) {
- this.moreImgShow = this.pageTotal;
- } else {
- this.moreImgShow = this.fileVisiblePages;
- }
- this.reading = false;
- },
- fileProcessingEnd() {
- this.popupShow = true;
- },
- async getDataList() {
- const that = this;
- let params = {
- pageNo: '',
- pageSize: 10,
- language: this.$i18n.locale.toUpperCase(),
- status: 0,
- descStatus: 0,
- reserveTwo: 'Y',
- }
- if (this.pageNo >= this.totalPage) {
- this.isLoading = false;
- this.status = 'nomore';
- } else {
- this.isLoading = true;
- this.pageNo++;
- params.pageNo = this.pageNo;
- const res = await this.$myRequest({
- url: '/resourceshare/baseResearchResultViews/',
- data: {
- ...params
- }
- })
- if (res.data) {
- let data = res.data.baseResearchResultViews;
- data.forEach((i) => {
- i.createDate = i.createDate ? this.formatDate(i.createDate, "YYYY-MM-DD") : "";
- })
- for (let i = 0; i < data.length; i++) {
- for (let o = 0; o < that.classify1.length; o++) {
- if (data[i].researchResultType == that.classify1[o].value) {
- data[i].researchResultType = that.classify1[o].label;
- }
- }
- }
- that.recommendList = [...that.recommendList, ...data]
- this.totalPage = res.data.page.totalPage;
- if (that.totalPage == 1) {
- this.isLoading = false;
- this.status = 'nomore';
- }
- let flag = false;
- for (let j = 0; j < that.recommendList.length; j++) {
- if (that.recommendList[j].name == that.details.name) {
- flag = j;
- }
- }
- if (flag === 0 || flag != false) {
- that.recommendList.splice(flag, 1)
- }
- }
- }
- },
- //收藏
- async getMyCollecModel() {
- const that = this;
- if (this.AuthToken) {
- var users = this.Storage_data;
- let MyCollecModel = {
- modelType: 'researchResult',
- userId: users.userId,
- modelEntityId: this.entityId,
- }
- const res = await this.$myRequest({
- url: '/op/basePortalModelFollowInfos/followModelStatusByModelIdAndUserId',
- data: {
- modelId: this.entityId,
- modelType: 'researchResult',
- userId: users.id,
- },
- });
- if (res) {
- this.ifcommon = res.data;
- }
- }
- },
- shareChange() {
- if (this.ifcommon) {
- this.saveFollowModelDo("unfollow");
- } else {
- this.saveFollowModelDo("follow");
- }
- },
- // ***** 关注操作方法
- async saveFollowModelDo(followType) {
- if (!this.AuthToken) {
- // 登录
- } else {
- var users = this.Storage_data;
- let MyCollecModel = {
- followType: followType,
- modelId: this.entityId,
- modelType: 'researchResult',
- userId: users.id,
- }
- const res = await this.$myRequest({
- url: '/op/basePortalModelFollowInfos/followModel',
- method: 'post',
- headers: {
- token: this.token
- },
- data: {
- followType: followType,
- modelId: this.entityId,
- modelType: 'researchResult',
- userId: users.id,
- }
- });
- if (res) {
- if (followType == 'unfollow') {
- if (this.$i18n.locale == 'zh') {
- this.$refs.uToast.show({
- title: '取消关注',
- type: 'success',
- })
- } else {
- this.$refs.uToast.show({
- title: 'Cancel concerned',
- type: 'success',
- })
- }
- } else {
- if (this.$i18n.locale == 'zh') {
- this.$refs.uToast.show({
- title: '已关注',
- type: 'success',
- })
- } else {
- this.$refs.uToast.show({
- title: 'Already concerned',
- type: 'success',
- })
- }
- }
- this.ifcommon = !this.ifcommon;
- }
- }
- },
- toDetaile(entityId) {
- uni.redirectTo({
- url: `/pages/resourceSharing/resourceInfoDetail/resourceInfoDetail?entityId=${entityId}`,
- });
- },
- // 底部bar事件
- bottombarInit() {
- this.bottombar[0].text = this.$i18n.locale == 'zh' ? (this.ifcommon === true ? "已关注" : "关注") : (this
- .ifcommon === true ? "Concerned" : " Follow")
- // this.bottombar[1].text = this.i18n('resourceDetailsShare')
- // this.bottombar[2].text = this.i18n('resourceDetailsDownload')
- },
- bottombarChange(index) {
- if (index == 0) {
- // 收藏
- if (this.AuthToken) {
- this.shareChange()
- } else {
- if (this.$i18n.locale == 'zh') {
- this.$refs.uToast.show({
- title: '请登录',
- type: 'warning',
- url: '/pages/public/login',
- params: {
- back: 1
- }
- })
- } else {
- this.$refs.uToast.show({
- title: 'please log in',
- type: 'warning',
- url: '/pages/public/login',
- params: {
- back: 1
- }
- })
- }
- }
- } else if (index == 1) {
- // 分享
- } else if (index == 2) {
- // 下载
- const that = this;
- if (this.AuthToken) {
- if (that.AuthToken) {
- this.Download()
- } else {
- if (this.$i18n.locale.toUpperCase() == 'ZH') {
- this.$refs.uToast.show({
- title: '该文件暂不支持下载',
- type: 'warning',
- })
- } else {
- this.$refs.uToast.show({
- title: 'This file is not supported for download',
- type: 'warning',
- })
- }
- }
- } else {
- if (this.$i18n.locale == 'zh') {
- this.$refs.uToast.show({
- title: '请登录',
- type: 'warning',
- url: '/pages/public/login',
- params: {
- back: 1
- }
- })
- } else {
- this.$refs.uToast.show({
- title: 'please log in',
- type: 'warning',
- url: '/pages/public/login',
- params: {
- back: 1
- }
- })
- }
- }
- }
- },
- Download() {
- let pdfUrl = this.details.researchResultFile;
- uni.downloadFile({
- url: 'https://m.geidcp.com/api/file/pub/' + pdfUrl, //下载地址接口返回
- success: (data) => {
- if (data.statusCode === 200) {
- //文件保存到本地
- uni.saveFile({
- tempFilePath: data.tempFilePath, //临时路径
- success: function(res) {
- uni.showToast({
- icon: 'none',
- mask: true,
- title: '文件已保存:' + res.savedFilePath, //保存路径
- duration: 3000,
- });
- setTimeout(() => {
- //打开文档查看
- uni.openDocument({
- filePath: res.savedFilePath,
- success: function(res) {
- // console.log('打开文档成功');
- }
- });
- }, 3000)
- }
- });
- }
- },
- fail: (err) => {
- console.log(err);
- uni.showToast({
- icon: 'none',
- mask: true,
- title: '失败请重新下载',
- });
- },
- });
- },
- back() {
- uni.navigateBack();
- },
- toRgister() {
- this.$mRouter.push({
- route: `/pages/public/login?back=1`,
- });
- },
- //中英文切换
- i18n(data) {
- return this.$t('common.' + data);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .rf-category {
- background-color: #F3F4F5;
- /* #ifdef APP-PLUS */
- /*margin-top: calc(20upx + var(--status-bar-height));*/
- /* #endif */
- .icoStyle {
- display: flex;
- align-items: center;
- .leftArrow {
- width: 36upx;
- height: 36upx;
- position: fixed;
- z-index: 99;
- /* #ifdef APP-PLUS */
- padding-top: calc(20upx + var(--status-bar-height));
- /* #endif */
- }
- }
- .content {
- background-color: white;
- .readEnd {
- position: relative;
- &::before {
- content: "";
- position: absolute;
- left: 0;
- top: 50%;
- width: 255upx;
- height: 1upx;
- background-color: #979797;
- }
- &::after {
- content: "";
- position: absolute;
- right: 0;
- top: 50%;
- width: 255upx;
- height: 1upx;
- background-color: #979797;
- }
- }
- }
- .recommend {
- background-color: white;
- margin-top: 20upx;
- width: 100%;
- }
- .oneLine {
- /* 隐藏溢出元素 */
- overflow: hidden;
- /* 单行显示 */
- white-space: nowrap;
- /* 溢出显示省略号 */
- text-overflow: ellipsis;
- }
- .twoLine {
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .threeLine {
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 3;
- -webkit-box-orient: vertical;
- }
- .fourLine {
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 4;
- -webkit-box-orient: vertical;
- }
- }
- </style>
|