This commit is contained in:
yj 2025-01-06 14:26:15 +08:00
parent 956f045fad
commit 496a4dd28f
2 changed files with 23 additions and 18 deletions

View File

@ -13,36 +13,42 @@ const FeedBackModel = forwardRef((_props: any, ref: any) => {
const [feedBackForm, setFeedBackForm] = useState({
rateValue: 0,
otherContent: '',
type: 0,
});
const [feedBackList, _setFeedBackList] = useState([
const [feedBackList, setFeedBackList] = useState([
{
text: "软件卡顿",
value: 2
value: 2,
active: false,
},
{
text: "设计不合理",
value: 3
value: 3,
active: false,
},
{
text: "功能太少",
value: 4
value: 4,
active: false,
},
{
text: "通话不流畅",
value: 5
value: 5,
active: false,
},
{
text: "视频卡顿",
value: 6
value: 6,
active: false,
},
{
text: "操作麻烦",
value: 7
value: 7,
active: false,
},
{
text: "其他,需要手动填写",
value: 1
value: 1,
active: false,
},
]);
return (
@ -75,11 +81,10 @@ const FeedBackModel = forwardRef((_props: any, ref: any) => {
{
feedBackList.map((item, index) => {
return (
<div key={index} className={feedBackForm.type === item.value ? styles.active : ''} onClick={() => {
setFeedBackForm({
...feedBackForm,
type: item.value
})
<div key={index} className={item.active ? styles.active : ''} onClick={() => {
const feedBackListTemp = [...feedBackList]
feedBackListTemp[index].active = !feedBackListTemp[index].active
setFeedBackList(feedBackListTemp)
}}>
<span>{item.text}</span>
</div>
@ -88,7 +93,7 @@ const FeedBackModel = forwardRef((_props: any, ref: any) => {
}
</div>
</div>
<div className={styles.feedBackModelContentList} style={{ visibility: feedBackForm.type === 1 ? 'visible' : 'hidden' }}>
<div className={styles.feedBackModelContentList} style={{ visibility: feedBackList[feedBackList.length - 1].active ? 'visible' : 'hidden' }}>
<TextArea
placeholder="填写意见"
value={feedBackForm.otherContent}
@ -107,8 +112,8 @@ const FeedBackModel = forwardRef((_props: any, ref: any) => {
onClick={() => {
let parmes = {
score: feedBackForm.rateValue,
otherContent: feedBackForm.type === 1 ? feedBackForm.otherContent : '',
type: feedBackForm.type,
otherContent: feedBackList[feedBackList.length - 1].active ? feedBackForm.otherContent : '',
types: feedBackList.filter(row => row.active).map((item: any) => item.value),
}
PostFeedback(parmes).then(res => {
if (res.code === 200) {

View File

@ -50,8 +50,8 @@ const Index: React.FC = () => {
const userInfo = JSON.parse(storage.getItem('user') as string)
useEffect(() => {
setUser(userInfo)
feedBackModelRef.current.changeModal()
if (state?.currentSeconds >= 600) {
feedBackModelRef.current.changeModal()
}
}, [])
useEffect(() => {