|
|
// pages/kaishi/kaishi.js
|
|
|
const app=getApp();
|
|
|
const app = getApp();
|
|
|
Page({
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -11,11 +11,11 @@ Page({ |
|
|
'../../imgs/lunbo2@3x.png',
|
|
|
'../../imgs/lunbo3@3x.png'
|
|
|
],
|
|
|
indexs:0,
|
|
|
color:'#cccccc',
|
|
|
indexs: 0,
|
|
|
color: '#cccccc',
|
|
|
indicatorDots: false,
|
|
|
autoplay: true,
|
|
|
activecolor:'#ffffff',
|
|
|
activecolor: '#ffffff',
|
|
|
interval: 5000,
|
|
|
duration: 1000
|
|
|
},
|
...
|
...
|
@@ -23,17 +23,18 @@ Page({ |
|
|
start(e) {
|
|
|
let that = this;
|
|
|
app.globalData.userInfo = e.detail.userInfo;
|
|
|
|
|
|
wx.login({
|
|
|
success: function (s) {
|
|
|
let url = 'wxapp/public/getSessionKey';
|
|
|
if (s.code) {
|
|
|
var code = s.code;
|
|
|
var param = {
|
|
|
code: code
|
|
|
code: s.code
|
|
|
}
|
|
|
app.post(url, param).then((res) => {
|
|
|
that.login(res.openid, res.session_key, e.detail.encryptedData, e.detail.iv);
|
|
|
console.log(res);
|
|
|
console.log(e);
|
|
|
that.login(res.data.openid, res.data.session_key, e.detail.encryptedData, e.detail.iv, e.detail.rawData, e.detail.signature);
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg);
|
|
|
})
|
...
|
...
|
@@ -41,28 +42,49 @@ Page({ |
|
|
}
|
|
|
});
|
|
|
},
|
|
|
login(openid, session_key, encrypted_data, iv) {
|
|
|
login(openid, session_key, encrypted_data, iv,r,s) {
|
|
|
let that = this;
|
|
|
let param = {
|
|
|
openid: openid,
|
|
|
session_key: session_key,
|
|
|
encrypted_data: encrypted_data,
|
|
|
iv: iv
|
|
|
iv: iv,
|
|
|
rawData: r,
|
|
|
signature: s
|
|
|
}
|
|
|
let url = 'wxapp/public/login';
|
|
|
// wx.navigateTo({
|
|
|
// url: '/pages/login/login',
|
|
|
// success: function (res) { },
|
|
|
// fail: function (res) { },
|
|
|
// complete: function (res) { },
|
|
|
// })
|
|
|
app.post(url, param).then((res) => {
|
|
|
wx.setStorageSync('token', res.token);
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/login/login',
|
|
|
success: function (res) { },
|
|
|
fail: function (res) { },
|
|
|
complete: function (res) { },
|
|
|
console.log(res)
|
|
|
wx.setStorageSync('token', res.data.token);
|
|
|
let u = "wxapp/public/isMobile";
|
|
|
let header = {
|
|
|
"XX-Token": res.data.token
|
|
|
}
|
|
|
let data = {
|
|
|
type: 1
|
|
|
}
|
|
|
app.post(u, data, header).then((r) => {
|
|
|
console.log(r)
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
// wx.navigateTo({
|
|
|
// url: '/pages/login/login',
|
|
|
// success: function (res) { },
|
|
|
// fail: function (res) { },
|
|
|
// complete: function (res) { },
|
|
|
// })
|
|
|
}).catch((errMsg) => {
|
|
|
console.log(errMsg);
|
|
|
})
|
|
|
},
|
|
|
changeindexs(e){
|
|
|
changeindexs(e) {
|
|
|
this.setData({
|
|
|
indexs: e.detail.current
|
|
|
})
|
...
|
...
|
|