feat: 添加微信扫码登录功能
This commit is contained in:
@ -64,7 +64,7 @@
|
||||
</div>
|
||||
<div v-if="!isLogin" class="mt-[30px] flex justify-between px-[20px]">
|
||||
<img src="~/assets/images/qq-v2.png" alt="QQ登录" class="social-icon" @click="handleLoginQQ" />
|
||||
<img src="~/assets/images/weixin-v2.png" alt="微信登录" class="social-icon" @click="handleLoginWechat" />
|
||||
<img src="~/assets/images/weixin-v2.png" alt="微信登录" class="social-icon" @click="handleLoginWechatV2" />
|
||||
<img src="~/assets/images/email-v2.png" alt="邮箱登录" class="social-icon" @click="handleLoginEmail" />
|
||||
<img src="~/assets/images/phone-v2.png" alt="手机登录" class="social-icon" @click="handleLoginPhone" />
|
||||
</div>
|
||||
@ -73,6 +73,9 @@
|
||||
<img src="~/assets/images/sign.png" alt="签到奖励" class="bonus-image" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- wx二维码弹窗 -->
|
||||
<wx v-model:visible="visible" v-model:qrcode="qrcode" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -80,7 +83,7 @@
|
||||
import { getCurrentInstance, computed, watchEffect, ref } from 'vue'
|
||||
import { handleLoginQQ, handleLoginWechat } from '~/utils/login'
|
||||
import type { UserStatisticsCountRespVO } from '~/api/personal-center/types'
|
||||
import { getUserStatistics } from '~/api/personal-center/index'
|
||||
import { getUserStatistics, getLoginQrcode } from '~/api/personal-center/index'
|
||||
import useUserStore from '~/stores/user'
|
||||
const userStore = useUserStore()
|
||||
const app = useNuxtApp()
|
||||
@ -90,6 +93,18 @@
|
||||
return !!userStore.token
|
||||
})
|
||||
|
||||
// 打开微信二维码
|
||||
const qrcode = ref<string>()
|
||||
const visible = ref<boolean>(false)
|
||||
const handleLoginWechatV2 = () => {
|
||||
getLoginQrcode().then((res) => {
|
||||
if (res.code === 0) {
|
||||
visible.value = true
|
||||
qrcode.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取用户统计信息
|
||||
const userStaticInfo = ref<UserStatisticsCountRespVO>()
|
||||
const fetchUserStatistics = async () => {
|
||||
|
||||
Reference in New Issue
Block a user