diff --git a/src/App.vue b/src/App.vue index 0aea4f4..63b7991 100644 --- a/src/App.vue +++ b/src/App.vue @@ -63,7 +63,7 @@ onLaunch(() => { uni.hideLoading(); if (res2.data.token) { uni.redirectTo({ - url: "/pages/index/index", + url: "/pages/home/index", }); } else { uni.redirectTo({ diff --git a/src/api/closeStyle.js b/src/api/closeStyle.js new file mode 100644 index 0000000..5bad618 --- /dev/null +++ b/src/api/closeStyle.js @@ -0,0 +1,34 @@ +import request from "../utils/request" + +// 获取风格列表 +export function getListApi(pageNum, pageSize) { + return request({ + url: `api/digitalAvatarMould/list?pageNum=${pageNum}&pageSize=${pageSize}`, + method: 'GET', + }) +} + +// 根据iD获取详情 +export function findByIdApi(id) { + return request({ + url: `api/digitalAvatarMould/findById?id=${id}`, + method: 'GET', + }) +} + +// 查询用户头像照片,生成写真时需要 +export function findImageApi() { + return request({ + url: `api/userDigital/findImage`, + method: 'GET', + }) +} + +// 生成写真 +export function createPhotoApi(data) { + return request({ + url: `api/digitalAvatarPhoto/createPhoto`, + method: 'POST', + data + }) +} \ No newline at end of file diff --git a/src/api/createing.js b/src/api/createing.js new file mode 100644 index 0000000..dd736c8 --- /dev/null +++ b/src/api/createing.js @@ -0,0 +1,9 @@ +import request from "../utils/request" + +// 获取风格列表 +export function findWorkByIdApi(id) { + return request({ + url: `api/digitalAvatarPhoto/findById?id=${id}`, + method: 'GET', + }) +} \ No newline at end of file diff --git a/src/api/uploadphoto.js b/src/api/uploadphoto.js new file mode 100644 index 0000000..c2d48b5 --- /dev/null +++ b/src/api/uploadphoto.js @@ -0,0 +1,30 @@ +import request from "../utils/request" + +// /api/baidu/checkPhoto +// /api/userDigital/checkPhoto +// /api/upload/awsImgUpload //上传,先上传后保存 +// /api/userDigital/addImage //保存 +// { +// "image": +// } +// 百度人脸识别 +export function baiduPhotoApi(data) { + const formData = new FormData(); + formData.append('file', data); + return request({ + url: 'api/baidu/checkPhoto', + method: 'post', + data: formData, + headers: { + 'Content-Type': 'application/form-data' + } + }); +} + +export function addImageApi(data) { + return request({ + url: 'api/userDigital/addImage', + method: 'post', + data + }); +} \ No newline at end of file diff --git a/src/pages/closeStyle/closeStyle.vue b/src/pages/closeStyle/closeStyle.vue index a6abcd5..cde7a3e 100644 --- a/src/pages/closeStyle/closeStyle.vue +++ b/src/pages/closeStyle/closeStyle.vue @@ -4,13 +4,13 @@ - - - 样式风格 - 单人 + + + {{ item.title }} + {{ peopleNum(item.mouldType) }} @@ -22,23 +22,63 @@ //#region 导入 import { ref, reactive } from "vue"; import { voiceTotalApi } from "../../api/login.js"; +import { getListApi } from "../../api/closeStyle"; //#endregion //#region 列表加载 -const styleList = ref([0, 1, 2, 3, 4, 5, 6, 7]); -const scrolltolower = () => { - loadmore(); +const pageNum = ref(1); +const pageSize = ref(6); +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", + }); + } }; -const loadmore = () => { - styleList.value.push(...[8, 9, 10, 11]); -}; +// 处理单人双人多人 +function peopleNum(num) { + if (num == 1) { + return "单人"; + } else if (num == 2) { + return "双人"; + } else if (num == 3) { + return "三人"; + } +} //#endregion --------------------- //#region 点击图片 -function createPhoto() { - uni.redirectTo({ - url: "/pages/closeStyle/goCreatePhoto", +function createPhoto(id) { + uni.navigateTo({ + url: `/pages/closeStyle/goCreatePhoto?id=${id}`, }); } //#endregion --------------------- @@ -70,6 +110,9 @@ function createPhoto() { // } // } // } +.page { + background-color: #222527; +} .u-list { width: 650rpx; .glodYBox { @@ -98,7 +141,7 @@ function createPhoto() { height: 400rpx; } .name { - background-color: red; + background-color: #393b3d; width: 100%; height: 80rpx; text-align: center; @@ -114,8 +157,9 @@ function createPhoto() { height: 41rpx; text-align: center; line-height: 41rpx; - background: #000000; - opacity: 0.4; + background: rgba(0, 0, 0, 0.4); + font-size: 22rpx; + // opacity: 0.4; border-radius: 12rpx; } } diff --git a/src/pages/closeStyle/goCreatePhoto.vue b/src/pages/closeStyle/goCreatePhoto.vue index 91981c9..12a7d2d 100644 --- a/src/pages/closeStyle/goCreatePhoto.vue +++ b/src/pages/closeStyle/goCreatePhoto.vue @@ -1,10 +1,10 @@