From 83d2f09620910e48fc288170ddfc8cd7376d49a6 Mon Sep 17 00:00:00 2001 From: corala <18339694416@163.com> Date: Sun, 24 Apr 2022 16:28:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 6 +-- pages/AR/index.js | 6 ++- pages/login/index.js | 103 ++++++++++++++++++++++++++++++++++------- pages/login/index.wxml | 25 ++++++---- pages/login/index.wxss | 52 ++++++++++++++++++++- pages/out/index.js | 1 - pages/out/index.wxml | 2 +- project.config.json | 2 +- 8 files changed, 163 insertions(+), 34 deletions(-) diff --git a/app.json b/app.json index d08d923..c99c57c 100644 --- a/app.json +++ b/app.json @@ -1,10 +1,10 @@ { "pages": [ - "pages/middle/index", "pages/index/index", - "pages/rank/index", - "pages/out/index", "pages/login/index", + "pages/out/index", + "pages/middle/index", + "pages/rank/index", "pages/AR/index", "components/loading/loading" ], diff --git a/pages/AR/index.js b/pages/AR/index.js index dbd2773..05ce58a 100644 --- a/pages/AR/index.js +++ b/pages/AR/index.js @@ -22,13 +22,15 @@ Page({ apiSecret: '483e000a38265687c058efb7ab66cbc0917a3331b6dbf5482df46c76cb749529', // EasyAR开发中心 - API KEY - API Secret crsAppId: '8911f4b8f03725e300ca4130c01f27e9', // EasyAR开发中心 - 云服务 - 云识别管理 - 云识别库信息 - CRS AppId token: '', - clientHost: 'http://bd9b3490fe845642e600cf53f0cd64b8.cn1.crs.easyar.com:8080', //服务器一般不变 + clientHost: 'https://bd9b3490fe845642e600cf53f0cd64b8.cn1.crs.easyar.com:8443', //服务器一般不变 jpegQuality: 0.7, //JPEG压缩质量,建议不低于70% minInterval: 1000, //最短的两次CRS请求间隔 }, //识别到这个数组中的ID就触发内容 targetIds: [ - "", + "6c27e0a1-e4ca-424d-9062-4c8ec676a5ad", + "ec72a9a2-20d5-4b86-82db-05f29e1c0fbb", + "f0bdba05-e610-4d1c-811a-5034ccc0d1f7", "79014ee9-60c7-4a0c-81ed-0d5889a7ecc9" ], showLoading: false, diff --git a/pages/login/index.js b/pages/login/index.js index 17f9396..466b0c7 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -6,16 +6,23 @@ Page({ data: { ischecked: true, bindInfo: false, + avatarModal: false, + phoneModal: false, + phoneModal1: false, + showBg: false, + step: 0,// 头像授权1, 手机授权2 + nickNamebind: false, + phonebind: false, + userInfo: null, userid:'', token: '' }, onLoad() { this.loginGettoken() - console.log(getApp()) }, - backGame(){ + backhome(){ wx.navigateTo({ - url: '' + url: '/pages/index/index' }) }, checkFun(){ @@ -25,7 +32,30 @@ Page({ }, // 协议 toxieyi(){ - + }, + shouquan(){ + if(this.data.step==1){ + this.setData({ + avatarModal: true, + showBg: true + }) + } + if(this.data.step==2){ + this.setData({ + phoneModal: true, + showBg: true + }) + } + }, + closeModal(){ + this.setData({ + showBg: false + }) + }, + leave(){ + wx.navigateTo({ + url: '../out/index?index=1', + }) }, //登录-获取token loginGettoken(){ @@ -44,10 +74,38 @@ Page({ }, success(res1) { if (res1.statusCode == 200) { + let userInfo = res1.data.user_info that.setData({ token: res1.data.access_token, - userid: res1.data.user_info.id + userid: userInfo.id, + userInfo: userInfo + }) + if(!!userInfo.userWxName&&!!userInfo.phone){ + that.leave() + return; + } + // console.log(userInfo) + + if(!userInfo.userWxName||!userInfo.phone){ + that.setData({ + showBg: true + }) + }else{ + that.setData({ + showBg: false + }) + } + that.setData({ + avatarModal: !!userInfo.userWxName?false:true, + phoneModal1: !!userInfo.phone?false:true, + step: 1 }) + if(!that.data.avatarModal){ + that.setData({ + step: 2, + phoneModal: that.data.phoneModal1 + }) + } } } }) @@ -76,27 +134,32 @@ Page({ success(res) { if (res.statusCode == 200) { that.setData({ - bindInfo: true + avatarModal: false, + step: 2 }) - console.log('绑定用户头像信息成功') + if(that.data.phoneModal1){ + that.setData({ + phoneModal: true + }) + } } } }) }, getUserInfo(){ - if(!this.data.ischecked){ - wx.showToast({ - title: '请勾选协议', - icon: 'none', - duration: 2000 - }) - return; - } + // if(!this.data.ischecked){ + // wx.showToast({ + // title: '请勾选协议', + // icon: 'none', + // duration: 2000 + // }) + // return; + // } let that = this wx.getUserProfile({ desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 success: (res) => { - console.log(res) + // console.log(res) that.bindNickname(res.userInfo) } }) @@ -122,8 +185,14 @@ Page({ }, success(res) { console.log(res) - if (res.statusCode == 200) { + if (res.data.code == 0) { // console.log(res) + that.setData({ + phoneModal: false, + showBg: false, + step: 0 + }) + that.leave() } } }) diff --git a/pages/login/index.wxml b/pages/login/index.wxml index 8ab95ac..211dc3c 100644 --- a/pages/login/index.wxml +++ b/pages/login/index.wxml @@ -5,15 +5,24 @@ - - + - - 勾选表示您已阅读并同意 - 《隐私协议》 + 勾选表示您已阅读并同意 + 《隐私协议》 + --> + 微信一键授权 + 返回游戏 + + + + 请授权"加油新青年"获取您的昵称、头像 + 授权 + + + 请授权"加油新青年"获取您的手机号 + - - 微信一键登录 - 返回游戏 + \ No newline at end of file diff --git a/pages/login/index.wxss b/pages/login/index.wxss index 0292245..4caf96f 100644 --- a/pages/login/index.wxss +++ b/pages/login/index.wxss @@ -90,4 +90,54 @@ color: #CE592E; background:#FFFFFF; border: 2rpx solid #CE592E; margin-top: 30rpx; -} \ No newline at end of file +} +.bg{ + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0,0,0,0.69); + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} +.avatar-modal,.phope-modal{ + width: 650rpx; + height: 392rpx; + background: url('https://static.quhouse.com/8bf6c53566574d01ad6836a894511b95.png') no-repeat; + background-size: 650rpx 392rpx; + display: flex; + justify-content: center; + flex-direction: column; + align-items: center; +} +.desc{ + width: 434rpx; + height: 96rpx; + font-size: 32rpx; + text-align: center; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #000000; + line-height: 48rpx; + margin-bottom: 60rpx; +} +.phone-btn{ + width: 510rpx !important; + height: 96rpx !important; + background: #CE592E; + border-radius: 48rpx; + line-height: 96rpx !important; + color: #fff; + font-size: 32rpx; + padding: 0; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; +} +.bg .close{ + margin-top: 40rpx; + width: 54rpx; + height: 54rpx; +} diff --git a/pages/out/index.js b/pages/out/index.js index 7b03816..5ae2a17 100644 --- a/pages/out/index.js +++ b/pages/out/index.js @@ -8,7 +8,6 @@ Page({ web:null, index:0, }, - /** * 生命周期函数--监听页面加载 */ diff --git a/pages/out/index.wxml b/pages/out/index.wxml index 0d71f53..11153ae 100644 --- a/pages/out/index.wxml +++ b/pages/out/index.wxml @@ -1,3 +1,3 @@ - + diff --git a/project.config.json b/project.config.json index 403d36d..a0861d6 100644 --- a/project.config.json +++ b/project.config.json @@ -5,7 +5,7 @@ "include": [] }, "setting": { - "urlCheck": false, + "urlCheck": true, "es6": true, "enhance": false, "postcss": true,