Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit da986012
authored
Oct 28, 2022
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
分享二维码修复
1 parent
8b8baed1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
46 deletions
pages/mineDetail/messageBox/messageBox.js
pages/mineDetail/messageBox/messageBox.scss
pages/mineDetail/messageBox/messageBox.wxml
pages/tab/output/components/merchant/mrechant.js
pages/tab/output/components/merchant/mrechant.wxml
utils/lib/weapp-qrcode.js
pages/mineDetail/messageBox/messageBox.js
View file @
da98601
// pages/mineDetail/messageBox/messageBox.js
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
({
/**
* 组件的属性列表
...
...
@@ -15,6 +16,7 @@ Component({
loginType
:
0
,
agree
:
true
,
tabIndx
:
0
,
text
:
''
,
tabList
:
[
'战报'
,
'通知'
],
type
:
{
warReport
:
{
...
...
@@ -35,6 +37,7 @@ Component({
serviceMerchantId
:
''
},
attached
()
{
this
.
ewmChange
()
// this.initTime()
let
{
userInfo
}
=
wx
.
$storage
.
get
()
let
merchantId
=
userInfo
.
subLoginUser
.
merchantId
...
...
@@ -49,6 +52,21 @@ Component({
* 组件的方法列表
*/
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
)
{
let
{
valueurl
}
=
e
.
currentTarget
.
dataset
// console.log(e)
...
...
@@ -74,46 +92,45 @@ Component({
},
copyLink
(
e
)
{
console
.
log
(
e
)
let
that
=
this
let
{
url
}
=
e
.
currentTarget
.
dataset
console
.
log
(
url
)
handleCopy
(
url
)
this
.
ewmChange
(
url
)
setTimeout
(()
=>
{
this
.
share
()
},
100
)
},
share
(
e
)
{
// console.log(e)
let
that
=
this
const
dpr
=
wx
.
getSystemInfoSync
().
pixelRatio
wx
.
canvasToTempFilePath
({
canvasId
:
'myQrcode'
,
x
:
0
,
y
:
0
,
width
:
600
,
height
:
600
,
destWidth
:
600
*
dpr
,
// width*屏幕像素密度
destHeight
:
600
*
dpr
,
// height*屏幕像素密度
fileType
:
'jpg'
,
quality
:
1
,
//图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。
success
:
function
(
res
)
{
var
tempFilePath
=
res
.
tempFilePath
wx
.
getImageInfo
({
src
:
tempFilePath
,
success
(
obj
)
{
wx
.
showShareImageMenu
({
path
:
obj
.
path
})
},
fail
()
{}
})
},
fail
:
function
(
res
)
{
console
.
log
(
res
)
}
})
},
// handleCopy(e) {
// var { idx } = e.currentTarget.dataset
// var currentItem = this.data.orderObj.activityList[idx]
// var qr = wxqrcode.createQrCodeImg(currentItem.activityUrl)
// const base64src = function (base64data) {
// return new Promise((resolve, reject) => {
// const [a, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || []
// if (!format) reject(new Error('ERROR_BASE64SRC_PARSE'))
// const filePath = `${wx.env.USER_DATA_PATH}/tmp_base64src.${format}`
// const buffer = wx.base64ToArrayBuffer(bodyData)
// wx.getFileSystemManager().writeFile({
// filePath,
// data: buffer,
// encoding: 'binary',
// success() {
// resolve(filePath)
// },
// fail() {
// reject(new Error('ERROR_BASE64SRC_WRITE'))
// }
// })
// })
// }
// base64src(qr).then(res => {
// wx.getImageInfo({
// src: res,
// success(obj) {
// wx.showShareImageMenu({
// path: obj.path
// })
// },
// fail() {
// }
// })
// })
// },
navbarReady
(
e
)
{
let
{
height
,
statusBarHeight
}
=
e
.
detail
console
.
log
(
e
)
...
...
@@ -142,10 +159,7 @@ Component({
this
.
getMessageList
(
typename
)
},
changeTabIndx
(
e
)
{
// console.log(e)
// let { tabIndx } = this.data
let
{
detail
}
=
e
// console.log(detail)
this
.
setData
({
tabIndx
:
detail
})
...
...
pages/mineDetail/messageBox/messageBox.scss
View file @
da98601
...
...
@@ -97,4 +97,10 @@
font-size
:
24rpx
;
color
:
#3666FE
;
}
}
.erweimaCanvas
{
position
:
fixed
;
top
:
-9999rpx
;
left
:
-9999rpx
;
}
\ No newline at end of file
pages/mineDetail/messageBox/messageBox.wxml
View file @
da98601
...
...
@@ -126,4 +126,5 @@
</view>
</view>
<crowdfund-poster item="{{posterItem}}" />
<canvas class="erweimaCanvas" style="width: 600rpx; height: 600rpx;" canvas-id="myQrcode" />
pages/tab/output/components/merchant/mrechant.js
View file @
da98601
...
...
@@ -86,7 +86,7 @@ Component({
let
that
=
this
let
{
index
}
=
e
.
currentTarget
.
dataset
let
{
dataObj
,
userInfo
,
list
}
=
this
.
data
const
itemList
=
[
'本月'
,
'本日'
,
'
全部
'
]
const
itemList
=
[
'本月'
,
'本日'
,
'
累计
'
]
wx
.
showActionSheet
({
// '全部'
itemList
,
...
...
@@ -148,7 +148,7 @@ Component({
},
getTotalMerchantCount
(
type
)
{
// let { } = this.data
let
{
current
,
userInfo
}
=
this
.
data
let
{
current
,
userInfo
,
dataObj
}
=
this
.
data
// let { merchantId } = userInfo.subLoginUser
// console.log('merchantId', merchantId)
// console.log('test', userInfo.merchantId)
...
...
@@ -158,7 +158,7 @@ Component({
// 44211548
try
{
outputApi
.
partnerMerchantTotal
({
merchantId
:
userInfo
.
merchantId
})
.
partnerMerchantTotal
({
merchantId
:
userInfo
.
merchantId
,
...
dataObj
.
defaultTime
})
.
then
(
result
=>
{
// debugger
console
.
log
(
'result'
,
result
)
...
...
pages/tab/output/components/merchant/mrechant.wxml
View file @
da98601
...
...
@@ -28,7 +28,7 @@
<view class="contitle">
<view class="name">{{item.merchantName}}</view>
<view class="select" data-index="{{index}}" bind:tap="pickSheet">
<view>{{item.selectName||'
全部
'}}</view>
<view>{{item.selectName||'
累计
'}}</view>
<image
class="arrow {{isAct?'isAct':''}}"
webp
...
...
utils/lib/weapp-qrcode.js
0 → 100644
View file @
da98601
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment