💥 feat(模块): 添加了个很棒的功能
This commit is contained in:
@ -27,6 +27,7 @@ export enum AdminAPI {
|
|||||||
MATERIAL_UPDATE = '/api/bo/resume/update',
|
MATERIAL_UPDATE = '/api/bo/resume/update',
|
||||||
// 七牛
|
// 七牛
|
||||||
UPLOAD_FILE = '/api/backend/file/upload',
|
UPLOAD_FILE = '/api/backend/file/upload',
|
||||||
|
UPLOAD_FILE_WX = '/api/cityOperator/wxCp/uploadImg',
|
||||||
// 运营人员
|
// 运营人员
|
||||||
STAFF_LIST = '/api/staff/getStaffPageList',
|
STAFF_LIST = '/api/staff/getStaffPageList',
|
||||||
STAFF_ALL = '/api/staff/getAllStaff',
|
STAFF_ALL = '/api/staff/getAllStaff',
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|||||||
|
|
||||||
import { CITY_OPTIONS } from '@/constants/city';
|
import { CITY_OPTIONS } from '@/constants/city';
|
||||||
import { TIME_FORMAT } from '@/constants/global';
|
import { TIME_FORMAT } from '@/constants/global';
|
||||||
import { uploadFile } from '@/services/file';
|
import { uploadFileWx } from '@/services/file';
|
||||||
import { deleteCityOperator, getAllStaffList, getCityOpratorList, updateCityOperator } from '@/services/list';
|
import { deleteCityOperator, getAllStaffList, getCityOpratorList, updateCityOperator } from '@/services/list';
|
||||||
|
|
||||||
const useStyles = createStyles(({ token }) => {
|
const useStyles = createStyles(({ token }) => {
|
||||||
@ -69,7 +69,7 @@ const TableList: React.FC = () => {
|
|||||||
actionRef.current?.reload();
|
actionRef.current?.reload();
|
||||||
};
|
};
|
||||||
const handleUpload = async (file: File) => {
|
const handleUpload = async (file: File) => {
|
||||||
const { url } = await uploadFile({ file, type: 'IMAGE' });
|
const url = await uploadFileWx({ file });
|
||||||
return url;
|
return url;
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -121,7 +121,7 @@ const TableList: React.FC = () => {
|
|||||||
copyable: true,
|
copyable: true,
|
||||||
search: false,
|
search: false,
|
||||||
render(_dom, { contactQrCode }) {
|
render(_dom, { contactQrCode }) {
|
||||||
return <img className={styles.img} src={contactQrCode} alt="" />;
|
return contactQrCode ? <img className={styles.img} src={contactQrCode} alt="" /> : '-';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -131,7 +131,7 @@ const TableList: React.FC = () => {
|
|||||||
copyable: true,
|
copyable: true,
|
||||||
search: false,
|
search: false,
|
||||||
render(_dom, { groupQrCode }) {
|
render(_dom, { groupQrCode }) {
|
||||||
return <img className={styles.img} src={groupQrCode} alt="" />;
|
return groupQrCode ? <img className={styles.img} src={groupQrCode} alt="" /> : '-';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -245,7 +245,7 @@ const TableList: React.FC = () => {
|
|||||||
<ProFormText name="groupLink" label="进群链接" rules={[{ message: '请输入链接', type: 'url' }]} />
|
<ProFormText name="groupLink" label="进群链接" rules={[{ message: '请输入链接', type: 'url' }]} />
|
||||||
<ProFormUploadButton
|
<ProFormUploadButton
|
||||||
name="qrCode"
|
name="qrCode"
|
||||||
label="上传"
|
label="进群二维码"
|
||||||
max={1}
|
max={1}
|
||||||
accept="image/*"
|
accept="image/*"
|
||||||
rules={[{ required: true, message: '必填项' }]}
|
rules={[{ required: true, message: '必填项' }]}
|
||||||
|
|||||||
@ -11,3 +11,13 @@ export async function uploadFile(options: { file: File; type: 'VIDEO' | 'IMAGE'
|
|||||||
data: options,
|
data: options,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function uploadFileWx(options: { file: File; id?: number }): Promise<string> {
|
||||||
|
return request<string>(AdminAPI.UPLOAD_FILE_WX, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
},
|
||||||
|
data: options,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user