<template>
	<div>
		<div class="autoBox box">
			<div class="crumbs">
				<el-breadcrumb separator="/">
					<el-breadcrumb-item :to="{ path: 'home' }"
						>{{ $t('common.Home') }}
					</el-breadcrumb-item>
					<el-breadcrumb-item :to="{ path: 'enterprise' }"
						>{{ $t('common.EnterpriseShow') }}
					</el-breadcrumb-item>
					<el-breadcrumb-item>{{ enterpriseDetails }}</el-breadcrumb-item>
				</el-breadcrumb>
			</div>
			<div
				style="
					width: 100%;
					height: 450px;
					position: relative;
					border-bottom: 1px solid #ccc;
				"
			>
				<div class="swipers">
					<div class="swiper-container gallery-top">
						<div class="swiper-wrapper">
							<div
								class="swiper-slide"
								v-for="(i, index) in img"
								v-if="img.length > 0"
							>
								<img
									:src="'api/file/pub/' + i"
									alt
									style="width: 100%; height: 100%"
								/>
							</div>
							<div class="swiper-slide" v-if="img.length == 0">
								<img
									:src="'api/file/pub/' + '/def/def1.png'"
									alt
									style="width: 100%; height: 100%"
								/>
							</div>
						</div>
						<div class="swiper-button-next swiper-button-white"></div>
						<div class="swiper-button-prev swiper-button-white"></div>
					</div>
					<div class="swiper-container gallery-thumbs">
						<div class="swiper-wrapper">
							<div
								class="swiper-slide"
								v-for="(i, index) in img"
								v-if="img.length > 0"
							>
								<img
									:src="'api/file/pub/' + i"
									alt
									style="width: 100%; height: 100%"
								/>
							</div>
							<div class="swiper-slide" v-if="img.length == 0">
								<img
									:src="'api/file/pub/' + '/def/def1.png'"
									alt
									style="width: 100%; height: 100%"
								/>
							</div>
						</div>
					</div>
					<div
						style="
							float: right;
							color: #666;
							font-size: 14px;
							margin-right: 20px;
						"
					>
						<!--            <span class="share cursor" :style="ifcommon?'color: #66b1ff;':''"-->
						<!--                style="margin-right: 20px;" @click="shareChange()">-->
						<!--                <i class="el-icon-star-off" :style="ifcommon?'color: #66b1ff;':''"> </i>-->
						<!--                {{ifcommon?$t('common.companyAttentioned'):$t('common.Focusonthecompany')}}-->
						<!--            </span>-->
						<!-- <span class="share cursor btn" :data-clipboard-text="url" @click="copy">
								<i class="el-icon-share"> </i>
								{{$t('common.ShareProject')}}
						</span> -->
					</div>
				</div>

				<div class="details">
					<div
						style="width: 100%; font-size: 16px"
						@click="toView('enterpriseDetails', item.label)"
					>
						<div>
							<span class="initData_label cursor">{{ initData.unitName }}</span>
							<span
								style="
									margin-left: 150px;
									padding: 10px;
									background: #ff0033;
									color: #fff;
									font-weight: 700;
								"
								v-if="initData.recommendFlag == 1"
								>{{ $t('common.RecommendedEnterprise') }}
							</span>
						</div>
						<div style="line-height: 40px">
							<div>
								<span>
									<i class="el-icon-location-outline"></i>
									{{
										$i18n.locale === 'zh'
											? initData.unitCountry
											: initData.unitCountryDict.charAt(0).toUpperCase() +
											  initData.unitCountryDict.slice(1)
									}}
									<span v-show="initData.unitRegion">-</span
									>{{ initData.unitRegion }}
								</span>
							</div>
							<!--                  <div>-->
							<!--                    &lt;!&ndash; <span>-->
							<!--                      <i class="fa fa-jpy" aria-hidden="true"></i>-->
							<!--                      {{$t('common.RegisteredCapital')}}:{{initData.registerMoney}}-->
							<!--                    </span> &ndash;&gt;-->
							<!--                    <i class="el-icon-time"></i>-->
							<!--                    <span >-->
							<!--                      {{$t('common.DateOfEstablishment')}}:{{formatDate(initData.setUpDate) }}-->
							<!--                    </span>-->
							<!--                  </div>-->
						</div>

						<div style="line-height: 40px">
							<span>
								<i class="fa fa-envelope-open-o" aria-hidden="true"></i>
								{{ $t('common.ProductInformation') }}
								<span style="color: #0099ff; padding: 0 3px"
									>(
									<a href="#unitScope">{{
										UnitTypeNumber[1] ? UnitTypeNumber[1] : '0'
									}}</a>
									)</span
								>
								{{ $t('common.CoreTechnology') }}
								<span style="color: #0099ff; padding: 0 3px"
									>(
									<a href="#information02">{{
										UnitTypeNumber[2] ? UnitTypeNumber[2] : '0'
									}}</a>
									)</span
								>
								{{ $t('common.ProjectPerformance') }}
								<span style="color: #0099ff; padding: 0 3px"
									>(
									<a href="#information03">{{
										UnitTypeNumber[3] ? UnitTypeNumber[3] : '0'
									}}</a>
									)</span
								>
								{{ $t('common.ScopeBusiness') }}
								<span style="color: #0099ff; padding: 0 3px"
									>(
									<a href="#information04">{{
										UnitTypeNumber[4] ? UnitTypeNumber[4] : '0'
									}}</a>
									)</span
								>
							</span>
						</div>
						<div
							style="
								-webkit-box-orient: vertical;
								position: relative;
								line-height: 1.4em;
								overflow: hidden;
								height: 7.1em;
								cursor: pointer;
							"
							class="plate"
							@click="dialogVisibleChange"
						>
							<span style="line-height: 30px">
								<i class="el-icon-tickets"></i>
								{{ $t('common.CompanyProfile') }}:
								<span v-html="initData.unitIntrodutionMin"></span>
							</span>
						</div>
						<div style="margin-top: 10px">
							<el-tag
								v-if="0 < initData.unitLabel.size"
								style="margin: 10px 10px 0 0"
								v-for="unitLabel in initData.unitLabel"
								>{{ unitLabel }}
							</el-tag>
						</div>
						<div
							style="
								float: right;
								color: #666;
								font-size: 14px;
								margin-right: 20px;
							"
						>
							<!--            <span class="share cursor" :style="ifcommon?'color: #66b1ff;':''"-->
							<!--                  style="margin-right: 20px;" @click="shareChange()">-->
							<!--                <i class="el-icon-star-off" :style="ifcommon?'color: #66b1ff;':''"> </i>-->
							<!--                {{ifcommon?$t('common.companyAttentioned'):$t('common.Focusonthecompany')}}-->
							<!--            </span>-->
							<div>
								<!--                <el-button type="" style="margin-left: 10px;margin-top: 10px;height: 40px;width: 170px;" icon="el-icon-star-off" :style="ifcommon?'color: #66b1ff;':''" @click="shareChange()">-->
								<span
									class="share cursor"
									:style="ifcommon ? 'color: #66b1ff;' : ''"
									style="margin-right: 380px"
									@click="shareChange()"
								>
									<i
										class="el-icon-star-off"
										:style="ifcommon ? 'color: #66b1ff;' : ''"
									></i>
									{{
										ifcommon
											? $t('common.companyAttentioned')
											: $t('common.Focusonthecompany')
									}}
								</span>
								<!--                </el-button>-->
							</div>
							<!-- <span class="share cursor btn" :data-clipboard-text="url" @click="copy">
									<i class="el-icon-share"> </i>
									{{$t('common.ShareProject')}}
							</span> -->
						</div>
					</div>
				</div>
			</div>
			<!-- 企业介绍 -->
			<!-- <div style="width: 100%;border-bottom: 1px solid #ccc;" v-if="enterprise.label1.label">
				<div class="enterprise_style">

					<span class="enterprise_style_span">{{$t('common.EnterpriseIntroduction')}}</span>
				</div>
				<div
					style="margin-top: 15px;color: #2c3e50;margin:0 100px;"
					v-html="enterprise.label1.label"
				></div>
			</div> -->

			<div
				style="width: 100%; height: 320px; border-bottom: 1px solid #ccc"
				id="unitScope"
				v-if="enterprise1.length > 0"
			>
				<!--  -->
				<div class="enterprise_style">
					<span class="enterprise_style_span">{{
						$t('common.ProductInformation')
					}}</span>
				</div>
				<div
					v-if="enterprise1.length > 6"
					style="
						float: right;
						transform: translateY(-7px);
						margin-right: 61px;
						font-size: 14px;
						color: #2c558a;
					"
					@click="
						toViewMore(
							'EnterPriseMoreInformationList',
							initData.baseEntityId,
							'1'
						)
					"
					class="cursor"
				>
					{{ $t('common.ViewMore') }}
				</div>
				<div
					style="
						float: left;
						margin-top: 15px;
						margin-left: 100px;
						width: 400px;
						height: 230px;
					"
				>
					<img
						:src="'api/file/pub/' + enterprise.label2.src"
						alt
						style="width: 100%; height: 100%"
						v-if="enterprise.label2.src"
					/>
					<img
						:src="'api/file/pub/' + '/def/def2.png'"
						alt
						style="width: 100%; height: 100%"
						v-if="!enterprise.label2.src"
					/>
				</div>
				<div
					style="float: left; margin-top: 15px; margin-left: 20px; width: 620px"
					class="enterprise_style_product"
				>
					<tr
						v-for="(item, index) in enterprise1"
						v-if="index < 6"
						class="cursor"
						@click="
							toViewDetail(
								'enterpriseInformationDetails',
								item.baseEntityId,
								'common.ProductInformation'
							)
						"
					>
						<td
							style="
								float: left;
								width: 500px;
								display: inline-block;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							"
						>
							{{ item.title }}
						</td>
						<td style="float: right">{{ formatDate(item.createDate) }}</td>
						<td style="clear: both"></td>
					</tr>
				</div>
			</div>
			<div
				style="width: 100%; height: 320px; border-bottom: 1px solid #ccc"
				id="information03"
				v-if="enterprise3.length > 0"
			>
				<!--  -->
				<div class="enterprise_style">
					<span class="enterprise_style_span">{{
						$t('common.ProjectPerformance')
					}}</span>
				</div>
				<div
					v-if="enterprise3.length > 6"
					style="
						float: right;
						transform: translateY(-7px);
						margin-right: 61px;
						font-size: 14px;
						color: #2c558a;
					"
					@click="
						toViewMore(
							'EnterPriseMoreInformationList',
							initData.baseEntityId,
							'3'
						)
					"
					class="cursor"
				>
					{{ $t('common.ViewMore') }}
				</div>
				<div
					style="
						float: left;
						margin-top: 15px;
						margin-left: 100px;
						width: 400px;
						height: 230px;
					"
				>
					<img
						:src="'api/file/pub/' + enterprise.label4.src"
						alt
						style="width: 100%; height: 100%"
						v-if="enterprise.label4.src"
					/>
					<img
						:src="'api/file/pub/' + '/def/def4.png'"
						alt
						style="width: 100%; height: 100%"
						v-if="!enterprise.label4.src"
					/>
				</div>
				<div
					style="float: left; margin-top: 15px; margin-left: 20px; width: 620px"
					class="enterprise_style_product"
				>
					<tr
						v-for="(item, index) in enterprise3"
						v-if="index < 5"
						class="cursor"
						@click="
							toViewDetail(
								'enterpriseInformationDetails',
								item.baseEntityId,
								'common.ProjectPerformance'
							)
						"
					>
						<td
							style="
								float: left;
								width: 500px;
								display: inline-block;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							"
						>
							{{ item.title }}
						</td>
						<td style="float: right">{{ formatDate(item.createDate) }}</td>
						<td style="clear: both"></td>
					</tr>
				</div>
			</div>
			<div
				style="width: 100%; height: 320px; border-bottom: 1px solid #ccc"
				id="information02"
				v-if="enterprise2.length > 0"
			>
				<div class="enterprise_style">
					<span class="enterprise_style_span">{{
						$t('common.CoreTechnology')
					}}</span>
				</div>
				<div
					v-if="enterprise2.length > 6"
					style="
						float: right;
						transform: translateY(-7px);
						margin-right: 61px;
						font-size: 14px;
						color: #2c558a;
					"
					@click="
						toViewMore(
							'EnterPriseMoreInformationList',
							initData.baseEntityId,
							'2'
						)
					"
					class="cursor"
				>
					{{ $t('common.ViewMore') }}
				</div>
				<div
					style="
						float: left;
						margin-top: 15px;
						margin-left: 100px;
						width: 400px;
						height: 230px;
					"
				>
					<img
						:src="'api/file/pub/' + enterprise.label3.src"
						alt
						style="width: 100%; height: 100%"
						v-if="enterprise.label3.src"
					/>
					<img
						:src="'api/file/pub/' + '/def/def3.png'"
						alt
						style="width: 100%; height: 100%"
						v-if="!enterprise.label3.src"
					/>
				</div>
				<div
					style="float: left; margin-top: 15px; margin-left: 20px; width: 620px"
					class="enterprise_style_product"
				>
					<tr
						v-for="(item, index) in enterprise2"
						v-if="index < 6"
						class="cursor"
						@click="
							toViewDetail(
								'enterpriseInformationDetails',
								item.baseEntityId,
								'common.CoreTechnology'
							)
						"
					>
						<td
							style="
								float: left;
								width: 500px;
								display: inline-block;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							"
						>
							{{ item.title }}
						</td>
						<!-- <td style="float: right;margin-left: 10px;">{{item.updateDate}}</td> -->
						<td style="float: right">{{ formatDate(item.createDate) }}</td>
						<td style="clear: both"></td>
					</tr>
				</div>
			</div>

			<div
				style="width: 100%; height: 320px; border-bottom: 1px solid #ccc"
				id="information04"
				v-if="enterprise4.length > 0"
			>
				<!--  -->
				<div class="enterprise_style">
					<span class="enterprise_style_span">{{
						$t('common.ScopeBusiness')
					}}</span>
				</div>
				<div
					v-if="enterprise4.length > 6"
					style="
						float: right;
						transform: translateY(-7px);
						margin-right: 61px;
						font-size: 14px;
						color: #2c558a;
					"
					@click="
						toViewMore(
							'EnterPriseMoreInformationList',
							initData.baseEntityId,
							'4'
						)
					"
					class="cursor"
				>
					{{ $t('common.ViewMore') }}
				</div>
				<div
					style="
						float: left;
						margin-top: 15px;
						margin-left: 100px;
						width: 400px;
						height: 230px;
					"
				>
					<img
						:src="'api/file/pub/' + enterprise.label5.src"
						alt
						style="width: 100%; height: 100%"
						v-if="enterprise.label5.src"
					/>
					<img
						:src="'api/file/pub/' + '/def/def2.png'"
						alt
						style="width: 100%; height: 100%"
						v-if="!enterprise.label5.src"
					/>
				</div>
				<div
					style="float: left; margin-top: 15px; margin-left: 20px; width: 620px"
					class="enterprise_style_product"
				>
					<tr
						v-for="(item, index) in enterprise4"
						v-if="index < 5"
						class="cursor"
						@click="
							toViewDetail(
								'enterpriseInformationDetails',
								item.baseEntityId,
								'common.ProjectPerformance'
							)
						"
					>
						<td
							style="
								float: left;
								width: 500px;
								display: inline-block;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							"
						>
							{{ item.title }}
						</td>
						<td style="float: right">{{ formatDate(item.createDate) }}</td>
						<td style="clear: both"></td>
					</tr>
				</div>
			</div>

			<!--<div style="width: 100%;height: 250px;display:none;">
				<div class="enterprise_style">
					<span class="enterprise_style_span">{{$t('common.RecommendedEnterprise')}}</span>
				</div>
				<div class="recommend">
					<ul>
						<li v-for="(item,index) in recommend" key="index">
							<img :src="'api/file/pub/' + item.photo" alt style="width: 100%;height: 115px;" />
							<div style="color: #bcbcbc;font-size: 14px;">{{item.num?item.num:0}}{{$t('common.Browse')}}</div>
						</li>
					</ul>
				</div>
			</div>-->
		</div>
		<!-- <el-dialog
			:title="$t('common.CompanyProfile')"
			:visible.sync="dialogVisible"
			width="60%">
			<span style="line-height: 29px;font-size: 18px;" v-html="initData.unitIntrodution"></span>
		</el-dialog> -->
		<FrameTemplate
			:dialogVisible="dialogVisible"
			width="60%"
			:title="$t('common.CompanyProfile')"
			@FrameBack="dialogVisible = false"
		>
			<span
				slot="center"
				style="line-height: 29px; font-size: 18px"
				v-html="initData.unitIntrodution"
			>
			</span>
		</FrameTemplate>
		<el-dialog
			:title="$i18n.locale == 'zh' ? '提示' : 'Reminder'"
			:visible.sync="toViewLogin"
			:width="$i18n.locale == 'zh' ? '500px' : '750px'"
			:height="$i18n.locale == 'zh' ? '300px' : '386px'"
			:before-close="toViewLoginChange"
		>
			<div style="width: 100%; height: 100%">
				<img
					src="@/assets/img/loginTips.png"
					alt=""
					style="width: 180px; height: 180px; margin-left: 20px"
				/>
				<div
					style="float: right; margin-right: 20px"
					:style="
						$i18n.locale == 'zh'
							? 'width: 49%;margin-top: 10px;'
							: 'width: 453px;margin-top: -25px;'
					"
				>
					<div
						style="
							font-size: 20px;
							font-weight: normal;
							color: #333333;
							font-family: HiraginoSansGB-W3, HiraginoSansGB;
							line-height: 40px;
						"
					>
						{{ $t('common.ReminderFirst') }}
					</div>
					<div
						style="
							font-size: 16px;
							font-family: HiraginoSansGB-W3, HiraginoSansGB;
							font-weight: normal;
							color: #666666;
							line-height: 30px;
						"
					>
						{{ $t('common.ReminderSecond') }}
						<span style="color: #0091ff; font-size: 18px">{{ num }}</span>
						{{ $t('common.ReminderThird') }}
					</div>
					<div
						style="
							font-size: 14px;
							font-family: HiraginoSansGB-W3, HiraginoSansGB;
							font-weight: normal;
							color: #666666;
							line-height: 30px;
						"
					>
						{{ $t('common.ReminderForth') }}
					</div>
					<div
						style="
							font-size: 14px;
							font-family: HiraginoSansGB-W3, HiraginoSansGB;
							height: 33px;
							line-height: 60px;
							font-weight: normal;
							color: #0091ff;
						"
					>
						<span
							style="margin-left: 40px"
							class="cursor"
							@click="toView('login')"
						>
							{{ $t('common.ReminderFifth') }}
						</span>
						<span
							style="margin-left: 10px"
							class="cursor"
							@click="toView('Register')"
						>
							{{ $t('common.ReminderSixth') }}
						</span>
					</div>
				</div>
			</div>
		</el-dialog>
	</div>
