| @@ -17,7 +17,7 @@ | |||||
| ><image :src="styleData.coverImg" | ><image :src="styleData.coverImg" | ||||
| /></view> | /></view> | ||||
| <text class="name">{{ styleData.title }}</text> | <text class="name">{{ styleData.title }}</text> | ||||
| <view class="orangeBtn" @click="createing" style="margin-top: -20rpx" | |||||
| <view class="orangeBtn" @click="createing1" style="margin-top: -20rpx" | |||||
| >开始制作写真 | >开始制作写真 | ||||
| </view> | </view> | ||||
| <view class="orangeBtn" @click="toCamera" style="margin-top: 10rpx" | <view class="orangeBtn" @click="toCamera" style="margin-top: 10rpx" | ||||
| @@ -82,45 +82,44 @@ async function getInfo() { | |||||
| //#endregion --------------------- | //#endregion --------------------- | ||||
| //#region 生成写真照片 | //#region 生成写真照片 | ||||
| async function createing() { | |||||
| async function createing1() { | |||||
| // 没有token则扫码登录 | // 没有token则扫码登录 | ||||
| if (!uni.getStorageSync("token")) { | if (!uni.getStorageSync("token")) { | ||||
| showQrCode.value = true; | showQrCode.value = true; | ||||
| return; | return; | ||||
| } else { | } else { | ||||
| // uni.navigateTo({ | |||||
| // url: `/pages/created/index?id=866172729176285184`, | |||||
| // }); | |||||
| // return; | |||||
| try { | |||||
| uni.showLoading({ | |||||
| title: "生成中...", | |||||
| mask: true, | |||||
| }); | |||||
| const res = await findImageApi(); | |||||
| let myImg = | |||||
| "https://suimang.oss-accelerate.aliyuncs.com/capi/2023-09-18/bd50b0024ea4470cbd391bcb00382f72.jpg?x-oss-process=image/resize,w_10000/quality,q_60"; | |||||
| const data = { | |||||
| machineQrcodeId: uni.getStorageSync("UserId"), | |||||
| plat: uni.getStorageSync("plat"), | |||||
| digitalAvatarId: styleData.value.id, | |||||
| userImages: JSON.stringify([myImg]), | |||||
| title: styleData.value.title, | |||||
| }; | |||||
| const res2 = await createPhotoApi(data); | |||||
| console.log(res2); | |||||
| uni.navigateTo({ | |||||
| url: `/pages/created/index?id=${res2.data.id}`, | |||||
| }); | |||||
| uni.hideLoading(); | |||||
| } catch (error) { | |||||
| console.log(error); | |||||
| uni.hideLoading(); | |||||
| uni.showToast({ | |||||
| title: "生成失败,请重试", | |||||
| icon: "none", | |||||
| }); | |||||
| } | |||||
| toCamera(); | |||||
| } | |||||
| } | |||||
| async function createing2() { | |||||
| try { | |||||
| uni.showLoading({ | |||||
| title: "生成中...", | |||||
| mask: true, | |||||
| }); | |||||
| // const res = await findImageApi(); | |||||
| let myImg = | |||||
| "https://suimang.oss-accelerate.aliyuncs.com/capi/2023-09-18/bd50b0024ea4470cbd391bcb00382f72.jpg?x-oss-process=image/resize,w_10000/quality,q_60"; | |||||
| const data = { | |||||
| machineQrcodeId: uni.getStorageSync("UserId"), | |||||
| plat: uni.getStorageSync("plat"), | |||||
| digitalAvatarId: styleData.value.id, | |||||
| userImages: JSON.stringify([myImg]), | |||||
| title: styleData.value.title, | |||||
| }; | |||||
| const res2 = await createPhotoApi(data); | |||||
| console.log(res2); | |||||
| uni.navigateTo({ | |||||
| url: `/pages/created/index?id=${res2.data.id}`, | |||||
| }); | |||||
| uni.hideLoading(); | |||||
| } catch (error) { | |||||
| console.log(error); | |||||
| uni.hideLoading(); | |||||
| uni.showToast({ | |||||
| title: "生成失败,请重试", | |||||
| icon: "none", | |||||
| }); | |||||
| } | } | ||||
| } | } | ||||
| //#endregion --------------------- | //#endregion --------------------- | ||||