-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from HXTIA/merge-feat-initial-and-feat-mp-clip…
…-page fix: authorization component and update system info
- Loading branch information
Showing
19 changed files
with
398 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
@import "../../../app.scss"; | ||
@import '../../../app.scss'; | ||
|
||
.mask{ | ||
position: absolute; | ||
width: 100vw; | ||
min-height: 100vh; | ||
height: 100%; | ||
top: 0; | ||
left: 0; | ||
background-color: $bg-color-gary5; | ||
opacity: .1; | ||
z-index: 100; | ||
.mask { | ||
position: absolute; | ||
width: 100vw; | ||
min-height: 100vh; | ||
height: 100%; | ||
top: 0; | ||
left: 0; | ||
background-color: $bg-color-gary5; | ||
opacity: 0.1; | ||
z-index: 100; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
@import '../../../app.scss'; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@import '../../../app.scss'; | ||
.InitAccomplish { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
// justify-content: center; | ||
width: 100%; | ||
height: 100vh; | ||
padding-top: 200rpx; | ||
&__bgContainer__canvas { | ||
width: 1400rpx; | ||
height: 700rpx; | ||
} | ||
&__button { | ||
background-color: $primary-color; | ||
width: 548rpx; | ||
margin-top: 35rpx; | ||
color: #000; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Canvas, View } from '@tarojs/components' | ||
import React, { useCallback } from 'react' | ||
import { Button } from '@taroify/core' | ||
import { $, goTo, query, URL } from 'src/utils' | ||
import useAnimation from 'src/hooks/useAnimation' | ||
import { JSON_MAP } from 'src/static/SVG/lottie-map' | ||
import './initAccomplish.module.scss' | ||
|
||
const Index = () => { | ||
useAnimation({ | ||
node: $('#InitAccomplish__bgContainer__canvas'), | ||
template: JSON_MAP['initial_success'], | ||
_options: { loop: false }, | ||
}) | ||
const goToPage = useCallback(() => { | ||
goTo({ | ||
url: URL.SettingCourse, | ||
methodType: 'reLaunch', | ||
extraParams: { | ||
...query(), | ||
}, | ||
options: { | ||
authorize: false, | ||
}, | ||
}) | ||
}, []) | ||
|
||
return ( | ||
<View className='InitAccomplish'> | ||
{/* <View>完成</View> */} | ||
<Canvas | ||
className='InitAccomplish__bgContainer__canvas' | ||
id='InitAccomplish__bgContainer__canvas' | ||
type='2d' | ||
></Canvas> | ||
<Button | ||
variant='contained' | ||
color='success' | ||
shape='round' | ||
className='InitAccomplish__button' | ||
onClick={goToPage} | ||
> | ||
开启你的专属作业板~ | ||
</Button> | ||
</View> | ||
) | ||
} | ||
|
||
export default React.memo(Index) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { createContext } from 'react' | ||
import { requestUrlCreator } from 'src/utils' | ||
import { TPropsThrough } from './types' | ||
|
||
/** context props透传 https://zh-hans.react.dev/learn/passing-data-deeply-with-context# */ | ||
export const IndexContextProvider = createContext<TPropsThrough>({ | ||
page: 0, | ||
}) | ||
|
||
/** 课程数据的基础路径 */ | ||
export const getCourseInterUrl = requestUrlCreator({ | ||
absolutePath: '/course' /** TODO: 需要替换,mock路径 */, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { View } from '@tarojs/components' | ||
import { Input } from '@taroify/core' | ||
import React, { FC, useCallback, useContext, useState } from 'react' | ||
import useUpdateEffect from 'src/hooks/useUpdateEffect' | ||
import { TStateHookUpdateFn } from '../types' | ||
import { IndexContextProvider } from '../common' | ||
import './search.module.scss' | ||
|
||
const Index: FC<{ | ||
setSearchText: TStateHookUpdateFn<string> | ||
setPage: TStateHookUpdateFn<number> | ||
}> = ({ setSearchText, setPage }) => { | ||
const { requestFn, updateList, searchText, filterType } = useContext(IndexContextProvider) | ||
/** 搜索文案 */ | ||
const [text, setText] = useState('') | ||
/** 搜索逻辑 */ | ||
const searchBtn = useCallback(() => { | ||
/** TODO: 或许可以优化下这个逻辑 + 从未输入时的空数据不发请求 */ | ||
setPage(0) | ||
requestFn!({ page: 0, searchText: text }).then((res) => { | ||
res && updateList!([...(res || [])]) | ||
}) | ||
setSearchText(text) | ||
}, [requestFn, setPage, setSearchText, text, updateList]) | ||
|
||
useUpdateEffect(() => { | ||
setText('') | ||
setSearchText('') | ||
}, [filterType]) | ||
|
||
/** 更新搜索框文字 */ | ||
const updateText = useCallback( | ||
(e) => { | ||
const currentText = e.detail.value as string | ||
setText(currentText) | ||
/** 如果搜索框的值和index的不一样进行更新 */ | ||
if (currentText !== searchText) { | ||
setSearchText(currentText) | ||
} | ||
}, | ||
[searchText, setSearchText], | ||
) | ||
|
||
return ( | ||
<View className='search_wrapper'> | ||
<Input | ||
placeholder='输入点什么...' | ||
className='input' | ||
value={text} | ||
/** 每200ms合并一次 */ | ||
onChange={debounce(updateText, 200)} | ||
/> | ||
<View className='button' onClick={searchBtn}> | ||
搜索 | ||
</View> | ||
</View> | ||
) | ||
} | ||
|
||
export default React.memo<{ | ||
setSearchText: TStateHookUpdateFn<string> | ||
setPage: TStateHookUpdateFn<number> | ||
}>(Index) | ||
|
||
function debounce(func, delay) { | ||
let timer | ||
return function () { | ||
const context = this | ||
const args = arguments | ||
clearTimeout(timer) | ||
timer = setTimeout(() => { | ||
func.apply(context, args) | ||
}, delay) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** 搜索框 */ | ||
.search_wrapper { | ||
display: flex; | ||
justify-content: space-around; | ||
align-items: center; | ||
width: 100%; | ||
height: 100%; | ||
|
||
.input { | ||
box-sizing: border-box; | ||
width: 500rpx; | ||
height: 68rpx; | ||
border-radius: 215rpx; | ||
background: rgba(241, 245, 249, 1); | ||
padding: 0 30rpx 0 30rpx; | ||
} | ||
|
||
.button { | ||
box-sizing: border-box; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 120rpx; | ||
height: 60rpx; | ||
font-size: 25rpx; | ||
border-radius: 215rpx; | ||
background: rgba(61, 235, 165, 1); | ||
padding: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@import '../../../app.scss'; | ||
|
||
.course_wrapper { | ||
&__bottom { | ||
display: flex; | ||
justify-content: space-around; | ||
align-items: center; | ||
margin-top: 10px; | ||
} | ||
&__button { | ||
background-color: $primary-color; | ||
height: 75rpx; | ||
width: 500rpx; | ||
color: #000; | ||
} | ||
} |
Oops, something went wrong.