@@ -338,7 +338,9 @@ var config = { | |||
// 获取所有直播间和商品信息 | |||
getReplayList: "/live/replayList", | |||
// 获取直播房间回放数据和商品信息 | |||
getRoomList: "/live/roomList" | |||
getRoomList: "/live/roomList", | |||
//商城地图 | |||
getStoreMap:"/wxMallBuilding/getbuildingfloorlist", | |||
}, | |||
weapp: { | |||
AppId: weappId | |||
@@ -139,6 +139,7 @@ | |||
</view> | |||
</view> | |||
<view class="con" wx:if="{{ifHaveCarModular == 0}}" > | |||
<image class="img" src="{{parkUrl}}" mode="widthFix"></image> | |||
<text class="txt1">智慧停车即将上线</text> | |||
@@ -441,6 +441,7 @@ Page({ | |||
} | |||
}); | |||
}, | |||
saveImageToPhotos: function(tempFilePath) { | |||
wx.saveImageToPhotosAlbum({ | |||
filePath: tempFilePath, | |||
@@ -13,6 +13,7 @@ Page({ | |||
navigationBarHeight, | |||
chevronUrl: imgurl.chevron.url, | |||
date: '1988-03-12', | |||
dateEnd:'', | |||
flag: 1, | |||
flagsex: 0, | |||
items: [ | |||
@@ -126,7 +127,7 @@ Page({ | |||
}) | |||
.then(res => { | |||
wx.showToast({ | |||
title: "修改成功", | |||
title: "信息提交成功,将在3分钟内生效", | |||
icon: 'none', | |||
duration: 2000, | |||
mask: false | |||
@@ -192,21 +193,30 @@ Page({ | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
let tmpeDateEnd = util.formatTime(new Date(), "yyyy-MM-dd") | |||
let that = this; | |||
that.setData({ | |||
dateEnd: tmpeDateEnd | |||
}) | |||
Http.get({ | |||
url: config.api.getScore, | |||
data: {} | |||
data: {}, | |||
}) | |||
.then(res => {res.data | |||
console.log(res); | |||
if(res.code == 200){ | |||
let tmpeArr = res.data.childrenList | |||
tmpeArr.map(item=>{ | |||
item.birthdate = util.fmtDate(parseInt(item.birthdate)) | |||
}) | |||
if (res.data.childrenList){ | |||
let tmpeArr = res.data.childrenList | |||
tmpeArr.map(item => { | |||
item.birthdate = util.fmtDate(parseInt(item.birthdate)) | |||
that.setData({ | |||
childArr: tmpeArr | |||
}) | |||
}) | |||
} | |||
that.setData({ | |||
showPage:true, | |||
childArr: tmpeArr | |||
}) | |||
} | |||
var reg = RegExp(/address/); | |||
@@ -8,7 +8,7 @@ | |||
</view> | |||
<view class="section sec"> | |||
<text>生日</text> | |||
<picker mode="date" value="{{date}}" start="1930-09-01" end="2017-09-01" bindchange="bindDateChange"> | |||
<picker mode="date" value="{{date}}" start="1930-09-01" end="{{dateEnd}}" bindchange="bindDateChange"> | |||
<input wx:if="{{flag==1}}" class='input' placeholder='请输入生日' disabled/> | |||
<view wx:if="{{flag==2}}" class="picker"> {{date}}</view> | |||
</picker> | |||
@@ -40,7 +40,7 @@ | |||
<view class="contBox_section sec"> | |||
<text>生日</text> | |||
<picker class="contBox_picker" mode="date" value="{{date}}" start="1930-09-01" end="2017-09-01" bindchange="chidBirthday" data-index="{{index}}"> | |||
<picker class="contBox_picker" mode="date" value="{{date}}" start="1930-09-01" end="{{dateEnd}}" bindchange="chidBirthday" data-index="{{index}}"> | |||
<input wx:if="{{!item.birthdate}}" class='contBox_picker' placeholder='请输入生日' disabled/> | |||
<view wx:if="{{item.birthdate}}" class="contBox_picker"> {{item.birthdate}}</view> | |||
</picker> | |||
@@ -10,11 +10,63 @@ Page({ | |||
*/ | |||
data: { | |||
navigationBarHeight, | |||
falgFloor:0,//楼座标识 | |||
tierFalg:0,//楼层标识 | |||
dataLsit:[],//楼层信息 | |||
tmpePicture:'',//零时存放 图片 | |||
}, | |||
lookimg(){ | |||
wx.previewImage({ | |||
current: 'http://wayn.xin:9092/upload/2020/12/28/9aada16278ecbb200bb69de0e5ce25df.png', // 当前显示图片的http链接 | |||
urls: ['http://wayn.xin:9092/upload/2020/12/28/9aada16278ecbb200bb69de0e5ce25df.png'] // 需要预览的图片http链接列表 | |||
current: this.data.tmpePicture, // 当前显示图片的http链接 | |||
urls: [this.data.tmpePicture] // 需要预览的图片http链接列表 | |||
}) | |||
}, | |||
setFalgFloor(e){//设置选中楼层 | |||
let index = e.currentTarget.dataset.index | |||
this.setData({ | |||
falgFloor:index, | |||
tierFalg:0, | |||
}) | |||
let tmepimg = '' | |||
if (this.data.dataLsit[index].floors[0].floorMaps && this.data.dataLsit[index].floors[0].floorMaps.length != 0) { | |||
tmepimg = this.data.dataLsit[index].floors[0].floorMaps[0].url | |||
} else { | |||
tmepimg = '' | |||
} | |||
this.setData({ | |||
tmpePicture: tmepimg | |||
}) | |||
}, | |||
setTierFalg(e){//设置选中楼层 | |||
let index = e.currentTarget.dataset.index | |||
let tmepimg = '' | |||
if (this.data.dataLsit[this.data.falgFloor].floors[index].floorMaps && this.data.dataLsit[this.data.falgFloor].floors[index].floorMaps.length!=0){ | |||
tmepimg = this.data.dataLsit[this.data.falgFloor].floors[index].floorMaps[0].url | |||
}else{ | |||
tmepimg = '' | |||
} | |||
this.setData({ | |||
tierFalg: index, | |||
tmpePicture: tmepimg | |||
}) | |||
}, | |||
getStoreMap(){//获取楼层信息 | |||
Http.get({ | |||
url: config.api.getStoreMap | |||
}).then(res=>{ | |||
//初始化地图 | |||
let tmepimg = '' | |||
if (res.data[0].floors[0].floorMaps && res.data[0].floors[0].floorMaps.length != 0) { | |||
tmepimg = res.data[0].floors[0].floorMaps[0].url | |||
} else { | |||
tmepimg = '' | |||
} | |||
//拿取第一张地图 | |||
this.setData({ | |||
dataLsit:res.data, | |||
tmpePicture: tmepimg | |||
}) | |||
}) | |||
}, | |||
@@ -22,7 +74,7 @@ Page({ | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
this.getStoreMap() | |||
}, | |||
/** | |||
@@ -3,38 +3,21 @@ | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class="Box"> | |||
<view class="area"> | |||
<view class="{{falgFloor==index?'areaItemActivity':'areaItem'}}" wx:for="{{dataLsit}}" wx:key="index" bindtap="setFalgFloor" data-index="{{index}}">{{item.buildingName}}</view> | |||
<!-- <view class="areaItem">B座</view> --> | |||
</view> | |||
<!-- <image mode="widthFix" class="dt_1_img" src="https://formall.oss-accelerate.aliyuncs.com/789/a7524bda-3b36-41c2-89e3-490ef1a3da49.png"></image> --> | |||
<view class="dt_box"> | |||
<view class="le_box"> | |||
<view class="floor_a"> | |||
<text class="text">第一层</text> | |||
<text class="active"></text> | |||
</view> | |||
<view class="floor"> | |||
<text class="text">第一层</text> | |||
<!-- <text class="active"></text> --> | |||
</view> | |||
<view class="floor"> | |||
<text class="text">第一层</text> | |||
<!-- <text class="active"></text> --> | |||
</view> | |||
<view class="floor"> | |||
<text class="text">第一层</text> | |||
<!-- <text class="active"></text> --> | |||
</view> | |||
<view class="floor"> | |||
<text class="text">第一层</text> | |||
<!-- <text class="active"></text> --> | |||
<view class="{{tierFalg==index?'floor_a':floor}}" wx:for="{{dataLsit[falgFloor].floors}}" wx:key="index" bindtap="setTierFalg" data-index="{{index}}"> | |||
<text class="text">{{item.floorName}}</text> | |||
<text class="active" wx:if="{{tierFalg==index}}"></text> | |||
</view> | |||
<view class="floor"> | |||
<text class="text">第一层</text> | |||
<!-- <text class="active"></text> --> | |||
</view> | |||
</view> | |||
<view class="ri_box"> | |||
<image mode="widthFix" class="dt_2_img" src="https://formall.oss-accelerate.aliyuncs.com/789/a7524bda-3b36-41c2-89e3-490ef1a3da49.png"></image> | |||
</view> | |||
<image mode="widthFix" class="dt_2_img" src="{{tmpePicture}}" wx:if="{{tmpePicture!=''}}" bindtap="lookimg"></image> | |||
<view class="noIMg" wx:if="{{tmpePicture==''}}">暂未配置</view> | |||
</view> | |||
</view> | |||
</view> |
@@ -58,7 +58,6 @@ | |||
text-align: center; | |||
line-height: 100rpx; | |||
} | |||
.active { | |||
position: absolute; | |||
left: 4rpx; | |||
@@ -70,3 +69,35 @@ | |||
background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%); | |||
border-radius: 7rpx; | |||
} | |||
.area{ | |||
overflow: hidden; | |||
margin-bottom: 30rpx; | |||
} | |||
.areaItemActivity{ | |||
float: left; | |||
text-align: center; | |||
line-height: 60rpx; | |||
height: 60rpx; | |||
width: 100rpx; | |||
background-color: #409EFF; | |||
color: #fff; | |||
} | |||
.areaItem{ | |||
color: #606266; | |||
float: left; | |||
width: 100rpx; | |||
text-align: center; | |||
line-height: 60rpx; | |||
height: 60rpx; | |||
background-color: #fff; | |||
border-radius: 5rpx; | |||
} | |||
.noIMg{ | |||
width: 92%; | |||
margin: 0 2%; | |||
text-align: center; | |||
height: 50vh; | |||
line-height: 50vh; | |||
font-size: 36rpx; | |||
border: #fff solid 10rpx; | |||
} |
@@ -5,67 +5,248 @@ const Http = require("../../utils/HttpBasics"); | |||
const util = require("../../utils/util"); | |||
const imgurl = require("../../utils/imgurl"); | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
navigationBarHeight, | |||
poterbg: imgurl.poterbg.url, | |||
windowWidth: wx.getSystemInfoSync().windowWidth, | |||
windowHeight: wx.getSystemInfoSync().screenHeight, | |||
totalHeight: 0, | |||
isdisable: true, | |||
mallname: '', //商场名字 | |||
qrCodeL: "", //小程序码 | |||
couponList: [], //活动劵列表 | |||
canvasScale: 1.0 // 画布放大的倍数,因为如果保存的是一倍的分享图片的话,分享图会有点虚。所以保存的时候,canvasScale设置为2.0,wxss 里面的left: 500%;打开注释。就可保存两倍的分享图 | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
onLoad: function(options) { | |||
this.setCanvas() | |||
}, | |||
onShow: function(){ | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady: function () { | |||
}, | |||
//绘制微信头像 | |||
drawAvatarimg(ctx, scale) { | |||
var that = this; | |||
//商户详情海报 | |||
console.log(that.data.avatarUrl,"???") | |||
let src1 = that.data.avatarUrl + `?imageView/2/w/${100}/h/${100}`; | |||
let src2 = util.getProxyImgUrl(src1); | |||
wx.getImageInfo({ | |||
src: src2, | |||
success: function (res) { | |||
console.log(res.path) | |||
that.darwAvatarArc(ctx, res.path, 10, 8, 35, 35); | |||
} | |||
}); | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
setCanvas() { | |||
// 适配屏幕 | |||
let scale = this.data.windowWidth / 375.0 | |||
console.log(scale) | |||
this.setData({ | |||
totalHeight: 667 * scale | |||
}) | |||
// 获取Canvas | |||
let ctx = wx.createCanvasContext("myCanvas"); | |||
this.getMallInfo(ctx, scale) | |||
this.getUserInfo(ctx, scale) | |||
this.drawNormalText(ctx, "适用门店:", 30 * scale, 348 * scale, 16 * scale, "#000", "left", "middle") | |||
this.drawNormalText(ctx, " 向您推荐", 70 * scale, 25 * scale, 16 * scale, "#848484", "left", "middle", scale); | |||
ctx.draw(true); | |||
}, | |||
// 绘制只有一行的文字 | |||
drawNormalText(ctx, str, x, y, font, style, align, baseLine) { | |||
ctx.setFontSize(font); | |||
ctx.setFillStyle(style); | |||
ctx.setTextAlign(align); | |||
ctx.setTextBaseline(baseLine); | |||
ctx.fillText(str, x, y); | |||
ctx.draw(true); | |||
}, | |||
/** | |||
* 生命周期函数--监听页面隐藏 | |||
*/ | |||
onHide: function () { | |||
//商场信息 | |||
getMallInfo: function (ctx, scale) { | |||
let that = this; | |||
// 获取用户信息 | |||
Http.get({ | |||
url: config.api.getMallInfo, | |||
data: {} | |||
}).then(res => { | |||
console.log(res); | |||
if (res.data.img){ | |||
let src1 = res.data.img + `?imageView/2/w/${100}/h/${100}`; | |||
}else{ | |||
// let src1 = res.data.img + `?imageView/2/w/${100}/h/${100}`;//默认图片地址 | |||
} | |||
let src2 = util.getProxyImgUrl(src1); | |||
wx.getImageInfo({ | |||
src: src2, | |||
success: function (res) { | |||
ctx.drawImage(res.path, 20 * scale, 60 * scale, (that.data.windowWidth-60) * scale, 200*scale); | |||
ctx.draw(true); | |||
} | |||
}); | |||
that.setData({ | |||
mallname: res.data.name | |||
}); | |||
that.drawNormalText(ctx, "---" + that.data.mallname + "---", 175 * scale, 25 * scale, 16 * scale, "#000", "left", "middle", scale); | |||
}); | |||
}, | |||
/** | |||
* 生命周期函数--监听页面卸载 | |||
*/ | |||
onUnload: function () { | |||
//获取头像和昵称 | |||
getUserInfo: function (ctx, scale) { | |||
let that = this; | |||
// 获取用户信息 | |||
Http.get({ | |||
url: config.api.getScore, | |||
data: {} | |||
}).then(res => { | |||
let nickName = ''; | |||
if (res.data.nickName == undefined || res.data.nickName == undefined) { | |||
wx.getUserInfo({ | |||
success: function(data) { | |||
nickName = data.userInfo.nickName; | |||
that.setData({ | |||
nickName: nickName, //用户名 | |||
avatarUrl: data.userInfo.avatarUrl //用户头像 | |||
}); | |||
this.drawNormalText(ctx, nickName, 48 * scale, 24 * scale, 16 * scale, "#000", "left", "middle"); | |||
that.drawAvatarimg(ctx, scale) | |||
} | |||
}) | |||
} else { | |||
nickName = res.data.nickName; | |||
that.setData({ | |||
nickName: nickName, | |||
avatarUrl: res.data.avatarUrl | |||
}); | |||
this.drawNormalText(ctx, nickName, 48 * scale, 24 * scale, 16 * scale, "#000", "left", "middle"); | |||
that.drawAvatarimg(ctx, scale) | |||
} | |||
}); | |||
}, | |||
/** | |||
* 页面相关事件处理函数--监听用户下拉动作 | |||
*/ | |||
onPullDownRefresh: function () { | |||
}, | |||
/** | |||
* 页面上拉触底事件的处理函数 | |||
*/ | |||
onReachBottom: function () { | |||
//绘制圆角图像 | |||
darwAvatarArc: function(ctx, src, x, y, w, h = w) { | |||
/* | |||
ctx: 画布对象 | |||
src: 头像缓存路径 | |||
x: 头像起始位置 横坐标 | |||
y: 头像起始位置 纵坐标 | |||
w: 头像宽度 | |||
h: 头像高度,不传为w | |||
*/ | |||
// 保存绘图上下文。 | |||
ctx.save(); | |||
// 开始创建一个路径。需要调用 fill 或者 stroke 才会使用路径进行填充或描边 | |||
ctx.beginPath(); | |||
// 设创建一个圆可以指定 起始弧度为 0,终止弧度为 2 * Math.PI。 | |||
// 用 stroke 或者 fill 方法来在 canvas 中画弧线。 | |||
ctx.arc(x + w / 2, y + h / 2, w / 2, 0, Math.PI * 2, false); | |||
/* 从原始画布中剪切任意形状和尺寸。 | |||
一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内( | |||
不能访问画布上的其他区域)。可以在使用 clip 方法前通过使用 save 方法对当前画布区域进行保存,并在以后的任意时间通过restore方法对其进行恢复。 | |||
*/ | |||
ctx.clip(); | |||
// 画头像 | |||
ctx.drawImage(src, x, y, w, h); | |||
// 恢复之前保存的绘图上下文。 | |||
ctx.restore(); | |||
// 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。 | |||
ctx.draw(true); | |||
}, | |||
/** | |||
* 用户点击右上角分享 | |||
* 保存图片 | |||
*/ | |||
onShareAppMessage: function () { | |||
saveImage() { | |||
let that = this; | |||
wx.canvasToTempFilePath({ | |||
x: 0, | |||
y: 0, | |||
width: this.data.windowWidth * this.data.canvasScale, | |||
height: this.data.totalHeight * this.data.canvasScale, | |||
canvasId: "myCanvas", | |||
success: function(res) { | |||
that.saveImageToPhotos(res.tempFilePath); | |||
}, | |||
fail: function(res) { | |||
wx.showToast({ | |||
title: "图片生成失败", | |||
icon: "none", | |||
duration: 2000 | |||
}); | |||
} | |||
}); | |||
}, | |||
//保存到相册 | |||
saveImageToPhotos: function(tempFilePath) { | |||
wx.saveImageToPhotosAlbum({ | |||
filePath: tempFilePath, | |||
success(result) { | |||
wx.showToast({ | |||
title: "保存成功,从相册中分享到朋友圈吧", | |||
icon: "none", | |||
duration: 4000 | |||
}); | |||
}, | |||
fail: function(err) { | |||
if ( | |||
err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" || | |||
err.errMsg === "saveImageToPhotosAlbum:fail auth deny" | |||
) { | |||
// 这边微信做过调整,必须要在按钮中触发,因此需要在弹框回调中进行调用 | |||
wx.showModal({ | |||
title: "提示", | |||
content: "需要您授权保存相册", | |||
showCancel: false, | |||
success: modalSuccess => { | |||
wx.openSetting({ | |||
success(settingdata) { | |||
console.log("settingdata", settingdata); | |||
if (settingdata.authSetting["scope.writePhotosAlbum"]) { | |||
wx.showModal({ | |||
title: "提示", | |||
content: "获取权限成功,再次点击图片即可保存", | |||
showCancel: false | |||
}); | |||
} else { | |||
wx.showModal({ | |||
title: "提示", | |||
content: "获取权限失败,将无法保存到相册哦~", | |||
showCancel: false | |||
}); | |||
} | |||
}, | |||
fail(failData) { | |||
console.log("failData", failData); | |||
}, | |||
complete(finishData) { | |||
console.log("finishData", finishData); | |||
} | |||
}); | |||
} | |||
}); | |||
} | |||
} | |||
}); | |||
} | |||
}) | |||
}); |
@@ -1,2 +1,11 @@ | |||
<navbar back home text="分享好友" background='#fff'></navbar> | |||
<view style="height:{{navigationBarHeight}} "></view> | |||
<view class='content'> | |||
<view class='poster'> | |||
<canvas canvas-id='myCanvas' class='canvas-content' style="width:{{windowWidth-20}}px;height:{{windowHeight}}px;box-shadow: 1px 1px 5px 5px rgba(0, 0, 0, 0.05); position:absolute;z-index:1;"> | |||
</canvas> | |||
</view> | |||
<cover-view class="bottomsave" style="position:fixed;z-index:11;"> | |||
<button bindtap="saveImage" disabled="{{isdisable}}" class='saveposter'>保存图片分享给朋友</button> | |||
</cover-view> | |||
</view> |
@@ -1 +1,42 @@ | |||
/* pages/canvas/index.wxss */ | |||
.content { | |||
margin: 0; | |||
padding: 0; | |||
width: 100%; | |||
height: 100%; | |||
background: #f3f3f3; | |||
position: relative; | |||
} | |||
.poster { | |||
height: 100%; | |||
padding: 20rpx; | |||
position: absolute; | |||
top: 0; | |||
left: 0; | |||
} | |||
button::after{ border: none; } | |||
.bottomsave { | |||
width: 100%; | |||
height: 140rpx; | |||
line-height: 140rpx; | |||
margin: auto 0; | |||
bottom: 0; | |||
left: 0; | |||
right: 0; | |||
border-top: 1px solid #ccc; | |||
box-shadow: 0 0rpx 150rpx #ccc; | |||
background: #fff; | |||
} | |||
.saveposter { | |||
color: #fff; | |||
width: 380rpx; | |||
height: 80rpx; | |||
border-radius: 50rpx; | |||
background: #f08f04; | |||
margin-top: 30rpx; | |||
font-size: 32rpx; | |||
} | |||
/* pages/shareFriend/shareFriend.wxss */ |
@@ -63,8 +63,8 @@ | |||
"list": [ | |||
{ | |||
"id": 0, | |||
"name": "pages/", | |||
"pathName": "pages/edit/edit", | |||
"name": "pages/shareFriend/shareFriend", | |||
"pathName": "pages/shareFriend/shareFriend", | |||
"query": "", | |||
"scene": null | |||
}, | |||
@@ -0,0 +1,7 @@ | |||
{ | |||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", | |||
"rules": [{ | |||
"action": "allow", | |||
"page": "*" | |||
}] | |||
} |