feat(passport): 实现微信小程序手机号授权登录和扫码功能
- 新增微信小程序手机号一键授权登录功能 - 添加扫码登录确认页面实现二维码登录流程 - 集成统一扫码功能支持登录和核销场景 - 更新协议页面从CMS动态加载内容并添加加载状态 - 修改登录注册页面UI和导航逻辑 - 配置文件添加新的路由页面入口 - 更新API基础URL配置 - 实现邀请参数解析和推广跟踪功能 - 添加微信OpenID自动获取和存储机制 - 优化页面跳转和重定向逻辑处理
This commit is contained in:
@@ -1,28 +1,47 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import { useEffect, useState } from 'react'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {View, RichText} from '@tarojs/components'
|
||||
import { Loading } from '@nutui/nutui-react-taro'
|
||||
import { RichText, View } from '@tarojs/components'
|
||||
import { getByCode } from '@/api/cms/cmsArticle'
|
||||
import { wxParse } from '@/utils/common'
|
||||
|
||||
const Agreement = () => {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [content, setContent] = useState<string>('')
|
||||
|
||||
const [content, setContent] = useState<any>('')
|
||||
const reload = () => {
|
||||
Taro.hideTabBar()
|
||||
setContent('<p>' +
|
||||
'<span style="font-size: 14px;">欢迎使用</span>' +
|
||||
'<span style="font-size: 14px;"> </span>' +
|
||||
'<span style="font-size: 14px;"><strong><span style="color: rgb(255, 0, 0);">【WebSoft】</span></strong></span>' +
|
||||
'<span style="font-size: 14px;">服务协议 </span>' +
|
||||
'</p>')
|
||||
const reload = async () => {
|
||||
try {
|
||||
Taro.hideTabBar()
|
||||
} catch (_) {
|
||||
// ignore (e.g. H5 / unsupported env)
|
||||
}
|
||||
|
||||
try {
|
||||
const article = await getByCode('xieyi')
|
||||
setContent(article?.content ? wxParse(article.content) : '<p>暂无协议内容</p>')
|
||||
} catch (e) {
|
||||
// Keep UI usable even if CMS/API fails.
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('load agreement failed', e)
|
||||
setContent('<p>协议内容加载失败</p>')
|
||||
Taro.showToast({ title: '协议加载失败', icon: 'none' })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
}, [])
|
||||
|
||||
if (loading) {
|
||||
return <Loading className={'px-2'}>加载中</Loading>
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<View className={'content text-gray-700 text-sm p-4'}>
|
||||
<RichText nodes={content}/>
|
||||
<RichText nodes={content} />
|
||||
</View>
|
||||
</>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user