@@ -1,8 +1,13 @@ | |||
# Suimang-wxapp | |||
# setStorageSync 键名 | |||
userId --用户id,用于邀请分享功能 | |||
loginAwardCoin --注册奖励金币 | |||
inviteAwardCoin --邀请奖励金币 | |||
plat --根据平台不同来返回的值,用于发送请求 1为微信,2为抖音 | |||
"appid": "wx75cf14e3a0d45821", | |||
wx-"appid": "wx75cf14e3a0d45821", | |||
git commit -m "feat: " | |||
git commit --no-verify -m "提交时的注释" 跳过检验 |
@@ -10,7 +10,6 @@ import { findImageApi, findGlodApi } from "./api/home"; | |||
const userInfoModulesPinia = userInfoModules(); | |||
onLaunch(() => { | |||
console.log("App Launch!"); | |||
// 获取平台及系统信息 | |||
uni.getSystemInfo({ | |||
success: function (res) { | |||
@@ -19,8 +18,10 @@ onLaunch(() => { | |||
if (res.uniPlatform == "web") { | |||
uniPlatform = 1; | |||
} else if (res.uniPlatform == "mp-weixin") { | |||
uni.setStorageSync("plat", 1); | |||
uniPlatform = 2; | |||
} else if (res.uniPlatform == "mp-toutiao") { | |||
uni.setStorageSync("plat", 3); | |||
uniPlatform = 3; | |||
} | |||
if (res.osName == "windows") { | |||
@@ -41,6 +42,26 @@ onLaunch(() => { | |||
console.log(res.osName, osName, "System"); | |||
}, | |||
}); | |||
// uni.setStorageSync("userId", "114514"); | |||
const updateManager = uni.getUpdateManager(); | |||
updateManager.onUpdateReady(function (res) { | |||
uni.showModal({ | |||
title: "更新提示", | |||
content: "有新的版本哦,请重启小程序应用更新", | |||
showCancel: false, | |||
confirmText: "立刻重启", | |||
confirmColor: "#ff4f00", | |||
success(res) { | |||
if (res.confirm) { | |||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 | |||
updateManager.applyUpdate(); | |||
} | |||
}, | |||
}); | |||
}); | |||
}); | |||
onShow(() => { | |||
console.log("App Show!"); | |||
@@ -1,9 +1,9 @@ | |||
import request from "../utils/request" | |||
import { request } from "../utils/request" | |||
// 获取风格列表 | |||
export function getListApi(pageNum, pageSize) { | |||
export function getListApi(pageNum, pageSize, sex) { | |||
return request({ | |||
url: `api/digitalAvatarMould/list?pageNum=${pageNum}&pageSize=${pageSize}`, | |||
url: `api/digitalAvatarMould/list?pageNum=${pageNum}&pageSize=${pageSize}&sex=${sex}`, | |||
method: 'GET', | |||
}) | |||
} | |||
@@ -1,4 +1,4 @@ | |||
import request from "../utils/request" | |||
import { request } from "../utils/request" | |||
/** | |||
* @description:获取金币价格列表 | |||
@@ -45,9 +45,9 @@ export function createPay(data) { | |||
* @param orderNumber | |||
* @return: data | |||
*/ | |||
export function getOrderStatus(orderNumber) { | |||
export function getOrderStatus(orderNumber, payVendor) { | |||
return request({ | |||
url: `api/productOrder/findStatus?orderNumber=${orderNumber}`, | |||
url: `api/productOrder/findStatus?orderNumber=${orderNumber}&payVendor=${payVendor}`, | |||
method: 'get' | |||
}) | |||
} |
@@ -1,4 +1,4 @@ | |||
import request from "../utils/request" | |||
import { request } from "../utils/request" | |||
// 获取风格列表 | |||
export function findWorkByIdApi(id) { | |||
@@ -1,4 +1,4 @@ | |||
import request from "../utils/request" | |||
import { request } from "../utils/request" | |||
/** | |||
* @description:获取用户头像 | |||
@@ -49,6 +49,19 @@ export function getConsumeListApi(pageSize, pageNum) { | |||
}) | |||
} | |||
/** | |||
* @description:获取邀请记录 | |||
* @param (pageSize, pageNum) | |||
* @return: | |||
*/ | |||
export function getInviteListApi(pageSize, pageNum) { | |||
return request({ | |||
url: `api/userFrom/list?fromProject=5&pageSize=${pageSize}&pageNum=${pageNum}`, | |||
method: 'get', | |||
}) | |||
} | |||
/** | |||
* @description:删除写真 | |||
* @param id | |||
@@ -1,11 +1,6 @@ | |||
import request from "../utils/request" | |||
import { request } from "../utils/request" | |||
export function voiceTotalApi() { | |||
return request({ | |||
url: `api/voiceMould/voiceTotal`, | |||
method: 'GET', | |||
}) | |||
} | |||
// 微信登录 | |||
export function loginApi(data) { | |||
return request({ | |||
@@ -22,4 +17,26 @@ export function loginPhoneApi(data) { | |||
method: 'POST', | |||
data | |||
}) | |||
} | |||
// 获取短信验证码 | |||
export function getCodeApi(phone) { | |||
return request({ | |||
url: `api/user/sendLoginPhoneCode?phone=${phone}`, | |||
method: 'get', | |||
}) | |||
} | |||
/** | |||
* @description:短信登录 | |||
* @param {*} (appId, openId,phone,code) | |||
* @return: list | |||
*/ | |||
export function loginByCodeApi(data) { | |||
return request({ | |||
url: `api/miniApp/loginPhoneCode`, | |||
method: 'POST', | |||
data | |||
}) | |||
} |
@@ -1,4 +1,4 @@ | |||
import request from "../utils/request" | |||
import { request } from "../utils/request" | |||
/** | |||
@@ -38,3 +38,29 @@ export function getSupperPhotoStateApi(id) { | |||
method: 'get', | |||
}) | |||
} | |||
/** | |||
* @description:生成画报 | |||
* @param {appId,img} | |||
* @return: data | |||
*/ | |||
export function getUserQrcodeApi(data) { | |||
return request({ | |||
url: `/api/miniApp/getUserQrcode`, | |||
method: 'POST', | |||
responseType: "arraybuffer", | |||
data | |||
}) | |||
} | |||
/** | |||
* @description:获取订阅消息模版id | |||
* @param | |||
* @return: data | |||
*/ | |||
export function getTemplateMsgApi() { | |||
return request({ | |||
url: `api/templateMsg/list?projectType=5&plat=${uni.getStorageSync("plat")}&type=1`, | |||
method: 'get', | |||
}) | |||
} |
@@ -1,4 +1,4 @@ | |||
import request from "../utils/request" | |||
import { request } from "../utils/request" | |||
// /api/baidu/checkPhoto | |||
// /api/userDigital/checkPhoto | |||
@@ -27,4 +27,29 @@ export function addImageApi(data) { | |||
method: 'post', | |||
data | |||
}); | |||
} | |||
/** | |||
* @description:获取登陆,注册送多少金币的接口 | |||
* @param "projectType":5,//智像固定5 "type":1-注册,2-邀请 | |||
* @return: data | |||
*/ | |||
export function getProjectConfigApi(data) { | |||
return request({ | |||
url: `api/glodConfig/getProjectConfig`, | |||
method: 'post', | |||
data | |||
}) | |||
} | |||
/** | |||
* @description:获取照片生成次数,判断是不是首次生成 | |||
* @param "projectType":5,//智像固定5 "type":1-注册,2-邀请 | |||
* @return: data | |||
*/ | |||
export function getCountApi() { | |||
return request({ | |||
url: `api/digitalAvatarPhoto/getCount`, | |||
method: 'get', | |||
}) | |||
} |
@@ -1,10 +0,0 @@ | |||
<template> | |||
<div class="myLoading">{{ title }}</div> | |||
</template> | |||
<script setup> | |||
import { ref } from "vue"; | |||
const title = ref("myLoading"); | |||
</script> | |||
<style lang="scss"></style> |
@@ -5,10 +5,13 @@ import "./style/my.scss"; | |||
//#region VUE3 | |||
import { createSSRApp } from 'vue' | |||
import { store } from '../src/store/index' | |||
import share from "../src/utils/share" | |||
export function createApp() { | |||
const app = createSSRApp(App) | |||
app.use(uviewPlus) | |||
app.use(store) | |||
app.mixin(share) | |||
return { | |||
app | |||
} | |||
@@ -51,6 +51,9 @@ | |||
/* 小程序特有相关 */ | |||
"mp-weixin": { | |||
"appid": "wx75cf14e3a0d45821", | |||
// "useExtendedLib": { | |||
// "share": true // 确保分享功能已经开启 | |||
// }, | |||
"permission": { | |||
"scope.userLocation": { | |||
"desc": "获取您的地理位置信息" | |||
@@ -67,7 +70,8 @@ | |||
"ignoreDevUnusedFiles": false, | |||
"ignoreUploadUnusedFiles": false | |||
}, | |||
"usingComponents": true | |||
"usingComponents": true, | |||
"__usePrivacyCheck__": true | |||
}, | |||
"h5": { | |||
"title": "", | |||
@@ -80,7 +84,8 @@ | |||
"usingComponents": true | |||
}, | |||
"mp-toutiao": { | |||
"usingComponents": true | |||
"usingComponents": true, | |||
"appid": "tt2eba5807b1883f9f01" | |||
}, | |||
"uniStatistics": { | |||
"enable": false | |||
@@ -30,6 +30,12 @@ | |||
"navigationBarTitleText": "上传成功" | |||
} | |||
}, | |||
{ | |||
"path": "pages/uploadPhoto/camera ", | |||
"style": { | |||
"navigationBarTitleText": "拍照" | |||
} | |||
}, | |||
{ | |||
"path": "pages/closeStyle/closeStyle", | |||
"style": { | |||
@@ -75,7 +81,7 @@ | |||
{ | |||
"path": "pages/protocol/coin", | |||
"style": { | |||
"navigationBarTitleText": "慧拍金币充值协议" | |||
"navigationBarTitleText": "智像金币充值协议" | |||
} | |||
}, | |||
{ | |||
@@ -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 { voiceTotalApi } from "../../api/login.js"; | |||
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> |
@@ -1,13 +1,34 @@ | |||
<template> | |||
<div class="page"> | |||
<u-list class="styleListBox" @scrolltolower="scrolltolower"> | |||
<!-- 性别tab --> | |||
<!-- <view class="sexTab"> | |||
<view @click="sex = 2" class="sex" :class="sex == 2 ? 'sexActive' : ''" | |||
>女</view | |||
> | |||
<view @click="sex = 1" class="sex" :class="sex == 1 ? 'sexActive' : ''" | |||
>男</view | |||
> | |||
</view> --> | |||
<u-tabs | |||
:list="tabList" | |||
lineWidth="70" | |||
lineColor="#ff4f00" | |||
:activeStyle="{ color: '#ff4f00' }" | |||
:inactiveStyle="{ color: '#fff' }" | |||
@click="chooseTab" | |||
></u-tabs> | |||
<u-list | |||
class="styleListBox" | |||
@scrolltolower="scrolltolower" | |||
lowerThreshold="100" | |||
> | |||
<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)"> | |||
<view class="styleInfo" @click="createPhoto(item)"> | |||
<image :src="item.coverImg" mode="aspectFit" /> | |||
<text class="name">{{ item.title }}</text> | |||
<text class="single">{{ peopleNum(item.mouldType) }}</text> | |||
@@ -21,8 +42,7 @@ | |||
<script setup> | |||
//#region 导入 | |||
import { onPullDownRefresh } from "@dcloudio/uni-app"; | |||
import { ref, reactive } from "vue"; | |||
import { voiceTotalApi } from "../../api/login.js"; | |||
import { ref, reactive, watch } from "vue"; | |||
import { getListApi } from "../../api/closeStyle"; | |||
//#endregion | |||
@@ -43,20 +63,36 @@ import { getListApi } from "../../api/closeStyle"; | |||
//#region 列表加载 | |||
const pageNum = ref(1); | |||
const pageSize = ref(8); | |||
const pageSize = ref(20); | |||
const sex = ref(2); //1男2女 | |||
const styleList = ref([]); | |||
// 得到列表 | |||
async function getList() { | |||
try { | |||
const res = await getListApi(pageNum.value, pageSize.value); | |||
uni.showLoading({ | |||
title: "加载中...", | |||
mask: true, | |||
}); | |||
const res = await getListApi(pageNum.value, pageSize.value, sex.value); | |||
styleList.value = res.data.list; | |||
uni.hideLoading(); | |||
} catch (error) { | |||
uni.hideLoading(); | |||
uni.showToast({ | |||
title: "获取列表失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} | |||
// 监听性别tab变化 | |||
watch( | |||
() => sex.value, | |||
(sex) => { | |||
pageNum.value = 1; | |||
pageSize.value = 20; | |||
getList(); | |||
} | |||
); | |||
getList(); | |||
// 触底加载更多 | |||
const scrolltolower = async () => { | |||
@@ -66,9 +102,12 @@ const scrolltolower = async () => { | |||
mask: true, | |||
}); | |||
pageNum.value += 1; | |||
const res = await getListApi(pageNum.value, pageSize.value); | |||
const res = await getListApi(pageNum.value, pageSize.value, sex.value); | |||
styleList.value.push(...res.data.list); | |||
uni.hideLoading(); | |||
setTimeout(function () { | |||
uni.hideLoading(); | |||
}, 500); | |||
if (res.data.list.length == 0) { | |||
pageNum.value -= 1; | |||
uni.showToast({ | |||
@@ -77,7 +116,9 @@ const scrolltolower = async () => { | |||
}); | |||
} | |||
} catch (error) { | |||
uni.hideLoading(); | |||
setTimeout(function () { | |||
uni.hideLoading(); | |||
}, 500); | |||
uni.showToast({ | |||
title: "获取数据失败,请重试", | |||
icon: "none", | |||
@@ -98,19 +139,68 @@ function peopleNum(num) { | |||
//#endregion --------------------- | |||
//#region 点击图片 | |||
function createPhoto(id) { | |||
uni.navigateTo({ | |||
url: `/pages/closeStyle/goCreatePhoto?id=${id}`, | |||
}); | |||
function createPhoto(item) { | |||
if (item.mouldType == 1) { | |||
uni.navigateTo({ | |||
url: `/pages/closeStyle/goCreatePhoto?id=${item.id}`, | |||
}); | |||
} else { | |||
uni.navigateTo({ | |||
url: `/pages/closeStyle/multiplayer?id=${item.id}`, | |||
}); | |||
} | |||
} | |||
//#endregion --------------------- | |||
//#region tab栏 | |||
const tabList = ref([ | |||
{ name: "女", id: 2 }, | |||
{ name: "男", id: 1 }, | |||
// { name: "多人", id: 3 }, | |||
// { name: "电影明星", id: 4 }, | |||
// { name: "体育", id: 5 }, | |||
]); | |||
function chooseTab(item) { | |||
sex.value = item.id; | |||
} | |||
//#endregion | |||
</script> | |||
<style lang="scss"> | |||
.page { | |||
background-color: #222527; | |||
} | |||
// .sexTab { | |||
// margin: 20rpx 0; | |||
// width: 100%; | |||
// height: 60rpx; | |||
// display: flex; | |||
// justify-content: space-evenly; | |||
// line-height: 54rpx; | |||
// text-align: center; | |||
// .sex { | |||
// border-radius: 20rpx; | |||
// border: 2rpx solid #ccc; | |||
// width: 40%; | |||
// } | |||
// .sexActive { | |||
// color: #ff4f00; | |||
// border: 2rpx solid #ff4f00; | |||
// transition: all 0.3s; | |||
// } | |||
// } | |||
.u-tabs { | |||
max-width: 100%; | |||
color: #fff !important; | |||
margin-bottom: 30rpx; | |||
.u-tabs__wrapper__nav__item { | |||
width: 200rpx; | |||
height: 90rpx !important; | |||
} | |||
} | |||
.u-list { | |||
overflow: hidden; | |||
height: calc(100vh - 200rpx) !important; | |||
width: 650rpx; | |||
.glodYBox { | |||
display: flex !important; | |||
@@ -24,7 +24,7 @@ | |||
<script setup> | |||
//#region 导入 | |||
import { ref, reactive } from "vue"; | |||
import { onLoad } from "@dcloudio/uni-app"; | |||
import { onLoad, onShow } from "@dcloudio/uni-app"; | |||
import { | |||
findByIdApi, | |||
findImageApi, | |||
@@ -40,6 +40,10 @@ const styleId = ref(null); | |||
const styleData = ref({}); | |||
onLoad((options) => { | |||
styleId.value = options.id; | |||
// getInfo(); | |||
// getMyCoin(); | |||
}); | |||
onShow(() => { | |||
getInfo(); | |||
getMyCoin(); | |||
}); | |||
@@ -89,14 +93,15 @@ async function createing(id) { | |||
const res = await findImageApi(); | |||
let myImg = res.data.image; | |||
const data = { | |||
plat: uni.getStorageSync("plat"), | |||
digitalAvatarId: id, | |||
userImages: JSON.stringify([myImg]), | |||
title: styleData.value.title, | |||
}; | |||
const res2 = await createPhotoApi(data); | |||
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(); | |||
} 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> |
@@ -106,6 +106,7 @@ | |||
//#region 导入 | |||
import { ref, reactive } from "vue"; | |||
import { onLoad } from "@dcloudio/uni-app"; | |||
import { BASE_URL } from "@/utils/request"; | |||
import { | |||
findByIdApi, | |||
findImageApi, | |||
@@ -120,9 +121,9 @@ const userInfoModulesPinia = userInfoModules(); | |||
const styleId = ref(null); | |||
const styleData = ref({}); | |||
onLoad((options) => { | |||
// styleId.value = options.id; | |||
styleId.value = options.id; | |||
// styleId.value = "857147862095679488"; | |||
styleId.value = "2003"; | |||
// styleId.value = "2003"; | |||
// styleId.value = "246"; | |||
getInfo(); | |||
// getMyCoin(); | |||
@@ -157,17 +158,14 @@ async function getMyCoin() { | |||
const avatarList = ref([ | |||
{ | |||
url: userInfoModulesPinia.myAvatar, | |||
// url: "https://suimang.oss-accelerate.aliyuncs.com/builtin/digital_avatar/girl/%E9%A3%8E%E9%87%87%E5%87%BA%E4%BC%97.jpg", | |||
isMyAvatar: true, | |||
}, | |||
{ | |||
url: "", | |||
// url: "https://suimang.oss-accelerate.aliyuncs.com/builtin/digital_avatar/girl/%E9%AA%8F%E9%A9%AC%E4%BD%B3%E4%BA%BA.jpg", | |||
isMyAvatar: false, | |||
}, | |||
{ | |||
url: "", | |||
// url: "https://suimang.oss-accelerate.aliyuncs.com/builtin/digital_avatar/girl/%E7%B4%AB%E8%96%87%E7%90%B4%E9%9F%B5.png", | |||
isMyAvatar: false, | |||
}, | |||
]); | |||
@@ -194,7 +192,7 @@ function chooseImg(index) { | |||
}); | |||
// 百度敏感信息检测 | |||
uni.uploadFile({ | |||
url: "https://test.metavatar.cc/C/api/baidu/checkPhoto", //上传图片api | |||
url: BASE_URL + "api/baidu/checkPhoto", //上传图片api | |||
filePath: res.tempFilePaths[0], | |||
name: "file", | |||
formData: { | |||
@@ -202,7 +200,7 @@ function chooseImg(index) { | |||
}, | |||
header: { | |||
// Authorization: userInfoModulesPinia.token, | |||
token: userInfoModulesPinia.token, | |||
token: uni.getStorageSync("token"), | |||
}, | |||
success: async (res2) => { | |||
if (JSON.parse(res2.data).code != 200) { | |||
@@ -215,7 +213,7 @@ function chooseImg(index) { | |||
} else { | |||
// 人脸识别接口 | |||
uni.uploadFile({ | |||
url: "https://test.metavatar.cc/C/api/userDigital/checkPhoto", //上传图片api | |||
url: BASE_URL + "api/userDigital/checkPhoto", //上传图片api | |||
filePath: res.tempFilePaths[0], | |||
name: "file", | |||
formData: { | |||
@@ -223,7 +221,7 @@ function chooseImg(index) { | |||
}, | |||
header: { | |||
// Authorization: userInfoModulesPinia.token, | |||
token: userInfoModulesPinia.token, | |||
token: uni.getStorageSync("token"), | |||
}, | |||
success: (res3) => { | |||
if (JSON.parse(res3.data).code != 200) { | |||
@@ -236,7 +234,7 @@ function chooseImg(index) { | |||
} else { | |||
// 上传接口 | |||
uni.uploadFile({ | |||
url: "https://test.metavatar.cc/C/api/upload/awsImgUpload", //上传图片api | |||
url: BASE_URL + "api/upload/awsImgUpload", //上传图片api | |||
filePath: res.tempFilePaths[0], | |||
name: "file", | |||
formData: { | |||
@@ -244,7 +242,7 @@ function chooseImg(index) { | |||
}, | |||
header: { | |||
"Content-Type": "multipart/form-data", | |||
token: userInfoModulesPinia.token, | |||
token: uni.getStorageSync("token"), | |||
}, | |||
success: async (res4) => { | |||
if (JSON.parse(res4.data).code != 200) { | |||
@@ -320,17 +318,32 @@ async function createing(id) { | |||
myImgList.push(item.url); | |||
}); | |||
const data = { | |||
plat: uni.getStorageSync("plat"), | |||
title: styleData.value.title, | |||
digitalAvatarId: id, | |||
userImages: | |||
styleData.value.mouldType == 2 | |||
? JSON.stringify(myImgList.slice(0, 2)) | |||
: JSON.stringify(myImgList), | |||
}; | |||
if ( | |||
myImgList[0].length == 0 || | |||
myImgList[1].length == 0 || | |||
(styleData.value.mouldType == 3 && myImgList[2].length == 0) | |||
) { | |||
uni.showToast({ | |||
title: "头像未上传", | |||
icon: "none", | |||
mask: true, | |||
}); | |||
return; | |||
} | |||
const res2 = await createPhotoApi(data); | |||
console.log(res2); | |||
uni.hideLoading(); | |||
uni.navigateTo({ | |||
url: `/pages/createing/index?id=${res2.data.id}`, | |||
url: `/pages/lookPhoto/index?id=${res2.data.id}`, | |||
}); | |||
} catch (error) { | |||
console.log(error); | |||
@@ -7,31 +7,6 @@ | |||
<view class="changeStyle" @click="changeStyle">更换风格</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 | |||
v-if="createState == 2" | |||
indicator | |||
@@ -129,9 +129,17 @@ function inviteFriend() { | |||
//#region 页面跳转 | |||
function bueCoin() { | |||
uni.navigateTo({ | |||
url: "/pages/home/buyCoin", | |||
}); | |||
if (userInfoModulesPinia.platForm == 3) { | |||
uni.showToast({ | |||
title: "暂未开放", | |||
icon: "none", | |||
mask: true, | |||
}); | |||
} else { | |||
uni.navigateTo({ | |||
url: "/pages/index/buyCoin", | |||
}); | |||
} | |||
} | |||
//#endregion --------------------- | |||
@@ -13,7 +13,7 @@ | |||
</view> | |||
<view class="buyBtn"> | |||
<view class="btn" @click="createProductOrder">立刻购买</view> | |||
<view class="pro" @click="goPro">《慧拍金币充值协议》</view> | |||
<view class="pro" @click="goPro">《智像金币充值协议》</view> | |||
</view> | |||
</view> | |||
</template> | |||
@@ -29,6 +29,7 @@ import { | |||
} from "../../api/coin.js"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
const userInfoModulesPinia = userInfoModules(); | |||
//#endregion ---------------------------------- | |||
const active = ref(""); | |||
const orderNumber = ref(""); | |||
@@ -78,7 +79,7 @@ const createProductPay = async (orderNumber) => { | |||
const data = { | |||
orderNumber, | |||
openId, | |||
payVendor: 1, //Number,1:微信;2:抖音 | |||
payVendor: userInfoModulesPinia.platForm == 2 ? 1 : 5, //Number,1:微信;5:抖音 | |||
}; | |||
const res = await createPay(data); | |||
startPay(res.data); | |||
@@ -90,59 +91,112 @@ const createProductPay = async (orderNumber) => { | |||
// 拉起收银台 | |||
const startPay = (data) => { | |||
const orderInfo = { | |||
package: data.package, | |||
nonceStr: data.nonceStr, | |||
timeStamp: data.timeStamp, | |||
paySign: data.paySign, | |||
signType: data.signType, | |||
}; | |||
console.log(orderInfo, "orderInfo"); | |||
uni.hideLoading(); | |||
uni.requestPayment({ | |||
provider: "wxpay", //固定值为"wxpay" | |||
...orderInfo, | |||
success: function (res) { | |||
console.log(res, "res"); | |||
getStatusOfOrder(orderNumber.value).then((res) => { | |||
console.log(res, "status"); | |||
if (res == 1) { | |||
uni.showToast({ | |||
title: "支付取消", | |||
icon: "exception", | |||
}); | |||
} else if (res == 2) { | |||
} else if (res == 3) { | |||
uni.showToast({ | |||
title: "支付成功!", | |||
icon: "success", | |||
success() { | |||
setTimeout(() => { | |||
uni.navigateBack(); | |||
}, 2000); | |||
}, | |||
}); | |||
} else if (res == 4) { | |||
uni.showToast({ | |||
title: "支付取消", | |||
icon: "exception", | |||
}); | |||
} | |||
}); | |||
}, | |||
fail: function (err) { | |||
uni.showToast({ | |||
title: "支付失败!", | |||
icon: "error", | |||
}); | |||
console.log("支付失败", err); | |||
}, | |||
}); | |||
let orderInfo = null; | |||
if (userInfoModulesPinia.platForm == 2) { | |||
orderInfo = { | |||
package: data.package, | |||
nonceStr: data.nonceStr, | |||
timeStamp: data.timeStamp, | |||
paySign: data.paySign, | |||
signType: data.signType, | |||
}; | |||
console.log(orderInfo, "orderInfo"); | |||
uni.hideLoading(); | |||
uni.requestPayment({ | |||
provider: "wxpay", //固定值为"wxpay" | |||
...orderInfo, | |||
success: function (res) { | |||
console.log(res, "res"); | |||
getStatusOfOrder(orderNumber.value).then((res) => { | |||
console.log(res, "status"); | |||
if (res == 1) { | |||
uni.showToast({ | |||
title: "支付取消", | |||
icon: "exception", | |||
}); | |||
} else if (res == 2) { | |||
} else if (res == 3) { | |||
uni.showToast({ | |||
title: "支付成功!", | |||
icon: "success", | |||
success() { | |||
setTimeout(() => { | |||
uni.navigateBack(); | |||
}, 2000); | |||
}, | |||
}); | |||
} else if (res == 4) { | |||
uni.showToast({ | |||
title: "支付取消", | |||
icon: "exception", | |||
}); | |||
} | |||
}); | |||
}, | |||
fail: function (err) { | |||
uni.showToast({ | |||
title: "支付失败!", | |||
icon: "fail", | |||
}); | |||
console.log("支付失败", err); | |||
}, | |||
}); | |||
} | |||
// 抖音支付 | |||
else if (userInfoModulesPinia.platForm == 3) { | |||
orderInfo = { | |||
order_id: data.orderId, | |||
order_token: data.token, | |||
}; | |||
console.log(orderInfo, "orderInfo"); | |||
uni.hideLoading(); | |||
uni.requestPayment({ | |||
provider: "toutiao", //固定值为"wxpay" | |||
orderInfo: orderInfo, | |||
service: 5, | |||
success: function (res) { | |||
console.log(res, "res"); | |||
getStatusOfOrder(orderNumber.value).then((res) => { | |||
console.log(res, "status"); | |||
if (res == 1) { | |||
uni.showToast({ | |||
title: "支付取消", | |||
icon: "exception", | |||
}); | |||
} else if (res == 2) { | |||
} else if (res == 3) { | |||
uni.showToast({ | |||
title: "支付成功!", | |||
icon: "success", | |||
success() { | |||
setTimeout(() => { | |||
uni.navigateBack(); | |||
}, 2000); | |||
}, | |||
}); | |||
} else if (res == 4) { | |||
uni.showToast({ | |||
title: "支付取消", | |||
icon: "exception", | |||
}); | |||
} | |||
}); | |||
}, | |||
fail: function (err) { | |||
uni.showToast({ | |||
title: "支付失败!", | |||
icon: "fail", | |||
}); | |||
console.log("支付失败", err); | |||
}, | |||
}); | |||
} | |||
}; | |||
const getStatusOfOrder = async (orderNumber) => { | |||
try { | |||
const res = await getOrderStatus(orderNumber); | |||
let payVendor = userInfoModulesPinia.platForm == 2 ? 1 : 5; | |||
const res = await getOrderStatus(orderNumber, payVendor); | |||
console.log(res, "getStatusOfOrder"); | |||
return res.data.orderStatus; | |||
} catch (error) { | |||
@@ -210,6 +264,7 @@ getList(); | |||
.pro { | |||
text-align: center; | |||
color: #ff4f00; | |||
font-size: 24rpx; | |||
} | |||
} | |||
</style> |
@@ -30,9 +30,7 @@ | |||
<view class="coinBox" v-if="userInfoModulesPinia.token"> | |||
我的金币: {{ userInfoModulesPinia.myGlod }} | |||
<image src="../../assets/icon/icon.png" mode="scaleToFill" /> | |||
<text class="buyCoinText" @click="goOtherPage('buyCoin', 2)" | |||
>购买金币</text | |||
></view | |||
<text class="buyCoinText" @click="goBuyCoin">购买金币</text></view | |||
> | |||
<view class="coinBox" v-if="!userInfoModulesPinia.token" | |||
>登录即可体验更多功能哦! | |||
@@ -70,9 +68,7 @@ | |||
v-for="item in PhotoList" | |||
:key="item.id" | |||
class="showListItem" | |||
@click=" | |||
goOtherPage(`/pages/lookPhoto/index?id=${item.id}`, item.status) | |||
" | |||
@click="goLookPhoto(item.id, item.status)" | |||
> | |||
<view class="top"> | |||
<text class="name">{{ item.title }}</text> | |||
@@ -116,11 +112,7 @@ | |||
<!-- 空处理 --> | |||
<view v-show="PhotoList.length == 0" class="noData" | |||
>暂无数据 , | |||
<text | |||
@click="goOtherPage('/pages/closeStyle/closeStyle', 2)" | |||
class="goCreate" | |||
>去生成!</text | |||
> | |||
<text @click="goCloseStyle" class="goCreate">去生成!</text> | |||
</view> | |||
</scroll-view> | |||
<!-- 显示视频列表内容 --> | |||
@@ -155,17 +147,23 @@ | |||
class="InviteBox" | |||
v-show="showListActive == 3 && userInfoModulesPinia.token" | |||
> | |||
<scroll-view :scroll-y="true" class="showInviteList"> | |||
<view v-for="item in 9" :key="item" class="InviteList"> | |||
<scroll-view | |||
:scroll-y="true" | |||
class="showInviteList" | |||
@scrolltolower="getMoreInviteList" | |||
> | |||
<view v-for="item in InviteList" :key="item.id" class="InviteList"> | |||
<up-avatar :src="avatarUrl" size="50"></up-avatar> | |||
<view class="info"> | |||
<view class="name">猕猴桃</view> | |||
<view class="time">2023/7/29</view> | |||
<view class="name">{{ item.userPhone }}</view> | |||
<view class="time">{{ | |||
dayjs(item.createDate).format("YYYY-MM-DD HH:mm:ss") | |||
}}</view> | |||
</view> | |||
<view class="getCoin"> 金币+2 </view> | |||
<view class="getCoin"> +{{ item.goldNum }}金币 </view> | |||
</view> | |||
</scroll-view> | |||
<view class="inviteBtn">继续邀请好友</view> | |||
<button open-type="share" class="inviteBtn">继续邀请好友</button> | |||
</view> | |||
<!-- 显示消费列表内容 --> | |||
<view | |||
@@ -226,6 +224,7 @@ import { | |||
findGlodApi, | |||
getPhotoListApi, | |||
getConsumeListApi, | |||
getInviteListApi, | |||
deleteApi, | |||
} from "../../api/home.js"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
@@ -252,47 +251,25 @@ function chooseAvatar() { | |||
url: "/pages/uploadPhoto/uploadPhoto", | |||
}); | |||
return; | |||
uni.chooseImage({ | |||
count: 1, // 最多可以选择的图片张数,这里设置为1,只选择一张图片 | |||
success: async (res) => { | |||
// avatarUrl.value = res.tempFilePaths[0]; | |||
// TODO: 在这里处理图片上传逻辑,你可以调用上传接口将图片上传到服务器 | |||
// 示例代码: | |||
// uploadImageToServer(tempFilePaths[0]); | |||
// 图片压缩 | |||
console.log(res.tempFiles[0].size); | |||
if (userInfoModulesPinia.platForm != 1) { | |||
uni.compressImage({ | |||
src: res.tempFilePaths[0], | |||
quality: 20, | |||
success: (res2) => { | |||
avatarUrl.value = res2.tempFilePath; | |||
console.log(res2.tempFilePath); | |||
}, | |||
}); | |||
} else { | |||
const options = { | |||
maxSizeMB: 2, // 最大压缩大小为 4MB | |||
useWebWorker: true, // 使用 Web Worker 进行压缩,提高性能 | |||
}; | |||
const compressedFile = await imageCompression( | |||
res.tempFiles[0], | |||
options | |||
); | |||
//compressedFile是一个blob对象 | |||
avatarUrl.value = URL.createObjectURL(compressedFile); | |||
console.log(compressedFile); | |||
// avatarUrl.value = compressedFile; | |||
console.log("压缩图片h5"); | |||
} | |||
}, | |||
fail: (err) => { | |||
console.error("选择图片失败", err); | |||
}, | |||
} | |||
//#endregion | |||
//#region 路由跳转 | |||
function goBuyCoin() { | |||
// if (userInfoModulesPinia.platForm == 3) { | |||
// uni.showToast({ | |||
// title: "暂未开放", | |||
// icon: "none", | |||
// mask: true, | |||
// }); | |||
// } else { | |||
// } | |||
uni.navigateTo({ | |||
url: "/pages/index/buyCoin", | |||
}); | |||
} | |||
function goOtherPage(url, status) { | |||
function goLookPhoto(id, status) { | |||
if (status != 2) { | |||
uni.showToast({ | |||
title: "正在生成,请稍后", | |||
@@ -301,16 +278,31 @@ function goOtherPage(url, status) { | |||
return; | |||
} | |||
uni.navigateTo({ | |||
url: url, | |||
url: `/pages/lookPhoto/index?id=${id}`, | |||
}); | |||
} | |||
function goCloseStyle() { | |||
if (!userInfoModulesPinia.myAvatar) { | |||
uni.showToast({ | |||
title: "请先上传头像", | |||
icon: "none", | |||
mask: true, | |||
}); | |||
} else { | |||
uni.navigateTo({ | |||
url: `/pages/closeStyle/closeStyle`, | |||
}); | |||
} | |||
} | |||
//#endregion | |||
//#region tab | |||
const tabList = ref([ | |||
{ name: "我的写真", id: 1 }, | |||
// { name: "我的视频", id: 2 }, | |||
// { name: "我的邀请", id: 3 }, | |||
{ name: "我的邀请", id: 3 }, | |||
{ name: "消费记录", id: 4 }, | |||
]); | |||
const showListActive = ref(1); | |||
@@ -319,13 +311,14 @@ function clickTabHandle(e) { | |||
return; | |||
} | |||
showListActive.value = e.id; | |||
pageNum1.value = 1; | |||
pageNum2.value = 1; | |||
pageNum3.value = 1; | |||
if (e.id == 1) { | |||
getPhotoList(pageSize1.value, pageNum1.value); | |||
} else if (e.id == 2) { | |||
} else if (e.id == 3) { | |||
getInviteList(pageSize3.value, pageNum3.value); | |||
} else if (e.id == 4) { | |||
getConsumeList(pageSize2.value, pageNum2.value); | |||
} | |||
@@ -412,11 +405,44 @@ function getSymbol(type) { | |||
if ([1, 2, 3].includes(type)) { | |||
return "+"; | |||
} else { | |||
return "-"; | |||
return ""; | |||
} | |||
} | |||
//#endregion 获取图片,金币, | |||
//#region 获取邀请记录 | |||
const pageSize3 = ref(20); | |||
const pageNum3 = ref(1); | |||
const InviteList = ref(20); | |||
async function getInviteList(pageSize, pageNum) { | |||
try { | |||
const res = await getInviteListApi(pageSize, pageNum); | |||
InviteList.value = res.data.list; | |||
} catch (error) {} | |||
} | |||
/** | |||
* @description:触底加载更多邀请记录 | |||
*/ | |||
async function getMoreInviteList() { | |||
try { | |||
pageNum3.value += 1; | |||
const res = await getInviteListApi(pageSize3.value, pageNum3.value); | |||
if (res.data && res.data.list && res.data.list.length == 0) { | |||
pageNum3.value -= 1; | |||
} | |||
InviteList.value.push(...res.data.list); | |||
} catch (error) { | |||
console.log(error, "error"); | |||
uni.showToast({ | |||
title: "获取数据失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} | |||
//#endregion | |||
const myAvatar = ref( | |||
"https://suimang.oss-accelerate.aliyuncs.com/capi/2023-08-25/03b58cd2f52c49829435addbf1ec435a.jpg?x-oss-process=image/resize,w_10000/quality,q_60" | |||
); | |||
@@ -494,6 +520,7 @@ onLoad(async () => { | |||
findGlod(); | |||
getPhotoList(pageSize1.value, pageNum1.value); | |||
getConsumeList(pageSize2.value, pageNum2.value); | |||
getInviteList(pageSize3.value, pageNum3.value); | |||
} | |||
// setTimeout(() => { | |||
// findImage(); | |||
@@ -706,12 +733,13 @@ onShareAppMessage((res) => { | |||
} | |||
} | |||
} | |||
.noData { | |||
text-align: center; | |||
.goCreate { | |||
color: #ff4f00; | |||
text-decoration: underline; | |||
} | |||
} | |||
.noData { | |||
margin-top: 20rpx; | |||
text-align: center; | |||
.goCreate { | |||
color: #ff4f00; | |||
text-decoration: underline; | |||
} | |||
} | |||
// 视频列表 | |||
@@ -803,6 +831,7 @@ onShareAppMessage((res) => { | |||
line-height: 100rpx; | |||
text-align: center; | |||
font-size: 30rpx; | |||
color: #fff; | |||
background-color: rgba(255, 79, 0, 1); | |||
border-radius: 50rpx; | |||
} | |||
@@ -888,11 +917,23 @@ onShareAppMessage((res) => { | |||
padding: 0 50rpx; | |||
height: 65rpx; | |||
line-height: 65rpx; | |||
text-align: center; | |||
.name, | |||
.coin { | |||
width: 25%; | |||
font-weight: 900; | |||
white-space: nowrap; | |||
overflow: hidden; | |||
text-overflow: ellipsis; | |||
} | |||
.name { | |||
text-align: start; | |||
} | |||
.coin { | |||
text-align: end; | |||
} | |||
.time { | |||
flex: 1; | |||
font-weight: 100; | |||
} | |||
} | |||
@@ -20,7 +20,7 @@ | |||
</view> | |||
<view class="bottomBox"> | |||
<button | |||
v-if="!checkboxValue[0]" | |||
v-if="!checkboxValue[0] && userInfoModulesPinia.platForm == 2" | |||
class="bottomBtn" | |||
type="default" | |||
id="getPhoneNumber" | |||
@@ -29,7 +29,7 @@ | |||
开始制作我的数字写真 | |||
</button> | |||
<button | |||
v-if="checkboxValue[0]" | |||
v-if="checkboxValue[0] && userInfoModulesPinia.platForm == 2" | |||
class="bottomBtn" | |||
open-type="getPhoneNumber" | |||
type="default" | |||
@@ -38,8 +38,31 @@ | |||
> | |||
开始制作我的数字写真 | |||
</button> | |||
<!-- 抖音获取手机号 --> | |||
<!-- <button | |||
v-if="userInfoModulesPinia.platForm == 3" | |||
class="bottomBtn" | |||
open-type="getPhoneNumber" | |||
type="default" | |||
id="getPhoneNumber" | |||
@getphonenumber="dogetphonenumber" | |||
> | |||
开始制作我的数字分身 | |||
</button> --> | |||
<!-- 手机号登录 --> | |||
<button | |||
v-if="userInfoModulesPinia.platForm == 3" | |||
class="bottomBtn" | |||
type="default" | |||
id="getPhoneNumber" | |||
@click="showForm = true" | |||
> | |||
开始制作我的数字分身 | |||
</button> | |||
<!-- <view class="bottomBtn" @click="toCreate"> 开始制作我的数字写真 </view> --> | |||
<!-- 同意协议 --> | |||
<u-checkbox-group | |||
v-if="userInfoModulesPinia.platForm == 2" | |||
v-model="checkboxValue" | |||
placement="row" | |||
@change="changedCheckbox" | |||
@@ -57,6 +80,74 @@ | |||
</text> | |||
</u-checkbox-group> | |||
</view> | |||
<!-- 抖音手机号验证码登录 --> | |||
<view | |||
class="phoneLoginForm" | |||
v-show="userInfoModulesPinia.platForm == 3 && showForm" | |||
> | |||
<u--form | |||
labelPosition="left" | |||
:model="formData" | |||
:rules="rules" | |||
ref="formRef" | |||
> | |||
<u-form-item | |||
labelWidth="80" | |||
label="手机号" | |||
prop="phoneNum" | |||
borderBottom | |||
ref="form1" | |||
> | |||
<u--input | |||
type="number" | |||
v-model="formData.phoneNum" | |||
border="none" | |||
></u--input> | |||
</u-form-item> | |||
<!-- 获取验证码 --> | |||
<!-- 验证码 --> | |||
<view class="getCodeBtn" @click="getCode"> | |||
{{ backwardsNum < 60 ? backwardsNum + "s" : "发送验证码" }} | |||
</view> | |||
<!-- <view v-if="backwardsNums <= 0" class="getCodeBtn">{{ | |||
backwardsNum | |||
}}</view> --> | |||
<u-form-item labelWidth="80" label="验证码 " borderBottom ref="form2"> | |||
<u--input | |||
type="number" | |||
v-model="formData.codeNum" | |||
border="none" | |||
></u--input> | |||
</u-form-item> | |||
</u--form> | |||
<view class="loginBtn" @click="loginByCode">登录</view> | |||
</view> | |||
<view class="outSide" v-if="showPrivacy"> | |||
<view class="showPrivacy"> | |||
<view class="title">隐私协议更新</view> | |||
<view class="content"> | |||
感谢您一直以来对我们的信任和支持。为了更好地保护您的个人信息安全我们已经更新了隐私协议。如您继续使用我们的服务即表示同意并接受更新后的隐私协议。如您有任何疑问或意见,欢迎您联系我们的客户服务团队。 | |||
</view> | |||
<button | |||
class="agree" | |||
type="primary" | |||
open-type="agreePrivacyAuthorization" | |||
@agreeprivacyauthorization="handleAgreePrivacyAuthorization" | |||
> | |||
同意 | |||
</button> | |||
<button class="check" @click="handleOpenPrivacyContract"> | |||
查看《隐私保护指引》 | |||
</button> | |||
<image | |||
@click="closePrivacy" | |||
class="delete" | |||
src="../../assets/icon/delete.png" | |||
mode="" | |||
/> | |||
</view> | |||
</view> | |||
</view> | |||
</template> | |||
@@ -64,11 +155,19 @@ | |||
//#region 导入 | |||
import { ref, reactive, computed } from "vue"; | |||
import { onLoad } from "@dcloudio/uni-app"; | |||
import { voiceTotalApi, loginPhoneApi } from "../../api/login.js"; | |||
import { findImageApi, findGlodApi } from "../../api/home"; | |||
import { | |||
loginApi, | |||
loginPhoneApi, | |||
getCodeApi, | |||
loginByCodeApi, | |||
} from "../../api/login.js"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
//#endregion | |||
const userInfoModulesPinia = userInfoModules(); | |||
const showPrivacy = ref(false); | |||
const pageClass = computed(() => { | |||
if (userInfoModulesPinia.platForm == 1) { | |||
return "page pageH5"; | |||
@@ -76,7 +175,7 @@ const pageClass = computed(() => { | |||
return "page"; | |||
} | |||
}); | |||
//#region 勾选 | |||
//#region 勾选和手机号授权 | |||
const checkboxValue = ref([]); | |||
const checkboxList = ref([ | |||
{ | |||
@@ -87,15 +186,17 @@ function changedCheckbox(e) { | |||
console.log(e); | |||
} | |||
async function getphonenumber(e) { | |||
console.log(e); | |||
async function dogetphonenumber(e) { | |||
console.log(e, "e"); | |||
if (e.detail.errMsg.includes("ok")) { | |||
// if (e.detail.errMsg.includes("fail")) { | |||
//用户授权了手机号 | |||
const data = { | |||
appId: "wx75cf14e3a0d45821", | |||
appId: userInfoModulesPinia.getAppId(), | |||
openId: userInfoModulesPinia.openId, | |||
encryptedData: e.detail.encryptedData, | |||
iv: e.detail.iv, | |||
uid: urlUid.value, | |||
}; | |||
try { | |||
const res2 = await loginPhoneApi(data); | |||
@@ -104,13 +205,14 @@ async function getphonenumber(e) { | |||
title: "获取成功", | |||
}); | |||
userInfoModulesPinia.token = res2.data.token; | |||
uni.setStorageSync("token", userInfoModulesPinia.token); | |||
uni.switchTab({ | |||
url: "/pages/uploadPhoto/uploadPhoto", | |||
}); | |||
} catch (error) { | |||
uni.showToast({ | |||
icon: "none", | |||
title: "获取失败", | |||
title: "获取手机号失败", | |||
}); | |||
} | |||
} else { | |||
@@ -126,7 +228,7 @@ async function toCreate(e) { | |||
console.log(); | |||
if (checkboxValue.value[0]) { | |||
// await handleLogin(); | |||
await getphonenumber(e); | |||
await dogetphonenumber(e); | |||
} else { | |||
uni.showModal({ | |||
title: "提示", | |||
@@ -135,7 +237,7 @@ async function toCreate(e) { | |||
if (res.confirm) { | |||
checkboxValue.value = ["同意智像相机用户使用协议"]; | |||
// handleLogin(); | |||
getphonenumber(e); | |||
dogetphonenumber(e); | |||
} else if (res.cancel) { | |||
} | |||
}, | |||
@@ -192,23 +294,393 @@ const goPro = () => { | |||
}; | |||
//#endregion --------------------- | |||
//#region | |||
onLoad((options) => { | |||
uni.hideHomeButton(); | |||
// workId.value = options.id; | |||
if (options.type == "tokenFfalse") { | |||
//#region 抖音手机号登录 | |||
const showForm = ref(false); | |||
const formData = ref({ | |||
phoneNum: null, | |||
codeNum: null, | |||
}); | |||
const rules = { | |||
phoneNum: [ | |||
{ | |||
required: true, | |||
message: "请填写手机号", | |||
trigger: ["blur"], | |||
}, | |||
{ | |||
// 自定义验证函数,见上说明 | |||
validator: (rule, value, callback) => { | |||
// 上面有说,返回true表示校验通过,返回false表示不通过 | |||
// uni.$u.test.mobile()就是返回true或者false的 | |||
return uni.$u.test.mobile(value); | |||
}, | |||
message: "手机号码不正确", | |||
// 触发器可以同时用blur和change | |||
trigger: ["blur"], | |||
}, | |||
], | |||
}; | |||
const formRef = ref(null); | |||
const form1 = ref(null); | |||
const backwardsNum = ref(60); | |||
const countdownTimer = ref(null); // 倒计时的计时器 | |||
const timerFlag = ref(false); | |||
function getCode() { | |||
if (timerFlag.value) { | |||
return; // 如果倒计时尚未结束,不执行倒计时操作 | |||
} | |||
timerFlag.value = true; | |||
formRef.value | |||
.validate() | |||
.then(async (res0) => { | |||
try { | |||
uni.showLoading({ | |||
title: "请稍后", | |||
mask: true, | |||
}); | |||
console.log("duanxing1"); | |||
const res = await getCodeApi(formData.value.phoneNum); | |||
console.log(res.code, "duanxing2"); | |||
uni.hideLoading(); | |||
if (res.code != 200) { | |||
uni.showToast({ | |||
title: res.message, | |||
icon: "none", | |||
}); | |||
} | |||
console.log(res); | |||
// 表单验证通过后开始倒计时 | |||
countdownTimer.value = setInterval(() => { | |||
if (backwardsNum.value > 0) { | |||
backwardsNum.value--; | |||
} else { | |||
clearInterval(countdownTimer.value); | |||
countdownTimer.value = null; | |||
backwardsNum.value = 60; | |||
timerFlag.value = false; | |||
} | |||
}, 1000); | |||
} catch (error) { | |||
uni.hideLoading(); | |||
uni.$u.toast("短信验证码获取失败"); | |||
clearInterval(countdownTimer.value); | |||
countdownTimer.value = null; | |||
backwardsNum.value = 60; | |||
timerFlag.value = false; | |||
} | |||
}) | |||
.catch((errors) => { | |||
console.log(errors); | |||
}); | |||
} | |||
async function loginByCode() { | |||
uni.showLoading({ | |||
title: "请稍后", | |||
mask: true, | |||
}); | |||
const data = { | |||
appId: userInfoModulesPinia.getAppId(), | |||
openId: userInfoModulesPinia.openId, | |||
phone: formData.value.phoneNum, | |||
code: formData.value.codeNum, | |||
}; | |||
try { | |||
const res = await loginByCodeApi(data); | |||
console.log(res); | |||
uni.hideLoading(); | |||
userInfoModulesPinia.token = res.data.token; | |||
uni.setStorageSync("token", userInfoModulesPinia.token); | |||
console.log(res.code, "denglu"); | |||
if (res.code != 200) { | |||
uni.showToast({ | |||
title: res.message, | |||
icon: "none", | |||
}); | |||
} else { | |||
uni.switchTab({ | |||
url: "/pages/uploadPhoto/uploadPhoto", | |||
}); | |||
} | |||
} catch (error) { | |||
uni.hideLoading(); | |||
uni.showToast({ | |||
title: "登录失效,请重新登录", | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} | |||
//#endregion --------------------- | |||
//#region 隐私协议 | |||
const getPrivacySetting = (num) => { | |||
const canIUsePrivacy = wx.canIUse("getPrivacySetting"); | |||
// console.log(canIUsePrivacy, "canIUse getPrivacySetting"); | |||
if (canIUsePrivacy) { | |||
wx.getPrivacySetting({ | |||
success: (res) => { | |||
// console.log(res, "getPrivacySetting"); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' } | |||
if (res.needAuthorization) { | |||
// 需要弹出隐私协议 | |||
showPrivacy.value = true; | |||
} else { | |||
// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口 | |||
if (num == 1) { | |||
// 返回token,直接跳转首页 | |||
// uni.switchTab({ | |||
// url: "/pages/uploadPhoto/uploadPhoto", | |||
// }); | |||
} else if (num == 2) { | |||
// 没有返回token,无事发生 | |||
} | |||
} | |||
}, | |||
fail: () => {}, | |||
complete: () => {}, | |||
}); | |||
} | |||
}; | |||
// 关闭弹框直接退出小程序,仅对微信小程序生效 | |||
const closePrivacy = () => { | |||
wx.exitMiniProgram(); | |||
}; | |||
const handleAgreePrivacyAuthorization = () => { | |||
// console.log("Privacy Agreed!"); | |||
showPrivacy.value = false; | |||
// 用户同意隐私协议事件回调 | |||
// 用户点击了同意,之后所有已声明过的隐私接口和组件都可以调用了 | |||
}; | |||
const handleOpenPrivacyContract = () => { | |||
// 打开隐私协议页面 | |||
wx.openPrivacyContract({ | |||
success: () => {}, // 打开成功 | |||
fail: () => {}, // 打开失败 | |||
complete: () => {}, | |||
}); | |||
}; | |||
//#endregion --------------------------------- | |||
//#region 初始化 | |||
const urlUid = ref(""); //通过邀请来的会携带邀请人ID参数 | |||
onLoad((options) => { | |||
// 获取平台及系统信息 | |||
uni.getSystemInfo({ | |||
success: function (res) { | |||
let uniPlatform = ""; | |||
let osName = ""; | |||
if (res.uniPlatform == "web") { | |||
uniPlatform = 1; | |||
} else if (res.uniPlatform == "mp-weixin") { | |||
uni.setStorageSync("plat", 1); | |||
uniPlatform = 2; | |||
} else if (res.uniPlatform == "mp-toutiao") { | |||
uni.setStorageSync("plat", 3); | |||
uniPlatform = 3; | |||
} | |||
if (res.osName == "windows") { | |||
osName = 1; | |||
} else if (res.osName == "ios") { | |||
osName = 2; | |||
} else if (res.osName == "android") { | |||
osName = 3; | |||
} else if (res.osName == "mac") { | |||
osName = 4; | |||
} else if (res.osName == "linux") { | |||
osName = 5; | |||
} | |||
userInfoModulesPinia.platForm = uniPlatform; // 平台 | |||
userInfoModulesPinia.hostSystem = osName; // 系统 | |||
console.log(res.uniPlatform, uniPlatform, "PlatForm"); | |||
console.log(res.osName, osName, "System"); | |||
// 原来的登录逻辑 | |||
// 二维码扫描进入时 | |||
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; | |||
} else { | |||
urlUid.value = null; | |||
} | |||
console.log(urlUid.value, "邀请人id"); | |||
uni.hideHomeButton(); | |||
// workId.value = options.id; | |||
if (options.type == "tokenFfalse") { | |||
uni.showToast({ | |||
title: "登录失效,请重新登录", | |||
icon: "none", | |||
}); | |||
} | |||
// 已有token时直接登录 | |||
if (uni.getStorageSync("token")) { | |||
uni.switchTab({ url: "/pages/uploadPhoto/uploadPhoto" }); | |||
} | |||
if (userInfoModulesPinia.platForm == 2) { | |||
uni.login({ | |||
provider: "weixin", // 使用微信登录授权 | |||
success: async (res) => { | |||
console.log(res, "uni.login"); | |||
if (res.code) { | |||
try { | |||
uni.showLoading({ | |||
title: "加载中...", | |||
mask: true, | |||
}); | |||
const data = { | |||
appId: userInfoModulesPinia.getAppId(), | |||
code: res.code, | |||
}; | |||
const res2 = await loginApi(data); | |||
userInfoModulesPinia.openId = res2.data.openId; | |||
if (res2.data.token) { | |||
userInfoModulesPinia.token = res2.data.token; | |||
uni.setStorageSync("token", userInfoModulesPinia.token); | |||
console.log(userInfoModulesPinia.openId, "获取openid"); | |||
// 获取头像和金币 | |||
const res3 = await findImageApi(); | |||
if (res3.data) { | |||
uni.setStorageSync("userId", res3.data.id); | |||
} | |||
userInfoModulesPinia.myAvatar = | |||
res3.data && res3.data.image ? res3.data.image : ""; | |||
const res4 = await findGlodApi(); | |||
if (res4.data) { | |||
uni.setStorageSync("userId", res4.data.id); | |||
} | |||
if (!res4.data) { | |||
userInfoModulesPinia.myGlod = 0; | |||
} else { | |||
userInfoModulesPinia.myGlod = res4.data | |||
.digitalAvatarResidueGlod | |||
? res4.data.digitalAvatarResidueGlod | |||
: 0; | |||
} | |||
uni.hideLoading(); | |||
if (res2.data.token) { | |||
getPrivacySetting(1); | |||
} else { | |||
console.log("error1"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} else { | |||
getPrivacySetting(2); | |||
} | |||
uni.hideLoading(); | |||
} catch (error) { | |||
// uni.redirectTo({ | |||
// url: "pages/index/index", | |||
// }); | |||
console.log(error, "error2"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} else { | |||
// uni.redirectTo({ | |||
// url: "pages/index/index", | |||
// }); | |||
console.log("error3"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
}, | |||
fail: (err) => { | |||
// uni.redirectTo({ | |||
// url: "pages/index/index", | |||
// }); | |||
console.log("error4"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
}, | |||
}); | |||
} | |||
// 抖音头条授权 | |||
else if (userInfoModulesPinia.platForm == 3) { | |||
uni.login({ | |||
provider: "toutiao", // 使用微信登录授权 | |||
success: async (res) => { | |||
console.log(res, "uni.login"); | |||
if (res.code) { | |||
try { | |||
uni.showLoading({ | |||
title: "加载中...", | |||
mask: true, | |||
}); | |||
const data = { | |||
appId: userInfoModulesPinia.getAppId(), | |||
code: res.code, | |||
}; | |||
const res2 = await loginApi(data); | |||
userInfoModulesPinia.openId = res2.data.openId; | |||
if (res2.data.token) { | |||
userInfoModulesPinia.token = res2.data.token; | |||
// uni.setStorageSync("token", userInfoModulesPinia.token); | |||
console.log(userInfoModulesPinia.openId, "获取openid"); | |||
uni.hideLoading(); | |||
} else { | |||
uni.hideLoading(); | |||
// uni.redirectTo({ | |||
// url: "/pages/login/index", | |||
// }); | |||
console.log("error1"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
uni.hideLoading(); | |||
} catch (error) { | |||
uni.hideLoading(); | |||
console.log(error, "error2"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} else { | |||
console.log("error3"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
}, | |||
fail: (err) => { | |||
console.log("error4"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
}, | |||
}); | |||
} | |||
}, | |||
}); | |||
}); | |||
//#endregion --------------------------------- | |||
//#region | |||
//#endregion --------------------------------- | |||
// voiceTotalApi(); | |||
</script> | |||
<style lang="scss"> | |||
@@ -217,13 +689,16 @@ onLoad((options) => { | |||
padding: 0; | |||
min-height: 100vh; | |||
} | |||
.bgImg { | |||
width: 750rpx; | |||
height: 100vh; | |||
} | |||
.videoBox { | |||
width: 750rpx; | |||
height: 1120rpx; | |||
// aspect-ratio: 9/12; | |||
video { | |||
width: 100%; | |||
@@ -231,6 +706,7 @@ onLoad((options) => { | |||
// aspect-ratio: 9/12; | |||
} | |||
} | |||
.bottomBox { | |||
position: absolute; | |||
bottom: 0; | |||
@@ -241,6 +717,7 @@ onLoad((options) => { | |||
align-items: center; | |||
background-color: rgba(0, 0, 0, 0.8); | |||
color: #fff !important; | |||
.bottomBtn { | |||
margin-top: 55rpx; | |||
margin-bottom: 65rpx; | |||
@@ -254,13 +731,108 @@ onLoad((options) => { | |||
font-size: 30rpx; | |||
font-weight: 900; | |||
} | |||
.checkPro { | |||
display: inline-block; | |||
height: 27rpx; | |||
line-height: 54rpx; | |||
.goPro { | |||
color: #ff4f00; | |||
} | |||
} | |||
} | |||
.phoneLoginForm { | |||
position: absolute; | |||
top: 20%; | |||
left: 30rpx; | |||
width: 690rpx; | |||
z-index: 9; | |||
background-color: rgba(255, 255, 255, 0.6); | |||
padding: 50rpx 30rpx; | |||
border-radius: 30rpx; | |||
.u-code { | |||
width: 100%; | |||
height: 80rpx; | |||
background-color: green; | |||
color: #ff4f00; | |||
} | |||
.getCodeBtn { | |||
background-color: green; | |||
text-align: center; | |||
line-height: 50rpx; | |||
border-radius: 15rpx; | |||
} | |||
.loginBtn { | |||
background-color: #ff4f00; | |||
text-align: center; | |||
line-height: 50rpx; | |||
border-radius: 15rpx; | |||
} | |||
} | |||
.outSide { | |||
position: fixed; | |||
top: 0; | |||
left: 0; | |||
width: 100%; | |||
height: 100%; | |||
color: #000000; | |||
background-color: #00000059; | |||
.showPrivacy { | |||
position: fixed; | |||
width: 520rpx; | |||
background-color: #fff; | |||
left: 50%; | |||
top: 50%; | |||
transform: translate(-50%, -50%); | |||
padding: 60rpx 50rpx; | |||
border-radius: 20rpx; | |||
box-shadow: #00000047 2px 1px 2px 2px; | |||
.title { | |||
text-align: center; | |||
font-size: 30rpx; | |||
font-weight: 600; | |||
} | |||
.content { | |||
text-indent: 2em; | |||
margin: 40rpx 0; | |||
} | |||
button { | |||
width: 350rpx; | |||
&.agree { | |||
margin-bottom: 25rpx; | |||
background-color: #ff4f00; | |||
} | |||
&.check { | |||
background-color: #ffffff00; | |||
font-size: 21rpx; | |||
text-decoration: underline; | |||
padding: 0; | |||
&::after { | |||
border: none; | |||
} | |||
} | |||
} | |||
.delete { | |||
position: absolute; | |||
top: 15rpx; | |||
right: 15rpx; | |||
width: 65rpx; | |||
height: 65rpx; | |||
} | |||
} | |||
} | |||
</style> |
@@ -2,6 +2,7 @@ | |||
<view class="page"> | |||
<!-- 轮播图 --> | |||
<u-swiper | |||
v-if="createState == 2" | |||
indicator | |||
indicatorMode="dot" | |||
circular | |||
@@ -12,7 +13,25 @@ | |||
@change="getSwiperIndex" | |||
@click="previewImage" | |||
></u-swiper> | |||
<view class="checkMore">左右滑动查看更多</view> | |||
<image | |||
v-if="createState != 2" | |||
class="logo" | |||
src="../../assets/img/logo-4.png" | |||
mode="aspectFit" | |||
/> | |||
<view v-if="createState == 2" class="checkMore">左右滑动查看更多</view> | |||
<view | |||
v-if="createState != 2 && userInfoModulesPinia.platForm == 2" | |||
class="wait" | |||
>生成中,请稍后...</view | |||
> | |||
<view | |||
@click="subscribe" | |||
v-if="createState != 2" | |||
style="text-decoration: underline; color: #ff4f00" | |||
class="wait" | |||
>做好后通知我</view | |||
> | |||
<!-- <view class="uploadBtn grayBtn"> | |||
<text>我要让照片说话</text> | |||
<view class="free"> | |||
@@ -22,58 +41,104 @@ | |||
<view @click="downloadImg" class="uploadBtn"> | |||
<text>下载照片</text> | |||
</view> | |||
<view class="grayBtn" @click="photoSupper"> | |||
<view class="grayBtn" @click="goChooseStyle"> | |||
重新生成 | |||
<!-- <view v-if="supperPhotoState == 0 || supperPhotoState == 3" class="free"> | |||
<text>耗金币1枚</text> | |||
</view> --> | |||
{{ supperTips() }} | |||
</view> | |||
{{ supperTips() }} --> | |||
</view> | |||
<!-- 底部 --> | |||
<view class="bottomBox"> | |||
<view class="tips"> | |||
<text>邀请好友可获得2枚金币</text> | |||
<view v-if="createState == 2" class="tips"> | |||
<text>邀请好友可获得{{ loginAwardCoin }}枚金币</text> | |||
</view> | |||
<view class="shareBtn" @click="share">分享</view> | |||
<view class="shareBtn" @click="inviteFriend">邀请好友</view> | |||
<button open-type="share" class="shareBtn">分享</button> | |||
<view v-if="createState == 2" class="shareBtn" @click="getUserQrcode" | |||
>邀请好友</view | |||
> | |||
<view class="shareBtn" @click="buyCoin">金币充值</view> | |||
</view> | |||
<!-- 画报 --> | |||
<view v-if="showPictorial" class="pictorialBox"> | |||
<image show-menu-by-longpress :src="pictorialUrl" mode="scaleToFill" /> | |||
<text>长按保存、分享、收藏</text> | |||
<view class="orangeBtn" @click="showPictorial = fales">关闭</view> | |||
</view> | |||
</view> | |||
</template> | |||
<script setup> | |||
// import myloading from '../../components/myLoading.vue' | |||
//#region 导入 | |||
import { onLoad } from "@dcloudio/uni-app"; | |||
import { | |||
onLoad, | |||
onHide, | |||
onShareAppMessage, | |||
onShareTimeline, | |||
} from "@dcloudio/uni-app"; | |||
import { BASE_URL } from "../../utils/request"; | |||
import { findGlodApi } from "../../api/home"; | |||
import { ref, reactive, watch } from "vue"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
import { | |||
getPhotoListApi, | |||
photoSupperApi, | |||
getSupperPhotoStateApi, | |||
getUserQrcodeApi, | |||
getTemplateMsgApi, | |||
} from "../../api/lookPhoto.js"; | |||
//#endregion | |||
const userInfoModulesPinia = userInfoModules(); | |||
//#region 轮播图 | |||
const createState = ref(1); //制作状态:1生成中,2完成,3失败 | |||
const workId = ref(null); //作品id | |||
const loginAwardCoin = uni.getStorageSync("loginAwardCoin"); | |||
onLoad(async (options) => { | |||
workId.value = options.id; | |||
await getTemplateMsg(); | |||
await getSwiperList(); | |||
await getSupperPhotoState(swiperList.value[0].id); | |||
// 重新获取金币 | |||
const res4 = await findGlodApi(); | |||
if (!res4.data) { | |||
userInfoModulesPinia.myGlod = 0; | |||
} else { | |||
userInfoModulesPinia.myGlod = res4.data.digitalAvatarResidueGlod | |||
? res4.data.digitalAvatarResidueGlod | |||
: 0; | |||
} | |||
}); | |||
onHide(() => { | |||
clearTimeout(timer); | |||
timer.value = null; | |||
}); | |||
const swiperList = ref([]); //轮播图 | |||
const previewImageList = ref([]); //预览图片列表 | |||
const timer = ref(null); | |||
async function getSwiperList() { | |||
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); | |||
} | |||
}); | |||
} | |||
if (res.data.status != 2) { | |||
timer.value = setTimeout(() => { | |||
getSwiperList(); | |||
}, 3000); | |||
} else { | |||
clearTimeout(timer); | |||
timer.value = null; | |||
} | |||
} | |||
//#endregion --------------------- | |||
@@ -159,68 +224,89 @@ function previewImage(index) { | |||
//#endregion --------------------- | |||
//#region 分享 | |||
// onShareAppMessage((res) => { | |||
// // 分享事件来源:button(页面内分享按钮)、menu(右上角分享按钮) | |||
// if (res.from === "button") { | |||
// // 来自页面内分享按钮 | |||
// return { | |||
// //分享标题 | |||
// title: "智像", | |||
// //页面 path | |||
// path: `/pages/login/index`, | |||
// // 分享图标 | |||
// // imageUr: shopDetailsData.value?.GoodsCoverImg, | |||
// success: function () { | |||
// // 转发成功 | |||
// console.log("res", res); | |||
// }, | |||
// fail: function () { | |||
// // 转发失败 | |||
// console.log("res", res); | |||
// }, | |||
// }; | |||
// } else { | |||
// return { | |||
// title: "智像", | |||
// path: "/pages/login/index", | |||
// // imageUr: shopDetailsData.value?.GoodsCoverImg, | |||
// }; | |||
// } | |||
// }); | |||
// onShareAppMessage((res) => { | |||
// return { | |||
// title: "页面分享的标题", | |||
// path: "pages/uploadPhoto/uploadPhoto", | |||
// // imageUrl: "", | |||
// }; | |||
// }); | |||
function share() { | |||
uni.showToast({ | |||
title: "敬请期待!", | |||
icon: "none", | |||
}); | |||
return; | |||
uni.share({ | |||
provider: "weixin", //分享服务提供商(即weixin|qq|sinaweibo) | |||
scene: "WXSenceTimeline", //WXSceneSession(分享到聊天界面)、WXSenceTimeline(分享到朋友圈)、WXSceneFavorite(分享到微信收藏) | |||
type: 5, | |||
title: "分享到朋友圈", | |||
summary: "分享描述", | |||
href: "www.baidu.com", //分享跳转地址 | |||
imageUrl: "../static/lovehot.png", //分享图片路径(必须是线上可访问图片) | |||
miniProgram: { | |||
id: "wx75cf14e3a0d45821", | |||
path: "pages/index/index", | |||
type: 0, | |||
webUrl: "", | |||
}, | |||
success: function (res) { | |||
// console.log("success:" + JSON.stringify(res)); | |||
}, | |||
fail: function (err) { | |||
// console.log("fail:" + JSON.stringify(err)); | |||
}, | |||
}); | |||
} | |||
function inviteFriend() { | |||
uni.showToast({ | |||
title: "敬请期待!", | |||
icon: "none", | |||
}); | |||
return; | |||
uni.share({ | |||
provider: "weixin", //分享服务提供商(即weixin|qq|sinaweibo) | |||
scene: "WXSceneSession", //WXSceneSession(分享到聊天界面)、WXSenceTimeline(分享到朋友圈)、WXSceneFavorite(分享到微信收藏) | |||
type: 5, | |||
title: "分享给好友", | |||
summary: "分享描述", | |||
href: "www.baidu.com", //分享跳转地址 | |||
imageUrl: "../static/lovehot.png", //分享图片路径(必须是线上可访问图片) | |||
miniProgram: { | |||
id: "gwx75cf14e3a0d45821", | |||
path: "pages/index/index", | |||
type: 0, | |||
webUrl: "", | |||
}, | |||
success: function (res) { | |||
// console.log("success:" + JSON.stringify(res)); | |||
}, | |||
fail: function (err) { | |||
// console.log("fail:" + JSON.stringify(err)); | |||
}, | |||
}); | |||
// -------------------------------------------------- | |||
// uni.showToast({ | |||
// title: "敬请期待!", | |||
// icon: "none", | |||
// }); | |||
// return; | |||
// uni.onShareAppMessage({ | |||
// provider: "weixin", //分享服务提供商(即weixin|qq|sinaweibo) | |||
// scene: "WXSenceTimeline", //WXSceneSession(分享到聊天界面)、WXSenceTimeline(分享到朋友圈)、WXSceneFavorite(分享到微信收藏) | |||
// type: 5, | |||
// title: "分享到朋友圈", | |||
// summary: "分享描述", | |||
// href: "www.baidu.com", //分享跳转地址 | |||
// imageUrl: "../static/lovehot.png", //分享图片路径(必须是线上可访问图片) | |||
// miniProgram: { | |||
// id: "wx75cf14e3a0d45821", | |||
// path: "pages/index/index", | |||
// type: 0, | |||
// webUrl: "", | |||
// }, | |||
// success: function (res) { | |||
// }, | |||
// fail: function (err) { | |||
// }, | |||
// }); | |||
} | |||
//#endregion --------------------- | |||
//#region 页面跳转 | |||
function buyCoin() { | |||
if (userInfoModulesPinia.platForm == 3) { | |||
uni.showToast({ | |||
title: "暂未开放", | |||
icon: "none", | |||
mask: true, | |||
}); | |||
} else { | |||
uni.navigateTo({ | |||
url: "/pages/index/buyCoin", | |||
}); | |||
} | |||
} | |||
function goChooseStyle() { | |||
uni.navigateTo({ | |||
url: "/pages/index/buyCoin", | |||
url: "/pages/closeStyle/closeStyle", | |||
}); | |||
} | |||
//#endregion --------------------- | |||
@@ -255,6 +341,7 @@ async function photoSupper() { | |||
console.log(res); | |||
uni.hideLoading(); | |||
uni.showToast({ | |||
title: "高清处理请求成功,请稍后", | |||
title: "高清处理请求成功,请稍等", | |||
icon: "none", | |||
}); | |||
@@ -298,6 +385,121 @@ watch( | |||
); | |||
//#endregion --------------------- | |||
//#region 生成画报 | |||
const pictorialUrl = ref(""); | |||
const showPictorial = ref(false); | |||
async function getUserQrcode() { | |||
try { | |||
uni.showLoading({ | |||
title: "加载中...", | |||
mask: true, | |||
}); | |||
const data = { | |||
appId: userInfoModulesPinia.getAppId(), | |||
img: swiperList.value[swiperIndex.value].imageSuper | |||
? swiperList.value[swiperIndex.value].imageSuper | |||
: swiperList.value[swiperIndex.value].image, | |||
}; | |||
const res = await getUserQrcodeApi(data); | |||
if (res.code == 200) { | |||
pictorialUrl.value = `data:image/png;base64,${res.data}`; | |||
// ${uni.arrayBufferToBase64( | |||
// res.data | |||
// )} | |||
console.log(pictorialUrl.value); | |||
showPictorial.value = true; | |||
} else { | |||
uni.showToast({ | |||
title: "画报生成失败", | |||
icon: "none", | |||
mask: true, | |||
}); | |||
} | |||
uni.hideLoading(); | |||
} catch (error) { | |||
uni.hideLoading(); | |||
uni.showToast({ | |||
title: "画报生成失败", | |||
icon: "none", | |||
mask: true, | |||
}); | |||
console.log(error); | |||
} | |||
} | |||
//#endregion --------------------- | |||
//#region 订阅消息 | |||
const templateId = ref([]); | |||
async function getTemplateMsg() { | |||
try { | |||
const res = await getTemplateMsgApi(); | |||
if (res.data) { | |||
res.data.forEach((item) => { | |||
templateId.value.push(item.templateId); | |||
}); | |||
} | |||
} catch (error) { | |||
console.log("获取订阅消息模版失败", error); | |||
} | |||
} | |||
function subscribe() { | |||
uni.requestSubscribeMessage({ | |||
//此处填写刚才申请模板的模板ID | |||
tmplIds: templateId.value, | |||
success(res) { | |||
console.log(res); | |||
let failFlag = true; | |||
templateId.value.forEach((item) => { | |||
if (res[item] == "accept") { | |||
uni.showToast({ | |||
title: "订阅成功", | |||
icon: "success", | |||
}); | |||
failFlag = false; | |||
} | |||
}); | |||
if (failFlag) { | |||
// uni.showToast({ | |||
// duration: 5000, | |||
// title: "订阅失败 ,您可以在小程序设置->通知管理 \n 中重新启用订阅功能", | |||
// icon: "none", | |||
// }); | |||
uni.showModal({ | |||
title: "提示", | |||
content: | |||
"订阅失败 ,您可以在 \n 小程序设置->通知管理 \n 中重新启用订阅功能", | |||
confirmText: "确定", | |||
showCancel: false, | |||
}); | |||
} | |||
// if (res[templateId[0]] == "accept") { | |||
// uni.showToast({ | |||
// title: "订阅成功", | |||
// icon: "success", | |||
// }); | |||
// // 用户允许订阅 | |||
// } else { | |||
// uni.showToast({ | |||
// title: "订阅失败", | |||
// icon: "none", | |||
// }); | |||
// // 用户拒绝订阅 | |||
// } | |||
}, | |||
fail(err) { | |||
console.error("订阅消息失败", err); | |||
uni.showToast({ | |||
title: "订阅失败", | |||
icon: "none", | |||
}); | |||
}, | |||
}); | |||
} | |||
//#endregion --------------------- | |||
//#region | |||
//#endregion --------------------- | |||
@@ -305,11 +507,12 @@ watch( | |||
<style lang="scss"> | |||
.page { | |||
padding: 0 30rpx; | |||
background-color: rgba(24, 25, 26, 1); | |||
} | |||
// 轮播图 | |||
.u-swiper { | |||
margin-top: 40rpx; | |||
margin-top: 70rpx; | |||
width: 540rpx; | |||
height: 720rpx !important; | |||
border-radius: 50rpx; | |||
@@ -333,7 +536,25 @@ watch( | |||
} | |||
} | |||
.checkMore { | |||
.logo { | |||
width: 260rpx; | |||
margin: 90rpx; | |||
animation: rotateAnimation 3s 0s infinite; | |||
opacity: 0.7; | |||
} | |||
@keyframes rotateAnimation { | |||
0% { | |||
transform: rotate(0deg); | |||
} | |||
66.66% { | |||
transform: rotate(360deg); | |||
} | |||
100% { | |||
transform: rotate(360deg); | |||
} | |||
} | |||
.checkMore, | |||
.wait { | |||
color: #ffffff; | |||
margin-top: 30rpx; | |||
} | |||
@@ -385,6 +606,7 @@ watch( | |||
} | |||
} | |||
.grayBtn { | |||
margin-bottom: 220rpx; | |||
.free { | |||
position: absolute; | |||
color: #fff; | |||
@@ -402,13 +624,13 @@ watch( | |||
} | |||
.bottomBox { | |||
flex: 1; | |||
position: relative; | |||
bottom: -30rpx; | |||
// flex: 1; | |||
position: absolute; | |||
bottom: 60rpx; | |||
width: 100%; | |||
display: flex; | |||
justify-content: space-between; | |||
padding: 65rpx 10rpx 0; | |||
justify-content: space-evenly; | |||
padding: 65rpx 40rpx 0; | |||
.tips { | |||
position: absolute; | |||
top: 0rpx; | |||
@@ -423,12 +645,36 @@ watch( | |||
text-align: center; | |||
} | |||
.shareBtn { | |||
margin: 0; | |||
color: #fff; | |||
width: 200rpx; | |||
height: 70rpx; | |||
line-height: 70rpx; | |||
text-align: center; | |||
border-radius: 70rpx; | |||
font-size: 26rpx; | |||
background-color: rgba(255, 255, 255, 0.1); | |||
} | |||
} | |||
.pictorialBox { | |||
position: absolute; | |||
width: 100%; | |||
height: 100%; | |||
display: flex; | |||
flex-direction: column; | |||
align-items: center; | |||
background-color: rgba($color: #000000, $alpha: 0.9); | |||
image { | |||
margin-top: 80rpx; | |||
width: 630rpx; | |||
height: 940rpx; | |||
border-radius: 24rpx; | |||
margin-bottom: 50rpx; | |||
} | |||
text { | |||
margin-bottom: 30rpx; | |||
} | |||
z-index: 9; | |||
} | |||
</style> |
@@ -1,24 +1,24 @@ | |||
<template> | |||
<div class="page"> | |||
<div class="title">慧拍“金币”充值协议</div> | |||
<div class="title">智像“金币”充值协议</div> | |||
<div class="paragraph"> | |||
欢迎您使用慧拍的“金币”付费服务!为了使用慧拍内的特定付费产品和服务,您必须仔细阅读并遵守《慧拍“金币”充值协议》(以下简称“本协议”)。 | |||
欢迎您使用智像的“金币”付费服务!为了使用智像内的特定付费产品和服务,您必须仔细阅读并遵守《智像“金币”充值协议》(以下简称“本协议”)。 | |||
</div> | |||
<div class="paragraph"> | |||
注意:请用户仔细阅读以下全部内容。如果您不同意本服务协议的任一或全部条款内容,请不要使用慧拍“金币”服务。慧拍“金币”服务是慧拍服务的子服务,因此,当您开始使用慧拍“金币”服务时,即表示您与慧拍已达成协议关系,并自愿接受并遵守慧拍服务及慧拍“金币”服务的所有服务协议,包括但不限于《用户服务协议》、本服务协议及相关子协议和管理规范等。 | |||
注意:请用户仔细阅读以下全部内容。如果您不同意本服务协议的任一或全部条款内容,请不要使用智像“金币”服务。智像“金币”服务是智像服务的子服务,因此,当您开始使用智像“金币”服务时,即表示您与智像已达成协议关系,并自愿接受并遵守智像服务及智像“金币”服务的所有服务协议,包括但不限于《用户服务协议》、本服务协议及相关子协议和管理规范等。 | |||
</div> | |||
<div class="paragraph"> | |||
特别提示:在您开始使用本服务之前,您应当具备中华人民共和国法律规定的与您行为相适应的民事行为能力。若您不具备前述与您行为相适应的民事行为能力,则应获得监护人的知情同意。您及您的监护人应依照法律规定承担因此而导致的相应责任。特别地,如果您是未成年人,请在您的监护人的同意和指导下访问和/或使用我们的平台。慧拍谨此提醒家长合理引导未成年子女的上网及消费行为。 | |||
特别提示:在您开始使用本服务之前,您应当具备中华人民共和国法律规定的与您行为相适应的民事行为能力。若您不具备前述与您行为相适应的民事行为能力,则应获得监护人的知情同意。您及您的监护人应依照法律规定承担因此而导致的相应责任。特别地,如果您是未成年人,请在您的监护人的同意和指导下访问和/或使用我们的平台。智像谨此提醒家长合理引导未成年子女的上网及消费行为。 | |||
</div> | |||
<div class="item"> | |||
<div class="name">一、协议的范围</div> | |||
<div class="child"> | |||
1.1 | |||
协议适用主体范围:本协议是用户与慧拍之间关于用户在使用指定付费产品/服务和充值规则等相关事宜所订立的协议。 | |||
协议适用主体范围:本协议是用户与智像之间关于用户在使用指定付费产品/服务和充值规则等相关事宜所订立的协议。 | |||
</div> | |||
<div class="child"> | |||
1.2 | |||
协议关系及冲突条款:本协议视为《慧拍用户服务协议》的补充协议,是其不可分割的组成部分。如果本协议与上述内容存在冲突,以本协议为准。 | |||
协议关系及冲突条款:本协议视为《智像用户服务协议》的补充协议,是其不可分割的组成部分。如果本协议与上述内容存在冲突,以本协议为准。 | |||
</div> | |||
</div> | |||
@@ -26,11 +26,11 @@ | |||
<div class="name">二、名词定义</div> | |||
<div class="child"> | |||
2.1 | |||
慧拍“金币”:指按照慧拍的指定方式支付一定费用后,可以享有由慧拍提供的特定付费产品和服务。慧拍“金币”不具有法定货币的流通和支付功能,不得兑换为法定货币或实物。慧拍提醒用户注意,慧拍“金币”付费服务非存款、预付款或其他可无理由退还性质的商品或财产权利。 | |||
智像“金币”:指按照智像的指定方式支付一定费用后,可以享有由智像提供的特定付费产品和服务。智像“金币”不具有法定货币的流通和支付功能,不得兑换为法定货币或实物。智像提醒用户注意,智像“金币”付费服务非存款、预付款或其他可无理由退还性质的商品或财产权利。 | |||
</div> | |||
<div class="child"> | |||
2.2 | |||
充值服务:用户通过慧拍“金币”充值,享有由慧拍或第三方提供的特定付费产品/服务。用户所享有的具体服务内容会根据充值金额而有所不同。同时,慧拍可能会在不同时间推出具体不同的服务内容,以不断完善和优化本服务。具体服务内容请参阅慧拍相关服务页面的公布和实际提供的内容。 | |||
充值服务:用户通过智像“金币”充值,享有由智像或第三方提供的特定付费产品/服务。用户所享有的具体服务内容会根据充值金额而有所不同。同时,智像可能会在不同时间推出具体不同的服务内容,以不断完善和优化本服务。具体服务内容请参阅智像相关服务页面的公布和实际提供的内容。 | |||
</div> | |||
</div> | |||
@@ -38,49 +38,49 @@ | |||
<div class="name">三、付费服务及充值规则</div> | |||
<div class="child"> | |||
3.1 | |||
用户理解并同意,用户必须成为慧拍的普通注册用户后,才能继续进行付费服务。本服务收取的充值金额是慧拍向最终用户收取互联网增值服务使用费的一种通用收费渠道或计费方式。该充值金额仅可用于慧拍指定服务,不适用于其他任何产品或服务。 | |||
用户理解并同意,用户必须成为智像的普通注册用户后,才能继续进行付费服务。本服务收取的充值金额是智像向最终用户收取互联网增值服务使用费的一种通用收费渠道或计费方式。该充值金额仅可用于智像指定服务,不适用于其他任何产品或服务。 | |||
</div> | |||
<div class="child"> | |||
3.2 | |||
慧拍将有权决定所提供的服务资费标准和收费方式。可能会针对不同的服务制定不同的资费标准和收费方式,也可能根据慧拍所提供的服务的不同阶段确定不同的资费标准和收费方式。 | |||
智像将有权决定所提供的服务资费标准和收费方式。可能会针对不同的服务制定不同的资费标准和收费方式,也可能根据智像所提供的服务的不同阶段确定不同的资费标准和收费方式。 | |||
</div> | |||
<div class="child"> | |||
3.3 充值 | |||
<div class="inside"> | |||
3.3.1 | |||
用户通过所用客户端相应的支付方式(具体支付方式请见充值页面),为其账号充值所直接获得的慧拍“金币”,可在指定的付费产品/服务中使用。 | |||
安卓端:慧拍“金币”费用将通过支付宝、微信等第三方代收费的方式支付,具体价格请见购买收银台标示。 | |||
iOS端:慧拍“金币”费用将通过支付宝、微信等第三方代收费的方式支付,具体价格为人民币0.1元。 | |||
用户通过所用客户端相应的支付方式(具体支付方式请见充值页面),为其账号充值所直接获得的智像“金币”,可在指定的付费产品/服务中使用。 | |||
安卓端:智像“金币”费用将通过支付宝、微信等第三方代收费的方式支付,具体价格请见购买收银台标示。 | |||
iOS端:智像“金币”费用将通过支付宝、微信等第三方代收费的方式支付。 | |||
</div> | |||
<div class="inside"> | |||
3.3.2 | |||
用户可以通过登录慧拍,在首页点击“我的金币”,查询已购买或尚未消费的慧拍“金币”。 | |||
用户可以通过登录智像,在首页点击“我的金币”,查询已购买或尚未消费的智像“金币”。 | |||
</div> | |||
<div class="inside"> | |||
3.3.3 | |||
用户理解并知晓,慧拍不提供用户间交易慧拍“金币”服务。用户间交易慧拍“金币”构成对本协议的违反,慧拍有权在未经通知的情况下采取相应适当措施,以确保不提供用户间交易慧拍“金币”服务。 | |||
用户理解并知晓,智像不提供用户间交易智像“金币”服务。用户间交易智像“金币”构成对本协议的违反,智像有权在未经通知的情况下采取相应适当措施,以确保不提供用户间交易智像“金币”服务。 | |||
</div> | |||
<div class="inside"> | |||
3.3.4 | |||
用户理解并同意,充值的慧拍“金币”不适用无理由退换。充值一旦成功,即视为充值完成。用户不得以消费完成后账户内仍有剩余慧拍“金币”为由要求退费。 | |||
用户理解并同意,充值的智像“金币”不适用无理由退换。充值一旦成功,即视为充值完成。用户不得以消费完成后账户内仍有剩余智像“金币”为由要求退费。 | |||
</div> | |||
<div class="inside"> | |||
3.3.5 | |||
当用户在慧拍进行慧拍“金币”充值时,用户必须仔细确认自己的账号及信息。若因为用户自身操作不当、不了解或未充分了解充值计费方式等因素造成充错账号、错选充值种类等情况而损害自身权益,由用户自行负责。 | |||
当用户在智像进行智像“金币”充值时,用户必须仔细确认自己的账号及信息。若因为用户自身操作不当、不了解或未充分了解充值计费方式等因素造成充错账号、错选充值种类等情况而损害自身权益,由用户自行负责。 | |||
</div> | |||
<div class="inside"> | |||
3.3.6 | |||
用户在充值时使用第三方支付企业提供的服务应遵守与该第三方的各项协议及其服务规则。在使用第三方支付服务过程中,用户应妥善保管个人信息,包括但不限于银行卡账号、密码、验证码等。用户同意并确认,慧拍对因第三方支付服务产生的纠纷不承担任何责任。 | |||
用户在充值时使用第三方支付企业提供的服务应遵守与该第三方的各项协议及其服务规则。在使用第三方支付服务过程中,用户应妥善保管个人信息,包括但不限于银行卡账号、密码、验证码等。用户同意并确认,智像对因第三方支付服务产生的纠纷不承担任何责任。 | |||
</div> | |||
<div class="inside"> | |||
3.3.7 | |||
若因违反本协议条款,导致账号被冻结和/或终止使用的用户,不得因此要求慧拍作任何补偿或赔偿。 | |||
若因违反本协议条款,导致账号被冻结和/或终止使用的用户,不得因此要求智像作任何补偿或赔偿。 | |||
</div> | |||
<div class="inside"> | |||
3.3.8 | |||
若因慧拍“金币”充值系统自身充值故障原因造成用户充值失实,在慧拍恢复、存有有效数据和用户提供合法有效凭证的情况下,慧拍将根据用户充值情况作出变动及补救措施。 | |||
因慧拍“金币”充值系统自身故障原因,造成系统充值额小于用户实际充值额的,慧拍将补其差额。 | |||
因慧拍“金币”充值系统自身故障原因,造成系统充值额大于用户实际充值额的,慧拍有权追回差额。 | |||
若因智像“金币”充值系统自身充值故障原因造成用户充值失实,在智像恢复、存有有效数据和用户提供合法有效凭证的情况下,智像将根据用户充值情况作出变动及补救措施。 | |||
因智像“金币”充值系统自身故障原因,造成系统充值额小于用户实际充值额的,智像将补其差额。 | |||
因智像“金币”充值系统自身故障原因,造成系统充值额大于用户实际充值额的,智像有权追回差额。 | |||
</div> | |||
</div> | |||
</div> | |||
@@ -89,22 +89,22 @@ | |||
<div class="name">四、服务的变更、中止或终止</div> | |||
<div class="child"> | |||
4.1 本服务的中止或终止包含如下情况: | |||
因用户的违约或违规行为,慧拍主动中止或终止服务。 | |||
因国家或相关政府监管部门要求或发生不可抗力事件时,慧拍中止或终止服务。 | |||
因用户的违约或违规行为,智像主动中止或终止服务。 | |||
因国家或相关政府监管部门要求或发生不可抗力事件时,智像中止或终止服务。 | |||
其他根据法律法规应中止或终止服务的情况。 | |||
</div> | |||
<div class="child"> | |||
4.2 | |||
中止或终止服务后,慧拍会以法律允许的方式通知用户。当用户发现无法登录或享受服务时,可以咨询客服人员。 | |||
中止或终止服务后,智像会以法律允许的方式通知用户。当用户发现无法登录或享受服务时,可以咨询客服人员。 | |||
</div> | |||
<div class="child"> | |||
4.3 中止或终止后的处理: | |||
除法律规定的责任外,慧拍对本服务的中止或终止对用户和第三人不承担任何责任。 | |||
除法律规定的责任外,智像对本服务的中止或终止对用户和第三人不承担任何责任。 | |||
除法律规定或本协议另有约定外,已收取的费用不予退还。 | |||
</div> | |||
<div class="child"> | |||
4.4 | |||
对于本服务或本协议可能发生的变更(包括但不限于本协议修改、服务细则调整等),慧拍将根据本协议的约定通知用户。请用户仔细阅读并选择是否按照调整和/或变更后的本协议/服务细则等继续选择本服务。如用户同意上述调整和/或变更,用户可以继续使用本服务,以表明用户已经接受上述调整和/或变更。如用户不同意调整和/或变更,建议用户立即停止使用本服务。如用户对上述调整和/或变更有任何问题,可以咨询客服。 | |||
对于本服务或本协议可能发生的变更(包括但不限于本协议修改、服务细则调整等),智像将根据本协议的约定通知用户。请用户仔细阅读并选择是否按照调整和/或变更后的本协议/服务细则等继续选择本服务。如用户同意上述调整和/或变更,用户可以继续使用本服务,以表明用户已经接受上述调整和/或变更。如用户不同意调整和/或变更,建议用户立即停止使用本服务。如用户对上述调整和/或变更有任何问题,可以咨询客服。 | |||
</div> | |||
</div> | |||
@@ -112,11 +112,11 @@ | |||
<div class="name">五、违约责任</div> | |||
<div class="child"> | |||
5.1 | |||
如果慧拍发现用户有违反本协议任何行为的,慧拍有权进行独立判断并采取技术手段予以删除、屏蔽或断开相关信息。同时,慧拍有权视用户的行为性质,对用户采取包括但不限于暂停或终止部分或全部本服务、中止或终止用户对慧拍账号使用、追究法律责任等措施。由此给用户带来的损失(包括但不限于通信中断、相关数据清空、服务费用作为违约金而归慧拍所有等),由用户自行承担。造成慧拍损失的,用户也应予以赔偿。若慧拍依前述约定对用户采取暂停或终止部分或全部本服务的,慧拍无需向用户退还任何费用,剩余的服务费用作为违约金而归慧拍所有。 | |||
如果智像发现用户有违反本协议任何行为的,智像有权进行独立判断并采取技术手段予以删除、屏蔽或断开相关信息。同时,智像有权视用户的行为性质,对用户采取包括但不限于暂停或终止部分或全部本服务、中止或终止用户对智像账号使用、追究法律责任等措施。由此给用户带来的损失(包括但不限于通信中断、相关数据清空、服务费用作为违约金而归智像所有等),由用户自行承担。造成智像损失的,用户也应予以赔偿。若智像依前述约定对用户采取暂停或终止部分或全部本服务的,智像无需向用户退还任何费用,剩余的服务费用作为违约金而归智像所有。 | |||
</div> | |||
<div class="child"> | |||
5.2 | |||
如用户有违反本协议任何行为,导致任何第三方损害,用户应当独立承担责任。慧拍因此遭受损失的,用户也应当一并赔偿。 | |||
如用户有违反本协议任何行为,导致任何第三方损害,用户应当独立承担责任。智像因此遭受损失的,用户也应当一并赔偿。 | |||
</div> | |||
</div> | |||
@@ -144,7 +144,7 @@ | |||
</div> | |||
<div class="paragraph"> | |||
以上为慧拍“金币”充值协议的内容,请您仔细阅读并遵守。如您同意并愿意继续使用慧拍“金币”服务,请进行相应操作。如有任何疑问,请咨询客服人员。谢谢! | |||
以上为智像“金币”充值协议的内容,请您仔细阅读并遵守。如您同意并愿意继续使用智像“金币”服务,请进行相应操作。如有任何疑问,请咨询客服人员。谢谢! | |||
</div> | |||
</div> | |||
</template> | |||
@@ -4,7 +4,7 @@ | |||
<div class="date">生效日期:2023年8月2日</div> | |||
<div class="version">版本号:2023V1</div> | |||
<div class="paragraph"> | |||
欢迎您使用慧拍!为使用未序网络科技(上海)有限公司(以下简称“我方”)运营的慧拍客户端软件提供的相关服务(以下简称“我方平台服务”),您应当阅读并遵守《用户服务协议》(以下简称“本协议”)。建议您仔细阅读本协议的全部内容,尤其是以加粗形式展示的与您的权益(可能)存在重大关系的条款(包括相关约定免除或者限制责任的条款、法律适用和争议解决等条款),请您务必审慎阅读、充分理解个条款内容。各条款标题仅为帮助您理解该条款表达的主旨之用,不影响或限制本协议条款的含义或解释。 | |||
欢迎您使用智像!为使用未序网络科技(上海)有限公司(以下简称“我方”)运营的智像客户端软件提供的相关服务(以下简称“我方平台服务”),您应当阅读并遵守《用户服务协议》(以下简称“本协议”)。建议您仔细阅读本协议的全部内容,尤其是以加粗形式展示的与您的权益(可能)存在重大关系的条款(包括相关约定免除或者限制责任的条款、法律适用和争议解决等条款),请您务必审慎阅读、充分理解个条款内容。各条款标题仅为帮助您理解该条款表达的主旨之用,不影响或限制本协议条款的含义或解释。 | |||
</div> | |||
<div class="paragraph"> | |||
您点击同意或您使用我方平台服务(使用”行为指包括但不限于下载安装、启动、浏览、注册、登录等行为中的一种或多种,下同),即表示您已阅读并同意签署本协议所有内容,本协议即在您与我方之间产生法律效力,成为对双方均具有约束力的法律文件。如您不同意我方不时对本协议的修改或补充内容,您应放弃注册、停止使用或主动取消本服务。 | |||
@@ -21,7 +21,7 @@ | |||
</div> | |||
<div class="child"> | |||
1.2 | |||
我方平台:慧拍(www.metavatar.cc)向您提供的各项产品及/或服务的网站、客户端、小程序以及随技术发展出现的新形态。 | |||
我方平台:智像(www.metavatar.cc)向您提供的各项产品及/或服务的网站、客户端、小程序以及随技术发展出现的新形态。 | |||
</div> | |||
<div class="child"> | |||
1.3 | |||
@@ -56,7 +56,7 @@ | |||
3.2 账户说明 | |||
<div class="inside"> | |||
3.2.1 | |||
[账户获得]当您按照注册页面提示填写信息、阅读并同意本协议目完成全部注册程序后,您可获得我方平台账户(“慧拍账户”)并成为我方平台用户。 | |||
[账户获得]当您按照注册页面提示填写信息、阅读并同意本协议目完成全部注册程序后,您可获得我方平台账户(“智像账户”)并成为我方平台用户。 | |||
</div> | |||
<div class="inside"> | |||
3.2.2 | |||
@@ -69,7 +69,7 @@ | |||
<div class="name">4.1 我方平台服务</div> | |||
<div class="child"> | |||
4.1.1 | |||
服务范围:我方平台服务是指由我们提供的名称为慧拍的服务。根据您选择的功能不同,您可能将上传您的照片用于AI生成,系统将通过后期技术生成新的内容。“您的上传内容”与“AI生成内容”,统称为“您的内容”。 | |||
服务范围:我方平台服务是指由我们提供的名称为智像的服务。根据您选择的功能不同,您可能将上传您的照片用于AI生成,系统将通过后期技术生成新的内容。“您的上传内容”与“AI生成内容”,统称为“您的内容”。 | |||
</div> | |||
<div class="child"> | |||
4.1.2 | |||
@@ -79,7 +79,7 @@ | |||
4.1.3 知识产权: | |||
<div class="inside"> | |||
(1) | |||
我方知识产权:除非另有约定或我方另行声明,本服务所使用的我方平台内的所有内容及我方平台的Logo、“慧拍”等文字、图形及其组合,以及我方平台的其他标识、徽记、产品和服务名称均归我方或我方关联公司所有或控制。未经我方书面授权,任何人不得以任何方式展示、使用或作其他处理,也不得向他人表明您有权展示、使用或作其他处理。 | |||
我方知识产权:除非另有约定或我方另行声明,本服务所使用的我方平台内的所有内容及我方平台的Logo、“智像”等文字、图形及其组合,以及我方平台的其他标识、徽记、产品和服务名称均归我方或我方关联公司所有或控制。未经我方书面授权,任何人不得以任何方式展示、使用或作其他处理,也不得向他人表明您有权展示、使用或作其他处理。 | |||
</div> | |||
<div class="inside"> | |||
(2) | |||
@@ -105,9 +105,17 @@ function previewImage(index) { | |||
//#region 页面跳转 | |||
function bueCoin() { | |||
uni.navigateTo({ | |||
url: "/pages/home/buyCoin", | |||
}); | |||
if (userInfoModulesPinia.platForm == 3) { | |||
uni.showToast({ | |||
title: "暂未开放", | |||
icon: "none", | |||
mask: true, | |||
}); | |||
} else { | |||
uni.navigateTo({ | |||
url: "/pages/index/buyCoin", | |||
}); | |||
} | |||
} | |||
//#endregion --------------------- | |||
@@ -0,0 +1,106 @@ | |||
<template> | |||
<camera output-dimension="540" :device-position="cameraPosition"> | |||
<cover-image | |||
src="../../assets/img/people.png" | |||
style="width: 100%; height: 700rpx; margin-top: 100rpx" | |||
></cover-image> | |||
<!-- <button type="primary" @click="takePhoto">拍照</button> --> | |||
<view class="btnBox"> | |||
<view class="takePhoto" style="opacity: 0">闪光灯</view> | |||
<view class="takePhoto" @click="takePhoto">拍照</view> | |||
<view class="device" @click="device"> | |||
<image src="../../assets/img/reset.png" mode="scaleToFill" /> | |||
</view> | |||
</view> | |||
</camera> | |||
</template> | |||
<script setup> | |||
import { ref } from "vue"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
const userInfoModulesPinia = userInfoModules(); | |||
const cameraPosition = ref("back"); // 后置摄像头 | |||
// const cameraFlash = ref("auto"); // 自动闪光灯 | |||
// 翻转摄像头 | |||
function device() { | |||
if (cameraPosition.value == "back") { | |||
cameraPosition.value = "front"; | |||
} else { | |||
cameraPosition.value = "back"; | |||
} | |||
} | |||
function takePhoto() { | |||
const ctx = uni.createCameraContext(); | |||
ctx.takePhoto({ | |||
quality: "high", | |||
success: (res) => { | |||
// 拍照成功后的回调 | |||
// onPhotoTaken(res.tempImagePath); | |||
userInfoModulesPinia.photoPath = res.tempImagePath; | |||
uni.setStorageSync("action", 2); | |||
uni.switchTab({ | |||
url: "/pages/uploadPhoto/uploadPhoto", | |||
}); | |||
}, | |||
fail: (err) => { | |||
console.error("拍照失败", err); | |||
}, | |||
}); | |||
} | |||
// const takePhoto = () => { | |||
// // 调用拍照方法 | |||
// uni.takePhoto({ | |||
// success: (res) => { | |||
// // 拍照成功后的回调 | |||
// // onPhotoTaken(res.tempImagePath); | |||
// userInfoModulesPinia.photoPath = res.tempImagePath; | |||
// uni.setStorageSync("action", 2); | |||
// uni.switchTab({ | |||
// url: "/pages/uploadPhoto/uploadPhoto", | |||
// }); | |||
// }, | |||
// fail: (err) => { | |||
// console.error("拍照失败", err); | |||
// }, | |||
// }); | |||
// }; | |||
const onScanCode = (e) => { | |||
console.log("Scanned Code: ", e.detail); | |||
}; | |||
</script> | |||
<style lang="scss"> | |||
camera { | |||
width: 100vw; | |||
height: 100vh; | |||
.btnBox { | |||
width: 100%; | |||
position: absolute; | |||
bottom: 50rpx; | |||
display: flex; | |||
// flex-direction: column; | |||
align-items: center; | |||
justify-content: space-evenly; | |||
.takePhoto { | |||
width: 120rpx; | |||
height: 120rpx; | |||
border-radius: 60rpx; | |||
line-height: 120rpx; | |||
text-align: center; | |||
background-color: #fd4e00; | |||
color: #fff; | |||
font-size: 40rpx; | |||
} | |||
.device { | |||
image { | |||
margin-top: 0rpx; | |||
width: 120rpx; | |||
height: 120rpx; | |||
} | |||
} | |||
} | |||
} | |||
</style> |
@@ -37,7 +37,7 @@ | |||
<script setup> | |||
//#region 导入 | |||
import { ref, reactive } from "vue"; | |||
import { voiceTotalApi } from "../../api/login.js"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
import imageCompression from "browser-image-compression"; //压缩图片插件 | |||
import { onShow } from "@dcloudio/uni-app"; | |||
@@ -61,7 +61,7 @@ function router2(url) { | |||
} | |||
function getRandomRange() { | |||
randomNum.value = Math.floor(Math.random() * (100 - 81)) + 80; | |||
randomNum.value = Math.floor(Math.random() * (99 - 95 + 1)) + 95; | |||
} | |||
//#endregion --------------------- | |||
@@ -22,15 +22,15 @@ | |||
<!-- 上传按钮 --> | |||
<image | |||
class="addImg" | |||
v-show="!showImgUrl" | |||
v-show="!showImgUrl && !userInfoModulesPinia.myAvatar" | |||
src="../../assets/icon/add.png" | |||
alt="" | |||
/> | |||
<!-- @click.prevent="chooseImage" --> | |||
<image | |||
class="showImg" | |||
v-show="showImgUrl" | |||
:src="showImgUrl" | |||
v-show="showImgUrl || userInfoModulesPinia.myAvatar" | |||
:src="showImgUrl ? showImgUrl : userInfoModulesPinia.myAvatar" | |||
alt="" | |||
mode="aspectFit" | |||
/> | |||
@@ -47,7 +47,7 @@ | |||
<view class="grayBtn" v-if="uploadState == 4" @click="chooseImage" | |||
>重新上传</view | |||
> | |||
<view class="free"> | |||
<view class="free" v-if="countNum == 0"> | |||
<image src="../../assets/icon/blackBG.png" mode="aspectFit" /> | |||
<text>新用户免费制作</text> | |||
</view> | |||
@@ -80,24 +80,32 @@ | |||
</view> | |||
</view> | |||
</view> | |||
<!-- 摄像头 --> | |||
<!-- <camera> | |||
<cover-image | |||
src="../../assets/img/people.png" | |||
style="width: 100%; height: 700rpx; margin-top: 100rpx" | |||
></cover-image> | |||
<button type="primary" @click="takePhoto">拍照</button> | |||
</camera> --> | |||
</view> | |||
</template> | |||
<script setup> | |||
//#region 导入 | |||
import { ref, reactive, nextTick } from "vue"; | |||
import { | |||
onLoad, | |||
onShareAppMessage, | |||
onShareTimeline, | |||
onAddToFavorites, | |||
onShow, | |||
} from "@dcloudio/uni-app"; | |||
import { BASE_URL } from "../../utils/request"; | |||
import { onLoad, onShow } from "@dcloudio/uni-app"; | |||
import { loginApi } from "../../api/login"; | |||
import { addImageApi } from "../../api/uploadphoto.js"; | |||
import { | |||
addImageApi, | |||
getProjectConfigApi, | |||
getCountApi, | |||
} from "../../api/uploadphoto.js"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
import imageCompression from "browser-image-compression"; //压缩图片插件 | |||
import { findImageApi, findGlodApi } from "../../api/home"; | |||
//#endregion | |||
const userInfoModulesPinia = userInfoModules(); | |||
@@ -105,13 +113,11 @@ const userInfoModulesPinia = userInfoModules(); | |||
const uploadState = ref(1); //上传状态 | |||
const showImgUrl = ref(""); //回显路径 压缩 | |||
const showImgUrl2 = ref(null); //回显路径 未压缩 | |||
const showImgData = ref(null); //上传数据 | |||
// 点击上传图片 | |||
// 点击上传图片或打开相机 | |||
function chooseImage() { | |||
console.log("chooseImage"); | |||
// 检查token | |||
if (!userInfoModulesPinia.token) { | |||
if (!uni.getStorageSync("token")) { | |||
uni.showModal({ | |||
title: "提示", | |||
content: "登录以体验完整功能", | |||
@@ -135,7 +141,7 @@ function chooseImage() { | |||
uploadState.value = 2; | |||
// 图片压缩 | |||
console.log(res.tempFiles[0].size); | |||
showImgUrl2.value = res.tempFiles[0]; | |||
// showImgUrl2.value = res.tempFiles[0]; | |||
if (userInfoModulesPinia.platForm != 1) { | |||
uni.compressImage({ | |||
src: res.tempFilePaths[0], | |||
@@ -156,7 +162,6 @@ function chooseImage() { | |||
); | |||
//compressedFile是一个blob对象 | |||
showImgUrl.value = URL.createObjectURL(compressedFile); | |||
showImgData.value = compressedFile; | |||
} | |||
}, | |||
fail: (err) => { | |||
@@ -173,7 +178,7 @@ function chooseImage() { | |||
// console.log(userInfoModulesPinia.token, "token"); | |||
async function toCloseStyle() { | |||
// 检查token | |||
if (!userInfoModulesPinia.token) { | |||
if (!uni.getStorageSync("token")) { | |||
uni.showModal({ | |||
title: "提示", | |||
content: "登录以体验完整功能", | |||
@@ -191,10 +196,10 @@ async function toCloseStyle() { | |||
}); | |||
} else { | |||
if (!showImgUrl.value) { | |||
uni.showToast({ | |||
title: "请先上传图片", | |||
icon: "none", | |||
}); | |||
// uni.showToast({ | |||
// title: "请先上传图片", | |||
// icon: "none", | |||
// }); | |||
chooseImage(); | |||
return; | |||
} | |||
@@ -204,18 +209,18 @@ async function toCloseStyle() { | |||
}); | |||
uploadState.value = 3; | |||
console.log(showImgUrl.value); | |||
console.log(showImgUrl2.value.path); | |||
console.log(showImgUrl2.value); | |||
// 百度敏感信息检测 | |||
uni.uploadFile({ | |||
url: "https://test.metavatar.cc/C/api/baidu/checkPhoto", //上传图片api | |||
filePath: showImgUrl2.value.path, | |||
url: BASE_URL + "api/baidu/checkPhoto", //上传图片api | |||
filePath: showImgUrl.value, | |||
name: "file", | |||
formData: { | |||
user: "test", | |||
}, | |||
header: { | |||
// Authorization: userInfoModulesPinia.token, | |||
token: userInfoModulesPinia.token, | |||
token: uni.getStorageSync("token"), | |||
}, | |||
success: (res0) => { | |||
if (JSON.parse(res0.data).code != 200) { | |||
@@ -225,15 +230,15 @@ async function toCloseStyle() { | |||
} | |||
// 人脸识别接口 | |||
uni.uploadFile({ | |||
url: "https://test.metavatar.cc/C/api/userDigital/checkPhoto", //上传图片api | |||
filePath: showImgUrl2.value.path, | |||
url: BASE_URL + "api/userDigital/checkPhoto", //上传图片api | |||
filePath: showImgUrl.value, | |||
name: "file", | |||
formData: { | |||
user: "test", | |||
}, | |||
header: { | |||
// Authorization: userInfoModulesPinia.token, | |||
token: userInfoModulesPinia.token, | |||
token: uni.getStorageSync("token"), | |||
}, | |||
success: (res) => { | |||
if (JSON.parse(res.data).code != 200) { | |||
@@ -243,8 +248,8 @@ async function toCloseStyle() { | |||
} | |||
// 上传接口 | |||
uni.uploadFile({ | |||
url: "https://test.metavatar.cc/C/api/upload/awsImgUpload", //上传图片api | |||
filePath: showImgUrl2.value.path, | |||
url: BASE_URL + "api/upload/awsImgUpload", //上传图片api | |||
filePath: showImgUrl.value, | |||
name: "file", | |||
formData: { | |||
user: "test", | |||
@@ -327,93 +332,213 @@ async function toCloseStyle() { | |||
//#region 页面初始化 | |||
onLoad((options) => { | |||
// showImgUrl.value = userInfoModulesPinia.myAvatar; | |||
// 微信登录授权 | |||
if (userInfoModulesPinia.platForm != 1) { | |||
uni.login({ | |||
provider: "weixin", // 使用微信登录授权 | |||
success: async (res) => { | |||
console.log(res); | |||
if (res.code) { | |||
console.log(res.code); | |||
try { | |||
uni.showLoading({ | |||
title: "加载中...", | |||
mask: true, | |||
}); | |||
const data = { | |||
appId: "wx75cf14e3a0d45821", | |||
code: res.code, | |||
}; | |||
const res2 = await loginApi(data); | |||
userInfoModulesPinia.openId = res2.data.openId; | |||
if (res2.data.token) { | |||
userInfoModulesPinia.token = res2.data.token; | |||
// uni.setStorageSync("token", userInfoModulesPinia.token); | |||
console.log(userInfoModulesPinia.openId, "获取openid"); | |||
// 获取头像和金币 | |||
const res3 = await findImageApi(); | |||
userInfoModulesPinia.myAvatar = | |||
res3.data && res3.data.image ? res3.data.image : ""; | |||
const res4 = await findGlodApi(); | |||
if (!res4.data) { | |||
userInfoModulesPinia.myGlod = 0; | |||
} else { | |||
userInfoModulesPinia.myGlod = res4.data.digitalAvatarResidueGlod | |||
? res4.data.digitalAvatarResidueGlod | |||
: 0; | |||
} | |||
uni.hideLoading(); | |||
if (res2.data.token) { | |||
uni.getSystemInfo({ | |||
success: function (res) { | |||
let uniPlatform = ""; | |||
let osName = ""; | |||
if (res.uniPlatform == "web") { | |||
uniPlatform = 1; | |||
} else if (res.uniPlatform == "mp-weixin") { | |||
uni.setStorageSync("plat", 1); | |||
uniPlatform = 2; | |||
} else if (res.uniPlatform == "mp-toutiao") { | |||
uni.setStorageSync("plat", 2); | |||
uniPlatform = 3; | |||
} | |||
if (res.osName == "windows") { | |||
osName = 1; | |||
} else if (res.osName == "ios") { | |||
osName = 2; | |||
} else if (res.osName == "android") { | |||
osName = 3; | |||
} else if (res.osName == "mac") { | |||
osName = 4; | |||
} else if (res.osName == "linux") { | |||
osName = 5; | |||
} | |||
userInfoModulesPinia.platForm = uniPlatform; // 平台 | |||
userInfoModulesPinia.hostSystem = osName; // 系统 | |||
console.log(res.uniPlatform, uniPlatform, "PlatForm"); | |||
console.log(res.osName, osName, "System"); | |||
}, | |||
complete: function (res) { | |||
// 获取微信小程序的 AppID | |||
// const appid = uni.getAccountInfoSync().miniProgram.appId; | |||
// 微信登录授权 | |||
if (userInfoModulesPinia.platForm == 2) { | |||
uni.login({ | |||
provider: "weixin", // 使用微信登录授权 | |||
success: async (res) => { | |||
console.log(res, "uni.login"); | |||
if (res.code) { | |||
try { | |||
uni.showLoading({ | |||
title: "加载中...", | |||
mask: true, | |||
}); | |||
const data = { | |||
appId: userInfoModulesPinia.getAppId(), | |||
code: res.code, | |||
}; | |||
const res2 = await loginApi(data); | |||
userInfoModulesPinia.openId = res2.data.openId; | |||
if (res2.data.token) { | |||
userInfoModulesPinia.token = res2.data.token; | |||
uni.setStorageSync("token", userInfoModulesPinia.token); | |||
console.log(userInfoModulesPinia.openId, "获取openid"); | |||
// 获取头像和金币 | |||
const res3 = await findImageApi(); | |||
if (res3.data) { | |||
uni.setStorageSync("userId", res3.data.id); | |||
} | |||
userInfoModulesPinia.myAvatar = | |||
res3.data && res3.data.image ? res3.data.image : ""; | |||
const res4 = await findGlodApi(); | |||
if (res4.data) { | |||
uni.setStorageSync("userId", res4.data.id); | |||
} | |||
if (!res4.data) { | |||
userInfoModulesPinia.myGlod = 0; | |||
} else { | |||
userInfoModulesPinia.myGlod = res4.data | |||
.digitalAvatarResidueGlod | |||
? res4.data.digitalAvatarResidueGlod | |||
: 0; | |||
} | |||
uni.hideLoading(); | |||
if (res2.data.token) { | |||
// uni.redirectTo({ | |||
// url: "/pages/index/index", | |||
// }); | |||
} else { | |||
uni.redirectTo({ | |||
url: "/pages/login/index", | |||
}); | |||
console.log("error1"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} | |||
uni.hideLoading(); | |||
} catch (error) { | |||
// uni.redirectTo({ | |||
// url: "/pages/index/index", | |||
// url: "pages/index/index", | |||
// }); | |||
} else { | |||
uni.redirectTo({ | |||
url: "/pages/login/index", | |||
}); | |||
console.log("error1"); | |||
console.log(error, "error2"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} else { | |||
// uni.redirectTo({ | |||
// url: "pages/index/index", | |||
// }); | |||
console.log("error3"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
uni.hideLoading(); | |||
} catch (error) { | |||
}, | |||
fail: (err) => { | |||
// uni.redirectTo({ | |||
// url: "pages/index/index", | |||
// }); | |||
console.log(error, "error2"); | |||
console.log("error4"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} else { | |||
// uni.redirectTo({ | |||
// url: "pages/index/index", | |||
// }); | |||
console.log("error3"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
}, | |||
fail: (err) => { | |||
// uni.redirectTo({ | |||
// url: "pages/index/index", | |||
// }); | |||
console.log("error4"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}, | |||
}); | |||
}, | |||
}); | |||
} | |||
console.log(options); | |||
} | |||
// 抖音头条授权 | |||
else if (userInfoModulesPinia.platForm == 3) { | |||
console.log("platForm3"); | |||
uni.login({ | |||
provider: "toutiao", // 使用抖音登录授权 | |||
success: async (res) => { | |||
if (res.code) { | |||
console.log("code"); | |||
try { | |||
uni.showLoading({ | |||
title: "加载中...", | |||
mask: true, | |||
}); | |||
const data = { | |||
appId: userInfoModulesPinia.getAppId(), | |||
code: res.code, | |||
}; | |||
const res2 = await loginApi(data); | |||
userInfoModulesPinia.openId = res2.data.openId; | |||
if (res2.data.token) { | |||
console.log(res2.data.token, "res2.data.token"); | |||
userInfoModulesPinia.token = res2.data.token; | |||
uni.setStorageSync("token", userInfoModulesPinia.token); | |||
console.log(userInfoModulesPinia.openId, "获取openid"); | |||
// 获取头像和金币 | |||
const res3 = await findImageApi(); | |||
userInfoModulesPinia.myAvatar = | |||
res3.data && res3.data.image ? res3.data.image : ""; | |||
const res4 = await findGlodApi(); | |||
if (!res4.data) { | |||
userInfoModulesPinia.myGlod = 0; | |||
} else { | |||
userInfoModulesPinia.myGlod = res4.data | |||
.digitalAvatarResidueGlod | |||
? res4.data.digitalAvatarResidueGlod | |||
: 0; | |||
} | |||
getCount(); | |||
uni.hideLoading(); | |||
} else { | |||
uni.hideLoading(); | |||
uni.setStorageSync("token", null); | |||
uni.redirectTo({ | |||
url: "/pages/login/index", | |||
}); | |||
console.log("error1"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
uni.hideLoading(); | |||
} catch (error) { | |||
uni.hideLoading(); | |||
console.log(error, "error2"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
} else { | |||
console.log("error3"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
} | |||
}, | |||
fail: (err) => { | |||
console.log("error4"); | |||
uni.showToast({ | |||
title: "登录失败,请重试", | |||
icon: "none", | |||
}); | |||
}, | |||
}); | |||
} | |||
}, | |||
}); | |||
// 如果是从相机页返回 | |||
}); | |||
onShow(() => { | |||
// 若来自我的页面的更换头像按钮,直接触发以下操作 | |||
@@ -422,28 +547,16 @@ onShow(() => { | |||
chooseImage(); | |||
uni.removeStorageSync("action"); | |||
} | |||
// 若来相机页拍照,直接触发以下操作 | |||
if (uni.getStorageSync("action") == 2) { | |||
showImgUrl.value = userInfoModulesPinia.photoPath; | |||
toCloseStyle(); | |||
uni.removeStorageSync("action"); | |||
} | |||
getCount(); | |||
}); | |||
//#endregion --------------------- | |||
onShareAppMessage((res) => { | |||
return { | |||
title: "邃芒智像", | |||
}; | |||
}); | |||
// 分享到朋友圈 | |||
onShareTimeline((res) => { | |||
return { | |||
title: "邃芒智像", | |||
}; | |||
}); | |||
// 收藏 | |||
onAddToFavorites((res) => { | |||
return { | |||
title: "邃芒智像", | |||
}; | |||
}); | |||
//#region 公共方法 | |||
function goOtherPage(url) { | |||
@@ -453,6 +566,58 @@ function goOtherPage(url) { | |||
} | |||
//#endregion --------------------- | |||
//#region 相机 | |||
const photoPath = ref(null); | |||
function takePhoto() { | |||
const ctx = uni.createCameraContext(); | |||
ctx.takePhoto({ | |||
quality: "high", | |||
success: (res) => { | |||
showImgUrl.value = res.tempImagePath; | |||
}, | |||
}); | |||
} | |||
//#endregion --------------------- | |||
//#region 获取邀请 注册等奖励金币数量 | |||
async function getProjectConfig() { | |||
const data1 = { | |||
projectType: 5, | |||
type: 1, | |||
}; | |||
const data2 = { | |||
projectType: 5, | |||
type: 2, | |||
}; | |||
try { | |||
const res1 = await getProjectConfigApi(data1); | |||
uni.setStorageSync("loginAwardCoin", res1.data.glodNum); | |||
const res2 = await getProjectConfigApi(data2); | |||
uni.setStorageSync("inviteAwardCoin", res2.data.glodNum); | |||
} catch (error) { | |||
console.log("获取邀请 注册等奖励金币数量失败", error); | |||
} | |||
} | |||
getProjectConfig(); | |||
//#endregion --------------------- | |||
//#region 是否首次生成 | |||
const countNum = ref(0); | |||
async function getCount() { | |||
try { | |||
const res = await getCountApi(); | |||
if (res.data) { | |||
countNum.value = res.data; | |||
} else { | |||
countNum.value = 0; | |||
} | |||
} catch (error) { | |||
console.log("是否首次生成", error); | |||
} | |||
} | |||
//#endregion --------------------- | |||
//#region | |||
//#endregion --------------------- | |||
@@ -14,6 +14,9 @@ export const userInfoModules = defineStore("userInfoStore", () => { | |||
const token = ref(null) | |||
const myAvatar = ref('') | |||
const myGlod = ref(0) | |||
const wxappid = "wx75cf14e3a0d45821" | |||
const dyappid = "tt2eba5807b1883f9f01" | |||
const photoPath = ref(null) //自定义相机拍照得到照片路径 | |||
/** | |||
* @description:依托平台:(web、mp-weixin、mp-toutiao) | |||
* @example 平台名:"web-H5",枚举值:1 | |||
@@ -40,7 +43,14 @@ export const userInfoModules = defineStore("userInfoStore", () => { | |||
// async function getMyGlod(params) { | |||
// } | |||
return { userInfo, openId, token, myAvatar, myGlod, platForm, hostSystem }; | |||
function getAppId() { | |||
if (platForm.value == 2) { | |||
return wxappid | |||
} else if (platForm.value == 3) { | |||
return dyappid | |||
} | |||
} | |||
return { userInfo, openId, token, myAvatar, myGlod, platForm, hostSystem, wxappid, dyappid, getAppId }; | |||
}, | |||
{ | |||
@@ -1,7 +1,8 @@ | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
import { store } from '@/store/index'; | |||
const BASE_URL = 'https://test.metavatar.cc/C/'; | |||
// const BASE_URL = 'https://test.metavatar.cc/C/'; | |||
const BASE_URL = 'https://mtest.metavatar.cc/C/'; | |||
const userInfoModulesPinia = userInfoModules(store); | |||
// const BASE_URL = 'https://test.metavatar.cc/'; | |||
@@ -15,10 +16,12 @@ const request = (requestObj) => { | |||
data: requestObj.data, | |||
header: { | |||
// Authorization: userInfoModulesPinia.token, | |||
token: userInfoModulesPinia.token, | |||
// token: userInfoModulesPinia.token, | |||
token: uni.getStorageSync("token"), | |||
}, | |||
success: (res) => { | |||
if (res.data.code == 1052) { | |||
uni.setStorageSync("token", null) | |||
uni.reLaunch({ | |||
url: "/pages/login/index?type=tokenFfalse", | |||
}); | |||
@@ -45,4 +48,4 @@ const request = (requestObj) => { | |||
}) | |||
}) | |||
}; | |||
export default request | |||
export { BASE_URL, request } |
@@ -0,0 +1,26 @@ | |||
export default { | |||
onShareAppMessage() { | |||
return { | |||
title: "邃芒智像", | |||
path: `/pages/login/index?userId=${uni.getStorageSync('userId')}`, | |||
}; | |||
}, | |||
// 分享到朋友圈 | |||
onShareTimeline() { | |||
return { | |||
title: "邃芒智像", | |||
path: `/pages/login/index?userId=${uni.getStorageSync('userId')}`, | |||
}; | |||
}, | |||
// 收藏 | |||
onAddToFavorites() { | |||
return { | |||
title: "邃芒智像", | |||
}; | |||
} | |||
} |