Commit 86297f6c2d05662f485080f28b20144d0eb42807
1 parent
1bf2cee0
fix: 修复3d模型在大屏中无法保存缩略图与模型加载与上传时间调整为2min
Showing
6 changed files
with
20 additions
and
15 deletions
| 1 | 1 | import { UIPanel, UIRow, UIHorizontalRule } from './libs/ui.js' |
| 2 | -import useMessage from './MessageDialog.js' | |
| 3 | -import { saveOrUpdateThreeJsModel } from './libs/http/api.js' | |
| 4 | -import html2canvas from 'html2canvas' | |
| 5 | -import { fetchRouteParamsLocation } from '@/utils' | |
| 6 | -import { uploadFile } from '@/api/external/contentSave/content' | |
| 7 | -import { base64toFile } from '../utils/Base64ToFile.js' | |
| 8 | -import { useSpin } from '../js/libs/spin/useSpin.js' | |
| 9 | 2 | import arkanoid from '../examples/arkanoid.app.json?url' |
| 10 | 3 | import camera from '../examples/camera.app.json?url' |
| 11 | 4 | import particles from '../examples/particles.app.json?url' | ... | ... |
| ... | ... | @@ -15,6 +15,8 @@ function Strings( config ) { |
| 15 | 15 | 'prompt/history/preserve': 'The history will be preserved across sessions.\nThis can have an impact on performance when working with textures.', |
| 16 | 16 | 'prompt/history/forbid': 'Undo/Redo disabled while scene is playing.', |
| 17 | 17 | 'prompt/rendering/realistic/unsupportedMaterial': 'REALISTIC Shading: Only MeshStandardMaterial and MeshPhysicalMaterial are supported', |
| 18 | + 'prompt/save/success': "Save successfully", | |
| 19 | + 'prompt/save/faild': "Save failure", | |
| 18 | 20 | |
| 19 | 21 | 'command/AddObject': 'Add Object', |
| 20 | 22 | 'command/AddScript': 'Add Script', |
| ... | ... | @@ -418,6 +420,8 @@ function Strings( config ) { |
| 418 | 420 | 'prompt/history/preserve': 'L\'histoire sera conservée entre les sessions.\nCela peut avoir un impact sur les performances lors de la manipulation des textures.', |
| 419 | 421 | 'prompt/history/forbid': 'Les fonctions Annuler/Rétablir sont désactivées pendant la lecture de la scène.', |
| 420 | 422 | 'prompt/rendering/realistic/unsupportedMaterial': 'Ombrage REALISTIC : seuls MeshStandardMaterial et MeshPhysicalMaterial sont pris en charge', |
| 423 | + 'prompt/save/success': "Sauvé avec succès", | |
| 424 | + 'prompt/save/faild': "Échec de sauvegarde", | |
| 421 | 425 | |
| 422 | 426 | 'command/AddObject': 'Ajouter un objet', |
| 423 | 427 | 'command/AddScript': 'Ajouter un script', |
| ... | ... | @@ -821,6 +825,8 @@ function Strings( config ) { |
| 821 | 825 | 'prompt/history/preserve': '历史将在会话之间保留。\n这可能会影响在处理纹理时的性能。', |
| 822 | 826 | 'prompt/history/forbid': '在播放场景时,撤消/重做被禁用。', |
| 823 | 827 | 'prompt/rendering/realistic/unsupportedMaterial': 'REALISTIC着色:仅支持 MeshStandardMaterial 和 MeshPhysicalMaterial', |
| 828 | + 'prompt/save/success': "保存成功", | |
| 829 | + 'prompt/save/faild': "保存失败", | |
| 824 | 830 | |
| 825 | 831 | 'command/AddObject': '添加对象', |
| 826 | 832 | 'command/AddScript': '添加脚本', |
| ... | ... | @@ -1224,6 +1230,8 @@ function Strings( config ) { |
| 1224 | 1230 | 'prompt/history/preserve': '履歴はセッションをまたいで保存されます。\nこれは、テクスチャを操作する際のパフォーマンスに影響を与える可能性があります。', |
| 1225 | 1231 | 'prompt/history/forbid': 'シーンの再生中は元に戻す/やり直しは無効になります。', |
| 1226 | 1232 | 'prompt/rendering/realistic/unsupportedMaterial': 'REALISTIC シェーディング: MeshStandardmaterial と MeshPhysicalmaterial のみがサポートされています', |
| 1233 | + 'prompt/save/success': "保存成功です", | |
| 1234 | + 'prompt/save/faild': "保存に失敗しました", | |
| 1227 | 1235 | |
| 1228 | 1236 | 'command/AddObject': 'オブジェクトを追加', |
| 1229 | 1237 | 'command/AddScript': 'スクリプトを追加', |
| ... | ... | @@ -1626,6 +1634,8 @@ function Strings( config ) { |
| 1626 | 1634 | 'prompt/history/preserve': '기록은 세션을 통해 저장됩니다. 이는 텍스처를 조작할 때 성능에 영향을 미칠 수 있습니다.', |
| 1627 | 1635 | 'prompt/history/forbid': '씬을 재생하는 동안 되돌리기/다시하기는 비활성화됩니다.', |
| 1628 | 1636 | 'prompt/rendering/realistic/unsupportedMaterial': 'REALISTIC 셰이딩: MeshStandardmaterial 및 MeshPhysicalmaterial만 지원됩니다', |
| 1637 | + 'prompt/save/success': "성공적으로 저장했습니다", | |
| 1638 | + 'prompt/save/faild': "저장 실패", | |
| 1629 | 1639 | |
| 1630 | 1640 | 'command/AddObject': '객체 추가', |
| 1631 | 1641 | 'command/AddScript': '스크립트 추가', | ... | ... |
| ... | ... | @@ -7,6 +7,7 @@ import { base64toFile } from '../../../utils/Base64ToFile.js' |
| 7 | 7 | import { useSpin } from '../spin/useSpin' |
| 8 | 8 | |
| 9 | 9 | export function useSave(editor) { |
| 10 | + const strings = editor.strings | |
| 10 | 11 | |
| 11 | 12 | async function save() { |
| 12 | 13 | // 获取缩略图片 |
| ... | ... | @@ -38,9 +39,9 @@ export function useSave(editor) { |
| 38 | 39 | imageUrl: uploadRes?.fileStaticUri, |
| 39 | 40 | data: file_json |
| 40 | 41 | }) |
| 41 | - success('保存成功') | |
| 42 | + success(strings.getKey('prompt/save/success')) | |
| 42 | 43 | } catch (e) { |
| 43 | - error(e?.message || e?.msg || '网络错误') | |
| 44 | + error(e?.message || e?.msg || e?.response?.statusText || strings.getKey('prompt/save/faild')) | |
| 44 | 45 | } finally { |
| 45 | 46 | stop() |
| 46 | 47 | } | ... | ... |
| ... | ... | @@ -12,10 +12,10 @@ export function saveOrUpdateThreeJsModel(params) { |
| 12 | 12 | { |
| 13 | 13 | url: `${API['URL']}?id=${params['id']}&imageUrl=${params['imageUrl']}`, |
| 14 | 14 | data: params['data'], |
| 15 | - timeout: 30 * 1000 | |
| 15 | + timeout: 60 * 1000 * 2 | |
| 16 | 16 | }, |
| 17 | 17 | { |
| 18 | - errorMessageMode: '' | |
| 18 | + errorMessageMode: 'none' | |
| 19 | 19 | } |
| 20 | 20 | ) |
| 21 | 21 | } |
| ... | ... | @@ -41,7 +41,7 @@ export function getThreeJsModelByJson(id) { |
| 41 | 41 | return defHttp.get( |
| 42 | 42 | { |
| 43 | 43 | url: API['URL'] + '/json' + '/' + id + '/root.json', |
| 44 | - timeout: 30 * 1000 | |
| 44 | + timeout: 60 * 1000 * 2 | |
| 45 | 45 | }, |
| 46 | 46 | { |
| 47 | 47 | errorMessageMode: '' | ... | ... |
| ... | ... | @@ -4,10 +4,11 @@ import { ModelComponentItemType } from './model'; |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -export const doGet3DComponentJson = (id: string, ) => { | |
| 7 | +export const doGet3DComponentJson = (id: string,) => { | |
| 8 | 8 | return defHttp.get<ModelComponentItemType | null>( |
| 9 | 9 | { |
| 10 | - url: `/3d_component/json/${id}/root.json` | |
| 10 | + url: `/3d_component/json/${id}/root.json`, | |
| 11 | + timeout: 1000 * 60 * 2 | |
| 11 | 12 | } |
| 12 | 13 | ) |
| 13 | 14 | } | ... | ... |
| ... | ... | @@ -24,7 +24,7 @@ export class ModelLoader { |
| 24 | 24 | height = window.innerHeight |
| 25 | 25 | }: ModelLoaderConstructorOptions = {} |
| 26 | 26 | ) { |
| 27 | - this.renderer = new WebGLRenderer({ alpha: true, antialias: true }) | |
| 27 | + this.renderer = new WebGLRenderer({ alpha: true, antialias: true, preserveDrawingBuffer: true }) | |
| 28 | 28 | this.scene = new Scene() |
| 29 | 29 | this.camera = new PerspectiveCamera() |
| 30 | 30 | this.objectLoader = new ObjectLoader() | ... | ... |