Commit 2f4d379e authored by Maofei94's avatar Maofei94

fix: 修复移动配置

parent baa85b98
......@@ -74,7 +74,7 @@ const SiteConfig = props => {
.then(res => {
setLoading(false);
if (res.success) {
submitCallback();
submitCallback(obj.title);
notification.success({
message: '提示',
duration: 3,
......@@ -87,7 +87,6 @@ const SiteConfig = props => {
description: res.message || '编辑失败',
});
}
console.log(res, 'res');
})
.catch(err => {
setLoading(false);
......
......@@ -55,10 +55,18 @@ const MobileConfigPage = props => {
return item;
});
setParentKey(arr[0].id);
setSingleList(arr);
setMiniTitle(arr[0].text);
setClientName(arr[0].subSystemValue);
if (miniTitle) {
let obj = arr.find(item => item.text === miniTitle);
setParentKey(obj.id);
setMiniTitle(obj.text);
setClientName(obj.subSystemValue);
} else {
setParentKey(arr[0].id);
setMiniTitle(arr[0].text);
setClientName(arr[0].subSystemValue);
}
console.log(arr);
} else {
setShowConfig(false);
......@@ -106,14 +114,17 @@ const MobileConfigPage = props => {
setClientName(obj.subSystemValue);
setMiniTitle(obj.text);
};
const submitCallback = () => {
const submitCallback = val => {
setFlag(flag + 1);
setMiniTitle(val);
setSubType('');
};
const addCallback = val => {
console.log(val);
setSubType('');
setAddVisible(false);
setMiniTitle(val);
setFlag(flag + 1);
// setMiniTitle(val);
};
......@@ -130,6 +141,7 @@ const MobileConfigPage = props => {
.then(res => {
setLoading(false);
if (res.success) {
setMiniTitle('');
setFlag(flag + 1);
deleteMiniMenu({ visible: val });
notification.success({
......@@ -221,7 +233,7 @@ const MobileConfigPage = props => {
{
title: '版本包配置',
key: '3',
component: <VersionPublish />,
component: <VersionPublish clientName={clientName} />,
},
];
return (
......
......@@ -4,6 +4,7 @@ import { Switch, Button, Message, Spin, Modal } from 'antd';
import BaseForm from '@/components/BaseForm/index';
import { getApkNameAndDate, SaveMobileApk } from '@/services/appConfig/api';
import { getMobileFiles } from '@/services/mobileConfig/api';
import styles from './otherConfig.less';
......@@ -11,7 +12,9 @@ import styles from './otherConfig.less';
// location.origin
// }/cityinterface/rest/services/filedownload.svc/download/BufFile/Mobile/APK/`;
export default () => {
export default props => {
console.log(props);
const { clientName } = props;
const items = [
{
label: '更新描述',
......@@ -50,12 +53,13 @@ export default () => {
const formEntity = useRef(null);
const fileEntity = useRef(null);
const [loading, setLoading] = useState(true); // 显示请求的loading
const [loading, setLoading] = useState(false); // 显示请求的loading
const [showModal, setShowModal] = useState(false); // 显示更新的modal
const [fileData, setFileData] = useState({}); // 获取到的包名和更新时间
const [file, setFile] = useState({}); // 上传的文件
const [fileSuccess, setFileSuccess] = useState(false); // 本地文件是否成功
const [progress, setProgress] = useState(false); // 是否正在保存
const [upFlag, setUpFlag] = useState(1);
// const uploadProps = {
// name: 'file',
......@@ -79,17 +83,18 @@ export default () => {
formData.set('description', describe);
formData.set('isRefresh', !!forceUpdate);
formData.set('file', file);
formData.set('client', 'miniapp');
formData.set('client', clientName);
setProgress(true);
SaveMobileApk(formData).then(res => {
console.log(res);
setProgress(false);
if (Number(res.code) === 200) {
if (Number(res.code) === 0) {
Message.success('更新成功');
setUpFlag(upFlag + 1);
setShowModal(false);
init();
} else {
Message.error(res.msg);
// Message.error(res.msg);
}
});
})
......@@ -114,32 +119,46 @@ export default () => {
};
const init = () => {
getApkNameAndDate({})
.then(res => {
const message = res.ResultMessage || '';
const [fileName = '', updateTime] = message.split(',');
setFileData({
fileName,
updateTime,
});
setLoading(false);
// const index = fileName.lastIndexOf('.');
// axios
// .get(`${JSON_BASE}${fileName.slice(0, index)}.json`, {})
// .then(res => {
// console.log(res);
// });
})
.catch(err => {
Message.error(err);
setLoading(false);
});
// getApkNameAndDate({})
// .then(res => {
// const message = res.ResultMessage || '';
// const [fileName = '', updateTime] = message.split(',');
// setFileData({
// fileName,
// updateTime,
// });
// setLoading(false);
// // const index = fileName.lastIndexOf('.');
// // axios
// // .get(`${JSON_BASE}${fileName.slice(0, index)}.json`, {})
// // .then(res => {
// // console.log(res);
// // });
// })
// .catch(err => {
// Message.error(err);
// setLoading(false);
// });
};
useEffect(() => {
init();
}, []);
useEffect(() => {
console.log(window.location.origin);
getMobileFiles({ client: clientName }).then(res => {
if (res.code === 0) {
const { data } = res;
let fileName =
data.apkPath.split('/')[data.apkPath.split('/').length - 1] || '';
setFileData({
...data,
fileName,
isRefresh: true,
});
}
});
}, [upFlag]);
return (
<div className={loading ? styles.loadingContainer : styles.VersionPublish}>
{loading ? (
......@@ -168,14 +187,12 @@ export default () => {
</div>
<div className={styles.row}>
<div className={styles.label}>更新描述:</div>
<div className="value">
更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:更新描述:
</div>
<div className="value">{fileData.description}</div>
</div>
<div className={styles.row}>
<div className={styles.label}>强制更新:</div>
<div className="value">
<Switch checked disabled />
<Switch checked={fileData.isRefresh} disabled />
</div>
</div>
<Button
......@@ -198,7 +215,7 @@ export default () => {
>
<BaseForm items={items} getForm={handleGetForm} />
<div className={styles.row}>
<div className={`${styles.label} ${styles.required}`}>
<div className={`${styles.label2} ${styles.required}`}>
apk文件:
</div>
<input
......
......@@ -27,4 +27,7 @@
.label {
width: 100px;
flex-shrink: 0;
}
.label2 {
flex-shrink: 0;
}
\ No newline at end of file
......@@ -115,4 +115,4 @@ export const getApkNameAndDate = params =>
);
// 上传apk版本信息以及apk包的接口
export const SaveMobileApk = params =>
post(`${PUBLISH_SERVICE}/FileCenter/SaveMobileApk`, params);
post(`/Publish/OMS/FileCenter/SaveMobileApk`, params);
......@@ -108,3 +108,7 @@ export const dragMenu = params =>
export const deleteMiniMenu = params =>
get(`${PUBLISH_SERVICE}/PlatformCenter/DeleteMiniMenu`, params);
// 获取移动应用上传APK信息
export const getMobileFiles = params =>
get(`${PUBLISH_SERVICE}/FileCenter/GetMobileFiles`, params);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment