diff --git a/config/config.js b/config/config.js index a80a552..b37e649 100755 --- a/config/config.js +++ b/config/config.js @@ -338,7 +338,9 @@ var config = { // 获取所有直播间和商品信息 getReplayList: "/live/replayList", // 获取直播房间回放数据和商品信息 - getRoomList: "/live/roomList" + getRoomList: "/live/roomList", + //商城地图 + getStoreMap:"/wxMallBuilding/getbuildingfloorlist", }, weapp: { AppId: weappId diff --git a/index/passCar.wxml b/index/passCar.wxml index b733854..064975e 100644 --- a/index/passCar.wxml +++ b/index/passCar.wxml @@ -139,6 +139,7 @@ + 智慧停车即将上线 diff --git a/pages/canvas/index.js b/pages/canvas/index.js index 1726cac..916a730 100644 --- a/pages/canvas/index.js +++ b/pages/canvas/index.js @@ -441,6 +441,7 @@ Page({ } }); }, + saveImageToPhotos: function(tempFilePath) { wx.saveImageToPhotosAlbum({ filePath: tempFilePath, diff --git a/pages/edit/edit.js b/pages/edit/edit.js index 58a3793..3971ed6 100644 --- a/pages/edit/edit.js +++ b/pages/edit/edit.js @@ -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/); diff --git a/pages/edit/edit.wxml b/pages/edit/edit.wxml index f81470b..b64822c 100644 --- a/pages/edit/edit.wxml +++ b/pages/edit/edit.wxml @@ -8,7 +8,7 @@ 生日 - + {{date}} @@ -40,7 +40,7 @@ 生日 - + {{item.birthdate}} diff --git a/pages/marketAtlas/marketAtlas.js b/pages/marketAtlas/marketAtlas.js index 606684f..6d09ee5 100644 --- a/pages/marketAtlas/marketAtlas.js +++ b/pages/marketAtlas/marketAtlas.js @@ -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() }, /** diff --git a/pages/marketAtlas/marketAtlas.wxml b/pages/marketAtlas/marketAtlas.wxml index ac9685e..0bd4771 100644 --- a/pages/marketAtlas/marketAtlas.wxml +++ b/pages/marketAtlas/marketAtlas.wxml @@ -3,38 +3,21 @@ + + {{item.buildingName}} + + - - 第一层 - - - - 第一层 - - - - 第一层 - - - - 第一层 - - - - 第一层 - + + {{item.floorName}} + - - 第一层 - - - - - - + + 暂未配置 + \ No newline at end of file diff --git a/pages/marketAtlas/marketAtlas.wxss b/pages/marketAtlas/marketAtlas.wxss index bfb9ce6..4ea789b 100644 --- a/pages/marketAtlas/marketAtlas.wxss +++ b/pages/marketAtlas/marketAtlas.wxss @@ -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; +} \ No newline at end of file diff --git a/pages/shareFriend/shareFriend.js b/pages/shareFriend/shareFriend.js index be9ba88..0e685bf 100644 --- a/pages/shareFriend/shareFriend.js +++ b/pages/shareFriend/shareFriend.js @@ -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); + } + }); + } + }); + } + } + }); } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/pages/shareFriend/shareFriend.wxml b/pages/shareFriend/shareFriend.wxml index fdd3f84..461ab57 100644 --- a/pages/shareFriend/shareFriend.wxml +++ b/pages/shareFriend/shareFriend.wxml @@ -1,2 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/pages/shareFriend/shareFriend.wxss b/pages/shareFriend/shareFriend.wxss index 6473bc0..75f4844 100644 --- a/pages/shareFriend/shareFriend.wxss +++ b/pages/shareFriend/shareFriend.wxss @@ -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 */ \ No newline at end of file diff --git a/project.config.json b/project.config.json index e754bfc..dde5e17 100644 --- a/project.config.json +++ b/project.config.json @@ -63,8 +63,8 @@ "list": [ { "id": 0, - "name": "pages/", - "pathName": "pages/edit/edit", + "name": "pages/shareFriend/shareFriend", + "pathName": "pages/shareFriend/shareFriend", "query": "", "scene": null }, diff --git a/sitemap53.json b/sitemap53.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/sitemap53.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file