-
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 #32 from HXTIA/feat-auth
WIP:feat: 初始化授权认证页面结构
- Loading branch information
Showing
28 changed files
with
484 additions
and
113 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,5 +26,9 @@ | |
margin-top: 10%; | ||
color: $base-element-color; | ||
} | ||
|
||
.back-btn { | ||
margin-top: 120rpx; | ||
} | ||
} | ||
} |
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
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 was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
src/pages/main/Manage/components/apply-manage/components/apply.modules.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
.apply { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgb(110, 220, 220); | ||
border: 1px solid black; | ||
box-sizing: border-box; | ||
|
||
.title { | ||
font-size: 35rpx; | ||
font-family: AlibabaPuHuiTi; | ||
margin-bottom: 30rpx; | ||
} | ||
|
||
.ipt { | ||
width: 80%; | ||
height: 80rpx; | ||
background-color: greenyellow; | ||
margin-bottom: 120rpx; | ||
padding: 20rpx; | ||
font-size: 35rpx; | ||
font-family: AlibabaPuHuiTi; | ||
box-sizing: border-box; | ||
border-radius: 15rpx; | ||
} | ||
|
||
.btn_groups { | ||
width: 100%; | ||
height: 120rpx; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
.btn { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.apply-btn { | ||
width: 30%; | ||
height: 70%; | ||
} | ||
|
||
.history-btn { | ||
width: 30%; | ||
height: 70%; | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/pages/main/Manage/components/apply-manage/components/apply.tsx
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,54 @@ | ||
import { Button, Input, View, Text } from '@tarojs/components' | ||
import React, { FC, useCallback, useState } from 'react' | ||
import { Post, requestUrlCreator, showToast } from 'src/utils' | ||
import './apply.modules.scss' | ||
import { TComponents } from '..' | ||
import Frame from './frame' | ||
|
||
const url = requestUrlCreator({ | ||
rootPath: 'WX_STU', | ||
absolutePath: '/apply', | ||
}) /** TODO: 替换真实接口 */ | ||
const Index: FC<{ setView: React.Dispatch<React.SetStateAction<TComponents>> }> = ({ setView }) => { | ||
const [ipt, setIpt] = useState('') | ||
const apply = useCallback(async () => { | ||
if (!ipt.length) return | ||
/** 替换真实接口 */ | ||
const result = await Post({ | ||
url, | ||
data: { | ||
code: ipt, | ||
}, | ||
silent: true, | ||
}) | ||
|
||
if (result.isSuccess) { | ||
showToast({ icon: 'success', title: '申请成功' }) | ||
setTimeout(() => { | ||
setView('feedback') | ||
}, 1500) | ||
} else { | ||
result.handleException() | ||
} | ||
}, [ipt]) | ||
|
||
return ( | ||
<View className='apply'> | ||
<Frame targetView='feedback' setView={setView}> | ||
<Text>你可以申请权限获得管理员能力,请输入</Text> | ||
<Text className='title'>请输入授权码</Text> | ||
<Input className='ipt' value={ipt} onInput={({ detail: { value } }) => setIpt(value)} /> | ||
<View className='btn_groups'> | ||
<Button className='apply-btn btn' onClick={apply}> | ||
点击申请 | ||
</Button> | ||
<Button className='history-btn btn' key='button'> | ||
申请历史 | ||
</Button> | ||
</View> | ||
</Frame> | ||
</View> | ||
) | ||
} | ||
|
||
export default React.memo(Index) |
46 changes: 46 additions & 0 deletions
46
src/pages/main/Manage/components/apply-manage/components/feedback.modules.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.feedback_wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: 100%; | ||
height: 100%; | ||
border: 1px solid black; | ||
box-sizing: border-box; | ||
|
||
.back-btn { | ||
width: 100%; | ||
height: 5%; | ||
} | ||
|
||
.list_wrapper { | ||
width: 100%; | ||
max-height: 95%; | ||
overflow-y: scroll; | ||
} | ||
|
||
.list { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
height: 100rpx; | ||
padding: 0 30rpx 0 20rpx; | ||
box-sizing: border-box; | ||
background-color: aqua; | ||
|
||
&_left { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
|
||
.name { | ||
font-family: AlibabaPuHuiTi; | ||
font-size: 35rpx; | ||
} | ||
|
||
.time { | ||
font-size: 25rpx; | ||
} | ||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
src/pages/main/Manage/components/apply-manage/components/feedback.tsx
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,68 @@ | ||
import React, { FC, memo, useEffect, useState } from 'react' | ||
import { Button, View } from '@tarojs/components' | ||
import { timeFormat } from 'src/utils' | ||
import './feedback.modules.scss' | ||
import { TComponents } from '..' | ||
import Frame from './frame' | ||
|
||
const enumO = { | ||
0: '申请中', | ||
1: '已完成', | ||
} | ||
|
||
const List = memo(({ children }: any) => { | ||
const [data, setData] = useState<any[]>() | ||
useEffect(() => { | ||
/** TODO: 模拟请求 */ | ||
new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve([ | ||
{ | ||
id: 1, | ||
name: 'xbhsjabxhjasbhjxa', | ||
time: Date.now(), | ||
status: 0, | ||
}, | ||
{ | ||
id: 2, | ||
name: 'xsjabxhjasbxhjasbxhj', | ||
time: Date.now(), | ||
status: 1, | ||
}, | ||
]) | ||
}, 0) | ||
}).then((res: any[]) => { | ||
setData(res) | ||
}) | ||
}, []) | ||
return data && data.map((d) => children(d)) | ||
}) | ||
|
||
const Index: FC<{ setView: React.Dispatch<React.SetStateAction<TComponents>> }> = ({ setView }) => { | ||
return ( | ||
<Frame targetView='apply' setView={setView}> | ||
<View className='feedback_wrapper'> | ||
<View key='button' className='back-btn'> | ||
返回申请 | ||
</View> | ||
<View className='list_wrapper'> | ||
<List> | ||
{({ name, time, status }) => ( | ||
<View className='list'> | ||
<View className='list_left'> | ||
<View className='name'>{name}</View> | ||
<View className='time'>{timeFormat(time)}</View> | ||
</View> | ||
<View className='list_right'> | ||
<View className='status'>{enumO[status]}</View> | ||
</View> | ||
</View> | ||
)} | ||
</List> | ||
</View> | ||
</View> | ||
</Frame> | ||
) | ||
} | ||
|
||
export default React.memo(Index) |
File renamed without changes.
Oops, something went wrong.