diff --git a/src/App.vue b/src/App.vue index 628ec32..0aea4f4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -40,40 +40,50 @@ onLaunch(() => { }, }); // 微信登录授权 - 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.token; - console.log(userInfoModulesPinia.openId, "获取openid"); - uni.hideLoading(); - if (res2.token) { - uni.redirectTo({ - url: "/pages/home/index", - }); - } else { - uni.redirectTo({ - url: "/pages/index/index", + 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"); + uni.hideLoading(); + if (res2.data.token) { + uni.redirectTo({ + url: "/pages/index/index", + }); + } else { + uni.redirectTo({ + url: "/pages/login/index", + }); + uni.showToast({ + title: "登录失败,请重试", + icon: "none", + }); + } + } catch (error) { + // uni.redirectTo({ + // url: "pages/index/index", + // }); uni.showToast({ title: "登录失败,请重试", icon: "none", }); } - } catch (error) { + } else { // uni.redirectTo({ // url: "pages/index/index", // }); @@ -82,7 +92,8 @@ onLaunch(() => { icon: "none", }); } - } else { + }, + fail: (err) => { // uni.redirectTo({ // url: "pages/index/index", // }); @@ -90,18 +101,9 @@ onLaunch(() => { title: "登录失败,请重试", icon: "none", }); - } - }, - fail: (err) => { - // uni.redirectTo({ - // url: "pages/index/index", - // }); - uni.showToast({ - title: "登录失败,请重试", - icon: "none", - }); - }, - }); + }, + }); + } }); onShow(() => { console.log("App Show!"); diff --git a/src/manifest.json b/src/manifest.json index 0c73fbe..d3d1d0c 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -51,6 +51,17 @@ /* 小程序特有相关 */ "mp-weixin": { "appid": "wx75cf14e3a0d45821", + "permission": { + "scope.userLocation": { + "desc": "获取您的地理位置信息" + }, + "scope.userInfo": { + "desc": "获取您的用户信息" + }, + "scope.userPhoneNumber": { + "desc": "获取您的手机号码" + } + }, "setting": { "urlCheck": false, "ignoreDevUnusedFiles": false, diff --git a/src/pages.json b/src/pages.json index 9d0c6d5..c8af644 100644 --- a/src/pages.json +++ b/src/pages.json @@ -7,51 +7,51 @@ } }, { - "path": "pages/uploadPhoto/uploadPhoto", + "path": "pages/index/buyCoin", "style": { - "navigationBarTitleText": "智像" + "navigationBarTitleText": "购买金币" } }, { - "path": "pages/uploadPhoto/success", + "path": "pages/login/index", "style": { "navigationBarTitleText": "智像" } }, { - "path": "pages/closeStyle/closeStyle", + "path": "pages/uploadPhoto/uploadPhoto", "style": { "navigationBarTitleText": "智像" } }, { - "path": "pages/closeStyle/goCreatePhoto", + "path": "pages/uploadPhoto/success", "style": { "navigationBarTitleText": "智像" } }, { - "path": "pages/createing/index", + "path": "pages/closeStyle/closeStyle", "style": { "navigationBarTitleText": "智像" } }, { - "path": "pages/lookPhoto/index", + "path": "pages/closeStyle/goCreatePhoto", "style": { "navigationBarTitleText": "智像" } }, { - "path": "pages/home/index", + "path": "pages/createing/index", "style": { "navigationBarTitleText": "智像" } }, { - "path": "pages/home/buyCoin", + "path": "pages/lookPhoto/index", "style": { - "navigationBarTitleText": "购买金币" + "navigationBarTitleText": "智像" } }, { diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue deleted file mode 100644 index 89d57a3..0000000 --- a/src/pages/home/index.vue +++ /dev/null @@ -1,511 +0,0 @@ - - - - - diff --git a/src/pages/home/buyCoin.vue b/src/pages/index/buyCoin.vue similarity index 100% rename from src/pages/home/buyCoin.vue rename to src/pages/index/buyCoin.vue diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index d92034f..f67bb84 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -1,156 +1,525 @@ diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue new file mode 100644 index 0000000..87f7e71 --- /dev/null +++ b/src/pages/login/index.vue @@ -0,0 +1,215 @@ + + + + + diff --git a/src/style/my.scss b/src/style/my.scss index adb4466..f6e88ac 100644 --- a/src/style/my.scss +++ b/src/style/my.scss @@ -7,12 +7,15 @@ // background-color: #fff; font-size: 26rpx; color: #fff; - min-height: 100vh; position: relative; min-height: 100vh; background-color: rgba(0, 0, 0, 0.8); } +.pageH5 { + min-height: calc(100vh - 44px); +} + body { -webkit-touch-callout: none; /*系统默认菜单被禁用*/