| | |
| | | "quickapp" : {}, |
| | | /* 快应用特有相关 */ |
| | | "mp-weixin" : { |
| | | "appid" : "wx1441324401626290", |
| | | "appid" : "wx6d0ecc4e18710458", |
| | | "setting" : { |
| | | "urlCheck" : false, |
| | | "es6" : true, |
| | |
| | | setTimeout(() => { |
| | | this.$message.hideLoading() |
| | | }, 2000) |
| | | |
| | | }, |
| | | methods: { |
| | | // 生成分享图片 |
| | |
| | | <!-- 联系我们 --> |
| | | <!-- --> |
| | | <view class="contact-container"> |
| | | <view class="container" @click="saveCode"> |
| | | |
| | | <view class="container" @click="saveCode" v-if="!codeUrl"> |
| | | <canvas type="2d" id="myQrcode" class="code"></canvas> |
| | | <view class="info"> |
| | | <view class="desc"> |
| | | <p>{{name||'-'}}的推广二维码</p> |
| | | <p style="font-size: 600;color: #000;">点击保存二维码</p> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-if="codeUrl" @click="saveImg"> |
| | | <image :src="codeUrl" class="code-img"></image> |
| | | <view class="info"> |
| | | <view class="desc"> |
| | | <p>{{name||'-'}}的推广二维码</p> |
| | |
| | | return { |
| | | name: '', |
| | | userId: '', |
| | | codeUrl: '', |
| | | canvas: undefined, |
| | | } |
| | | }, |
| | |
| | | this.$message.showToast('请先完善合伙人信息') |
| | | return |
| | | } |
| | | //有定制二维码,显示定制二维码 |
| | | this.codeUrl = this.currentInfo.partnerDTO.codeUrl || '' |
| | | this.name = this.currentInfo.partnerDTO.name || '佚名' |
| | | // this.userId = this.currentInfo.userId |
| | | this.initcode() |
| | | if (!this.codeUrl) |
| | | this.initcode() |
| | | }, |
| | | methods: { |
| | | async saveImg() { |
| | | await this.$message.confirm('确定保存此文件吗') |
| | | let _this = this |
| | | _this.$message.showLoading() |
| | | |
| | | uni.downloadFile({ |
| | | url: _this.codeUrl, //下载地址接口返回 |
| | | success: (data) => { |
| | | _this.$message.hideLoading() |
| | | console.log('success', data) |
| | | if (data.statusCode === 200) { |
| | | //文件保存到本地 |
| | | uni.saveImageToPhotosAlbum({ |
| | | filePath: data.tempFilePath, |
| | | success: function() { |
| | | console.log('save success'); |
| | | uni.showToast({ |
| | | title: '保存成功' |
| | | }) |
| | | }, |
| | | fail(res) { |
| | | console.error(res) |
| | | uni.showToast({ |
| | | title: '保存失败。', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | }else{ |
| | | uni.showToast({ |
| | | title: '保存失败。.', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | _this.$message.hideLoading() |
| | | |
| | | console.log(err); |
| | | uni.showToast({ |
| | | icon: 'none', |
| | | mask: true, |
| | | title: '失败请重新下载', |
| | | }); |
| | | }, |
| | | }); |
| | | }, |
| | | initcode() { |
| | | let that = this |
| | | const query = uni.createSelectorQuery() |
| | | |
| | | var qrUrl = |
| | | `https://scan.hmyxianhua.com/wx/?partnerUserId=${this.currentInfo.id||'-'}&partnerUserName=${this.name||'-'}` |
| | | query.select('#myQrcode') |
| | | .fields({ |
| | | node: true, |
| | |
| | | padding: 30, |
| | | background: '#ffffff', |
| | | foreground: '#000000', |
| | | text: JSON.stringify({ |
| | | 'name': that.name, |
| | | 'userId': that.currentInfo.id, |
| | | // 'userId': that.currentInfo.partnerDTO.id, |
| | | 'version': '1.1.0' |
| | | }), |
| | | // text: JSON.stringify({ |
| | | // 'name': that.name, |
| | | // 'userId': that.currentInfo.id, |
| | | // 'version': '1.1.0' |
| | | // }), |
| | | text: qrUrl |
| | | // text: `https://www.hmyxianhua.com/wx-c-jump/sub_pages/customer/customer-info/customer-info?name=${that.name}&userId=${that.currentInfo.id}` |
| | | // JSON.stringify({ |
| | | // 'name': that.name, |
| | |
| | | .contact-container { |
| | | position: relative; |
| | | |
| | | .code-img { |
| | | width: 600rpx; |
| | | min-height: 600rpx; |
| | | display: inline-block; |
| | | margin: 0 auto; |
| | | margin-top: 100rpx; |
| | | } |
| | | |
| | | .container { |
| | | position: absolute; |
| | | top: 148rpx; |