You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zx/image/wode/wode.js

95 lines
2.2 KiB

// 首页/shouye.js
const app = getApp()
Page({
data: {
motto: 'Hello',
userInfo: {},
hasUserInfo: true,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
//事件处理函数
bindViewTap: function () {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad: function () {
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
})
} else if (this.data.canIUse) {
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
} else {
// 在没有 open-type=getUserInfo 版本的兼容处理
wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
}
},
getUserInfo: function (e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
},
denglusubmit: function (e) {
wx.showModal({
title: '退出登录',
content: '是否退出登录',
confirmColor: "rgba(253, 153, 65, 1)",
success: function (res) {
if (res.confirm) {
wx.redirectTo({
url: '../denglu/denglu',
})
}
}
})
},
gerenxinxisubmit: function (e) {
wx.navigateTo({
url: '../gerenxinxi/gerenxinxi',
})
},
jieyuezhongsubmit: function (e) {
wx.request({
url: 'http://localhost:9527/zxborrow/Br',
data: {
's_id': '20160801'
},
header: {
"Content-Type": "pplication/json"
},
methods: {
method: "POST",
},
success: function (res) {
var book = res.data
let bookstr = JSON.stringify(book);
console.log(book);
wx.navigateTo({
url: '../jieyuejilu/jieyuezhong/jieyuezhong?bookstr=' + bookstr,
})
}
})
}
})