Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
73da6ea5
Commit
73da6ea5
authored
Mar 10, 2021
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style:
💄
格式优化
parent
5acdca3f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
86 deletions
+4
-86
useRequest.js
c_client/src/hooks/useRequest.js
+2
-2
useTasks.js
c_client/src/hooks/useTasks.js
+0
-78
index.jsx
c_client/src/pages/index/index.jsx
+2
-6
No files found.
c_client/src/hooks/useRequest.js
View file @
73da6ea5
...
@@ -14,7 +14,7 @@ import { useState, useEffect } from 'react'
...
@@ -14,7 +14,7 @@ import { useState, useEffect } from 'react'
}
}
* @return {*}
* @return {*}
*/
*/
export
function
useRequest
(
api
,
p
arams
=
{},
config
=
{
manual
:
false
})
{
export
function
useRequest
(
api
,
defaultP
arams
=
{},
config
=
{
manual
:
false
})
{
const
[
data
,
setData
]
=
useState
({})
const
[
data
,
setData
]
=
useState
({})
const
[
code
,
setCode
]
=
useState
(
''
)
const
[
code
,
setCode
]
=
useState
(
''
)
const
[
success
,
setSuccess
]
=
useState
(
false
)
const
[
success
,
setSuccess
]
=
useState
(
false
)
...
@@ -22,7 +22,7 @@ export function useRequest(api, params = {}, config = { manual: false }) {
...
@@ -22,7 +22,7 @@ export function useRequest(api, params = {}, config = { manual: false }) {
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
error
,
setError
]
=
useState
(
null
)
const
[
error
,
setError
]
=
useState
(
null
)
const
request
=
async
()
=>
{
const
request
=
async
(
params
=
defaultParams
)
=>
{
setLoading
(
true
)
setLoading
(
true
)
try
{
try
{
const
{
data
:
resData
,
success
:
resSuccess
,
message
:
resMsg
,
code
:
resCode
}
=
await
api
(
params
,
config
)
const
{
data
:
resData
,
success
:
resSuccess
,
message
:
resMsg
,
code
:
resCode
}
=
await
api
(
params
,
config
)
...
...
c_client/src/hooks/useTasks.js
View file @
73da6ea5
...
@@ -5,84 +5,6 @@ import { useRequest } from './useRequest'
...
@@ -5,84 +5,6 @@ import { useRequest } from './useRequest'
export
function
useTasks
()
{
export
function
useTasks
()
{
const
{
data
,
run
:
fetchTaskList
}
=
useRequest
(
API
.
getTaskList
,
{},
{
manual
:
false
})
const
{
data
,
run
:
fetchTaskList
}
=
useRequest
(
API
.
getTaskList
,
{},
{
manual
:
false
})
// const mockTaskList = [
// {
// taskType: 'follow',
// title: '关注店铺',
// taskRateType: 1,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'member',
// title: '加入会员',
// taskRateType: 1,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'invites',
// title: '邀请好友入会',
// taskRateType: 1,
// times: 3,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'jumpLink',
// title: '浏览店铺15s',
// taskRateType: 2,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'browseGoods',
// itemIds: '617724147979,617724563528,617300295119',
// title: '浏览商品',
// taskRateType: 2,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'orderGoods',
// itemIds: '617724147979,617724563528,617300295119',
// title: '下单任务',
// taskRateType: 2,
// times: 1,
// completeTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'collectGoods',
// title: '收藏商品',
// itemIds: '617724147979,617724563528,617300295119',
// taskRateType: 2,
// times: 1,
// todayCompleteTimes: 0,
// status: 1,
// rewards: 1
// },
// {
// taskType: 'sign',
// title: '每日签到',
// taskRateType: 2,
// times: 1,
// todayCompleteTimes: 0,
// status: 1,
// rewards: 1
// }
// ]
return
{
return
{
taskList
:
data
?.
list
||
[],
taskList
:
data
?.
list
||
[],
fetchTaskList
fetchTaskList
...
...
c_client/src/pages/index/index.jsx
View file @
73da6ea5
...
@@ -8,7 +8,6 @@ import API from '@/api'
...
@@ -8,7 +8,6 @@ import API from '@/api'
import
RuleModal
from
'@/components/RuleModal/RuleModal'
import
RuleModal
from
'@/components/RuleModal/RuleModal'
import
DoHelpModal
from
'@/components/DoHelpModal/DoHelpModal'
import
DoHelpModal
from
'@/components/DoHelpModal/DoHelpModal'
import
TasksModal
from
'@/components/TasksModal/TasksModal'
import
TasksModal
from
'@/components/TasksModal/TasksModal'
import
styles
from
'./index.module.less'
import
styles
from
'./index.module.less'
const
INDEX_CONFIG
=
{
const
INDEX_CONFIG
=
{
...
@@ -31,11 +30,8 @@ function Index() {
...
@@ -31,11 +30,8 @@ function Index() {
const
[
taskFlag
,
setTaskFlag
]
=
useState
(
0
)
const
[
taskFlag
,
setTaskFlag
]
=
useState
(
0
)
const
fetchActivityInfo
=
async
()
=>
{
const
fetchActivityInfo
=
async
()
=>
{
const
res
=
await
API
.
getActivityBaseInfoById
()
const
{
success
,
data
}
=
await
API
.
getActivityBaseInfoById
()
const
{
data
}
=
res
success
&&
setActivityInfoAndStatus
(
data
)
if
(
res
?.
success
)
{
setActivityInfoAndStatus
(
data
)
}
}
}
// 授权登录完成
// 授权登录完成
useLogin
(()
=>
{
useLogin
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment