Browse Source

再次生成bug修改,提示文字修改

lzm_web
Linzm 8 months ago
parent
commit
5e0ce4b4b5
  1. 6
      src/views/badge/index.vue
  2. 77
      src/views/badge/preview.vue
  3. 6
      src/views/badge/record.vue

6
src/views/badge/index.vue

@ -82,8 +82,8 @@ function getBlobBg(data) { @@ -82,8 +82,8 @@ function getBlobBg(data) {
}
imgBgUrl.value = data;
}
const getRandomNumber = (min: number, max: number) => {
return Math.floor(Math.random() * (max - min + 1) + min);
const getRandomNumber = () => {
return kindList.value.map(obj => obj.id)[Math.floor(Math.random() * kindList.value.length)];
}
// Pid
@ -94,7 +94,7 @@ const getPid = async () => { @@ -94,7 +94,7 @@ const getPid = async () => {
message: '上传中...',
forbidClick: true,
})
kindId.value = checkId.value == 0 ? getRandomNumber(kindList.value[0].id, kindList.value[kindList.value.length - 1].id) : checkId.value
kindId.value = checkId.value == 0 ? getRandomNumber() : checkId.value
const params = {
extend_value: isBgShow.value ? -1 : 0,
kind_id: kindId.value,

77
src/views/badge/preview.vue

@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
<div class="progress-bar-bg">
<div class="progress-bar-fg" :style="{ width: progress + '%' }"></div>
</div>
<div class="progress-text">照片数据分析中 {{progress}}%</div>
<div class="progress-text">{{progressText}} {{progress}}%</div>
<div class="progress-desc">总计大约需要60秒请耐心等待...</div>
</div>
<div v-else class="progress-section">
@ -163,7 +163,7 @@ @@ -163,7 +163,7 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { useRoutimporter } from 'vue-router';
import { showSuccessToast, showToast, showNotify } from 'vant';
import { showSuccessToast, showToast, showNotify, showConfirmDialog } from 'vant';
import * as badgeApi from '@/api/badge'
const router = useRouter();
const value = ref(0);
@ -199,13 +199,17 @@ function reload() { @@ -199,13 +199,17 @@ function reload() {
})
showReload.value = true
}
const getKindID = () => {
return kindList.value.map(obj => obj.id)[Math.floor(Math.random() * kindList.value.length)];
}
function sureReload() {
console.log('sureReload')
imageUrl.value = '';
group.value = newGroup.value
const kindID = checkId.value == 0 ? getKindID() : checkId.value
const params = {
pid: pid.value,
kind_id: checkId.value,
kind_id: kindID,
extend_value: extend_value.value,
group: group.value,
}
@ -314,30 +318,41 @@ const confirm = () => { @@ -314,30 +318,41 @@ const confirm = () => {
return
}
loading.value = true
const parms = {
pid: pid.value,
key: key.value,
pay_amount: payAmount.value,
products: sizeList.value
}
badgeApi.creatOrder(parms).then((res: any) => {
console.log('creatOrder', res)
showSuccessToast({
message: '下单成功',
duration: 2000,
})
router.push({
path: '/badge/myOrder'
})
}).catch((err) => {
console.log('creatOrder', err)
showToast({
message: err.message,
duration: 2000,
showConfirmDialog({
title: '确认下单',
message:
'请再次确认是否选择这个模型下单。',
})
.then(() => {
const parms = {
pid: pid.value,
key: key.value,
pay_amount: payAmount.value,
products: sizeList.value
}
badgeApi.creatOrder(parms).then((res: any) => {
console.log('creatOrder', res)
showSuccessToast({
message: '下单成功',
duration: 2000,
})
router.push({
path: '/badge/myOrder'
})
}).catch((err) => {
console.log('creatOrder', err)
showToast({
message: err.message,
duration: 2000,
})
}).finally(() => {
loading.value = false
})
}).finally(() => {
loading.value = false
})
.catch(() => {
// on cancel
});
}
const imageUrl = ref('')
@ -347,6 +362,7 @@ const flag = ref(1) @@ -347,6 +362,7 @@ const flag = ref(1)
const timer = ref()
const progress = ref(0)
const progressTimer = ref()
const progressText = ref('')
const progressList = () => {
//
progress.value = 0
@ -354,6 +370,15 @@ const progressList = () => { @@ -354,6 +370,15 @@ const progressList = () => {
progressTimer.value = setInterval(() => {
if (progress.value < 90) {
progress.value += 1
if (progress.value < 25) {
progressText.value = '照片数据分析中'
} else if (progress.value < 50) {
progressText.value = '提炼图像关键词'
} else if (progress.value < 75) {
progressText.value = '图像生成中'
} else {
progressText.value = '图像后处理与优化'
}
}
}, 300)
}
@ -381,6 +406,7 @@ const getImageList = () => { @@ -381,6 +406,7 @@ const getImageList = () => {
imageUrl.value = data.list[0].origin_url
imageList.value = data.list
key.value = data.list[0].key
getCompareImage()
}
}).catch((err) => {
clearInterval(progressTimer.value)
@ -404,7 +430,6 @@ onMounted(() => { @@ -404,7 +430,6 @@ onMounted(() => {
getImageList()
progressList()
getSizeList()
getCompareImage()
timer.value = setInterval(() => {
getImageList()
}, 10000)

6
src/views/badge/record.vue

@ -11,7 +11,10 @@ @@ -11,7 +11,10 @@
<img :src="item.path" :alt="item.name" style="width: 100%; height: 100%; object-fit: cover; border-radius: 50%;">
<div class="record-image-item-shadow"></div>
</block>
<div v-else class="record-image-item-loading">
<div v-else-if="item.status == 0" class="record-image-item-loading">
设计中
</div>
<div v-else-if="item.status == 2" class="record-image-item-loading">
设计失败
</div>
</div>
@ -109,7 +112,6 @@ function goBack() { @@ -109,7 +112,6 @@ function goBack() {
position: relative;
overflow: hidden;
cursor: pointer;
background: #f5f5f5;
border-radius: 12px;
}
.record-image-item img {

Loading…
Cancel
Save