Commit 617151dd by 张立顺

Merge branch 'v3.0' of http://192.168.3.233:8090/saas_plus/store-assistant into v3.0

2 parents e4853821 5bf63052
......@@ -80,6 +80,13 @@ class ActivityApi {
...data
})
}
// 获取活动短链接
getActivityUrl(data) {
return api.post({
method: `scrm.api.assistant.activity.poster`,
...data
})
}
}
export default ActivityApi
\ No newline at end of file
// components/sharePopup/sharePopup.js
import {imgUrlMixin} from '~/mixins/index'
import index_const from "~/pages/tab/index/index_const"
import { IMG_URL } from '~/utils/constantData'
import Draw from '~/utils/Draw'
Component({
/**
......@@ -12,21 +11,28 @@ Component({
data: {
type: Object,
observer(val) {
let _this = this
let thisPage = wx.$router.getPageInstance()
this.setData({
_this.setData({
navHeight: thisPage.data.navHeight
})
if (val.showSharePopup) {
val.boxImageHeight = 66
// 计算弹窗图片区域最大高度
wx.$util.getViewInfo('.layout', res => {
this.setData({
_this.setData({
postersBoxHeight: res.height * 0.7,
postersImageHeight: (res.height / res.width ) * 247
})
val.postersBoxHeight = res.height * 0.7,
val.postersImageHeight = (res.height / res.width ) * 247
this.init(val)
})
wx.getImageInfo({
src: val.posterImg,
success(e) {
_this.setData({
postersImageHeight: (e.height / e.width ) * 247
})
val.postersImageHeight = (e.height / e.width ) * 247
_this.init(val)
}
})
})
}
......@@ -39,18 +45,24 @@ Component({
*/
data: {
USERINFO: wx.$storage.get('userInfo'),
activityTypList: index_const.data.activityTypList
activityTypList: index_const.data.activityTypList,
imageLoaded: false
},
/**
* 组件的方法列表
*/
methods: {
imageLoaded(event) {
if (event.detail.width) {
this.setData({imageLoaded: true})
}
},
async init(n) {
wx.$api.showLoading()
const drawfun = new Draw({
width: 280,
height: n.postersImageHeight + 80,
width: 279,
height: n.postersImageHeight + 76,
borderRadius: 8
}, this),
{
......@@ -70,8 +82,8 @@ Component({
width: 20,
height: 20,
borderRadius: 40,
// url: `${userInfo.sta_avatarUrl && userInfo.sta_avatarUrl.indexOf('https://thirdwx.qlogo.cn') > -1 ? userInfo.sta_avatarUrl : userInfo.weChatAvatarUrl && userInfo.weChatAvatarUrl.indexOf('https://thirdwx.qlogo.cn') > -1 ? userInfo.weChatAvatarUrl : this.data.IMGURL}default_avatar.png`
url: `${this.data.IMGURL}default_avatar.png`
url: userInfo.sta_avatarUrl && userInfo.sta_avatarUrl.indexOf('https://thirdwx.qlogo.cn') > -1 ? userInfo.sta_avatarUrl : userInfo.weChatAvatarUrl && userInfo.weChatAvatarUrl.indexOf('https://thirdwx.qlogo.cn') > -1 ? userInfo.weChatAvatarUrl : `${this.data.IMGURL}default_avatar.png`
// url: `${this.data.IMGURL}default_avatar.png`
},
{
x: 16,
......@@ -120,7 +132,8 @@ Component({
}
},
],
})
})
console.log(res)
wx.hideLoading()
this.setData({
poster: res.path
......@@ -128,6 +141,10 @@ Component({
},
close() {
let thisPage = wx.$router.getPageInstance()
this.setData({
imageLoaded: false,
poster: ""
})
thisPage.setData({
sharePopupData: {
showSharePopup: false
......
<!--components/sharePopup/sharePopup.wxml-->
<view class="share-popup" wx:if="{{data.showSharePopup}}">
<view class="share-popup-bg" />
<wxs module="fn">
var time = function(e, num) {
return getDate().getTime()
}
module.exports.time = time
</wxs>
<view class="share-popup" wx:if="{{poster}}">
<view class="share-popup-bg" wx:if="{{imageLoaded}}"/>
<view class="share-box" style="transform: translate(-50%, calc(-50% + {{navHeight / 2}}px));">
<view class="close-box">
<view class="close-box" wx:if="{{imageLoaded}}">
<view class="close_btn" bindtap="close">
<image webp src="{{IMGURL}}popup_close_btn.png"></image>
</view>
</view>
<view class="share-popup-content" style="max-height: {{postersBoxHeight}}px;">
<image style="height: {{postersImageHeight + 80}}px;" mode="widthFix" src="{{poster}}"></image>
<image style="height: {{postersImageHeight + 76}}px;" src="{{poster}}" bindload="imageLoaded"></image>
</view>
<view class="btn-box">
<view class="btn-box" wx:if="{{imageLoaded}}">
<view class="btn" bind:tap="saveImage">保存至相册</view>
<view class="tip">提示:这是您的专属活动海报,请保存至手机相册后转发给客户微信,系统将自动记录成交订单归属,并发放积分奖励!</view>
</view>
......
......@@ -77,7 +77,15 @@ Page({
})
}
if (val.materialType == 4) { // 链接
res.linkUrl = this.filterJumpUrl(res.activityId)
// res.linkUrl = this.filterJumpUrl(res.activityId)
// 获取活动专属短链接
ActivityApi.getActivityUrl({activityId: res.activityId}).then(e => {
res.linkUrl = e.activityUrl
this.setData({
detailInfo: res,
materialTypeArr: typeArr
})
})
}
})
this.setData({
......@@ -147,12 +155,12 @@ Page({
}
},
// 复制文案
// 复制文案及专属链接
copyText() {
return new Promise((resolve, reject) => {
let { textContent } = this.data.detailInfo
let { textContent, linkUrl } = this.data.detailInfo
wx.setClipboardData({
data: textContent,
data: linkUrl ? `${textContent}\n活动链接:${linkUrl}` : textContent,
success () {
wx.hideLoading()
resolve()
......
......@@ -449,7 +449,7 @@ class Draw {
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 filePath = `${wx.env.USER_DATA_PATH}/tmp_base64src${new Date().getTime()}.${format}`
const buffer = wx.base64ToArrayBuffer(bodyData)
wx.getFileSystemManager().writeFile({
filePath,
......
const target = ['ip', 'dev', 'uat', 'prod']
/**
*
0本地
......@@ -16,6 +17,7 @@ const secretKey = {
}
},
uat: {
sso: {
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
......@@ -66,6 +68,7 @@ const defaultMerchantId = {
ip: '44184606',
dev: '44184606',
uat: '44184606',
prod: '44189923'
}[target[index]]
module.exports = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!