Browse Source

去掉随机选择

lzm_web
Linzm 8 months ago
parent
commit
8bb73181e0
  1. 12
      src/views/badge/index.vue
  2. 13
      src/views/badge/preview.vue

12
src/views/badge/index.vue

@ -55,6 +55,10 @@ function goToPreview() { @@ -55,6 +55,10 @@ function goToPreview() {
showToast('剩余次数不足')
return
}
if (checkId.value == 0) {
showToast('请选择风格样式')
return
}
isLoading.value = true
getPid()
}
@ -94,10 +98,10 @@ const getPid = async () => { @@ -94,10 +98,10 @@ const getPid = async () => {
message: '上传中...',
forbidClick: true,
})
kindId.value = checkId.value == 0 ? getRandomNumber() : checkId.value
// kindId.value = checkId.value == 0 ? getRandomNumber() : checkId.value
const params = {
extend_value: isBgShow.value ? -1 : 0,
kind_id: kindId.value,
kind_id: checkId.value,
}
try {
const res = await badgeApi.getPid(params)
@ -399,13 +403,13 @@ onMounted(() => { @@ -399,13 +403,13 @@ onMounted(() => {
风格样式
</div>
<div class="style-list">
<div class="style-item" @click="checkId = 0">
<!-- <div class="style-item" @click="checkId = 0">
<img class="style-img" src="@/assets/badge/suiji.png" alt="随机风格盲盒">
<div class="style-label">
随机风格盲盒
</div>
<span class="style-selected" v-if="checkId == 0" />
</div>
</div> -->
<div class="style-item" v-for="item in kindList" :key="item.id" @click="checkId = item.id">
<img class="style-img" :src="item.path" :alt="item.name">
<div class="style-label">

13
src/views/badge/preview.vue

@ -190,6 +190,10 @@ function compare() { @@ -190,6 +190,10 @@ function compare() {
const kindList = ref([])
const checkId = ref(0)
function reload() {
if (checkId.value == 0) {
showToast('请选择风格样式')
return
}
badgeApi.getKindList({
page: 1,
size: 20,
@ -207,17 +211,16 @@ function reload() { @@ -207,17 +211,16 @@ function reload() {
})
showReload.value = true
}
const getKindID = () => {
return kindList.value.map(obj => obj.id)[Math.floor(Math.random() * kindList.value.length)];
}
// 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: kindID,
kind_id: checkId.value,
extend_value: extend_value.value,
group: group.value,
}

Loading…
Cancel
Save