</template>

<script>
import { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper'
// import 'swiper/dist/css/swiper.css'
import 'vue-awesome-swiper/node_modules/swiper/dist/css/swiper.css'
import Base from '@/views/base/Base'
import {
	getBaseUnitViews,
	get,
	saveOrUpdate,
	del,
	cmsInformationViews,
	getUnit,
	gateGetUnitViewById,
} from '@/api/baseUnitView'
import moment from 'moment'
import Clipboard from 'clipboard'
import FrameTemplate from '@/components/FrameTemplate'
import { formatDate } from '@/utils/formatUtils'
import { saveFollowModelLanguage } from '@/api/operation/basePortalModelFollowInfo'
import { getToken } from '@/utils/auth'
import { getFollowModeNumlByModelIdAndUserId } from '@/api/operation/basePortalModelFollowInfo'
import { addIntegral, addGrowth } from '@/utils/toCompleteTask'
import { getUserPointPage } from '@/api/user'
import _ from 'lodash'

export default {
	name: 'EnterpriseDetails',
	extends: Base,
	components: { FrameTemplate },
	data() {
		return {
			num: 5,
			language: this.$i18n.locale.toUpperCase(),
			toViewLogin: false,
			timer: '',
			dialogVisible: false,
			enterpriseDetails: '',
			img: [],
			key: this.$route.query.key,
			page: {
				businessType: 'unitShow',
				businessId: '',
				// typeDict:1,
			},
			ifcommon: false,
			initData: {},
			enterprise: {
				label1: {
					label: '',
					src: '',
				},
				label2: {
					src: '',
				},
				label3: {
					src: '',
				},
				label4: {
					src: '',
				},
				label5: {
					src: '',
				},
			},
			recommend: [],
			enterprise1: [],
			enterprise2: [],
			enterprise3: [],
			enterprise4: [],
			UnitTypeNumber: {},
			user: {
				umsUser: {},
			},
			pointStatus: null,
			isToken: null,
		}
	},
	updated() {
		this.Swiper()
	},
	mounted() {
		this.initData1()
		this.page.businessId = this.key
		this.$store.commit('modify', 'enterpriseDetails')
		window.localStorage.setItem('router', 'enterpriseDetails')
		this.getData()
		console.log(this.$store.state.routerItem)
		// window.sessionStorage.setItem('routerItem', 'enterprise');
	},
	watch: {
		'$i18n.locale'() {
			this.getData()
			this.language = this.$i18n.locale.toUpperCase()
		},
		toViewLogin() {
			if (this.toViewLogin == true) {
				this.loginTipsChange()
			}
		},
	},

	methods: {
		initData1() {
			this.isToken = getToken()
			if (this.isToken) {
				getUserPointPage().then((res) => {
					this.pointStatus = res.data.umsUserPoints[0].pointStatus
				})
			}
		},
		// 未登录跳转
		loginTipsChange() {
			const that = this
			this.num = 5
			// clearInterval(timer_interval);

			this.timer = setInterval(function () {
				if (that.num > 0) {
					that.num--
				} else {
					if (that.toViewLogin == true) {
						clearInterval(that.timer)
						that.toView('login')
					} else {
						clearInterval(that.timer)
					}
				}
			}, 1000)
		},
		// 判断未登录跳转是否关闭
		toViewLoginChange(done) {
			this.toViewLogin = false
			this.num = 5
			clearInterval(this.timer)
		},
		dialogVisibleChange() {
			this.dialogVisible = true
		},
		Swiper() {
			var galleryThumbs = new Swiper('.gallery-thumbs', {
				spaceBetween: 10,
				slidesPerView: 4,
				freeMode: true,
				watchSlidesVisibility: true,
				watchSlidesProgress: true,
				autoplay: {
					//自动播放
					delay: 4000,
					disableOnInteraction: false, //用户操作后是否停止 默认停止（true）
				},
			})

			var galleryTop = new Swiper('.gallery-top', {
				spaceBetween: 10,
				navigation: {
					nextEl: '.swiper-button-next',
					prevEl: '.swiper-button-prev',
				},
				autoplay: {
					//自动播放
					delay: 4000,
					disableOnInteraction: false, //用户操作后是否停止 默认停止（true）
				},
				thumbs: {
					swiper: galleryThumbs,
				},
			})
		},
		getData() {
			const that = this
			gateGetUnitViewById(this.key, this.$i18n.locale.toUpperCase()).then(
				(res) => {
					that.initData = res.data.baseUnitView
					that.initData.unitIntrodutionMin = that.initData.unitIntrodution
						? that.initData.unitIntrodution
								.replace(/<[^>]+>/g, '')
								.replace(/&nbsp;/gi, '')
						: ''
					that.enterpriseDetails = that.initData.unitName
					that.initData.unitLabel = that.initData.unitLabel
						? that.initData.unitLabel.split(',')
						: ''
					that.enterprise.label1.label = res.data.baseUnitView.unitIntrodution
					let user = window.localStorage.getItem('user')
					if (user) {
						var users = JSON.parse(user)
						var token = '' + getToken()
						var projectId = this.initData.baseEntityId
						let userId = users.userId
						getFollowModeNumlByModelIdAndUserId(
							projectId,
							'enterprise',
							this.userId
						).then((res) => {
							this.ifcommon = res.data
							console.log(
								res.data,
								'---------------------------------------------------------------------------'
							)
						})
					}
				}
			)

			// // 获取企业信息数量
			getUnit(this.key, this.$i18n.locale.toUpperCase()).then((res) => {
				this.UnitTypeNumber = res.data
			})
			// 获取企业详情信息
			this.getDataList(3)
			// 获取推荐企业
			// this.getRecommended();
		},
		getDataList(num) {
			// this.page.typeDict=num;
			this.img = []
			const that = this
			this.page.language = this.$i18n.locale.toUpperCase()
			cmsInformationViews(this.page).then((res) => {
				if (res.data[1]) {
					this.enterprise1 = res.data[1] || []
					let url = res.data[1].filter((item) => {
						return (
							item.pictureUrl !== undefined ||
							item.pictureUrl !== null ||
							item.pictureUrl !== ''
						)
					})
					if (url.length > 0) {
						that.enterprise.label2.src = url[0].pictureUrl
					} else {
						that.enterprise.label2.src = '/def/def2.png'
					}
				} else {
					this.enterprise1 = []
					that.$forceUpdate()
				}
				if (res.data[2]) {
					that.enterprise2 = res.data[2] || []
					let url = res.data[2].filter((item, index) => {
						return (
							item.pictureUrl !== undefined ||
							item.pictureUrl !== null ||
							item.pictureUrl !== ''
						)
					})
					if (url.length > 0) {
						that.enterprise.label3.src = url[0].pictureUrl
					} else {
						that.enterprise.label3.src = '/def/def3.png'
					}
				} else {
					that.enterprise2 = []
					that.$forceUpdate()
					// that.enterprise.label3.src="/def/def3.png";
				}
				if (res.data[3]) {
					that.enterprise3 = res.data[3] || []
					let url = res.data[3].filter((item, index) => {
						return (
							item.pictureUrl !== undefined ||
							item.pictureUrl !== null ||
							item.pictureUrl !== ''
						)
					})
					if (url.length > 0) {
						that.enterprise.label4.src = url[0].pictureUrl
					} else {
						that.enterprise.label4.src = '/def/def4.png'
					}
				} else {
					this.enterprise3 = []
					that.$forceUpdate()
				}
				if (res.data[4]) {
					that.enterprise4 = res.data[4] || []
					let url = res.data[4].filter((item, index) => {
						return (
							item.pictureUrl !== undefined ||
							item.pictureUrl !== null ||
							item.pictureUrl !== ''
						)
					})
					if (url.length > 0) {
						that.enterprise.label5.src = url[0].pictureUrl
					} else {
						that.enterprise.label5.src = '/def/def2.png'
					}
				} else {
					this.enterprise4 = []
					that.$forceUpdate()
				}
				that.img = []
				if (res.data[1]) {
					res.data[1].forEach((item, index) => {
						if (item) {
							if (item.pictureUrl) {
								that.img.push(item.pictureUrl)
							}
						}
					})
				}
				if (res.data[2]) {
					res.data[2].forEach((item, index) => {
						if (item) {
							if (item.pictureUrl) {
								that.img.push(item.pictureUrl)
							}
						}
					})
				}
				if (res.data[3]) {
					res.data[3].forEach((item, index) => {
						if (item) {
							if (item.pictureUrl) {
								that.img.push(item.pictureUrl)
							}
						}
					})
				}
				if (res.data[4]) {
					res.data[4].forEach((item, index) => {
						if (item) {
							if (item.pictureUrl) {
								that.img.push(item.pictureUrl)
							}
						}
					})
				}
			})
			this.getRecommended()
		},
		getRecommended() {
			this.page.recommendFlag = 'y'
			const that = this
			getBaseUnitViews(this.page).then((res) => {
				if (res.data.baseUnitViews) {
					that.recommend = res.data.baseUnitViews
					console.log(res.data.baseUnitViews, that.init)
				}
				this.loading = false
			})
		},
		getIconUrls(url) {
			return require('@/assets/img/realTimeInfo/' + url)
		},
		getIconUrl(url) {
			return 'http://localhost:8080' + 'api/file/pub/' + url
		},
		toView(router, json) {
			clearInterval(this.timer)
			this.$router.push({ name: router, params: { key: json } })
		},
		screenBack(data) {
			console.log(data, 'screenBackscreenBackscreenBackscreenBack')
		},
		toViewDetail(router, json, name) {
			this.$store.commit('modify', router)
			window.localStorage.setItem('router', router)
			const { href } = this.$router.resolve({
				name: router,
				query: {
					key: json,
					name: name,
				},
			})
			window.open(href, '_blank')
		},
		toViewMore(router, json, businessType) {
			this.$store.commit('modify', router)
			window.localStorage.setItem('router', router)
			const { href } = this.$router.resolve({
				name: 'EnterPriseMoreInformationList',
				query: {
					key: json,
					businessType: businessType,
				},
			})
			window.open(href, '_blank')
		},
		screen(i) {
			this.index = i
		},
		// 项目收藏改变
		// shareChange() {
		//   if (this.ifcommon) {
		//     this.saveFollowModelDo("unfollow");
		//   } else {
		//     this.saveFollowModelDo("follow");
		//   }
		// },
		shareChange: _.throttle(function () {
			if (this.ifcommon) {
				this.saveFollowModelDo('unfollow')
			} else {
				this.saveFollowModelDo('follow')
			}
		}, 3000),
		saveFollowModelDo: function (followType) {
			let user = window.localStorage.getItem('user')
			let that = this
			if (!this.$Cookies.get('token')) {
				// this.$message.warning("请先登录");
				// this.$confirm('检测到您未登录，是否登录')
				// .then(_ => {
				//  this.toView('login');
				// })
				// .catch(_ => {});
				this.toViewLogin = true
			} else {
				var users = JSON.parse(user)
				var token = '' + getToken()
				var projectId = this.initData.baseEntityId
				var userId = users.userId
				// 接口逻辑
				this.submitHandler((token) => {
					saveFollowModelLanguage(
						that.language,
						projectId,
						'enterprise',
						userId,
						followType,
						token
					)
						.then((result) => {
							if (followType == 'unfollow') {
								if (this.$i18n.locale == 'zh') {
									this.$message({
										message: '取消关注成功',
										type: 'success',
									})
								} else {
									this.$message({
										message: 'Cancel the follow successfully',
										type: 'success',
									})
								}
							} else {
								if (
									this.user.umsUser.userUsertypeDict !== '2' &&
									this.pointStatus == 'y'
								) {
									addIntegral('point_task_attention', '3')
								}
								if (this.$i18n.locale == 'zh') {
									this.$message({
										message: '关注成功',
										type: 'success',
									})
								} else {
									this.$message({
										message: 'Follow of success',
										type: 'success',
									})
								}
							}

							this.ifcommon = !this.ifcommon
							this.resetToken()
						})
						.catch((error) => {
							// 此处你的业务代码
						})
				})
			}
		},
	},
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.box {
	margin-top: 10px;
	background: #fff;
	/* height: 500px; */
	padding: 20px 0;
}

.crumbs {
	margin-left: 20px;
}

body {
	margin: 0;
}

.swipers {
	position: absolute;
	top: 30px;
	left: 100px;
	width: 460px;
	height: 390px;
}

.details {
	position: absolute;
	top: 30px;
	left: 600px;
	width: 490px;
	height: 390px;
}

.swiper-container {
	width: 100%;
	height: 300px;
	margin-left: auto;
	margin-right: auto;
}

.swiper-slide {
	background-size: cover;
	background-position: center;
}

.gallery-top {
	height: 80%;
	width: 100%;
}

.gallery-thumbs {
	height: 20%;
	box-sizing: border-box;
	padding: 10px 0;
}

.gallery-thumbs .swiper-slide {
	width: 25%;
	height: 100%;
	opacity: 0.4;
}

.gallery-thumbs .swiper-slide-thumb-active {
	opacity: 1;
}

.initData_label {
	color: #2c558a;
	font-weight: 700;
	font-size: 22px;
	line-height: 42px;
}

.enterprise_style {
	line-height: 50px;
	color: #6c819d;
	padding-left: 100px;
	font-size: 18px;
	font-weight: 700;
	margin-top: 5px;
}

.enterprise_style_span {
	display: inline-block;
	padding: 0 10px;
	text-align: center;
	height: 50px;
	border-bottom: 2px solid #6699ff;
}

.enterprise_style_product tr {
	line-height: 30px;
	width: 100%;
	display: inline-block;
	border-bottom: 1px dashed #ccc;
	font-size: 14px;
	color: #2c558a;
	margin-bottom: 5px;
}

.recommend {
	margin-top: 15px;
	margin-left: 100px;
}

.recommend li {
	display: inline-block;
	width: 170px;
	/* height: 130px; */
	text-align: center;
	margin-right: 15px;
}

.share:hover {
	color: #2c558a;
}

>>> .el-dialog__body {
	word-break: normal;
	padding: 0px 20px 10px;
}
</style>
