<template>
	<div class="userCenterMyIntegral">
		<div class="user">
			<div class="head">
				<div class="headPortrait">
					<img
						v-if="!booleanFlag.headPortraitDefaultImg"
						:src="'api/file/pub/' + user.umsUser.userPic"
						alt=""
						style="width: 100%; height: 100%"
						@error="booleanFlag.headPortraitDefaultImg = true"
					/>
					<img
						v-if="booleanFlag.headPortraitDefaultImg"
						:src="require('@/assets/img/userCenter/user.png')"
						alt=""
						style="width: 100%; height: 100%"
					/>
				</div>
				<!-- <div class="level">
					<div v-if="isZh">
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/level02.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
					<div v-else>
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/黄金用户e.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
				</div> -->
				<!-- 白银用户 -->
				<div v-if="userLevel1 == 2" class="level">
					<div v-if="isZh">
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/白银用户.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
					<div v-else>
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/@1白银用户.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
				</div>
				<!-- 黄金用户 -->
				<div v-if="userLevel1 == 3" class="level">
					<div v-if="isZh">
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/level02.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
					<div v-else>
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/黄金用户e.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
				</div>
				<!-- 白金用户 -->
				<div v-if="userLevel1 == 4" class="level">
					<div v-if="isZh">
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/白金用户.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
					<div v-else>
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/白金用户e.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
				</div>
				<!-- 钻石用户 -->
				<div v-if="userLevel1 == 5" class="level">
					<div v-if="isZh">
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/白金用户.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
					<div v-else>
						<img
							v-if="!booleanFlag.levelDefaultImg"
							:src="require('@/assets/img/userCenter/白金用户e.png')"
							alt=""
							style="width: 100%; height: 100%"
						/>
					</div>
				</div>
			</div>
			<div class="content">
				<div class="name">
					<span>{{ realName }}</span>
					<span class="tag _568AD5" v-if="user.umsUser.realStatus">{{
						realStatusDicts[user.umsUser.realStatus]
					}}</span>
					<!-- <span class="tag _70D56F" v-if="user.umsUser.userEmailStatus">{{
							userEmailStatusDicts[user.umsUser.userEmailStatus]
					}}</span> -->
					<span class="tag _70D56F" v-if="user.umsUser.userEmailStatus == '0'">
						{{ $i18n.locale == 'zh' ? '邮箱已验证' : 'Email Verified' }}
					</span>
					<span class="tag _70D56F" v-if="user.umsUser.userEmailStatus == '1'">
						{{ $i18n.locale == 'zh' ? '邮箱未验证' : 'Email Not Verified' }}
					</span>
					<!-- <span class="tag _F9AF55" v-if="user.umsUser.userMobileStatus">{{
							userMobileStatusDicts[user.umsUser.userMobileStatus]
					}}</span> -->
					<span
						class="tag _F9AF55"
						v-if="user.umsUser.userMobileStatus == '0'"
						>{{ $i18n.locale == 'zh' ? '手机已验证' : 'Mobile Verified' }}</span
					>
					<span
						class="tag _F9AF55"
						v-if="user.umsUser.userMobileStatus == '1'"
						>{{
							$i18n.locale == 'zh' ? '手机未验证' : 'Mobile Not Verified'
						}}</span
					>
				</div>
				<div class="integral">
					<span
						>{{ $i18n.locale == 'zh' ? '可用积分' : 'Available Integral' }}：
					</span>
					<span style="font-size: 16px; color: #ef790c">{{ integral }}</span>
					<el-button
						:disabled="whetherFreez"
						type="primary"
						style="margin-left: 60px; vertical-align: super"
						@click="booleanFlag.checkInsFlag = true"
					>
						{{ $i18n.locale == 'zh' ? '签到' : 'Sign In' }}
					</el-button>
					<el-button
						:disabled="whetherFreez"
						type="primary"
						style="vertical-align: super"
						@click="
							toView('userCenterIntegralExchange', {
								key: '/userCenterIntegralExchange',
							})
						"
					>
						{{ $i18n.locale == 'zh' ? '积分兑换' : 'Integral Exchange' }}
					</el-button>
				</div>
			</div>
		</div>
		<div class="task">
			<div class="title">
				<span
					style="
						width: 7px;
						height: 19px;
						background-color: #265186;
						margin-left: 4px;
					"
				></span>
				<span style="margin-left: 8px; color: #265186">{{
					$i18n.locale == 'zh' ? '新手任务' : 'New Task'
				}}</span>
			</div>

			<el-tabs v-model="activeName">
				<el-tab-pane
					:label="$i18n.locale === 'zh' ? '积分任务' : 'Integral Task'"
					name="first"
				>
					<div class="content">
						<div
							v-for="item in userTaskComplete.other.piont_newbie_task"
							class="card"
						>
							<div style="width: 126px; display: flex; align-items: center">
								<div style="margin-left: 30px">
									<div v-if="isZh">
										<img
											v-if="item.count == item.number"
											:src="newDoneTasks[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
										<img
											v-else
											:src="newUnDoneTasks[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
									</div>
									<div v-else>
										<img
											v-if="item.count == item.number"
											:src="newDoneTasksEn[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
										<img
											v-else
											:src="newUnDoneTasksEn[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
									</div>
								</div>
							</div>
							<div
								style="
									flex: 1;
									display: flex;
									flex-direction: column;
									justify-content: center;
									font-size: 16px;
								"
							>
								<div>
									<!-- <span style="font-weight: 600">{{ item.taskName }}</span> -->
									<span style="font-weight: 600">{{
										$i18n.locale == 'zh' ? item.taskName : item.taskNameEn
									}}</span>
								</div>
								<div style="margin-top: 10px; display: flex">
									<div class="integral">
										<img
											style="width: 16px"
											src="../../../assets/img/userCenter/integral.png"
											alt=""
										/>
										<span>{{
											$i18n.locale == 'zh' ? '积分' : 'Integral'
										}}</span>
										<span style="color: #e01729; margin-left: 5px"
											>+{{ item.taskPoint.day1 }}</span
										>
									</div>
									<div style="margin: 0 10px" class="grow">
										<span
											>{{ $i18n.locale == 'zh' ? '已完成' : 'done' }}
											{{ item.count }}/{{ item.number }}</span
										>
									</div>
								</div>
							</div>
							<div
								style="padding-right: 20px; display: flex; align-items: center"
							>
								<el-button
									type="primary"
									style="
										color: #858585;
										background-color: transparent;
										border-color: #858585;
									"
									v-if="item.count == item.number"
									>{{ $i18n.locale == 'zh' ? '已完成' : 'done' }}
								</el-button>
								<el-button
									:disabled="whetherFreez"
									type="primary"
									style="color: #66b1ff; background-color: #fff"
									v-else
									@click="toCompleteTheTask(item)"
									>{{ $i18n.locale == 'zh' ? '去完成' : 'unfinished' }}
								</el-button>
							</div>
						</div>
					</div>
				</el-tab-pane>
				<el-tab-pane
					:label="$i18n.locale === 'zh' ? '成长值任务' : 'Growth Task'"
					name="second"
				>
					<div class="content">
						<div v-for="item in growNewTask" class="card">
							<div style="width: 126px; display: flex; align-items: center">
								<div style="margin-left: 30px">
									<div v-if="isZh">
										<img
											v-if="item.count == item.number"
											:src="newDoneTasks[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
										<img
											v-else
											:src="newUnDoneTasks[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
									</div>
									<div v-else>
										<img
											v-if="item.count == item.number"
											:src="newDoneTasksEn[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
										<img
											v-else
											:src="newUnDoneTasksEn[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
									</div>
								</div>
							</div>
							<div
								style="
									flex: 1;
									display: flex;
									flex-direction: column;
									justify-content: center;
									font-size: 16px;
								"
							>
								<div>
									<span style="font-weight: 600">{{
										$i18n.locale == 'zh' ? item.taskName : item.taskNameEn
									}}</span>
								</div>
								<div style="margin-top: 10px; display: flex">
									<div style="margin: 0 10px" class="grow">
										<img
											style="width: 16px"
											src="../../../assets/img/userCenter/grow.png"
											alt=""
										/>
										<span>{{
											$i18n.locale == 'zh' ? '成长值' : 'GrowthValue'
										}}</span>
										<span style="color: #2dc22b; margin-left: 5px"
											>+{{ item.growth }}</span
										>
										<span style="margin-left: 10px"
											>{{ $i18n.locale == 'zh' ? '已完成' : 'done' }}
											{{ item.count }}/{{ item.number }}</span
										>
									</div>
								</div>
							</div>
							<div
								style="padding-right: 20px; display: flex; align-items: center"
							>
								<el-button
									type="primary"
									style="
										color: #858585;
										background-color: transparent;
										border-color: #858585;
									"
									v-if="item.count == item.number"
									>{{ $i18n.locale == 'zh' ? '已完成' : 'done' }}
								</el-button>
								<el-button
									:disabled="whetherFreez"
									type="primary"
									style="color: #66b1ff; background-color: #fff"
									v-else
									@click="toCompleteGrowthTask(item)"
									>{{ $i18n.locale == 'zh' ? '去完成' : 'unfinished' }}
								</el-button>
							</div>
						</div>
					</div>
				</el-tab-pane>
			</el-tabs>
		</div>
		<div class="task" style="margin-bottom: 20px">
			<div class="title">
				<span
					style="
						width: 7px;
						height: 19px;
						background-color: #265186;
						margin-left: 4px;
					"
				></span>
				<span style="margin-left: 8px; color: #265186">{{
					$i18n.locale == 'zh' ? '日常任务' : 'Daily Task'
				}}</span>
			</div>
			<el-tabs v-model="activeName1">
				<el-tab-pane
					:label="$i18n.locale === 'zh' ? '积分任务' : 'Integral Task'"
					name="first1"
				>
					<div class="content">
						<div
							v-for="item in userTaskComplete.other.point_daily_task"
							class="card"
						>
							<div style="width: 126px; display: flex; align-items: center">
								<div style="margin-left: 30px">
									<div v-if="isZh">
										<img
											v-if="item.count == item.number"
											:src="dayDoneTasks[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
										<img
											v-else
											:src="dayUnDoneTasks[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
									</div>
									<div v-else>
										<img
											v-if="item.count == item.number"
											:src="dayDoneTasksEn[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
										<img
											v-else
											:src="dayUnDoneTasksEn[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
									</div>
								</div>
							</div>
							<div
								style="
									flex: 1;
									display: flex;
									flex-direction: column;
									justify-content: center;
									font-size: 16px;
								"
							>
								<div>
									<span style="font-weight: 600">{{
										$i18n.locale == 'zh' ? item.taskName : item.taskNameEn
									}}</span>
								</div>
								<div style="margin-top: 10px">
									<img
										style="width: 18px"
										src="../../../assets/img/userCenter/integral.png"
										alt=""
									/>
									<span>{{ $i18n.locale == 'zh' ? '积分' : 'Integral' }}</span>
									<span>{{
										item.taskPoint.day1.indexOf('-') == -1 ? '+' : ''
									}}</span>
									<span style="color: #e01729; margin-left: 5px">{{
										item.taskPoint.day1
									}}</span>

									<span style="margin-left: 30px"
										>{{ $i18n.locale == 'zh' ? '已完成' : 'done' }}
										{{ item.count }}/{{ item.number }}</span
									>
								</div>
							</div>
							<div
								style="padding-right: 20px; display: flex; align-items: center"
							>
								<el-button
									type="primary"
									style="
										color: #858585;
										background-color: transparent;
										border-color: #858585;
									"
									v-if="item.count == item.number"
								>
									{{ $i18n.locale == 'zh' ? '已完成' : 'done' }}
								</el-button>
								<el-button
									:disabled="whetherFreez"
									type="primary"
									style="color: #66b1ff; background-color: #fff"
									v-else
									@click="toCompleteTheTask(item)"
									>{{ $i18n.locale == 'zh' ? '去完成' : 'unfinished' }}
								</el-button>
							</div>
						</div>
					</div>
				</el-tab-pane>
				<el-tab-pane
					:label="$i18n.locale === 'zh' ? '成长值任务' : 'Growth Task'"
					name="second1"
				>
					<div class="content">
						<div v-for="item in growDailyTask" class="card">
							<div style="width: 126px; display: flex; align-items: center">
								<div style="margin-left: 30px">
									<div v-if="isZh">
										<img
											v-if="item.count == item.number"
											:src="dayDoneTasks[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
										<img
											v-else
											:src="dayUnDoneTasks[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
									</div>
									<div v-else>
										<img
											v-if="item.count == item.number"
											:src="dayDoneTasksEn[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
										<img
											v-else
											:src="dayUnDoneTasksEn[item.taskDict]"
											alt=""
											style="width: 68px"
										/>
									</div>
								</div>
							</div>
							<div
								style="
									flex: 1;
									display: flex;
									flex-direction: column;
									justify-content: center;
									font-size: 16px;
								"
							>
								<div>
									<span style="font-weight: 600">{{
										$i18n.locale == 'zh' ? item.taskName : item.taskNameEn
									}}</span>
								</div>
								<div style="margin-top: 10px">
									<img
										style="width: 18px"
										src="../../../assets/img/userCenter/grow.png"
										alt=""
									/>
									<span>{{ $i18n.locale == 'zh' ? '成长值' : 'Growth' }}</span>
									<span>{{ item.growth.indexOf('-') == -1 ? '+' : '' }}</span>
									<span style="color: #e01729; margin-left: 5px">{{
										item.growth
									}}</span>

									<span style="margin-left: 30px"
										>{{ $i18n.locale == 'zh' ? '已完成' : 'done' }}
										{{ item.count }}/{{ item.number }}</span
									>
								</div>
							</div>
							<div
								style="padding-right: 20px; display: flex; align-items: center"
							>
								<el-button
									type="primary"
									style="
										color: #858585;
										background-color: transparent;
										border-color: #858585;
									"
									v-if="item.count == item.number"
								>
									{{ $i18n.locale == 'zh' ? '已完成' : 'done' }}
								</el-button>
								<el-button
									:disabled="whetherFreez"
									type="primary"
									style="color: #66b1ff; background-color: #fff"
									v-else
									@click="toCompleteGrowthTask(item)"
									>{{ $i18n.locale == 'zh' ? '去完成' : 'unfinished' }}
								</el-button>
							</div>
						</div>
					</div>
				</el-tab-pane>
			</el-tabs>
		</div>
		<!-- 签到dialog -->
		<el-dialog
			center
			:modal="false"
			custom-class="userCenterMyIntegralDialog"
			style="margin-top: 180px"
			:visible.sync="booleanFlag.checkInsFlag"
			width="480px"
		>
			<span slot="title">
				<i class="el-icon-present" style="color: #fb630d"></i>
				{{ $i18n.locale == 'zh' ? '签到领积分' : 'Sign in and get points' }}
			</span>
			<div class="content">
				<div
					style="display: flex; flex-wrap: wrap; justify-content: space-between"
				>
					<div
						class="item"
						:class="{ notSignIn: index >= userTaskComplete.sign.length }"
						v-for="(value, name, index) in userTaskComplete.signTask.taskPoint"
						:key="'userCenterMyIntegralDialog' + index"
					>
						<div class="title">
							<span>
								{{
									$i18n.locale == 'zh' ? `第${index + 1}天` : `Day ${index + 1}`
								}}
							</span>
						</div>
						<div class="integral">
							<div style="margin-top: 18px">
								<i class="el-icon-present"></i>
							</div>
							<div>
								<span
									>{{ value
									}}{{ $i18n.locale == 'zh' ? '积分' : 'points' }}</span
								>
							</div>
						</div>
					</div>
				</div>
				<div style="text-align: center">
					<el-button
						:disabled="isShow"
						type="primary"
						round
						style="width: 150px"
						@click="toSignIn"
					>
						{{ $i18n.locale == 'zh' ? '签到' : 'Sign In' }}
					</el-button>
				</div>
			</div>
		</el-dialog>
		<!-- 分享dialog -->
		<el-dialog
			style="margin-top: 180px"
			:title="isZh ? '请登录App分享' : 'Please log in to the app to share'"
			:visible.sync="shareDialogVisible"
			width="15%"
			:before-close="shareDialogBeforeClose"
		>
			<div style="margin-left: 18%">
				<img src="../../../assets/img/userCenter/share.png" alt="" />
			</div>
			<div slot="footer">
				<el-button @click="shareDialogVisible = false"
					>{{ $i18n.locale == 'zh' ? '取 消' : 'Cancel' }}
				</el-button>
				<el-button type="primary" @click="shareDialogVisible = false"
					>{{ $i18n.locale == 'zh' ? '确 定' : 'Determine' }}
				</el-button>
			</div>
		</el-dialog>
	</div>
