feat:添加二维码操作类型
This commit is contained in:
parent
e1a40a8980
commit
5493acab8e
|
@ -244,7 +244,9 @@ const DiaryOption = (props: SelectDiary) => {
|
|||
label: '复制',
|
||||
key: '1',
|
||||
onClick: () => {
|
||||
copyToClipboard(clickTaskDiary!.description)
|
||||
copyToClipboard(clickTaskDiary!.description).then(res=>{
|
||||
res && message.info(`复制成功${clickTaskDiary!.description.length>5?clickTaskDiary!.description.substring(0,5)+"...":clickTaskDiary!.description}`)
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
import React, {Fragment, useEffect, useState} from 'react';
|
||||
import {Button, Image, Modal, QRCode} from 'antd';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
const ShareOption = (props:{taskId:string} ) => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [buttonIndex, setButtonIndex] = useState(0);
|
||||
const [qrCodeValue, setQrCodeValue] = useState<string>("-");
|
||||
const [qrCodeStatus, setQrCodeStatus]=useState<'active' | 'expired' | 'loading' | 'scanned'>("active");
|
||||
|
||||
const generateQrcode =()=>{
|
||||
|
||||
}
|
||||
const showModal = () => {
|
||||
setOpen(true);
|
||||
};
|
||||
|
||||
const handleOk = () => {
|
||||
setLoading(true);
|
||||
setTimeout(() => {
|
||||
setLoading(false);
|
||||
setOpen(false);
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
setOpen(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
// 分享人必须有权限
|
||||
const clientId: string = uuidv4();
|
||||
let qrCodeData={
|
||||
taskId:props.taskId,pass:clientId,local:"马上行计划管理",opType:"SHARE_OPTION"
|
||||
}
|
||||
setQrCodeValue(JSON.stringify(qrCodeData))
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<Button type="primary" onClick={showModal}>
|
||||
分享
|
||||
</Button>
|
||||
<Modal
|
||||
open={open}
|
||||
title="Title"
|
||||
onOk={handleOk}
|
||||
onCancel={handleCancel}
|
||||
footer={[
|
||||
<Button key="back" onClick={handleCancel}>
|
||||
返回
|
||||
</Button>,
|
||||
<Button key="submit" type="primary" loading={loading} onClick={handleOk}>
|
||||
使用二维码
|
||||
</Button>,
|
||||
<Button
|
||||
key="link"
|
||||
href="https://google.com"
|
||||
target="_blank"
|
||||
type="primary"
|
||||
loading={loading}
|
||||
onClick={handleOk}
|
||||
>
|
||||
使用连接
|
||||
</Button>,
|
||||
]}
|
||||
>
|
||||
{buttonIndex==1&& <div>
|
||||
<div>
|
||||
<div className="title">微信小程序二维码</div>
|
||||
<Image width={300} src="/static/pc-Web.png"/>
|
||||
<Button>下载</Button>
|
||||
</div>
|
||||
<div>
|
||||
<div className="title">小程序扫描二维码,有效期7天</div>
|
||||
<QRCode value={qrCodeValue} size={300} status={qrCodeStatus} onRefresh={generateQrcode}/>
|
||||
<Button>下载</Button>
|
||||
</div>
|
||||
</div>}
|
||||
|
||||
</Modal>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
export default ShareOption;
|
|
@ -40,7 +40,8 @@ export default function XcxLoginPage() {
|
|||
const clientId: string = uuidv4();
|
||||
generateQrcodeAPI({clientId}).then(res=>{
|
||||
let qrCodeData={
|
||||
clientId,serverId:res.data.data,local:"马上行计划管理"
|
||||
clientId,serverId:res.data.data,local:"马上行计划管理",
|
||||
opType:"LOGIN_OPTION"
|
||||
}
|
||||
setQrCodeValue(JSON.stringify(qrCodeData))
|
||||
setQrCodeStatus("active")
|
||||
|
|
|
@ -7,6 +7,7 @@ import Link from "next/link";
|
|||
import {DetailModelForm} from "@/ui/task/project/DetailModelForm";
|
||||
interface OperationButtonProps {
|
||||
itemId: string,
|
||||
taskType?:string,
|
||||
itemName: string,
|
||||
priority?:string,
|
||||
pid: string,
|
||||
|
@ -124,11 +125,13 @@ const RightOption: React.FC<OperationButtonProps> = (props) => {
|
|||
itemId={operateState.operationId === OPERATION_BUTTON_TYPE.UPDATE||operateState.operationId === OPERATION_BUTTON_TYPE.DETAIL?props.itemId:undefined}
|
||||
pPid={props.pPid}
|
||||
pid={operateState.operationId === OPERATION_BUTTON_TYPE.ADD_CHILD ?props.itemId:undefined}
|
||||
taskType={props.taskType}
|
||||
operationId={operateState.operationId}
|
||||
description={operateState.operationId === OPERATION_BUTTON_TYPE.DETAIL ? '任务详情' :
|
||||
operateState.operationId === OPERATION_BUTTON_TYPE.ADD_CHILD ? '添加支线任务' :
|
||||
operateState.operationId === OPERATION_BUTTON_TYPE.UPDATE ? '修改任务' : '未知操作'}
|
||||
open={operateState.openModal}
|
||||
closeOpen={() => setOperateState({...operateState, openModal: false})}
|
||||
reloadData={handleCancel}/>}
|
||||
</Fragment>
|
||||
);
|
||||
|
|
|
@ -83,6 +83,7 @@ export const DroppableTable = React.memo((props: DroppableTableProps) => {
|
|||
{(provided, snapshot) => (
|
||||
<RightOption refreshDate={props.refreshDate} itemId={record.id}
|
||||
itemName={record.name} pid={record.pid}
|
||||
taskType={record.taskType}
|
||||
pPid={record.pPid} children={<div
|
||||
ref={provided.innerRef}
|
||||
{...provided.draggableProps}
|
||||
|
|
|
@ -18,11 +18,13 @@ import {
|
|||
import {DataType} from "@/lib/definitions";
|
||||
import dayjs, {Dayjs} from "dayjs";
|
||||
import DiaryOption from "@/components/DiaryOption";
|
||||
import ShareOption from "@/components/ShareOption";
|
||||
|
||||
export type DetailModelFormProps = {
|
||||
// 当前内容id
|
||||
itemId?: string,
|
||||
pid?: string,
|
||||
taskType?:string,
|
||||
// 祖宗任务id
|
||||
pPid?: string,
|
||||
// 操作id
|
||||
|
@ -164,8 +166,9 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
|||
if (!editFormDisable) {
|
||||
result.push(...defaultDoms)
|
||||
} else {
|
||||
result.push(<Button type="primary" key="join"
|
||||
onClick={() => props.closeOpen?.()}>邀请小伙伴加入</Button>)
|
||||
if (props.taskType=='1') {
|
||||
result.push(<ShareOption taskId={props.itemId!}/>)
|
||||
}
|
||||
result.push(<Button type="primary" key="close"
|
||||
onClick={() => props.closeOpen?.()}>关闭</Button>)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue