TestEShopDist/src/app.tsx
2022-06-02 20:14:05 +08:00

62 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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