gx
queenwuli
2022-04-15 c110a60ee4a75060dfd47d32150e99232c11f9e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<template>
    <div class="wrap">
        <div class="flex align-center justify-between">
            <h3 class="title">{{$t("message.Share")}}</h3>
            <img class="close" src="../../assets/images/close.png" @click="close" />
        </div>
        <img class="banner" src="../../assets/images/1.png" />
        <div class="share-box">
            <h3>{{$t("message.ShareLink")}}</h3>
            <div class="flex align-center justify-between">
                <input :value="inviteUrl" class="flex-1" readonly/>   
                <button @click="onCopy">{{$t("message.Copy")}}</button>
            </div>
        </div>
        <p class="tips">{{$t("message.CopyTip")}}</p>
    </div>
</template>
 
<script>
import { ref, reactive, getCurrentInstance,onBeforeMount,onMounted } from 'vue';
import useClipboard from 'vue-clipboard3'
export default {
    name: 'App',
    setup() {
        const { proxy } = getCurrentInstance()
        const { toClipboard } = useClipboard()
        const iShow = ref(false)
        const inviteUrl = ref('')
        const close = () => {
            proxy.$emit('close')
        }
        const onCopy = async () => {
            try {
                await toClipboard(proxy.inviteUrl)
                proxy.$notify({type: 'success', message: proxy.$t('message.CopySuc')});
            } catch (e) {
                proxy.$notify(proxy.$t('message.CopyErr'));
            }
        }
        const initData = () => {
            let str = window.location.href + '?code=';
            proxy.$axios({
                url: '/dapi/member/walletInfo',
                method: 'post'
            }).then((res) => {
                if(res.code == 200) {
                    proxy.inviteUrl = str + res.data.inviteId;
                }else{
                    proxy.inviteUrl = str
                }
            }).catch(() => {
                proxy.inviteUrl = str
            })
        }
        onMounted(() => {
            initData()
        })
        return {
            iShow,
            close,
            inviteUrl,
            onCopy,
            initData
        }
    },
    methods: {
    }
}
</script>
 
<style scoped>
.wrap {
    padding: 36px 24px 36px 44px;
    background: #FFFFFF;
    height: 100vh;
    box-sizing: border-box;
}
.wrap .title{
    font-size: 32px;
    position: relative;
    margin: 0;
}
.wrap .title::before{
    content: '';
    width: 10px;
    height: 10px;
    background: #FEAA4A;
    display: block;
    border-radius: 50%;
    position: absolute;
    left: -20px;
    top: 50%;
}
.close{
    width: 32px;
    font-weight: bold;
}
.banner{
    display: block;
    width: 78%;
    margin: 45px auto;
}
.share-box{
    box-shadow: 0px 10px 30px 1px rgba(153, 153, 153, 0.15);
    padding: 28px 24px 48px;
    text-align: left;
    border-radius: 20px;
}
.share-box h3{
    font-size: 28px;
    margin: 0 0 30px;
}
.share-box input{
    border: 1px solid #E9E9E9;
    border-radius: 5px;
    color: #AFAFAF;
    font-size: 24px;
    padding: 18px 24px;
    margin-right: 24px;
}
.share-box button{
    border: 0;
    background: linear-gradient(86deg, #FEAA4A 0%, #FF8517 100%);
    border-radius: 48px;
    color: #ffffff;
    font-size: 28px;
    font-weight: bold;
    padding: 14px 40px;
}
.tips{
    color: #AFAFAF;
    margin: 32px 0 0;
    line-height: 32px;
    text-align: left;
}
</style>