Commit 8905faae authored by 田翔's avatar 田翔

fix: 扫码url增加参数

parent db26b916
Pipeline #83634 passed with stages
...@@ -80,15 +80,17 @@ const Container = (props, ref) => { ...@@ -80,15 +80,17 @@ const Container = (props, ref) => {
} else if (item.title === '上一项') { } else if (item.title === '上一项') {
let ativeIndex = shema?.work?.findIndex(v => v.active) - 1 let ativeIndex = shema?.work?.findIndex(v => v.active) - 1
index = ativeIndex >= 0 ? ativeIndex : 0 index = ativeIndex >= 0 ? ativeIndex : 0
moblieRef.current.scrollTop = moblieRef.current.scrollTop - 70
} else if (item.title === '下一项') { } else if (item.title === '下一项') {
let ativeIndex = shema?.work?.findIndex(v => v.active) + 1 let ativeIndex = shema?.work?.findIndex(v => v.active) + 1
index = ativeIndex < (shema?.work.length - 1) ? ativeIndex : shema?.work.length - 1 index = ativeIndex < (shema?.work.length - 1) ? ativeIndex : shema?.work.length - 1
moblieRef.current.scrollTop = moblieRef.current.scrollTop + 70
} }
let array = [] let array = []
shema?.work.forEach((v, i) => { shema?.work.forEach((v, i) => {
array.push({ ...v, active: index === i, children: v.children.map(s => ({ ...s, active: false })) }) array.push({ ...v, active: index === i, children: v.children.map(s => ({ ...s, active: false })) })
}) })
setShema({ ...shema, work: array, active: false }) setShema({ ...shema, work: array, active: false, carousel: { ...shema.carousel, active: false } })
} }
const carouselClick = (e) => { const carouselClick = (e) => {
......
import React, { useState, createContext, useRef } from 'react' import React, { useState, createContext, useRef, useEffect } from 'react'
import { useDrag, useDrop, DndProvider } from 'react-dnd' import { useDrag, useDrop, DndProvider } from 'react-dnd'
import QRcode from 'qrcode.react' import QRcode from 'qrcode.react'
import { Button, Popover, message } from 'antd' import { Button, Popover, message } from 'antd'
...@@ -10,6 +10,7 @@ import Container from './Container' ...@@ -10,6 +10,7 @@ import Container from './Container'
import Right from './Right' import Right from './Right'
import html2canvas from 'html2canvas' import html2canvas from 'html2canvas'
import { request } from '@wisdom-utils/utils/es'; import { request } from '@wisdom-utils/utils/es';
import { getSiteTree } from '@/services/siteManage/api'
const HtmlToCanvas = (DOM, option) => { const HtmlToCanvas = (DOM, option) => {
// function saveFile(data, filename) { // function saveFile(data, filename) {
...@@ -47,6 +48,7 @@ const Designer = (props) => { ...@@ -47,6 +48,7 @@ const Designer = (props) => {
const { currentCard, } = props const { currentCard, } = props
const [shema, setShema] = useState(currentCard['卡片结构'] ? { ...JSON.parse(currentCard['卡片结构']) } : initShema) const [shema, setShema] = useState(currentCard['卡片结构'] ? { ...JSON.parse(currentCard['卡片结构']) } : initShema)
const [currentSite, setCurrentSite] = useState('永吉水务有限公司')
const containerRef = useRef(null) const containerRef = useRef(null)
const goBack = () => { const goBack = () => {
...@@ -81,6 +83,17 @@ const Designer = (props) => { ...@@ -81,6 +83,17 @@ const Designer = (props) => {
}) })
} }
const getSite = async () => {
const { code, data } = await getSiteTree({ node: -1 })
if (code === 0) {
setCurrentSite(data?.list?.[0].text)
}
}
useEffect(() => {
getSite()
}, [])
const preview = () => { const preview = () => {
props?.saveDesgin?.({ ...currentCard, '卡片结构': JSON.stringify(shema) }) props?.saveDesgin?.({ ...currentCard, '卡片结构': JSON.stringify(shema) })
} }
...@@ -102,7 +115,7 @@ const Designer = (props) => { ...@@ -102,7 +115,7 @@ const Designer = (props) => {
trigger="click" trigger="click"
content={ content={
<div> <div>
<QRcode value={`${window.origin}/civ_mobile/product/water/monitor/workbench?env=dev&id=${currentCard.ID}`} /> <QRcode value={`${window.origin}/civ_mobile/product/water/monitor/workbench?env=dev&id=${currentCard.ID}&station=${currentSite}`} />
</div> </div>
} }
> >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment