diff --git a/components/product/productItem.vue b/components/product/productItem.vue index adf0aee..0cc1da5 100644 --- a/components/product/productItem.vue +++ b/components/product/productItem.vue @@ -52,23 +52,23 @@ - ¥{{ item.goldPrice }} + ¥{{ item.silverPrice }} /元每件 - + + - ¥{{ item.silverPrice }} + ¥{{ item.goldPrice }} /元每件 - - + diff --git a/pages/index/center.vue b/pages/index/center.vue index 16a3648..5f2b011 100644 --- a/pages/index/center.vue +++ b/pages/index/center.vue @@ -116,7 +116,7 @@ - 广告招商 + 合伙人招募 @@ -145,7 +145,8 @@ - + diff --git a/pages_order/mine/promotion - 副本.vue b/pages_order/mine/promotion - 副本.vue new file mode 100644 index 0000000..621f896 --- /dev/null +++ b/pages_order/mine/promotion - 副本.vue @@ -0,0 +1,216 @@ + + + + + \ No newline at end of file diff --git a/pages_order/mine/promotion.vue b/pages_order/mine/promotion.vue index 621f896..a501e0b 100644 --- a/pages_order/mine/promotion.vue +++ b/pages_order/mine/promotion.vue @@ -2,23 +2,17 @@ - - - - - - - - - - 保存二维码 - + + + + + @@ -27,7 +21,7 @@ export default { name: 'Promotion', computed: { - ...mapState(['userInfo']), + ...mapState(['userInfo', 'promotionUrl']), }, data() { return { @@ -39,7 +33,11 @@ } }, onShow() { - this.getQrCode() + if(this.promotionUrl){ + this.imagePath = this.promotionUrl + }else{ + this.getQrCode() + } this.$store.commit('getUserInfo') }, methods: { @@ -71,73 +69,73 @@ // Canvas 画布的实际绘制宽高 const width = res[0].width const height = res[0].height + + console.log(width, height); // 初始化画布大小 const dpr = wx.getWindowInfo().pixelRatio - + //根据dpr调整 // dpr 2 4 // 3 6 let Ratio = dpr * 2 - console.log("bug", dpr) + canvas.width = width * dpr canvas.height = height * dpr - + this.canvas = canvas ctx.scale(dpr, dpr) ctx.clearRect(0, 0, width, height) - ctx.fillStyle = '#fff' - ctx.fillRect(0, 0, canvas.width, canvas.height) - - //用户图片 - // const image = canvas.createImage() - // image.onload = () => { - // ctx.drawImage(image, 30, 18, 40, 40) - // } - // image.src = '/public/img/wechar_1.png' - // image.src = this.userInfo.headImage - ctx.fillStyle = 'black' - ctx.font = '22px PingFangSC-regular'; - - // 绘制用户姓名 - // let nickName = this.userInfo.nickName || '绘制用户姓名' - // ctx.fillText(nickName, canvas.width / Ratio - nickName.length * 11, 40); - - // ctx.font = '18px PingFangSC-regular'; + // ctx.fillStyle = '#fff' + // ctx.fillRect(0, 0, canvas.width, canvas.height) + + + //图片 + const bgImage = canvas.createImage() + bgImage.src = this.configList.qr_code - // 绘制欢迎语 - let s = this.title || '' - ctx.fillText(s, canvas.width / Ratio - s.length * 11, 50); - //二维码图片 const coderImage = canvas.createImage() coderImage.src = this.baseUrl + this.url - coderImage.onload = () => { - ctx.drawImage(coderImage, - canvas.width / Ratio - 240 / 2, 100, 240, 240) + + + bgImage.onload = () => { + canvas.width = bgImage.width + canvas.height = bgImage.height + ctx.drawImage(bgImage, + 0, 0, bgImage.width, bgImage.height) + + coderImage.onload = () => { + ctx.drawImage(coderImage, + canvas.width / 2 - 175, canvas.height / 2 - 100, 350, 350) + this.canvasToTempFilePath() + } } - - // 绘制完成后存储路径 - - setTimeout(() => { - wx.canvasToTempFilePath({ - x: 0, - y: 0, - width: this.canvas.width, - height: this.canvas.height, - canvas, - success: (res) => { - var tempFilePath = res.tempFilePath; - this.imagePath = tempFilePath - uni.hideLoading() - } - }); - }, 600); - }) }, + canvasToTempFilePath(){ + // 绘制完成后存储路径 + setTimeout(() => { + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: this.canvas.width, + height: this.canvas.height, + canvas : this.canvas, + success: (res) => { + var tempFilePath = res.tempFilePath; + this.imagePath = tempFilePath + + this.$store.commit('setPromotionUrl', res.tempFilePath) + + uni.hideLoading() + this.load = false + } + }); + }, 200); + }, back() { uni.navigateBack(-1) }, @@ -176,28 +174,10 @@ width: 100%; height: 100vh; background-color: $uni-color; - .promotion-card { - width: 90%; - margin: 140rpx auto 0rpx auto; - box-shadow: 0rpx 0rpx 15rpx rgba(0, 0, 0, .2); - border-radius: 40rpx; - padding: 40rpx 30rpx; - box-sizing: border-box; - background-color: #fff; - position: relative; - padding-top: 100rpx; - .headImage{ - position: absolute; - height: 180rpx; - width: 180rpx; - border-radius: 50%; - top: -80rpx; - left: 50%; - transform: translate(-50%); - border: 10rpx solid #fff; - box-shadow: 0 0 10rpx 10rpx #00000013; - } - } + } + .image{ + width: 100%; + height: calc(100vh - 200rpx); } #myCanvas { @@ -206,9 +186,8 @@ /* visibility: hidden */ /* visibility: hidden; */ /* margin-top: 100rpx; */ - margin: 68rpx auto; width: 750rpx; - height: 750rpx; + height: calc(100vh - 120rpx); /* line-height: 20px; */ background-color: rgba(255, 255, 255, 1); text-align: center; diff --git a/store/store.js b/store/store.js index 083273e..d0cb825 100644 --- a/store/store.js +++ b/store/store.js @@ -13,6 +13,7 @@ const store = new Vuex.Store({ riceInfo: {}, //用户相关信息 category: [], //分类信息 payOrderProduct: [], //支付订单中的商品 + promotionUrl : '',//分享二维码 }, getters: {}, mutations: { @@ -144,6 +145,9 @@ const store = new Vuex.Store({ setPayOrderProduct(state, data) { state.payOrderProduct = data }, + setPromotionUrl(state, data){ + state.promotionUrl = data + }, }, actions: {}, })