master
Aaron Yu 2022-01-24 20:11:46 +08:00
parent dea09d52cf
commit 8ffeb52090
2 changed files with 3 additions and 4 deletions

View File

@ -28,7 +28,7 @@ class App extends React.Component {
refreshQrCode() { refreshQrCode() {
var {selectedProject} = this.state; var {selectedProject} = this.state;
var rawUrl = encodeURI(BaseUrl + selectedProject.HtmlUrl) var rawUrl = encodeURI(!selectedProject?.HtmlUrl?.startsWith("http") ? BaseUrl + selectedProject.HtmlUrl : selectedProject.HtmlUrl)
selectedProject.HtmlUrl && QrCode.toDataURL([{ data: rawUrl, mode: 'byte'}], { width: 120 }) selectedProject.HtmlUrl && QrCode.toDataURL([{ data: rawUrl, mode: 'byte'}], { width: 120 })
.then((dataUrl) => { .then((dataUrl) => {
this.setState({ this.setState({

View File

@ -8,11 +8,10 @@ import ipadVPng from '../../images/iPad-v.png'
import copyPng from '../../images/copy.png' import copyPng from '../../images/copy.png'
import refreshButtonPng from '../../images/refresh-button.png' import refreshButtonPng from '../../images/refresh-button.png'
import {CopyToClipboard} from 'react-copy-to-clipboard'; import {CopyToClipboard} from 'react-copy-to-clipboard';
import React, { createRef, useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { BaseUrl } from '../../constants' import { BaseUrl } from '../../constants'
import { Alert, Snackbar } from '@mui/material' import { Alert, Snackbar } from '@mui/material'
var baseUrl = "http://123.56.161.61:1157/"
var configMap = { var configMap = {
"android-h": { "android-h": {
bkg: androidHPng, bkg: androidHPng,
@ -64,7 +63,7 @@ function DeviceFrame(props) {
useEffect(() => { useEffect(() => {
console.log('触发更新', props.htmlUrl); console.log('触发更新', props.htmlUrl);
setAbsoluteUrl(!props.htmlUrl?.startsWith("http") ? BaseUrl + props.htmlUrl : props.htmlUrl); props.htmlUrl && setAbsoluteUrl(!props.htmlUrl.startsWith("http") ? BaseUrl + props.htmlUrl : props.htmlUrl);
refresh() refresh()
props.refreshQrCode() props.refreshQrCode()
}, [props.htmlUrl]) }, [props.htmlUrl])