作者 wumengyu

添加banner跳转专题列表页,优化canvas再次调用

{
"pages": [
"pages/index/index",
"pages/index/banner-list/banner-list",
"pages/activity/detail/detail",
"pages/activity/activity",
"pages/index/answer-question/answer-question",
... ... @@ -28,7 +29,7 @@
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTitleText": "火柴西路",
"navigationBarTextStyle": "black"
}
}
\ No newline at end of file
... ...
// pages/index/banner-list/banner-list.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {},
//获取列表
getList() {
const self = this;
let url = '/portal/Active/allList';
let header = {
"token": wx.getStorageSync('token')
};
app.post(url, {}, {}).then((res) => {
console.log('获取列表', res);
if (+res.code === 1) {
self.setData({
list: res.data.active,
pic:res.data.pic,
});
}
})
},
goPostDetail(e) {
const id = +e.currentTarget.dataset.id;
const type = +e.currentTarget.dataset.type;
console.log('type', type);
if(type === 1) { //1是活动,2是拼餐
wx.navigateTo({
url: '/pages/activity/detail/detail?id=' + id,
})
}else {
wx.navigateTo({
url: '/pages/meal/detail/detail?id=' + id,
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getList();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--pages/index/banner-list/banner-list.wxml-->
<view class="content">
<image src="{{pic}}" class="banner" mode="widthFix"></image>
<view class='content_box'>
<view class="no-data" wx:if="{{list.length === 0}}">暂无活动</view>
<view class='content_item' wx:for='{{list}}' wx:key="index" wx:if="{{list.length>0}}"
bindtap='goPostDetail' data-id="{{item.id}}" data-type="{{item.type}}">
<!--<image src="http://pk86rwhci.bkt.clouddn.com/activity_img@2x.png"></image>-->
<image src="{{item.pic}}"></image>
<view class="title">
<text class="area">{{item.title}} {{item.time}}</text>
<text class="num">还差{{item.people}}人</text>
</view>
<view class="user">
<!--<image src="../../../images/avatar@2x.png" class="avatar"></image>-->
<image src="{{item.userPic}}" mode="aspectFill"></image>
<text>{{item.userName}} {{item.address}}</text>
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
/* pages/index/banner-list/banner-list.wxss */
@import '../../spell-list/spell-list.wxss';
@import '../tandian-list/tandian-list.wxss';
.banner {
width: 100%;
height: auto;
}
\ No newline at end of file
... ...
... ... @@ -389,16 +389,9 @@ Page({
},
//点击分享
share() {
// this.drawCard();
console.log(this.data.can_save);
this.setData({can_save: false});
// wx.showLoading({title:'加载中',mask:true});
this.drawCard();
console.log(this.data.can_save);
// if(this.data.can_save) {
// wx.hideLoading({});
this.setData({show_canvas: true});
// }
this.setData({show_canvas: true}, () => {
this.drawCard();
})
},
hideCanvasMask() {
// this.setData({show_canvas: true});
... ... @@ -579,6 +572,7 @@ Page({
},
savePic() {
console.log('是否能保存',this.data.can_save);
if(this.data.can_save) {
wx.canvasToTempFilePath({
x: 0,
... ...
... ... @@ -642,7 +642,7 @@ swiper {
color: #999999;
font-size: 60rpx;
border-radius: 50%;
background-color: #fff;
/* background-color: #fff; */
margin-top: 34rpx;
}
.close-btn .icon-guanbi {
... ...