From f8ed6c9b46800105789afccc444c46c2aeb956dd Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期六, 03 八月 2024 13:47:18 +0800
Subject: [PATCH] update 合伙人二维码
---
manifest.json | 2
sub_pages/partner/partner-info/partner-code.vue | 89 +++++++++++++++++++++++++++++++++++++++-----
sub_pages/partner/partner-info/partner-code-v2.vue | 1
3 files changed, 81 insertions(+), 11 deletions(-)
diff --git a/manifest.json b/manifest.json
index 2848179..782394c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -49,7 +49,7 @@
"quickapp" : {},
/* 快应用特有相关 */
"mp-weixin" : {
- "appid" : "wx1441324401626290",
+ "appid" : "wx6d0ecc4e18710458",
"setting" : {
"urlCheck" : false,
"es6" : true,
diff --git a/sub_pages/partner/partner-info/partner-code-v2.vue b/sub_pages/partner/partner-info/partner-code-v2.vue
index be6113e..efb3659 100644
--- a/sub_pages/partner/partner-info/partner-code-v2.vue
+++ b/sub_pages/partner/partner-info/partner-code-v2.vue
@@ -52,6 +52,7 @@
setTimeout(() => {
this.$message.hideLoading()
}, 2000)
+
},
methods: {
// 生成分享图片
diff --git a/sub_pages/partner/partner-info/partner-code.vue b/sub_pages/partner/partner-info/partner-code.vue
index 97cea11..4202524 100644
--- a/sub_pages/partner/partner-info/partner-code.vue
+++ b/sub_pages/partner/partner-info/partner-code.vue
@@ -2,9 +2,17 @@
<!-- 联系我们 -->
<!-- -->
<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>
@@ -23,6 +31,7 @@
return {
name: '',
userId: '',
+ codeUrl: '',
canvas: undefined,
}
},
@@ -45,15 +54,67 @@
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,
@@ -74,12 +135,12 @@
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,
@@ -138,6 +199,14 @@
.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;
--
Gitblit v1.9.3