diff --git a/src/pages/Detail/index.tsx b/src/pages/Detail/index.tsx index fd62395..4a112c5 100644 --- a/src/pages/Detail/index.tsx +++ b/src/pages/Detail/index.tsx @@ -29,7 +29,8 @@ const Index: FC = () => { }), { auto: true }, ) - const imgs = useMemo(() => data?.pictureLinks?.split(',').map((v) => v) || [], [data]) + const imgs = useMemo(() => data?.pictureLinks?.split(',').filter((v) => !!v) || [], [data]) + const [isShowPoster, setIsShowPoster] = useState(false) // const updateTaskStatus = useCallback(() => { // if (data!.status > 1) { diff --git a/src/pages/main/Manage/components/apply-manage/components/apply.tsx b/src/pages/main/Manage/components/apply-manage/components/apply.tsx index 04f6984..8c69d01 100644 --- a/src/pages/main/Manage/components/apply-manage/components/apply.tsx +++ b/src/pages/main/Manage/components/apply-manage/components/apply.tsx @@ -7,7 +7,7 @@ import Frame from './frame' const url = requestUrlCreator({ rootPath: 'WX_STU', - absolutePath: '/apply', + absolutePath: '/verificationCode', }) /** TODO: 替换真实接口 */ const Index: FC<{ setView: React.Dispatch> }> = ({ setView }) => { const [ipt, setIpt] = useState('') @@ -15,10 +15,7 @@ const Index: FC<{ setView: React.Dispatch> }> if (!ipt.length) return /** 替换真实接口 */ const result = await Post({ - url, - data: { - code: ipt, - }, + url: url + `?code=${ipt}`, silent: true, }) diff --git a/src/pages/main/Manage/components/apply-manage/components/feedback.modules.scss b/src/pages/main/Manage/components/apply-manage/components/feedback.modules.scss index ef00670..5a8bda7 100644 --- a/src/pages/main/Manage/components/apply-manage/components/feedback.modules.scss +++ b/src/pages/main/Manage/components/apply-manage/components/feedback.modules.scss @@ -27,10 +27,11 @@ height: 100rpx; padding: 0 30rpx 0 20rpx; box-sizing: border-box; - background-color: aqua; + background-color: rgb(206, 213, 213); &_left { display: flex; + width: 100%; flex-direction: column; justify-content: center; @@ -42,6 +43,10 @@ .time { font-size: 25rpx; } + + .right { + text-align: end; + } } } } diff --git a/src/pages/main/Manage/components/apply-manage/components/feedback.tsx b/src/pages/main/Manage/components/apply-manage/components/feedback.tsx index d4fdd8e..acb5c90 100644 --- a/src/pages/main/Manage/components/apply-manage/components/feedback.tsx +++ b/src/pages/main/Manage/components/apply-manage/components/feedback.tsx @@ -1,38 +1,27 @@ import React, { FC, memo, useEffect, useState } from 'react' import { Button, View } from '@tarojs/components' -import { timeFormat } from 'src/utils' +import { Get, requestUrlCreator, timeFormat } from 'src/utils' import './feedback.modules.scss' import { TComponents } from '..' import Frame from './frame' -const enumO = { - 0: '申请中', - 1: '已完成', -} - +const url = requestUrlCreator({ + rootPath: 'WX_STU', + absolutePath: '/getStudentCode', +}) const List = memo(({ children }: any) => { const [data, setData] = useState() 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) + Get({ + url, + silent: true, + }).then(({ isSuccess, handleException, data: lists }) => { + if (!isSuccess) { + handleException() + } else { + setData(lists as any) + } }) }, []) return data && data.map((d) => children(d)) @@ -43,19 +32,20 @@ const Index: FC<{ setView: React.Dispatch> }> - 返回申请 + 🔙 返回继续申请 - {({ name, time, status }) => ( + {({ code, createdAt }) => ( - {name} - {timeFormat(time)} - - - {enumO[status]} + {code} + 申请时间:{timeFormat(createdAt)} + {/* + 创建人 + {studentId} + */} )} diff --git a/src/pages/main/Manage/index.tsx b/src/pages/main/Manage/index.tsx index c04ef19..4a6a0c2 100644 --- a/src/pages/main/Manage/index.tsx +++ b/src/pages/main/Manage/index.tsx @@ -42,7 +42,7 @@ const Index = () => { - + ) } diff --git a/src/utils/request/business.ts b/src/utils/request/business.ts index 1b780ac..58f3ccd 100644 --- a/src/utils/request/business.ts +++ b/src/utils/request/business.ts @@ -22,9 +22,13 @@ export const request = ( return new Promise(async (resolve) => { let resInstance try { + const _params = Object.assign({}, params, { data: { + ...(params.data ?? {}) as any, + collegeId: getStorage('userInfo')?.collegeId ?? -1 + } }) const result = await baseRequest({ ...baseExtraConfig, - ...params, + ..._params, header: { WXToken: getStorage('userInfo')?.token, ...params.header, diff --git a/src/utils/request/constants.ts b/src/utils/request/constants.ts index 7956b29..26f9f2b 100644 --- a/src/utils/request/constants.ts +++ b/src/utils/request/constants.ts @@ -36,6 +36,8 @@ export const enum STATUS_CODE { NO_LOGIN = 60001, /** 服务器异常 */ SERVER_FAIL = 500, + /** 不存在的授权码 */ + NO_CODE_EXIST = 600010 } /** diff --git a/src/utils/request/exception.ts b/src/utils/request/exception.ts index 31526d0..cf9882a 100644 --- a/src/utils/request/exception.ts +++ b/src/utils/request/exception.ts @@ -23,9 +23,19 @@ const handle_system_error_exception = (resWrap: ResultWrap) => { }) } +/** 处理没有授权码 */ +const handle_no_exist_code_error_exception = () => { + showToast({ + title: '错误的授权码', + icon: 'none', + duration: 3000, + }) +} + export default { handle_no_login_error_exception, handle_system_error_exception, + handle_no_exist_code_error_exception } /** 响应码对应的异常处理 */ @@ -33,4 +43,5 @@ export const EXCEPTION_HANDLE = { [STATUS_CODE.FAIL]: 'pass_error', [STATUS_CODE.NO_LOGIN]: 'no_login_error', [STATUS_CODE.SERVER_FAIL]: 'server_error', + [STATUS_CODE.NO_CODE_EXIST]: 'no_exist_code_error' }