Skip to content

Let's use AI to Earn!

单个

daoyian692fbdd3fb8e
diff --git a/src/api/material.ts b/src/api/material.ts
index af1c9299..564cc751 100644
--- a/src/api/material.ts
+++ b/src/api/material.ts
@@ -67,6 +67,7 @@ export const apiCreateMaterial = (data: {
title: string;
desc?: string;
option?: Record<string, any>;
+ location?: number[];
}) => {
return http.post("material", data);
};
diff --git a/src/app/[lng]/cgmaterial/cgmaterialPageCore.tsx b/src/app/[lng]/cgmaterial/cgmaterialPageCore.tsx
index 4cedd663..3cda1c15 100644
--- a/src/app/[lng]/cgmaterial/cgmaterialPageCore.tsx
+++ b/src/app/[lng]/cgmaterial/cgmaterialPageCore.tsx
@@ -41,6 +41,8 @@ export default function CgMaterialPageCore() {
const [mediaList, setMediaList] = useState<any[]>([]);
const [selectedCover, setSelectedCover] = useState<string | null>(null);
const [selectedMaterials, setSelectedMaterials] = useState<string[]>([]);
+ // 单个素材位置
+ const [singleLocation, setSingleLocation] = useState<[number, number]>([0, 0]);
// 创建/批量表单
const [form] = Form.useForm();
@@ -142,6 +144,22 @@ export default function CgMaterialPageCore() {
setSelectedMaterials([]);
const res = await getMediaGroupList(1, 50);
setMediaGroups(((res?.data as any)?.list as any[]) || []);
+ // 获取地理位置
+ if (navigator.geolocation) {
+ navigator.geolocation.getCurrentPosition(
+ (pos) => {
+ setSingleLocation([pos.coords.longitude, pos.coords.latitude]);
+ form.setFieldsValue({ location: [pos.coords.longitude, pos.coords.latitude] });
+ },
+ () => {
+ setSingleLocation([0, 0]);
+ form.setFieldsValue({ location: [0, 0] });
+ }
+ );
+ } else {
+ setSingleLocation([0, 0]);
+ form.setFieldsValue({ location: [0, 0] });
+ }
}
// 选择媒体组后,加载资源
@@ -177,6 +195,7 @@ export default function CgMaterialPageCore() {
title: values.title,
desc: values.desc,
option: {},
+ location: singleLocation,
});
message.success('创建素材成功');
setCreateModal(false);
@@ -377,6 +396,12 @@ export default function CgMaterialPageCore() {
{...handleGroupItemEvents(item)}
>
<div className={styles.groupName}>{item.name || item.title}</div>
+ <div className={styles.descTypeInfo}>
+ {item.desc && <span>{item.desc}</span>}
+ <span>
+ {item.type === MaterialType.ARTICLE ? '图文' : item.type === MaterialType.VIDEO ? '视频' : item.type}
+ </span>
+ </div>
<div className={styles.groupActions}>
<span
className={styles.groupActionBtn}
@@ -444,7 +469,7 @@ export default function CgMaterialPageCore() {
<img
src={getOssUrl(item.coverUrl)}
alt="cover"
- style={{ width: "100%", height: 120, objectFit: "cover", borderRadius: 6 }}
+ style={{ width: "100%", objectFit: "cover", borderRadius: 6 }}
/>
) : null
}
@@ -572,6 +597,15 @@ export default function CgMaterialPageCore() {
<Form.Item label="简介" name="desc">
<TextArea rows={3} />
</Form.Item>
+ <Form.Item label="地理位置" name="location">
+ <Input
+ value={singleLocation.join(',')}
+ onChange={e => {
+ const val = e.target.value.split(',').map((v: string) => Number(v.trim()));
+ setSingleLocation([val[0] || 0, val[1] || 0]);
+ }}
+ />
+ </Form.Item>
</Form>
</Modal>
{/* 批量生成草稿弹窗 */}
diff --git a/src/app/[lng]/cgmaterial/styles/cgmaterial.module.scss b/src/app/[lng]/cgmaterial/styles/cgmaterial.module.scss
index c46c059c..80ce232e 100644
--- a/src/app/[lng]/cgmaterial/styles/cgmaterial.module.scss
+++ b/src/app/[lng]/cgmaterial/styles/cgmaterial.module.scss
@@ -45,8 +45,9 @@
border: 1px solid #f0f0f0;
padding: 12px 16px !important;
display: flex;
- align-items: center;
- min-height: 48px;
+ flex-direction: column;
+ align-items: flex-start;
+ min-height: 56px;
position: relative;
}
@@ -69,6 +70,29 @@
flex: 1;
}
+.descTypeInfo {
+ font-size: 12px;
+ color: #888;
+ margin-top: 2px;
+ line-height: 1.4;
+ word-break: break-all;
+ display: flex;
+ gap: 12px;
+}
+
+.typeTag {
+ display: inline-block;
+ padding: 0 8px;
+ height: 20px;
+ line-height: 20px;
+ border-radius: 10px;
+ border: 1px solid #a66ae4;
+ color: #a66ae4;
+ background: #f6edfd;
+ font-size: 12px;
+ font-weight: 500;
+}
+
.groupActions {
display: flex;
gap: 8px;
@@ -79,24 +103,28 @@
opacity: 0;
transition: opacity 0.2s;
z-index: 2;
+ pointer-events: none;
}
-.groupItem:hover .groupActions,
.groupItem.showActions .groupActions {
opacity: 1;
+ pointer-events: auto;
}
.groupActionBtn {
- background: #fff;
- border: 1px solid #d9d9d9;
- border-radius: 4px;
- padding: 2px 8px;
+ background: #f6edfd;
+ border: 1px solid #a66ae4;
+ border-radius: 5px;
+ padding: 2px 12px;
font-size: 13px;
- color: #1677ff;
+ color: #a66ae4;
cursor: pointer;
- transition: background 0.2s, color 0.2s;
+ transition: background 0.2s, color 0.2s, box-shadow 0.2s;
+ box-shadow: 0 1px 4px rgba(166,106,228,0.10);
+ font-weight: 500;
}
.groupActionBtn:hover {
- background: #1677ff;
+ background: #a66ae4;
color: #fff;
+ box-shadow: 0 2px 8px rgba(166,106,228,0.18);
}
\ No newline at end of file