Commit 73da6ea5 authored by qinhaitao's avatar qinhaitao

style: 💄 格式优化

parent 5acdca3f
...@@ -14,7 +14,7 @@ import { useState, useEffect } from 'react' ...@@ -14,7 +14,7 @@ import { useState, useEffect } from 'react'
} }
* @return {*} * @return {*}
*/ */
export function useRequest(api, params = {}, config = { manual: false }) { export function useRequest(api, defaultParams = {}, 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)
......
...@@ -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
......
...@@ -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(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment