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 4abc465f
authored
Oct 27, 2022
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
bugfix
2 parents
728c8a60
b8cea721
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
263 additions
and
67 deletions
api/outputApi/output.js
components/Authorize/Authorize.js
login/index/components/Box/Box.js
login/lib/index.js
login/loading/loading.js
packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.js
packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.json
packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.wxml
packageOutput/pages/summary/components/outputCrowdfund/outputCrowdfund.js
packageOutput/pages/summary/components/outputCrowdfund/outputCrowdfund.wxml
packageOutput/pages/summary/summary.js
pages/checkProduct/checkProduct.js
pages/tab/index/components/product/product.wxml
utils/Draw.js
utils/share.js
api/outputApi/output.js
View file @
4abc465
...
@@ -76,5 +76,13 @@ class outputApi {
...
@@ -76,5 +76,13 @@ class outputApi {
...
data
...
data
})
})
}
}
/** 店面汇总-下载海报 */
getPosterUrl
(
data
)
{
return
api
.
post
({
method
:
'scrm.api.busassistant.crowdFunding.poster'
,
...
data
})
}
}
}
export
default
outputApi
export
default
outputApi
components/Authorize/Authorize.js
View file @
4abc465
...
@@ -52,7 +52,7 @@ Component({
...
@@ -52,7 +52,7 @@ Component({
/**
/**
* 禁止滑动
* 禁止滑动
*/
*/
noScroll
:
wx
.
$util
.
noScroll
()
,
noScroll
(){}
,
cancel
(
e
)
{
cancel
(
e
)
{
let
{
confirm
}
=
e
.
currentTarget
.
dataset
let
{
confirm
}
=
e
.
currentTarget
.
dataset
let
{
buttonType
,
title
}
=
this
.
data
let
{
buttonType
,
title
}
=
this
.
data
...
...
login/index/components/Box/Box.js
View file @
4abc465
// login/index/components/LoginBox.js
// login/index/components/LoginBox.js
import
USERAPI
from
'~/api/usersApi/index'
import
USERAPI
from
'~/api/usersApi/index'
import
{
import
{
selectAccountLogin
,
checkLoginUserInfo
,
setLoginInfo
,
setLoginInfo
,
loginModal
loginModal
}
from
'~/login/lib/index'
}
from
'~/login/lib/index'
...
@@ -176,7 +176,7 @@ Component({
...
@@ -176,7 +176,7 @@ Component({
})
=>
{
})
=>
{
this
.
setBtnLoading
(
false
)
this
.
setBtnLoading
(
false
)
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
if
(
loginType
==
1
)
this
.
checkLoginUserInfo
(
data
)
if
(
loginType
==
1
)
checkLoginUserInfo
(
data
)
else
{
else
{
const
{
const
{
autoLogin
autoLogin
...
@@ -220,7 +220,7 @@ Component({
...
@@ -220,7 +220,7 @@ Component({
data
,
data
,
message
message
})
=>
{
})
=>
{
if
(
code
==
'0'
)
this
.
checkLoginUserInfo
(
data
)
if
(
code
==
'0'
)
checkLoginUserInfo
(
data
)
else
{
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
this
.
init
()
this
.
init
()
...
@@ -235,24 +235,6 @@ Component({
...
@@ -235,24 +235,6 @@ Component({
this
.
init
()
this
.
init
()
})
})
},
},
/**手机号&微信登录:是否跳转登录列表页 */
checkLoginUserInfo
({
loginUserInfoList
,
sessionId
})
{
/**多个账号 */
if
(
loginUserInfoList
.
length
>
1
)
wx
.
$router
.
go
(
'login.accountItems'
,
{
sessionId
,
...
thisPage
.
options
})
/**只有一个账号 */
else
selectAccountLogin
({
id
:
loginUserInfoList
[
0
].
uuid
,
sessionId
})
},
/**设置登录按钮loading状态 */
/**设置登录按钮loading状态 */
setBtnLoading
(
loading
=
true
)
{
setBtnLoading
(
loading
=
true
)
{
thisPage
.
setData
({
thisPage
.
setData
({
...
...
login/lib/index.js
View file @
4abc465
import
{
setSessionId
,
setUserInfo
}
from
'~/utils/cache/storageApi'
import
{
setSessionId
,
setUserInfo
}
from
'~/utils/cache/storageApi'
import
USERAPI
from
'~/api/usersApi/index'
import
USERAPI
from
'~/api/usersApi/index'
const
setRouteData
=
targetPath
=>
{
const
setRouteData
=
targetPath
=>
{
let
[
url
,
query
]
=
targetPath
.
split
(
'?'
),
let
[
url
,
query
]
=
targetPath
.
split
(
'?'
),
...
@@ -15,11 +18,18 @@ const setRouteData = targetPath => {
...
@@ -15,11 +18,18 @@ const setRouteData = targetPath => {
}
}
}
}
/**选择账号登录 */
/**选择账号登录 */
const
selectAccountLogin
=
({
id
,
sessionId
})
=>
{
const
selectAccountLogin
=
({
id
,
sessionId
})
=>
{
USERAPI
.
selectAccountLogin
({
USERAPI
.
selectAccountLogin
({
id
,
id
,
sessionId
sessionId
}).
then
(({
code
,
data
,
message
})
=>
{
}).
then
(({
code
,
data
,
message
})
=>
{
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
console
.
log
(
data
)
console
.
log
(
data
)
setLoginInfo
(
data
.
loginUserInfoList
[
0
],
data
.
sessionId
)
setLoginInfo
(
data
.
loginUserInfoList
[
0
],
data
.
sessionId
)
...
@@ -28,7 +38,7 @@ const selectAccountLogin = ({ id, sessionId }) => {
...
@@ -28,7 +38,7 @@ const selectAccountLogin = ({ id, sessionId }) => {
}
}
/**设置登录信息 */
/**设置登录信息 */
const
setLoginInfo
=
(
userInfo
,
sessionId
)
=>
{
const
setLoginInfo
=
(
userInfo
,
sessionId
)
=>
{
if
(
!
userInfo
)
{
if
(
!
userInfo
)
{
wx
.
$api
.
showToast
(
'仅支持服务商类型账户登录'
)
wx
.
$api
.
showToast
(
'仅支持服务商类型账户登录'
)
return
return
}
}
...
@@ -39,14 +49,23 @@ const setLoginInfo = (userInfo, sessionId) => {
...
@@ -39,14 +49,23 @@ const setLoginInfo = (userInfo, sessionId) => {
/**成功跳转 */
/**成功跳转 */
const
loginSuccess
=
()
=>
{
const
loginSuccess
=
()
=>
{
const
{
const
{
options
:
{
targetPath
}
options
:
{
targetPath
}
}
=
wx
.
$router
.
getPageInstance
()
}
=
wx
.
$router
.
getPageInstance
()
if
(
targetPath
)
{
if
(
targetPath
)
{
const
{
url
,
obj
}
=
setRouteData
(
targetPath
)
const
{
url
,
obj
}
=
setRouteData
(
targetPath
)
wx
.
$router
.
reLaunch
(
url
,
obj
)
wx
.
$router
.
reLaunch
(
url
,
obj
)
}
else
wx
.
$router
.
go
(
'pages.index'
)
}
else
wx
.
$router
.
go
(
'pages.index'
)
}
}
const
loginModal
=
async
({
message
,
confirmText
,
cancelText
})
=>
{
const
loginModal
=
async
({
message
,
confirmText
,
cancelText
})
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
showModal
({
wx
.
showModal
({
content
:
message
||
'网络异常'
,
content
:
message
||
'网络异常'
,
...
@@ -60,7 +79,27 @@ const loginModal = async ({ message, confirmText, cancelText }) => {
...
@@ -60,7 +79,27 @@ const loginModal = async ({ message, confirmText, cancelText }) => {
})
})
})
})
}
}
/**手机号&微信登录:是否跳转登录列表页 */
const
checkLoginUserInfo
=
({
loginUserInfoList
,
sessionId
})
=>
{
const
thisPage
=
wx
.
$router
.
getPageInstance
()
/**多个账号 */
if
(
loginUserInfoList
.
length
>
1
)
wx
.
$router
.
go
(
'login.accountItems'
,
{
sessionId
,
...
thisPage
.
options
})
/**只有一个账号 */
else
selectAccountLogin
({
id
:
loginUserInfoList
[
0
].
uuid
,
sessionId
})
}
module
.
exports
=
{
module
.
exports
=
{
checkLoginUserInfo
,
selectAccountLogin
,
selectAccountLogin
,
loginSuccess
,
loginSuccess
,
setRouteData
,
setRouteData
,
...
...
login/loading/loading.js
View file @
4abc465
import
{
import
{
checkLoginUserInfo
,
setRouteData
,
setRouteData
,
setLoginInfo
,
setLoginInfo
,
loginModal
loginModal
...
@@ -35,7 +36,16 @@ Page({
...
@@ -35,7 +36,16 @@ Page({
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
*/
*/
onShow
()
{
onShow
()
{
this
.
init
()
const
appEnter
=
wx
.
getEnterOptionsSync
()
if
(
appEnter
.
scene
==
1037
)
{
if
(
Object
.
keys
(
appEnter
.
referrerInfo
).
length
)
{
const
{
extraData
}
=
appEnter
.
referrerInfo
if
(
extraData
&&
Object
.
keys
(
extraData
).
length
)
this
.
phoneSmsLogin
(
extraData
)
else
this
.
init
()
}
else
this
.
init
()
}
else
this
.
init
()
},
},
/**
/**
...
@@ -128,5 +138,30 @@ Page({
...
@@ -128,5 +138,30 @@ Page({
})
})
}
else
wx
.
$router
.
reLaunch
(
'login.index'
,
obj
)
}
else
wx
.
$router
.
reLaunch
(
'login.index'
,
obj
)
}
else
wx
.
$router
.
reLaunch
(
'login.index'
,
obj
)
}
else
wx
.
$router
.
reLaunch
(
'login.index'
,
obj
)
},
phoneSmsLogin
(
extraData
)
{
console
.
log
(
extraData
)
USERAPI
.
phoneSmsLogin
({
mobile
:
extraData
.
phone
,
code
:
extraData
.
smscode
}).
then
(({
code
,
data
,
message
})
=>
{
if
(
code
==
'0'
)
checkLoginUserInfo
(
data
)
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
setTimeout
(()
=>
{
wx
.
$router
.
reLaunch
(
'login.index'
)
},
1
e3
)
}
})
.
catch
(
err
=>
{
wx
.
$api
.
showToast
(
'系统异常'
)
setTimeout
(()
=>
{
wx
.
$router
.
reLaunch
(
'login.index'
)
},
1
e3
)
})
}
}
})
})
\ No newline at end of file
\ No newline at end of file
packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.js
View file @
4abc465
...
@@ -61,6 +61,14 @@ Component({
...
@@ -61,6 +61,14 @@ Component({
textBaseline
:
'top'
textBaseline
:
'top'
},
},
{
{
x
:
16
+
drawfun
.
getTextWidth
(
merchantName
,
14
),
y
:
15
,
fontSize
:
12
,
color
:
'#6E6E7A'
,
text
:
'邀请你参加'
,
textBaseline
:
'top'
},
{
x
:
12
,
x
:
12
,
y
:
36
,
y
:
36
,
fontSize
:
14
,
fontSize
:
14
,
...
@@ -71,17 +79,15 @@ Component({
...
@@ -71,17 +79,15 @@ Component({
},
},
{
{
x
:
14
+
drawfun
.
getTextWidth
(
n
.
activityName
,
14
)
+
9
,
x
:
14
+
drawfun
.
getTextWidth
(
n
.
activityName
,
14
)
+
9
,
y
:
3
7
,
y
:
3
9
,
fontSize
:
10
,
fontSize
:
10
,
color
:
'#4466F0'
,
color
:
'#4466F0'
,
text
:
'众筹'
,
text
:
'众筹'
,
textBaseline
:
'top'
,
border
:
{
border
:
{
width
:
1
,
width
:
1
,
color
:
'#
4466F0
'
,
color
:
'#
8FA5FF
'
,
radius
:
2
,
radius
:
2
,
padding
:
[
2
,
5
],
padding
:
[
5
,
5
]
opacity
:
0.5
}
}
}
}
],
],
...
@@ -89,22 +95,34 @@ Component({
...
@@ -89,22 +95,34 @@ Component({
console
.
log
(
res
)
console
.
log
(
res
)
wx
.
hideLoading
()
wx
.
hideLoading
()
this
.
setData
({
this
.
setData
({
poster
:
res
.
path
,
poster
:
res
.
path
show
:
true
})
})
},
},
download
()
{
download
()
{
const
filePath
=
this
.
data
.
poster
const
filePath
=
this
.
data
.
poster
,
_this
=
this
wx
.
saveImageToPhotosAlbum
({
wx
.
saveImageToPhotosAlbum
({
filePath
filePath
,
})
success
(){
wx
.
$api
.
showToast
(
'保存成功'
)
},
fail
(
err
)
{
const
auth
=
_this
.
selectComponent
(
'#auth'
)
auth
.
check
()
}
}
)
},
},
hide
()
{
hide
()
{
this
.
setData
({
this
.
setData
({
show
:
false
,
poster
:
''
poster
:
''
})
})
},
},
noScroll
()
{}
noScroll
()
{},
authFail
(
e
)
{
this
.
setData
({
showAuth
:
true
})
}
}
}
})
})
\ No newline at end of file
\ No newline at end of file
packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.json
View file @
4abc465
{
{
"component"
:
true
,
"component"
:
true
,
"usingComponents"
:
{}
"usingComponents"
:
{
"authorize"
:
"/components/Authorize/Authorize"
}
}
}
\ No newline at end of file
\ No newline at end of file
packageOutput/pages/summary/components/CrowdfundPoster/CrowdfundPoster.wxml
View file @
4abc465
<block wx:if="{{
show
}}">
<block wx:if="{{
poster
}}">
<view class="layout" catchtouchmove="noScroll">
<view class="layout" catchtouchmove="noScroll">
<view class="bg" bindtap="hide"></view>
<view class="bg" bindtap="hide"></view>
<image src="{{poster}}" class="poster" mode="aspectFit"></image>
<image src="{{poster}}" class="poster" mode="aspectFit"></image>
...
@@ -8,3 +8,4 @@
...
@@ -8,3 +8,4 @@
</view>
</view>
</view>
</view>
</block>
</block>
<authorize scopeType="writePhotosAlbum" bindfail="authFail" show="{{showAuth}}" id="auth"></authorize>
\ No newline at end of file
\ No newline at end of file
packageOutput/pages/summary/components/outputCrowdfund/outputCrowdfund.js
View file @
4abc465
// packageOutput/pages/summary/components/outputCrowdfund/outputCrowdfund.js
// packageOutput/pages/summary/components/outputCrowdfund/outputCrowdfund.js
import
wxqrcode
from
'~/utils/lib/wxqrcode'
import
wxqrcode
from
'~/utils/lib/wxqrcode'
import
{
IMG_URL
}
from
'~/utils/constantData'
import
{
IMG_URL
}
from
'~/utils/constantData'
import
outputApi
from
'~/api/outputApi/index'
Component
({
Component
({
/**
/**
* 组件的属性列表
* 组件的属性列表
...
@@ -133,11 +134,16 @@ Component({
...
@@ -133,11 +134,16 @@ Component({
})
})
})
})
},
},
download
(
e
){
download
(
e
)
{
const
{
item
}
=
e
.
currentTarget
.
dataset
const
{
item
}
=
e
.
currentTarget
.
dataset
wx
.
$api
.
showLoading
(
'加载中...'
)
outputApi
.
getPosterUrl
({
id
:
item
.
activityId
}).
then
(
res
=>
{
item
.
posterUrl
=
res
this
.
setData
({
this
.
setData
({
posterItem
:
item
posterItem
:
item
})
})
})
}
}
}
}
})
})
packageOutput/pages/summary/components/outputCrowdfund/outputCrowdfund.wxml
View file @
4abc465
...
@@ -69,4 +69,4 @@
...
@@ -69,4 +69,4 @@
</view>
</view>
</view>
</view>
</view>
</view>
<crowdfund-poster item="{{posterItem}}" />
\ No newline at end of file
\ No newline at end of file
<crowdfund-poster item="{{posterItem}}"/>
\ No newline at end of file
\ No newline at end of file
packageOutput/pages/summary/summary.js
View file @
4abc465
...
@@ -230,7 +230,7 @@ Page({
...
@@ -230,7 +230,7 @@ Page({
/** 查询场景4的产值 */
/** 查询场景4的产值 */
getActivityRevenue
(
isFirst
=
false
)
{
getActivityRevenue
(
isFirst
=
false
)
{
!
isFirst
&&
wx
.
showLoading
()
wx
.
showLoading
()
var
params
=
this
.
dealSearchStatus
()
var
params
=
this
.
dealSearchStatus
()
outputApi
.
getActivityRevenue
({
merchantId
:
this
.
data
.
merchantInfo
.
merchantId
,
...
params
}).
then
(
res
=>
{
outputApi
.
getActivityRevenue
({
merchantId
:
this
.
data
.
merchantInfo
.
merchantId
,
...
params
}).
then
(
res
=>
{
// console.log(res)
// console.log(res)
...
...
pages/checkProduct/checkProduct.js
View file @
4abc465
...
@@ -241,16 +241,23 @@ Page({
...
@@ -241,16 +241,23 @@ Page({
// 微信转发
// 微信转发
wechatFn() {
wechatFn() {
// this.data.onShareAppMessage()
// this.data.onShareAppMessage()
<<<<<<< HEAD
this.modelcloseFn()
this.modelcloseFn()
=======
// this.modelcloseFn();
>>>>>>> b8cea7213c09e98ec5040478dc687f2a6c410f9f
},
},
// 下载海报
// 下载海报
async download() {
async download() {
let { actNum, activeNavIdx, imgHeightArr, imgPath } = this.data
let { actNum, activeNavIdx, imgHeightArr, imgPath } = this.data
const { appId } = wx.getAccountInfoSync().miniProgram
const { appId } = wx.getAccountInfoSync().miniProgram
let { userInfo } = wx.$storage.get()
let { userInfo } = wx.$storage.get(),
wx_user_info = wx.$storage.get('wx_user_info'),
senceItem = senceData[actNum], item = senceData[actNum]?.productList[activeNavIdx];
// let wx_user_info = wx.$storage.get("wx_user_info");
// let wx_user_info = wx.$storage.get("wx_user_info");
// console.log('wx_user_info: ', wx_user_info.appId);
// console.log('wx_user_info: ', wx_user_info.appId);
wx.showLoading({
wx.showLoading({
<<<<<<< HEAD
title: '海报生成中...'
title: '海报生成中...'
})
})
let params = {
let params = {
...
@@ -259,6 +266,23 @@ Page({
...
@@ -259,6 +266,23 @@ Page({
isShare: true
isShare: true
}
}
=======
title: "海报生成中...",
});
console.log(wx_user_info)
let params = {
actNum,
activeNavIdx,
isShare: true,
merchantId:userInfo.merchantId || '',
shareOpenId: wx_user_info.openId || '',
sharePhone: userInfo.phone || '',
sceneCode: senceItem?.sceneCode || '',
productCode: item?.productCode || '',
productDesc: item?.productName || '',
category: item?.category || ''
};
>>>>>>> b8cea7213c09e98ec5040478dc687f2a6c410f9f
// console.log(' wx_user_info.appId', wx_user_info)
// console.log(' wx_user_info.appId', wx_user_info)
let res = await createQrCodeApi({
let res = await createQrCodeApi({
appId: appId,
appId: appId,
...
@@ -407,6 +431,12 @@ Page({
...
@@ -407,6 +431,12 @@ Page({
})
})
let
ercodeParams
=
await
this
.
analysisQRcode
(
options
.
scene
)
let
ercodeParams
=
await
this
.
analysisQRcode
(
options
.
scene
)
options
=
JSON
.
parse
(
ercodeParams
.
scene
)
options
=
JSON
.
parse
(
ercodeParams
.
scene
)
<<<<<<<
HEAD
=======
this
.
options
=
options
console
.
log
(
'===================='
,
this
.
options
)
this
.
onLoad
(
null
)
>>>>>>>
b8cea7213c09e98ec5040478dc687f2a6c410f9f
}
}
let
{
senceData
}
=
this
.
data
let
{
senceData
}
=
this
.
data
// 扫码进来
// 扫码进来
...
...
pages/tab/index/components/product/product.wxml
View file @
4abc465
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
<!-- wx:if="{{isShare && actNum != 2 && index == 4}}" -->
<!-- wx:if="{{isShare && actNum != 2 && index == 4}}" -->
<!-- wx:if="{{ isShare && actNum != 2 && index == 4}}" -->
<!-- wx:if="{{ isShare && actNum != 2 && index == 4}}" -->
<button
<button
wx:if="{{ isShare && isAuthphone && !getMoreBtn &&
actNum != 2 &&
index == 4}}"
wx:if="{{ isShare && isAuthphone && !getMoreBtn && index == 4}}"
class="more-btn"
class="more-btn"
data-index="{{index}}"
data-index="{{index}}"
bindgetphonenumber="getUserInfo"
bindgetphonenumber="getUserInfo"
...
...
utils/Draw.js
View file @
4abc465
...
@@ -140,18 +140,10 @@ class Draw {
...
@@ -140,18 +140,10 @@ class Draw {
this
[
_ctx_
].
globalAlpha
=
opacity
this
[
_ctx_
].
globalAlpha
=
opacity
this
[
_ctx_
].
font
=
`
${
fontWeight
||
400
}
${
fontSize
}
px
${
font
}
`
this
[
_ctx_
].
font
=
`
${
fontWeight
||
400
}
${
fontSize
}
px
${
font
}
`
this
[
_ctx_
].
fillStyle
=
color
||
'#000'
this
[
_ctx_
].
fillStyle
=
color
||
'#000'
this
[
_ctx_
].
strokeStyle
=
color
||
'#000'
this
[
_ctx_
].
textBaseline
=
textBaseline
this
[
_ctx_
].
textBaseline
=
textBaseline
this
[
_ctx_
].
textAlign
=
textAlign
this
[
_ctx_
].
textAlign
=
textAlign
this
[
_ctx_
].
lineWidth
=
this
.
toRpx
(
2
)
this
[
_ctx_
].
lineWidth
=
this
.
toRpx
(
2
)
let
text_width
=
this
.
getTextWidth
(
text
)
let
text_width
=
this
.
getTextWidth
(
text
)
if
(
textParams
.
border
)
this
.
drawBorder
({
text
,
x
:
textParams
.
x
,
y
:
textParams
.
y
,
fontSize
:
textParams
.
fontSize
||
12
,
...
textParams
.
border
})
const
drawOneLineText
=
()
=>
{
const
drawOneLineText
=
()
=>
{
let
textArr
=
text
.
toString
().
split
(
''
),
let
textArr
=
text
.
toString
().
split
(
''
),
newText
=
''
,
newText
=
''
,
...
@@ -230,6 +222,14 @@ class Draw {
...
@@ -230,6 +222,14 @@ class Draw {
drawOneLineText
()
drawOneLineText
()
}
}
}
else
drawOneLineText
()
}
else
drawOneLineText
()
if
(
textParams
.
border
)
this
.
drawBorder
({
text
,
x
:
textParams
.
x
,
y
:
textParams
.
y
,
fontSize
:
textParams
.
fontSize
||
12
,
...
textParams
.
border
})
this
[
_ctx_
].
stroke
()
this
[
_ctx_
].
stroke
()
}
}
drawBorder
(
params
)
{
drawBorder
(
params
)
{
...
@@ -243,18 +243,91 @@ class Draw {
...
@@ -243,18 +243,91 @@ class Draw {
opacity
,
opacity
,
padding
,
padding
,
fontSize
fontSize
}
=
params
}
=
params
,
console
.
log
(
params
)
paddingX
=
0
,
let
topX
,
topY
,
rightX
,
rightY
,
bottomX
,
bottomY
,
leftX
,
leftY
,
paddingX
,
paddingY
paddingY
=
0
// if(padding && padding.length>1)
if
(
padding
&&
padding
.
length
)
{
paddingX
=
this
.
toRpx
(
padding
[
0
])
paddingY
=
this
.
toRpx
(
padding
[
0
])
if
(
padding
.
length
>
1
)
paddingX
=
this
.
toRpx
(
padding
[
1
])
}
let
startX
=
this
.
toRpx
(
x
)
-
paddingX
,
endX
=
this
.
toRpx
(
x
)
+
this
.
getTextWidth
(
text
)
+
paddingX
,
startY
=
this
.
toRpx
(
y
)
-
paddingY
,
endY
=
this
.
toRpx
(
y
+
fontSize
)
+
paddingY
/
2
,
arr
=
[{
x
:
startX
,
y
:
startY
,
width
:
endX
},
{
x
:
endX
,
y
:
startY
,
height
:
endY
},
{
x
:
startX
,
y
:
endY
,
width
:
endX
},
{
x
:
startX
,
y
:
startY
,
height
:
endY
}
]
console
.
log
(
this
.
toRpx
(
y
)
,
paddingY
)
this
[
_ctx_
].
beginPath
()
this
[
_ctx_
].
globalAlpha
=
typeof
opacity
===
'number'
?
opacity
:
1
this
[
_ctx_
].
lineWidth
=
width
||
this
.
toRpx
(
1
)
if
(
radius
)
{
if
(
radius
)
{
radius
=
this
.
toRpx
(
radius
)
let
arcArr
=
[{
moveTo
:
[
startX
,
startY
+
radius
],
arcTo
:
[
startX
,
startY
,
startX
+
radius
,
startY
],
},
{
moveTo
:
[
endX
-
radius
,
startY
],
arcTo
:
[
endX
,
startY
,
endX
,
startY
+
radius
],
},
{
moveTo
:
[
startX
,
endY
-
radius
],
arcTo
:
[
startX
,
endY
,
startX
+
radius
,
endY
],
},
{
moveTo
:
[
endX
,
endY
-
radius
],
arcTo
:
[
endX
,
endY
,
endX
-
radius
,
endY
],
}
]
arr
.
map
((
e
,
index
)
=>
{
if
(
index
==
0
||
index
==
2
)
{
e
.
x
+=
radius
e
.
width
-=
radius
}
else
{
e
.
y
+=
radius
e
.
height
-=
radius
}
}
})
arcArr
.
map
((
e
,
index
)
=>
{
this
[
_ctx_
].
moveTo
(...
e
.
moveTo
)
this
[
_ctx_
].
arcTo
(...
e
.
arcTo
,
radius
)
this
[
_ctx_
].
stroke
()
this
[
_ctx_
].
restore
()
this
[
_ctx_
].
save
()
})
}
arr
.
map
((
e
,
index
)
=>
{
this
[
_ctx_
].
moveTo
(
e
.
x
,
e
.
y
)
this
[
_ctx_
].
lineTo
(
e
.
width
?
e
.
width
:
e
.
x
,
e
.
height
?
e
.
height
:
e
.
y
)
this
[
_ctx_
].
stroke
()
this
[
_ctx_
].
restore
()
this
[
_ctx_
].
strokeStyle
=
color
||
'#000'
this
[
_ctx_
].
save
()
})
}
}
drawLine
(
lineParams
,
callback
)
{
drawLine
(
lineParams
,
callback
)
{
this
[
_ctx_
].
beginPath
()
this
[
_ctx_
].
beginPath
()
let
{
let
{
noTransition
,
opacity
,
opacity
,
startX
,
startX
,
startY
,
startY
,
...
@@ -263,18 +336,20 @@ class Draw {
...
@@ -263,18 +336,20 @@ class Draw {
endX
,
endX
,
endY
endY
}
=
lineParams
}
=
lineParams
if
(
!
noTransition
)
{
startX
=
this
.
toRpx
(
startX
)
startX
=
this
.
toRpx
(
startX
)
startY
=
this
.
toRpx
(
startY
)
startY
=
this
.
toRpx
(
startY
)
width
=
this
.
toRpx
(
width
)
width
=
this
.
toRpx
(
width
)
endX
=
this
.
toRpx
(
endX
)
endX
=
this
.
toRpx
(
endX
)
endY
=
this
.
toRpx
(
endY
)
endY
=
this
.
toRpx
(
endY
)
}
this
[
_ctx_
].
globalAlpha
=
typeof
opacity
===
'number'
?
opacity
:
1
this
[
_ctx_
].
globalAlpha
=
typeof
opacity
===
'number'
?
opacity
:
1
this
[
_ctx_
].
strokeStyle
=
color
||
'#000'
this
[
_ctx_
].
lineWidth
=
width
||
this
.
toRpx
(
1
)
this
[
_ctx_
].
lineWidth
=
width
||
this
.
toRpx
(
1
)
this
[
_ctx_
].
moveTo
(
startX
,
startY
)
this
[
_ctx_
].
moveTo
(
startX
,
startY
)
this
[
_ctx_
].
lineTo
(
endX
,
endY
)
this
[
_ctx_
].
lineTo
(
endX
,
endY
)
this
[
_ctx_
].
stroke
()
this
[
_ctx_
].
stroke
()
this
[
_ctx_
].
restore
()
this
[
_ctx_
].
restore
()
this
[
_ctx_
].
strokeStyle
=
color
||
'#000'
this
[
_ctx_
].
save
()
this
[
_ctx_
].
save
()
if
(
callback
)
callback
()
if
(
callback
)
callback
()
}
}
...
@@ -412,7 +487,7 @@ class Draw {
...
@@ -412,7 +487,7 @@ class Draw {
if
(
index
==
data
.
imageList
.
length
-
1
)
drawFun
()
if
(
index
==
data
.
imageList
.
length
-
1
)
drawFun
()
}
}
else
drawFun
()
else
drawFun
()
}
}
else
drawFun
()
})
})
}
}
}
}
...
...
utils/share.js
View file @
4abc465
...
@@ -116,7 +116,7 @@ class Share {
...
@@ -116,7 +116,7 @@ class Share {
USERINFO
USERINFO
}
=
this
.
getCommonData
(),
}
=
this
.
getCommonData
(),
thisPage
=
wx
.
$router
.
getPageInstance
().
options
thisPage
=
wx
.
$router
.
getPageInstance
().
options
query
=
`
${
query
?
`?
${
query
}
&`
:
'?'
}
merchantId=
${
thisPage
.
merchantId
||
USERINFO
.
merchantId
||
''
}
&shareOpenId=
${
thisPage
.
shareOpenId
||
WXUSERINFO
.
openId
||
''
}
&sharePhone=
${
thisPage
.
sharePhone
||
USERINFO
.
phone
||
''
}
`
query
=
`
${
query
?
`?
${
query
}
&`
:
'?'
}
merchantId=
${
thisPage
.
merchantId
||
USERINFO
.
merchantId
||
''
}
&shareOpenId=
${
thisPage
.
shareOpenId
||
WXUSERINFO
.
openId
||
''
}
&sharePhone=
${
thisPage
.
sharePhone
||
USERINFO
.
phone
||
''
}
`
return
query
return
query
}
}
reportShareData
(
shareTrackData
)
{
reportShareData
(
shareTrackData
)
{
...
...
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