Skip to content

Commit

Permalink
Merge branch 'MuxiKeStack:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
eleliauk authored Sep 26, 2024
2 parents 0a19551 + b775043 commit ad8bd8d
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 84 deletions.
1 change: 1 addition & 0 deletions src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default defineAppConfig({
'pages/editUser/index',
'pages/guide/index',
'pages/shareGrades/index',
'pages/questionList/index',
],
subpackages: [
{
Expand Down
144 changes: 72 additions & 72 deletions src/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,77 @@
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
export { };
declare global {
const useAPICheck: typeof import('taro-hooks')['useAPICheck']
const useAccountInfo: typeof import('taro-hooks')['useAccountInfo']
const useActionSheet: typeof import('taro-hooks')['useActionSheet']
const useAlertBeforeUnload: typeof import('taro-hooks')['useAlertBeforeUnload']
const useApp: typeof import('taro-hooks')['useApp']
const useArrayBuffer: typeof import('taro-hooks')['useArrayBuffer']
const useAudio: typeof import('taro-hooks')['useAudio']
const useAuthorize: typeof import('taro-hooks')['useAuthorize']
const useBackground: typeof import('taro-hooks')['useBackground']
const useBattery: typeof import('taro-hooks')['useBattery']
const useBluetooth: typeof import('taro-hooks')['useBluetooth']
const useBoolean: typeof import('taro-hooks')['useBoolean']
const useBrightness: typeof import('taro-hooks')['useBrightness']
const useCamera: typeof import('taro-hooks')['useCamera']
const useChooseAddress: typeof import('taro-hooks')['useChooseAddress']
const useClipboardData: typeof import('taro-hooks')['useClipboardData']
const useCreation: typeof import('taro-hooks')['useCreation']
const useDebounce: typeof import('taro-hooks')['useDebounce']
const useDebounceFn: typeof import('taro-hooks')['useDebounceFn']
const useDeviceInfo: typeof import('taro-hooks')['useDeviceInfo']
const useEnterOptions: typeof import('taro-hooks')['useEnterOptions']
const useEnv: typeof import('taro-hooks')['useEnv']
const useEvent: typeof import('taro-hooks')['useEvent']
const useFile: typeof import('taro-hooks')['useFile']
const useFrom: typeof import('taro-hooks')['useFrom']
const useImage: typeof import('taro-hooks')['useImage']
const useInvoice: typeof import('taro-hooks')['useInvoice']
const useKeyboard: typeof import('taro-hooks')['useKeyboard']
const useLatest: typeof import('taro-hooks')['useLatest']
const useLaunchOptions: typeof import('taro-hooks')['useLaunchOptions']
const useLoading: typeof import('taro-hooks')['useLoading']
const useLocation: typeof import('taro-hooks')['useLocation']
const useLogin: typeof import('taro-hooks')['useLogin']
const useManualPullDownRefresh: typeof import('taro-hooks')['useManualPullDownRefresh']
const useMap: typeof import('taro-hooks')['useMap']
const useMemoizedFn: typeof import('taro-hooks')['useMemoizedFn']
const useMenuButtonBoundingClientRect: typeof import('taro-hooks')['useMenuButtonBoundingClientRect']
const useModal: typeof import('taro-hooks')['useModal']
const useMotion: typeof import('taro-hooks')['useMotion']
const useMount: typeof import('taro-hooks')['useMount']
const useNavigationBar: typeof import('taro-hooks')['useNavigationBar']
const useNetworkType: typeof import('taro-hooks')['useNetworkType']
const useOnline: typeof import('taro-hooks')['useOnline']
const usePage: typeof import('taro-hooks')['usePage']
const usePreload: typeof import('taro-hooks')['usePreload']
const usePromise: typeof import('taro-hooks')['usePromise']
const useRecord: typeof import('taro-hooks')['useRecord']
const useRequest: typeof import('taro-hooks')['useRequest']
const useRequestSubscribeMessage: typeof import('taro-hooks')['useRequestSubscribeMessage']
const useRouter: typeof import('taro-hooks')['useRouter']
const useScanCode: typeof import('taro-hooks')['useScanCode']
const useSelectorQuery: typeof import('taro-hooks')['useSelectorQuery']
const useStorage: typeof import('taro-hooks')['useStorage']
const useSystemInfo: typeof import('taro-hooks')['useSystemInfo']
const useTabBar: typeof import('taro-hooks')['useTabBar']
const useThrottle: typeof import('taro-hooks')['useThrottle']
const useThrottleFn: typeof import('taro-hooks')['useThrottleFn']
const useToast: typeof import('taro-hooks')['useToast']
const useToggle: typeof import('taro-hooks')['useToggle']
const useTopBarText: typeof import('taro-hooks')['useTopBarText']
const useUnmount: typeof import('taro-hooks')['useUnmount']
const useUpdate: typeof import('taro-hooks')['useUpdate']
const useUpdateEffect: typeof import('taro-hooks')['useUpdateEffect']
const useUpdateManager: typeof import('taro-hooks')['useUpdateManager']
const useUserInfo: typeof import('taro-hooks')['useUserInfo']
const useVibrate: typeof import('taro-hooks')['useVibrate']
const useVideo: typeof import('taro-hooks')['useVideo']
const useVisible: typeof import('taro-hooks')['useVisible']
const useWeRun: typeof import('taro-hooks')['useWeRun']
const useWebp: typeof import('taro-hooks')['useWebp']
const useWindowInfo: typeof import('taro-hooks')['useWindowInfo']
const useAPICheck: (typeof import('taro-hooks'))['useAPICheck'];
const useAccountInfo: (typeof import('taro-hooks'))['useAccountInfo'];
const useActionSheet: (typeof import('taro-hooks'))['useActionSheet'];
const useAlertBeforeUnload: (typeof import('taro-hooks'))['useAlertBeforeUnload'];
const useApp: (typeof import('taro-hooks'))['useApp'];
const useArrayBuffer: (typeof import('taro-hooks'))['useArrayBuffer'];
const useAudio: (typeof import('taro-hooks'))['useAudio'];
const useAuthorize: (typeof import('taro-hooks'))['useAuthorize'];
const useBackground: (typeof import('taro-hooks'))['useBackground'];
const useBattery: (typeof import('taro-hooks'))['useBattery'];
const useBluetooth: (typeof import('taro-hooks'))['useBluetooth'];
const useBoolean: (typeof import('taro-hooks'))['useBoolean'];
const useBrightness: (typeof import('taro-hooks'))['useBrightness'];
const useCamera: (typeof import('taro-hooks'))['useCamera'];
const useChooseAddress: (typeof import('taro-hooks'))['useChooseAddress'];
const useClipboardData: (typeof import('taro-hooks'))['useClipboardData'];
const useCreation: (typeof import('taro-hooks'))['useCreation'];
const useDebounce: (typeof import('taro-hooks'))['useDebounce'];
const useDebounceFn: (typeof import('taro-hooks'))['useDebounceFn'];
const useDeviceInfo: (typeof import('taro-hooks'))['useDeviceInfo'];
const useEnterOptions: (typeof import('taro-hooks'))['useEnterOptions'];
const useEnv: (typeof import('taro-hooks'))['useEnv'];
const useEvent: (typeof import('taro-hooks'))['useEvent'];
const useFile: (typeof import('taro-hooks'))['useFile'];
const useFrom: (typeof import('taro-hooks'))['useFrom'];
const useImage: (typeof import('taro-hooks'))['useImage'];
const useInvoice: (typeof import('taro-hooks'))['useInvoice'];
const useKeyboard: (typeof import('taro-hooks'))['useKeyboard'];
const useLatest: (typeof import('taro-hooks'))['useLatest'];
const useLaunchOptions: (typeof import('taro-hooks'))['useLaunchOptions'];
const useLoading: (typeof import('taro-hooks'))['useLoading'];
const useLocation: (typeof import('taro-hooks'))['useLocation'];
const useLogin: (typeof import('taro-hooks'))['useLogin'];
const useManualPullDownRefresh: (typeof import('taro-hooks'))['useManualPullDownRefresh'];
const useMap: (typeof import('taro-hooks'))['useMap'];
const useMemoizedFn: (typeof import('taro-hooks'))['useMemoizedFn'];
const useMenuButtonBoundingClientRect: (typeof import('taro-hooks'))['useMenuButtonBoundingClientRect'];
const useModal: (typeof import('taro-hooks'))['useModal'];
const useMotion: (typeof import('taro-hooks'))['useMotion'];
const useMount: (typeof import('taro-hooks'))['useMount'];
const useNavigationBar: (typeof import('taro-hooks'))['useNavigationBar'];
const useNetworkType: (typeof import('taro-hooks'))['useNetworkType'];
const useOnline: (typeof import('taro-hooks'))['useOnline'];
const usePage: (typeof import('taro-hooks'))['usePage'];
const usePreload: (typeof import('taro-hooks'))['usePreload'];
const usePromise: (typeof import('taro-hooks'))['usePromise'];
const useRecord: (typeof import('taro-hooks'))['useRecord'];
const useRequest: (typeof import('taro-hooks'))['useRequest'];
const useRequestSubscribeMessage: (typeof import('taro-hooks'))['useRequestSubscribeMessage'];
const useRouter: (typeof import('taro-hooks'))['useRouter'];
const useScanCode: (typeof import('taro-hooks'))['useScanCode'];
const useSelectorQuery: (typeof import('taro-hooks'))['useSelectorQuery'];
const useStorage: (typeof import('taro-hooks'))['useStorage'];
const useSystemInfo: (typeof import('taro-hooks'))['useSystemInfo'];
const useTabBar: (typeof import('taro-hooks'))['useTabBar'];
const useThrottle: (typeof import('taro-hooks'))['useThrottle'];
const useThrottleFn: (typeof import('taro-hooks'))['useThrottleFn'];
const useToast: (typeof import('taro-hooks'))['useToast'];
const useToggle: (typeof import('taro-hooks'))['useToggle'];
const useTopBarText: (typeof import('taro-hooks'))['useTopBarText'];
const useUnmount: (typeof import('taro-hooks'))['useUnmount'];
const useUpdate: (typeof import('taro-hooks'))['useUpdate'];
const useUpdateEffect: (typeof import('taro-hooks'))['useUpdateEffect'];
const useUpdateManager: (typeof import('taro-hooks'))['useUpdateManager'];
const useUserInfo: (typeof import('taro-hooks'))['useUserInfo'];
const useVibrate: (typeof import('taro-hooks'))['useVibrate'];
const useVideo: (typeof import('taro-hooks'))['useVideo'];
const useVisible: (typeof import('taro-hooks'))['useVisible'];
const useWeRun: (typeof import('taro-hooks'))['useWeRun'];
const useWebp: (typeof import('taro-hooks'))['useWebp'];
const useWindowInfo: (typeof import('taro-hooks'))['useWindowInfo'];
}
4 changes: 2 additions & 2 deletions src/common/components/CommentComponent/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
}

.avatar {
width: 57.97rpx;
height: 57.97rpx;
width: 57.97rpx !important;
height: 57.97rpx !important;
border-radius: 100%;
margin-right: 10px;
border: #d2d5d8 solid 5rpx;
Expand Down
8 changes: 8 additions & 0 deletions src/pages/QuestionList/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.btn {
margin-top: 60rpx;
padding: 0 50rpx;
width: max-content;
border-radius: 50rpx;
background-color: #ffd777;
color: white;
}
29 changes: 25 additions & 4 deletions src/pages/QuestionList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// import React from 'react';
import { View } from '@tarojs/components';
import { useEffect, useState } from 'react';

import { Course } from '@/common/assets/types';
import CourseInfo from '@/common/components/CourseInfo/CourseInfo';
import QuestionListComponent from '@/common/components/QuestionListComponent/QuestionListComponent';
import { get } from '@/common/utils/fetch';
import { Button, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useEffect, useState } from 'react';
import './index.scss';

interface IQuestion {
id: number;
Expand All @@ -29,7 +30,18 @@ interface IQuestion {
const App = () => {
const [course, setCourse] = useState<Course | null>(null);
const [questions, setQuestions] = useState<IQuestion[] | null>(null);
const courseId = 2347; //先用概率统计A来调试吧
// const courseId = 2347; //先用概率统计A来调试吧
const [courseId, setCourseId] = useState<string | null>(null);
useEffect(() => {
const getParams = () => {
const instance = Taro.getCurrentInstance();
const params = instance?.router?.params || {};

if (params.course_id) setCourseId(params.course_id);
};

getParams();
}, []);

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/require-await
Expand Down Expand Up @@ -70,13 +82,22 @@ const App = () => {
if (courseId) void getQuestionList().then((r) => console.log(r));
}, [courseId]);

const handleAsk = () => {
void Taro.navigateTo({
url: `/pages/publishQuestion/index?course_id=${courseId}`,
});
};

return (
<View>
<CourseInfo name={course?.name} school={course?.school} teacher={course?.teacher} />
{questions !== null &&
questions.map((question, index) => (
<QuestionListComponent key={index} question={question} />
))}
<Button className="btn" onClick={handleAsk}>
我也要提问
</Button>
</View>
);
};
Expand Down
4 changes: 3 additions & 1 deletion src/pages/classInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ export default function Index() {
{questionlist.length > 0 && (
<View
onClick={() => {
void Taro.navigateTo({ url: '/pages/questionInfo/index' });
void Taro.navigateTo({
url: `/pages/questionList/index?course_id=${courseId}`,
});
}}
className="text-right"
>
Expand Down
13 changes: 12 additions & 1 deletion src/pages/publishQuestion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ const getCurrentDate = () => {
export default function Index() {
const [course, setCourse] = useState<Course | null>(null);

const courseId = 2347; //先用概率统计A来调试吧!
// const courseId = 2347; //先用概率统计A来调试吧!
const [courseId, setCourseId] = useState<string | null>(null);
useEffect(() => {
const getParams = () => {
const instance = Taro.getCurrentInstance();
const params = instance?.router?.params || {};

if (params.course_id) setCourseId(params.course_id);
};

getParams();
}, []);

//用户个人身份信息
const [avatarUrl, setAvatarUrl] = useState<string>('');
Expand Down
8 changes: 8 additions & 0 deletions src/pages/questionList/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.btn {
margin-top: 60rpx;
padding: 0 50rpx;
width: max-content;
border-radius: 50rpx;
background-color: #ffd777;
color: white;
}
29 changes: 25 additions & 4 deletions src/pages/questionList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// import React from 'react';
import { View } from '@tarojs/components';
import { useEffect, useState } from 'react';

import { Course } from '@/common/assets/types';
import CourseInfo from '@/common/components/CourseInfo/CourseInfo';
import QuestionListComponent from '@/common/components/QuestionListComponent/QuestionListComponent';
import { get } from '@/common/utils/fetch';
import { Button, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useEffect, useState } from 'react';
import './index.scss';

interface IQuestion {
id: number;
Expand All @@ -29,7 +30,18 @@ interface IQuestion {
const App = () => {
const [course, setCourse] = useState<Course | null>(null);
const [questions, setQuestions] = useState<IQuestion[] | null>(null);
const courseId = 2347; //先用概率统计A来调试吧
// const courseId = 2347; //先用概率统计A来调试吧
const [courseId, setCourseId] = useState<string | null>(null);
useEffect(() => {
const getParams = () => {
const instance = Taro.getCurrentInstance();
const params = instance?.router?.params || {};

if (params.course_id) setCourseId(params.course_id);
};

getParams();
}, []);

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/require-await
Expand Down Expand Up @@ -70,13 +82,22 @@ const App = () => {
if (courseId) void getQuestionList().then((r) => console.log(r));
}, [courseId]);

const handleAsk = () => {
void Taro.navigateTo({
url: `/pages/publishQuestion/index?course_id=${courseId}`,
});
};

return (
<View>
<CourseInfo name={course?.name} school={course?.school} teacher={course?.teacher} />
{questions !== null &&
questions.map((question, index) => (
<QuestionListComponent key={index} question={question} />
))}
<Button className="btn" onClick={handleAsk}>
我也要提问
</Button>
</View>
);
};
Expand Down

0 comments on commit ad8bd8d

Please sign in to comment.