作者 乔蒙蒙

合并分支 'qiaomeng' 到 'master'

Qiaomeng



查看合并请求 !1
... ... @@ -24,6 +24,7 @@ App({
let header = {
'content-type': 'application/x-www-form-urlencoded'
}
// console.log(baseUrl/ + url)
header = Object.assign(header, headerParams)
wx.request({
url: baseUrl + url,
... ... @@ -31,8 +32,9 @@ App({
method: 'POST',
header: header,
success: function (res) {//返回取得的数据
// console.log(res)
if (res.data.code == '20000') {
resolve(res.data.data);
resolve(res.data);
} else if (res.data.code == '10001') {//用户未
} else if (res.data.code == '40000') {
... ...
// 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
})
... ...
... ... @@ -20,10 +20,11 @@
</view>
<view class='start_btnbox'>
<button class='start_btn' open-type='getUserInfo' bindgetuserinfo='start'>
<text class='txt'>一起来吧</text> </button>
<text class='txt'>一起来吧</text>
</button>
</view>
</swiper-item>
</swiper>
<view class='botsbox'>
<view class='bots {{index==indexs?"activecolor":""}}' wx:for='{{imgUrls.length+1}}' wx:key ></view>
<view class='bots {{index==indexs?"activecolor":""}}' wx:for='{{imgUrls.length+1}}' wx:key></view>
</view>
\ No newline at end of file
... ...
//logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad: function () {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return util.formatTime(new Date(log))
})
})
}
})
... ...
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log}}</text>
</block>
</view>
... ...
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}
... ...
... ... @@ -12,7 +12,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.4.1",
"appid": "wx4ac44ac1779dc6a6",
"appid": "wx6e9436f62c626fb7",
"projectname": "bar",
"debugOptions": {
"hidedInDevtools": []
... ...