<template>
    <!-- components/contactmov/contactmov.wxml -->
    <view>
        <movable-area class="move-area-ser">
            <movable-view direction="all" :x="pageX + 'rpx'" :y="pageY + 'rpx'" class="move-view-ser">
                <image
                    class="contact-img"
                    mode="aspectFit"
                    :src="'https://jzmall.lifejingzhi.com/file/jzmall/weixin/ad-kt.png?' + randomNum"
                    @longpress="goJoin"
                    @tap="goJoin"
                ></image>
            </movable-view>
        </movable-area>
    </view>
</template>

<script>
// components/contactmov/contactmov.js
const util = require('../../utils/util.js');
const api = require('../../config/api.js');
export default {
    data() {
        return {
            randomNum: (Math.random() * 100000000).toFixed(0)
        };
    },
    /**
     * 组件的属性列表
     */
    props: {
        pageX: {
            type: Number,
            default: 600
        },
        pageY: {
            type: Number,
            default: 1000
        }
    },
    /**
     * 组件的方法列表
     */
    methods: {
        goJoin() {
            // if (!app.globalData.hasLogin) {
            // 	wx.navigateTo({
            //     url: "/pages/auth/login/login"
            //   });
            //  return;
            // }
            util.request(api.AuthInfo, {}, 'GET').then((res) => {
                if (res.errno == 0) {
                    let mobile = res.data.mobile;
                    let randomBoolean = Math.random() < 0.5;
                    let cp = randomBoolean == true ? '13127931250' : '13122656821';
                    uni.navigateTo({
                        url: '/pages/ucenter/wx/join?mobile=' + mobile + '&cp=' + cp
                    });
                }
            });
        }
    },
    created: function () {}
};
</script>
<style>
/* components/contactmov/contactmov.wxss */
.move-area-ser {
    width: 750rpx;
    height: 100vh;
    top: 0rpx;
    /* pointer-events: auto; */
    position: fixed;
    pointer-events: none;
}

.move-view-ser {
    pointer-events: auto;
    width: 246rpx;
    height: 200rpx;
}

.contact-img {
    width: 246rpx;
    height: 200rpx;
    margin: 0;
}
</style>
