Kaynağa Gözat

fix-搜索pageNum问题

lanxin 1 ay önce
ebeveyn
işleme
8dc84ef60e

+ 7 - 7
src/components/PreviewOperate/index.tsx

@@ -82,13 +82,13 @@ function PreviewOperate({ src }: { src?: string }) {
               // 动态修改 CSS 路径
               const linkElements = iframeDocument.querySelectorAll('link[rel="stylesheet"]')
               linkElements.forEach((link: any) => {
-                if (link.href.includes('index-BNWQR98R.css')) {
-                  // 替换为正确的 CSS 路径,请根据实际情况修改
-                  link.href = `${baseURL}/mini/assets/index-BNWQR98R.css`
-                }
-                if (link.href.includes('index-DqAPdNY3.css')) {
-                  // 替换为正确的 CSS 路径,请根据实际情况修改
-                  link.href = `${baseURL}/mini/assets/index-DqAPdNY3.css`
+                // 提取CSS文件名(兼容相对路径和绝对路径)
+                const url = new URL(link.href, iframeWindow.location.href)
+                const fileName = url.pathname.split('/').pop()
+
+                // 统一设置为${baseURL}/mini/assets/[文件名]
+                if (fileName && fileName.endsWith('.css')) {
+                  link.href = `${baseURL}/mini/assets/${fileName}`
                 }
               })
               setIsIframeReady(true)

+ 1 - 1
src/components/ZupTypes/index.tsx

@@ -1,6 +1,6 @@
 import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
-import { Button, Checkbox, Input, Modal } from 'antd'
+import { Button, Checkbox, Input, message, Modal } from 'antd'
 import { forwardRef, useImperativeHandle } from 'react'
 import {
   PlusOutlined,

+ 31 - 1
src/pages/A1banner/A1add/index.tsx

@@ -9,6 +9,7 @@ import ZupOne from '@/components/ZupOne'
 import { A1AddType, A1tbType } from '@/types'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import dayjs from 'dayjs'
+import { baseURL } from '@/utils/http'
 
 type Props = {
   editInfo: A1EditInfoType
@@ -87,6 +88,18 @@ function A1add({ editInfo, closeFu, addTableFu, editTableFu }: Props) {
       // 没有传 封面图
       if (!coverUrl.url) return MessageFu.warning('请上传封面图!')
 
+      const url = values.url || ''
+      const commonUrl = 'https://www.4dmodel.com/'
+      const sceneUrl = 'https://4dscene.4dage.com/'
+      // 不是以http:// 或 https:// 开头
+      if (!url.startsWith('http://') && !url.startsWith('https://')) {
+        return MessageFu.warning('链接格式不正确,请以 http:// 或 https:// 开头。')
+      }
+      // 当前业务域名为commonUrl,sceneUrl, baseURL
+      if (!url.includes(baseURL) && !url.includes(commonUrl) && !url.includes(sceneUrl)) {
+        return MessageFu.warning('填写域名地址未在小程序配置,请前往小程序后台的“业务域名”配置')
+      }
+
       // 发布
       const obj1: A1AddType = {
         ...values,
@@ -200,7 +213,24 @@ function A1add({ editInfo, closeFu, addTableFu, editTableFu }: Props) {
           </div>
 
           <div className='A1fromRow'>
-            <Form.Item label='链接' name='url'>
+            <Form.Item
+              label='链接'
+              name='url'
+              rules={[
+                {
+                  required: true,
+                  validator: async (_, value) => {
+                    // 检查值是否为空、包含空白字符或包含空格
+                    if (!value || value.trim() === '' || /\s/.test(value)) {
+                      return Promise.reject(
+                        new Error('链接地址不能为空或包含空白字符,请输入有效的链接。')
+                      )
+                    }
+                    return Promise.resolve()
+                  }
+                }
+              ]}
+            >
               <Input placeholder='请输入' />
             </Form.Item>
           </div>

+ 35 - 1
src/pages/A6exhibition/A6add/index.tsx

@@ -11,6 +11,7 @@ import MyPopconfirm from '@/components/MyPopconfirm'
 import dayjs from 'dayjs'
 import ZRichTexts from '@/components/ZRichTexts'
 import { A6AddType, A6tableType } from '@/types/api/A6exhibition'
+import { baseURL } from '@/utils/http'
 
 type Props = {
   editInfo: A1EditInfoType
@@ -119,6 +120,20 @@ function A6add({ editInfo, closeFu, addTableFu, editTableFu }: Props) {
       console.log(context)
       if (context.flag) return MessageFu.warning('请输入正文!')
 
+      const url = values.webSite || ''
+      const commonUrl = 'https://www.4dmodel.com/'
+      const sceneUrl = 'https://4dscene.4dage.com/'
+      if (url !== '') {
+        // 不是以http:// 或 https:// 开头
+        if (!url.startsWith('http://') && !url.startsWith('https://')) {
+          return MessageFu.warning('链接格式不正确,请以 http:// 或 https:// 开头。')
+        }
+        // 当前业务域名为commonUrl,sceneUrl, baseURL
+        if (!url.includes(baseURL) && !url.includes(commonUrl) && !url.includes(sceneUrl)) {
+          return MessageFu.warning('填写域名地址未在小程序配置,请前往小程序后台的“业务域名”配置')
+        }
+      }
+
       // 发布
       const obj1: A6AddType = {
         ...values,
@@ -274,7 +289,26 @@ function A6add({ editInfo, closeFu, addTableFu, editTableFu }: Props) {
             />
           </Form.Item>
 
-          <Form.Item label='虚拟展厅' name='webSite'>
+          <Form.Item
+            label='虚拟展厅'
+            name='webSite'
+            rules={[
+              {
+                required: false,
+                validator: async (_, value) => {
+                  // 可以为空
+                  if (!value) return Promise.resolve()
+                  // 检查值是否包含空白字符或包含空格
+                  if (value.trim() === '' || /\s/.test(value)) {
+                    return Promise.reject(
+                      new Error('链接地址不能为空或包含空白字符,请输入有效的链接。')
+                    )
+                  }
+                  return Promise.resolve()
+                }
+              }
+            ]}
+          >
             <Input placeholder='请输入链接' />
           </Form.Item>
 

+ 25 - 2
src/pages/A7collection/A7add/index.tsx

@@ -11,6 +11,7 @@ import MyPopconfirm from '@/components/MyPopconfirm'
 import dayjs from 'dayjs'
 import { A7AddType, A7tableType } from '@/types/api/A7collection'
 import ZupTypes from '@/components/ZupTypes'
+import { baseURL } from '@/utils/http'
 
 type Props = {
   editInfo: A1EditInfoType
@@ -143,9 +144,31 @@ function A7add({ editInfo, closeFu, addTableFu, editTableFu }: Props) {
 
       const coverUrl1 = ZupThumbRef1.current?.fileComFileResFu()
       const { fileList, sonType, sonIsOk } = ZupTypesRef.current?.fileComFileResFu()
+      console.log(fileList, sonType, sonIsOk, '1111111')
       // 没有传 封面图
       if (!coverUrl1.url) return MessageFu.warning('请上传首页封面图!')
       if (sonIsOk) return MessageFu.warning('请上传附件!')
+      const modelFile = fileList.model.filePath || ''
+      const commonUrl = 'https://www.4dmodel.com/'
+      const sceneUrl = 'https://4dscene.4dage.com/'
+      if (modelFile !== '') {
+        if (modelFile.trim() === '' || /\s/.test(modelFile))
+          return MessageFu.warning('链接地址不能为空或包含空白字符,请输入有效的链接。')
+
+        // 不是以http:// 或 https:// 开头
+        if (!modelFile.startsWith('http://') && !modelFile.startsWith('https://')) {
+          return MessageFu.warning('链接格式不正确,请以 http:// 或 https:// 开头。')
+        }
+        if (
+          !modelFile.includes(baseURL) &&
+          !modelFile.includes(commonUrl) &&
+          !modelFile.includes(sceneUrl)
+        ) {
+          return MessageFu.warning('填写域名地址未在小程序配置,请前往小程序后台的“业务域名”配置')
+        }
+      } else if (sonType.includes('model') && modelFile === '') {
+        return MessageFu.warning('链接地址不能为空或包含空白字符,请输入有效的链接。')
+      }
 
       // 发布
       const obj1: A7AddType = {
@@ -261,11 +284,11 @@ function A7add({ editInfo, closeFu, addTableFu, editTableFu }: Props) {
           </Form.Item>
 
           <Form.Item label='尺寸' name='size'>
-            <Input placeholder='请输入内容,最多30字' maxLength={30} showCount />
+            <Input placeholder='请输入内容,最多100字' maxLength={100} showCount />
           </Form.Item>
 
           <Form.Item label='简介' name='remark'>
-            <TextArea maxLength={1000} showCount placeholder='请输入内容,不超过1000个字' />
+            <TextArea maxLength={2000} showCount placeholder='请输入内容,不超过2000个字' />
           </Form.Item>
 
           {/* 封面 */}

+ 7 - 3
src/pages/A7collection/index.tsx

@@ -27,9 +27,13 @@ function A7collection() {
   const [title, setTitle] = useState('')
   const [type, setType] = useState(0)
   const getListFu = useCallback(
-    (title?: string) => {
+    (title?: string, pageNum?: number) => {
+      const obj = { ...pageData, status: -1, title, type }
+
+      if (pageNum) obj.pageNum = 1
+
       // status: -1 全部 0 未发布 1 已发布
-      dispatch(A7_APIgetList({ ...pageData, status: -1, title, type }))
+      dispatch(A7_APIgetList(obj))
     },
     [dispatch, pageData, type]
   )
@@ -143,7 +147,7 @@ function A7collection() {
             onChange={e => setTitle(e.target.value)}
             value={title}
           />
-          <Button type='primary' onClick={() => getListFu(title)}>
+          <Button type='primary' onClick={() => getListFu(title, 1)}>
             搜索
           </Button>
           <Button

+ 1 - 1
src/utils/http.ts

@@ -16,7 +16,7 @@ console.log(baseUrlTemp)
 // const baseFlag = baseUrlTemp.includes('https://')
 
 // 请求基地址
-export const baseURL = envFlag ? baseUrlTemp : baseUrlTemp
+export const baseURL = envFlag ? baseUrlTemp2 : baseUrlTemp
 // export const baseURL = baseUrlTemp2
 
 // 处理  类型"AxiosResponse<any, any>"上不存在属性"code"