<template>
    <div :class="[model.sysCss, 'app-login-third']" :style="containerStyle">
        <div class="app-login-third__title">{{ $t("components.login.other") }}</div>
        <div class="app-login-third__content">
            <div class="sign-btn" @click="handleThirdLogin('DINGDING')">
                <img class="third-svg-container" src="@/assets/img/dingding.svg" />
            </div>
            <div class="sign-btn" @click="handleThirdLogin('WXWORK')">
                <img class="third-svg-container" src="@/assets/img/qiyeweixin.svg" />
            </div>
        </div>
    </div>
</template>

<script lang="ts">
import { PanelUserControlModel } from "@/model/panel-detail";
import { Component, Prop, Vue } from "vue-property-decorator";
@Component({})
export default class AppThirdLogin extends Vue {

    /**
     * 模型
     *
     * @type {string}
     * @memberof AppLoginInput
     */
    @Prop() public model!: PanelUserControlModel;
    
    /**
     * 值
     *
     * @type {string}
     * @memberof AppLoginInput
     */
    @Prop() public value!: string;

    /**
     * 名称
     *
     * @type {string}
     * @memberof AppLoginInput
     */
    @Prop() public name!: string;

    /**
     * 容器样式
     *
     * @type {any}
     * @memberof AppLoginInput
     */
    public containerStyle: any = null;

    public mounted() {
        if (this.model) {
            this.containerStyle = this.model.getElementStyle();
        }
    }
    
    /**
     * 处理第三方登录
     *
     * @param type 登录类型
     * @memberof AppThirdLogin
     */
    handleThirdLogin(type: string) {
        switch (type) {
            case "DINGDING":
                this.dingTalkHandleClick();
                break;
            case "WXWORK":
                this.wxWorkHandleClick();
                break;
            default:
                console.warn(`暂不支持${type}登录`);
                break;
        }
    }

    /**
     * 钉钉登录
     *
     * @memberof AppThirdLogin
     */
    async dingTalkHandleClick() {
        
    }

    /**
     * 微信登录
     *
     * @memberof AppThirdLogin
     */
    async wxWorkHandleClick() {
        
    }
}
</script>

<style lang="less">
@import "./app-login-third.less";
</style>
