| @@ -17,7 +17,6 @@ App({ | |||
| const logs = wx.getStorageSync('logs') || [] | |||
| logs.unshift(Date.now()) | |||
| wx.setStorageSync('logs', logs) | |||
| this.loginGettoken() | |||
| }, | |||
| globalData: { | |||
| httpurl: 'https://cktest.2weisou.com/meta/', // 生产 | |||
| @@ -1,9 +1,9 @@ | |||
| { | |||
| "pages": [ | |||
| "pages/index/index", | |||
| "pages/login/index", | |||
| "pages/middle/index", | |||
| "pages/guodu/index", | |||
| "pages/login/index", | |||
| "pages/share/index", | |||
| "pages/out/index", | |||
| "pages/rank/index", | |||
| @@ -67,14 +67,15 @@ Page({ | |||
| }); | |||
| }, | |||
| onHide(){ | |||
| this.listener =null | |||
| this.busy=false | |||
| this.runningCrs=false | |||
| clearInterval(timer); | |||
| this.setData({ | |||
| runningCrs: false | |||
| }) | |||
| }, | |||
| onUnload: function () { | |||
| this.listener = null | |||
| this.listener =null | |||
| this.busy=false | |||
| this.runningCrs=false | |||
| clearInterval(timer); | |||
| }, | |||
| daojishi: function(){ | |||
| @@ -88,9 +89,6 @@ Page({ | |||
| }) | |||
| } | |||
| if(seconds<=0){ | |||
| // that.setData({ | |||
| // showtoast: false | |||
| // }) | |||
| clearInterval(timer); | |||
| this.listener = null | |||
| wx.navigateBack({ | |||
| @@ -169,9 +167,10 @@ Page({ | |||
| this.hideLoading(); | |||
| let base64 = result.target.meta | |||
| let web = this.base64_decode(base64) | |||
| console.log(web) | |||
| // 解析跳转链接 | |||
| wx.navigateTo({ | |||
| url: '../out/index?web=' + web + '&index=2', | |||
| url: '/pages/out/index?web=' + web + '&index=2', | |||
| }) | |||
| // todo: 解析meta中的信息,触发业务逻辑 | |||
| //如果待触发的id列表中存在识别到的这个id,就触发 | |||
| @@ -208,29 +207,7 @@ Page({ | |||
| }); | |||
| this.hideLoading(); | |||
| }, | |||
| experience: function () { | |||
| this.setData({ | |||
| showOverlay: false, | |||
| showContent: true, | |||
| selectType: SELECT_TYPE.IMAGE, | |||
| }); | |||
| }, | |||
| download: function () { | |||
| wx.saveImageToPhotosAlbum({ | |||
| filePath: "/images/namecard.jpg", | |||
| success: res => { | |||
| wx.showToast({title: "已保存到相册", icon: "none"}); | |||
| }, | |||
| fail: res => { | |||
| wx.showToast({title: "保存失败", icon: "none"}); | |||
| }, | |||
| }); | |||
| }, | |||
| selectContent: function (e) { | |||
| this.setData({ | |||
| selectType: e.currentTarget.dataset.contenttype, | |||
| }); | |||
| }, | |||
| queryToken: function() { // 获取token | |||
| return new Promise((resolve, reject) => { | |||
| wx.request({ | |||
| @@ -20,17 +20,4 @@ | |||
| <image id="logoscan2" class="logoscan2" mode="widthFix" src="https://static.quhouse.com/8c7d146f447546cea00776f3893237e8.png"></image> | |||
| <image id="logoscan3" class="logoscan3" mode="widthFix" src="https://static.quhouse.com/a4e924b079ed42f49f22b390d0651876.png"></image> | |||
| <loading text="{{showLoadingText}}"></loading> | |||
| </view> | |||
| <!-- <view id="content" wx:if="{{showContent}}"> | |||
| <view wx:if="{{SELECT_TYPE.IMAGE === selectType}}"> | |||
| <image src="/images/namecard.jpg" style="width: 500rpx; height: 300rpx;"></image> | |||
| </view> | |||
| <view wx:if="{{SELECT_TYPE.VIDEO === selectType}}"> | |||
| <video src="https://mp.easyar.cn/video/yuyuan1.mp4" autoplay="{{true}}" controls="{{false}}" loop="{{true}}" style="width: 714rpx; height: 400rpx;"></video> | |||
| </view> | |||
| </view> --> | |||
| <!-- <view id="select" wx:if="{{showContent}}"> | |||
| <view class="select {{SELECT_TYPE.IMAGE === selectType ? 'selected': ''}}" data-contentType="{{SELECT_TYPE.IMAGE}}" bind:tap="selectContent">图片</view> | |||
| <view class="select {{SELECT_TYPE.VIDEO === selectType ? 'selected': ''}}" data-contentType="{{SELECT_TYPE.VIDEO}}" bind:tap="selectContent">视频</view> | |||
| </view> --> | |||
| </view> | |||
| @@ -1,18 +1,18 @@ | |||
| // index.js | |||
| // 获取应用实例 | |||
| const app = getApp() | |||
| Page({ | |||
| data: { | |||
| token: '', | |||
| userInfo: null, | |||
| paramsid: '' | |||
| }, | |||
| onLoad(option) { | |||
| console.log(option.id) | |||
| let that = this | |||
| if(option.id){ // 有ID则是通过分享链接进来的 | |||
| setTimeout(function(){ | |||
| that.inviteFun(option.id) | |||
| },1000) | |||
| } | |||
| this.setData({ | |||
| paramsid: option.id | |||
| }) | |||
| this.loginGettoken() | |||
| }, | |||
| // 判断是跳转游戏还是静态页 | |||
| panduanFun(){ | |||
| @@ -22,15 +22,15 @@ Page({ | |||
| method: "get", | |||
| data: {}, | |||
| header: { | |||
| Authorization: 'bearer '+ getApp().globalData.token | |||
| Authorization: 'bearer '+ that.data.token | |||
| }, | |||
| success(res) { | |||
| console.log(res) | |||
| if (res.data.code == 0) { | |||
| let data = res.data.data | |||
| if(data.miniType==0){ | |||
| getApp().globalData.gameurl=data.linkUrl | |||
| console.log(getApp().globalData.gameurl) | |||
| // gameVersion为指定发版,和后台是否保持一致,方便提审通过,后续只需更改1为2,3,4,5... | |||
| if(data.miniType==0&&data.gameVersion==2){ | |||
| getApp().globalData.gameurl = data.linkUrl | |||
| that.tabindex(data.linkUrl) | |||
| }else{ | |||
| wx.navigateTo({ | |||
| @@ -38,6 +38,9 @@ Page({ | |||
| }) | |||
| } | |||
| }else{ | |||
| wx.navigateTo({ | |||
| url: '/pages/guodu/index' | |||
| }) | |||
| wx.showToast({ | |||
| icon: 'none', | |||
| title: res.data.msg | |||
| @@ -48,18 +51,17 @@ Page({ | |||
| }) | |||
| }, | |||
| inviteFun(id){ | |||
| let token = wx.getStorageSync('token') | |||
| console.log(token) | |||
| let that = this | |||
| wx.request({ | |||
| url: getApp().globalData.httpurl + 'ar/user/bindNShareUserId?shareUserId='+ id, | |||
| method: "get", | |||
| data: {}, | |||
| header: { | |||
| Authorization: 'bearer '+ token | |||
| Authorization: 'bearer '+ that.data.token | |||
| }, | |||
| success(res) { | |||
| console.log(res) | |||
| if (res.data.code == 0) { | |||
| }else{ | |||
| wx.showToast({ | |||
| icon: 'none', | |||
| @@ -71,11 +73,10 @@ Page({ | |||
| }) | |||
| }, | |||
| tabindex(url) { | |||
| let userInfo = getApp().globalData.userInfo | |||
| console.log(userInfo) | |||
| // let userInfo = getApp().globalData.userInfo | |||
| let id = 0 | |||
| if(userInfo.phone){ | |||
| id = userInfo.id | |||
| if(this.data.userInfo.phone){ | |||
| id = this.data.userInfo.id | |||
| } | |||
| wx.navigateTo({ | |||
| url: '/pages/out/index?index=1&userid=' + id+ '&gameid=1&type=1&url='+url | |||
| @@ -85,5 +86,42 @@ Page({ | |||
| wx.navigateTo({ | |||
| url: '/pages/AR/index' | |||
| }) | |||
| }, | |||
| //登录-获取token | |||
| loginGettoken(){ | |||
| let that = this | |||
| wx.login({ | |||
| success (res) { | |||
| if (res.code) { | |||
| //发起网络请求 | |||
| wx.request({ | |||
| url: getApp().globalData.httpurl+ 'auth/mobile/token/social?grant_type=mobil&mobile=MINI_C@'+res.code+'@'+'', | |||
| method: "POST", | |||
| data: { | |||
| }, | |||
| header: { | |||
| Authorization: "Basic YXBwbGV0OmFwcGxldA==", | |||
| }, | |||
| success(res1) { | |||
| if (res1.statusCode == 200) { | |||
| that.setData({ | |||
| token: res1.data.access_token, | |||
| userInfo: res1.data.user_info | |||
| }) | |||
| if(that.data.paramsid){ // 有ID则是通过分享链接进来的 | |||
| setTimeout(function(){ | |||
| that.inviteFun(that.data.paramsid) | |||
| },1000) | |||
| } | |||
| getApp().globalData.token = res1.data.access_token | |||
| getApp().globalData.userInfo = res1.data.user_info | |||
| } | |||
| } | |||
| }) | |||
| } else { | |||
| console.log('登录失败!' + res.errMsg) | |||
| } | |||
| } | |||
| }) | |||
| } | |||
| }) | |||
| @@ -57,7 +57,7 @@ Page({ | |||
| }, | |||
| shouquan(){ | |||
| if(userInfo.phone){ | |||
| if(userInfo&&userInfo.phone){ | |||
| wx.showToast({ | |||
| icon: 'none', | |||
| title: '您已完成授权', | |||
| @@ -102,23 +102,21 @@ margin-top: 30rpx; | |||
| margin-bottom: 60rpx; | |||
| } | |||
| .desc{ | |||
| width: 560rpx; | |||
| height: 52rpx; | |||
| font-size: 32rpx; | |||
| font-family: PingFangSC-Medium, PingFang SC; | |||
| font-weight: 500; | |||
| color: #000000; | |||
| line-height: 52rpx; | |||
| text-align: center; | |||
| height: 52rpx; | |||
| font-size: 32rpx; | |||
| font-family: PingFangSC-Medium, PingFang SC; | |||
| font-weight: 500; | |||
| color: #000000; | |||
| line-height: 52rpx; | |||
| text-align: center; | |||
| } | |||
| .desc1{ | |||
| width: 560rpx; | |||
| height: 52rpx; | |||
| text-align: center; | |||
| font-size: 32rpx; | |||
| font-weight: normal; | |||
| color: #666; | |||
| line-height: 52rpx; | |||
| height: 52rpx; | |||
| text-align: center; | |||
| font-size: 32rpx; | |||
| font-weight: normal; | |||
| color: #666; | |||
| line-height: 52rpx; | |||
| } | |||
| .avatarbtn{ | |||
| width: 284rpx; | |||
| @@ -6,7 +6,7 @@ Page({ | |||
| */ | |||
| data: { | |||
| web:null, | |||
| index:1, | |||
| index:0, | |||
| userid: 0,// 用户ID | |||
| gameid: 0,// 游戏ID | |||
| type: 1, | |||
| @@ -18,13 +18,15 @@ Page({ | |||
| onLoad: function (options) { | |||
| console.log(options); | |||
| this.setData({ | |||
| web:options.web, | |||
| index:options.index, | |||
| web: options.web, | |||
| index: options.index, | |||
| userid: options.userid, | |||
| gameid: options.gameid, | |||
| type: options.type, | |||
| allurl: options.url +`?userid=${options.userid||0}&gameid=${options.gameid||0}&type=${options.type==2?2:1}` | |||
| }) | |||
| console.log(this.data.web) | |||
| console.log(this.data.index) | |||
| console.log(this.data.allurl) | |||
| }, | |||
| /** | |||
| @@ -70,7 +70,7 @@ Page({ | |||
| // console.log(getApp().globalData.userInfo.id) | |||
| this.shareFun() | |||
| return { | |||
| title: '万套房源5折起iPhone13 Pro Max免费赢', | |||
| title: '万套房源5折起,iPhone13 Pro Max免费赢!速来!', | |||
| imageUrl: 'https://static.quhouse.com/468340e3a1374decb4fa51a172aa4f52.png', | |||
| path: '/pages/index/index?id=' + getApp().globalData.userInfo.id | |||
| } | |||
| @@ -5,7 +5,7 @@ | |||
| "include": [] | |||
| }, | |||
| "setting": { | |||
| "urlCheck": true, | |||
| "urlCheck": false, | |||
| "es6": true, | |||
| "enhance": false, | |||
| "postcss": true, | |||
| @@ -15,7 +15,14 @@ | |||
| "list": [] | |||
| }, | |||
| "miniprogram": { | |||
| "list": [] | |||
| "list": [ | |||
| { | |||
| "name": "pages/index/index", | |||
| "pathName": "pages/index/index", | |||
| "query": "id=11", | |||
| "scene": null | |||
| } | |||
| ] | |||
| } | |||
| } | |||
| } | |||