<template>
	<view>
		<view :class="'top ddflex'+(config.greyTheme==1?' grayTheme':'')">
			<view class="top-tab ddflex fflex">
				<view :class="'li ' + (currentTab == 1 ? 'active' : '')" @click="swiTab(1)">话题</view>
				<view :class="'li ' + (currentTab == 2 ? 'active' : '')" @click="swiTab(2)">投票</view>
				<view :class="'li ' + (currentTab == 3 ? 'active' : '')" @click="swiTab(3)">团队</view>
			</view>
			<view class="search ddflex" @click="jumpUrl('/office/search/index?currentTab='+currentTab)">
				<image src="../../static/images/ssico.png"></image>
				搜索你感兴趣的
			</view>
		</view>
		<view style="height: 100rpx;"></view>
		<view :class="(config.greyTheme==1?' grayTheme':'')">
			<block v-if="currentTab == 1 || currentTab == 2">
				<block v-if="currentTab == 1">
					<view class="t-con">
						<view class="item">
							<navigator url="/topics/index/index" hover-class="none" class="tits ddflex">
								<image :src="picUrlss+'office_images/hot.png'" class="hot"></image>
								<view class="more ddflex">更多<image src="../../static/images/n_rico.png"></image>
								</view>
							</navigator>
							<view class="item-list">
								<view class="li ddflex" v-for="(item, index) in hotTopicList" :key="index"
									@click="jumpUrl('/topics/detail/detail?topicId=' + item.id)">
									<text class="num">{{ index + 1 }}</text>
									<view class="fflex tover">{{ item.title }}</view>
									<text>{{ item.participantsNO }}参与</text>
								</view>
							</view>
						</view>
					</view>
			
					<view v-if="cmsList.length>0">
						<view class="ddflex"
							style="padding:0rpx 30rpx;font-size: 32rpx;color: #1A1F30;font-weight: bold;justify-content: space-between;"
							@click="jumpUrl('/topic/contentList/contentList?title=官方动态')">
							<view>官方动态</view>
							<image style="width: 14rpx;height: 24rpx;" src="../../static/images/n_rico.png"></image>
						</view>
						<view class="list">
							<view class="li" v-for="(item, index) in cmsList" :key="index"
								@click="jumpUrl('/topic/content/content?id=' + item.id+'&title=官方动态')">
								<view class="user ddflex">
									<image :src="config.CONFIG_PROJECT_LOGO" style="border:1px solid #eeeeee;padding: 5rpx;"
										mode="aspectFill" class="userimg"></image>
									<view class="fflex">
										<view class="namea ddflex">
											<view class="name fflex ddflex">
												<!-- {{ config.CONFIG_NAME }} -->
												社区管理员
												<view class="guanfang">官方</view>
											</view>
											<view class="time">{{ getDateTimeStamp(item.createDate) }}</view>
										</view>
										<view class="area">湖南·长沙</view>
									</view>
								</view>
								<view class="ddflex step-box" style="justify-content: space-between;">
									<image class="step-pic" style="width: 199rpx;height: 150rpx;" :src="item.pic"
										mode="aspectFill"></image>
									<view class="fflex">
										<view class="step-title tovers" style="font-size: 30rpx;line-height: 40rpx;">
											{{item.title}}</view>
										<view class="opt ddflex" style="justify-content: space-between;">
											<view class="fflex">{{fomatNumbers(item.browse)}}次浏览</view>
											<view class="ddflex" @click.stop="addThumbs(item,index)">
												<image
													:src="'../../static/images/' + (item.isThumbs? 'like_h' : 'like') + '.png'">
												</image>
												{{fomatNumbers(item.thumbsNumber)}}
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
			
					<view class="tab ddflex" style="border-top: 20rpx solid #f7f7f7;">
						<view :class="'li ' + (pType == 12 ? 'active' : '')" @click="swiPType(12)">最新</view>
						<view :class="'li ' + (pType == 11 ? 'active' : '')" @click="swiPType(11)">附近</view>
						<!-- <view :class="'li ' + (pType == 1 ? 'active' : '')" @click="swiPType(1)">综合</view> -->
						<!-- <view :class="'li ' + (cateIndex == index ? 'active' : '')" @click="swiTree(item,index)" v-for="(item,index) in category" :key="index">{{item.name}}</view> -->
						<!-- <view :class="'li ' + (pType == 5 ? 'active' : '')" @click="swiPType(5)">热门</view> -->
					</view>
					<view class="loc-wz ddflex" v-if="pois&&pois.poiName&&pType==11"
						@click="jumpUrlPoi(pois,'/office/poi/index')">
						<view class="loc-wzs ddflex">
							<image :src="picUrlss+'office_images/loca.png'"></image>{{pois.poiName}}
						</view>
					</view>
				</block>
				<view :class="'cons-b'+(currentTab==2?' cons-b-tp':'')">
					<view class="list" v-if="officeList && officeList.length > 0">
						<view class="li" v-for="(item, index) in officeList" :key="index">
							<view class="user ddflex" @click="jumpUrl('/topics/home/home?userId=' + item.userDTO.id)">
								<image :src="item.userDTO.avatar" mode="aspectFill" class="userimg"></image>
								<view class="fflex">
									<view class="namea ddflex">
										<view class="name fflex ddflex">{{ item.userDTO.nickName }}
											<!-- <image src="../../static/images/vip_tag.png" class="vip-tag" v-if="item.userDTO.levelGrade > 0"></image> -->
											<image v-if="item.userDTO.isOpenWeRunData"
												style="width:15rpx;height:20rpx;margin-left: 10rpx;"
												src="../../static/images/yd.png"></image>
										</view>
										<view class="time">{{ item.time }}</view>
									</view>
									<view class="area" v-if="item.userDTO.cityName">{{ item.userDTO.provinceName }}
										{{ item.userDTO.cityName }}</view>
								</view>
							</view>
							<view class="des" @click="jumpUrlDetail(item)"><rich-text :nodes="item.content"></rich-text>
							</view>
							<!-- //如果有投票，就不显示图片 -->
							<block v-if="!item.qyPoll">
								<view class="video" v-if="item.isHaveVideo && config.open_community_video == 1">
									<video :src="item.url" :show-center-play-btn="false" :controls="item.isControls"
										:autoplay="item.isControls" :id="'myVideo'+index" @pause="videoPause(index)"
										@ended="videoEnded(index)"></video>
									<view class="video-play ddflex" @click="videoPlay(index)" v-if="item.isShowPlayBtn">
										<image src="../../static/images/play.png"></image>
									</view>
								</view>
								<view class="imgbox ddflex" @click="jumpUrlDetail(item)" v-if="!item.isHaveVideo">
									<!-- @click="previewImgss(item.url, idx)" -->
									<block v-if="item.url&&item.url.length>0">
										<image mode="aspectFill" v-for="(it, idx) in item.url" :src="it" :key="idx"></image>
									</block>
								</view>
							</block>
							<!-- 话题 -->
							<view class="ddflex" v-if="item.qyDialogu">
								<view class="topic ddflex"
									@click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
									<image src="../../static/images/topic.png"></image>
									{{ item.qyDialogu.title }}
								</view>
								<!-- <view class="topic ddflex" @click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
								<image src="../../static/images/topic.png"></image>
								{{ item.qyDialogu.title }}
							</view> -->
							</view>
							<view class="loca ddflex" @click="jumpUrlPoi(item,'/office/poi/index')" v-if="item.poiName">
								<image :src="picUrlss+'office_images/loca.png'"></image><text
									v-if="item.poiDistance > 0">{{item.poiDistance ? item.poiDistance < 1000 ? item.poiDistance+'m' : (item.poiDistance/1000).toFixed(1)+'km' : ''}}</text>{{item.poiName}}
							</view>
							<!-- 投票 -->
							<view :class="'vote-box' + (item.qyPoll.isEnd ? ' ends' : '')" v-if="item.qyPoll">
								<view class="vote-tit">{{ item.qyPoll.title }}</view>
								<block v-if="item.qyPoll.isVote == 1">
									<view class="vote-list end" @click="jumpUrlDetail(item)">
										<view :class="'lis ddflex  ' + (itpy.isVote == 1 ? 'active' : '')"
											v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex">
											<view class="percent" :style="'width:' + parseFloat(itpy.proportion) + '%;'">
											</view>
											<view class="fflex">{{ itpy.name }}</view>
											<view>{{ parseFloat(itpy.proportion) + '%' }}</view>
										</view>
									</view>
								</block>
								<block v-else>
									<view class="vote-list">
										<view class="lis" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)"
											:key="idex" @click="submitPoll(item, index, idex)">
											{{ itpy.name }}
										</view>
									</view>
								</block>
								<view class="vote-can" v-if="item.qyPoll.isEnd">
									<text>{{item.qyPoll.voteCount}}人参与</text>投票已结束</view>
							</view>
							<block v-if="item.type==10||item.type==11">
								<view v-if="item.type==10" class="ddflex step-box" style="justify-content: space-between;"
									@click="jumpUrl('/exercise/record/record?userId=' + item.userId)">
									<view>
										<view class="step-date">{{item.wxRun.step}}</view>
										<view class="step-label">步数</view>
									</view>
									<view>
										<view class="step-date">{{item.wxRun.index}}</view>
										<view class="step-label" style="text-align: right;">名次</view>
									</view>
								</view>
								<view v-if="item.type==11" class="ddflex step-box" style="justify-content: space-between;"
									@click="jumpUrl('/match/activityDetail/activityDetail?id=' + item.matchContent.id)">
									<image class="step-pic" :src="item.matchContent.pic" mode="aspectFill"></image>
									<view class="fflex">
										<view class="step-title tovers">{{item.matchContent.title}}</view>
										<view class="ddflex" style="justify-content: space-between;margin-top: 10rpx;">
											<view class="step-price">{{item.matchContent.endTime}}</view>
											<view class="step-btn">查看</view>
										</view>
									</view>
								</view>
							</block>
							<view v-if="item.userGroupId" class="ddflex step-box" style="padding: 25rpx 21rpx;"
								@click="jumpUrl('/office/team/index?id=' + item.userGroupId)">
								<image style="width: 24rpx;height: 24rpx;margin-right: 13rpx;"
									src="../../static/images/link.png"></image>
								<view style="font-weight: 500;color: #999999;">Team：</view>
								<view>{{item.userGroupTitle}}</view>
							</view>
							<block v-else>
								<view class="product" v-if="item.products && item.products.length > 0">
									<view scroll-x="true" class="pro-view pro-view1" v-if="item.products.length == 1">
										<view class="lis" v-for="(it, idx) in item.products" :key="idx"
											@click="toProductDetail(it)">
											<view class="ddflex">
												<image :src="it.pic" mode="aspectFill"
													class="pic"></image>
												<view class="fflex">
													<view class="title tover">{{ it.title }}</view>
													<view class="opts ddflex">
														<view class="money"><text>￥</text>{{ it.salePrice }}</view>
														<view class="pro-btn">
															<image src="../../static/pages/images/n_cart.png"></image>
														</view>
													</view>
												</view>
											</view>
										</view>
									</view>
									<scroll-view scroll-x="true" class="pro-view" v-else>
										<view class="lis" v-for="(it, idx) in item.products" :key="idx"
											@click="toProductDetail(it)">
											<view class="ddflex">
												<image :src="it.pic" mode="aspectFill"
													class="pic"></image>
												<view class="fflex">
													<view class="title tover">{{ it.title }}</view>
													<view class="opts ddflex">
														<view class="money"><text>￥</text>{{ it.salePrice }}</view>
														<view class="pro-btn">
															<image src="../../static/pages/images/n_cart.png"></image>
														</view>
													</view>
												</view>
											</view>
										</view>
									</scroll-view>
								</view>
							</block>
							<view class="opt ddflex" v-if="!item.source">
								<view class="fflex" @click="jumpUrlDetail(item)">{{fomatNumbers(item.count.browseCount)}}次浏览
								</view>
								<view class="ddflex" @click="submitFabulous(2, item.id, index)">
									<image
										:src="'../../static/images/' + (item.isPraise == 1 ? 'like_h' : 'like') + '.png'">
									</image>
									{{fomatNumbers(item.count.fabulousCount)}}
								</view>
								<view class="ddflex" @click="jumpUrlDetail(item)" v-if="config.is_show_create_btn == 1">
									<image src="../../static/images/comment.png"></image>
									{{fomatNumbers(item.count.commentCount)}}
								</view>
								<button open-type="share" hover-class="none" class="opt-share ddflex">
									<image src="../../static/images/share.png"></image>
									分享
								</button>
							</view>
						</view>
					</view>
					<view class="nodata" v-else>
						<image :src="picUrlss + 'empty_jl.png'"></image>
						<text>暂无动态</text>
					</view>
				</view>
			</block>
			<block v-if="currentTab == 3">
				<view class="m-team" v-if="userTeamList.length>0">
					<view class="m-tits ddflex" @click="jumpUrl('/office/myTeam/index')">
						<view class="fflex">我的团队</view>
						<view class="m-nums ddflex">{{userTeamTotal}}个团队<image src="../../static/pages/images/more.png">
							</image>
						</view>
					</view>
					<view class="map-team">
						<scroll-view scroll-x="true" class="map-teams">
							<view class="li" v-for="(item,index) in userTeamList" :key="index"
								@click="jumpUrlTeam(item,'/office/team/index?id='+item.id)">
								<view class="ddflex">
									<image :src="item.url?item.url:picUrlss+'office_images/team_default.png'"
										mode="aspectFill"></image>
									<view class="fflex">
										<view class="tover">{{item.title}}</view>
										<text>日新贴{{item.dayMomentsNum}}</text>
									</view>
									<view class="li-btn" v-if="item.auditStatus == 1">去看看</view>
									<view :class="'sta'+(item.auditStatus == 2 ? ' fail':'')" v-else>
										{{item.auditStatus == 0 ? '审核中' : '审核失败'}}</view>
								</view>
							</view>
						</scroll-view>
					</view>
				</view>
				<view class="team-list" v-if="teamList.length>0">
					<view v-for="(item,index) in teamList" :key="index">
						<view class="li ddflex" @click="jumpUrl('/office/team/index?id='+item.id)">
							<image :src="item.url?item.url:picUrlss+'office_images/team_default.png'" mode="aspectFill"
								class="team-img"></image>
							<view class="fflex">
								<view class="ddflex">
									<view class="team-tit tover" style="max-width: calc(100% - 80rpx);">{{item.title}}
									</view>
									<!-- <view v-if="item.relationMatch" style="margin-left: 10rpx; width: 60rpx;line-height: 29rpx;font-size: 20rpx;color: #FFFFFF;background: linear-gradient(56deg, #FF7000 0%, #FF9100 100%);border-radius: 5rpx;text-align: center;">赛事</view> -->
									<!-- <view v-else style="margin-left: 10rpx;width: 60rpx;line-height: 29rpx;font-size: 20rpx;color: #FFFFFF;background: linear-gradient(48deg, #5190FF 0%, #78A9FF 100%);border-radius: 5rpx;text-align: center;">社区</view> -->
								</view>
								<view class="team-sta">
									<text>{{item.memberNum}}成员</text>
									<text>{{item.momentsNum}}帖子</text>
								</view>
							</view>
							<view class="join-btn" @click.stop="joinTeam(item,index)">加入</view>
						</view>
						<view v-if="item.relationMatch" class="ddflex"
							style="background: #F7F8FC;border-radius: 10rpx;padding: 18rpx 20rpx;margin-top: 20rpx;margin-left: 96rpx;color: #999;font-size: 24rpx;"
							@click="jumpUrl('/match/activityDetail/activityDetail?id='+item.relationMatch.id)">
							来自
							<view class="fflex tover" style="color: var(--main);">{{item.relationMatch.title}}</view>
						</view>
					</view>
				</view>
				<view class="nodata" v-else>
					<image :src="picUrlss + 'empty_jl.png'"></image>
					<text>暂无团队</text>
				</view>
			</block>
		</view>
		<view :class="'create'+(config.greyTheme==1?' grayTheme':'')" @click="showBtn"
			v-if="config.is_show_create_btn == 1">
			<image style="display: block;" src="/static/images/create.png"></image>发布
		</view>
		<view :class="'ceng'+(config.greyTheme==1?' grayTheme':'')" v-if="isShowbtn" @click="hideBtn"></view>
		<!-- @click="createJump('/office/news/news?newsType=1')" -->
		<view :class="'side ddflex'+(config.greyTheme==1?' grayTheme':'')" v-if="isShowbtn">
			<view class="li" @click="createJump('/office/createTeam/index')">
				<image src="/static/images/ll_dt.png"></image>
				<view>创建团队</view>
			</view>
			<view class="li" @click="createJump('/office/news/news?newsType=1')">
				<image src="/static/images/ll_cz.png"></image>
				<view>发帖</view>
			</view>
		</view>
		<foot channel="interactive" :isUpdate="false"></foot>
		
		<update-userinfonew :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfonew>
	</view>
