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