Просмотр исходного кода

Merge remote-tracking branch 'origin/dev_czc' into dev

master
congzc 1 год назад
Родитель
Сommit
87face1742
1 измененных файлов: 28 добавлений и 3 удалений
  1. +28
    -3
      src/pages/closeStyle/goCreatePhoto.vue

+ 28
- 3
src/pages/closeStyle/goCreatePhoto.vue Просмотреть файл

@@ -12,11 +12,11 @@
>开始制作写真 >开始制作写真
<view class="free"> <view class="free">
<image src="../../assets/icon/blackBG.png" mode="aspectFit" /> <image src="../../assets/icon/blackBG.png" mode="aspectFit" />
<text>耗金币2枚</text>
<text>耗金币{{ needCoin }}枚</text>
</view> </view>
</view> </view>
<view class="balance" <view class="balance"
>金币余额:&nbsp;&nbsp;30
>金币余额:&nbsp;&nbsp;{{ userInfoModulesPinia.myGlod }}
<image src="../../assets/icon/coin.png" mode="aspectFit" /> <image src="../../assets/icon/coin.png" mode="aspectFit" />
</view> </view>
</view> </view>
@@ -31,6 +31,9 @@ import {
findImageApi, findImageApi,
createPhotoApi, createPhotoApi,
} from "../../api/closeStyle"; } from "../../api/closeStyle";
import { findGlodApi } from "../../api/home";
import { userInfoModules } from "@/store/modules/userInfo";
const userInfoModulesPinia = userInfoModules();
//#endregion //#endregion
//#region 初始化 //#region 初始化
@@ -39,10 +42,24 @@ const styleData = ref({});
onLoad((options) => { onLoad((options) => {
styleId.value = options.id; styleId.value = options.id;
getInfo(); getInfo();
getMyCoin();
}); });
// 查询我的金币
async function getMyCoin() {
const res4 = await findGlodApi();
if (!res4.data) {
userInfoModulesPinia.myGlod = 0;
} else {
userInfoModulesPinia.myGlod = res4.data.digitalAvatarGlod
? res4.data.digitalAvatarGlod
: 0;
}
}
const needCoin = ref(""); //模版消耗金币
async function getInfo() { async function getInfo() {
try { try {
const res = await findByIdApi(styleId.value); const res = await findByIdApi(styleId.value);
needCoin.value = res.data.salePrice;
console.log(res); console.log(res);
styleData.value = res.data; styleData.value = res.data;
} catch (error) { } catch (error) {
@@ -54,15 +71,23 @@ async function getInfo() {
} }
//#endregion --------------------- //#endregion ---------------------
//#region 生成写真照片 //#region 生成写真照片
async function createing(id) { async function createing(id) {
if (needCoin.value > userInfoModulesPinia.myGlod) {
uni.showToast({
title: "金币不足,请充值",
icon: "none",
});
return;
}
try { try {
uni.showLoading({ uni.showLoading({
title: "加载中...", title: "加载中...",
mask: true, mask: true,
}); });
const res = await findImageApi(); const res = await findImageApi();
console.log(res);
let myImg = res.data.image; let myImg = res.data.image;
const data = { const data = {
digitalAvatarId: id, digitalAvatarId: id,


Загрузка…
Отмена
Сохранить