</template>

<script>
import {
	addSignPointDetail,
	getUserPointPage,
	completeGrowthValue,
	growthValueTaskList,
	addPointDetailByTaskDict,
} from '@/api/user'
import { judgeLogin } from '@/api/login'
import moment from 'moment'
import { getToken } from '@/api/token'

export default {
	name: 'userCenterMyIntegral',
	data() {
		return {
			isShow: null,
			shareDialogVisible: false,
			activeName: 'first',
			activeName1: 'first1',
			booleanFlag: {
				headPortraitDefaultImg: false,
				levelDefaultImg: false,
				checkInsFlag: false,
			},
			user: {
				umsUser: {},
			},
			phoneVervificationSuccess: {},
			integral: '',
			// 积分任务
			userTaskComplete: {
				other: {},
				sign: [],
				signTask: {},
			},
			clickTask: {},
			clickGrowthTask: {},
			// 成长值任务
			growTask: [],
			userTypeDicts: {
				2: this.$t('common.UserUsertyp1'),
				5: this.$t('common.UserUsertyp2'),
				4: this.$t('common.UserUsertyp3'),
			},
			userMobileStatusDicts: {
				0: this.$t('common.PhoneNumberVerified'),
				1: this.$t('common.PhoneNumberNotVerified'),
			},
			userEmailStatusDicts: {
				0: this.$t('common.EmailVerified'),
				1: this.$t('common.EmailNotVerified'),
			},
			realStatusDicts: {
				true: this.$t('common.RealNameVerification'),
				false: this.$t('common.RealNameNotVerification'),
			},
			isZh: true,
			// 新手未完成任务
			newUnDoneTasks: {
				// 完善个人信息
				point_task_complete_info: require('@/assets/img/userCenter/Pointsaccount/newMask/undone/未完成个人信息完善.png'),
				// 实名认证
				point_task_verified_name: require('@/assets/img/userCenter/Pointsaccount/newMask/undone/未完成实名认证.png'),
				// 绑定邮箱
				point_task_bind_email: require('@/assets/img/userCenter/Pointsaccount/newMask/undone/未完成绑定邮箱.png'),
				// 设置昵称
				point_task_set_nickname: require('@/assets/img/userCenter/Pointsaccount/newMask/undone/未完成设置昵称.png'),
				// 头像
				point_task_upload_head_portrait: require('@/assets/img/userCenter/Pointsaccount/newMask/undone/未完成上传头像.png'),
				// 绑定手机号
				point_task_bind_phone: require('@/assets/img/userCenter/Pointsaccount/newMask/undone/未完成绑定手机号.png'),
			},
			// 新手未完成任务英文
			newUnDoneTasksEn: {
				// 完善个人信息
				point_task_complete_info: require('@/assets/img/userCenter/Pointsaccount/newMask/undoneEn/个人信息完善.png'),
				// 实名认证
				point_task_verified_name: require('@/assets/img/userCenter/Pointsaccount/newMask/undoneEn/完成实名认证E.png'),
				// 绑定邮箱
				point_task_bind_email: require('@/assets/img/userCenter/Pointsaccount/newMask/undoneEn/绑定邮箱E.png'),
				// 设置昵称
				point_task_set_nickname: require('@/assets/img/userCenter/Pointsaccount/newMask/undoneEn/设置昵称E.png'),
				// 头像
				point_task_upload_head_portrait: require('@/assets/img/userCenter/Pointsaccount/newMask/undoneEn/上传头像.png'),
				// 绑定手机号
				point_task_bind_phone: require('@/assets/img/userCenter/Pointsaccount/newMask/undoneEn/绑定收集好E.png'),
			},

			// 新手完成任务
			newDoneTasks: {
				// 完善个人信息
				point_task_complete_info: require('@/assets/img/userCenter/Pointsaccount/newMask/done/完成个人信息完善.png'),
				// 实名认证
				point_task_verified_name: require('@/assets/img/userCenter/Pointsaccount/newMask/done/完成实名认证.png'),
				// 绑定邮箱
				point_task_bind_email: require('@/assets/img/userCenter/Pointsaccount/newMask/done/完成绑定邮箱.png'),
				// 设置昵称
				point_task_set_nickname: require('@/assets/img/userCenter/Pointsaccount/newMask/done/完成设置昵称.png'),
				// 头像
				point_task_upload_head_portrait: require('@/assets/img/userCenter/Pointsaccount/newMask/done/完成上传头像.png'),
				// 绑定手机号
				point_task_bind_phone: require('@/assets/img/userCenter/Pointsaccount/newMask/done/完成绑定手机号.png'),
			},
			// 新手完成任务英文
			newDoneTasksEn: {
				// 完善个人信息
				point_task_complete_info: require('@/assets/img/userCenter/Pointsaccount/newMask/doneEn/个人信息完善完成E.png'),
				// 实名认证
				point_task_verified_name: require('@/assets/img/userCenter/Pointsaccount/newMask/doneEn/完成实名认证完成E.png'),
				// 绑定邮箱
				point_task_bind_email: require('@/assets/img/userCenter/Pointsaccount/newMask/doneEn/绑定邮箱完成E.png'),
				// 设置昵称
				point_task_set_nickname: require('@/assets/img/userCenter/Pointsaccount/newMask/doneEn/设置昵称完成E.png'),
				// 头像
				point_task_upload_head_portrait: require('@/assets/img/userCenter/Pointsaccount/newMask/doneEn/上传头像完成E.png'),
				// 绑定手机号
				point_task_bind_phone: require('@/assets/img/userCenter/Pointsaccount/newMask/doneEn/绑定手机号完成E.png'),
			},
			// 日常未完成任务
			dayUnDoneTasks: {
				// 发布无效留言
				releasing_invalid_messages: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成阅读咨询.png'),
				// 上传无效资料
				uploading_invalid_data: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成阅读咨询.png'),
				// 阅读咨询
				point_read_information: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成阅读咨询.png'),
				// 分享咨询
				point_task_share_information: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成分享.png'),
				// 上传资源成果
				point_task_upload_resources_result: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成上传成果.png'),
				// 分享项目
				point_task_share_project: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成分享.png'),
				// 上传项目资源
				point_task_upload_resources_project: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成上传成果.png'),
				// 上传咨询信息
				point_task_upload_information: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成上传成果.png'),
				// 上传期刊信息
				point_task_upload_journal: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成上传成果.png'),
				// 收藏项目、国别、企业
				point_task_collect: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成关注.png'),
				// 关注项目、国别、企业
				point_task_attention: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成关注.png'),
				// 查看资源项目
				point_task_view_resources_project: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成查看项目资源.png'),
				// 平台问题反馈
				platform_problem_feedback: require('@/assets/img/userCenter/grow/undone/问题反馈_未完成.png'),
				// 参与合作交流活动报名成功
				activity_registration_successful: require('@/assets/img/userCenter/grow/undone/活动报名成功_未完成.png'),
				// 上传调研资源并审核通过
				point_task_upload_research_resources: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成上传成果.png'),
				// 提交留言一次
				aubmit_a_message_once: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成上传成果.png'),
				// 参与会议活动报名成功
				meeting_registration_successful: require('@/assets/img/userCenter/grow/undone/会议报名成功_未完成.png'),
				// 留言被点赞
				the_message_was_liked: require('@/assets/img/userCenter/grow/undone/留言被点赞_未完成.png'),
				// 登录打卡
				point_task_sign: require('@/assets/img/userCenter/grow/undone/登录打卡_未完成.png'),
				// 留言被收藏
				message_is_saved: require('@/assets/img/userCenter/grow/undone/留言被收藏_未完成.png'),
				// 项目被平台推荐
				project_recommended: require('@/assets/img/userCenter/grow/undone/项目被平台推荐_未完成.png'),
				// 发展合作留言
				point_task_development_cooperation_message: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成发展合作留言.png'),
				// 项目问询
				point_task_project_ask: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成项目问询.png'),
				// 项目留言
				point_task_project_message: require('@/assets/img/userCenter/Pointsaccount/dayMask/undone/未完成项目留言.png'),
			},

			// 日常未完成任务英文
			dayUnDoneTasksEn: {
				// 发布无效留言
				// releasing_invalid_messages: require("@/assets/img/userCenter/enIcon/undoneEn/未完成阅读咨询.png"),
				// 上传无效资料
				// uploading_invalid_data: require("@/assets/img/userCenter/enIcon/undoneEn/未完成阅读咨询.png"),
				// 阅读咨询
				point_read_information: require('@/assets/img/userCenter/enIcon/undoneEn/阅读资讯E.png'),
				// 分享咨询
				point_task_share_information: require('@/assets/img/userCenter/enIcon/undoneEn/分享资讯E.png'),
				// 上传资源成果
				point_task_upload_resources_result: require('@/assets/img/userCenter/enIcon/undoneEn/上传研究成果并审核通过E.png'),
				// 分享项目
				point_task_share_project: require('@/assets/img/userCenter/enIcon/undoneEn/分享项目E.png'),
				// 上传项目资源
				point_task_upload_resources_project: require('@/assets/img/userCenter/enIcon/undoneEn/上传项目资源并审核通过E.png'),
				// 上传咨询信息
				point_task_upload_information: require('@/assets/img/userCenter/enIcon/undoneEn/上传资讯信息并审核通过E.png'),
				// 上传期刊信息
				point_task_upload_journal: require('@/assets/img/userCenter/enIcon/undoneEn/上传期刊信息并审核通过E.png'),
				// 收藏项目、国别、企业
				point_task_collect: require('@/assets/img/userCenter/enIcon/undoneEn/阅读资讯E.png'),
				// 关注项目、国别、企业
				point_task_attention: require('@/assets/img/userCenter/enIcon/undoneEn/关注项目国别企业E.png'),
				// 查看资源项目
				point_task_view_resources_project: require('@/assets/img/userCenter/enIcon/undoneEn/阅读资讯E.png'),
				// 平台问题反馈
				platform_problem_feedback: require('@/assets/img/userCenter/enIcon/undoneEn/平台问题反馈E.png'),
				// 参与合作交流活动报名成功
				activity_registration_successful: require('@/assets/img/userCenter/enIcon/undoneEn/参与合作交流活动报名成功E.png'),
				// 上传调研资源并审核通过
				point_task_upload_research_resources: require('@/assets/img/userCenter/enIcon/undoneEn/上传调研资源并审核通过E.png'),
				// 提交留言一次
				aubmit_a_message_once: require('@/assets/img/userCenter/enIcon/undoneEn/提交留言一次E.png'),
				// 参与会议活动报名成功
				meeting_registration_successful: require('@/assets/img/userCenter/enIcon/undoneEn/参与会议活动报名成功E.png'),
				// 留言被点赞
				the_message_was_liked: require('@/assets/img/userCenter/enIcon/undoneEn/留言被点赞E.png'),
				// 登录打卡
				point_task_sign: require('@/assets/img/userCenter/enIcon/undoneEn/登录打卡E.png'),
				// 留言被收藏
				message_is_saved: require('@/assets/img/userCenter/enIcon/undoneEn/留言被收藏E.png'),
				// 项目被平台推荐
				project_recommended: require('@/assets/img/userCenter/enIcon/undoneEn/项目被平台推荐E.png'),
				// 发展合作留言
				point_task_development_cooperation_message: require('@/assets/img/userCenter/enIcon/undoneEn/发展合作留言E.png'),
				// 项目问询
				point_task_project_ask: require('@/assets/img/userCenter/enIcon/undoneEn/项目问询E.png'),
				// 项目留言
				point_task_project_message: require('@/assets/img/userCenter/enIcon/undoneEn/项目留言E.png'),
			},

			// 日常完成任务
			dayDoneTasks: {
				// 发布无效留言
				releasing_invalid_messages: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成阅读咨询.png'),
				// 上传无效资料
				uploading_invalid_data: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成阅读咨询.png'),
				// 阅读咨询
				point_read_information: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成阅读咨询.png'),
				// 分享咨询
				point_task_share_information: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成分享.png'),
				// 上传资源成果
				point_task_upload_resources_result: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成上传成果.png'),
				// 分享项目
				point_task_share_project: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成分享.png'),
				// 上传项目资源
				point_task_upload_resources_project: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成上传成果.png'),
				// 上传咨询信息
				point_task_upload_information: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成上传成果.png'),
				// 上传期刊信息
				point_task_upload_journal: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成上传成果.png'),
				// 收藏项目、国别、企业
				point_task_collect: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成关注.png'),
				// 关注项目、国别、企业
				point_task_attention: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成关注.png'),
				// 查看资源项目
				point_task_view_resources_project: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成查看项目资源.png'),
				// 平台问题反馈
				platform_problem_feedback: require('@/assets/img/userCenter/grow/done/问题反馈_已完成.png'),
				// 参与合作交流活动报名成功
				activity_registration_successful: require('@/assets/img/userCenter/grow/done/活动报名成功_已完成.png'),
				// 上传调研资源并审核通过
				point_task_upload_research_resources: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成上传成果.png'),
				// 提交留言一次
				aubmit_a_message_once: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成上传成果.png'),
				// 参与会议活动报名成功
				meeting_registration_successful: require('@/assets/img/userCenter/grow/done/会议报名成功_已完成.png'),
				// 留言被点赞
				the_message_was_liked: require('@/assets/img/userCenter/grow/done/留言被点赞_已完成.png'),
				// 登录打卡
				point_task_sign: require('@/assets/img/userCenter/grow/done/登录打卡_已完成.png'),
				// 留言被收藏
				message_is_saved: require('@/assets/img/userCenter/grow/done/留言被收藏_已完成.png'),
				// 项目被平台推荐
				project_recommended: require('@/assets/img/userCenter/grow/done/项目被平台推荐_已完成.png'),
				// 发展合作留言
				point_task_development_cooperation_message: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成发展合作留言.png'),
				// 项目问询
				point_task_project_ask: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成项目问询.png'),
				// 项目留言
				point_task_project_message: require('@/assets/img/userCenter/Pointsaccount/dayMask/done/完成项目留言.png'),
			},
			// 日常完成任务英文
			dayDoneTasksEn: {
				// 发布无效留言
				// releasing_invalid_messages: require("@/assets/img/userCenter/enIcon/undoneEn/未完成阅读咨询.png"),
				// 上传无效资料
				// uploading_invalid_data: require("@/assets/img/userCenter/enIcon/undoneEn/未完成阅读咨询.png"),
				// 阅读咨询
				point_read_information: require('@/assets/img/userCenter/enIcon/doneEn/阅读资讯完成E.png'),
				// 分享咨询
				point_task_share_information: require('@/assets/img/userCenter/enIcon/doneEn/分享资讯完成E.png'),
				// 上传资源成果
				point_task_upload_resources_result: require('@/assets/img/userCenter/enIcon/doneEn/上传研究成果并审核通过完成E.png'),
				// 分享项目
				point_task_share_project: require('@/assets/img/userCenter/enIcon/doneEn/分享项目完成E.png'),
				// 上传项目资源
				point_task_upload_resources_project: require('@/assets/img/userCenter/enIcon/doneEn/上传项目资源并审核通过完成E.png'),
				// 上传咨询信息
				point_task_upload_information: require('@/assets/img/userCenter/enIcon/doneEn/上传资讯信息并审核通过完成E.png'),
				// 上传期刊信息
				point_task_upload_journal: require('@/assets/img/userCenter/enIcon/doneEn/上传期刊信息并审核通过完成E.png'),
				// 收藏项目、国别、企业
				point_task_collect: require('@/assets/img/userCenter/enIcon/doneEn/阅读资讯完成E.png'),
				// 关注项目、国别、企业
				point_task_attention: require('@/assets/img/userCenter/enIcon/doneEn/关注项目国别企业完成E.png'),
				// 查看资源项目
				point_task_view_resources_project: require('@/assets/img/userCenter/enIcon/doneEn/阅读资讯完成E.png'),
				// 平台问题反馈
				platform_problem_feedback: require('@/assets/img/userCenter/enIcon/doneEn/平台问题反馈完成E.png'),
				// 参与合作交流活动报名成功
				activity_registration_successful: require('@/assets/img/userCenter/enIcon/doneEn/参与合作交流活动报名成功完成E.png'),
				// 上传调研资源并审核通过
				point_task_upload_research_resources: require('@/assets/img/userCenter/enIcon/doneEn/上传调研资源并审核通过完成E.png'),
				// 提交留言一次
				aubmit_a_message_once: require('@/assets/img/userCenter/enIcon/doneEn/提交留言一次完成E.png'),
				// 参与会议活动报名成功
				meeting_registration_successful: require('@/assets/img/userCenter/enIcon/doneEn/参与会议活动报名成功完成E.png'),
				// 留言被点赞
				the_message_was_liked: require('@/assets/img/userCenter/enIcon/doneEn/留言被点赞完成E.png'),
				// 登录打卡
				point_task_sign: require('@/assets/img/userCenter/enIcon/doneEn/登录打卡完成E.png'),
				// 留言被收藏
				message_is_saved: require('@/assets/img/userCenter/enIcon/doneEn/留言被收藏完成E.png'),
				// 项目被平台推荐
				project_recommended: require('@/assets/img/userCenter/enIcon/doneEn/项目被平台推荐完成E.png'),
				// 发展合作留言
				point_task_development_cooperation_message: require('@/assets/img/userCenter/enIcon/doneEn/发展合作留言完成E.png'),
				// 项目问询
				point_task_project_ask: require('@/assets/img/userCenter/enIcon/doneEn/项目问询完成E.png'),
				// 项目留言
				point_task_project_message: require('@/assets/img/userCenter/enIcon/doneEn/项目留言完成E.png'),
			},
			growDailyTask: [],
			growNewTask: [],
			demo: null,
			growth: '',
			language: '',
			whetherFreez: null,
		}
	},
	watch: {
		'$i18n.locale'() {
			this.userTypeDicts = {
				2: this.$t('common.UserUsertyp1'),
				5: this.$t('common.UserUsertyp2'),
				4: this.$t('common.UserUsertyp3'),
			}
			this.userMobileStatusDicts = {
				0: this.$t('common.PhoneNumberVerified'),
				1: this.$t('common.PhoneNumberNotVerified'),
			}
			this.userEmailStatusDicts = {
				0: this.$t('common.EmailVerified'),
				1: this.$t('common.EmailNotVerified'),
			}
			this.realStatusDicts = {
				true: this.$t('common.RealNameVerification'),
				false: this.$t('common.RealNameNotVerification'),
			}

			this.init()
		},
		'$i18n.locale': {
			handler: function () {
				if (this.$i18n.locale == 'zh') {
					this.isZh = true
				} else {
					this.isZh = false
				}
			},
			deep: true,
		},
	},
	mounted() {
		this.language = window.localStorage.getItem('locale')
		if (this.language == 'zh') {
			this.isZh = true
		} else {
			this.isZh = false
		}
		this.init()
	},
	methods: {
		init() {
			this.user = JSON.parse(window.localStorage.getItem('user'))
			if (this.user.umsUser.userPic == undefined) {
				this.user.umsUser.userPic = ''
			}
			this.growthForValue1()
			this.growthForValue()
			this.getUserTaskComplete()
			this.getUmsUserPoints()
			this.judgeWeek()
			// this.test()
		},
		// 获取成长值
		growthForValue1() {
			getUserPointPage().then((res) => {
				if (res) {
					this.demo = res.data
					if (JSON.stringify(this.demo) !== '{}') {
						this.growth = res.data.umsUserPoints[0].growthValue
					} else {
						this.growth = 6000
					}
				}
			})
		},
		// 获取积分任务信息
		getUserTaskComplete() {
			this.$store.dispatch('user/SAVE_USER_TASK_COMPLETE').then((res) => {
				Object.assign(
					this.userTaskComplete,
					JSON.parse(window.localStorage.getItem('userTaskComplete'))
				)
			})
		},
		// 获取成长值任务
		growthForValue() {
			growthValueTaskList().then((res) => {
				if (res) {
					this.growTask = res.data
					console.log(this.growTask)
					this.growDailyTask = this.growTask.point_daily_task
					this.growNewTask = this.growTask.piont_newbie_task
				}
			})
		},
		// 获取积分
		getUmsUserPoints() {
			getUserPointPage().then((res) => {
				if (res) {
					this.integral = res.data.umsUserPoints[0].point
					if (res.data.umsUserPoints[0].pointStatus == 'n') {
						this.$message({
							message:
								this.$i18n.locale == 'zh'
									? '该用户积分已冻结，请联系客服'
									: "The user's points have been frozen, please contact customer service",
							type: 'error',
						})
						this.whetherFreez = true
					} else {
						this.whetherFreez = false
					}
				}
			})
		},
		// 完成积分任务
		toCompleteTheTask(task) {
			this.clickTask = task
			if (task.taskDict == 'point_read_information') {
				// 日常任务
				// 阅读咨询
				this.$router.push({ name: 'realTimeInfo1' })
				// this.addIntegral();
			} else if (task.taskDict == 'point_task_share_information') {
				// 分享咨询
				this.shareDialogVisible = true
				// this.$router.push({ name: "realTimeInfo1" });
				// this.addIntegral();
			} else if (task.taskDict == 'point_task_collect') {
				// 收藏
				this.$router.push({ name: 'myCollection' })
				this.addIntegral()
			} else if (task.taskDict == 'point_task_view_resources_project') {
				// 查看项目资源
				this.$router.push({ name: 'projectPresentation' })
				this.addIntegral()
			} else if (task.taskDict == 'point_task_share_project') {
				// 分享项目
				this.shareDialogVisible = true
				// this.$router.push({ name: "projectPresentation" });
				// this.addIntegral();
			} else if (task.taskDict == 'point_task_upload_resources_project') {
				// 上传项目资源
				this.$router.push({ name: 'addMyProject' })
			} else if (task.taskDict == 'point_task_upload_resources_result') {
				// 上传资源成果
				this.$router.push({ name: 'resourceform' })
			} else if (task.taskDict == 'point_task_upload_information') {
				// 上传咨询信息
				this.$router.push({ name: 'myInfoData' })
			} else if (task.taskDict == 'point_task_bind_phone') {
				// 新手任务
				// 绑定手机号
				this.$router.push({ name: 'securitySettingBindPhone' })
			} else if (task.taskDict == 'point_task_bind_email') {
				// 验证邮箱
				this.$router.push({ name: 'securitySettingChangeMail' })
			} else if (task.taskDict == 'point_task_complete_info') {
				// 完善个人信息
				this.$router.push({ name: 'information' })
			} else if (task.taskDict == 'point_task_upload_head_portrait') {
				// 上传头像
				this.$router.push({ name: 'information' })
			} else if (task.taskDict == 'point_task_verified_name') {
				// 完成实名认证
				this.$router.push({ name: 'authentication' })
			} else if (task.taskDict == 'point_task_attention') {
				// 关注项目、国别、企业等
				this.$router.push({ name: 'projectPresentation' })
				// this.addIntegral();
			} else if (task.taskDict == 'point_task_upload_journal') {
				// 上传期刊信息并审核通过
				this.$router.push({ name: 'myInfoData', params: { index: '6' } })
			} else if (task.taskDict == 'uploading_invalid_data') {
				// 上传无效资料
				// this.addIntegral();
			} else if (
				task.taskDict == 'point_task_development_cooperation_message'
			) {
				// 发展合作留言
				// this.addIntegral();
				this.$router.push({ name: 'developmentCooperation' })
			} else if (task.taskDict == 'point_task_project_ask') {
				// 项目问询
				this.$router.push({ name: 'projectPresentation' })
				// this.addIntegral()
			} else if (task.taskDict == 'activity_registration_successful') {
				// 参与合作交流活动报名成功
				this.$router.push({
					name: 'cooperationExchange',
					query: { language: this.language },
				})
				// this.addIntegral()
			} else if (task.taskDict == 'meeting_registration_successful') {
				// 参与会议活动报名成功
				this.$router.push({ name: 'conferenceServices' })
				// this.addIntegral()
			} else if (task.taskDict == 'point_task_project_message') {
				// 项目留言
				this.$router.push({ name: 'projectPresentation' })
				// this.addIntegral();
			}
		},
		// 完成成长值任务
		toCompleteGrowthTask(task) {
			this.clickGrowthTask = task
			// 上传头像
			if (task.taskDict == 'point_task_upload_head_portrait') {
				this.$router.push({ name: 'information' })
			} else if (task.taskDict == 'point_task_complete_info') {
				// 完善个人信息
				this.$router.push({ name: 'information' })
			} else if (task.taskDict == 'platform_problem_feedback') {
				// 平台问题反馈
				this.$router.push({ name: 'Feedback' })
			} else if (task.taskDict == 'activity_registration_successful') {
				// 参与合作交流活动报名成功
				this.$router.push({ name: 'cooperationExchange' })
			} else if (task.taskDict == 'point_task_upload_resources_project') {
				// 发布项目
				this.$router.push({ name: 'addMyProject' })
			} else if (task.taskDict == 'point_task_upload_research_resources') {
				// 上传调研资源并审核通过
				this.$router.push({ name: 'resourceform' })
			} else if (task.taskDict == 'aubmit_a_message_once') {
				// 提交留言一次
				// this.addGrowth();
				this.$router.push({ name: 'projectPresentation' })
			} else if (task.taskDict == 'point_task_upload_journal') {
				// 上传期刊信息并审核通过
				this.$router.push({ name: 'myInfoData', params: { index: '6' } })
			} else if (task.taskDict == 'point_task_upload_resources_result') {
				// 上传(研究)资源成果并审核通过
				this.$router.push({ name: 'resourceform' })
			} else if (task.taskDict == 'point_task_share_project') {
				// 分享项目
				this.shareDialogVisible = true
				// this.$router.push({ name: "projectPresentation" });
				// this.addGrowth();
			} else if (task.taskDict == 'meeting_registration_successful') {
				// 参与会议活动报名成功
				this.$router.push({ name: 'conferenceServices' })
			} else if (task.taskDict == 'the_message_was_liked') {
				// 留言被点赞
				this.$router.push({ name: 'developmentCooperation' })
			} else if (task.taskDict == 'point_task_attention') {
				// 关注
			} else if (task.taskDict == 'point_task_sign') {
				// 登录打卡
			} else if (task.taskDict == 'message_is_saved') {
				// 留言被收藏
				this.$router.push({ name: 'developmentCooperation' })
			} else if (task.taskDict == 'point_task_upload_information') {
				// 上传资讯信息并审核通过
				this.$router.push({ name: 'myInfoData' })
			} else if (task.taskDict == 'project_recommended') {
				// 项目被平台推荐
			} else if (task.taskDict == 'point_task_share_information') {
				// 分享咨询
				// this.$router.push({ name: "realTimeInfo1" });
				// this.addGrowth();
				this.shareDialogVisible = true
			}
		},

		// 加积分
		addIntegral() {
			console.log(this.clickTask.taskDict)
			getToken().then((res) => {
				addPointDetailByTaskDict(
					{
						taskDict: this.clickTask.taskDict,
						// userId: this.user.userId,
						point: this.clickTask.taskPoint.day1,
					},
					res.data
				)
					.then((res) => {
						this.getUserTaskComplete()
					})
					.catch((error) => {})
			})
		},
		// 加成长值
		addGrowth() {
			getToken().then((res) => {
				completeGrowthValue(
					{
						taskDict: this.clickGrowthTask.taskDict,
						// userId: this.user.userId,
					},
					res.data
				).then((res) => {
					this.growthForValue()
				})
			})
		},

		// 签到
		toSignIn() {
			this.isShow = true

			// 用户未签到过
			if (this.userTaskComplete.sign.length === 0) {
				console.log('未签到')
				getToken().then((res) => {
					addSignPointDetail(
						{
							taskDict: 'point_task_sign',
							point:
								this.userTaskComplete.signTask.taskPoint[
									`day${this.userTaskComplete.sign.length + 1}`
								],
							// userId: this.user.userId,
						},
						res.data
					).then((res) => {
						if (res.status == '200') {
							this.booleanFlag.checkInsFlag = false
							if (this.$i18n.locale == 'zh') {
								this.$message.success('签到成功')
							} else {
								this.$message.success('Sign in successfully')
							}
							// 手机号不能为空
							this.init()
						}
					})
					// .catch((error) => {
					// 	this.$message({
					// 		message: error.msg,
					// 		type: "error",
					// 	});
					// });
				})
			} else {
				// 用户已经签到了
				console.log('已经签到')
				let todayDate = moment(new Date()).format('YYYY-MM-DD')
				var length = this.userTaskComplete.sign.length
				var data = parseInt(length - 1)
				let lastSingIn = moment(
					this.userTaskComplete.sign[data].updateDate
				).format('YYYY-MM-DD')
				console.log(todayDate)
				console.log(lastSingIn)
				if (todayDate != lastSingIn) {
					getToken().then((res) => {
						addSignPointDetail(
							{
								taskDict: 'point_task_sign',
								point:
									this.userTaskComplete.signTask.taskPoint[
										`day${this.userTaskComplete.sign.length + 1}`
									],
								// userId: this.user.userId,
							},
							res.data
						).then((res) => {
							console.log(res)
							if (res.status == '200') {
								this.booleanFlag.checkInsFlag = false
								if (this.$i18n.locale == 'zh') {
									this.$message.success('签到成功')
								} else {
									this.$message.success('Sign in successfully')
								} // 手机号不能为空
								this.init()
							}
						})
						// .catch((error) => {
						//   this.$message({
						//     message: error.msg,
						//     type: "error",
						//   });
						// });
					})
				} else {
					if (this.$i18n.locale == 'zh') {
						this.$message.success('今天已签到')
					} else {
						this.$message.success('I have signed in today')
					}
					this.booleanFlag.checkInsFlag = false
				}
			}
		},
		shareDialogBeforeClose() {
			this.shareDialogVisible = false
		},
		// 判断是周几
		judgeWeek() {
			var whatDay = new Date().getDay()
			if (whatDay == 1) {
				this.userTaskComplete.sign = []
			}
			console.log(whatDay)
		},
		getMyDate(str) {
			if (str == null) {
				return ''
			}
			var oDate = new Date(str),
				oYear = oDate.getFullYear(),
				oMonth = oDate.getMonth() + 1,
				oDay = oDate.getDate(),
				// oHour = oDate.getHours(),
				// oMin = oDate.getMinutes(),
				// oSen = oDate.getSeconds(),
				oTime = oYear + '-' + this.addZero(oMonth) + '-' + this.addZero(oDay)
			return oTime
		},
		//补零操作
		addZero(num) {
			if (parseInt(num) < 10) {
				num = '0' + num
			}
			return num
		},
		toView(route, params) {
			this.$router.push({ name: route, query: params })
		},
	},

	computed: {
		// 判断有无真名
		realName() {
			if (this.user.umsUser.userNickName) {
				return this.user.umsUser.userNickName
			} else {
				return this.user.username
			}
		},
		// 判断会员等级
		userLevel1() {
			if (this.growth >= 0 && this.growth < 1000) {
				return 2
			} else if (this.growth >= 1000 && this.growth < 3000) {
				return 3
			} else if (this.growth >= 3000 && this.growth < 6000) {
				return 4
			} else if (this.growth >= 6000) {
				return 5
			}
		},
	},
}
</script>

