fix: repair wx phone autofill and add video player route

This commit is contained in:
malei 2026-04-16 23:44:34 +08:00
parent 9275403b4d
commit 9ae9cdb08e
3 changed files with 105 additions and 4 deletions

View File

@ -13,6 +13,7 @@
{"path": "pages/mine/MyOrders"}, {"path": "pages/mine/MyOrders"},
{"path": "pages/mine/MyPets"}, {"path": "pages/mine/MyPets"},
{"path": "pages/mine/Profile"}, {"path": "pages/mine/Profile"},
{"path": "pages/video-player/videoPlayer"},
{"path": "pages/report-view/reportView"} {"path": "pages/report-view/reportView"}
], ],
"globalStyle": { "globalStyle": {

View File

@ -230,6 +230,11 @@ const onWechatLoginNotInMp = () => {
showToast('微信授权登录仅支持在微信小程序内使用,请使用验证码登录') showToast('微信授权登录仅支持在微信小程序内使用,请使用验证码登录')
} }
const getWxLoginPhone = (res) => {
if (!isHttpOk(res)) return ''
return uString(res?.data?.user?.phone || res?.data?.phone)
}
/** /**
* 微信小程序用户同意授权后携带 code服务端换手机号并登录 * 微信小程序用户同意授权后携带 code服务端换手机号并登录
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
@ -273,8 +278,9 @@ const onWxGetPhoneNumberBoss = async (e) => {
loginLoading.value = true loginLoading.value = true
try { try {
const res = await wxPhoneLogin(code) const res = await wxPhoneLogin(code)
if (res.code === 200 && res.data?.phone) { const phone = getWxLoginPhone(res)
bossForm.phone = res.data.phone if (phone) {
bossForm.phone = phone
bossForm.wxPhoneAuto = true bossForm.wxPhoneAuto = true
showToast('手机号已获取') showToast('手机号已获取')
} else { } else {
@ -297,8 +303,9 @@ const onWxGetPhoneNumberStaff = async (e) => {
loginLoading.value = true loginLoading.value = true
try { try {
const res = await wxPhoneLogin(code) const res = await wxPhoneLogin(code)
if (res.code === 200 && res.data?.phone) { const phone = getWxLoginPhone(res)
staffForm.phone = res.data.phone if (phone) {
staffForm.phone = phone
staffForm.wxPhoneAuto = true staffForm.wxPhoneAuto = true
showToast('手机号已获取') showToast('手机号已获取')
} else { } else {

View File

@ -0,0 +1,93 @@
<template>
<view class="video-page">
<view class="video-nav nav-gradient" :style="navSafeStyle">
<view class="nav-back" @click="goBack"><AppIcon name="back" :size="18" color="#ffffff" /></view>
<text class="nav-title">视频播放</text>
<view style="width:32px"></view>
</view>
<view class="video-wrap">
<video
v-if="videoUrl"
:src="videoUrl"
class="video-player"
:autoplay="true"
:controls="true"
objectFit="contain"
/>
<view v-else class="empty-wrap">
<text class="empty-text">视频地址无效</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import AppIcon from '../../components/AppIcon.vue'
const videoUrl = ref('')
const navSafeStyle = (() => {
const statusBarHeight = uni.getSystemInfoSync?.().statusBarHeight || 20
let navHeight = statusBarHeight + 44
const menuRect = uni.getMenuButtonBoundingClientRect?.()
if (menuRect && menuRect.top && menuRect.height) {
const verticalGap = Math.max(menuRect.top - statusBarHeight, 4)
navHeight = statusBarHeight + verticalGap * 2 + menuRect.height
}
return `padding-top:${statusBarHeight}px;height:${navHeight}px;`
})()
const goBack = () => {
const pages = getCurrentPages()
if (pages.length > 1) {
uni.navigateBack()
return
}
uni.reLaunch({ url: '/pages/home/Home' })
}
onLoad((options) => {
const raw = options?.url ? decodeURIComponent(options.url) : ''
videoUrl.value = raw
})
</script>
<style scoped>
.video-page {
min-height: 100vh;
background: #000;
}
.video-nav {
padding: 0 16px 12px;
display: flex;
align-items: center;
justify-content: space-between;
}
.video-wrap {
height: calc(100vh - 88px);
display: flex;
align-items: center;
justify-content: center;
}
.video-player {
width: 100%;
height: 100%;
}
.empty-wrap {
display: flex;
align-items: center;
justify-content: center;
}
.empty-text {
color: #cbd5e1;
font-size: 14px;
}
</style>