登录信息获取

This commit is contained in:
shikong 2024-11-06 23:22:42 +08:00
parent 871137c592
commit 3f1abfa35f
Signed by: Shikong
GPG Key ID: BD85FF18B373C341

View File

@ -2,6 +2,14 @@
<view> <view>
页面内容 页面内容
</view> </view>
<view class="uni-form-item uni-column">
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="ctx.avatarUrl"></image>
</button>
<input class="uni-input" placeholder="请输入昵称"/>
</view>
<view class="warp"> <view class="warp">
<button type="warn" @click="toTestPage">{{ t("my.toTestPage") }}</button> <button type="warn" @click="toTestPage">{{ t("my.toTestPage") }}</button>
<button class="button" type="primary" @click="getLocation">{{ t('my.getLocation') }}</button> <button class="button" type="primary" @click="getLocation">{{ t('my.getLocation') }}</button>
@ -23,13 +31,20 @@ import {reactive, watchEffect} from "vue"
import {useI18n} from "vue-i18n" import {useI18n} from "vue-i18n"
import {onReady} from "@dcloudio/uni-app"; import {onReady} from "@dcloudio/uni-app";
const {t, locale} = useI18n() const {t, locale} = useI18n()
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
const ctx = reactive({ const ctx = reactive({
lang: { lang: {
switchTo: '' switchTo: ''
} },
avatarUrl: defaultAvatarUrl,
}) })
function onChooseAvatar(e) {
const { avatarUrl } = e.detail
ctx.avatarUrl = avatarUrl
}
function switchLanguage(){ function switchLanguage(){
if(uni.getLocale().startsWith("en")){ if(uni.getLocale().startsWith("en")){
uni.setLocale("zh-Hans") uni.setLocale("zh-Hans")