shaogen1995 %!s(int64=2) %!d(string=hai) anos
pai
achega
0b2fd8e2ce
Modificáronse 2 ficheiros con 13 adicións e 7 borrados
  1. 7 1
      houtai/src/pages/A6Swpage/index.tsx
  2. 6 6
      houtai/src/utils/http.ts

+ 7 - 1
houtai/src/pages/A6Swpage/index.tsx

@@ -208,11 +208,17 @@ function A6Swpage() {
   // 点击新增/编辑出来的页面
   const [editId, setEditId] = useState(0);
 
+  // 点击新增
+  const addFu = useCallback(() => {
+    if (results.length >= 10) return MessageFu.warning("最多支持10条数据!");
+    setEditId(-1);
+  }, [results.length]);
+
   return (
     <div className={styles.A6Swpage}>
       <div className="pageTitle">
         轮播图管理
-        <div className="titleBtn" onClick={() => setEditId(-1)}>
+        <div className="titleBtn" onClick={addFu}>
           <Button type="primary">新增</Button>
         </div>
       </div>

+ 6 - 6
houtai/src/utils/http.ts

@@ -7,10 +7,10 @@ import { domShowFu } from "./domShow";
 // 请求基地址
 export const baseURL =
   // 线下的图片地址需要加上/api/
-  process.env.NODE_ENV === "development"
-    ? "http://192.168.20.55:8042/api/"
-    : "";
-  // process.env.NODE_ENV === "development" ? "https://bengbubwg.4dage.com" : "";
+  // process.env.NODE_ENV === "development"
+  //   ? "http://192.168.20.55:8042/api/"
+  //   : "";
+  process.env.NODE_ENV === "development" ? "https://bengbubwg.4dage.com" : "";
 
 // 处理  类型“AxiosResponse<any, any>”上不存在属性“code”
 declare module "axios" {
@@ -23,10 +23,10 @@ declare module "axios" {
 // 创建 axios 实例
 const http = axios.create({
   // --------线下的地址不用加/api/
-  baseURL: baseURL,
+  // baseURL: baseURL,
 
   // --------打包或线上环境接口需要加上api/
-  // baseURL: baseURL + "/api/",
+  baseURL: baseURL + "/api/",
   timeout: 5000,
 });