<template>
    <!-- <view class="staticTitle">上传本人身份证照片</view> -->
    <view class="p30">
        <view
            class="uploadFan"
            hover-class="thover"
            :data-url="user.idcardImgFront != null ? user.idcardImgFront : '//matripe.oss-cn-beijing.aliyuncs.com/tuiguang/renxiang.png'"
            @tap="TT"
        >
            <image :src="user.idcardImgFront ? user.idcardImgFront : '//matripe.oss-cn-beijing.aliyuncs.com/tuiguang/renxiang.png'"></image>
            <view class="" hover-class="none" :hover-stop-propagation="false">身份证正面</view>
        </view>
        <view
            class="uploadFan"
            hover-class="thover"
            :data-url="user.idcardImgBack != null ? user.idcardImgBack : '//matripe.oss-cn-beijing.aliyuncs.com/tuiguang/guohui.png'"
            data-id="2"
            @tap="TT"
        >
            <image :src="user.idcardImgBack ? user.idcardImgBack : '//matripe.oss-cn-beijing.aliyuncs.com/tuiguang/guohui.png'"></image>
            <view class="" hover-class="none" :hover-stop-propagation="false">身份证反面</view>
        </view>
        <view class="f12 tc c045 display-flex" style="align-items: center; margin-top: 16px; margin-left: 24px" v-if="!user.idcardImgBack">
            <!-- <switch checked="{{switch1Checked}}" class="dib" color="#0dcc91" style="transform:scale(.5)" bindchange="switch1Change" /> -->
            <radio-group class="dib">
                <radio :checked="switch1Checked" @click.stop="switch1Change" value="0" class="dib" color="var(--color-ysd)" style="transform: scale(0.7)" />
            </radio-group>
            我已阅读并同意
            <navigator url="../serviceTerm/index" class="aLink">《用户服务协议》</navigator>
            及
            <navigator url="../secret/index" class="aLink">《隐私政策》</navigator>
        </view>
    </view>
    <!-- <button type='primary' class="loginOut" style="margin-top:80px;" catchtap="goBack">
返回
</button> -->
</template>

<script>
// pages/seeIdCard/index.js
const app = getApp();
export default {
    data() {
        return {
            user: {
                idcardImgFront: '',
                idcardImgBack: ''
            },

            switch1Checked: true,
            isLogin: ''
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (options) {},
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        //登录=================================start
        if (app.globalData.isLogin) {
            this.setData({
                isLogin: app.globalData.isLogin,
                user: app.globalData.user
            });
        } else {
            // 由于 userLogin 是网络请求，可能会在 Page.onLoad 之后才返回
            // 所以此处加入 callback 以防止这种情况
            app.globalData.userLoginCallback = (res) => {
                this.setData({
                    isLogin: app.globalData.isLogin,
                    user: app.globalData.user
                });
            };
        }
        console.log(this.user);
    },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    methods: {
        TT(e) {
            var url = e.currentTarget.dataset.url;
            console.log(url);
            uni.previewImage({
                current: url,
                // 当前显示图片的http链接
                urls: [
                    this.user.idcardImgFront != null ? this.user.idcardImgFront : '//matripe.oss-cn-beijing.aliyuncs.com/tuiguang/renxiang.png',
                    this.user.idcardImgBack != null ? this.user.idcardImgBack : '//matripe.oss-cn-beijing.aliyuncs.com/tuiguang/guohui.png'
                ] // 需要预览的图片http链接列表
            });
        },

        goBack() {
            /*wx.navigateTo({
      url: '/pages/seeCard/index',
    })*/
            uni.navigateBack({
                delta: 1
            });
        },

        /**
         * 用户点击右上角分享
         */
        onShareAppMessage1: function () {},

        switch1Change() {
            console.log('占位：函数 switch1Change 未声明');
        }
    }
};
</script>
<style>
@import './index.css';
</style>
