...
|
...
|
@@ -2,7 +2,7 @@ |
|
|
|
|
|
App({
|
|
|
onLaunch: function () {
|
|
|
|
|
|
this.count()
|
|
|
},
|
|
|
//判断小程序是否注册
|
|
|
ifregister(e){
|
...
|
...
|
@@ -16,9 +16,7 @@ App({ |
|
|
var param = {
|
|
|
code: code
|
|
|
}
|
|
|
that.post(url, param).then((res) => {
|
|
|
console.log(res);
|
|
|
|
|
|
that.post(url, param).then((res) => {
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg);
|
|
|
})
|
...
|
...
|
@@ -27,6 +25,30 @@ App({ |
|
|
});
|
|
|
|
|
|
},
|
|
|
count() {
|
|
|
let that = this;
|
|
|
wx.login({
|
|
|
success: function (s) {
|
|
|
let url = 'wxapp/public/getSessionKey';
|
|
|
if (s.code) {
|
|
|
var code = s.code;
|
|
|
var param = {
|
|
|
code: code
|
|
|
}
|
|
|
that.post(url, param).then((res) => {
|
|
|
let url = 'wxapp/public/visit';
|
|
|
let params = {
|
|
|
openid: res.openid
|
|
|
}
|
|
|
that.post(url, params).then((res) => {
|
|
|
}).catch((err) => {
|
|
|
})
|
|
|
}).catch((errMsg) => {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
//获取sessionKey和openid
|
|
|
start(e) {
|
|
|
let that = this;
|
...
|
...
|
|