Skip to content

Commit

Permalink
💩 poop:先暫把多数 Eslint 警告禁掉做个应急处哩,之后再慢慢去掉
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackishGreen33 committed Aug 23, 2024
1 parent 530274b commit 4ff641c
Show file tree
Hide file tree
Showing 29 changed files with 250 additions and 125 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ dist-ssr
*.local
weapp.js
babel.config.js
ec-canvas

*.js
Binary file modified .yarn/install-state.gz
Binary file not shown.
3 changes: 3 additions & 0 deletions src/assets/userService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-return */
// userService.ts
import { get } from '@/fetch'; // 确保这个路径正确

import { User } from './types';

export const getUserInfo = (userId: number): Promise<User> => {
Expand Down
10 changes: 5 additions & 5 deletions src/components/CollectionCourse/CollectionCourse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import './index.scss';
type CollectionCourseProps = object;

const CollectionCourse: React.FC<CollectionCourseProps> = () => {
const [courseType, setCourseType] = useState('专');
const [courseName, setCourseName] = useState('高等数学A1');
const [courseTeacher, setCourseTeacher] = useState('周振荣');
const [courseRate, setCourseRate] = useState(3.5);
const [isClollected, setIsClollected] = useState(true);
const [courseType] = useState('专');
const [courseName] = useState('高等数学A1');
const [courseTeacher] = useState('周振荣');
const [courseRate] = useState(3.5);
const [isClollected] = useState(true);

return (
<>
Expand Down
18 changes: 14 additions & 4 deletions src/components/CommentComponent/CommentComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable import/first */
// Comment.tsx
import { get } from '@/fetch';
import { Image, Text, View } from '@tarojs/components';
import React, { useEffect, useState } from 'react';

import './index.scss';

import { get } from '@/fetch';

import { Comment } from '../../assets/types';
import { getUserInfo } from '../../assets/userService';
import './index.scss';

interface CommentProps {
comments: Comment[];
Expand Down Expand Up @@ -61,8 +71,8 @@ const CommentComponent: React.FC<CommentProps> = ({ comments, onCommentClick })
setAllComments(commentsWithRepliesAndUserInfo);
};

fetchAllReplies();
}, []);
void fetchAllReplies();
}, [allComments]);

