Skip to content

Commit

Permalink
🐞 fix:merge
Browse files Browse the repository at this point in the history
  • Loading branch information
eleliauk committed Sep 22, 2024
2 parents 35d3414 + 6711c00 commit e0f5f67
Show file tree
Hide file tree
Showing 13 changed files with 1,498 additions and 3,356 deletions.
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'));
};
68 changes: 41 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,79 +40,93 @@
],
"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": "4.0.5",
"@tarojs/components-advanced": "^4.0.5",
<<<<<<< HEAD
"@tarojs/helper": "3.6.34",
"@tarojs/plugin-framework-react": "4.0.5",
"@tarojs/plugin-platform-alipay": "3.6.34",
"@tarojs/plugin-platform-h5": "4.0.5",
"@tarojs/plugin-platform-jd": "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": "4.0.5",
>>>>>>> 6711c00fb72d013457788d1ef4d78ce99c93bdb2
"@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": "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",
<<<<<<< HEAD
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^8.6.0",
"autoprefixer": "^10.4.19",
=======
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"autoprefixer": "^10.4.20",
>>>>>>> 6711c00fb72d013457788d1ef4d78ce99c93bdb2
"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
31 changes: 22 additions & 9 deletions src/modules/guide/components/Guide.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +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 />
</Selector>
</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;
20 changes: 9 additions & 11 deletions src/modules/guide/components/Selector.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ConfigProvider, Picker, Popup } from '@taroify/core';
import { ArrowDown } from '@taroify/icons';
import { Text, View } from '@tarojs/components';
import { memo, useState } from 'react';
import { memo } from 'react';

import uniqueKeyUtil from '@/common/utils/keyGen';

Expand All @@ -14,6 +14,10 @@ interface SelectProps {
}

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;
}

Expand Down Expand Up @@ -55,14 +59,8 @@ const Select: React.FC<SelectProps> = memo(({ type, value, setIsOpen }) => (
</View>
));

const Selector: React.FC<SelectorProps> = memo(({ children }) => {
const [selection, setSelection] = useState<{ year: string; term: string }>({
year: '全部',
term: '全部',
});
const [isOpen, setIsOpen] = useState(false);

return (
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) => (
Expand Down Expand Up @@ -92,7 +90,7 @@ const Selector: React.FC<SelectorProps> = memo(({ children }) => {
</ConfigProvider>
</Popup>
</>
);
});
)
);

export default Selector;
82 changes: 74 additions & 8 deletions src/modules/guide/components/Source.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,88 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { Text, View } from '@tarojs/components';
import { memo } from 'react';
import Taro from '@tarojs/taro';
import { memo, useEffect, useState } from 'react';
import { AtIcon } from 'taro-ui';

interface SourceProps {}
import { get } from '@/common/api/get';

const SourceItem: React.FC<{ text: string }> = memo(({ text }) => (
<View className="flex w-full items-center gap-4 p-2 hover:bg-gray-200">
interface SourceProps {
year: string;
term: string;
}

const handleCopy = (link: string) => {
void Taro.setClipboardData({
data: link,
success: () => {
void Taro.showToast({
title: '复制链接成功',
icon: 'success',
duration: 2000,
});
},
fail: () => {
void Taro.showToast({
title: '复制链接失败',
icon: 'none',
duration: 2000,
});
},
});
};

const SourceItem: React.FC<{ text: string; link: string }> = memo(({ text, link }) => (
<View
className="flex w-full items-center gap-4 p-2 hover:bg-gray-200"
onClick={() => handleCopy(link)}
>
<AtIcon value="file-generic" size="35" color="#f18900" />
<Text className="text-sm">{text}</Text>
</View>
));

const Source: React.FC<SourceProps> = memo(() => {
const Source: React.FC<SourceProps> = memo(({ year, term }) => {
const [source, setSource] = useState<{ name: string; content: string }[]>([]);

useEffect(() => {
const getSouce = async () => {
try {
const type = '选课手册';
const res = await get(`/statics/match/labels?labels[type]=${type}`);
let filteredData = res.data;
if (year !== '全部' && term !== '全部') {
filteredData = filteredData.filter(
(item) => item.labels.year === year && item.labels.term === term
);
} else if (year === '全部') {
filteredData = filteredData.filter((item) => item.labels.term === term);
} else if (term === '全部') {
filteredData = filteredData.filter((item) => item.labels.year === year);
}
const mappedData = filteredData.map((item) => ({
name: item.name as string,
content: item.content as string,
}));
setSource(mappedData);
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
}
};
void getSouce();
}, [term, year]);

return (
<View className="h-auto min-h-[75vh] w-full rounded-lg bg-[#f9f9f2] px-4 py-2">
<SourceItem text="2022-2023第一学期选课手册" />
<SourceItem text="2022-2023第一学期选课手册(2)" />
<SourceItem text="2022-2023第一学期选课手册(3)" />
<SourceItem text="2022-2023第一学期选课手册" link="" />
<SourceItem text="2022-2023第一学期选课手册(2)" link="" />
<SourceItem text="2022-2023第一学期选课手册(3)" link="" />
{source.map((item, index) => (
<SourceItem key={index} text={item.name} link={item.content} />
))}
</View>
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/modules/notification/components/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { memo } from 'react';

import type { Message as MessageType } from './types';

interface MessageProps extends MessageType {}
type MessageProps = MessageType;

const Message: React.FC<MessageProps> = memo(
({ username, avatar, eventType, description, comment, timestamp }) => (
Expand Down
4 changes: 1 addition & 3 deletions src/pages/feedback/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import React from 'react';

import './index.scss';

interface FeedbackProps {}

const Feedback: React.FC<FeedbackProps> = React.memo(() => {
const Feedback: React.FC = React.memo(() => {
const copyText = '764752182';

const handleCopy = () => {
Expand Down
Loading

0 comments on commit e0f5f67

Please sign in to comment.