This commit is contained in:
2023-08-18 17:22:11 +08:00
parent 1263c372cb
commit 61f840059b
36 changed files with 2371 additions and 1109 deletions

View File

@@ -3,7 +3,8 @@
<view class="text">
<view>授权提醒</view>
<view style="margin-top: 10px"
>请授权头像信息以便为您提供更好的服务</view
>请授权头像信息以便为您提供更好的服务
</view
>
<view class="bom">
<view class="btn b" @click="onCancel">随便逛逛</view>
@@ -15,45 +16,53 @@
<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: {
type: Boolean,
default: false,
},
});
default: false
}
})
const emit = defineEmits(["update:visible", "update:info"]);
const emit = defineEmits(['update:visible', 'ok'])
const onCancel = () => {
emit("update:visible", false);
};
emit('update:visible', false)
}
const onOk = () => {
Taro.getUserProfile({
desc: "用于完善会员资料",
desc: '完善用户资料',
success: async (user) => {
console.log(user);
Taro.login({
success: async ({ code }) => {
const { data }: any = await login({
code: code,
});
Taro.setStorageSync("token", data.token);
emit("update:visible", false);
success: async ({code}) => {
try {
const {data}: any = await login({
code: code,
nickName: user.userInfo.nickName,
avatarUrl: user.userInfo.avatarUrl
})
Taro.setStorageSync('token', data.token)
emit('ok', false)
} catch (error) {
Taro.showToast({
title: error.message,
icon: 'none'
})
}
},
fail: (err) => {
console.log(err);
},
});
console.log(err)
}
})
},
fail: (err) => {
console.log(err);
},
});
};
console.log(err)
}
})
}
</script>
<style lang="scss">
@@ -71,6 +80,7 @@ const onOk = () => {
justify-content: space-evenly;
align-items: center;
margin-top: 20px;
.btn {
width: 150px;
padding: 10px;