@@ -1,161 +0,0 @@ | |||||
<template> | |||||
<div class="page"> | |||||
<u-list class="styleListBox" @scrolltolower="scrolltolower"> | |||||
<u-list-item class="glodYBox"> | |||||
<u-list-item | |||||
v-for="item in styleList" | |||||
:key="item.id" | |||||
class="styleListBoxItme" | |||||
> | |||||
<view class="styleInfo" @click="createPhoto(item.id)"> | |||||
<image :src="item.coverImg" mode="aspectFit" /> | |||||
<text class="name">{{ item.title }}</text> | |||||
<text class="single">{{ peopleNum(item.mouldType) }}</text> | |||||
</view> | |||||
</u-list-item> | |||||
</u-list-item> | |||||
</u-list> | |||||
</div> | |||||
</template> | |||||
<script setup> | |||||
//#region 导入 | |||||
import { onPullDownRefresh } from "@dcloudio/uni-app"; | |||||
import { ref, reactive } from "vue"; | |||||
import { getListApi } from "../../api/closeStyle"; | |||||
//#endregion | |||||
//#region 下拉刷新 | |||||
onPullDownRefresh(async () => { | |||||
uni.showLoading({ | |||||
title: "加载中...", | |||||
mask: true, | |||||
}); | |||||
pageNum.value = 1; | |||||
pageSize.value = 8; | |||||
styleList.value = []; | |||||
await getList(); | |||||
uni.hideLoading(); | |||||
uni.stopPullDownRefresh(); | |||||
}); | |||||
//#endregion | |||||
//#region 列表加载 | |||||
const pageNum = ref(1); | |||||
const pageSize = ref(8); | |||||
const styleList = ref([]); | |||||
// 得到列表 | |||||
async function getList() { | |||||
try { | |||||
const res = await getListApi(pageNum.value, pageSize.value); | |||||
styleList.value = res.data.list; | |||||
} catch (error) { | |||||
uni.showToast({ | |||||
title: "获取列表失败,请重试", | |||||
icon: "none", | |||||
}); | |||||
} | |||||
} | |||||
getList(); | |||||
// 触底加载更多 | |||||
const scrolltolower = async () => { | |||||
try { | |||||
pageNum.value += 1; | |||||
const res = await getListApi(pageNum.value, pageSize.value); | |||||
if (res.data.list.length == 0) { | |||||
pageNum.value -= 1; | |||||
uni.showToast({ | |||||
title: "已加载全部内容", | |||||
icon: "none", | |||||
}); | |||||
} | |||||
styleList.value.push(...res.data.list); | |||||
} catch (error) { | |||||
uni.showToast({ | |||||
title: "获取数据失败,请重试", | |||||
icon: "none", | |||||
}); | |||||
} | |||||
}; | |||||
// 处理单人双人多人 | |||||
function peopleNum(num) { | |||||
if (num == 1) { | |||||
return "单人"; | |||||
} else if (num == 2) { | |||||
return "双人"; | |||||
} else if (num == 3) { | |||||
return "三人"; | |||||
} | |||||
} | |||||
//#endregion --------------------- | |||||
//#region 点击图片 | |||||
function createPhoto(id) { | |||||
uni.navigateTo({ | |||||
url: `/pages/closeStyle/goCreatePhoto?id=${id}`, | |||||
}); | |||||
} | |||||
//#endregion --------------------- | |||||
</script> | |||||
<style lang="scss"> | |||||
.page { | |||||
height: 100vh; | |||||
overflow: hidden; | |||||
background-color: #222527; | |||||
} | |||||
.u-list { | |||||
width: 650rpx; | |||||
.glodYBox { | |||||
display: flex !important; | |||||
flex-direction: row !important; | |||||
flex-wrap: wrap !important; | |||||
justify-content: space-between !important; | |||||
} | |||||
.u-list-item { | |||||
display: flex !important; | |||||
flex-direction: row !important; | |||||
flex-wrap: wrap !important; | |||||
justify-content: space-between !important; | |||||
} | |||||
.styleInfo { | |||||
position: relative; | |||||
display: flex !important; | |||||
flex-wrap: wrap !important; | |||||
width: 300rpx; | |||||
height: 480rpx; | |||||
margin-bottom: 50rpx; | |||||
border-radius: 24rpx; | |||||
overflow: hidden; | |||||
image { | |||||
width: 300rpx; | |||||
height: 400rpx; | |||||
} | |||||
.name { | |||||
background-color: #393b3d; | |||||
width: 100%; | |||||
height: 80rpx; | |||||
text-align: center; | |||||
line-height: 80rpx; | |||||
font-size: 30rpx; | |||||
font-weight: bold; | |||||
} | |||||
.single { | |||||
position: absolute; | |||||
top: 11rpx; | |||||
right: 13rpx; | |||||
width: 72rpx; | |||||
height: 41rpx; | |||||
text-align: center; | |||||
line-height: 41rpx; | |||||
background: rgba(0, 0, 0, 0.4); | |||||
font-size: 22rpx; | |||||
// opacity: 0.4; | |||||
border-radius: 12rpx; | |||||
} | |||||
} | |||||
} | |||||
</style> |
@@ -95,8 +95,8 @@ async function createing(id) { | |||||
}; | }; | ||||
const res2 = await createPhotoApi(data); | const res2 = await createPhotoApi(data); | ||||
console.log(res2); | console.log(res2); | ||||
uni.reLaunch({ | |||||
url: `/pages/createing/index?id=${res2.data.id}`, | |||||
uni.navigateTo({ | |||||
url: `/pages/lookPhoto/index?id=${res2.data.id}`, | |||||
}); | }); | ||||
uni.hideLoading(); | uni.hideLoading(); | ||||
} catch (error) { | } catch (error) { | ||||
@@ -1,253 +0,0 @@ | |||||
<template> | |||||
<view class="page"> | |||||
<view class="showImgBox imgContenBox" | |||||
><image :src="styleData.coverImg" | |||||
/></view> | |||||
<text class="name">{{ styleData.title }}</text> | |||||
<view class="imgBox"> | |||||
<!-- 图一 --> | |||||
<view class="imgBoxItem" v-for="item in avatarList" :key="item.url"> | |||||
<image class="avatar" :src="item.url" mode="scaleToFill" /> | |||||
<view v-if="!item.url" class="noUrlBox">+</view> | |||||
<view | |||||
v-if="item.url && item.url != userInfoModulesPinia.myAvatar" | |||||
class="reUploadBtn" | |||||
>更换头像</view | |||||
> | |||||
<view v-if="!item.url" class="uploadBtn">上传头像</view> | |||||
</view> | |||||
<image | |||||
class="exchange" | |||||
src="../../assets/icon/exchange.png" | |||||
mode="scaleToFill" | |||||
/> | |||||
<!-- 图二 --> | |||||
<!-- <view class="imgBoxItem"> | |||||
<image | |||||
class="avatar" | |||||
src="../../assets/img/img2.png" | |||||
mode="scaleToFill" | |||||
/> | |||||
</view> | |||||
<image | |||||
class="exchange" | |||||
src="../../assets/icon/exchange.png" | |||||
mode="scaleToFill" | |||||
/> --> | |||||
<!-- 图三 --> | |||||
<!-- <view class="imgBoxItem"> | |||||
<image | |||||
class="avatar" | |||||
src="../../assets/img/img3.png" | |||||
mode="scaleToFill" | |||||
/> | |||||
</view> --> | |||||
</view> | |||||
<text class="tips">人物头像对应模板任务位置,点击按钮可以调整顺序</text> | |||||
<view class="orangeBtn" @click="createing(styleData.id)" | |||||
>开始制作写真 | |||||
<view class="free"> | |||||
<text>耗金币2枚</text> | |||||
</view> | |||||
</view> | |||||
<view class="balance" | |||||
>金币余额: 30 | |||||
<image src="../../assets/icon/coin.png" mode="aspectFit" /> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script setup> | |||||
//#region 导入 | |||||
import { ref, reactive } from "vue"; | |||||
import { onLoad } from "@dcloudio/uni-app"; | |||||
import { | |||||
findByIdApi, | |||||
findImageApi, | |||||
createPhotoApi, | |||||
} from "../../api/closeStyle"; | |||||
import { userInfoModules } from "@/store/modules/userInfo"; | |||||
//#endregion | |||||
const userInfoModulesPinia = userInfoModules(); | |||||
//#region 初始化 | |||||
const styleId = ref(null); | |||||
const styleData = ref({}); | |||||
onLoad((options) => { | |||||
// styleId.value = options.id; | |||||
// styleId.value = "857147862095679488"; | |||||
styleId.value = "246"; | |||||
getInfo(); | |||||
}); | |||||
async function getInfo() { | |||||
try { | |||||
const res = await findByIdApi(styleId.value); | |||||
console.log(res); | |||||
styleData.value = res.data; | |||||
} catch (error) { | |||||
uni.showToast({ | |||||
title: "获取数据失败,请重试", | |||||
icon: "none", | |||||
}); | |||||
} | |||||
} | |||||
//#endregion --------------------- | |||||
//#region 上传图片 | |||||
const avatarList = ref([ | |||||
{ | |||||
url: userInfoModulesPinia.myAvatar, | |||||
isMyAvatar: true, | |||||
}, | |||||
{ | |||||
url: "", | |||||
isMyAvatar: false, | |||||
}, | |||||
{ | |||||
url: "", | |||||
isMyAvatar: false, | |||||
}, | |||||
]); | |||||
//#endregion --------------------- | |||||
//#region 生成写真照片 | |||||
async function createing(id) { | |||||
try { | |||||
const res = await findImageApi(); | |||||
console.log(res); | |||||
let myImg = res.data.image; | |||||
const data = { | |||||
digitalAvatarId: id, | |||||
userImages: JSON.stringify([myImg]), | |||||
}; | |||||
const res2 = await createPhotoApi(data); | |||||
console.log(res2); | |||||
uni.navigateTo({ | |||||
url: `/pages/createing/index?id=${res2.data.id}`, | |||||
}); | |||||
} catch (error) { | |||||
console.log(error); | |||||
uni.showToast({ | |||||
title: "生成失败,请重试", | |||||
icon: "none", | |||||
}); | |||||
} | |||||
} | |||||
//#endregion --------------------- | |||||
//#region | |||||
//#endregion --------------------- | |||||
</script> | |||||
<style lang="scss"> | |||||
.page { | |||||
background-color: rgba(24, 25, 26, 1); | |||||
} | |||||
.showImgBox { | |||||
margin-top: 30rpx; | |||||
width: 360rpx; | |||||
height: 480rpx; | |||||
// background-color: #ccc; | |||||
border-radius: 30rpx; | |||||
image { | |||||
width: 100%; | |||||
height: 100%; | |||||
border-radius: 30rpx; | |||||
} | |||||
} | |||||
.name { | |||||
margin-top: 70rpx; | |||||
margin-bottom: 47rpx; | |||||
font-size: 44rpx; | |||||
font-weight: 800; | |||||
} | |||||
.imgBox { | |||||
margin-bottom: 40rpx; | |||||
width: 100%; | |||||
// height: 180rpx; | |||||
display: flex; | |||||
justify-content: space-between; | |||||
align-items: flex-start; | |||||
.exchange { | |||||
width: 60rpx; | |||||
height: 60rpx; | |||||
margin-top: 67rpx; | |||||
margin-left: 180rpx; | |||||
} | |||||
.imgBoxItem { | |||||
position: relative; | |||||
width: 180rpx; | |||||
height: 250rpx; | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
.avatar { | |||||
position: absolute; | |||||
width: 180rpx; | |||||
height: 180rpx; | |||||
} | |||||
.noUrlBox { | |||||
position: absolute; | |||||
width: 180rpx; | |||||
height: 180rpx; | |||||
line-height: 180rpx; | |||||
color: #ff4f00; | |||||
font-size: 50rpx; | |||||
font-weight: 900; | |||||
text-align: center; | |||||
border-radius: 24rpx; | |||||
background-color: #393a3d; | |||||
} | |||||
.reUploadBtn, | |||||
.uploadBtn { | |||||
margin-top: 200rpx; | |||||
width: 150rpx; | |||||
height: 50rpx; | |||||
text-align: center; | |||||
line-height: 50rpx; | |||||
border-radius: 50rpx; | |||||
background-color: #383a3c; | |||||
} | |||||
} | |||||
} | |||||
.tips { | |||||
margin-top: 40rpx; | |||||
font-size: 22rpx; | |||||
} | |||||
.orangeBtn { | |||||
position: relative; | |||||
margin-top: 60rpx; | |||||
.free { | |||||
position: absolute; | |||||
top: -18rpx; | |||||
right: -70rpx; | |||||
width: 142rpx; | |||||
height: 50rpx; | |||||
background-color: #000; | |||||
border-radius: 25rpx 25rpx 25rpx 0; | |||||
font-size: 22rpx; | |||||
font-weight: 900; | |||||
line-height: 50rpx; | |||||
text-align: center; | |||||
} | |||||
} | |||||
.balance { | |||||
display: inline-block; | |||||
margin-top: 70rpx; | |||||
font-size: 30rpx; | |||||
font-weight: bold; | |||||
line-height: 33rpx; | |||||
image { | |||||
display: inline-block; | |||||
width: 33rpx; | |||||
height: 33rpx; | |||||
vertical-align: middle; | |||||
} | |||||
} | |||||
</style> |
@@ -1,235 +0,0 @@ | |||||
<template> | |||||
<view class="page"> | |||||
<view class="showImgBox imgContenBox" | |||||
><image :src="styleData.coverImg" | |||||
/></view> | |||||
<text class="name">{{ styleData.title }}</text> | |||||
<view class="imgBox"> | |||||
<!-- 图一 --> | |||||
<view class="imgBoxItem"> | |||||
<image | |||||
class="avatar" | |||||
src="../../assets/img/img1.png" | |||||
mode="scaleToFill" | |||||
/> | |||||
</view> | |||||
<image | |||||
class="exchange" | |||||
src="../../assets/icon/exchange.png" | |||||
mode="scaleToFill" | |||||
/> | |||||
<!-- 图二 --> | |||||
<view class="imgBoxItem"> | |||||
<image | |||||
class="avatar" | |||||
src="../../assets/img/img2.png" | |||||
mode="scaleToFill" | |||||
/> | |||||
<view class="reUploadBtn">更换头像</view> | |||||
</view> | |||||
<image | |||||
class="exchange" | |||||
src="../../assets/icon/exchange.png" | |||||
mode="scaleToFill" | |||||
/> | |||||
<!-- 图三 --> | |||||
<view class="imgBoxItem"> | |||||
<image | |||||
class="avatar" | |||||
src="../../assets/img/img3.png" | |||||
mode="scaleToFill" | |||||
/> | |||||
<view class="uploadBtn">上传头像</view> | |||||
</view> | |||||
</view> | |||||
<text class="tips">人物头像对应模板任务位置,点击按钮可以调整顺序</text> | |||||
<view class="orangeBtn" @click="createing(styleData.id)" | |||||
>开始制作写真 | |||||
<view class="free"> | |||||
<text>耗金币2枚</text> | |||||
</view> | |||||
</view> | |||||
<view class="balance" | |||||
>金币余额: 30 | |||||
<image src="../../assets/icon/coin.png" mode="aspectFit" /> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script setup> | |||||
//#region 导入 | |||||
import { ref, reactive } from "vue"; | |||||
import { onLoad } from "@dcloudio/uni-app"; | |||||
import { | |||||
findByIdApi, | |||||
findImageApi, | |||||
createPhotoApi, | |||||
} from "../../api/closeStyle"; | |||||
import { userInfoModules } from "@/store/modules/userInfo"; | |||||
//#endregion | |||||
const userInfoModulesPinia = userInfoModules(); | |||||
//#region 初始化 | |||||
const styleId = ref(null); | |||||
const styleData = ref({}); | |||||
onLoad((options) => { | |||||
// styleId.value = options.id; | |||||
// styleId.value = "857147862095679488"; | |||||
styleId.value = "246"; | |||||
getInfo(); | |||||
}); | |||||
async function getInfo() { | |||||
try { | |||||
const res = await findByIdApi(styleId.value); | |||||
console.log(res); | |||||
styleData.value = res.data; | |||||
} catch (error) { | |||||
uni.showToast({ | |||||
title: "获取数据失败,请重试", | |||||
icon: "none", | |||||
}); | |||||
} | |||||
} | |||||
//#endregion --------------------- | |||||
//#region 上传图片 | |||||
const avatarList = ref([ | |||||
{ | |||||
url: userInfoModulesPinia.myAvatar, | |||||
isMyAvatar: true, | |||||
}, | |||||
{ | |||||
url: "", | |||||
isMyAvatar: false, | |||||
}, | |||||
{ | |||||
url: "", | |||||
isMyAvatar: false, | |||||
}, | |||||
]); | |||||
//#endregion --------------------- | |||||
//#region 生成写真照片 | |||||
async function createing(id) { | |||||
try { | |||||
const res = await findImageApi(); | |||||
console.log(res); | |||||
let myImg = res.data.image; | |||||
const data = { | |||||
digitalAvatarId: id, | |||||
userImages: JSON.stringify([myImg]), | |||||
}; | |||||
const res2 = await createPhotoApi(data); | |||||
console.log(res2); | |||||
uni.navigateTo({ | |||||
url: `/pages/createing/index?id=${res2.data.id}`, | |||||
}); | |||||
} catch (error) { | |||||
console.log(error); | |||||
uni.showToast({ | |||||
title: "生成失败,请重试", | |||||
icon: "none", | |||||
}); | |||||
} | |||||
} | |||||
//#endregion --------------------- | |||||
//#region | |||||
//#endregion --------------------- | |||||
</script> | |||||
<style lang="scss"> | |||||
.page { | |||||
background-color: rgba(24, 25, 26, 1); | |||||
} | |||||
.showImgBox { | |||||
margin-top: 30rpx; | |||||
width: 360rpx; | |||||
height: 480rpx; | |||||
// background-color: #ccc; | |||||
border-radius: 30rpx; | |||||
image { | |||||
width: 100%; | |||||
height: 100%; | |||||
border-radius: 30rpx; | |||||
} | |||||
} | |||||
.name { | |||||
margin-top: 70rpx; | |||||
margin-bottom: 47rpx; | |||||
font-size: 44rpx; | |||||
font-weight: 800; | |||||
} | |||||
.imgBox { | |||||
margin-bottom: 40rpx; | |||||
width: 100%; | |||||
// height: 180rpx; | |||||
display: flex; | |||||
justify-content: space-between; | |||||
align-items: flex-start; | |||||
.exchange { | |||||
width: 60rpx; | |||||
height: 60rpx; | |||||
margin-top: 67rpx; | |||||
} | |||||
.imgBoxItem { | |||||
position: relative; | |||||
width: 180rpx; | |||||
height: 250rpx; | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
.avatar { | |||||
position: absolute; | |||||
width: 180rpx; | |||||
height: 180rpx; | |||||
} | |||||
.reUploadBtn, | |||||
.uploadBtn { | |||||
margin-top: 200rpx; | |||||
width: 150rpx; | |||||
height: 50rpx; | |||||
text-align: center; | |||||
line-height: 50rpx; | |||||
border-radius: 50rpx; | |||||
background-color: #383a3c; | |||||
} | |||||
} | |||||
} | |||||
.tips { | |||||
font-size: 22rpx; | |||||
} | |||||
.orangeBtn { | |||||
position: relative; | |||||
margin-top: 60rpx; | |||||
.free { | |||||
position: absolute; | |||||
top: -18rpx; | |||||
right: -70rpx; | |||||
width: 142rpx; | |||||
height: 50rpx; | |||||
background-color: #000; | |||||
border-radius: 25rpx 25rpx 25rpx 0; | |||||
font-size: 22rpx; | |||||
font-weight: 900; | |||||
line-height: 50rpx; | |||||
text-align: center; | |||||
} | |||||
} | |||||
.balance { | |||||
display: inline-block; | |||||
margin-top: 70rpx; | |||||
font-size: 30rpx; | |||||
font-weight: bold; | |||||
line-height: 33rpx; | |||||
image { | |||||
display: inline-block; | |||||
width: 33rpx; | |||||
height: 33rpx; | |||||
vertical-align: middle; | |||||
} | |||||
} | |||||
</style> |
@@ -321,6 +321,7 @@ async function createing(id) { | |||||
myImgList.push(item.url); | myImgList.push(item.url); | ||||
}); | }); | ||||
const data = { | const data = { | ||||
title: styleData.value.title, | |||||
digitalAvatarId: id, | digitalAvatarId: id, | ||||
userImages: | userImages: | ||||
styleData.value.mouldType == 2 | styleData.value.mouldType == 2 | ||||
@@ -331,7 +332,7 @@ async function createing(id) { | |||||
console.log(res2); | console.log(res2); | ||||
uni.hideLoading(); | uni.hideLoading(); | ||||
uni.navigateTo({ | uni.navigateTo({ | ||||
url: `/pages/createing/index?id=${res2.data.id}`, | |||||
url: `/pages/lookPhoto/index?id=${res2.data.id}`, | |||||
}); | }); | ||||
} catch (error) { | } catch (error) { | ||||
console.log(error); | console.log(error); | ||||
@@ -7,31 +7,6 @@ | |||||
<view class="changeStyle" @click="changeStyle">更换风格</view> | <view class="changeStyle" @click="changeStyle">更换风格</view> | ||||
</view> | </view> | ||||
<!-- 轮播图 --> | <!-- 轮播图 --> | ||||
<!-- <u-swiper | |||||
v-if="createState == 2" | |||||
indicator | |||||
indicatorMode="dot" | |||||
:radius="30" | |||||
:autoplay="false" | |||||
:list="swiperList" | |||||
keyName="image" | |||||
@change="" | |||||
@click="" | |||||
></u-swiper> --> | |||||
<!-- <u-swiper | |||||
v-if="createState == 2" | |||||
height="320" | |||||
:list="swiperList" | |||||
keyName="image" | |||||
previousMargin="60" | |||||
nextMargin="60" | |||||
circular | |||||
indicator | |||||
indicatorMode="line" | |||||
:autoplay="false" | |||||
radius="5" | |||||
bgColor="#1f2123" | |||||
></u-swiper> --> | |||||
<u-swiper | <u-swiper | ||||
v-if="createState == 2" | v-if="createState == 2" | ||||
indicator | indicator | ||||
@@ -164,7 +164,6 @@ const userInfoModulesPinia = userInfoModules(); | |||||
const showPrivacy = ref(false); | const showPrivacy = ref(false); | ||||
console.log(userInfoModulesPinia.platForm); | |||||
const pageClass = computed(() => { | const pageClass = computed(() => { | ||||
if (userInfoModulesPinia.platForm == 1) { | if (userInfoModulesPinia.platForm == 1) { | ||||
return "page pageH5"; | return "page pageH5"; | ||||
@@ -391,9 +390,9 @@ async function loginByCode() { | |||||
icon: "none", | icon: "none", | ||||
}); | }); | ||||
} else { | } else { | ||||
uni.switchTab({ | |||||
url: "/pages/uploadPhoto/uploadPhoto", | |||||
}); | |||||
// uni.switchTab({ | |||||
// url: "/pages/uploadPhoto/uploadPhoto", | |||||
// }); | |||||
} | } | ||||
} catch (error) { | } catch (error) { | ||||
uni.hideLoading(); | uni.hideLoading(); | ||||
@@ -405,13 +404,14 @@ async function loginByCode() { | |||||
} | } | ||||
//#endregion --------------------- | //#endregion --------------------- | ||||
//#region 隐私协议 | |||||
const getPrivacySetting = (num) => { | const getPrivacySetting = (num) => { | ||||
const canIUsePrivacy = wx.canIUse("getPrivacySetting"); | const canIUsePrivacy = wx.canIUse("getPrivacySetting"); | ||||
console.log(canIUsePrivacy, "canIUse getPrivacySetting"); | |||||
// console.log(canIUsePrivacy, "canIUse getPrivacySetting"); | |||||
if (canIUsePrivacy) { | if (canIUsePrivacy) { | ||||
wx.getPrivacySetting({ | wx.getPrivacySetting({ | ||||
success: (res) => { | success: (res) => { | ||||
console.log(res, "getPrivacySetting"); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' } | |||||
// console.log(res, "getPrivacySetting"); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' } | |||||
if (res.needAuthorization) { | if (res.needAuthorization) { | ||||
// 需要弹出隐私协议 | // 需要弹出隐私协议 | ||||
showPrivacy.value = true; | showPrivacy.value = true; | ||||
@@ -419,9 +419,9 @@ const getPrivacySetting = (num) => { | |||||
// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口 | // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口 | ||||
if (num == 1) { | if (num == 1) { | ||||
// 返回token,直接跳转首页 | // 返回token,直接跳转首页 | ||||
uni.switchTab({ | |||||
url: "/pages/uploadPhoto/uploadPhoto", | |||||
}); | |||||
// uni.switchTab({ | |||||
// url: "/pages/uploadPhoto/uploadPhoto", | |||||
// }); | |||||
} else if (num == 2) { | } else if (num == 2) { | ||||
// 没有返回token,无事发生 | // 没有返回token,无事发生 | ||||
} | } | ||||
@@ -439,7 +439,7 @@ const closePrivacy = () => { | |||||
}; | }; | ||||
const handleAgreePrivacyAuthorization = () => { | const handleAgreePrivacyAuthorization = () => { | ||||
console.log("Privacy Agreed!"); | |||||
// console.log("Privacy Agreed!"); | |||||
showPrivacy.value = false; | showPrivacy.value = false; | ||||
// 用户同意隐私协议事件回调 | // 用户同意隐私协议事件回调 | ||||
// 用户点击了同意,之后所有已声明过的隐私接口和组件都可以调用了 | // 用户点击了同意,之后所有已声明过的隐私接口和组件都可以调用了 | ||||
@@ -453,20 +453,25 @@ const handleOpenPrivacyContract = () => { | |||||
complete: () => {}, | complete: () => {}, | ||||
}); | }); | ||||
}; | }; | ||||
//#endregion --------------------------------- | |||||
//#region | |||||
//#region 初始化 | //#region 初始化 | ||||
const urlUid = ref(""); //通过邀请来的会携带邀请人ID参数 | const urlUid = ref(""); //通过邀请来的会携带邀请人ID参数 | ||||
onLoad((options) => { | onLoad((options) => { | ||||
if (options.userId) { | |||||
// 二维码扫描进入时 | |||||
if (options.scene) { | |||||
const str = decodeURIComponent(options.scene); | |||||
const regex = /_u:(\d+)/; // 正则表达式匹配_u:后面的数字 | |||||
const match = str.match(regex); | |||||
urlUid.value = match[1]; | |||||
} | |||||
// 分享链接进入时 | |||||
else if (options.userId) { | |||||
urlUid.value = options.userId; | urlUid.value = options.userId; | ||||
uni.showToast({ | |||||
title: `Uid获取成功!(${options.userId})`, | |||||
icon: "none", | |||||
}); | |||||
} else { | } else { | ||||
urlUid.value = null; | urlUid.value = null; | ||||
} | } | ||||
console.log(urlUid.value, "邀请人id"); | |||||
uni.hideHomeButton(); | uni.hideHomeButton(); | ||||
// workId.value = options.id; | // workId.value = options.id; | ||||
@@ -2,6 +2,7 @@ | |||||
<view class="page"> | <view class="page"> | ||||
<!-- 轮播图 --> | <!-- 轮播图 --> | ||||
<u-swiper | <u-swiper | ||||
v-if="createState == 2" | |||||
indicator | indicator | ||||
indicatorMode="dot" | indicatorMode="dot" | ||||
circular | circular | ||||
@@ -12,7 +13,14 @@ | |||||
@change="getSwiperIndex" | @change="getSwiperIndex" | ||||
@click="previewImage" | @click="previewImage" | ||||
></u-swiper> | ></u-swiper> | ||||
<view class="checkMore">左右滑动查看更多</view> | |||||
<image | |||||
v-if="createState != 2" | |||||
class="logo" | |||||
src="../../assets/img/logo-4.png" | |||||
mode="scaleToFill" | |||||
/> | |||||
<view v-if="createState == 2" class="checkMore">左右滑动查看更多</view> | |||||
<view v-if="createState != 2" class="wait">生成中,请稍后...</view> | |||||
<!-- <view class="uploadBtn grayBtn"> | <!-- <view class="uploadBtn grayBtn"> | ||||
<text>我要让照片说话</text> | <text>我要让照片说话</text> | ||||
<view class="free"> | <view class="free"> | ||||
@@ -22,19 +30,22 @@ | |||||
<view @click="downloadImg" class="uploadBtn"> | <view @click="downloadImg" class="uploadBtn"> | ||||
<text>下载照片</text> | <text>下载照片</text> | ||||
</view> | </view> | ||||
<!-- <view class="grayBtn" @click="photoSupper"> | |||||
<view v-if="supperPhotoState == 0 || supperPhotoState == 3" class="free"> | |||||
<view class="grayBtn" @click="goChooseStyle"> | |||||
重新生成 | |||||
<!-- <view v-if="supperPhotoState == 0 || supperPhotoState == 3" class="free"> | |||||
<text>耗金币1枚</text> | <text>耗金币1枚</text> | ||||
</view> | </view> | ||||
{{ supperTips() }} | |||||
</view> --> | |||||
{{ supperTips() }} --> | |||||
</view> | |||||
<!-- 底部 --> | <!-- 底部 --> | ||||
<view class="bottomBox"> | <view class="bottomBox"> | ||||
<view class="tips"> | |||||
<view v-if="createState == 2" class="tips"> | |||||
<text>邀请好友可获得2枚金币</text> | <text>邀请好友可获得2枚金币</text> | ||||
</view> | </view> | ||||
<button open-type="share" class="shareBtn">分享</button> | <button open-type="share" class="shareBtn">分享</button> | ||||
<view class="shareBtn" @click="getUserQrcode">邀请好友</view> | |||||
<view v-if="createState == 2" class="shareBtn" @click="getUserQrcode" | |||||
>邀请好友</view | |||||
> | |||||
<view class="shareBtn" @click="buyCoin">金币充值</view> | <view class="shareBtn" @click="buyCoin">金币充值</view> | ||||
</view> | </view> | ||||
<!-- 画报 --> | <!-- 画报 --> | ||||
@@ -61,6 +72,7 @@ import { | |||||
//#endregion | //#endregion | ||||
const userInfoModulesPinia = userInfoModules(); | const userInfoModulesPinia = userInfoModules(); | ||||
//#region 轮播图 | //#region 轮播图 | ||||
const createState = ref(null); //制作状态:1生成中,2完成,3失败 | |||||
const workId = ref(null); //作品id | const workId = ref(null); //作品id | ||||
onLoad(async (options) => { | onLoad(async (options) => { | ||||
workId.value = options.id; | workId.value = options.id; | ||||
@@ -72,15 +84,17 @@ const previewImageList = ref([]); //预览图片列表 | |||||
async function getSwiperList() { | async function getSwiperList() { | ||||
const res = await getPhotoListApi(workId.value); | const res = await getPhotoListApi(workId.value); | ||||
console.log(res.data.photoList); | |||||
swiperList.value = res.data.photoList; | |||||
swiperList.value.forEach((item) => { | |||||
if (item.imageSuper) { | |||||
previewImageList.value.push(item.imageSuper); | |||||
} else { | |||||
previewImageList.value.push(item.image); | |||||
} | |||||
}); | |||||
createState.value = res.data.status; | |||||
if (res.data.photoList) { | |||||
swiperList.value = res.data.photoList; | |||||
swiperList.value.forEach((item) => { | |||||
if (item.imageSuper) { | |||||
previewImageList.value.push(item.imageSuper); | |||||
} else { | |||||
previewImageList.value.push(item.image); | |||||
} | |||||
}); | |||||
} | |||||
} | } | ||||
//#endregion --------------------- | //#endregion --------------------- | ||||
@@ -246,6 +260,11 @@ function buyCoin() { | |||||
}); | }); | ||||
} | } | ||||
} | } | ||||
function goChooseStyle() { | |||||
uni.navigateTo({ | |||||
url: "/pages/closeStyle/closeStyle", | |||||
}); | |||||
} | |||||
//#endregion --------------------- | //#endregion --------------------- | ||||
//#region 超分相关 | //#region 超分相关 | ||||
@@ -402,7 +421,13 @@ async function getUserQrcode() { | |||||
} | } | ||||
} | } | ||||
.checkMore { | |||||
.logo { | |||||
width: 520rpx; | |||||
margin: 90rpx; | |||||
} | |||||
.checkMore, | |||||
.wait { | |||||
color: #ffffff; | color: #ffffff; | ||||
margin-top: 30rpx; | margin-top: 30rpx; | ||||
} | } | ||||
@@ -411,7 +436,6 @@ async function getUserQrcode() { | |||||
.uploadBtn { | .uploadBtn { | ||||
position: relative; | position: relative; | ||||
margin-top: 100rpx; | margin-top: 100rpx; | ||||
margin-bottom: 200rpx; | |||||
width: 520rpx; | width: 520rpx; | ||||
height: 100rpx; | height: 100rpx; | ||||
line-height: 100rpx; | line-height: 100rpx; | ||||
@@ -455,6 +479,7 @@ async function getUserQrcode() { | |||||
} | } | ||||
} | } | ||||
.grayBtn { | .grayBtn { | ||||
margin-bottom: 220rpx; | |||||
.free { | .free { | ||||
position: absolute; | position: absolute; | ||||
color: #fff; | color: #fff; | ||||
@@ -477,7 +502,7 @@ async function getUserQrcode() { | |||||
bottom: 60rpx; | bottom: 60rpx; | ||||
width: 100%; | width: 100%; | ||||
display: flex; | display: flex; | ||||
justify-content: space-between; | |||||
justify-content: space-evenly; | |||||
padding: 65rpx 40rpx 0; | padding: 65rpx 40rpx 0; | ||||
.tips { | .tips { | ||||
position: absolute; | position: absolute; | ||||
@@ -22,15 +22,15 @@ | |||||
<!-- 上传按钮 --> | <!-- 上传按钮 --> | ||||
<image | <image | ||||
class="addImg" | class="addImg" | ||||
v-show="!showImgUrl" | |||||
v-show="!showImgUrl && !userInfoModulesPinia.myAvatar" | |||||
src="../../assets/icon/add.png" | src="../../assets/icon/add.png" | ||||
alt="" | alt="" | ||||
/> | /> | ||||
<!-- @click.prevent="chooseImage" --> | <!-- @click.prevent="chooseImage" --> | ||||
<image | <image | ||||
class="showImg" | class="showImg" | ||||
v-show="showImgUrl" | |||||
:src="showImgUrl" | |||||
v-show="showImgUrl || userInfoModulesPinia.myAvatar" | |||||
:src="showImgUrl ? showImgUrl : userInfoModulesPinia.myAvatar" | |||||
alt="" | alt="" | ||||
mode="aspectFit" | mode="aspectFit" | ||||
/> | /> | ||||
@@ -2,7 +2,7 @@ export default { | |||||
onShareAppMessage() { | onShareAppMessage() { | ||||
return { | return { | ||||
title: "邃芒智像", | title: "邃芒智像", | ||||
path: `/pages/login/index?type=in&userId=${uni.getStorageSync('userId')}`, | |||||
path: `/pages/login/index?userId=${uni.getStorageSync('userId')}`, | |||||
}; | }; | ||||
}, | }, | ||||
@@ -11,7 +11,7 @@ export default { | |||||
onShareTimeline() { | onShareTimeline() { | ||||
return { | return { | ||||
title: "邃芒智像", | title: "邃芒智像", | ||||
path: `/pages/login/index?type=in&userId=${uni.getStorageSync('userId')}`, | |||||
path: `/pages/login/index?userId=${uni.getStorageSync('userId')}`, | |||||
}; | }; | ||||
}, | }, | ||||