Commit 4abc465f by 张立顺

bugfix

2 parents 728c8a60 b8cea721
......@@ -76,5 +76,13 @@ class outputApi {
...data
})
}
/** 店面汇总-下载海报 */
getPosterUrl(data) {
return api.post({
method: 'scrm.api.busassistant.crowdFunding.poster',
...data
})
}
}
export default outputApi
......@@ -52,7 +52,7 @@ Component({
/**
* 禁止滑动
*/
noScroll: wx.$util.noScroll(),
noScroll(){},
cancel(e) {
let { confirm } = e.currentTarget.dataset
let { buttonType, title } = this.data
......
// login/index/components/LoginBox.js
import USERAPI from '~/api/usersApi/index'
import {
selectAccountLogin,
checkLoginUserInfo,
setLoginInfo,
loginModal
} from '~/login/lib/index'
......@@ -176,7 +176,7 @@ Component({
}) => {
this.setBtnLoading(false)
if (code == '0') {
if (loginType == 1) this.checkLoginUserInfo(data)
if (loginType == 1) checkLoginUserInfo(data)
else {
const {
autoLogin
......@@ -220,7 +220,7 @@ Component({
data,
message
}) => {
if (code == '0') this.checkLoginUserInfo(data)
if (code == '0') checkLoginUserInfo(data)
else {
wx.$api.showToast(message || '系统异常')
this.init()
......@@ -235,24 +235,6 @@ Component({
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状态 */
setBtnLoading(loading = true) {
thisPage.setData({
......
import { setSessionId, setUserInfo } from '~/utils/cache/storageApi'
import {
setSessionId,
setUserInfo
} from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index'
const setRouteData = targetPath => {
let [url, query] = targetPath.split('?'),
......@@ -15,11 +18,18 @@ const setRouteData = targetPath => {
}
}
/**选择账号登录 */
const selectAccountLogin = ({ id, sessionId }) => {
const selectAccountLogin = ({
id,
sessionId
}) => {
USERAPI.selectAccountLogin({
id,
sessionId
}).then(({ code, data, message }) => {
}).then(({
code,
data,
message
}) => {
if (code == '0') {
console.log(data)
setLoginInfo(data.loginUserInfoList[0], data.sessionId)
......@@ -28,7 +38,7 @@ const selectAccountLogin = ({ id, sessionId }) => {
}
/**设置登录信息 */
const setLoginInfo = (userInfo, sessionId) => {
if(!userInfo) {
if (!userInfo) {
wx.$api.showToast('仅支持服务商类型账户登录')
return
}
......@@ -39,14 +49,23 @@ const setLoginInfo = (userInfo, sessionId) => {
/**成功跳转 */
const loginSuccess = () => {
const {
options: { targetPath }
options: {
targetPath
}
} = wx.$router.getPageInstance()
if (targetPath) {
const { url, obj } = setRouteData(targetPath)
const {
url,
obj
} = setRouteData(targetPath)
wx.$router.reLaunch(url, obj)
} else wx.$router.go('pages.index')
}
const loginModal = async ({ message, confirmText, cancelText }) => {
const loginModal = async ({
message,
confirmText,
cancelText
}) => {
return new Promise((resolve, reject) => {
wx.showModal({
content: message || '网络异常',
......@@ -60,10 +79,30 @@ 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 = {
checkLoginUserInfo,
selectAccountLogin,
loginSuccess,
setRouteData,
setLoginInfo,
loginModal
}
}
\ No newline at end of file
import {
checkLoginUserInfo,
setRouteData,
setLoginInfo,
loginModal
......@@ -35,7 +36,16 @@ Page({
* 生命周期函数--监听页面显示
*/
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()
},
/**
......@@ -68,10 +78,10 @@ Page({
init() {
wx.nextTick(() => {
const sessionId = getSessionId(),
{
url,
targetPath = url ? decodeURIComponent(url) : ''
} = this.options
{
url,
targetPath = url ? decodeURIComponent(url) : ''
} = this.options
let path = 'pages.index',
obj = {}
if (targetPath) obj.targetPath = targetPath
......@@ -128,5 +138,30 @@ Page({
})
} 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')
}, 1e3)
}
})
.catch(err => {
wx.$api.showToast('系统异常')
setTimeout(() => {
wx.$router.reLaunch('login.index')
}, 1e3)
})
}
})
\ No newline at end of file
......@@ -61,6 +61,14 @@ Component({
textBaseline: 'top'
},
{
x: 16 + drawfun.getTextWidth(merchantName, 14),
y: 15,
fontSize: 12,
color: '#6E6E7A',
text: '邀请你参加',
textBaseline: 'top'
},
{
x: 12,
y: 36,
fontSize: 14,
......@@ -71,17 +79,15 @@ Component({
},
{
x: 14 + drawfun.getTextWidth(n.activityName, 14) + 9,
y: 37,
y: 39,
fontSize: 10,
color: '#4466F0',
text: '众筹',
textBaseline: 'top',
border: {
width: 1,
color: '#4466F0',
color: '#8FA5FF',
radius: 2,
padding: [2, 5],
opacity: 0.5
padding: [5, 5]
}
}
],
......@@ -89,22 +95,34 @@ Component({
console.log(res)
wx.hideLoading()
this.setData({
poster: res.path,
show: true
poster: res.path
})
},
download() {
const filePath = this.data.poster
const filePath = this.data.poster,
_this = this
wx.saveImageToPhotosAlbum({
filePath
})
filePath,
success(){
wx.$api.showToast('保存成功')
},
fail(err) {
const auth = _this.selectComponent('#auth')
auth.check()
}
}
)
},
hide() {
this.setData({
show: false,
poster: ''
})
},
noScroll() {}
noScroll() {},
authFail(e) {
this.setData({
showAuth: true
})
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
"usingComponents": {
"authorize":"/components/Authorize/Authorize"
}
}
\ No newline at end of file
<block wx:if="{{show}}">
<block wx:if="{{poster}}">
<view class="layout" catchtouchmove="noScroll">
<view class="bg" bindtap="hide"></view>
<image src="{{poster}}" class="poster" mode="aspectFit"></image>
......@@ -7,4 +7,5 @@
提示:这是您的专属活动海报,请下载转发给门店员工注册并参与活动分享。请不要将此海报转发给非相关活动参与者,避免活动数据泄漏。
</view>
</view>
</block>
\ No newline at end of file
</block>
<authorize scopeType="writePhotosAlbum" bindfail="authFail" show="{{showAuth}}" id="auth"></authorize>
\ No newline at end of file
// packageOutput/pages/summary/components/outputCrowdfund/outputCrowdfund.js
import wxqrcode from '~/utils/lib/wxqrcode'
import { IMG_URL } from '~/utils/constantData'
import outputApi from '~/api/outputApi/index'
Component({
/**
* 组件的属性列表
......@@ -133,11 +134,16 @@ Component({
})
})
},
download(e){
const {item} = e.currentTarget.dataset
this.setData({
posterItem: item
download(e) {
const { item } = e.currentTarget.dataset
wx.$api.showLoading('加载中...')
outputApi.getPosterUrl({ id: item.activityId }).then(res => {
item.posterUrl = res
this.setData({
posterItem: item
})
})
}
}
})
......@@ -69,4 +69,4 @@
</view>
</view>
</view>
<crowdfund-poster item="{{posterItem}}" />
\ No newline at end of file
<crowdfund-poster item="{{posterItem}}"/>
\ No newline at end of file
......@@ -230,7 +230,7 @@ Page({
/** 查询场景4的产值 */
getActivityRevenue(isFirst = false) {
!isFirst && wx.showLoading()
wx.showLoading()
var params = this.dealSearchStatus()
outputApi.getActivityRevenue({ merchantId: this.data.merchantInfo.merchantId, ...params }).then(res => {
// console.log(res)
......
......@@ -241,16 +241,23 @@ Page({
// 微信转发
wechatFn() {
// this.data.onShareAppMessage()
<<<<<<< HEAD
this.modelcloseFn()
=======
// this.modelcloseFn();
>>>>>>> b8cea7213c09e98ec5040478dc687f2a6c410f9f
},
// 下载海报
async download() {
let { actNum, activeNavIdx, imgHeightArr, imgPath } = this.data
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");
// console.log('wx_user_info: ', wx_user_info.appId);
wx.showLoading({
<<<<<<< HEAD
title: '海报生成中...'
})
let params = {
......@@ -259,6 +266,23 @@ Page({
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)
let res = await createQrCodeApi({
appId: appId,
......@@ -407,6 +431,12 @@ Page({
})
let ercodeParams = await this.analysisQRcode(options.scene)
options = JSON.parse(ercodeParams.scene)
<<<<<<< HEAD
=======
this.options = options
console.log('====================',this.options)
this.onLoad(null)
>>>>>>> b8cea7213c09e98ec5040478dc687f2a6c410f9f
}
let { senceData } = this.data
// 扫码进来
......
......@@ -66,7 +66,7 @@
<!-- wx:if="{{isShare && actNum != 2 && index == 4}}" -->
<!-- wx:if="{{ isShare && actNum != 2 && index == 4}}" -->
<button
wx:if="{{ isShare && isAuthphone && !getMoreBtn && actNum != 2 && index == 4}}"
wx:if="{{ isShare && isAuthphone && !getMoreBtn && index == 4}}"
class="more-btn"
data-index="{{index}}"
bindgetphonenumber="getUserInfo"
......
......@@ -140,18 +140,10 @@ class Draw {
this[_ctx_].globalAlpha = opacity
this[_ctx_].font = `${fontWeight || 400} ${fontSize}px${font}`
this[_ctx_].fillStyle = color || '#000'
this[_ctx_].strokeStyle = color || '#000'
this[_ctx_].textBaseline = textBaseline
this[_ctx_].textAlign = textAlign
this[_ctx_].lineWidth = this.toRpx(2)
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 = () => {
let textArr = text.toString().split(''),
newText = '',
......@@ -230,6 +222,14 @@ class Draw {
drawOneLineText()
}
} else drawOneLineText()
if (textParams.border) this.drawBorder({
text,
x: textParams.x,
y: textParams.y,
fontSize: textParams.fontSize || 12,
...textParams.border
})
this[_ctx_].stroke()
}
drawBorder(params) {
......@@ -243,18 +243,91 @@ class Draw {
opacity,
padding,
fontSize
} = params
console.log(params)
let topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY, paddingX, paddingY
// if(padding && padding.length>1)
} = params,
paddingX = 0,
paddingY = 0
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) {
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) {
this[_ctx_].beginPath()
let {
noTransition,
opacity,
startX,
startY,
......@@ -263,18 +336,20 @@ class Draw {
endX,
endY
} = lineParams
startX = this.toRpx(startX)
startY = this.toRpx(startY)
width = this.toRpx(width)
endX = this.toRpx(endX)
endY = this.toRpx(endY)
if (!noTransition) {
startX = this.toRpx(startX)
startY = this.toRpx(startY)
width = this.toRpx(width)
endX = this.toRpx(endX)
endY = this.toRpx(endY)
}
this[_ctx_].globalAlpha = typeof opacity === 'number' ? opacity : 1
this[_ctx_].strokeStyle = color || '#000'
this[_ctx_].lineWidth = width || this.toRpx(1)
this[_ctx_].moveTo(startX, startY)
this[_ctx_].lineTo(endX, endY)
this[_ctx_].stroke()
this[_ctx_].restore()
this[_ctx_].strokeStyle = color || '#000'
this[_ctx_].save()
if (callback) callback()
}
......@@ -412,7 +487,7 @@ class Draw {
if (index == data.imageList.length - 1) drawFun()
}
else drawFun()
}
} else drawFun()
})
}
}
......
......@@ -116,7 +116,7 @@ class Share {
USERINFO
} = this.getCommonData(),
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
}
reportShareData(shareTrackData) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!