const ctimeToString = (ctime: number) => {
const ctimeDate = new Date(ctime);
Expand Down
1 change: 1 addition & 0 deletions src/components/FloatingWindow/FloatingWindow.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/jsx-key */
import { Swiper, SwiperItem, View } from '@tarojs/components';

import './index.scss';
Expand Down
4 changes: 2 additions & 2 deletions src/components/GuildLine/GuildLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const GuildLine: React.FC<GuildLineProps> = () => {
size="35"
color="#FFD777"
onClick={() => {
Taro.navigateTo({ url: '/pages/main/index' });
void Taro.navigateTo({ url: '/pages/main/index' });
}}
></AtIcon>
<View className="add_button">
Expand All @@ -25,7 +25,7 @@ const GuildLine: React.FC<GuildLineProps> = () => {
size="35"
color="#FFD777"
onClick={() => {
Taro.navigateTo({ url: '/pages/personalPage/index' });
void Taro.navigateTo({ url: '/pages/personalPage/index' });
}}
></AtIcon>
</View>
Expand Down
6 changes: 6 additions & 0 deletions src/components/SearchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
import { Image, Input, View } from '@tarojs/components';
import React, { useRef, useState } from 'react';

import './SearchInput.scss';

type SearchInputProps = {
Expand Down
7 changes: 6 additions & 1 deletion src/components/comment/comment.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
// import React, { useEffect } from "react";
import { Image, Navigator, Text, View } from '@tarojs/components';
import ShowStar from '../showStar/showStar';

import './comment.scss';

import ShowStar from '../showStar/showStar';

export default function comment(props) {
// 创建一个新的Date对象,传入时间戳
const ctimeDate = new Date(props.ctime);
Expand Down
4 changes: 3 additions & 1 deletion src/components/label1/label1.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
import { Text, View } from '@tarojs/components';
import { useCallback } from 'react';

Expand All @@ -9,7 +11,7 @@ export default function Label1(props) {
event.stopPropagation(); // 阻止事件冒泡
props.onClick(props.content);
},
[props.content, props.onClick]
[props]
);

return (
Expand Down
13 changes: 10 additions & 3 deletions src/components/label2/label2.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { View } from '@tarojs/components';
import { useEffect, useState } from 'react';

import './label2.scss';

import Label3 from '../label3/label3';
import ShowStar from '../showStar/showStar';
import './label2.scss';

export default function Label2(props) {
const star2 = 'https://s2.loli.net/2023/08/29/rENVFz7xU9n2bd6.png';
Expand Down Expand Up @@ -30,7 +37,7 @@ export default function Label2(props) {
return commentsArray.map((item, index) => {
// 确保item存在并且有内容可以显示
if (item) {
let obj = { content: item };
const obj = { content: item };
return <Label3 key={index} {...obj} />; // 添加key属性
}
return null;
Expand All @@ -40,7 +47,7 @@ export default function Label2(props) {
// 修正useEffect
useEffect(() => {
getStar(props.composite_score);
}, [props.composite_score]); // 添加依赖项props.composite_score
}, [getStar, props.composite_score]); // 添加依赖项props.composite_score

// ...其他代码

Expand Down
3 changes: 3 additions & 0 deletions src/components/label3/label3.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { View } from '@tarojs/components';

import './label3.scss';
Expand Down
2 changes: 2 additions & 0 deletions src/components/showStar/showStar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable react-hooks/rules-of-hooks */
import { Image, View } from '@tarojs/components';
import { useEffect, useState } from 'react';

Expand Down
6 changes: 4 additions & 2 deletions src/components/star/star.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* eslint-disable react/jsx-key */
/* eslint-disable unused-imports/no-unused-vars */
import { Image, View } from '@tarojs/components';
import { useState } from 'react';

import './star.scss';

export default function Star(props) {
export default function Star() {
const star0 = 'https://s2.loli.net/2023/08/29/NRLD54kzG9nEOHW.png';
const star1 = 'https://s2.loli.net/2023/08/29/rENVFz7xU9n2bd6.png';

Expand All @@ -23,7 +25,7 @@ export default function Star(props) {
return (
<Image
className="star"
onClick={(e) => {
onClick={() => {
starClick(index);
}}
src={star}
Expand Down
13 changes: 7 additions & 6 deletions src/custom-tab-bar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/* eslint-disable unused-imports/no-unused-vars */
import { View } from '@tarojs/components';

// 这边说一下,tabbar的样式没办法用tailwindcss,所以只能写原生
import './index.scss';

// eslint-disable-next-line import/first
import useActiveButtonStore from '@/common/hooks/useActiveNav';
// import useActiveButtonStore from '@/common/hooks/useActiveNav';

const TAB_LIST: Array<{ pagePath: string; text?: string }> = [
{ pagePath: '/pages/123/index', text: '123' },
{ pagePath: '/pages/456/index', text: '456' },
];
// const TAB_LIST: Array<{ pagePath: string; text?: string }> = [
// { pagePath: '/pages/123/index', text: '123' },
// { pagePath: '/pages/456/index', text: '456' },
// ];

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

return <View className="tabBar">test</View>;
};
Expand Down
23 changes: 14 additions & 9 deletions src/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-base-to-string */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import Taro from '@tarojs/taro';

const preUrl = 'https://kstack.muxixyz.com';
Expand All @@ -9,15 +14,15 @@ export async function post(url = '', data = {}, isToken = true) {

const getToken = () => {
return new Promise((resolve, reject) => {
Taro.getStorage({
void Taro.getStorage({
key: 'token',
success: (res) => {
const token = res.data;
if (token) {
resolve(token); // 如果token存在,解析Promise
} else {
reject(new Error('No token found')); // 如果没有token,拒绝Promise
Taro.navigateTo({ url: '/pages/login/index' }); // 导航到登录页面
void Taro.navigateTo({ url: '/pages/login/index' }); // 导航到登录页面
}
},
fail: (err) => {
Expand Down Expand Up @@ -60,15 +65,15 @@ export async function get(url = '', isToken = true) {

const getToken = () => {
return new Promise((resolve, reject) => {
Taro.getStorage({
void Taro.getStorage({
key: 'token',
success: (res) => {
const token = res.data;
if (token) {
resolve(token); // 如果token存在,解析Promise
} else {
reject(new Error('No token found')); // 如果没有token,拒绝Promise
Taro.navigateTo({ url: '/pages/login/index' }); // 导航到登录页面
void Taro.navigateTo({ url: '/pages/login/index' }); // 导航到登录页面
}
},
fail: (err) => {
Expand Down Expand Up @@ -110,13 +115,13 @@ export async function put(url = '', data = {}, isToken = true) {
};

if (isToken) {
Taro.getStorage({
void Taro.getStorage({
key: 'token',
success: (res) => {
const token = res.data;
if (token) header['Authorization'] = token;
else {
Taro.navigateTo({ url: '/pages/login/index' });
void Taro.navigateTo({ url: '/pages/login/index' });
}
},
});
Expand Down Expand Up @@ -153,7 +158,7 @@ export async function postPwd(url = '', data = {}, token: string) {

if (token) header['Authorization'] = token;
else {
Taro.navigateTo({ url: '/pages/login/index' });
void Taro.navigateTo({ url: '/pages/login/index' });
}

try {
Expand Down Expand Up @@ -181,13 +186,13 @@ export async function postLogin(url = '', data = {}, isToken = true) {
};

if (isToken) {
Taro.getStorage({
void Taro.getStorage({
key: 'token',
success: (res) => {
const token = res.data;
if (token) header['Authorization'] = token;
else {
Taro.navigateTo({ url: '/pages/login/index' });
void Taro.navigateTo({ url: '/pages/login/index' });
}
},
});
Expand Down
16 changes: 12 additions & 4 deletions src/pages/classInfo/index.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import Comment from '@/components/comment/comment';
import Label3 from '@/components/label3/label3';
import ShowStar from '@/components/showStar/showStar';
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable import/first */
import { Text, View } from '@tarojs/components';
import { Component } from 'react';

import './index.scss';

import Comment from '@/components/comment/comment';
import Label3 from '@/components/label3/label3';
import ShowStar from '@/components/showStar/showStar';

//import Chart from '@/components/chart/chart'
//@ts-ignore

import * as echarts from '../../components/ec-canvas/echarts.js'; // 引入echarts

class Chart extends Component {
Expand Down
13 changes: 10 additions & 3 deletions src/pages/evaluate/evaluate.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/* eslint-disable unused-imports/no-unused-vars */
/* eslint-disable react/jsx-key */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable react-hooks/rules-of-hooks */
/* eslint-disable import/first */
import {
Button,
Form,
Expand Down Expand Up @@ -26,15 +33,15 @@ export default function evaluate() {
// 示例用法
//const uniqueID = generateUniqueID();

const [testways, setTestways] = useState([
const [testways] = useState([
{ value: '开卷考试', text: '开卷考试', checked: false },
{ value: '闭卷考试', text: '闭卷考试', checked: false },
{ value: '论文考核', text: '论文考核', checked: false },
{ value: '小组汇报', text: '小组汇报', checked: false },
{ value: '无考核', text: '无考核', checked: false },
]);

const [myclass, setMyclass] = useState([{ content: '只能评价自己学过的课程哦' }]);
const [myclass] = useState([{ content: '只能评价自己学过的课程哦' }]);

const [features, setFeatures] = useState([
{ id: generateUniqueID(), content: '老师风趣幽默', checked: false },
Expand Down Expand Up @@ -80,7 +87,7 @@ export default function evaluate() {
<Text>考核方式 :</Text>
<View className="ways">
<RadioGroup>
{testways.map((item, index) => {
{testways.map((item) => {
return (
<Radio
className="myradio"
Expand Down
2 changes: 2 additions & 0 deletions src/pages/evaluateCourseHistory/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable no-console */
/* eslint-disable react-hooks/rules-of-hooks */
import { View } from '@tarojs/components';
import { useLoad } from '@tarojs/taro';

Expand Down
Loading

0 comments on commit 4ff641c

Please sign in to comment.