var imgUrlApp = getApp().globalData.imgUrlApp;
Page({
/**
* 页面的初始数据
*/
data: {
indicatorDots: true,
vertical: false,
autoplay: false,
circular: false,
interval: 2000,
duration: 500,
previousMargin: 0,
nextMargin: 0,
imgUrlApp: imgUrlApp,
swiperimgUrls: ['http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg'
],
userinfo: {},
companyinfo: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
var that = this;
console.log(
wx.getStorageSync("username")),
wx.request({
url: getApp().globalData.apiUrlApp + 'acc/get_userinfo/',
header: {
"Content-Type": "application/x-www-form-urlencoded",
'cookie': wx.getStorageSync("username"), //读取cookie,
'cookie': wx.getStorageSync("uid"), //读取cookie,
'cookie': wx.getStorageSync("gid") //读取cookie,
},
method: "GET",
data: {
username: wx.getStorageSync("username")
},
success: function(res) {
console.log(res)
if (res.data.status == 1) {
wx.showToast({
// title: res.data.info,
title: "帐号详情",
icon: 'success',
duration: 1500
}),
that.setData({
userinfo: res.data.data
}),
wx.request({
url: getApp().globalData.apiUrlApp + 'common/get_orginfo/',
header: {
"Content-Type": "application/x-www-form-urlencoded",
'cookie': wx.getStorageSync("username"), //读取cookie,
'cookie': wx.getStorageSync("uid"), //读取cookie,
'cookie': wx.getStorageSync("gid") //读取cookie,
},
method: "GET",
data: {
uid: wx.getStorageSync("uid")
},
success: function(res) {
console.log(res)
if (res.data.status == 1) {
wx.showToast({
// title: res.data.info,
title: "帐号详情",
icon: 'success',
duration: 1500
}),
that.setData({
companyinfo: res.data.data
})
} else if (res.data.status == 0) {
wx.showToast({
title: "无数据返回",
icon: 'success',
duration: 1500
})
} else if (res.data.status == -1) {
wx.showToast({
title: "请求异常,请检查重试",
icon: 'loading',
duration: 2000
})
}
}
})
} else if (res.data.status == 0) {
wx.showToast({
title: "无数据返回",
icon: 'success',
duration: 1500
})
} else if (res.data.status == -1) {
wx.showToast({
title: "请求异常,请检查重试",
icon: 'loading',
duration: 2000
})
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
})
@import "../../style/weui.wxss";
<view class="mainpage">
<view class="banner">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" circular="{{circular}}" vertical="{{vertical}}" interval="{{interval}}" duration="{{duration}}" previous-margin="{{previousMargin}}px" next-margin="{{nextMargin}}px">
<block wx:for="{{swiperimgUrls}}" wx:key="*this">
<swiper-item>
<image src="{{item}}" class="slide-image" style="width:100%" />
</swiper-item>
</block>
</swiper>
</view>