feat(custom): 新增消息订阅
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-08-27 17:06:59 +08:00
parent f199320de0
commit 1d8532eccf
104 changed files with 2350 additions and 2477 deletions

View File

@@ -15,8 +15,8 @@
<script setup lang="ts">
// import { computed, ref } from "vue";
import Taro from "@tarojs/taro";
import { login } from "@/api/user";
import Taro from '@tarojs/taro';
import {login} from '@/api/user';
defineProps({
visible: {
@@ -25,38 +25,38 @@ defineProps({
},
});
const emit = defineEmits(["update:visible", "ok"]);
const emit = defineEmits(['update:visible', 'ok']);
const onCancel = () => {
emit("update:visible", false);
emit('update:visible', false);
};
const onOk = () => {
Taro.showLoading({
title: "正在授权中",
title: '正在授权中',
mask: true,
});
Taro.getUserProfile({
desc: "完善用户资料",
success: async (user) => {
desc: '完善用户资料',
success: async user => {
Taro.login({
success: async ({ code }) => {
success: async ({code}) => {
try {
const { data }: any = await login({
const {data}: any = await login({
code: code,
nickName: user.userInfo.nickName,
avatarUrl: user.userInfo.avatarUrl,
});
Taro.setStorageSync("token", data.token);
emit("ok", false);
Taro.setStorageSync('token', data.token);
emit('ok', false);
} catch (error) {
Taro.showToast({
title: error.message,
icon: "none",
icon: 'none',
});
}
},
fail: (err) => {
fail: err => {
console.log(err);
},
complete: () => {
@@ -64,7 +64,7 @@ const onOk = () => {
},
});
},
fail: (err) => {
fail: err => {
console.log(err);
},
complete: () => {