diff --git a/src/App.vue b/src/App.vue index 456433f..d82b81b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -40,85 +40,6 @@ onLaunch(() => { console.log(res.osName, osName, "System"); }, }); - // 微信登录授权 - 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; - userInfoModulesPinia.token = res2.data.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.coin; - } - 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", - }); - } - } 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", - }); - }, - }); - } }); onShow(() => { console.log("App Show!"); diff --git a/src/assets/img/logo-5.png b/src/assets/img/logo-5.png new file mode 100644 index 0000000..417681b Binary files /dev/null and b/src/assets/img/logo-5.png differ diff --git a/src/pages/closeStyle/goCreatePhoto.vue b/src/pages/closeStyle/goCreatePhoto.vue index 4b38d83..526f0b3 100644 --- a/src/pages/closeStyle/goCreatePhoto.vue +++ b/src/pages/closeStyle/goCreatePhoto.vue @@ -57,6 +57,10 @@ async function getInfo() { //#region 生成写真照片 async function createing(id) { try { + uni.showLoading({ + title: "加载中...", + mask: true, + }); const res = await findImageApi(); console.log(res); let myImg = res.data.image; @@ -69,8 +73,10 @@ async function createing(id) { uni.navigateTo({ url: `/pages/createing/index?id=${res2.data.id}`, }); + uni.hideLoading(); } catch (error) { console.log(error); + uni.hideLoading(); uni.showToast({ title: "生成失败,请重试", icon: "none", diff --git a/src/pages/createing/index.vue b/src/pages/createing/index.vue index 82c2ab0..50f77e2 100644 --- a/src/pages/createing/index.vue +++ b/src/pages/createing/index.vue @@ -7,8 +7,22 @@ 更换风格 + - - - 写真生成中,预计用时X分X秒 - 做好后通知我 + + + + 写真生成中,预计用时X分X秒 + 做好后通知我 继续制作写真 重新生成 + 回到首页 @@ -40,36 +59,45 @@ import { ref, reactive } from "vue"; import { onLoad } from "@dcloudio/uni-app"; import { findWorkByIdApi } from "../../api/createing.js"; import { findByIdApi } from "../../api/closeStyle.js"; + //#endregion //#region 生成写真照片 -const swiperList = [ - "https://cdn.uviewui.com/uview/swiper/swiper3.png", - "https://cdn.uviewui.com/uview/swiper/swiper2.png", - "https://cdn.uviewui.com/uview/swiper/swiper1.png", -]; +const swiperList = ref([]); //#endregion --------------------- //#region 查询页面状态 const workId = ref(null); //作品id const createState = ref(null); //制作状态:1生成中,2完成,3失败 const styleId = ref(null); //风格id -const styleData = ref(null); +const styleData = ref(""); //风格信息 onLoad((options) => { workId.value = options.id; - // getInfo(); + // workId.value = "856433830235262976"; getWorkInfo(); }); async function getWorkInfo() { try { + uni.showLoading({ + title: "加载中...", + mask: true, + }); // const res = await findWorkByIdApi("854592119583068160"); const res = await findWorkByIdApi(workId.value); - console.log(res); + if (res.data.photoList) { + swiperList.value = res.data.photoList; + } createState.value = res.data.status; styleId.value = res.data.digitalAvatarId; const res2 = await findByIdApi(styleId.value); styleData.value = res2.data; + uni.hideLoading(); } catch (error) { + uni.hideLoading(); + uni.showToast({ + title: "加载失败,请重试", + icon: "none", + }); console.log(error); } } @@ -81,6 +109,11 @@ function changeStyle() { url: "/pages/closeStyle/closeStyle", }); } +function goHome() { + uni.switchTab({ + url: "/pages/index/index", + }); +} function goLookPhoto() { uni.redirectTo({ url: "/pages/lookPhoto/index", @@ -88,6 +121,10 @@ function goLookPhoto() { } //#endregion --------------------- +//#region 轮播图 + +//#endregion --------------------- + //#region //#endregion --------------------- @@ -148,6 +185,10 @@ function goLookPhoto() { width: 100%; height: 695rpx !important; } +.logo { + width: 520rpx; + margin: 90rpx; +} .createIng, .createEd { width: 100%; diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 8d16c72..504b5e0 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -10,20 +10,33 @@ + - + 我的金币:   {{ userInfoModulesPinia.myGlod }} - 购买金币购买金币 + 还未登录 , + 去登录! @@ -37,18 +50,29 @@ {{ item.name }} + + + 登录体验更多功能 + 风格名称 @@ -93,7 +117,7 @@ 暂无数据 , 去生成! @@ -102,7 +126,7 @@ @@ -127,7 +151,10 @@ - + @@ -141,7 +168,10 @@ 继续邀请好友 - + 名称 时间 @@ -251,7 +281,14 @@ function chooseAvatar() { }); } -function goOtherPage(url) { +function goOtherPage(url, status) { + if (status != 2) { + uni.showToast({ + title: "正在生成,请稍后", + icon: "none", + }); + return; + } uni.navigateTo({ url: url, }); @@ -261,7 +298,7 @@ function goOtherPage(url) { //#region tab const tabList = ref([ { name: "我的写真", id: 1 }, - { name: "我的视频", id: 2 }, + // { name: "我的视频", id: 2 }, { name: "我的邀请", id: 3 }, { name: "消费记录", id: 4 }, ]); @@ -369,7 +406,12 @@ async function findGlod() { } } catch (error) {} } - +//#region 跳转 +function goLoginHandel() { + uni.navigateTo({ + url: "/pages/login/index", + }); +} //#endregion --------------------------- //#region 删除弹出框 @@ -412,13 +454,15 @@ function init() { } } onLoad(async () => { - setTimeout(() => { + if (userInfoModulesPinia.token) { getPhotoList(pageSize1.value, pageNum1.value); getConsumeList(pageSize2.value, pageNum2.value); - // findImage(); - // findGlod(); - // getPhotoList(); - }, 2000); + } + // setTimeout(() => { + // findImage(); + // findGlod(); + // getPhotoList(); + // }, 2000); }); //#endregion --------------------------- @@ -479,7 +523,7 @@ onLoad(async () => { height: 33rpx; vertical-align: middle; } - text { + .buyCoinText { margin-left: 28rpx; display: inline-block; width: 160rpx; @@ -491,6 +535,10 @@ onLoad(async () => { background-color: rgba(255, 255, 255, 0.1); } } +.goLogin { + color: #ff4f00; + text-decoration: underline; +} // tab栏样式 .tabsBox { display: flex; @@ -597,7 +645,7 @@ onLoad(async () => { text-align: center; .goCreate { color: #ff4f00; - text-decoration: dashed; + text-decoration: underline; } } } diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index e597ac7..9ae5dc8 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -55,6 +55,7 @@