浏览代码

fix: 修改优化应用市场

liaojiaxing 2 月之前
父节点
当前提交
6f73e9ad2b

+ 14 - 2
src/api/appStore.ts

@@ -2,7 +2,7 @@ import { request } from "umi";
 import type { commonParams } from "@/api/index";
 
 /**
- * 获取应用市场列表
+ * 获取应用管理列表
  * @param commonParams
  * @returns
  */
@@ -13,13 +13,25 @@ export const GetAppList = (data: commonParams) => {
   });
 };
 
+/**
+ * 获取应用市场列表
+ * @param commonParams
+ * @returns
+ */
+export const GetAppPublicList = (data: commonParams) => {
+  return request("/api/appStore/public/applicationTemplate/list", {
+    method: "POST",
+    data,
+  });
+};
+
 /**
  * 获取应用详情
  * @param commonParams
  * @returns
  */
 export const GetAppDetail = (data: { id: string }) => {
-  return request("/api/appStore/applicationTemplate/detail", {
+  return request("/api/appStore/public/applicationTemplate/detail", {
     method: "POST",
     data,
   });

+ 1 - 1
src/api/apply.ts

@@ -31,7 +31,7 @@ export const GetApplyDetail = (data: {id: string}) => {
  * @returns
  */
 export const SubmitApply = (data: ApplyItem) => {
-  return request("/api/appStore/consultationForm/add", {
+  return request("/api/appStore/public/consultationForm/add", {
     method: "POST",
     data,
   });

+ 14 - 2
src/api/templateStore.ts

@@ -2,7 +2,7 @@ import { request } from "umi";
 import type { commonParams } from "@/api/index";
 
 /**
- * 获取模版市场列表
+ * 获取模版管理列表
  * @param commonParams
  * @returns
  */
@@ -13,13 +13,25 @@ export const GetTemplateList = (data: commonParams) => {
   });
 };
 
+/**
+ * 获取模版市场列表
+ * @param commonParams
+ * @returns
+ */
+export const GetTemplatePublicList = (data: commonParams) => {
+  return request("/api/templateStore/public/moduleTemplate/list", {
+    method: "POST",
+    data,
+  });
+};
+
 /**
  * 获取模版详情
  * @param id
  * @returns
  */
 export const GetTemplateDetail = (data: { id: string}) => {
-  return request("/api/templateStore/moduleTemplate/detail", {
+  return request("/api/templateStore/public/moduleTemplate/detail", {
     method: "POST",
     data,
   });

+ 1 - 1
src/components/ItemCard.tsx

@@ -26,7 +26,7 @@ export default function AppItem({
             </div>
           </div>
           <div className="flex items-center text-[10px] leading-[18px] text-text-tertiary font-medium">
-            <div className="truncate">作者 {data?.createByName}</div>
+            <div className="truncate">作者 {data?.createByName || '易码工坊'}</div>
           </div>
         </div>
       </div>

+ 2 - 2
src/pages/application/index.tsx

@@ -1,7 +1,7 @@
 import { useEffect, useState } from "react";
 import ItemCard from "@/components/ItemCard";
 import { Input, Empty, Spin } from "antd";
-import { GetAppList } from "@/api/appStore";
+import { GetAppPublicList } from "@/api/appStore";
 import { useRequest, history } from "umi";
 import { INDUSTRIE_OPTIONS, APPLICATION_SCENARIOS_OPTIONS } from "@/constants";
 import noDataImg from "@/assets/no-data.svg";
@@ -25,7 +25,7 @@ export default function Home() {
   const [search, setSearch] = useState("");
   const [industryFilter, setIndustryFilter] = useState("all");
   const [sceneFilter, setSceneFilter] = useState("recommend");
-  const { data, run, loading } = useRequest(GetAppList, {
+  const { data, run, loading } = useRequest(GetAppPublicList, {
     defaultParams: [
       {
         currentPage: 1,

+ 3 - 1
src/pages/apply/index.tsx

@@ -8,7 +8,7 @@ import {
   ProFormTextArea,
 } from "@ant-design/pro-components";
 import { ProTable } from "@ant-design/pro-components";
-import { Tag, message, Modal, Skeleton } from "antd";
+import { message, Modal, Skeleton } from "antd";
 import { useRequest } from "umi";
 import { GetApplyList, GetApplyDetail, HandleApply } from "@/api/apply";
 
@@ -147,6 +147,8 @@ export default () => {
           const res = await GetApplyList({
             currentPage: params.current || 1,
             pageSize: params.pageSize || 10,
+            orderByProperty: "createTime",
+            Ascending: false,
             filters: [
               { name: "name", value: params?.name },
               { name: "tel", value: params?.tel },

+ 112 - 26
src/pages/detail/index.tsx

@@ -1,4 +1,15 @@
-import { Button, Form, Image, Input, Modal, Select, Skeleton, Breadcrumb, message, notification } from "antd";
+import {
+  Button,
+  Form,
+  Image,
+  Input,
+  Modal,
+  Select,
+  Skeleton,
+  Breadcrumb,
+  message,
+  notification,
+} from "antd";
 import type { BreadcrumbProps } from "antd";
 import { useMemo, useState } from "react";
 import { useParams, useRequest, history } from "umi";
@@ -14,65 +25,127 @@ export default function detail() {
 
   const { id, type } = useParams();
 
-  const { data, loading } = useRequest<{result: any}>(type === 'application' ? GetAppDetail : GetTemplateDetail, {
-    defaultParams: [{
-      id: id
-    }]
-  });
+  const { data, loading } = useRequest<{ result: any }>(
+    type === "application" ? GetAppDetail : GetTemplateDetail,
+    {
+      defaultParams: [
+        {
+          id: id,
+        },
+      ],
+    }
+  );
 
   const handleToApp = () => {
-    if(data?.result?.trialUrl) {
+    if (data?.result?.trialUrl) {
       window.open(data?.result?.trialUrl, "_blank");
     }
   };
 
   const handleBack = () => {
     history.back();
-  }
+  };
 
   // 提交申请
   const handleSubmit = () => {
     form.validateFields().then(async (values) => {
       await SubmitApply({
         ...values,
-        type: type === 'application' ? 0 : 1,
+        type: type === "application" ? 0 : 1,
         templateId: id,
       });
       notification.success({
-        message: '您的申请已提交,后续会有专员与您联系!~',
+        message: "您的申请已提交,后续会有专员与您联系!~",
       });
       setShowAdvisory(false);
     });
   };
 
-  const breadcrumbItems: BreadcrumbProps['items'] = useMemo(() => {
+  const breadcrumbItems: BreadcrumbProps["items"] = useMemo(() => {
     return [
-      { key: 'all', title: <a onClick={handleBack}><LeftOutlined/><span className="m-l-4px">返回</span></a>},
-      { key: 'current', title: data?.result.name}
-    ]
+      {
+        key: "all",
+        title: (
+          <a onClick={handleBack}>
+            <LeftOutlined />
+            <span className="m-l-4px">返回</span>
+          </a>
+        ),
+      },
+      { key: "current", title: data?.result.name },
+    ];
   }, [data]);
 
   return (
     <div className="detail relative mx-auto pt-24px h-full overflow-y-auto">
       <div className="max-w-[1200px] mx-auto">
-        <Breadcrumb className="mb-24px" items={breadcrumbItems}/>
+        <Breadcrumb className="mb-24px" items={breadcrumbItems} />
         <Skeleton avatar active loading={loading}>
           <div className="flex mb-32px">
             <div className="w-128px h-128px rounded-20px bg-gray-200 overflow-hidden flex justify-center items-center">
-              <Image className="w-full h-full" preview={false} src={data?.result?.icon ? `/api/File/Download?fileId=${data?.result?.icon}` : ''}/>
+              <Image
+                className="w-full h-full"
+                preview={false}
+                src={
+                  data?.result?.icon
+                    ? `/api/File/Download?fileId=${data?.result?.icon}`
+                    : ""
+                }
+              />
             </div>
             <div className="flex-1 mx-24px">
               <div className="text-32px font-[600]">{data?.result?.name}</div>
               <div className="text-secondary text-14px">
-                {data?.result?.desc || '暂无描述'}
+                {data?.result?.desc || "暂无描述"}
               </div>
-              <div className="inline-block bg-[#dcdde0] rounded-8px text-secondary px-8px py-4px mt-12px text-12px">
-                <i className="iconfont icon-qiyexinxi mr-8px" />
-                <span>{data?.result?.createByName || '易码工坊'}</span>
+              <div className="mt-12px flex items-center">
+                <div className="block bg-[#dcdde0] rounded-8px text-secondary px-8px py-4px text-12px">
+                  <i className="iconfont icon-qiyexinxi mr-8px" />
+                  <span>{data?.result?.createByName || "易码工坊"}</span>
+                </div>
+                <div className="flex items-center px-[14px] leading-24px text-12px">
+                  <div className="flex items-center space-x-1 text-text-tertiary">
+                    <svg
+                      viewBox="0 0 24 24"
+                      xmlns="http://www.w3.org/2000/svg"
+                      width="24"
+                      height="24"
+                      fill="currentColor"
+                      className="remixicon shrink-0 w-3 h-3"
+                    >
+                      <path d="M9 2V4H5L4.999 14H18.999L19 4H15V2H20C20.5523 2 21 2.44772 21 3V21C21 21.5523 20.5523 22 20 22H4C3.44772 22 3 21.5523 3 21V3C3 2.44772 3.44772 2 4 2H9ZM18.999 16H4.999L5 20H19L18.999 16ZM17 17V19H15V17H17ZM13 2V7H16L12 11L8 7H11V2H13Z"></path>
+                    </svg>
+                    <div className="system-xs-regular">使用量 339</div>
+                  </div>
+                  <div className="mx-2 text-text-quaternary system-xs-regular">
+                    ·
+                  </div>
+                  <div className="flex flex-wrap space-x-2 h-4 overflow-hidden">
+                    {(data?.result.tags?.split(",") || []).map(
+                      (tag: string) => {
+                        return (
+                          <div
+                            className="flex space-x-1 system-xs-regular max-w-[120px] overflow-hidden"
+                            title={`# ${tag}`}
+                          >
+                            <span className="text-text-quaternary">#</span>
+                            <span className="truncate text-text-tertiary">
+                              {tag}
+                            </span>
+                          </div>
+                        );
+                      }
+                    )}
+                  </div>
+                </div>
               </div>
             </div>
             <div className="head-right flex flex-col justify-center items-center">
-              <Button type="primary" className="w-full mb-24px" onClick={handleToApp}>
+              <Button
+                type="primary"
+                className="w-full mb-24px"
+                onClick={handleToApp}
+              >
                 在线体验
               </Button>
               <Button className="w-full" onClick={() => setShowAdvisory(true)}>
@@ -87,13 +160,24 @@ export default function detail() {
         </div>
 
         <Skeleton active loading={loading}>
-          <div className={"content m-y-32px overflow-hidden relative " + styles.rich}>
-            <div dangerouslySetInnerHTML={{__html: data?.result?.detail || ''}}/>
+          <div
+            className={
+              "content m-y-32px overflow-hidden relative " + styles.rich
+            }
+          >
+            <div
+              dangerouslySetInnerHTML={{ __html: data?.result?.detail || "" }}
+            />
           </div>
         </Skeleton>
-        
       </div>
-      <Modal title="购买咨询" width={500} open={showAdvisory} onCancel={() => setShowAdvisory(false)} onOk={handleSubmit}>
+      <Modal
+        title="购买咨询"
+        width={500}
+        open={showAdvisory}
+        onCancel={() => setShowAdvisory(false)}
+        onOk={handleSubmit}
+      >
         <Form labelCol={{ span: 6 }} autoComplete="off" form={form}>
           <Form.Item
             label="如何称呼您?"
@@ -105,7 +189,9 @@ export default function detail() {
           <Form.Item
             label="联系方式"
             name="tel"
-            rules={[{ required: true, message: "请输入您的联系方式!", max: 20 }]}
+            rules={[
+              { required: true, message: "请输入您的联系方式!", max: 20 },
+            ]}
           >
             <Input placeholder="请输入" maxLength={20} />
           </Form.Item>

+ 0 - 1
src/pages/management/AppTab.tsx

@@ -107,7 +107,6 @@ export default () => {
     {
       title: "上架状态",
       dataIndex: "isOnMarket",
-      filters: true,
       ellipsis: true,
       valueType: "select",
       valueEnum: {

+ 0 - 1
src/pages/management/TemplateTab.tsx

@@ -103,7 +103,6 @@ export default () => {
     {
       title: "上架状态",
       dataIndex: "isOnMarket",
-      filters: true,
       ellipsis: true,
       valueType: "select",
       valueEnum: {

+ 2 - 2
src/pages/template/index.tsx

@@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
 import ItemCard from "@/components/ItemCard";
 import { APPLICATION_SCENARIOS_OPTIONS } from "@/constants";
 import { history, useRequest } from "umi";
-import { GetTemplateList } from "@/api/templateStore";
+import { GetTemplatePublicList } from "@/api/templateStore";
 import { Input, Spin, Empty } from "antd";
 import { MODULE_TEMPLATE_TYPE } from "@/constants";
 import noDataImg from "@/assets/no-data.svg";
@@ -30,7 +30,7 @@ export default function Template() {
   const [search, setSearch] = useState("");
   const [industryFilter, setIndustryFilter] = useState("all");
   const [sceneFilter, setSceneFilter] = useState("recommend");
-  const { data, run, loading } = useRequest(GetTemplateList, {
+  const { data, run, loading } = useRequest(GetTemplatePublicList, {
     defaultParams: [
       {
         currentPage: 1,