Commit da986012 by 张立顺

分享二维码修复

1 parent 8b8baed1
// pages/mineDetail/messageBox/messageBox.js // pages/mineDetail/messageBox/messageBox.js
import mineApi from '~/api/mineApi/index' import mineApi from '~/api/mineApi/index'
import { handleCopy } from '~/utils/utils_wx' // import { handleCopy } from '~/utils/utils_wx'
let drawQrcode = require('~/utils/lib/weapp-qrcode.js')
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -15,6 +16,7 @@ Component({ ...@@ -15,6 +16,7 @@ Component({
loginType: 0, loginType: 0,
agree: true, agree: true,
tabIndx: 0, tabIndx: 0,
text: '',
tabList: ['战报', '通知'], tabList: ['战报', '通知'],
type: { type: {
warReport: { warReport: {
...@@ -35,6 +37,7 @@ Component({ ...@@ -35,6 +37,7 @@ Component({
serviceMerchantId: '' serviceMerchantId: ''
}, },
attached() { attached() {
this.ewmChange()
// this.initTime() // this.initTime()
let { userInfo } = wx.$storage.get() let { userInfo } = wx.$storage.get()
let merchantId = userInfo.subLoginUser.merchantId let merchantId = userInfo.subLoginUser.merchantId
...@@ -49,6 +52,21 @@ Component({ ...@@ -49,6 +52,21 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
ewmChange(url) {
let size = {}
size.w = (wx.getSystemInfoSync().windowWidth / 750) * 600
size.h = size.w
var that = this
// ctx: wx.createCanvasContext('myQrcode'),
drawQrcode({
width: size.w,
height: size.h,
canvasId: 'myQrcode',
text: url || that.data.text
// v1.0.0+版本支持在二维码上绘制图片
})
},
preView(e) { preView(e) {
let { valueurl } = e.currentTarget.dataset let { valueurl } = e.currentTarget.dataset
// console.log(e) // console.log(e)
...@@ -74,46 +92,45 @@ Component({ ...@@ -74,46 +92,45 @@ Component({
}, },
copyLink(e) { copyLink(e) {
console.log(e) console.log(e)
let that = this
let { url } = e.currentTarget.dataset let { url } = e.currentTarget.dataset
console.log(url) this.ewmChange(url)
handleCopy(url) setTimeout(() => {
}, this.share()
// handleCopy(e) { }, 100)
// var { idx } = e.currentTarget.dataset },
// var currentItem = this.data.orderObj.activityList[idx]
// var qr = wxqrcode.createQrCodeImg(currentItem.activityUrl) share(e) {
// const base64src = function (base64data) { // console.log(e)
// return new Promise((resolve, reject) => { let that = this
// const [a, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || [] const dpr = wx.getSystemInfoSync().pixelRatio
// if (!format) reject(new Error('ERROR_BASE64SRC_PARSE')) wx.canvasToTempFilePath({
// const filePath = `${wx.env.USER_DATA_PATH}/tmp_base64src.${format}` canvasId: 'myQrcode',
// const buffer = wx.base64ToArrayBuffer(bodyData) x: 0,
// wx.getFileSystemManager().writeFile({ y: 0,
// filePath, width: 600,
// data: buffer, height: 600,
// encoding: 'binary', destWidth: 600 * dpr, // width*屏幕像素密度
// success() { destHeight: 600 * dpr, // height*屏幕像素密度
// resolve(filePath) fileType: 'jpg',
// }, quality: 1, //图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。
// fail() { success: function (res) {
// reject(new Error('ERROR_BASE64SRC_WRITE')) var tempFilePath = res.tempFilePath
// } wx.getImageInfo({
// }) src: tempFilePath,
// }) success(obj) {
// } wx.showShareImageMenu({
// base64src(qr).then(res => { path: obj.path
// wx.getImageInfo({ })
// src: res, },
// success(obj) { fail() {}
// wx.showShareImageMenu({ })
// path: obj.path },
// }) fail: function (res) {
// }, console.log(res)
// fail() { }
// } })
// }) },
// })
// },
navbarReady(e) { navbarReady(e) {
let { height, statusBarHeight } = e.detail let { height, statusBarHeight } = e.detail
console.log(e) console.log(e)
...@@ -142,10 +159,7 @@ Component({ ...@@ -142,10 +159,7 @@ Component({
this.getMessageList(typename) this.getMessageList(typename)
}, },
changeTabIndx(e) { changeTabIndx(e) {
// console.log(e)
// let { tabIndx } = this.data
let { detail } = e let { detail } = e
// console.log(detail)
this.setData({ this.setData({
tabIndx: detail tabIndx: detail
}) })
......
...@@ -98,3 +98,9 @@ ...@@ -98,3 +98,9 @@
color: #3666FE; color: #3666FE;
} }
} }
.erweimaCanvas {
position: fixed;
top: -9999rpx;
left: -9999rpx;
}
\ No newline at end of file \ No newline at end of file
...@@ -126,4 +126,5 @@ ...@@ -126,4 +126,5 @@
</view> </view>
</view> </view>
<crowdfund-poster item="{{posterItem}}" /> <crowdfund-poster item="{{posterItem}}" />
<canvas class="erweimaCanvas" style="width: 600rpx; height: 600rpx;" canvas-id="myQrcode" />
...@@ -86,7 +86,7 @@ Component({ ...@@ -86,7 +86,7 @@ Component({
let that = this let that = this
let { index } = e.currentTarget.dataset let { index } = e.currentTarget.dataset
let { dataObj, userInfo, list } = this.data let { dataObj, userInfo, list } = this.data
const itemList = ['本月', '本日', '全部'] const itemList = ['本月', '本日', '累计']
wx.showActionSheet({ wx.showActionSheet({
// '全部' // '全部'
itemList, itemList,
...@@ -148,7 +148,7 @@ Component({ ...@@ -148,7 +148,7 @@ Component({
}, },
getTotalMerchantCount(type) { getTotalMerchantCount(type) {
// let { } = this.data // let { } = this.data
let { current, userInfo } = this.data let { current, userInfo, dataObj } = this.data
// let { merchantId } = userInfo.subLoginUser // let { merchantId } = userInfo.subLoginUser
// console.log('merchantId', merchantId) // console.log('merchantId', merchantId)
// console.log('test', userInfo.merchantId) // console.log('test', userInfo.merchantId)
...@@ -158,7 +158,7 @@ Component({ ...@@ -158,7 +158,7 @@ Component({
// 44211548 // 44211548
try { try {
outputApi outputApi
.partnerMerchantTotal({ merchantId: userInfo.merchantId }) .partnerMerchantTotal({ merchantId: userInfo.merchantId, ...dataObj.defaultTime })
.then(result => { .then(result => {
// debugger // debugger
console.log('result', result) console.log('result', result)
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<view class="contitle"> <view class="contitle">
<view class="name">{{item.merchantName}}</view> <view class="name">{{item.merchantName}}</view>
<view class="select" data-index="{{index}}" bind:tap="pickSheet"> <view class="select" data-index="{{index}}" bind:tap="pickSheet">
<view>{{item.selectName||'全部'}}</view> <view>{{item.selectName||'累计'}}</view>
<image <image
class="arrow {{isAct?'isAct':''}}" class="arrow {{isAct?'isAct':''}}"
webp webp
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!