code: update template

This commit is contained in:
PengXiaoPeng 2023-07-23 21:56:10 +08:00
parent e5f4fa333b
commit 5546174bc0
4 changed files with 8 additions and 20 deletions

View File

@ -35,3 +35,5 @@ export const getWorks = (params: Type.Object = {}) => fetch('design/poster', par
// 作品列表
export const getMyDesign = (params: Type.Object = {}) => fetch('design/my', params, 'get')
export const test = (params: Type.Object = {}) => fetch('https://res.palxp.com/api/upload', params, 'post')

View File

@ -36,8 +36,6 @@
import { defineComponent, reactive, toRefs, onMounted, nextTick } from 'vue'
import { useStore } from 'vuex'
import { UploadFilled } from '@element-plus/icons-vue'
// import { client } from '@gradio/client'
// import * as api from '@/api/ai'
import uploader from '@/components/common/Uploader/index.vue'
import _dl from '@/common/methods/download'
@ -73,11 +71,7 @@ export default defineComponent({
state.rawImage = URL.createObjectURL(file)
fileName = file.name
//
const result = await app.predict('/predict', [
file, // blob in 'Input' Image component
'u2netp', // string (Option from: ['isnet-anime', 'isnet-general-use', 'sam', 'silueta', 'u2net', 'u2net_cloth_seg', 'u2net_custom', 'u2net_human_seg', 'u2netp']) in 'Models' Dropdown component
'',
])
const result = await app.predict('/predict', [file, 'u2netp', ''])
state.rawImage && (state.cutImage = result?.data[0])
requestAnimationFrame(run)
}

View File

@ -49,7 +49,6 @@ export default defineComponent({
const content = JSON.parse(data)
content.page.backgroundImage && content.page.backgroundImage.split('.')[1] === 'palxp' && (content.page.backgroundImage += '@small')
this.compressImages(content.widgets)
this.$store.commit('setDPage', content.page)
id ? this.$store.commit('setDWidgets', content.widgets) : this.setTemplate(content.widgets)
await this.$nextTick()
@ -149,14 +148,6 @@ export default defineComponent({
})
})
},
compressImages(widgets: any) {
//
for (const item of widgets) {
if (item.imgUrl && item.imgUrl.split('.')[item.imgUrl.split('.').length - 1] === 'png') {
item.imgUrl.split('.')[1] === 'palxp' && (item.imgUrl += '@small')
}
}
},
},
})
</script>

View File

@ -10,9 +10,9 @@
<div class="top-nav">
<div class="top-nav-wrap">
<div class="top-left">
<div class="name" style="font-size: 15px">迅排在线PSD解析</div>
<div class="name" style="font-size: 15px">在线PSD解析</div>
</div>
<div style="flex: 1"><el-button plain type="primary" @click="jump2word">查看模板规范文档</el-button></div>
<div style="flex: 1"><el-button plain type="primary" @click="jump2word">说明及PSD规范文档</el-button></div>
<el-button v-show="isDone" @click="clear">清空模板内容</el-button>
<div class="v-tips">
<HeaderOptions :isDone="isDone" @change="optionsChange" />
@ -81,7 +81,7 @@ export default defineComponent({
function loadJS() {
const link_element = document.createElement('script')
link_element.setAttribute('src', '/psd.js') // 'https://design.palxp.com/psd.js.gz'
link_element.setAttribute('src', '/psd.js')
document.head.appendChild(link_element)
}
async function selectFile(file: any) {
@ -166,7 +166,8 @@ export default defineComponent({
}, 100)
},
jump2word() {
window.open('https://kdocs.cn/l/clmBsIkhve8d')
window.open('https://xp.palxp.com/#/articles/1687855172725')
// window.open('https://kdocs.cn/l/clmBsIkhve8d')
},
},
})