</template>

<script>
	const app = getApp();
	const api = require('../../utils/api.js');
	const req = require('../../utils/request.js');
	const util = require('../../utils/util.js');
	const QQMapWX = require("../../utils/qqmap.js");
	import foot from "../../components/nav-bar/index.vue"
	export default {
		components: {
			foot
		},
		data() {
			return {
				systems: {},
				currentTab: 1,
				isShowbtn: false,
				isShowPage: false,
				picUrlss: req.public.picUrls,
				isLoad: true,
				form: {
					page: 1,
					limit: 5
				},
				pType: 12, //排序： 1综合, 2最新+综合,3浏览最多,4评论最多,5热门,10最新+标签，11位置，12时间
				isHoleLoad: true,
				holeForm: {
					page: 1,
					limit: 10
				},
				holeType: 1, //排序： 1综合, 2最新,3浏览最多,4评论最多,5热门
				hotTopicList: [],
				hotPollList: [],
				officeList: [], //聊一聊
				config: {},
				videoCurrent: null,
				videoContext: '',
				category: [],
				cateIndex: -1,
				treeId: '',
				pois: {},
				currentPoi: {},
				teamForm: {
					page: 1,
					limit: 10
				},
				isTeamLoad: true,
				teamList: [],
				userTeamList: [],
				userTeamTotal: 0,
				isFirst: true,
				isRefresh: false,
				cmsList: [], //官方动态
				
				isShowUpdate: false, //是否显示更新信息弹窗
				isUpdateInfo: false,//更新用户信息
				isUpdateMobile: false,//绑定手机号
			}
		},
		onLoad(options) {
			if (req.getStorage('officeList')) {
				this.officeList = JSON.parse(req.getStorage('officeList'));
				this.isShowPage = true;
			}
			if (req.getStorage('loctionAddressMap')) {
				let pois = req.getStorage('loctionAddressMap').pois[0];
				pois.poiName = pois.title;
				pois.poiAddress = pois.address;
				pois.poiLongitude = pois.location.lng;
				pois.poiLatitude = pois.location.lat
				this.pois = pois;
				this.getOfficeList();
				console.log('this.pois==', this.pois)
			} else {
				QQMapWX.initMap();
				req.getLocation(res => {
					const to = {
						latitude: res.latitude,
						longitude: res.longitude
					};
					QQMapWX.reverseGeocoder(to, resp => {
						if (resp) {
							resp.pois.map(it => {
								it.poiName = it.title;
								it.poiAddress = it.address;
								it.poiLongitude = it.location.lng;
								it.poiLatitude = it.location.lat
								return it;
							})
							this.pois = resp.pois[0];
						}
						this.getOfficeList();
					});
				});
			}
			req.saveBehaviorNew('',13,4)
			// req.silenceLogin(options.userId, '');
			// this.getHotPoll()
		},
		onShow() {
			// this.getCategory();
			this.getConfig();
			this.getHotTopic();
			this.getCmsList();
			if (this.currentTab > 2) {
				if (this.isRefresh) {
					this.teamForm.page = 1;
					this.isTeamLoad = true;
					this.getTeamPage();
					this.getUserTeam();
					this.isRefresh = false;
				}
			} else {
				if (!this.isFirst && this.isRefresh) {
					this.form.page = 1;
					this.isLoad = true;
					this.getOfficeList();
					this.isRefresh = false;
				}
			}
			this.getUpdate()
		},
		onHide() {
			this.isShowbtn = false;
		},
		onReachBottom() {
			if (this.currentTab > 1) {
				this.teamForm.page++;
				this.getTeamPage();
			} else {
				this.form.page++;
				this.getOfficeList();
			}
		},
		methods: {
			swiTab(index) {
				if (this.currentTab == index) return false;
				this.currentTab = index;
				if (index == 1) {
					this.pType = 12;
				} else {
					this.pType = 1;
				}
				this.teamList = [];
				this.officeList = [];
				if (index > 2) {
					this.isTeamLoad = true;
					this.teamForm.page = 1;
					this.getTeamPage();
					this.getUserTeam();
				} else {
					this.isLoad = true;
					this.form.page = 1;
					this.getOfficeList();
				}
				if(index==1){
					req.saveBehaviorNew('',17,4)
				}else if(index==2){
					req.saveBehaviorNew('',18,4)
				}else if(index==3){
					req.saveBehaviorNew('',19,4)
				}
			},
			//聊一聊切换排序类型
			swiPType(type) {
				this.isLoad = true;
				this.form.page = 1;
				this.pType = type;
				this.cateIndex = -1
				this.treeId = ''
				this.getOfficeList();
			},
			//预览图片
			previewImgss(picUrls, index) {
				//预览合同图片
				var src = picUrls[index];
				let imgs = picUrls;
				uni.previewImage({
					current: src, // 当前显示图片的http链接
					urls: imgs
				});
			},

			showBtn() {
				if (!req.isLogins(true)) {
					return;
				}
				this.isShowbtn = true;
			},
			hideBtn() {
				this.isShowbtn = false;
			},

			removeHtml(content) {
				return util.removeHtml(content);
			},
			createJump(url) {
				if (!req.isLogins(true)) {
					return;
				}
				this.jumpUrl(url);
			},
			jumpUrl(url) {
				uni.navigateTo({
					url: url
				})
			},
			jumpUrlPoi(item, url) {
				console.log('item==', item)
				this.currentPoi = item;
				uni.navigateTo({
					url: url
				})
			},
			jumpUrlTeam(item, url) {
				console.log('url', url)
				if (item.auditStatus == 1) {
					this.jumpUrl(url)
				} else {
					if (item.userId == req.getStorage('userInfo').id) {
						this.jumpUrl('/office/createTeam/index?id=' + item.id);
					} else {
						if (item.auditStatus == 0) {
							req.msg('团队正在审核中，暂时无法查看')
						} else {
							req.msg('团队审核不通过，无法查看')
						}
					}
				}
			},
			jumpToPractice(item, url) {
				let checkCategory = {
					id: item.question.cateId,
					name: item.question.cateName
				}
				req.setStorage('checkCategory', checkCategory)
				this.jumpUrl(url);
			},
			jumpUrlDetail(item) {
				this.jumpUrl('/office/detail/detail?contentId=' + item.id);
			},
			toProductDetail(item) {
				this.jumpUrl('/product/detail/detail?id=' + item.id);
			},
			getHotTopic() {
				var dataPram = {
					page: 1,
					limit: 4,
					attr: 2
				};
				req.getRequest('/api/v3/dialogue/list', dataPram, data => {
					this.hotTopicList = data;
				});
			},

			getHotPoll() {
				var dataPram = {
					page: 1,
					limit: 4,
					attr: 2,
					attrType: 0
				};
				req.getRequest('/api/v3/poll/pollList', dataPram, data => {
					this.hotPollList = data;
				});
			},
			getCategory() {
				req.getRequest('/api/v3/unified/tree/list', {
					type: 1
				}, data => {
					this.category = data;
				})
			},
			getConfig() {
				req.getRequest('/api/other/config', {}, data => {
					this.config = data;
				})
			},
			swiTree(item, index) {
				if (this.cateIndex == index) return false;
				this.cateIndex = index;
				this.pType = -1;
				this.treeId = item.id;
				this.form.page = 1;
				this.isLoad = true;
				this.getOfficeList()
			},
			sum(arr) {
				var s = 0;
				for (var i = arr.length - 1; i >= 0; i--) {
					if (arr[i].count) {
						s += Number(arr[i].count);
					}
				}
				return s;
			},
			fomatNumbers(num) {
				return util.formatNumbers(num)
			},
			getOfficeList() {
				let that = this;
				var pramData = {};
				pramData.page = this.form.page;
				pramData.limit = this.form.limit;
				// pramData.type = 4;
				if (this.pType == 5) {
					//热门
					pramData.isEssence = 2;
				} else {
					pramData.orderType = this.pType;
				}
				if (this.treeId) {
					pramData.treeId = this.treeId
					pramData.orderType = 1
				} else delete pramData.treeId
				if (this.currentTab < 3) pramData.searchType = this.currentTab; //1话题 2投票 3团队
				else delete pramData.searchType;
				pramData.poiLongitude = req.getStorage('loctionAddressMap').location.lng ? req.getStorage(
					'loctionAddressMap').location.lng : this.pois.poiLongitude;
				pramData.poiLatitude = req.getStorage('loctionAddressMap').location.lat ? req.getStorage(
					'loctionAddressMap').location.lat : this.pois.poiLatitude;
				if (this.pType == 11) pramData.distance = 20000;
				else delete pramData.distance;
				if (!this.isLoad) return false;
				this.isLoad = false;
				if (pramData.page == 1) {
					uni.showLoading({
						mask: true
					})
				}
				req.getRequest('/api/v3/moments/page', pramData, data => {
					if (data.list && data.list.length > 0) {
						data.list.map(it => {
							if (it.qyPoll && it.qyPoll.isEnd) {
								it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
							}
							if (it.url) {
								let h = it.url.substring(it.url.lastIndexOf('.') + 1)
								if (h.indexOf('mp4') < 0 && h.indexOf('MP4') < 0) {
									it.url = it.url.split(',');
								} else {
									it.isHaveVideo = true
									it.isControls = false
									it.isShowPlayBtn = true
								}
							}
							it.content =
								'<div style="overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 5;-webkit-box-orient: vertical;word-break: break-all;">' +
								it.content + '</div>'
							return it;
						})
					}
					if (data.list && data.list.length >= this.form.limit) {
						this.isLoad = true;
					}
					if (this.form.page > 1) {
						data.list = this.officeList.concat(data.list);
					} else {
						this.officeList = [];
					}
					this.officeList = data.list;
					// if(this.form.page == 1){
					// 	req.setStorage('officeList',JSON.stringify(this.officeList));
					// }
					this.isShowPage = true;
					this.isFirst = false;
					uni.hideLoading();
				});
			},
			getTeamPage() {
				if (!this.isTeamLoad) return false;
				this.isTeamLoad = false;
				let form = this.teamForm
				if (form.page == 1) {
					uni.showLoading({
						mask: true
					})
				}
				req.getRequest(api.user_team_page, form, data => {
					if (data.list && data.list.length >= 10) this.isTeamLoad = true;
					if (this.teamForm.page > 1) data.list = this.teamList.concat(data.list);
					this.teamList = data.list;
					uni.hideLoading();
				})
			},
			getUserTeam() {
				let form = {
					page: 1,
					limit: 5
				}
				req.getRequest(api.user_team_list, form, data => {
					this.userTeamList = data.list;
					this.userTeamTotal = data.total;
				})
			},
			//提交点赞、取消点赞；收藏、取消收藏
			submitFabulous(type, id, index) {
				if (!req.isLogins(true)) {
					return;
				}
				var dataP = {};
				dataP.type = type; //1，观看 ，2点赞，3评论，4分享，5收藏
				dataP.momentsId = id;
				req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
					if (type == 2) {
						//动态点赞
						if (this.officeList[index].isPraise == 1) {
							//已赞
							this.officeList[index].isPraise = 0;
							this.officeList[index].count.fabulousCount--;
							req.saveBehaviorNew(id, this.officeList[index].pollId?10:11,11)
						} else {
							this.officeList[index].isPraise = 1;
							this.officeList[index].count.fabulousCount++;
							req.saveBehaviorNew(id, this.officeList[index].pollId?10:11,3)
						}
					}
				});
			},
			//文章点赞
			addThumbs(item, index) {
				req.saveBehavior({
						behavior: 3,
						bindId: item.id,
						type: 4
					},
					(res) => {
						this.getCmsList()
					}
				);
			},

			//提交投票
			submitPoll(item, pIndex, pollIndex) {
				if (item.qyPoll.isEnd) {
					this.jumpUrlDetail(item)
					return false;
				}
				var dataP = {};
				// dataP.id = item.id;
				dataP.pollId = item.qyPoll.id;
				var pollObjList = JSON.parse(item.qyPoll.optionJson);
				dataP.pollOptionCode = pollObjList[pollIndex].code;
				req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
					req.msg('投票成功');
					//图片完之后要将该投票的对象返回，便于做渲染%
					this.officeList[pIndex].qyPoll = data;
					req.saveBehaviorNew(item.id,10,5)
				});
			},
			goTop: function(e) {
				// 一键回到顶部
				if (uni.pageScrollTo) {
					uni.pageScrollTo({
						scrollTop: 0
					});
				} else {
					uni.showModal({
						title: '提示',
						content: '当前微信版本过低，无法使用该功能，请升级到最新微信版本后重试。'
					});
				}
			},
			videoPlay(index) {
				var that = this;
				var curIdx = index;
				this.officeList[index].isControls = true
				this.officeList[index].isShowPlayBtn = false
				// 有播放时先将prev暂停，再播放当前点击的current
				if (that.videoCurrent != null) {
					var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
					if (that.videoCurrent != curIdx) {
						this.officeList[that.videoCurrent].isControls = false
						this.officeList[that.videoCurrent].isShowPlayBtn = true

						videoContextPrev.stop()
					}
					that.videoCurrent = curIdx
					var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
					videoContextCurrent.play()
				} else {
					// 没有播放时播放视频
					that.videoCurrent = curIdx
					var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
					videoContext.play()
				}
			},
			videoPause(index) {
				this.officeList[index].isControls = false
				this.officeList[index].isShowPlayBtn = true
			},
			videoEnded(index) {
				this.officeList[index].isControls = false
				this.officeList[index].isShowPlayBtn = true
			},
			joinTeam(item, index) {
				if (item.isJoin == 1) {
					uni.navigateTo({
						url: '/office/team/index?id=' + item.id
					})
					return false;
				}
				if (item.relationMatch) {
					uni.navigateTo({
						url: '/match/activityDetail/activityDetail?id=' + item.relationMatch.id
					})
					return false;
				}
				req.postRequest(api.user_team_follow, {
					userGroupId: item.id
				}, data => {
					req.msg('加入团队成功');
					this.teamList.splice(index, 1)
					this.getUserTeam();
				})
			},
			// 获取官方动态
			getCmsList() {
				var _this = this;
				req.getRequest(
					'/api/content/list', {
						page: 1,
						limit: 1,
						code: req.public.gfdtCode
					},
					function(res) {
						_this.setData({
							cmsList: res
						});
					}
				);
			},
			getDateTimeStamp(dateStr) {
				return util.getDateDiff(Date.parse(dateStr.replace(/-/gi, "/")));
			},
			
			closeUpdate(){
				this.isShowUpdate = false
			},
			updateInfo(e){
				this.isUpdateInfo = e;
			},
			updateMobile(e){
				this.isUpdateMobile = e;
			},
			getUpdate() {
				console.log('getUpdate')
				let userInfos = req.getStorage('userInfo')
				// if ((!userInfos.avatar || userInfos.avatar.indexOf('thirdwx.qlogo') > -1 || !userInfos.nickName || userInfos.nickName.indexOf('用户') > -1) ) {
				// 	console.log('没有昵称')
				// 	this.isShowUpdate = true;
				// 	this.isUpdateInfo = true;
				// 	return false;
				// }
				if(!userInfos.mobile){
					console.log('没有手机号')
					this.isShowUpdate = true
					this.isUpdateMobile = true
					return false;
				}
				return true;
			},
		},
		created() {
			const systemInfo = uni.getSystemInfoSync();
			// px转换到rpx的比例
			let pxToRpxScale = 750 / systemInfo.windowWidth;
			let systems = {
				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
			};
			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
			this.systems = systems;
		},
		onShareAppMessage: function() {
			let path = '/pages/interactive/index?isShare=' + true;
			if (req.getStorage('userInfo')) {
				path += '&userId=' + req.getStorage('userInfo').id;
			}
			if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
				path += '&merchantId=' + req.getStorage('MERCHANT').id;

				if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
					path += '&shopId=' + req.getStorage('smallShop').id;
				}
			}
			let title = '';
			if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
				title = this.merchant.title;
			} else {
				title = this.config.CONFIG_PROJECT_TITLE;
			}
			return {
				title: (req.excludeSpecial(req.getStorage('userInfo').nickName) ? req.excludeSpecial(req.getStorage(
					'userInfo').nickName) : '') + '为你推荐' + title,
				path: path
			};
		},
		onShareTimeline() {
			let path = 'isShare=' + true;
			if (req.getStorage('userInfo')) {
				path += '&userId=' + req.getStorage('userInfo').id;
			}
			if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
				path += '&merchantId=' + req.getStorage('MERCHANT').id;

				if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
					path += '&shopId=' + req.getStorage('smallShop').id;
				}
			}
			let title = '';
			if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
				title = this.merchant.title;
			} else {
				title = this.config.CONFIG_PROJECT_TITLE;
			}
			return {
				title: (req.excludeSpecial(req.getStorage('userInfo').nickName) ? req.excludeSpecial(req.getStorage(
					'userInfo').nickName) : '') + '为你推荐' + title,
				query: path
			};
		},
		
	}
</script>

<style>
	@import "./index.css";
</style>