-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
于占峰
committed
Aug 5, 2024
1 parent
f71030c
commit 195563a
Showing
15 changed files
with
292 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use sea_orm_migration::prelude::*; | ||
|
||
use entity::{resource, role_resource}; | ||
|
||
use crate::sea_orm::{ActiveModelTrait, NotSet}; | ||
use crate::sea_orm::ActiveValue::Set; | ||
|
||
#[derive(DeriveMigrationName)] | ||
pub struct Migration; | ||
|
||
#[async_trait::async_trait] | ||
impl MigrationTrait for Migration { | ||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
let db = manager.get_connection(); | ||
resource::ActiveModel { | ||
id: Set(62), | ||
parent_id: Set(48), | ||
resource_name: Set(Some("删除活动奖池物品".to_string())), | ||
resource_code: Set(Some("api_live_prize_pool_item_delete".to_string())), | ||
resource_type: Set(Some(2)), | ||
resource_root: Set(Some(false)), | ||
resource_action: Set(Some(true)), | ||
order_number: Set(Some(0)), | ||
url: Default::default(), | ||
api_path: Set(Some("/api/live_prize_pool_item/delete".to_string())), | ||
api_http_method: Set(Some("GET".to_string())), | ||
api_path_regex: NotSet, | ||
role: NotSet, | ||
status: Set(Some(true)), | ||
icon: NotSet, | ||
resource_desc: Set(Some("删除活动奖池物品接口".to_string())), | ||
}.insert(db).await?; | ||
role_resource::ActiveModel { | ||
id: NotSet, | ||
role_id: Set(1), | ||
resource_id: Set(62), | ||
}.insert(db).await?; | ||
Ok(()) | ||
} | ||
|
||
async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> { | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
web/src/pages/systemManager/livePrizePoolManager/livePrizePoolItem/addPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import React, { useContext, useEffect, useRef } from 'react'; | ||
import { | ||
Form, | ||
FormInstance, | ||
Modal, | ||
Notification, | ||
Select, | ||
} from '@arco-design/web-react'; | ||
import locale from './locale'; | ||
import useLocale from '@/utils/useLocale'; | ||
import { GlobalContext } from '@/context'; | ||
import FormItem from '@arco-design/web-react/es/Form/form-item'; | ||
import { addLivePrizePoolItem } from '@/api/livePrizePoolItem'; | ||
import { getPrizePoolItemBtPoolId } from '@/api/prizePoolItem'; | ||
|
||
function AddPage(props: { | ||
visible; | ||
setVisible; | ||
livePrizePoolId; | ||
callback: () => void; | ||
}) { | ||
const formRef = useRef<FormInstance>(); | ||
|
||
const { lang } = useContext(GlobalContext); | ||
|
||
const t = useLocale(locale); | ||
|
||
const [loading, setLoading] = React.useState(false); | ||
|
||
const [itemSelect, setItemSelect] = React.useState([]); | ||
|
||
|
||
const handleSubmit = () => { | ||
formRef.current.validate().then((values) => { | ||
setLoading(true); | ||
addLivePrizePoolItem(props.livePrizePoolId, values.item_id) | ||
.then((res) => { | ||
const { success, message } = res.data; | ||
if (success) { | ||
Notification.success({ content: message, duration: 1000 }); | ||
props.setVisible(false); | ||
props.callback(); | ||
} | ||
}) | ||
.finally(() => { | ||
setLoading(false); | ||
}); | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
setLoading(true); | ||
getPrizePoolItemBtPoolId(props.livePrizePoolId).then((res) => { | ||
const { success, data } = res.data; | ||
if (success) { | ||
setItemSelect(data.map((item) => { | ||
return { | ||
label: item.prize_name, | ||
value: item.id, | ||
}; | ||
})); | ||
} | ||
}).finally(() => { | ||
setLoading(false); | ||
}); | ||
|
||
}, [props.visible]); | ||
|
||
return ( | ||
<Modal | ||
title={t['searchTable.operations.add']} | ||
style={{ width: '35%' }} | ||
visible={props.visible} | ||
onOk={() => { | ||
handleSubmit(); | ||
}} | ||
onCancel={() => { | ||
props.setVisible(false); | ||
}} | ||
autoFocus={false} | ||
focusLock={true} | ||
confirmLoading={loading} | ||
> | ||
<Form | ||
ref={formRef} | ||
style={{ width: '95%', marginTop: '6px' }} | ||
labelCol={{ span: lang === 'en-US' ? 7 : 6 }} | ||
wrapperCol={{ span: lang === 'en-US' ? 17 : 18 }} | ||
> | ||
<FormItem | ||
required | ||
label={t['searchTable.columns.item_id']} | ||
field={'item_id'} | ||
> | ||
<Select | ||
placeholder={t['searchForm.placeholder']} | ||
options={itemSelect} | ||
allowClear | ||
/> | ||
</FormItem> | ||
</Form> | ||
</Modal> | ||
); | ||
} | ||
|
||
export default AddPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.