Commit 2f4d379e authored by Maofei94's avatar Maofei94

fix: 修复移动配置

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