<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>
