fix(api): 替换所有接口请求的域名为 guilixu-api.websoft.top
- 将获取 STS Token 的接口地址由 paopao-api 改为 guilixu-api - 更新图片上传接口地址为新的 guilixu-api 域名 - 修改用户推广页面中邀请码链接和二维码接口的域名 - 更改注册页微信登录接口请求的域名为 guilixu-api
This commit is contained in:
56
src/app.tsx
Normal file
56
src/app.tsx
Normal file
@@ -0,0 +1,56 @@
|
||||
import React, { useState } from 'react'
|
||||
import Taro, { useLaunch, useDidShow, useDidHide, getSystemInfoSync } from '@tarojs/taro'
|
||||
import { View } from '@tarojs/components'
|
||||
import { ConfigProvider } from '@nutui/nutui-react-taro'
|
||||
import zhCN from '@nutui/nutui-react-taro/dist/locales/zh-CN'
|
||||
import AppContext from './contexts/AppContext'
|
||||
import { UserProvider } from './contexts/UserContext'
|
||||
import { CartProvider } from './contexts/CartContext'
|
||||
import ErrorBoundary from './components/ErrorBoundary'
|
||||
import './app.scss'
|
||||
|
||||
type AppProps = {
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
function App(props: AppProps) {
|
||||
const [theme, setTheme] = useState<'light' | 'dark'>('light')
|
||||
|
||||
useLaunch(() => {
|
||||
const systemInfo = getSystemInfoSync()
|
||||
const savedTheme = Taro.getStorageSync('app_theme')
|
||||
if (savedTheme === 'light' || savedTheme === 'dark') {
|
||||
setTheme(savedTheme)
|
||||
}
|
||||
})
|
||||
|
||||
useDidShow(() => {})
|
||||
|
||||
useDidHide(() => {})
|
||||
|
||||
const toggleTheme = () => {
|
||||
setTheme(prev => {
|
||||
const next = prev === 'light' ? 'dark' : 'light'
|
||||
try { Taro.setStorageSync('app_theme', next) } catch { /* ignore */ }
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<AppContext.Provider value={{ theme, toggleTheme }}>
|
||||
<UserProvider>
|
||||
<CartProvider>
|
||||
<ConfigProvider locale={zhCN}>
|
||||
<ErrorBoundary>
|
||||
<View className={theme === 'dark' ? 'dark' : ''}>
|
||||
{props.children}
|
||||
</View>
|
||||
</ErrorBoundary>
|
||||
</ConfigProvider>
|
||||
</CartProvider>
|
||||
</UserProvider>
|
||||
</AppContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
||||
Reference in New Issue
Block a user