Skip to content

Commit

Permalink
update edit vue
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjj1024 committed Dec 19, 2024
1 parent 45e59ec commit 1d045de
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/lang/en_us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default {
desTips: 'Please enter the project description.',
save: 'Save',
preview: 'Preview',
previewNotSupport: 'Preview is not supported on this platform yet',
publish: 'Release',
build: 'Build',
pubPlatform: 'Platform',
Expand Down
2 changes: 2 additions & 0 deletions src/lang/ja_jp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export default {
desTips: 'プロジェクトの説明を入力してください',
save: '保存',
preview: 'プレビュー',
previewNotSupport:
'プレビューはこのプラットフォームではサポートされていません まだ',
publish: '公開',
build: 'ビルド&公開',
pubPlatform: '公開プラットフォーム',
Expand Down
1 change: 1 addition & 0 deletions src/lang/ko_kr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default {
desTips: '프로젝트 설명을 입력하세요',
save: '저장',
preview: '미리보기',
previewNotSupport: '미리보기는 이 플랫폼에서 지원되지 않습니다 아직',
publish: '게시',
build: '빌드 및 게시',
pubPlatform: '게시 플랫폼',
Expand Down
1 change: 1 addition & 0 deletions src/lang/zh_cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default {
desTips: '请输入项目描述',
save: '保存',
preview: '预览',
previewNotSupport: '预览暂不支持此平台',
publish: '发布',
build: '打包发布',
pubPlatform: '发布平台',
Expand Down
1 change: 1 addition & 0 deletions src/lang/zh_tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default {
desTips: '請輸入項目描述',
save: '保存',
preview: '預覽',
previewNotSupport: '預覽暫不支持此平台',
publish: '發佈',
build: '打包發佈',
pubPlatform: '發佈平台',
Expand Down
42 changes: 26 additions & 16 deletions src/pages/edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ import CutterImg from '@/components/CutterImg.vue'
import { useI18n } from 'vue-i18n'
import { CSSFILTER, isAlphanumeric, openUrl } from '@/utils/common'
import { platforms } from '@/utils/config'
import { platform } from '@tauri-apps/plugin-os'
import TauriConfig from '@/components/TauriConfig.vue'
const router = useRouter()
Expand All @@ -358,6 +359,7 @@ const centerDialogVisible = ref(false)
const formSize = ref<ComponentSize>('default')
const appFormRef = ref<FormInstance>()
const appForm: any = reactive(store.currentProject)
const platformName = platform()
const iconFileName = ref('')
const selJs = ref<any>(null)
Expand Down Expand Up @@ -896,22 +898,30 @@ const getInitializationScript = () => {
}
const preview = async (resize: boolean) => {
appFormRef.value?.validate((valid, fields) => {
if (valid) {
console.log('submit!', appForm)
saveProject(false)
// initialization_script
const initJsScript = getInitializationScript()
// console.log('initCssScript', initCssScript)
invoke('preview_from_config', {
resize,
config: tauriConfig.windows,
jsContent: initJsScript,
})
} else {
console.log('error submit!', fields)
}
})
// get platform
console.log('platform', platformName)
// if platform is macos, then use tauri preview
if (platformName === 'macos') {
appFormRef.value?.validate((valid, fields) => {
if (valid) {
console.log('submit!', appForm)
saveProject(false)
// initialization_script
const initJsScript = getInitializationScript()
// console.log('initCssScript', initCssScript)
invoke('preview_from_config', {
resize,
config: tauriConfig.windows,
jsContent: initJsScript,
})
} else {
console.log('error submit!', fields)
}
})
} else {
console.log('platform is not macos')
ElMessage.error(t('previewNotSupport'))
}
}
const createRepo = async () => {
Expand Down

0 comments on commit 1d045de

Please sign in to comment.