62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import { FC } from 'react'
|
||
import ContextBlueTooth from "@/use/contextBlueTooth"
|
||
import { Provider } from 'react-redux'
|
||
import configStore from './store'
|
||
import {BASE_URL, WX_APPID} from '@/common/constant'
|
||
import './app.scss'
|
||
import Taro, { useDidShow, useRouter, useShareAppMessage } from '@tarojs/taro'
|
||
import { useSelector } from './reducers/hooks'
|
||
import { AnalysisShortCodeApi } from './api/share'
|
||
|
||
const store = configStore()
|
||
const App:FC = (params) => {
|
||
|
||
Taro.showShareMenu({
|
||
withShareTicket: true
|
||
})
|
||
|
||
useDidShow(() => {
|
||
console.log('paramsparamsparamsparams:',params)
|
||
})
|
||
|
||
const res = useRouter()
|
||
const page = Taro.getCurrentInstance().page
|
||
|
||
// console.log('page::::',page)
|
||
//解析短码参数(该请求不能校验token)
|
||
// const {fetchData: fetchDataAnalysisShortCode} = AnalysisShortCodeApi()
|
||
// const analysisShortCode = async () => {
|
||
// let res = await fetchDataAnalysisShortCode({md5_key: page?.options?.share})
|
||
// // setParams({id: res.data.id, share: res.data})
|
||
// console.log('res::::&&', res.data)
|
||
// }
|
||
|
||
const sortCode = JSON.parse(Taro.getStorageSync('sort_code'))
|
||
console.log('res:::', page)
|
||
if(page && page.onShareAppMessage) {
|
||
if(page.options?.share) {
|
||
|
||
}
|
||
|
||
page.onShareAppMessage = () => {
|
||
return {
|
||
title: '电子商城',
|
||
path: `/pages/index/index?share=${sortCode.shareShortPage}`,
|
||
imageUrl:'',
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
return (
|
||
<ContextBlueTooth>
|
||
<Provider store={store}>
|
||
{params.children}
|
||
</Provider>
|
||
</ContextBlueTooth>
|
||
)
|
||
}
|
||
|
||
export default App |