@@ -67,6 +67,7 @@ | |||||
"@dcloudio/uni-stacktracey": "3.0.0-3081220230817001", | "@dcloudio/uni-stacktracey": "3.0.0-3081220230817001", | ||||
"@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001", | "@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001", | ||||
"@vue/runtime-core": "^3.2.45", | "@vue/runtime-core": "^3.2.45", | ||||
"pinia-plugin-unistorage": "0.0.17", | |||||
"sass": "^1.68.0", | "sass": "^1.68.0", | ||||
"sass-loader": "^13.3.2", | "sass-loader": "^13.3.2", | ||||
"vite": "4.1.4" | "vite": "4.1.4" | ||||
@@ -85,6 +85,7 @@ let isShowCanvas = ref(true); | |||||
let isUpload = ref(false); | let isUpload = ref(false); | ||||
let modelUrl = ref(""); | let modelUrl = ref(""); | ||||
let modelId = ref(""); | |||||
let QRCodeUrl = ref(""); | let QRCodeUrl = ref(""); | ||||
let showQrCode = ref(false); | let showQrCode = ref(false); | ||||
@@ -213,7 +214,7 @@ const takePicture = () => { | |||||
const confirmPhoto = () => { | const confirmPhoto = () => { | ||||
if (UimgSrc.value) { | if (UimgSrc.value) { | ||||
uni.navigateTo({ | uni.navigateTo({ | ||||
url: `/pages/createing/index?imageUrl=${UimgSrc.value}`, | |||||
url: `/pages/createing/index?imageUrl=${UimgSrc.value}&id=${modelId.value}`, | |||||
}); | }); | ||||
} | } | ||||
}; | }; | ||||
@@ -280,6 +281,7 @@ const cancelUplaod = () => { | |||||
onLoad((options) => { | onLoad((options) => { | ||||
console.log(options, "options"); | console.log(options, "options"); | ||||
modelUrl.value = options.modelUrl; | modelUrl.value = options.modelUrl; | ||||
modelId.value = options.id; | |||||
}); | }); | ||||
onMounted(() => { | onMounted(() => { | ||||
@@ -60,6 +60,8 @@ onLoad(async (options) => { | |||||
// await getTemplateMsg(); | // await getTemplateMsg(); | ||||
await getSwiperList(); | await getSwiperList(); | ||||
await getSupperPhotoState(swiperList.value[0].id); | await getSupperPhotoState(swiperList.value[0].id); | ||||
uni.setStorageSync("createTimes", userInfoModulesPinia.createTimes); | |||||
}); | }); | ||||
onUnload(() => { | onUnload(() => { | ||||
clearTimeout(timer); | clearTimeout(timer); | ||||
@@ -195,12 +197,19 @@ watch( | |||||
//#endregion --------------------- | //#endregion --------------------- | ||||
//#region 退出登录 | //#region 退出登录 | ||||
function loginOut(params) { | |||||
uni.setStorageSync("token", null); | |||||
uni.setStorageSync("UserId", null); | |||||
uni.setStorageSync("phone", null); | |||||
uni.navigateTo({ | |||||
url: "/pages/login/index", | |||||
function loginOut() { | |||||
uni.showModal({ | |||||
title: "提示", | |||||
content: "是否退出登录?", | |||||
success: function (res) { | |||||
if (res.confirm) { | |||||
console.log("用户点击确定"); | |||||
userInfoModulesPinia.clearStorage(); | |||||
uni.navigateTo({ url: "/pages/login/index" }); | |||||
} else if (res.cancel) { | |||||
console.log("用户点击取消"); | |||||
} | |||||
}, | |||||
}); | }); | ||||
} | } | ||||
//#endregion --------------------- | //#endregion --------------------- | ||||
@@ -35,7 +35,18 @@ | |||||
<view class="mask" v-show="payMask"></view> | <view class="mask" v-show="payMask"></view> | ||||
<image :src="qrCode" mode="scaleToFill" /> | <image :src="qrCode" mode="scaleToFill" /> | ||||
</view> | </view> | ||||
<text>打开微信扫码登录小程序</text> | |||||
<text | |||||
v-show=" | |||||
userInfoModulesPinia.token && !userInfoModulesPinia.createTimes == 0 | |||||
" | |||||
>打开微信扫码登录小程序</text | |||||
> | |||||
<text | |||||
v-show=" | |||||
userInfoModulesPinia.token && userInfoModulesPinia.createTimes == 0 | |||||
" | |||||
>剩余生成次数不足,请扫码充值!</text | |||||
> | |||||
<text style="margin-top: 30rpx" v-show="payCount != 90" | <text style="margin-top: 30rpx" v-show="payCount != 90" | ||||
>{{ payCount }}秒后过期</text | >{{ payCount }}秒后过期</text | ||||
> | > | ||||
@@ -62,9 +73,15 @@ const userInfoModulesPinia = userInfoModules(); | |||||
//#region 初始化 | //#region 初始化 | ||||
const styleId = ref(null); | const styleId = ref(null); | ||||
const styleData = ref({}); | const styleData = ref({}); | ||||
onLoad((options) => { | |||||
const cameraImg = ref(null); | |||||
onLoad(async (options) => { | |||||
styleId.value = options.id; | styleId.value = options.id; | ||||
// getInfo(); | // getInfo(); | ||||
cameraImg.value = options.imageUrl; | |||||
if (options.imageUrl) { | |||||
await getInfo(); | |||||
createing2(); | |||||
} | |||||
}); | }); | ||||
onShow(() => { | onShow(() => { | ||||
getInfo(); | getInfo(); | ||||
@@ -90,6 +107,8 @@ async function createing1() { | |||||
if (!uni.getStorageSync("token")) { | if (!uni.getStorageSync("token")) { | ||||
showQrCode.value = true; | showQrCode.value = true; | ||||
return; | return; | ||||
} else if (uni.getStorageSync("createTimes") == 0) { | |||||
showQrCode.value = true; | |||||
} else { | } else { | ||||
toCamera(); | toCamera(); | ||||
} | } | ||||
@@ -101,8 +120,9 @@ async function createing2() { | |||||
mask: true, | mask: true, | ||||
}); | }); | ||||
// const res = await findImageApi(); | // 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"; | |||||
// let myImg = | |||||
// "https://suimang.oss-accelerate.aliyuncs.com/capi/2023-09-18/bd50b0024ea4470cbd391bcb00382f72.jpg?x-oss-process=image/resize,w_10000/quality,q_60"; | |||||
let myImg = cameraImg.value; | |||||
const data = { | const data = { | ||||
machineQrcodeId: uni.getStorageSync("UserId"), | machineQrcodeId: uni.getStorageSync("UserId"), | ||||
plat: uni.getStorageSync("plat"), | plat: uni.getStorageSync("plat"), | ||||
@@ -111,10 +131,15 @@ async function createing2() { | |||||
title: styleData.value.title, | title: styleData.value.title, | ||||
}; | }; | ||||
const res2 = await createPhotoApi(data); | const res2 = await createPhotoApi(data); | ||||
console.log(res2); | |||||
uni.navigateTo({ | |||||
url: `/pages/created/index?id=${res2.data.id}`, | |||||
}); | |||||
if (res2.data) { | |||||
console.log(res2); | |||||
userInfoModulesPinia.createTimes = userInfoModulesPinia.createTimes - 1; | |||||
uni.navigateTo({ | |||||
url: `/pages/created/index?id=${res2.data.id}`, | |||||
}); | |||||
} else { | |||||
throw new Error(); | |||||
} | |||||
uni.hideLoading(); | uni.hideLoading(); | ||||
} catch (error) { | } catch (error) { | ||||
console.log(error); | console.log(error); | ||||
@@ -283,8 +308,9 @@ onUnload(() => { | |||||
//#region 路由跳转 | //#region 路由跳转 | ||||
function toCamera() { | function toCamera() { | ||||
const url = styleData.value.coverImg; | const url = styleData.value.coverImg; | ||||
const id = styleData.value.id; | |||||
uni.navigateTo({ | uni.navigateTo({ | ||||
url: `/pages/camera/index?modelUrl=${url}`, | |||||
url: `/pages/camera/index?modelUrl=${url}&id=${id}`, | |||||
}); | }); | ||||
} | } | ||||
//#endregion --------------------- | //#endregion --------------------- | ||||
@@ -1,10 +1,10 @@ | |||||
import { createPinia } from 'pinia' | import { createPinia } from 'pinia' | ||||
import * as Pinia from 'pinia' | import * as Pinia from 'pinia' | ||||
// import { createUnistorage } from 'pinia-plugin-unistorage' | |||||
import { createUnistorage } from 'pinia-plugin-unistorage' | |||||
// import { createPersistedState } from 'pinia-plugin-persistedstate' | // import { createPersistedState } from 'pinia-plugin-persistedstate' | ||||
const store = createPinia(); | const store = createPinia(); | ||||
// const store = Pinia.createPinia() | // const store = Pinia.createPinia() | ||||
// store.use(createUnistorage()) | |||||
store.use(createUnistorage()) | |||||
export { store, Pinia }; | export { store, Pinia }; |
@@ -40,6 +40,8 @@ export const userInfoModules = defineStore("userInfoStore", () => { | |||||
uni.setStorageSync("phone", null); | uni.setStorageSync("phone", null); | ||||
} | } | ||||
return { token, phone, createTimes, clearStorage }; | return { token, phone, createTimes, clearStorage }; | ||||
} | |||||
}, | |||||
{ | |||||
unistorage: true, | |||||
} | |||||
); | ); |
@@ -3581,6 +3581,13 @@ pify@^2.3.0: | |||||
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" | resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" | ||||
integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== | integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== | ||||
pinia-plugin-unistorage@0.0.17: | |||||
version "0.0.17" | |||||
resolved "https://registry.yarnpkg.com/pinia-plugin-unistorage/-/pinia-plugin-unistorage-0.0.17.tgz#b237d1146069c400b5b81ac5dac0467e3d07db68" | |||||
integrity sha512-Oo4KTWyZP+7/fRRGG5ACoFIBZznEgFt8SPSOcg99t5NHzFP1wSTAfgl25eRr7Tv11pkWyzgZSa3oMGVIBBs1MA== | |||||
dependencies: | |||||
pinia "^2.0.33" | |||||
pinia@2.0.33: | pinia@2.0.33: | ||||
version "2.0.33" | version "2.0.33" | ||||
resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.0.33.tgz#b70065be697874d5824e9792f59bd5d87ddb5e7d" | resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.0.33.tgz#b70065be697874d5824e9792f59bd5d87ddb5e7d" | ||||
@@ -3589,6 +3596,14 @@ pinia@2.0.33: | |||||
"@vue/devtools-api" "^6.5.0" | "@vue/devtools-api" "^6.5.0" | ||||
vue-demi "*" | vue-demi "*" | ||||
pinia@^2.0.33: | |||||
version "2.1.6" | |||||
resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.1.6.tgz#e88959f14b61c4debd9c42d0c9944e2875cbe0fa" | |||||
integrity sha512-bIU6QuE5qZviMmct5XwCesXelb5VavdOWKWaB17ggk++NUwQWWbP5YnsONTk3b752QkW9sACiR81rorpeOMSvQ== | |||||
dependencies: | |||||
"@vue/devtools-api" "^6.5.0" | |||||
vue-demi ">=0.14.5" | |||||
pixelmatch@^4.0.2: | pixelmatch@^4.0.2: | ||||
version "4.0.2" | version "4.0.2" | ||||
resolved "https://registry.yarnpkg.com/pixelmatch/-/pixelmatch-4.0.2.tgz#8f47dcec5011b477b67db03c243bc1f3085e8854" | resolved "https://registry.yarnpkg.com/pixelmatch/-/pixelmatch-4.0.2.tgz#8f47dcec5011b477b67db03c243bc1f3085e8854" | ||||
@@ -4196,7 +4211,7 @@ vite@4.1.4: | |||||
optionalDependencies: | optionalDependencies: | ||||
fsevents "~2.3.2" | fsevents "~2.3.2" | ||||
vue-demi@*: | |||||
vue-demi@*, vue-demi@>=0.14.5: | |||||
version "0.14.6" | version "0.14.6" | ||||
resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.14.6.tgz#dc706582851dc1cdc17a0054f4fec2eb6df74c92" | resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.14.6.tgz#dc706582851dc1cdc17a0054f4fec2eb6df74c92" | ||||
integrity sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w== | integrity sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w== | ||||