- 设计并实现了开发者中心与企业控制台两大模块 - 按用户角色区分开发者和企业客户,支持多项目类型及成员管理 - 新增项目管理、应用管理、API Key管理及成员邀请等多功能页面 - 实现应用版本发布、消息通知中心、权限审批与开发者申请流程 - 完成CI/CD流水线、运营监控、发票管理、SSO单点登录功能 - 搭建SDK下载中心、工单系统、FAQ系统、数据导入导出等模块 - 优化后端API,支持已登录和未注册用户不同加入应用流程 - 前端按钮统一采用微信手机号授权,完善用户授权体验 - 修复多个页面的JSX语法错误及依赖导入问题,替换部分组件库 - 增加详细的类型定义文件,提升项目类型安全 - 新增超过55个页面及60个API接口,扩展应用功能和服务体系 - 完成全面的样式设计,实现一致的视觉风格和交互体验
108 lines
2.7 KiB
TypeScript
108 lines
2.7 KiB
TypeScript
import {useEffect, useState, useRef} from "react";
|
|
import {useRouter} from '@tarojs/taro'
|
|
import {Button, Loading, CellGroup, Input, TextArea, Form} from '@nutui/nutui-react-taro'
|
|
import Taro from '@tarojs/taro'
|
|
import {AppVersion} from "@/api/app/appVersion/model";
|
|
import {getAppVersion, updateAppVersion} from "@/api/app/appVersion";
|
|
|
|
const AddAppVersion = () => {
|
|
const {params} = useRouter();
|
|
const [loading, setLoading] = useState<boolean>(true)
|
|
const [FormData, setFormData] = useState<AppVersion>({})
|
|
const formRef = useRef<any>(null)
|
|
|
|
const reload = async () => {
|
|
if (params.id) {
|
|
const data = await getAppVersion(Number(params.id))
|
|
setFormData(data)
|
|
} else {
|
|
setFormData({})
|
|
}
|
|
}
|
|
|
|
const submitSucceed = async (values: any) => {
|
|
try {
|
|
if (params.id) {
|
|
await updateAppVersion({
|
|
...values,
|
|
id: Number(params.id)
|
|
})
|
|
}
|
|
|
|
Taro.showToast({
|
|
title: `操作成功`,
|
|
icon: 'success'
|
|
})
|
|
|
|
setTimeout(() => {
|
|
return Taro.navigateBack()
|
|
}, 1000)
|
|
} catch (error) {
|
|
Taro.showToast({
|
|
title: `操作失败`,
|
|
icon: 'error'
|
|
});
|
|
}
|
|
}
|
|
|
|
const submitFailed = (error: any) => {
|
|
console.log(error, 'err...')
|
|
}
|
|
|
|
useEffect(() => {
|
|
reload().then(() => {
|
|
setLoading(false)
|
|
})
|
|
}, []);
|
|
|
|
if (loading) {
|
|
return <Loading className={'px-2'}>加载中</Loading>
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Form
|
|
ref={formRef}
|
|
divider
|
|
initialValues={FormData}
|
|
labelPosition="left"
|
|
onFinish={(values) => submitSucceed(values)}
|
|
onFinishFailed={(errors) => submitFailed(errors)}
|
|
footer={
|
|
<div
|
|
style={{
|
|
display: 'flex',
|
|
justifyContent: 'center',
|
|
width: '100%'
|
|
}}
|
|
>
|
|
<Button
|
|
nativeType="submit"
|
|
type="success"
|
|
size="large"
|
|
className={'w-full'}
|
|
block
|
|
>
|
|
更新
|
|
</Button>
|
|
</div>
|
|
}
|
|
>
|
|
<CellGroup style={{padding: '4px 0'}}>
|
|
<Form.Item name="versionName" label="版本名称" initialValue={FormData.versionName} required>
|
|
<Input placeholder="请输入版本名称" />
|
|
</Form.Item>
|
|
<Form.Item name="versionCode" label="版本号" initialValue={FormData.versionCode}>
|
|
<Input placeholder="请输入版本号" />
|
|
</Form.Item>
|
|
<Form.Item name="description" label="版本说明" initialValue={FormData.description}>
|
|
<TextArea placeholder="请输入版本说明" />
|
|
</Form.Item>
|
|
</CellGroup>
|
|
</Form>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default AddAppVersion;
|