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
MaggieMii authored Sep 25, 2024
2 parents fd04a1e + 6711c00 commit fedf67f
Show file tree
Hide file tree
Showing 14 changed files with 1,595 additions and 3,606 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.js linguist-language=typescript
4 changes: 2 additions & 2 deletions config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ const config = {

module.exports = function (merge) {
if (process.env.NODE_ENV === 'development') {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
return merge({}, config, require('./dev'));
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
return merge({}, config, require('./prod'));
};
74 changes: 37 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,79 +40,79 @@
],
"author": "",
"dependencies": {
"@babel/runtime": "^7.24.8",
"@taro-hooks/plugin-auto-import": "^2.0.11",
"@taro-hooks/plugin-react": "^2.0.11",
"@babel/runtime": "^7.25.6",
"@taro-hooks/plugin-auto-import": "^2.1.0",
"@taro-hooks/plugin-react": "^2.1.0",
"@taroify/core": "^0.4.0-alpha.0",
"@tarojs/components": "3.6.35",
"@tarojs/components": "4.0.5",
"@tarojs/components-advanced": "^4.0.5",
"@tarojs/helper": "3.6.34",
"@tarojs/plugin-framework-react": "3.6.34",
"@tarojs/plugin-platform-alipay": "3.6.34",
"@tarojs/helper": "4.0.5",
"@tarojs/plugin-framework-react": "4.0.5",
"@tarojs/plugin-platform-alipay": "4.0.5",
"@tarojs/plugin-platform-h5": "4.0.5",
"@tarojs/plugin-platform-jd": "3.6.34",
"@tarojs/plugin-platform-qq": "3.6.33",
"@tarojs/plugin-platform-jd": "4.0.5",
"@tarojs/plugin-platform-qq": "4.0.5",
"@tarojs/plugin-platform-swan": "4.0.5",
"@tarojs/plugin-platform-tt": "4.0.5",
"@tarojs/plugin-platform-weapp": "3.6.34",
"@tarojs/plugin-platform-weapp": "4.0.5",
"@tarojs/react": "4.0.5",
"@tarojs/runtime": "4.0.5",
"@tarojs/shared": "3.6.34",
"@tarojs/shared": "4.0.5",
"@tarojs/taro": "4.0.5",
"echarts": "^5.5.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"immer": "^10.1.1",
"lodash": "4.17.21",
"prettier": "^3.3.3",
"qiniu-js": "^4.0.0-beta.3",
"qiniu-js": "^4.0.0-beta.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"taro-charts": "^1.0.7",
"taro-hooks": "^2.0.11",
"taro-hooks": "^2.1.0",
"taro-react-echarts": "^1.2.2",
"taro-ui": "^3.3.0",
"zustand": "^4.5.4"
"zustand": "^4.5.5"
},
"devDependencies": {
"@babel/core": "^7.24.9",
"@babel/core": "^7.25.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
"@tarojs/cli": "3.6.35",
"@tarojs/cli": "4.0.5",
"@tarojs/taro-loader": "4.0.5",
"@tarojs/webpack5-runner": "3.6.35",
"@types/node": "^22.0.0",
"@types/react": "^18.3.3",
"@tarojs/webpack5-runner": "4.0.5",
"@types/node": "^22.5.5",
"@types/react": "^18.3.8",
"@types/sass": "1.45.0",
"@types/webpack-env": "^1.18.5",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"autoprefixer": "^10.4.19",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"autoprefixer": "^10.4.20",
"babel-plugin-import": "^1.13.8",
"babel-preset-taro": "3.6.35",
"cache-loader": "^4.1.0",
"cssnano": "^7.0.4",
"eslint": "^8.57.0",
"cssnano": "^7.0.6",
"eslint": "^8.57.1",
"eslint-config-taro": "4.0.5",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.0.1",
"husky": "^9.1.5",
"postcss": "^8.4.40",
"postcss-rem-to-responsive-pixel": "^6.0.1",
"prettier-plugin-organize-imports": "^4.0.0",
"prettier-plugin-tailwindcss": "^0.6.5",
"eslint-plugin-unused-imports": "^4.1.4",
"husky": "^9.1.6",
"postcss": "^8.4.47",
"postcss-rem-to-responsive-pixel": "^6.0.2",
"prettier-plugin-organize-imports": "^4.1.0",
"prettier-plugin-tailwindcss": "^0.6.6",
"react-refresh": "^0.14.2",
"stylelint": "16.9.0",
"tailwindcss": "^3.4.6",
"tailwindcss": "^3.4.12",
"taro-iconfont-cli": "^3.3.0",
"taro-plugin-compiler-optimization": "^1.0.4",
"thread-loader": "^4.0.2",
"thread-loader": "^4.0.4",
"ts-node": "^10.9.2",
"typescript": "^5.5.4",
"weapp-tailwindcss": "^3.4.0",
"webpack": "^5.93.0"
"typescript": "^5.6.2",
"weapp-tailwindcss": "^3.5.2",
"webpack": "^5.94.0"
},
"resolutions": {
"@types/sass": "1.45.0"
Expand Down
1 change: 1 addition & 0 deletions src/common/api/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export async function get(url: string) {
key: 'shortToken',
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
success: (res) => resolve(res.data),
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
fail: (err) => reject(err),
});
});
Expand Down
1 change: 1 addition & 0 deletions src/common/api/getUserCourses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export async function getUserCourses(year: string, term: string) {
key: 'shortToken',
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
success: (res) => resolve(res.data),
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
fail: (err) => reject(err),
});
});
Expand Down
1 change: 1 addition & 0 deletions src/common/api/qiniu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const fetchToQiniu = async (filepath) => {
resolve(`https://${domain_name}/${JSON.parse(res.data)?.key}`);
},
fail: (err) => {
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
reject(err);
},
});
Expand Down
4 changes: 1 addition & 3 deletions src/custom-tab-bar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import './index.scss';
import useActiveButtonStore, { ActiveButtonType } from '@/common/hooks/useActiveNav';
import uniqueKeyUtil from '@/common/utils/keyGen';

interface TabBarProps {}

const TAB_LIST: Array<{ pagePath: string; name: string; icon?: string }> = [
{ pagePath: '/pages/main/index', name: 'Home', icon: 'streaming' },
{ pagePath: '/pages/guide/index', name: 'Guide', icon: 'download-cloud' },
Expand All @@ -19,7 +17,7 @@ const TAB_LIST: Array<{ pagePath: string; name: string; icon?: string }> = [
{ pagePath: '/pages/profile/index', name: 'Profile', icon: 'user' },
];

const TabBar: React.FC<TabBarProps> = memo(() => {
const TabBar: React.FC = memo(() => {
const { activeButton, setActiveButton } = useActiveButtonStore();

return (
Expand Down
4 changes: 1 addition & 3 deletions src/modules/guide/components/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { Text, View } from '@tarojs/components';
import { memo } from 'react';
import { AtIcon } from 'taro-ui';

interface ContactProps {}

const Contact: React.FC<ContactProps> = memo(() => {
const Contact: React.FC = memo(() => {
return (
<View className="fixed bottom-[16vh] right-8 flex flex-col items-center gap-2">
<View className="flex aspect-square w-14 items-center justify-center rounded-full bg-[#f9f9f2] shadow-xl">
Expand Down
30 changes: 22 additions & 8 deletions src/modules/guide/components/Guide.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import { View } from '@tarojs/components';
import { memo } from 'react';
import { memo, useState } from 'react';

import Contact from './Contact';
import Selector from './Selector';
import Source from './Source';

const Guide: React.FC = memo(() => (
<View className="flex h-screen w-full flex-col items-center gap-4 overflow-y-scroll px-4 pb-[13vh] pt-2">
<Selector />
<Source />
<Contact />
</View>
));
const Guide: React.FC = memo(() => {
const [selection, setSelection] = useState<{ year: string; term: string }>({
year: '全部',
term: '全部',
});
const [isOpen, setIsOpen] = useState(false);

return (
<View className="flex h-screen w-full flex-col items-center gap-4 overflow-y-scroll px-4 pb-[13vh] pt-2">
<Selector
selection={selection}
isOpen={isOpen}
setSelection={setSelection}
setIsOpen={setIsOpen}
>
<Source year={selection.year} term={selection.term} />
<Contact />
</Selector>
</View>
);
});

export default Guide;
110 changes: 89 additions & 21 deletions src/modules/guide/components/Selector.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,96 @@
import { ConfigProvider, Picker, Popup } from '@taroify/core';
import { ArrowDown } from '@taroify/icons';
import { Text, View } from '@tarojs/components';
import { memo } from 'react';

interface SelectorProps {}

const Selector: React.FC<SelectorProps> = memo(() => {
return (
<View className="flex w-full items-center justify-between px-2">
<View className="flex w-1/3 flex-col gap-2">
<Text className="pl-2 text-xs">选择学年</Text>
<View className="flex w-full justify-between rounded-lg bg-[#f9f9f2] px-2 py-1">
<Text className="text-xs">全部</Text>
<ArrowDown className="text-xs" style={{ color: '#f18900' }} />
</View>
</View>
<View className="flex w-1/3 flex-col gap-2">
<Text className="pl-2 text-xs">选择学期</Text>
<View className="flex w-full justify-between rounded-lg bg-[#f9f9f2] px-2 py-1">
<Text className="text-xs">全部</Text>
<ArrowDown className="text-xs" style={{ color: '#f18900' }} />
</View>
</View>
import uniqueKeyUtil from '@/common/utils/keyGen';

type SelectType = '学年' | '学期';

interface SelectProps {
type: SelectType;
value: string;
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
}

interface SelectorProps {
selection: { year: string; term: string };
isOpen: boolean;
setSelection: React.Dispatch<React.SetStateAction<{ year: string; term: string }>>;
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
children: React.ReactNode;
}

const Times = () => {
const startYear = 2022;
const date = new Date();
const currentYear =
date.getMonth() + 1 > 8 ? date.getFullYear() : date.getFullYear() - 1;

return [
[
{ label: '全部', value: '全部' },
...Array(currentYear - startYear + 1)
.fill(null)
.map((_, index) => ({
label: `${startYear + index}`,
value: `${startYear + index}`,
})),
],
[
{ label: '全部', value: '全部' },
{ label: '第一学期', value: '第一学期' },
{ label: '第二学期', value: '第二学期' },
{ label: '第三学期', value: '第三学期' },
],
];
};

const Select: React.FC<SelectProps> = memo(({ type, value, setIsOpen }) => (
<View className="flex w-1/3 flex-col gap-2">
<Text className="pl-2 text-xs">选择{type}</Text>
<View
className="flex w-full justify-between rounded-lg bg-[#f9f9f2] px-2 py-1"
onClick={() => setIsOpen(true)}
>
<Text className="text-xs">{value}</Text>
<ArrowDown className="text-xs" style={{ color: '#f18900' }} />
</View>
);
});
</View>
));

const Selector: React.FC<SelectorProps> = memo(
({ selection, isOpen, setSelection, setIsOpen, children }) => (
<>
<View className="flex w-full items-center justify-between px-2">
{['学年', '学期'].map((item: SelectType) => (
<Select
key={uniqueKeyUtil.nextKey()}
type={item}
value={item === '学年' ? selection.year : selection.term}
setIsOpen={setIsOpen}
/>
))}
</View>
{children}
<Popup open={isOpen} placement="bottom">
<Popup.Close />
<ConfigProvider theme={{ pickerConfirmActionColor: '#f18900' }}>
<Picker
style={{ marginBottom: '15vh' }}
defaultValue={['全部', '全部']}
title="选择学年和学期"
columns={Times()}
onConfirm={(value) => {
setSelection({ year: value[0], term: value[1] });
setIsOpen(false);
}}
onCancel={() => setIsOpen(false)}
/>
</ConfigProvider>
</Popup>
</>
)
);

export default Selector;
Loading

0 comments on commit fedf67f

Please sign in to comment.