@@ -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,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> |
@@ -30,6 +30,12 @@ | |||
"navigationBarTitleText": "上传成功" | |||
} | |||
}, | |||
{ | |||
"path": "pages/uploadPhoto/camera ", | |||
"style": { | |||
"navigationBarTitleText": "拍照" | |||
} | |||
}, | |||
{ | |||
"path": "pages/closeStyle/closeStyle", | |||
"style": { | |||
@@ -2,12 +2,12 @@ | |||
<div class="page"> | |||
<!-- 性别tab --> | |||
<view class="sexTab"> | |||
<view @click="sex = 1" class="sex" :class="sex == 1 ? 'sexActive' : ''" | |||
>男</view | |||
> | |||
<view @click="sex = 2" class="sex" :class="sex == 2 ? 'sexActive' : ''" | |||
>女</view | |||
> | |||
<view @click="sex = 1" class="sex" :class="sex == 1 ? 'sexActive' : ''" | |||
>男</view | |||
> | |||
</view> | |||
<u-list | |||
class="styleListBox" | |||
@@ -56,7 +56,7 @@ import { getListApi } from "../../api/closeStyle"; | |||
//#region 列表加载 | |||
const pageNum = ref(1); | |||
const pageSize = ref(20); | |||
const sex = ref(1); //1男2女 | |||
const sex = ref(2); //1男2女 | |||
const styleList = ref([]); | |||
// 得到列表 | |||
async function getList() { | |||
@@ -158,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, | |||
}, | |||
]); | |||
@@ -328,6 +325,19 @@ async function createing(id) { | |||
? 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(); | |||
@@ -218,6 +218,7 @@ import { | |||
findGlodApi, | |||
getPhotoListApi, | |||
getConsumeListApi, | |||
getInviteListApi, | |||
deleteApi, | |||
} from "../../api/home.js"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
@@ -304,13 +305,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); | |||
} | |||
@@ -402,6 +404,39 @@ function getSymbol(type) { | |||
} | |||
//#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 { | |||
pageNum2.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" | |||
); | |||
@@ -479,6 +514,7 @@ onLoad(async () => { | |||
findGlod(); | |||
getPhotoList(pageSize1.value, pageNum1.value); | |||
getConsumeList(pageSize2.value, pageNum2.value); | |||
getInviteList(pageSize3.value, pageNum3.value); | |||
} | |||
// setTimeout(() => { | |||
// findImage(); | |||
@@ -691,12 +727,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; | |||
} | |||
} | |||
// 视频列表 | |||
@@ -59,7 +59,12 @@ | |||
<script setup> | |||
//#region 导入 | |||
import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app"; | |||
import { | |||
onLoad, | |||
onHide, | |||
onShareAppMessage, | |||
onShareTimeline, | |||
} from "@dcloudio/uni-app"; | |||
import { BASE_URL } from "../../utils/request"; | |||
import { ref, reactive, watch } from "vue"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
@@ -79,9 +84,14 @@ onLoad(async (options) => { | |||
await getSwiperList(); | |||
await getSupperPhotoState(swiperList.value[0].id); | |||
}); | |||
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); | |||
createState.value = res.data.status; | |||
@@ -96,10 +106,14 @@ async function getSwiperList() { | |||
} | |||
}); | |||
} | |||
if (createState.value != 2) { | |||
setTimeout(() => { | |||
timer.value = setTimeout(() => { | |||
getSwiperList(); | |||
}, 3000); | |||
} else { | |||
clearTimeout(timer); | |||
timer.value = null; | |||
} | |||
} | |||
//#endregion --------------------- | |||
@@ -428,9 +442,10 @@ async function getUserQrcode() { | |||
} | |||
.logo { | |||
width: 520rpx; | |||
width: 260rpx; | |||
margin: 90rpx; | |||
animation: rotateAnimation 3s 0s infinite; | |||
opacity: 0.7; | |||
} | |||
@keyframes rotateAnimation { | |||
0% { | |||
@@ -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> |
@@ -47,10 +47,10 @@ | |||
<view class="grayBtn" v-if="uploadState == 4" @click="chooseImage" | |||
>重新上传</view | |||
> | |||
<view class="free"> | |||
<!-- <view class="free" v-if="false"> | |||
<image src="../../assets/icon/blackBG.png" mode="aspectFit" /> | |||
<text>新用户免费制作</text> | |||
</view> | |||
</view> --> | |||
</view> | |||
<!-- 底部盒子 --> | |||
<view class="bottomBox"> | |||
@@ -80,6 +80,14 @@ | |||
</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> | |||
@@ -100,9 +108,8 @@ const userInfoModulesPinia = userInfoModules(); | |||
const uploadState = ref(1); //上传状态 | |||
const showImgUrl = ref(""); //回显路径 压缩 | |||
const showImgUrl2 = ref(null); //回显路径 未压缩 | |||
const showImgData = ref(null); //上传数据 | |||
// 点击上传图片 | |||
// 点击上传图片或打开相机 | |||
function chooseImage() { | |||
// 检查token | |||
if (!userInfoModulesPinia.token) { | |||
@@ -129,7 +136,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], | |||
@@ -150,7 +157,6 @@ function chooseImage() { | |||
); | |||
//compressedFile是一个blob对象 | |||
showImgUrl.value = URL.createObjectURL(compressedFile); | |||
showImgData.value = compressedFile; | |||
} | |||
}, | |||
fail: (err) => { | |||
@@ -198,11 +204,11 @@ async function toCloseStyle() { | |||
}); | |||
uploadState.value = 3; | |||
console.log(showImgUrl.value); | |||
console.log(showImgUrl2.value.path); | |||
console.log(showImgUrl2.value); | |||
// 百度敏感信息检测 | |||
uni.uploadFile({ | |||
url: BASE_URL + "api/baidu/checkPhoto", //上传图片api | |||
filePath: showImgUrl2.value.path, | |||
filePath: showImgUrl.value, | |||
name: "file", | |||
formData: { | |||
user: "test", | |||
@@ -220,7 +226,7 @@ async function toCloseStyle() { | |||
// 人脸识别接口 | |||
uni.uploadFile({ | |||
url: BASE_URL + "api/userDigital/checkPhoto", //上传图片api | |||
filePath: showImgUrl2.value.path, | |||
filePath: showImgUrl.value, | |||
name: "file", | |||
formData: { | |||
user: "test", | |||
@@ -238,7 +244,7 @@ async function toCloseStyle() { | |||
// 上传接口 | |||
uni.uploadFile({ | |||
url: BASE_URL + "api/upload/awsImgUpload", //上传图片api | |||
filePath: showImgUrl2.value.path, | |||
filePath: showImgUrl.value, | |||
name: "file", | |||
formData: { | |||
user: "test", | |||
@@ -350,7 +356,9 @@ onLoad((options) => { | |||
userInfoModulesPinia.myAvatar = | |||
res3.data && res3.data.image ? res3.data.image : ""; | |||
const res4 = await findGlodApi(); | |||
uni.setStorageSync("userId", res4.data.id); | |||
if (res4.data) { | |||
uni.setStorageSync("userId", res4.data.id); | |||
} | |||
if (!res4.data) { | |||
userInfoModulesPinia.myGlod = 0; | |||
} else { | |||
@@ -479,6 +487,7 @@ onLoad((options) => { | |||
}, | |||
}); | |||
} | |||
// 如果是从相机页返回 | |||
}); | |||
onShow(() => { | |||
// 若来自我的页面的更换头像按钮,直接触发以下操作 | |||
@@ -487,6 +496,12 @@ onShow(() => { | |||
chooseImage(); | |||
uni.removeStorageSync("action"); | |||
} | |||
// 若来相机页拍照,直接触发以下操作 | |||
if (uni.getStorageSync("action") == 2) { | |||
showImgUrl.value = userInfoModulesPinia.photoPath; | |||
toCloseStyle(); | |||
uni.removeStorageSync("action"); | |||
} | |||
}); | |||
//#endregion --------------------- | |||
@@ -499,6 +514,19 @@ 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 | |||
//#endregion --------------------- | |||
@@ -16,6 +16,7 @@ export const userInfoModules = defineStore("userInfoStore", () => { | |||
const myGlod = ref(0) | |||
const wxappid = "wx75cf14e3a0d45821" | |||
const dyappid = "tt2eba5807b1883f9f01" | |||
const photoPath = ref(null) //自定义相机拍照得到照片路径 | |||
/** | |||
* @description:依托平台:(web、mp-weixin、mp-toutiao) | |||
* @example 平台名:"web-H5",枚举值:1 | |||