处理页面

This commit is contained in:
2026-01-15 16:18:19 +08:00
parent b04c263e49
commit 1a0f43b1bd
13 changed files with 20 additions and 140 deletions

View File

@@ -1,108 +0,0 @@
<template>
<!-- <view class="content">
<view class="avatar">
<nut-avatar size="80">
<nut-icon size="30" name="my" />
</nut-avatar>
</view>
<view class="divider">
</view>
</view> -->
<view class="tip-infos">
<text>申请获取以下权限</text>
<text>获得你的手机号信息</text>
</view>
<view class="authorize-btn-inner">
<nut-button type="success" size="large" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">授权手机号</nut-button>
</view>
</template>
<script setup>
import {
onMounted,
ref
} from 'vue';
import {
login,
fetchUserPhone
} from '../../api/user';
import {
onLoad
} from '@dcloudio/uni-app'
import {
navigateTo
} from '../../utils/helper';
const code = ref('')
const redirect_url = ref('')
onLoad((options) => {
redirect_url.value = options.redirect_url
})
onMounted(() => {
uni.login({
provider: "weixin",
success(res) {
if (res.errMsg === 'login:ok') {
code.value = res.code
}
}
})
})
const getPhoneNumber = (res) => {
if(res.detail.code){
fetchUserPhone(res.detail.code).then(res=>{
console.log(res);
if(res.msg==='success' && res.code ===1){
uni.showToast({
title: '授权成功',
icon: 'none'
})
console.log("code");
uni.switchTab({
url: '/pages/mine/index'
})
// uni.navigateBack()
}else{
uni.switchTab({
url: '/pages/mine/index'
})
}
})
}
}
</script>
<style scoped lang="scss">
.divider {
height: 1px;
background: #eee;
width: 100%;
}
.content {
display: flex;
justify-content: center;
flex-direction: column;
padding: 25px 15px;
align-items: center;
gap: 20px;
}
.tip-infos {
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 10px 25px;
gap: 10px;
text:nth-child(2) {
font-size: 15px;
color: #666;
}
}
.authorize-btn-inner {
padding: 15px;
}
</style>

8
pages/todo/index.vue Normal file
View File

@@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@@ -1,22 +0,0 @@
<template>
<view>
<web-view :src="url"></web-view>
</view>
</template>
<script setup>
import {
ref
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app'
const url = ref('')
onLoad((val) => {
url.value = val.url
})
</script>
<style lang="scss">
</style>