diff --git a/app.js b/app.js
index e96a3b6..eae8d91 100644
--- a/app.js
+++ b/app.js
@@ -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/', // 生产
diff --git a/app.json b/app.json
index 16b023a..3d75ffc 100644
--- a/app.json
+++ b/app.json
@@ -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",
diff --git a/pages/AR/index.js b/pages/AR/index.js
index 4620b3b..879504d 100644
--- a/pages/AR/index.js
+++ b/pages/AR/index.js
@@ -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({
diff --git a/pages/AR/index.wxml b/pages/AR/index.wxml
index a18ebcb..d779cac 100644
--- a/pages/AR/index.wxml
+++ b/pages/AR/index.wxml
@@ -20,17 +20,4 @@
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/pages/index/index.js b/pages/index/index.js
index 7840dc7..2ef874d 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -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)
+ }
+ }
+ })
}
})
\ No newline at end of file
diff --git a/pages/login/index.js b/pages/login/index.js
index f3f29ca..9d123bd 100644
--- a/pages/login/index.js
+++ b/pages/login/index.js
@@ -57,7 +57,7 @@ Page({
},
shouquan(){
- if(userInfo.phone){
+ if(userInfo&&userInfo.phone){
wx.showToast({
icon: 'none',
title: '您已完成授权',
diff --git a/pages/login/index.wxss b/pages/login/index.wxss
index ae39b0a..cfe1bb7 100644
--- a/pages/login/index.wxss
+++ b/pages/login/index.wxss
@@ -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;
diff --git a/pages/out/index.js b/pages/out/index.js
index 1f19c67..b705b56 100644
--- a/pages/out/index.js
+++ b/pages/out/index.js
@@ -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)
},
/**
diff --git a/pages/share/index.js b/pages/share/index.js
index eef9936..37478a9 100644
--- a/pages/share/index.js
+++ b/pages/share/index.js
@@ -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
}
diff --git a/project.config.json b/project.config.json
index a0861d6..403d36d 100644
--- a/project.config.json
+++ b/project.config.json
@@ -5,7 +5,7 @@
"include": []
},
"setting": {
- "urlCheck": true,
+ "urlCheck": false,
"es6": true,
"enhance": false,
"postcss": true,
diff --git a/project.private.config.json b/project.private.config.json
index a868716..a313335 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -15,7 +15,14 @@
"list": []
},
"miniprogram": {
- "list": []
+ "list": [
+ {
+ "name": "pages/index/index",
+ "pathName": "pages/index/index",
+ "query": "id=11",
+ "scene": null
+ }
+ ]
}
}
}
\ No newline at end of file