shaogen1995 2 vuotta sitten
vanhempi
commit
b49432b2e4

+ 35 - 16
houtai/src/pages/A1Hot/index.tsx

@@ -11,6 +11,11 @@ import {
 import { PieChart } from "echarts/charts";
 import { LabelLayout } from "echarts/features";
 import { CanvasRenderer } from "echarts/renderers";
+import {
+  getHotExhibition,
+  getHotGoods,
+  getHotModule,
+} from "@/store/action/A1Hot";
 
 echarts.use([
   ToolboxComponent,
@@ -103,26 +108,32 @@ function Hot() {
   );
 
   // 时间改变的时候 获取3个数据
-  const getInfoAPIFu1 = useCallback(() => {
-    console.log("1获取饼图数据", select1Ref.current);
-
-    const data1 = [
-      { value: 124, name: "新闻资讯", icon: "circle" },
-      { value: 100, name: "虚拟漫游", icon: "circle" },
-      { value: 200, name: "馆藏鉴赏", icon: "circle" },
-      { value: 80, name: "场馆导览", icon: "circle" },
-      { value: 70, name: "周边查询", icon: "circle" },
-      { value: 155, name: "游客服务", icon: "circle" },
-    ];
+  const getInfoAPIFu1 = useCallback(async () => {
+    const res1 = await getHotModule(select1Ref.current);
+    const data1 = res1.data.map((v: any) => {
+      return {
+        value: v.pcs,
+        name: v.groupKey,
+        icon: "circle",
+      };
+    });
+    // console.log("1获取饼图数据", select1Ref.current);
     getEchartsFu(data1);
 
     // -------------
-    console.log(
-      "2获取场馆数据",
+    // console.log(
+    //   "2获取场馆数据",
+    //   select1Ref.current,
+    //   select2Ref.current ? select2Ref.current : "visit"
+    // );
+
+    const res2 = await getHotExhibition(
       select1Ref.current,
       select2Ref.current ? select2Ref.current : "visit"
     );
 
+    console.log(res2);
+
     const data2 = [
       { id: 1, name: "撒大苏打撒旦", num: 550 },
       {
@@ -141,11 +152,19 @@ function Hot() {
 
     // ---------------
 
-    console.log(
-      "3获取馆藏数据",
+    // console.log(
+    //   "3获取馆藏数据",
+    //   select1Ref.current,
+    //   select3Ref.current ? select3Ref.current : "visit"
+    // );
+
+    const res3 = await getHotGoods(
       select1Ref.current,
-      select3Ref.current ? select3Ref.current : "visit"
+      select2Ref.current ? select2Ref.current : "visit"
     );
+
+    console.log(res3);
+
     const data3 = [
       { id: 1, name: "撒大苏打撒旦", num: 550 },
       {

+ 20 - 7
houtai/src/pages/A2News/NewsAdd/index.tsx

@@ -54,7 +54,7 @@ function NewsAdd({
       FormBoxRef.current.setFieldsValue({
         display: 1,
         // 默认新闻日期为当天
-        myTime:
+        newsDay:
           tableType === "news"
             ? dayjs(dayjs(new Date()).format("YYYY-MM-DD"), "YYYY-MM-DD")
             : "",
@@ -110,7 +110,14 @@ function NewsAdd({
         // 创建FormData对象
         const fd = new FormData();
         // 把files添加进FormData对象(‘photo’为后端需要的字段)
-        fd.append("type", tableType === "video" ? "video" : "img");
+        fd.append(
+          "type",
+          tableType === "video"
+            ? "video"
+            : tableType === "img"
+            ? "thumb"
+            : "img"
+        );
         fd.append("dirCode", dirCode);
         fd.append("file", filesInfo);
 
@@ -178,11 +185,17 @@ function NewsAdd({
 
       if (fileCheckFu) return;
 
+      let thumb = "";
+      if (tableType === "news") thumb = imgList[0].filePath;
+      else if (tableType === "img") thumb = fileOne.filePath;
       const obj = {
         ...values,
         id: id > 0 ? id : null,
         dirCode,
-        myTime: values.myTime ? dayjs(values.myTime).format("YYYY-MM-DD") : "",
+        newsDay: values.newsDay
+          ? dayjs(values.newsDay).format("YYYY-MM-DD")
+          : "",
+        thumb,
         fileIds:
           tableType === "news"
             ? imgList.map((v) => v.id).join(",")
@@ -199,7 +212,7 @@ function NewsAdd({
       dirCode,
       editTableFu,
       fileCheckFu,
-      fileOne.id,
+      fileOne,
       id,
       imgList,
       tableType,
@@ -239,14 +252,14 @@ function NewsAdd({
             <>
               <Form.Item
                 label="新闻日期"
-                name="myTime"
+                name="newsDay"
                 rules={[{ required: true, message: "请选择新闻日期!" }]}
               >
                 <DatePicker />
               </Form.Item>
               <Form.Item
                 label="正文"
-                name="myTxt"
+                name="description"
                 rules={[
                   { required: true, message: "请输入正文!" },
                   {
@@ -325,7 +338,7 @@ function NewsAdd({
                     <div className="fileTit">
                       {imgList.length >= 2 ? (
                         <>
-                          按住鼠标可拖动图片调整顺序。
+                          按住鼠标可拖动图片调整顺序,第一张为展示端封面
                           <br />
                         </>
                       ) : null}

+ 32 - 0
houtai/src/store/action/A1Hot.ts

@@ -0,0 +1,32 @@
+import http from "@/utils/http";
+
+/**
+ * 统计热门板块
+ */
+export const getHotModule = (dayScope: 1 | 7 | 30 | "") => {
+  return http.get(`cms/report/ranking/module?dayScope=${dayScope}`);
+};
+
+/**
+ * 统计-热门场馆
+ */
+export const getHotExhibition = (
+  dayScope: 1 | 7 | 30 | "",
+  type: "visit" | "star" | ""
+) => {
+  return http.get(
+    `cms/report/ranking/exhibition?dayScope=${dayScope}&type=${type}`
+  );
+};
+
+/**
+ * 统计-热门场馆
+ */
+export const getHotGoods = (
+  dayScope: 1 | 7 | 30 | "",
+  type: "visit" | "star" | ""
+) => {
+  return http.get(
+    `cms/report/ranking/goods?dayScope=${dayScope}&type=${type}`
+  );
+};

+ 2 - 2
houtai/src/store/action/A2News.ts

@@ -10,7 +10,7 @@ const CancelToken = axios.CancelToken;
 export const newsUploadAPI = (data: any) => {
   domShowFu("#UpAsyncLoding", true);
 
-  return http.post("cms/goods/upload", data, {
+  return http.post("cms/news/upload", data, {
     timeout: 50000,
     // 显示进度条
     onUploadProgress: (e: any) => {
@@ -25,4 +25,4 @@ export const newsUploadAPI = (data: any) => {
       });
     }),
   });
-};
+};

+ 5 - 0
houtai/src/types/api/A1Hot.d.ts

@@ -0,0 +1,5 @@
+export type HotInfoType ={
+	name: string;
+	value: number;
+  icon:'circle'
+}

+ 2 - 0
houtai/src/types/index.d.ts

@@ -1,4 +1,6 @@
 export * from './api/layot'
+export * from './api/A1Hot'
+
 export * from './api/A2News'
 export * from './api/A3Goods'
 export * from './api/A4Venue'

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

@@ -8,7 +8,7 @@ import { domShowFu, progressDomFu } from "./domShow";
 export const baseURL =
   // 线下的图片地址需要加上/api/
   process.env.NODE_ENV === "development"
-    ? "http://192.168.20.55:8041/api/"
+    ? "http://192.168.20.55:8042/api/"
     : "";
 // process.env.NODE_ENV === "development" ? "https://xuzhouwall.4dage.com" : "";