Skip to content

Commit

Permalink
🐞 fix:merge
Browse files Browse the repository at this point in the history
  • Loading branch information
eleliauk committed Aug 31, 2024
2 parents 17aed51 + 7e55066 commit c24d9d5
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 65 deletions.
25 changes: 25 additions & 0 deletions src/common/components/TitleButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Button } from '@tarojs/components';
import { memo } from 'react';

interface TitleButtonProps {
title: string;
isSelected?: boolean;
isDisabled?: boolean;
onClick?: () => void;
}

const TitleButton: React.FC<TitleButtonProps> = memo(
({ title, isSelected, isDisabled, onClick }) => {
return (
<Button
className={`whitespace-nowrap px-2 py-1 text-xs text-[#f19900] shadow-lg ${isSelected ? 'bg-[#f19900] text-white' : 'bg-gray-200 text-white'}`}
disabled={isDisabled}
onClick={onClick}
>
{title}
</Button>
);
}
);

export default TitleButton;
1 change: 1 addition & 0 deletions src/common/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as CollectionCourse } from './CollectionCourse/CollectionCourse';
export { default as FloatingWindow } from './FloatingWindow/FloatingWindow';
export { default as TitleButton } from './TitleButton';
export { default as VirtualList } from './VirtualList';
15 changes: 0 additions & 15 deletions src/common/components/titleButton/titleButton.scss

This file was deleted.

24 changes: 0 additions & 24 deletions src/common/components/titleButton/titleButton.tsx

This file was deleted.

10 changes: 4 additions & 6 deletions src/modules/profile/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, { memo, useEffect, useMemo, useState } from 'react';

import { get } from '@/common/api/get';
import { TopBackground } from '@/common/assets/img/personalPage';
import TitleButton from '@/common/components/titleButton/titleButton';
import { TitleButton } from '@/common/components';
import type { ResponseLevel, ResponseUser } from '@/common/types/userTypes';

const Header: React.FC = memo(() => {
Expand Down Expand Up @@ -79,12 +79,10 @@ const Header: React.FC = memo(() => {
/>
</View>
<View className="flex flex-col gap-2">
<View className="flex w-2/5 items-center gap-2">
<View className="flex items-center gap-2">
<Text className="text-md whitespace-nowrap">{user.nickName}</Text>
{user.selectedTitle !== 'None' && (
<View className="w-1/5">
<TitleButton title={user.selectedTitle}></TitleButton>
</View>
<TitleButton title={user.selectedTitle} isSelected></TitleButton>
)}
<Text
className="text-md font-bold text-white"
Expand All @@ -107,7 +105,7 @@ const Header: React.FC = memo(() => {
color="orange"
strokeWidth={6}
borderRadius={100}
className="w-32"
className="w-36"
></Progress>
</View>
</View>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/editUser/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
//margin-left: 30%;
margin-right: 25%;
display: flex;
gap: 1vw;
align-items: center;
}
.editor-nickname {
width: 4vw;
Expand Down Expand Up @@ -80,9 +82,7 @@
width: 300rpx;
height: 81rpx;
background: #f19900;
}
.button-container {
display: flex;
color: white;
}
.logout-button {
margin-top: 10vw;
Expand Down
29 changes: 12 additions & 17 deletions src/pages/editUser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import './index.scss';
import { get } from '@/common/api/get';
import { fetchQiniuToken, fetchToQiniu } from '@/common/api/qiniu';
import { editIcon } from '@/common/assets/img/editPersonal';
import TitleButton from '@/common/components/titleButton/titleButton';
import { TitleButton } from '@/common/components';
import type { ResponseUser } from '@/common/types/userTypes';
import { post } from '@/common/utils/fetch';

Expand Down Expand Up @@ -92,10 +92,12 @@ const EditUser: React.FC = () => {
'/users/edit',
{ avatar: avatarUrl, nickname: nickName, using_title: selectedTitle },
true
).then((res) => console.log(res));
void Taro.showToast({
icon: 'success',
title: '保存成功',
).then((res) => {
console.log(res);
void Taro.showToast({ icon: 'success', title: '保存成功' });
setTimeout(() => {
void Taro.switchTab({ url: '/pages/profile/index' });
}, 1000);
});
};
const handleTitleSelect = (title: string) => {
Expand Down Expand Up @@ -174,22 +176,15 @@ const EditUser: React.FC = () => {
></TitleButton>
</View>
</View>
<View className="button-container">
<Button
className="cancel-button"
onClick={() => {
void Taro.switchTab({ url: '/pages/personalPage/index' });
}}
>
取消
</Button>
<View className="flex">
<Button className="cancel-button">取消</Button>
<Button className="save-button" onClick={handleSave}>
保存
</Button>
<Button className="logout-button" onClick={handleLogout}>
退出登陆
</Button>
</View>
<Button className="logout-button" onClick={handleLogout}>
退出登陆
</Button>
</View>
);
};
Expand Down

0 comments on commit c24d9d5

Please sign in to comment.