Skip to content

Commit

Permalink
Merge pull request #29 from HXTIA/revert-26-feat-mp-clip-page
Browse files Browse the repository at this point in the history
Revert "feat: 新增详情页、海报保存分享 & 修改storage类型推断"
  • Loading branch information
HardenSG authored May 8, 2024
2 parents 215ea1b + 0b5aecf commit 03607cd
Show file tree
Hide file tree
Showing 37 changed files with 229 additions and 739 deletions.
3 changes: 2 additions & 1 deletion src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Error from 'src/components/baseBuiltComp/Error'
import { store } from './store'
import './app.scss'
import { Get, getStorage, preloadResource, requestUrlCreator } from './utils'
import { IUserInfo } from './common-model'
import { JSON_MAP } from './static/SVG/lottie-map'

function App(props) {
Expand All @@ -14,7 +15,7 @@ function App(props) {

useLaunch(async () => {
/** 1. 校验登陆态 */
const token = getStorage('userInfo')?.token
const token = getStorage<IUserInfo>('userInfo')?.token

/** 2. 校验获取用户信息 */
/** TODO: 需和后端确定响应体 */
Expand Down
2 changes: 1 addition & 1 deletion src/common-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface ICommonState {

/** 默认store值 从storage中激活 */
export const defaultValue: ICommonState = {
userInfo: getStorage('userInfo') || {},
userInfo: getStorage<IUserInfo>('userInfo') || {},
system: {
coolStartSuccess: false,
hasAccountCompleted: false,
Expand Down
11 changes: 6 additions & 5 deletions src/components/baseBuiltComp/FORBIDDEN/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;

&__bgContainer {
position: relative;
Expand All @@ -16,8 +16,8 @@
height: 70%;
align-items: center;

&__canvas {
}

&__canvas {}

&__title {
text-align: center;
Expand All @@ -27,4 +27,5 @@
color: $base-element-color;
}
}
}

}
23 changes: 5 additions & 18 deletions src/components/baseBuiltComp/FORBIDDEN/index.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
import { Button, Canvas, CoverView, View } from '@tarojs/components'
import { $, URL, goTo } from 'src/utils'
import { $ } from 'src/utils'
import useAnimation from 'src/hooks/useAnimation'
import { JSON_MAP } from 'src/static/SVG/lottie-map'
import { useCallback, useEffect } from 'react'
import { useEffect } from 'react'
import './index.module.scss'

const Index = (props) => {
const Index = () => {
const { run, instance } = useAnimation({
node: $('#ForbiddenContainer__bgContainer__canvas'),
template: JSON_MAP['forbidden'],
isAutoRun: false,
})

const goToIndex = useCallback(() => {
goTo({
url: URL.Index,
methodType: 'reLaunch',
options: { authorize: false },
})
}, [])

useEffect(() => {
run()
// setTimeout(() => {
// instance?.pause()
// }, 4000);
}, [instance, run])
}, [instance])
return (
<View className='ForbiddenContainer'>
<View className='ForbiddenContainer__bgContainer'>
Expand All @@ -37,11 +28,7 @@ const Index = (props) => {
<CoverView className='ForbiddenContainer__bgContainer__title'>
SRY 你没有权限访问该页面
</CoverView>
{props.children ? (
<props.children />
) : (
<Button onClick={goToIndex}>返回主页(退一步海阔天空)</Button>
)}
<Button>返回主页(退一步海阔天空)</Button>
</View>
</View>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/baseBuiltComp/HocWrap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export const Authorize = (Component) => {
}

/** @HOC 禁止页面要求必须是已授权的 */
export const Forbidden = (Component, props?: any) => {
export const Forbidden = (Component) => {
return React.memo(() => {
const state = useSelector((root: RootState) => root.common)
if (!state.system.coolStartSuccess) {
return <Loading isShow />
} else {
if (state.userInfo.isBindManage) return <Component />
return <ForbiddenComp>{props}</ForbiddenComp>
return <ForbiddenComp />
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/baseBuiltComp/Loading/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
align-items: center;
width: 100%;
height: 100%;
z-index: 1000;

&__canvas {
width: 100%;
// height: 40%;
}
}

}
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const config: Config = {
'pages/main/Index/index',
'pages/main/Calendar/index',
'pages/main/Manage/index',
'pages/main/Manage/Publish/index',
'pages/main/My/index',
// 'pages/Detail/index',
// 'pages/Initial/index',
Expand Down
2 changes: 0 additions & 2 deletions src/hooks/useRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ const useRequest = <T>(requestFn: TRequestFn, options?: TRequestOptions) => {
/** 请求开始 */
PerfTackerInstance.requestBegin()
res = await fn<T>({ url, data: req, silent })
console.log(res.extraData?.count)

/* __PURE__ */ console.log(' === 响应返回 === ', res)

/** 校验是否成功 */
Expand Down
107 changes: 0 additions & 107 deletions src/pages/Detail/components/Poster.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/pages/Detail/components/poster.scss

This file was deleted.

2 changes: 1 addition & 1 deletion src/pages/Detail/index.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default definePageConfig({
/** 开启朋友分享 */
enableShareAppMessage: true,
/** 开启朋友圈分享 */
enableShareTimeline: false,
enableShareTimeline: true,
/** 自定义背景颜色 */
backgroundColor: '#ffffff',
/** 非首页设置返回Home */
Expand Down
Loading

0 comments on commit 03607cd

Please sign in to comment.