diff --git a/src/pages/app/app-config.tsx b/src/pages/app/app-config.tsx
index 961aa29..ae8c50d 100644
--- a/src/pages/app/app-config.tsx
+++ b/src/pages/app/app-config.tsx
@@ -4,7 +4,14 @@ import { Store } from "antd/lib/form/interface";
import PayConfig from "./config/pay-config";
import PushConfig from "./config/push-config";
import ImConfig from "./config/im-config";
+import { useEffect } from "react";
+import { useParams } from "react-router";
const AppManageConfig = (props: Store) => {
+ const { appStore } = props
+ const { id } = useParams();
+ useEffect(()=>{
+ appStore.getApp(id)
+ },[appStore,id])
const items: TabsProps["items"] = [
{
key: "1",
@@ -22,11 +29,13 @@ const AppManageConfig = (props: Store) => {
children: ,
},
];
-
+ const onChange = ()=>{
+ appStore.getApp(id)
+ }
return (
-
+
);
diff --git a/src/pages/app/config/pay-config.tsx b/src/pages/app/config/pay-config.tsx
index e97e055..a3924b4 100644
--- a/src/pages/app/config/pay-config.tsx
+++ b/src/pages/app/config/pay-config.tsx
@@ -10,8 +10,10 @@ const PayConfig = (props: Store) => {
const { id } = useParams();
const wxformRef = React.useRef(null);
const aliformRef = React.useRef(null);
-
- useEffect(() => {}, []);
+ useEffect(() => {
+ wxformRef.current?.setFieldsValue(appStore.item?.wechat)
+ aliformRef.current?.setFieldsValue(appStore.item?.ali)
+ }, [appStore.item,id]);
const onFinishFailed = () => {};
const onwxFinish = (values: any) => {
appStore.setWechatConfig(id,values)
diff --git a/src/pages/app/config/push-config.tsx b/src/pages/app/config/push-config.tsx
index 9bc235e..abbf570 100644
--- a/src/pages/app/config/push-config.tsx
+++ b/src/pages/app/config/push-config.tsx
@@ -15,8 +15,12 @@ const PushConfig = (props: Store) => {
const xmformRef = React.useRef(null);
useEffect(() => {
- appStore.getIosConfig(id);
- }, [appStore, id]);
+ hwformRef.current?.setFieldsValue(appStore.item.pushHwawei);
+ iosformRef.current?.setFieldsValue(appStore.item.pushIos);
+ opformRef.current?.setFieldsValue(appStore.item.pushOppo);
+ vivoformRef.current?.setFieldsValue(appStore.item.pushVivo);
+ xmformRef.current?.setFieldsValue(appStore.item.pushXiaomi);
+ }, [appStore.item, id]);
const onFinishFailed = () => {};
@@ -75,7 +79,7 @@ const PushConfig = (props: Store) => {
type: "upload",
label: "推送证书",
name: "centerFile",
- value: "",
+ value: [],
rules: [{ required: true, message: "请上传推送证书!" }],
},
]}
diff --git a/src/service/base.ts b/src/service/base.ts
index c5f893e..f0e942c 100644
--- a/src/service/base.ts
+++ b/src/service/base.ts
@@ -4,7 +4,7 @@ import axios, { AxiosResponse } from "axios";
axios.defaults.headers.common["CommonType"] = "shouka";
axios.defaults.headers.common["Content-Type"] = "application/json; charset=utf8";
axios.interceptors.request.use((config) => {
- config.baseURL = "http://127.0.0.1:8899/v1/api/";
+ config.baseURL = "http://quwanya.cn:8899/v1/api/";
config.timeout = 5000;
let token = window.localStorage.getItem("token")
config.headers.Authorization = 'Bearer ' + token
@@ -56,7 +56,6 @@ class BaseHttp {
data: params
});
return res.data;
-
};
async put(url: string, params: any) {
let res = await axios({
@@ -65,7 +64,6 @@ class BaseHttp {
data: params
});
return res.data;
-
};
async delete(url: string, params: any) {
let res = await axios({
diff --git a/src/store/appStore/index.ts b/src/store/appStore/index.ts
index 4299203..15df212 100644
--- a/src/store/appStore/index.ts
+++ b/src/store/appStore/index.ts
@@ -8,69 +8,46 @@ class AppStore extends BaseStore {
constructor() {
super(AppConfig)
makeObservable(this, {
- getIosConfig: action,
+ getApp: action
})
}
// 设置Ios 配置
async setIosConfig(id: number, param) {
return await baseHttp.put(AppConfig.IOSAPPPUSH + id, param)
}
- // 获取Ios 配置
- async getIosConfig(id: number) {
- return await baseHttp.get(AppConfig.IOSAPPPUSH + "/" + id, {})
- }
+
// 设置hw 配置
async setHwConfig(id: number, param) {
return await baseHttp.put(AppConfig.HUAWEIAPPPUSH + id, param)
}
- // 获取HW 配置
- async getHwConfig(id: number) {
- return await baseHttp.get(AppConfig.HUAWEIAPPPUSH + "/" + id, {})
- }
// 设置op 配置
async setOPConfig(id: number, param) {
return await baseHttp.put(AppConfig.OPPOAPPPUSH + id, param)
}
- // 获取op 配置
- async getOpConfig(id: number) {
- return await baseHttp.get(AppConfig.OPPOAPPPUSH + "/" + id, {})
- }
// 设置op 配置
async setVivoConfig(id: number, param) {
return await baseHttp.put(AppConfig.VIVOAPPPUSH + id, param)
}
- // 获取op 配置
- async getVivoConfig(id: number) {
- return await baseHttp.get(AppConfig.VIVOAPPPUSH + "/" + id, {})
- }
// 设置wx 配置
async setWechatConfig(id: number, param) {
return await baseHttp.put(AppConfig.WechatConfig + id, param)
}
- // 获取wx 配置
- async getWechatConfig(id: number) {
- return await baseHttp.get(AppConfig.WechatConfig + "/" + id, {})
- }
-
// 设置wx 配置
async setXmConfig(id: number, param) {
return await baseHttp.put(AppConfig.XIAOMIAPPPUSH + id, param)
}
- // 获取wx 配置
- async getXmConfig(id: number) {
- return await baseHttp.get(AppConfig.XIAOMIAPPPUSH + "/" + id, {})
- }
// 设置wx 配置
async setAlConfig(id: number, param) {
return await baseHttp.put(AppConfig.ALCONFIG + id, param)
}
- // 获取wx 配置
- async getAlConfig(id: number) {
- return await baseHttp.get(AppConfig.ALCONFIG + "/" + id, {})
+
+ async getApp(id: number) {
+ let data = await baseHttp.get(AppConfig.ADD + "/" + id, {})
+ this.item = data.data
}
}
export default new AppStore();
\ No newline at end of file
diff --git a/src/store/baseStore.ts b/src/store/baseStore.ts
index 062d725..da53745 100644
--- a/src/store/baseStore.ts
+++ b/src/store/baseStore.ts
@@ -72,6 +72,7 @@ class BaseStore implements BaseStoreInterface {
runInAction(() => {
this.list = data;
})
+ this.listStatus = false;
return;
}
for (let i = 0; i < res.data.list.length; i++) {
@@ -80,6 +81,7 @@ class BaseStore implements BaseStoreInterface {
...res.data.list[i]
})
}
+
runInAction(() => {
this.list = data;
this.total = res.data.total | res.data.totals