<template>
    <view class="body">
        <view class="head">
            <view class="userTitle">
                <image v-if="userInfo.avatar" :src="userInfo.avatar" mode=""></image>
                <image v-else src="../../static/img/head.svg" mode=""></image>
                <view class="userRight">
                    <view class="userTel" v-if="userInfo.user_name">
                        {{ auth.authInfo.realName ? auth.authInfo.realName : phoneFilter(userInfo.user_name) }}
                    </view>
                    <view class="userTel" v-else></view>
                    <view class="userContent">
                        <view style="margin-right: 40rpx">
                            实名认证：{{ auth.realNameState ? '已认证' : '未认证' }}
                        </view>
                        <!-- <view>银行卡核验：{{auth.bankCardState?'已认证':'未认证'}}</view> -->
                    </view>
                </view>
            </view>
            <view class="centerBar">
                <view class="BarList" @click="go('/pages/my/Browsinghistory')">
                    <image src="../../static/img/resumeMy.svg" mode=""></image>
                    我的邀请
                </view>
                <view class="BarList" @click="go('/pageMy/myProject/myProject')">
                    <image src="../../static/img/job.svg" mode=""></image>
                    我的申请
                </view>
                <view class="BarList" @click="go('/pageMy/myProject/myCollection')">
                    <image src="../../static/img/salary.svg" mode=""></image>
                    我的收藏
                </view>
                <view class="BarList" @click="go('/pageMy/myProject/browsingHistory')">
                    <image src="../../static/img/contract.png" mode=""></image>
                    浏览记录
                </view>
                <!-- <view class="BarList" @click="go('/pageMy/myProject/browsingHistory')">
					<image src="../../static/img/contract.png" mode=""></image>
					我要招工
				</view> -->
            </view>
        </view>
        <view style="height: 104rpx"></view>
        <!-- <view class="federation">
			<view>新业态职工工会联合会</view>
			<view v-if="!federationStatus" class="forMembership" @click="go('/pageMy/federation/forMembership/Notice')">申请入会</view>
			<view v-else class="forMembership" @click="go('/pageMy/federation/vip/information')">已加入</view>
		</view>  -->

        <view class="btn">
            <view class="btnList" @click="go('/pages/recruit/recruit')">
                <image src="../../static/img/zhao_gong.png" mode=""></image>
                我要招工
                <image src="../../static/img/right.svg" mode=""></image>
            </view>
            <view class="btnList" @click="go('/pageMy/setUserBase/index')">
                <image src="../../static/img/ID.svg" mode=""></image>
                认证信息
                <image src="../../static/img/right.svg" mode=""></image>
            </view>
            <view class="btnList" @click="navTo('/pageMy/setUserBase/mailbox')">
                <image src="../../static/img/evaluate.png" mode=""></image>
                咨询信箱
                <image src="../../static/img/right.svg" mode=""></image>
            </view>
            <view class="btnList" @click="navTo('/pageMy/setUserBase/applicationsRecord')">
                <image src="../../static/img/phone.svg" mode=""></image>
                问卷调查
                <image src="../../static/img/right.svg" mode=""></image>
            </view>
            <view class="btnList" @click="navTo('/pageMy/setUserBase/survey')">
                <image src="../../static/img/phone.svg" mode=""></image>
                用工调研
                <image src="../../static/img/right.svg" mode=""></image>
            </view>
            <view class="btnList" @click="navTo('/pageMy/setUserBase/complain')">
                <image src="../../static/img/vip.svg" mode=""></image>
                投诉建议
                <image src="../../static/img/right.svg" mode=""></image>
            </view>
            <view class="btnList">
                <image src="../../static/img/vip.svg" mode=""></image>
                消息提醒
                <switch class="imgswitch" :checked="user.isEnbleNotice" @change="switch1Change" />
            </view>
            <template v-if="user.userIsCms">
                <view class="btnList" @click="navTo('/pageMy/admin/check')">
                    <image src="../../static/img/check1.png" mode=""></image>
                    岗位发布审核
                    <image src="../../static/img/right.svg" mode=""></image>
                </view>
                <view class="btnList" @click="navTo('/pageMy/admin/dengji')">
                    <image src="../../static/img/dji.png" mode=""></image>
                    线下服务记录登记
                    <image src="../../static/img/right.svg" mode=""></image>
                </view>
                <view class="btnList" @click="navTo('/pageMy/admin/admin')">
                    <image src="../../static/img/dji.png" mode=""></image>
                    零工人员登记
                    <image src="../../static/img/right.svg" mode=""></image>
                </view>
            </template>
            <!-- <view class="btnList" @click="go('/pageMy/apply/applications')">
				<image src="../../static/img/apply.png" mode=""></image>
				我的申请
				<image src="../../static/img/right.svg" mode=""></image>
			</view> -->
            <!-- <view class="btnList" @click="go('/pageMy/help/help')">
				<image src="../../static/img/help.svg" mode=""></image>
				帮助与反馈
				<image src="../../static/img/right.svg" mode=""></image>
			</view> -->
            <!-- <view class="btnList" @click="go('/pageMy/my/set')">
				<image src="../../static/img/set.svg" mode=""></image>
				设置
				<image src="../../static/img/right.svg" mode=""></image>
			</view> -->
        </view>
        <!-- <view class="btn-out" @click="logout">
			退出登录
		</view> -->
        <view class="bottom" @click="makePhoneCall">
            <view>德阳市人社局 电话：0838-2505580</view>
            <view>地址：德阳市旌阳区天山南路1段-102号</view>
        </view>
        <cs-button></cs-button>
    </view>
</template>

<script>
import { GoLogin } from '@/untils/AxiosUtils.js';
import { mapState, mapGetters } from 'vuex';
import { phoneFilter, stringFilterNum } from '@/untils/format.js';
import { labourUnionInfo } from '@/api/federation.js';
export default {
    data() {
        return {
            federationStatus: false,
        };
    },
    onLoad() {
        // this.$store.dispatch('getMobileIsCms')
        // if (this.$api.haslogin() && this.authPass) {
        // 	this.$store.dispatch('getVipCode')
        // }
    },
    onShow() {
        if (/token/g.test(location.href)) {
            this.$api.sleep(2000).then(() => {
                if (!this.$api.haslogin()) {
                    GoLogin();
                } else {
                    uni.$emit('newsReadChange');
                    this.$store.dispatch('refreshAuthState');
                }
            });
        } else {
            if (!this.$api.haslogin()) {
                GoLogin();
            } else {
                uni.$emit('newsReadChange');
                this.$store.dispatch('refreshAuthState');
            }
        }
        // this.labourUnionInfoInit()
    },
    methods: {
        switch1Change(e) {
            if (e.detail.value) {
                this.$store.dispatch('setNoticeOpen');
            } else {
                this.$store.dispatch('setNoticeClose');
            }
        },
        labourUnionInfoInit() {
            labourUnionInfo().then((e) => {
                this.federationStatus = e.data.data.joined;
            });
        },
        // logout() {
        // 	this.$store.dispatch('LogOut').then(() => {
        // 		// uni.reLaunch({
        // 		// 	url: '/pages/login/login'
        // 		// })
        // 		this.$store.dispatch('clearAuthState')
        // 		this.$store.dispatch('endRefreshNewsTimer')
        // 		location.href = "https://dy12333.org.cn/h5/"
        // 	})
        // },
        go(url) {
            uni.navigateTo({
                url,
            });
        },
        makePhoneCall: function () {
            uni.makePhoneCall({
                phoneNumber: '18500206848',
            });
        },
        phoneFilter,
        stringFilterNum,
    },
    computed: {
        ...mapState(['user']),
        ...mapGetters(['userInfo', 'auth', 'authPass']),
    },
};
</script>

<style>
page {
    height: 100%;
    background: #f6f6f6;
}

.federation {
    height: 48rpx;
    border-radius: 10rpx;
    padding: 28rpx 30rpx;
    margin: 30rpx;
    font-size: 32rpx;
    font-weight: 400;
    color: #6f5931;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: url(../../static/img/my/mybanner.png) no-repeat;
    background-size: cover;
}

.forMembership {
    width: 140rpx;
    height: 50rpx;
    background: linear-gradient(112deg, #efe0bc 0%, #d29a5a 100%, #ddba88 100%);
    box-shadow: 0px 0px 2px 1px rgba(231, 174, 85, 0.39);
    border-radius: 25rpx;
    font-size: 26rpx;
    font-weight: 400;
    color: #6f5931;
    line-height: 48rpx;
    text-align: center;
}

.bottom {
    font-family: PingFangSC-Regular;
    font-size: 24rpx;
    color: #999999;
    /* position: absolute; */
    /* bottom: 120rpx; */
    /* width: 100%; */
    margin: 120rpx 0;
    text-align: center;
}

.btnList image:last-child {
    width: 19rpx;
    height: 32rpx;
    margin-left: auto;
    margin-right: 0;
}

.imgswitch {
    margin-left: auto;
    margin-right: 0;
}

.btnList image {
    width: 52rpx;
    height: 52rpx;
    margin-right: 10rpx;
}

.btnList {
    font-family: PingFangSC-Regular;
    font-size: 32rpx;
    color: #333333;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 30rpx 20rpx;
}

.btn {
    width: 690rpx;
    margin: 0 auto;
    border-radius: 15rpx;
    background: #fefefe;
}

.BarList {
    font-family: PingFangSC-Regular;
    font-size: 28rpx;
    color: #666666;
    float: left;
    width: 25%;
    text-align: center;
    padding: 30rpx 0rpx;
}

.BarList image {
    width: 52rpx;
    height: 52rpx;
    display: block;
    margin: 0 auto;
}

.centerBar {
    width: 690rpx;
    background-color: #fefefe;
    border-radius: 15rpx;
    overflow: hidden;
    position: absolute;
    bottom: -70rpx;
    left: 30rpx;
}

.userContent {
    font-family: PingFangSC-Regular;
    font-size: 26rpx;
    color: #ffffff;
    display: flex;
}

.userTel {
    font-family: PingFangSC-Medium;
    font-size: 36rpx;
    color: #ffffff;
}

.userRight {
    float: left;
    height: 50rpx;
    line-height: 50rpx;
}

.userTitle image {
    width: 100rpx;
    height: 100rpx;
    margin-right: 20rpx;
    float: left;
    border-radius: 200rpx;
    background-color: rgba(255, 255, 255, 0.3);
}

.userTitle {
    padding: 0 30rpx;
}

.head {
    background-color: #1b66ff;
    width: 100%;
    height: 200rpx;
    padding-top: 200rpx;
    position: relative;
}

.body {
    background: #f6f6f6;
    height: 100%;
    position: relative;
    overflow: auto;
}

/* .btn-out {
		background-color: #fefefe;
		margin-top: 20rpx;
		padding: 20rpx 0;
		text-align: center;
		font-family: PingFangSC-Regular;
		font-size: 32rpx;
		color: #F46161;
	} */
</style>