<style scoped lang="less">
.userCenterMyIntegral {
	width: 100%;
	padding: 0 18px;
	min-height: 700px;
	box-sizing: border-box;
	overflow: hidden;

	.user {
		display: flex;
		height: 190px;
		border-bottom: 1px solid #eeeff3;

		.head {
			width: 140px;

			.headPortrait {
				width: 82px;
				height: 82px;
				border-radius: 50%;
				margin: 27px auto 0;
			}

			.level {
				width: 108px;
				height: 28px;
				border-radius: 14px;
				margin: 8px auto 0;
			}
		}

		.content {
			flex: 1;

			.name {
				width: 100%;
				margin-top: 40px;
				margin-left: 23px;
				font-size: 22px;
				font-weight: 600;
				display: flex;
				align-items: center;

				.tag {
					font-size: 14px;
					line-height: 20px;
					padding: 0 8px;
					border-radius: 4px;
					height: 20px;
					margin-left: 18px;
					font-weight: 400;
				}

				._568AD5 {
					background-color: #568ad53d;
					color: #568ad5;
				}

				._70D56F {
					background-color: #70d56f3d;
					color: #70d56f;
				}

				._F9AF55 {
					background-color: #f9af553d;
					color: #f9af55;
				}
			}

			.integral {
				margin-top: 40px;
				margin-left: 23px;
				font-size: 18px;
			}
		}
	}

	.task {
		.title {
			width: 100%;
			// border-bottom: 1px solid #eeeff3;

			> span {
				display: inline-block;
				font-size: 18px;
				font-weight: 600;
				line-height: 70px;
				vertical-align: middle;
			}
		}

		.content {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;

			.card {
				width: 460px;
				height: 100px;
				background-color: #f6f7f9;
				border-radius: 6px;
				margin-top: 17px;
				display: flex;
			}
		}
	}

	/deep/ .el-dialog__wrapper {
		background-color: transparent !important;
	}
}

.userCenterMyIntegralDialog {
	.content {
		.item {
			width: 100px;
			height: 92px;
			margin-bottom: 6px;

			.title {
				width: 56px;
				height: 24px;
				background-color: #73d502;
				text-align: center;
				border-radius: 12px;
				margin: 0 auto;
				z-index: 20;
				position: relative;

				span {
					font-size: 14px;
					color: #fff;
					line-height: 24px;
				}
			}

			.integral {
				text-align: center;
				width: 100%;
				height: 78px;
				border-radius: 7px;
				border: 1px solid #73d502;
				margin-top: -12px;
				z-index: 10;
				position: relative;
				background: linear-gradient(to bottom, #f4fffa, #c7f5db);
				color: #73d502;

				i {
					font-size: 22px;
				}

				span {
					font-size: 13px;
				}
			}

			&:last-child {
				width: 210px;
			}
		}

		.notSignIn {
			.title {
				background-color: #fbb086;
			}

			.integral {
				border: 1px solid #fbb086;
				background: linear-gradient(to bottom, #fef8ea, #fef8ea);
				color: #fbb086;
			}
		}
	}
}
</style>
