Merge branch 'dev' into dev-yj
This commit is contained in:
commit
28de68eab3
@ -5,4 +5,6 @@ NEXT_PUBLIC_TEST="테스트변수입니다. development"
|
||||
|
||||
DATABASE_URL="sqlserver://mssql.devgrr.kr:1433;database=qcast;user=qcast;password=Qwertqaz12345;trustServerCertificate=true"
|
||||
|
||||
SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
||||
SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
||||
|
||||
CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3"
|
||||
@ -4,4 +4,6 @@ NEXT_PUBLIC_API_SERVER_PATH="http://localhost:8080"
|
||||
|
||||
DATABASE_URL=""
|
||||
|
||||
SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
||||
SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y="
|
||||
|
||||
CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3"
|
||||
@ -32,6 +32,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@turf/turf": "^7.0.0",
|
||||
"convertapi": "^1.14.0",
|
||||
"dayjs": "^1.11.13",
|
||||
"postcss": "^8",
|
||||
"prettier": "^3.3.3",
|
||||
|
||||
@ -6,6 +6,7 @@ import ColorPicker from './common/color-picker/ColorPicker'
|
||||
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { convertDwgToPng } from '@/lib/cadAction'
|
||||
// import { get } from '@/lib/Axios'
|
||||
|
||||
import QSelect from '@/components/ui/QSelect'
|
||||
@ -13,7 +14,8 @@ import QSelect from '@/components/ui/QSelect'
|
||||
import styles from './playground.module.css'
|
||||
|
||||
export default function Playground() {
|
||||
const { get } = useAxios()
|
||||
const fileRef = useRef(null)
|
||||
const { get, post } = useAxios()
|
||||
const testVar = process.env.NEXT_PUBLIC_TEST
|
||||
const { getMessage } = useMessage()
|
||||
|
||||
@ -28,6 +30,16 @@ export default function Playground() {
|
||||
console.log('users', users)
|
||||
}
|
||||
|
||||
const handleConvert = async () => {
|
||||
console.log('file', fileRef.current.files[0])
|
||||
|
||||
const formData = new FormData()
|
||||
formData.append('file', fileRef.current.files[0])
|
||||
|
||||
const result = await post({ url: process.env.CONVERTER_API_URL, data: formData })
|
||||
await convertDwgToPng(result.Files[0].FileName, result.Files[0].FileData)
|
||||
}
|
||||
|
||||
const data = [
|
||||
{
|
||||
id: 1,
|
||||
@ -70,6 +82,12 @@ export default function Playground() {
|
||||
<ColorPicker color={color} setColor={setColor} />
|
||||
<div className="p-4">{color}</div>
|
||||
</div>
|
||||
<div>
|
||||
<input type="file" name="file" ref={fileRef} />
|
||||
<div>
|
||||
<Button onClick={handleConvert}>Convert</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
||||
@ -634,30 +634,60 @@ export const SurfaceShapeModal = ({ canvas }) => {
|
||||
switch (type) {
|
||||
case 1: {
|
||||
if (length3 !== 0 && length1 > length3) {
|
||||
return false
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
case 3: {
|
||||
if (length3 > length1) {
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
case 6: {
|
||||
if (length3 > length1) {
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
case 7: {
|
||||
if (length3 > length1) {
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
case 8: {
|
||||
if (length2 > length3) {
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
case 9: {
|
||||
if (length2 > length3) {
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
case 21: {
|
||||
if (length1 < length2) {
|
||||
alert('1번보다 작게 입력해주세요.')
|
||||
return false
|
||||
return
|
||||
}
|
||||
|
||||
if (length3 < length4) {
|
||||
alert('3번보다 작게 입력해주세요.')
|
||||
return false
|
||||
return
|
||||
}
|
||||
}
|
||||
case 22: {
|
||||
if (length1 < length2) {
|
||||
alert('1번보다 작게 입력해주세요.')
|
||||
return false
|
||||
return
|
||||
}
|
||||
|
||||
if (length3 < length4) {
|
||||
alert('3번보다 작게 입력해주세요.')
|
||||
return false
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
src/lib/cadAction.js
Normal file
13
src/lib/cadAction.js
Normal file
@ -0,0 +1,13 @@
|
||||
const convertDwgToPng = async (fileName, data) => {
|
||||
console.log('fileName', fileName)
|
||||
const imagePath = 'public/cad-images'
|
||||
try {
|
||||
await fs.readdir(imagePath)
|
||||
} catch {
|
||||
await fs.mkdir(imagePath)
|
||||
}
|
||||
|
||||
return fs.writeFile(`${imagePath}/${fileName}`, data, 'base64')
|
||||
}
|
||||
|
||||
export { convertDwgToPng }
|
||||
16
yarn.lock
16
yarn.lock
@ -4017,6 +4017,15 @@ asynckit@^0.4.0:
|
||||
resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
|
||||
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
|
||||
|
||||
axios@^1.6.2:
|
||||
version "1.7.7"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f"
|
||||
integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==
|
||||
dependencies:
|
||||
follow-redirects "^1.15.6"
|
||||
form-data "^4.0.0"
|
||||
proxy-from-env "^1.1.0"
|
||||
|
||||
axios@^1.7.3:
|
||||
version "1.7.3"
|
||||
resolved "https://registry.npmjs.org/axios/-/axios-1.7.3.tgz"
|
||||
@ -4252,6 +4261,13 @@ console-control-strings@^1.0.0, console-control-strings@^1.1.0:
|
||||
resolved "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz"
|
||||
integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==
|
||||
|
||||
convertapi@^1.14.0:
|
||||
version "1.14.0"
|
||||
resolved "https://registry.yarnpkg.com/convertapi/-/convertapi-1.14.0.tgz#a291a98cb986ae1e0f2340a130adbe17f65c8c76"
|
||||
integrity sha512-9Rzkn+Mjs4jVLQ5pRUC8KpIjnT9WFUkuJZ5yjCJaDJsDM7Na2lWPKtDJdkfKcYCNDuo1h+OYZedne5SLp60EkQ==
|
||||
dependencies:
|
||||
axios "^1.6.2"
|
||||
|
||||
cookie@0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user