Commit 99e908be by 张立顺

第一轮bug修复

1 parent 893fdbca
...@@ -9,13 +9,16 @@ Component({ ...@@ -9,13 +9,16 @@ Component({
item: { item: {
type: Object, type: Object,
observer(n) { observer(n) {
this.check(n).then(res => { this.check(n)
if (res) this.setData({ .then(res => {
if (res)
this.setData({
poster: res, poster: res,
show: true show: true
}) })
else this.begin() else this.begin()
}).catch(() => this.begin()) })
.catch(() => this.begin())
} }
}, },
findKey: { findKey: {
...@@ -40,9 +43,7 @@ Component({ ...@@ -40,9 +43,7 @@ Component({
*/ */
methods: { methods: {
begin() { begin() {
let { let { item } = this.data
item
} = this.data
item.posterUrl && this.getImageInfo(item) item.posterUrl && this.getImageInfo(item)
}, },
check(n) { check(n) {
...@@ -51,16 +52,12 @@ Component({ ...@@ -51,16 +52,12 @@ Component({
}) })
const fileList = wx.$storage.get('fileList') || [], const fileList = wx.$storage.get('fileList') || [],
fn = wx.getFileSystemManager(), fn = wx.getFileSystemManager(),
{ { findKey } = this.data
findKey
} = this.data
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (fileList.length) { if (fileList.length) {
fn.readdir({ fn.readdir({
dirPath: wx.env.USER_DATA_PATH, dirPath: wx.env.USER_DATA_PATH,
success({ success({ files }) {
files
}) {
console.log(files, '文件列表') console.log(files, '文件列表')
if (files.length < 21) { if (files.length < 21) {
let item = fileList.find(e => e[findKey] === n[findKey]) let item = fileList.find(e => e[findKey] === n[findKey])
...@@ -84,7 +81,8 @@ Component({ ...@@ -84,7 +81,8 @@ Component({
} else reject() } else reject()
}) })
}, },
getImageInfo(n, width, height) { getImageInfo(n) {
console.log(n)
wx.$api.showLoading('处理中') wx.$api.showLoading('处理中')
let that = this let that = this
wx.getImageInfo({ wx.getImageInfo({
...@@ -102,26 +100,37 @@ Component({ ...@@ -102,26 +100,37 @@ Component({
}) })
}, },
async init(n, ImgWidth, ImgHeight) { async init(n, ImgWidth, ImgHeight) {
let proportion = ImgWidth / 247 // debugger
let actualHeight = ImgHeight / proportion // const {pixelRatio} = wx.getWindowInfo()
console.log(actualHeight) let actualWidth = 247 //默认宽度
let canvasHeight = 1959 //最大高度
let proportion = ImgWidth / actualWidth //图片实例化对应的比例
let actualHeight = ImgHeight / proportion //实际高度
// 解决 createOffscreenCanvas 最大高度不能超过4096的问题
// 这个 pixelRatio 不写是默认两倍 需转换计算
if (actualHeight > canvasHeight) {
actualWidth = actualWidth / (actualHeight / canvasHeight)
actualHeight = canvasHeight
}
// console.log(actualHeight)
n.activityName = n.activityName.length > 12 ? `${n.activityName.substring(0, 12)}...` : n.activityName n.activityName = n.activityName.length > 12 ? `${n.activityName.substring(0, 12)}...` : n.activityName
const drawfun = new Draw({ const drawfun = new Draw( // 大画布
width: 279, {
// height: 554 // height: 554
height: 82 + actualHeight width: actualWidth + 32,
height: actualHeight + 82
// pixelRatio
}, },
this this
), ),
{ { userInfo } = wx.$storage.get(),
userInfo
} = wx.$storage.get(),
merchantName = userInfo.merchantName.length > 12 ? `${userInfo.merchantName.substring(0, 12)}...` : userInfo.merchantName, merchantName = userInfo.merchantName.length > 12 ? `${userInfo.merchantName.substring(0, 12)}...` : userInfo.merchantName,
{ findKey } = this.data
let imageList = [
{ {
findKey
} = this.data,
res = await drawfun.begin({
imageList: [{
x: 0, x: 0,
y: 0, y: 0,
width: 279, width: 279,
...@@ -131,12 +140,13 @@ Component({ ...@@ -131,12 +140,13 @@ Component({
{ {
x: 16, x: 16,
y: 70, y: 70,
width: 247, width: actualWidth,
height: actualHeight, height: actualHeight,
url: n.posterUrl url: n.posterUrl
} }
], ]
textList: [{ let textList = [
{
x: 12, x: 12,
y: 14, y: 14,
fontSize: 14, fontSize: 14,
...@@ -169,6 +179,21 @@ Component({ ...@@ -169,6 +179,21 @@ Component({
} }
} }
] ]
if ((n.type = 'warReport')) {
imageList = [
{
x: 0,
y: 0,
width: actualWidth + 32,
height: actualHeight + 82,
url: n.posterUrl
}
]
textList = []
}
let res = await drawfun.begin({
imageList,
textList
}) })
console.log(res) console.log(res)
wx.hideLoading() wx.hideLoading()
...@@ -211,9 +236,7 @@ Component({ ...@@ -211,9 +236,7 @@ Component({
}) })
}, },
longpress() { longpress() {
let { let { _item_ } = this.data
_item_
} = this.data
this.triggerEvent('longtouch', _item_) this.triggerEvent('longtouch', _item_)
} }
} }
......
...@@ -18,17 +18,23 @@ ...@@ -18,17 +18,23 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: -1; z-index: -1;
background: rgba(0,0,0,.8); background: rgba(0, 0, 0, .8);
} }
.poster { .poster {
box-sizing: border-box;
width: 500rpx; width: 500rpx;
height: 68%; height: 68%;
// height: 1108rpx; // height: 1108rpx;
overflow: scroll; overflow: scroll;
border-radius: 8rpx 8rpx 0 0; border-radius: 8rpx 8rpx 0 0;
}
.pd {
padding: 32rpx;
background-color: #fff;
} }
.btn { .btn {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -41,6 +47,7 @@ ...@@ -41,6 +47,7 @@
font-size: 32rpx; font-size: 32rpx;
color: #3666FE; color: #3666FE;
margin-top: -2rpx; margin-top: -2rpx;
.icon { .icon {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
...@@ -53,9 +60,22 @@ ...@@ -53,9 +60,22 @@
font-size: 24rpx; font-size: 24rpx;
color: #FFFFFF; color: #FFFFFF;
line-height: 36rpx; line-height: 36rpx;
.underline{
.underline {
font-weight: 600; font-weight: 600;
text-decoration: underline; text-decoration: underline;
} }
} }
} }
.titleTime {
height: 64rpx;
line-height: 64rpx;
width: 100%;
// background-color: rgba(54, 102, 254, 0.08);
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 24rpx;
color: #fff;
text-align: center;
}
\ No newline at end of file \ No newline at end of file
<block wx:if="{{show}}"> <block wx:if="{{show}}">
<!-- catchtouchmove="noScroll" --> <!-- catchtouchmove="noScroll" catchtouchmove="noScroll" -->
<view class="layout"> <view class="layout">
<view class="bg" bindtap="hide" /> <view class="bg" bindtap="hide" />
<block wx:if="{{scrollImg}}"> <block wx:if="{{scrollImg}}">
<view class="poster"> <view class="poster {{item.type == 'warReport'?'pd':''}}">
<!-- <scroll-view scroll-x="false" scroll-y="true" style="height: 100%"> --> <scroll-view scroll-y scroll-x="false" style="height: 100%">
<image src="{{poster}}" mode="widthFix" show-menu-by-longpress /> <image
<!-- </scroll-view> --> src="{{poster}}"
mode="widthFix"
show-menu-by-longpress
bindlongpress="longpress" />
</scroll-view>
</view> </view>
</block> </block>
<block wx:else> <block wx:else>
<image src="{{poster}}" class="poster" mode="widthFix" show-menu-by-longpress bindlongpress="longpress" /> <view class="poster {{item.type == 'warReport'?'pd':''}}">
<scroll-view scroll-y scroll-x="false" style="height: 100%">
<image
src="{{poster}}"
class="poster"
mode="widthFix"
show-menu-by-longpress
bindlongpress="longpress" />
</scroll-view>
</view>
</block> </block>
<view class="btn"> <view class="btn">
<glsx-image src="output/longtap.png" class="icon"></glsx-image> <glsx-image src="output/longtap.png" class="icon" />
长按图片转发 长按图片转发
</view> </view>
<view class="tips">温馨提示:您可以转发到门店群,门店员工通过扫描海报二维码可以注册登录 <text class="underline">门店助手</text> 小程序,执行活动任务,转发活动链接促成订单。</view> <view wx:if="{{item.type == 'warReport'}}" class="titleTime">最近更新时间: {{item.updatedTime}}</view>
<view wx:else class="tips">
温馨提示:您可以转发到门店群,门店员工通过扫描海报二维码可以注册登录
<text class="underline">门店助手</text>
小程序,执行活动任务,转发活动链接促成订单。
</view>
</view> </view>
</block> </block>
<!-- <authorize scopeType="writePhotosAlbum" bindfail="authFail" show="{{showAuth}}" isShowCheck="{{false}}" id="auth" /> --> <!-- <authorize scopeType="writePhotosAlbum" bindfail="authFail" show="{{showAuth}}" isShowCheck="{{false}}" id="auth" /> -->
// login/index/components/LoginBox.js // login/index/components/LoginBox.js
import USERAPI from '~/api/usersApi/index' import USERAPI from '~/api/usersApi/index'
import { import { checkLoginUserInfo, setLoginInfo, loginModal } from '~/login/lib/index'
checkLoginUserInfo,
setLoginInfo,
loginModal
} from '~/login/lib/index'
import md5 from '~/utils/lib/md5' import md5 from '~/utils/lib/md5'
import network from '~/utils/network' import network from '~/utils/network'
import { import { imgUrlMixin } from '~/mixins/index'
imgUrlMixin
} from '~/mixins/index'
let thisPage let thisPage
Component({ Component({
behaviors: [imgUrlMixin], behaviors: [imgUrlMixin],
...@@ -32,6 +26,8 @@ Component({ ...@@ -32,6 +26,8 @@ Component({
code: '', code: '',
account: '', account: '',
password: '' password: ''
// account: 'bb123456',
// password: 'bb123456'
}, },
phoneReady: false, phoneReady: false,
countDown: null countDown: null
...@@ -49,11 +45,8 @@ Component({ ...@@ -49,11 +45,8 @@ Component({
}, },
/**输入回调 */ /**输入回调 */
input(e) { input(e) {
const { const { value } = e.detail,
value { name } = e.currentTarget.dataset
} = e.detail, {
name
} = e.currentTarget.dataset
this.setData({ this.setData({
[`formData.${name}`]: value [`formData.${name}`]: value
}) })
...@@ -66,9 +59,7 @@ Component({ ...@@ -66,9 +59,7 @@ Component({
}, },
/**清除input value */ /**清除input value */
clear(e) { clear(e) {
const { const { name } = e.currentTarget.dataset
name
} = e.currentTarget.dataset
this.setData({ this.setData({
[`formData.${name}`]: '' [`formData.${name}`]: ''
}) })
...@@ -77,21 +68,14 @@ Component({ ...@@ -77,21 +68,14 @@ Component({
}, },
/**获取验证码 */ /**获取验证码 */
getSmsCode() { getSmsCode() {
const { const { phoneReady, formData, count } = this.data,
phoneReady,
formData,
count
} = this.data,
countDown = 60 countDown = 60
if (!phoneReady || count) return if (!phoneReady || count) return
this.setData({ this.setData({
smsLoading: true smsLoading: true
}) })
USERAPI.getSmsCode(formData.phone) USERAPI.getSmsCode(formData.phone)
.then(({ .then(({ code, message }) => {
code,
message
}) => {
this.setData({ this.setData({
smsLoading: false smsLoading: false
}) })
...@@ -112,9 +96,7 @@ Component({ ...@@ -112,9 +96,7 @@ Component({
count: countDown count: countDown
}) })
setTimeout(() => { setTimeout(() => {
let { let { count } = this.data
count
} = this.data
this.setData({ this.setData({
count: --count count: --count
}) })
...@@ -127,13 +109,11 @@ Component({ ...@@ -127,13 +109,11 @@ Component({
}, },
/**检查输入框内容 */ /**检查输入框内容 */
checkFormData() { checkFormData() {
const { const { loginType, formData } = this.data
loginType,
formData
} = this.data
if (loginType != 0) { if (loginType != 0) {
if (loginType == 1) { if (loginType == 1) {
this.setData({ this.setData(
{
phoneReady: formData.phone && thisPage.validate.methods.tel(formData.phone) phoneReady: formData.phone && thisPage.validate.methods.tel(formData.phone)
}, },
() => { () => {
...@@ -151,39 +131,30 @@ Component({ ...@@ -151,39 +131,30 @@ Component({
}, },
/**手机号&帐号密码登录 */ /**手机号&帐号密码登录 */
login() { login() {
const { const { formData, loginType } = this.data,
formData,
loginType
} = this.data,
target = { target = {
1: 'phoneSmsLogin', 1: 'phoneSmsLogin',
2: 'accountLogin' 2: 'accountLogin'
} [loginType], }[loginType],
obj = obj =
loginType == 1 ? { loginType == 1
? {
mobile: formData.phone, mobile: formData.phone,
code: formData.code code: formData.code
} : { }
: {
userName: formData.account, userName: formData.account,
password: md5(formData.password) password: md5(formData.password)
} }
this.setBtnLoading() this.setBtnLoading()
USERAPI[target](obj) USERAPI[target](obj)
.then(({ .then(({ code, data, message }) => {
code,
data,
message
}) => {
this.setBtnLoading(false) this.setBtnLoading(false)
if (code == '0') { if (code == '0') {
if (loginType == 1) checkLoginUserInfo(data) if (loginType == 1) checkLoginUserInfo(data)
else { else {
const { const { autoLogin } = thisPage.data,
autoLogin { sessionId, loginUserInfoList } = data,
} = thisPage.data, {
sessionId,
loginUserInfoList
} = data,
validTime = 3600 * 24 * 7 * 1e3, validTime = 3600 * 24 * 7 * 1e3,
autoLoginFailureTime = Date.now() + validTime autoLoginFailureTime = Date.now() + validTime
if (autoLogin && loginUserInfoList[0]) { if (autoLogin && loginUserInfoList[0]) {
...@@ -209,20 +180,14 @@ Component({ ...@@ -209,20 +180,14 @@ Component({
}) })
}, },
/**微信登录 */ /**微信登录 */
wxLogin({ wxLogin({ detail }) {
detail
}) {
if (!detail.code) { if (!detail.code) {
wx.$api.showToast('当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。') wx.$api.showToast('当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。')
return return
} }
this.setBtnLoading() this.setBtnLoading()
USERAPI.authUserPhone(detail, this.loginToken) USERAPI.authUserPhone(detail, this.loginToken)
.then(({ .then(({ code, data, message }) => {
code,
data,
message
}) => {
if (code == '0') checkLoginUserInfo(data) if (code == '0') checkLoginUserInfo(data)
else { else {
wx.$api.showToast(message || '系统异常') wx.$api.showToast(message || '系统异常')
...@@ -230,9 +195,7 @@ Component({ ...@@ -230,9 +195,7 @@ Component({
} }
this.setBtnLoading(false) this.setBtnLoading(false)
}) })
.catch(({ .catch(({ errMsg }) => {
errMsg
}) => {
wx.$api.showToast(errMsg || '系统异常') wx.$api.showToast(errMsg || '系统异常')
this.setBtnLoading(false) this.setBtnLoading(false)
this.init() this.init()
...@@ -252,11 +215,7 @@ Component({ ...@@ -252,11 +215,7 @@ Component({
network.getNetworkType() network.getNetworkType()
thisPage = wx.$router.getPageInstance() thisPage = wx.$router.getPageInstance()
try { try {
const { const { data, code, message } = await USERAPI.wxCodeLogin()
data,
code,
message
} = await USERAPI.wxCodeLogin()
if (code == '0') { if (code == '0') {
thisPage.setData({ thisPage.setData({
disabled: false disabled: false
...@@ -264,9 +223,7 @@ Component({ ...@@ -264,9 +223,7 @@ Component({
this.loginToken = data this.loginToken = data
} else this.reLogin(message) } else this.reLogin(message)
wx.hideLoading() wx.hideLoading()
} catch ({ } catch ({ errMsg }) {
errMsg
}) {
// console.error(errMsg) // console.error(errMsg)
this.reLogin() this.reLogin()
} }
......
...@@ -58,6 +58,7 @@ Page({ ...@@ -58,6 +58,7 @@ Page({
baseCustomer: carObj.selNum, baseCustomer: carObj.selNum,
clueId clueId
} }
// return wx.$api.showToast('申请成功') // return wx.$api.showToast('申请成功')
applyApi applyApi
.merchantApply(params) .merchantApply(params)
...@@ -67,7 +68,10 @@ Page({ ...@@ -67,7 +68,10 @@ Page({
wx.$api.showToast('申请成功') wx.$api.showToast('申请成功')
setTimeout(() => { setTimeout(() => {
wx.$router.back(page => { wx.$router.back(page => {
page.getClueInit && page.getClueInit() // console.log()
// console.log(node.getClueInit)
let node = page.selectComponent('#indexclue')
node.getClueInit && node.getClueInit()
}) })
}, 1000) }, 1000)
} }
......
...@@ -103,11 +103,11 @@ Component({ ...@@ -103,11 +103,11 @@ Component({
*/ */
methods: { methods: {
restPageNum() { restPageNum() {
console.log('restPageNum') // console.log('restPageNum')
this.setData({ this.setData({
pageNum: 1 pageNum: 1
}) })
this.getMerchantCustomInfoList() this.getMerchantCustomInfoList('reset')
}, },
scrollonReachBottom() { scrollonReachBottom() {
// console.log('scrollonReachBottom') // console.log('scrollonReachBottom')
...@@ -121,7 +121,7 @@ Component({ ...@@ -121,7 +121,7 @@ Component({
this.getMerchantCustomInfoList() this.getMerchantCustomInfoList()
}, },
// 分页查询客户列表 // 分页查询客户列表
getMerchantCustomInfoList() { getMerchantCustomInfoList(type) {
wx.$api.showLoading('加载中...') wx.$api.showLoading('加载中...')
let { pageNum, pageSize, customerList } = this.data let { pageNum, pageSize, customerList } = this.data
let params = { let params = {
...@@ -150,7 +150,14 @@ Component({ ...@@ -150,7 +150,14 @@ Component({
}) })
.catch(err => {}) .catch(err => {})
.finally(() => { .finally(() => {
if (type == 'reset') {
wx.$api.showToast({
title: '刷新成功',
icon: 'success'
})
} else {
wx.$api.hideLoading() wx.$api.hideLoading()
}
}) })
}, },
submit(data) { submit(data) {
......
...@@ -15,8 +15,13 @@ page { ...@@ -15,8 +15,13 @@ page {
font-size: 28rpx; font-size: 28rpx;
caret-color: #3666FE; caret-color: #3666FE;
width: 430rpx; width: 430rpx;
} }
.disabled {
// color: #333;
color: #a6a9ad;
}
.customerBox { .customerBox {
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<!-- type="number" --> <!-- type="number" -->
<input <input
placeholder="{{item.isEdit? childItem['placeholder']:''}}" placeholder="{{item.isEdit? childItem['placeholder']:''}}"
class="input" class="input {{item.isEdit&&(ind == 0|| ind == 1) ? 'disabled':''}}"
placeholder-class="placeholder-class" placeholder-class="placeholder-class"
maxlength="{{childItem.maxLength}}" maxlength="{{childItem.maxLength}}"
value="{{item[childItem['key']] }}" value="{{item[childItem['key']] }}"
......
...@@ -85,12 +85,13 @@ Component({ ...@@ -85,12 +85,13 @@ Component({
current: valueurl current: valueurl
}) })
}, },
downLoad(e) { showPoster(e) {
const { item } = e.currentTarget.dataset const { item } = e.currentTarget.dataset
this.setData({ this.setData({
posterItem: { posterItem: {
activityName: item.activityName, activityName: item.activityName,
posterUrl: item.valueUrl posterUrl: item.valueUrl,
crowdFundActivityId: item.valueUrl
} }
}) })
}, },
...@@ -105,11 +106,11 @@ Component({ ...@@ -105,11 +106,11 @@ Component({
// }, // },
async copyLink(e) { async copyLink(e) {
const { item } = e.currentTarget.dataset, const { item } = e.currentTarget.dataset,
posterObj = this.selectComponent('#poster'), posterObj = this.selectComponent('#poster')
{ options } = wx.$router.getPageInstance() // { options } = wx.$router.getPageInstance()
// item.crowdFundActivityId // item.crowdFundActivityId
console.log(options) // console.log(options)
try { try {
let flag = await posterObj.check(item) let flag = await posterObj.check(item)
posterObj.setData({ posterObj.setData({
...@@ -188,7 +189,10 @@ Component({ ...@@ -188,7 +189,10 @@ Component({
icon: 'error' icon: 'error'
} }
} }
wx.$api.showToast(toastObj[res]) wx.$api.showToast({
...toastObj[res],
duration: 1000
})
}, },
scrollonReachBottom(e) { scrollonReachBottom(e) {
console.log(e) console.log(e)
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
wx:if="{{item.valueUrl}}" wx:if="{{item.valueUrl}}"
data-valueurl="{{item.valueUrl}}" data-valueurl="{{item.valueUrl}}"
data-item="{{item}}" data-item="{{item}}"
bind:tap="downLoad"> bind:tap="showPoster">
战报详情 战报详情
</view> </view>
</view> </view>
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<view wx:if="{{item.messageType == 1}}"> <view wx:if="{{item.messageType == 1}}">
<view class="cell"> <view class="cell">
<view class="label">活动名称:</view> <view class="label">活动名称:</view>
<view class="value">{{item.activityName}}</view> <view class="value">{{item.activityName||item.productName}}</view>
</view> </view>
<view class="cell"> <view class="cell">
<view class="label">开始时间:</view> <view class="label">开始时间:</view>
...@@ -104,11 +104,11 @@ ...@@ -104,11 +104,11 @@
</view> </view>
<view class="cell" wx:if="{{item.messageType == 4}}"> <view class="cell" wx:if="{{item.messageType == 4}}">
<view class="label">产品名称:</view> <view class="label">产品名称:</view>
<view class="value">{{item.activityName}}</view> <view class="value">{{item.activityName||item.productName}}</view>
</view> </view>
<view class="cell" wx:if="{{item.messageType == 5}}"> <view class="cell" wx:if="{{item.messageType == 5}}">
<view class="label">新车交付场景:</view> <view class="label">新车交付场景:</view>
<view class="value">{{item.activityName}}</view> <view class="value">{{item.productName}}</view>
</view> </view>
<view class="cell" wx:if="{{item.messageType == 6}}"> <view class="cell" wx:if="{{item.messageType == 6}}">
<view class="label">0~12个月场景:</view> <view class="label">0~12个月场景:</view>
......
...@@ -79,7 +79,10 @@ Page({ ...@@ -79,7 +79,10 @@ Page({
// wx.$api.showToast('申请成功') // wx.$api.showToast('申请成功')
setTimeout(() => { setTimeout(() => {
wx.$router.back(page => { wx.$router.back(page => {
page.getClueInit && page.getClueInit() let node = page.selectComponent('#indexclue')
// console.log(node)
node.getClueInit && node.getClueInit()
// page.getClueInit && page.getClueInit()
}) })
}, 1000) }, 1000)
}, },
...@@ -102,7 +105,7 @@ Page({ ...@@ -102,7 +105,7 @@ Page({
wx.showToast({ wx.showToast({
title: '提交成功', title: '提交成功',
icon: 'success', icon: 'success',
duration: 3000, duration: 2000,
mask: true, mask: true,
success: () => { success: () => {
this.handleJump() this.handleJump()
......
...@@ -67,7 +67,8 @@ Page({ ...@@ -67,7 +67,8 @@ Page({
wx.$api.showToast('申请成功') wx.$api.showToast('申请成功')
setTimeout(() => { setTimeout(() => {
wx.$router.back(page => { wx.$router.back(page => {
page.getClueInit && page.getClueInit() let node = page.selectComponent('#indexclue')
node.getClueInit && node.getClueInit()
}) })
}, 1000) }, 1000)
} }
......
...@@ -19,47 +19,72 @@ ...@@ -19,47 +19,72 @@
background: rgba(28, 27, 35, 0.60); background: rgba(28, 27, 35, 0.60);
} }
.titleTime {
height: 64rpx;
line-height: 64rpx;
width: 100%;
background-color: rgba(54, 102, 254, 0.08);
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 22rpx;
color: #3666FE;
text-align: center;
}
.imgCon { .imgCon {
height: calc(100% - 64rpx); // height: calc(100% - 64rpx);
height: 100%;
overflow: scroll; overflow: scroll;
} }
.poster { .poster {
position: relative;
background-color: #fff; background-color: #fff;
box-sizing: border-box; box-sizing: border-box;
padding: 32rpx;
// padding-bottom: 10rpx; // padding-bottom: 10rpx;
width: 558rpx; width: 558rpx;
// height: 60%; // height: 60%;
height: 1108rpx; height: 1108rpx;
// overflow: scroll; // overflow: scroll;
border-radius: 8rpx; border-radius: 8rpx 8rpx 0 0;
&::after {
content: '';
width: 100%;
height: 132rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/bgImg.webp') no-repeat;
background-size: 100% 132rpx;
position: absolute;
left: 0;
top: 0;
z-index: -1;
}
// bgImg.webp
} }
// .btn {
// width: 320rpx;
// height: 88rpx;
// line-height: 88rpx;
// background: #3666FE;
// // background-image: linear-gradient(-60deg, #556AF5 0%, #7197FF 100%);
// border-radius: 16rpx;
// font-weight: 500;
// font-size: 32rpx;
// color: #FFFFFF;
// text-align: center;
// margin-top: 32rpx;
// }
.btn { .btn {
width: 320rpx; display: flex;
height: 88rpx; align-items: center;
line-height: 88rpx; justify-content: center;
background: #3666FE; width: 558rpx;
// background-image: linear-gradient(-60deg, #556AF5 0%, #7197FF 100%); height: 90rpx;
border-radius: 16rpx; background: #F7F8FA;
border-radius: 0 0 12rpx 12rpx;
font-weight: 500; font-weight: 500;
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #3666FE;
text-align: center;
margin-top: 32rpx; // margin-top: -2rpx;
.icon {
width: 40rpx;
height: 40rpx;
margin-right: 12rpx;
}
} }
.tips { .tips {
......
...@@ -3,12 +3,18 @@ ...@@ -3,12 +3,18 @@
<!-- catchtouchmove="noScroll" --> <!-- catchtouchmove="noScroll" -->
<view class="bg" bindtap="hide" /> <view class="bg" bindtap="hide" />
<view class="poster"> <view class="poster">
<view class="titleTime">最近更新时间 {{item.updatedTime}}</view> <!-- <view class="titleTime">最近更新时间 {{item.updatedTime}}</view> -->
<view class="imgCon" catchtouchmove="noScroll"> <!-- catchtouchmove="noScroll" -->
<image src="{{poster}}" mode="widthFix" /> <view class="imgCon">
<image src="{{poster}}" mode="widthFix" show-menu-by-longpress />
</view>
</view> </view>
<!-- <view class="btn" bindtap="download">下载图片并转发</view> -->
<view class="btn">
<glsx-image src="output/longtap.png" class="icon" />
长按图片转发
</view> </view>
<view class="btn" bindtap="download">下载图片并转发</view> <view class="titleTime">最近更新时间: {{item.updatedTime}}</view>
<!-- <view class="tips">提示:这是您的专属活动海报,请下载转发给门店员工注册并参与活动分享。请不要将此海报转发给非相关活动参与者,避免活动数据泄漏。</view> --> <!-- <view class="tips">提示:这是您的专属活动海报,请下载转发给门店员工注册并参与活动分享。请不要将此海报转发给非相关活动参与者,避免活动数据泄漏。</view> -->
</view> </view>
</block> </block>
......
// pages/tab/index/components/indexClue/indexClue.js // pages/tab/index/components/indexClue/indexClue.js
import { IMG_URL } from "~/utils/constantData.js"; import { IMG_URL } from '~/utils/constantData.js'
import { unreadApi, pageApi, tagApi } from "~/api/index.js"; import { unreadApi, pageApi, tagApi } from '~/api/index.js'
const IMAGES = Object.freeze({ const IMAGES = Object.freeze({
arrow: `${IMG_URL}/index/point.png`, arrow: `${IMG_URL}/index/point.png`,
actArrow: `${IMG_URL}/index/actArrow.png`, actArrow: `${IMG_URL}/index/actArrow.png`
}); })
Component({ Component({
/** /**
...@@ -12,7 +12,7 @@ Component({ ...@@ -12,7 +12,7 @@ Component({
*/ */
properties: { properties: {
headerHeight: Number, headerHeight: Number,
disLikeRecordFlag: Boolean, disLikeRecordFlag: Boolean
}, },
/** /**
...@@ -23,30 +23,30 @@ Component({ ...@@ -23,30 +23,30 @@ Component({
IMG_URL, IMG_URL,
typeList: [ typeList: [
{ {
0: "无电话", 0: '无电话',
1: "有电话", 1: '有电话',
2: "联系电话", 2: '联系电话',
selectIndex: 2, selectIndex: 2,
key: "hasPhone", key: 'hasPhone'
}, },
{ {
0: "非意向客户", 0: '非意向客户',
1: "是意向客户", 1: '是意向客户',
2: "意向客户", 2: '意向客户',
selectIndex: 2, selectIndex: 2,
key: "starTag", key: 'starTag'
}, },
{ {
0: "来自访客", 0: '来自访客',
1: "来自门店", 1: '来自门店',
2: "线索来源", 2: '线索来源',
selectIndex: 2, selectIndex: 2,
key: "clueSource", key: 'clueSource'
}, },
{ {
2: "重置", 2: '重置',
selectIndex: 2, selectIndex: 2
}, }
], ],
clueList: [], clueList: [],
// 看线索部分 // 看线索部分
...@@ -54,13 +54,13 @@ Component({ ...@@ -54,13 +54,13 @@ Component({
cluePageSize: 1000, cluePageSize: 1000,
clueCurrentPage: 1, clueCurrentPage: 1,
disLikeFlag: true, disLikeFlag: true,
clueParams: {}, //看线索参数 clueParams: {} //看线索参数
}, },
lifetimes: { lifetimes: {
attached: function () { attached: function () {
// 看线索 // 看线索
this.getClueInit(); this.getClueInit()
}, }
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -68,27 +68,27 @@ Component({ ...@@ -68,27 +68,27 @@ Component({
methods: { methods: {
//点击收藏 //点击收藏
showToast: function (e) { showToast: function (e) {
wx.$storage.set("disLikeRecordFlag", false); wx.$storage.set('disLikeRecordFlag', false)
let disLikeRecordFlag = wx.$storage.get("disLikeRecordFlag"); let disLikeRecordFlag = wx.$storage.get('disLikeRecordFlag')
this.setData({ this.setData({
disLikeFlag: false, disLikeFlag: false,
disLikeRecordFlag, disLikeRecordFlag
}); })
let { type, item } = e.currentTarget.dataset; let { type, item } = e.currentTarget.dataset
console.log("type,item: ", type, item); console.log('type,item: ', type, item)
let tipObj = {}; let tipObj = {}
if (item.starTag == 1) { if (item.starTag == 1) {
tipObj = { tipObj = {
type: "fail", type: 'fail',
title: "取消标记为意向客户", title: '取消标记为意向客户'
}; }
} else { } else {
tipObj = { tipObj = {
type: "success", type: 'success',
title: "成功标记为意向客户", title: '成功标记为意向客户'
};
} }
this.triggerEvent("showToggleToast", tipObj); }
this.triggerEvent('showToggleToast', tipObj)
// this.data.showToggleToast(tipObj) // this.data.showToggleToast(tipObj)
// this.data.prompt.showToast({ // this.data.prompt.showToast({
// type: tipObj.type, // type: tipObj.type,
...@@ -101,130 +101,130 @@ Component({ ...@@ -101,130 +101,130 @@ Component({
// }); // });
//切换收藏标记 //切换收藏标记
let index = e.currentTarget.dataset.outidx; let index = e.currentTarget.dataset.outidx
let completeStatus = `clueList[${index}].like`; let completeStatus = `clueList[${index}].like`
this.setData({ this.setData({
[completeStatus]: !this.data.clueList[index].like, [completeStatus]: !this.data.clueList[index].like
}); })
//发请求 //发请求
let { sessionId } = wx.$storage.get(); let { sessionId } = wx.$storage.get()
let params = { let params = {
clueId: item.clueId, clueId: item.clueId,
sessionId, sessionId
}; }
this.getTagApi(params); this.getTagApi(params)
}, },
//看线索重置 //看线索重置
resetCluelist() { resetCluelist() {
let { typeList } = this.data; let { typeList } = this.data
typeList.forEach((item) => { typeList.forEach(item => {
item.selectIndex = 2; item.selectIndex = 2
}); })
this.setData({ this.setData({
typeList, typeList,
clueParams: {}, clueParams: {}
}); })
//重置数据 //重置数据
this.clearclueData(); this.clearclueData()
this.getPageApi(); this.getPageApi()
}, },
filterTypeFn(e) { filterTypeFn(e) {
let { typeList } = this.data; let { typeList } = this.data
let index = e.currentTarget.dataset.index; let index = e.currentTarget.dataset.index
// 重置筛选 // 重置筛选
if (index == 3) { if (index == 3) {
return this.resetCluelist(); return this.resetCluelist()
} }
let itemList = Object.values(typeList[index]).slice(0, 2); let itemList = Object.values(typeList[index]).slice(0, 2)
itemList.push("全部"); itemList.push('全部')
let _this = this; let _this = this
wx.pro.showActionSheet({ wx.pro.showActionSheet({
itemList, itemList,
success(res) { success(res) {
//重置数据 //重置数据
_this.clearclueData(); _this.clearclueData()
// 选中全部 // 选中全部
let selectIndex = res.tapIndex; let selectIndex = res.tapIndex
// console.log('selectIndex: ', selectIndex); // console.log('selectIndex: ', selectIndex);
typeList[index].selectIndex = selectIndex; typeList[index].selectIndex = selectIndex
let params = typeList.reduce((obj, item, index) => { let params = typeList.reduce((obj, item, index) => {
console.log(" item: ", item); console.log(' item: ', item)
if (item["key"]) { if (item['key']) {
let itemIndx = item.selectIndex; let itemIndx = item.selectIndex
// key: 'clueSource' // key: 'clueSource'
if (item["key"] == "clueSource") { if (item['key'] == 'clueSource') {
// itemIndx += 1 // itemIndx += 1
obj[item["key"]] = itemIndx == 2 ? "" : itemIndx + 1; obj[item['key']] = itemIndx == 2 ? '' : itemIndx + 1
} else { } else {
obj[item["key"]] = itemIndx == 2 ? "" : itemIndx; obj[item['key']] = itemIndx == 2 ? '' : itemIndx
} }
} }
return obj; return obj
}, {}); }, {})
console.log(params); console.log(params)
// 清空数据 // 清空数据
_this.setData({ typeList, clueParams: params }); _this.setData({ typeList, clueParams: params })
_this.getPageApi(params); _this.getPageApi(params)
}, },
fail(res) { fail(res) {
console.log(res.errMsg); console.log(res.errMsg)
}, }
}); })
}, },
//重置数据 //重置数据
clearclueData() { clearclueData() {
this.setData({ this.setData({
clueList: [], clueList: [],
clueCurrentPage: 1, clueCurrentPage: 1
// hasPhone: '', // hasPhone: '',
// starTag: '', // starTag: '',
// clueSource: '', // clueSource: '',
}); })
}, },
// 打电话 // 打电话
phoneCallFn(e) { phoneCallFn(e) {
let { phone } = e.currentTarget.dataset; let { phone } = e.currentTarget.dataset
console.log("phone: ", phone); console.log('phone: ', phone)
wx.$api.phoneCall(phone); wx.$api.phoneCall(phone)
}, },
// 复制号码 // 复制号码
setCopyDataFn(e) { setCopyDataFn(e) {
let { phone } = e.currentTarget.dataset; let { phone } = e.currentTarget.dataset
wx.$api.setCopyData(phone); wx.$api.setCopyData(phone)
}, },
getClueInit(param) { getClueInit(param) {
// console.log(22222) // console.log(22222)
this.getUnreadApi(param); this.getUnreadApi(param)
this.getPageApi(param); this.getPageApi(param)
}, },
//未读消息 //未读消息
async getUnreadApi(param) { async getUnreadApi(param) {
let { code, data } = await unreadApi(param); let { code, data } = await unreadApi(param)
if (code == 0) { if (code == 0) {
this.setData({ this.setData({
unreadClueCount: data.unreadClueCount, unreadClueCount: data.unreadClueCount
}); })
} }
}, },
//获取浏览线索数据列表 //获取浏览线索数据列表
async getPageApi(param) { async getPageApi(param) {
let { cluePageSize, clueCurrentPage, clueList } = this.data; let { cluePageSize, clueCurrentPage, clueList } = this.data
let params = { let params = {
pageSize: cluePageSize, pageSize: cluePageSize,
currentPage: clueCurrentPage, currentPage: clueCurrentPage,
...param, ...param
}; }
let { code, data } = await pageApi(params); let { code, data } = await pageApi(params)
if (code == 0) { if (code == 0) {
let arr = data.list.map((item) => { let arr = data.list.map(item => {
if (item.visitList && item.visitList.length > 5) { if (item.visitList && item.visitList.length > 5) {
item.getMoreFlag = true; item.getMoreFlag = true
} }
return item; return item
}); })
//添加分页数据 //添加分页数据
// let concatArr = [] // let concatArr = []
...@@ -234,81 +234,81 @@ Component({ ...@@ -234,81 +234,81 @@ Component({
// } // }
this.setData({ this.setData({
clueList: arr, clueList: arr
}); })
let arrinx = arr.findIndex((e) => e.clueType == 1 && e.starTag == 0); let arrinx = arr.findIndex(e => e.clueType == 1 && e.starTag == 0)
this.setData({ this.setData({
disLikeFlagIdx: arrinx, disLikeFlagIdx: arrinx,
triggered: false, triggered: false
}); })
} }
}, },
//喜欢收藏功能 //喜欢收藏功能
async getTagApi(param) { async getTagApi(param) {
let { clueParams } = this.data; let { clueParams } = this.data
let res = await tagApi(param); let res = await tagApi(param)
console.log("res: ", res); console.log('res: ', res)
if (res.code == 0) { if (res.code == 0) {
let clueListPamas = { let clueListPamas = {
...param, ...param,
...clueParams, ...clueParams
}; }
this.getPageApi(clueListPamas); this.getPageApi(clueListPamas)
} }
}, },
// 上拉刷新 // 上拉刷新
scrolltolowerFn() { scrolltolowerFn() {
console.log("scrolltolowerFn: "); console.log('scrolltolowerFn: ')
let { clueCurrentPage, clueParams } = this.data; let { clueCurrentPage, clueParams } = this.data
console.log("clueCurrentPage: ", clueCurrentPage); console.log('clueCurrentPage: ', clueCurrentPage)
let params = { let params = {
...clueParams, ...clueParams,
clueCurrentPage: clueCurrentPage++, clueCurrentPage: clueCurrentPage++
}; }
this.setData({ this.setData({
clueCurrentPage, clueCurrentPage
}); })
this.getPageApi(params); this.getPageApi(params)
}, },
// 下拉刷新 // 下拉刷新
refreshList() { refreshList() {
// console.log('onPullDownRefresh: '); // console.log('onPullDownRefresh: ');
let { clueParams } = this.data; let { clueParams } = this.data
this.getClueInit(clueParams); this.getClueInit(clueParams)
// this.resetCluelist() // this.resetCluelist()
// this.onLoad() // this.onLoad()
wx.pro.showToast({ wx.pro.showToast({
title: "刷新成功", title: '刷新成功',
icon: "loading", icon: 'success',
duration: 1500, duration: 1500
}); })
}, },
gotoApply(e) { gotoApply(e) {
let { type, item } = e.currentTarget.dataset; let { type, item } = e.currentTarget.dataset
// let { } = e.currentTarget.dataset // let { } = e.currentTarget.dataset
// console.log(item) // console.log(item)
// return // return
if (type == "active") { if (type == 'active') {
let { userInfo } = wx.$storage.get(); let { userInfo } = wx.$storage.get()
let pMerchantName = userInfo.subLoginUser.merchantName; let pMerchantName = userInfo.subLoginUser.merchantName
let pMerchantId = userInfo.subLoginUser.merchantId; let pMerchantId = userInfo.subLoginUser.merchantId
let sceneActive; let sceneActive
switch (this.data.actNum) { switch (this.data.actNum) {
case 0: case 0:
sceneActive = 1; sceneActive = 1
break; break
case 1: case 1:
sceneActive = 2; sceneActive = 2
break; break
case 2: case 2:
sceneActive = 3; sceneActive = 3
break; break
case 3: case 3:
sceneActive = 4; sceneActive = 4
break; break
} }
// let pMerchantId = userInfo.subLoginUser.merchantId // let pMerchantId = userInfo.subLoginUser.merchantId
...@@ -318,30 +318,30 @@ Component({ ...@@ -318,30 +318,30 @@ Component({
pMerchantId, pMerchantId,
pMerchantName, pMerchantName,
merchantId: item.visitList[0].merchantId, merchantId: item.visitList[0].merchantId,
merchantName: item.visitList[0].merchantName, merchantName: item.visitList[0].merchantName
}, },
sceneActive, sceneActive,
clueId: item.clueId, clueId: item.clueId
// sceneCodeList: ['SC001', 'SC002','SC003','SC004'] // sceneCodeList: ['SC001', 'SC002','SC003','SC004']
}; }
//申请活动 //申请活动
// wx.$router.go("packageOutput.openBusiness", params); // wx.$router.go("packageOutput.openBusiness", params);
wx.$router.go("/packagesList/packageOutput/pages/openBusiness", params); wx.$router.go('packagesList.openBusiness', params)
} else { } else {
//申请门店 //申请门店
// let { type, item } = e.currentTarget.dataset // let { type, item } = e.currentTarget.dataset
wx.$router.go("/packagesList/apply/pages/apply", item?.clueId || ""); wx.$router.go('packagesList.apply', item?.clueId || '')
} }
// wx.$router.go('apply',1235) // wx.$router.go('apply',1235)
}, },
getMore(e) { getMore(e) {
// console.log("显示更多数据"); // console.log("显示更多数据");
let index = e.currentTarget.dataset.outidx; let index = e.currentTarget.dataset.outidx
// console.log("index: ", index); // console.log("index: ", index);
let completeStatus = `clueList[${index}].getMoreFlag`; let completeStatus = `clueList[${index}].getMoreFlag`
this.setData({ this.setData({
[completeStatus]: !this.data.clueList[index].getMoreFlag, [completeStatus]: !this.data.clueList[index].getMoreFlag
}); })
}, }
}, }
}); })
...@@ -444,7 +444,8 @@ Page({ ...@@ -444,7 +444,8 @@ Page({
activityName: result.activityName, activityName: result.activityName,
// posterUrl: 'https://wx.glsx.com.cn/upload/biz/587076735934271488.png' // posterUrl: 'https://wx.glsx.com.cn/upload/biz/587076735934271488.png'
posterUrl: result.valueUrl, posterUrl: result.valueUrl,
updatedTime updatedTime,
type: 'warReport'
} }
}) })
if (result.status && result.status != 2) { if (result.status && result.status != 2) {
......
{ {
"usingComponents": { "usingComponents": {
"vas-toast": "./components/likeToast/likeToast", "vas-toast": "./components/likeToast/likeToast",
"crowdfund-poster": "./components/CrowdfundPoster/CrowdfundPoster", "indexProduct": "./components/indexProduct/indexProduct",
"indexProduct":"./components/indexProduct/indexProduct", "indexClue": "./components/indexClue/indexClue",
"indexClue":"./components/indexClue/indexClue", "FullscreenVideo": "../../../components/FullscreenVideo/FullscreenVideo"
"FullscreenVideo":"../../../components/FullscreenVideo/FullscreenVideo"
}, },
"navigationStyle": "custom", "navigationStyle": "custom",
"onReachBottomDistance": 50 "onReachBottomDistance": 50
......
...@@ -107,7 +107,7 @@ page { ...@@ -107,7 +107,7 @@ page {
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 3; z-index: 999;
} }
} }
......
...@@ -19,20 +19,21 @@ ...@@ -19,20 +19,21 @@
</view> </view>
</view> </view>
<!-- 托客户内容 --> <!-- 托客户内容 -->
<indexProduct wx:if="{{tabIndx == 1 }}" <indexProduct
wx:if="{{tabIndx == 1 }}"
bindselectCar="selectCar" bindselectCar="selectCar"
senceData="{{senceData}}" senceData="{{senceData}}"
actNum="{{actNum}}" actNum="{{actNum}}"
img_version="{{img_version}}" img_version="{{img_version}}"
headerHeight="{{headerHeight}}" headerHeight="{{headerHeight}}"
bindrefresherrefresh="refresherrefresh"></indexProduct> bindrefresherrefresh="refresherrefresh" />
<!-- 看线索内容 --> <!-- 看线索内容 -->
<indexClue <indexClue
id="indexclue"
wx:if="{{tabIndx == 0 }}" wx:if="{{tabIndx == 0 }}"
headerHeight="{{headerHeight}}" headerHeight="{{headerHeight}}"
disLikeRecordFlag="{{disLikeRecordFlag}}" disLikeRecordFlag="{{disLikeRecordFlag}}"
bindshowToggleToast="showToggleToast" bindshowToggleToast="showToggleToast" />
></indexClue>
</view> </view>
<!-- 收藏、取消提示框 --> <!-- 收藏、取消提示框 -->
<vas-toast id='toast' /> <vas-toast id='toast' />
...@@ -101,5 +102,5 @@ ...@@ -101,5 +102,5 @@
</view> </view>
<crowdfund-poster item="{{posterItem}}" /> <crowdfund-poster item="{{posterItem}}" />
<!-- 全屏视频组件 --> <!-- 全屏视频组件 -->
<FullscreenVideo id="videocomp" src="{{videoSrc}}" title="{{videoTitle}}"></FullscreenVideo> <FullscreenVideo id="videocomp" src="{{videoSrc}}" title="{{videoTitle}}" />
...@@ -60,7 +60,11 @@ Component({ ...@@ -60,7 +60,11 @@ Component({
getClientApi(isPull = false) { getClientApi(isPull = false) {
this.getProfit() this.getProfit()
this.getList() this.getList()
isPull && wx.$api.showToast('刷新成功') isPull &&
wx.$api.showToast({
title: '刷新成功',
icon: 'success'
})
if (this.data.pageObj.currentPage == 1) { if (this.data.pageObj.currentPage == 1) {
this.setData({ this.setData({
scrollTop: 0, scrollTop: 0,
...@@ -115,7 +119,7 @@ Component({ ...@@ -115,7 +119,7 @@ Component({
// } = e.currentTarget.dataset, // } = e.currentTarget.dataset,
console.log(item) console.log(item)
const posterObj = this.selectComponent('#poster') const posterObj = this.selectComponent('#poster')
const {options} = wx.$router.getPageInstance() const { options } = wx.$router.getPageInstance()
console.log(options) console.log(options)
try { try {
let flag = await posterObj.check(item) let flag = await posterObj.check(item)
...@@ -125,15 +129,18 @@ Component({ ...@@ -125,15 +129,18 @@ Component({
}) })
} catch (error) { } catch (error) {
wx.$api.showLoading('加载中...') wx.$api.showLoading('加载中...')
outputApi.getPosterUrl({ outputApi
.getPosterUrl({
id: item.activityId id: item.activityId
}).then(res => { })
.then(res => {
item.posterUrl = res item.posterUrl = res
this.setData({ this.setData({
posterItem: item, posterItem: item,
isShowTip: false isShowTip: false
}) })
}).catch(() => { })
.catch(() => {
wx.$api.showToast('下载海报失败') wx.$api.showToast('下载海报失败')
}) })
} }
...@@ -142,9 +149,7 @@ Component({ ...@@ -142,9 +149,7 @@ Component({
async longtouch(e) { async longtouch(e) {
console.log('长按海报', e) console.log('长按海报', e)
this.onBindRefresh() this.onBindRefresh()
let { let { activityId } = e.detail
activityId
} = e.detail
const res = await outputApi.reportPosterTrack({ const res = await outputApi.reportPosterTrack({
activityId activityId
}) })
......
...@@ -118,7 +118,10 @@ Component({ ...@@ -118,7 +118,10 @@ Component({
this.setData({ this.setData({
triggered: false triggered: false
}) })
wx.$api.showToast('刷新成功') wx.$api.showToast({
title: '刷新成功',
icon: 'success'
})
that.setMerchantObj(current, result, itemList[res.tapIndex], item) that.setMerchantObj(current, result, itemList[res.tapIndex], item)
}) })
.catch(err => {}) .catch(err => {})
......
{ {
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"libVersion": "2.25.0", "libVersion": "2.27.2",
"condition": { "condition": {
"miniprogram": { "miniprogram": {
"list": [ "list": [
......
...@@ -8,17 +8,21 @@ class Draw { ...@@ -8,17 +8,21 @@ class Draw {
[_canvasObject_] = null; [_canvasObject_] = null;
[_canvas_] = null [_canvas_] = null
constructor(canvasObject, isCompInst) { constructor(canvasObject, isCompInst) {
//createOffscreenCanvas height最大值 4096
this[_canvasObject_] = canvasObject this[_canvasObject_] = canvasObject
this[_pixelRatio_] = canvasObject.pixelRatio || 2 this[_pixelRatio_] = canvasObject.pixelRatio || 2
const height = this.toRpx(canvasObject.height), const canvasObjectHeight = this.toRpx(canvasObject.height)
width = this.toRpx(canvasObject.width), let height = canvasObjectHeight,
canvas = wx.createOffscreenCanvas({ width = this.toRpx(canvasObject.width)
let canvas = wx.createOffscreenCanvas({
type: '2d', type: '2d',
width, width,
height, height,
compInst: isCompInst compInst: isCompInst
}), }),
ctx = canvas.getContext('2d') ctx = canvas.getContext('2d')
this[_canvas_] = canvas this[_canvas_] = canvas
this[_ctx_] = ctx this[_ctx_] = ctx
this[_ctx_].clearRect(0, 0, width, height) this[_ctx_].clearRect(0, 0, width, height)
...@@ -34,14 +38,7 @@ class Draw { ...@@ -34,14 +38,7 @@ class Draw {
async drawImages(imageParams, callback) { async drawImages(imageParams, callback) {
this[_ctx_].beginPath() this[_ctx_].beginPath()
this[_ctx_].save() this[_ctx_].save()
let { let { borderRadius, height, width, url, x, y } = imageParams
borderRadius,
height,
width,
url,
x,
y
} = imageParams
height = this.toRpx(height) height = this.toRpx(height)
width = this.toRpx(width) width = this.toRpx(width)
x = this.toRpx(x) x = this.toRpx(x)
...@@ -83,13 +80,7 @@ class Draw { ...@@ -83,13 +80,7 @@ class Draw {
return this[_ctx_].measureText(text).width return this[_ctx_].measureText(text).width
} }
// 画块形状 // 画块形状
drawFill({ drawFill({ x, y, width, height, color }) {
x,
y,
width,
height,
color
}) {
height = this.toRpx(height) height = this.toRpx(height)
width = this.toRpx(width) width = this.toRpx(width)
x = this.toRpx(x) x = this.toRpx(x)
...@@ -102,24 +93,7 @@ class Draw { ...@@ -102,24 +93,7 @@ class Draw {
this[_ctx_].save() this[_ctx_].save()
} }
drawText(textParams) { drawText(textParams) {
let { let { textDecoration, textBaseline, lineHeight, fontWeight, textAlign, textWidth, maxWidth, fontSize, lastFont, opacity, lineNum, width, color, text, x, y } = textParams,
textDecoration,
textBaseline,
lineHeight,
fontWeight,
textAlign,
textWidth,
maxWidth,
fontSize,
lastFont,
opacity,
lineNum,
width,
color,
text,
x,
y
} = textParams,
font = this[_ctx_].font.split('px')[1] font = this[_ctx_].font.split('px')[1]
textAlign = textAlign || 'left' textAlign = textAlign || 'left'
textBaseline = textBaseline || 'normal' textBaseline = textBaseline || 'normal'
...@@ -233,17 +207,7 @@ class Draw { ...@@ -233,17 +207,7 @@ class Draw {
this[_ctx_].stroke() this[_ctx_].stroke()
} }
drawBorder(params) { drawBorder(params) {
let { let { x, y, text, color, width, radius, opacity, padding, fontSize } = params,
x,
y,
text,
color,
width,
radius,
opacity,
padding,
fontSize
} = params,
paddingX = 0, paddingX = 0,
paddingY = 0 paddingY = 0
if (padding && padding.length) { if (padding && padding.length) {
...@@ -255,7 +219,8 @@ class Draw { ...@@ -255,7 +219,8 @@ class Draw {
endX = this.toRpx(x) + this.getTextWidth(text) + paddingX, endX = this.toRpx(x) + this.getTextWidth(text) + paddingX,
startY = this.toRpx(y) - paddingY, startY = this.toRpx(y) - paddingY,
endY = this.toRpx(y + fontSize) + paddingY / 2, endY = this.toRpx(y + fontSize) + paddingY / 2,
arr = [{ arr = [
{
x: startX, x: startX,
y: startY, y: startY,
width: endX width: endX
...@@ -282,7 +247,8 @@ class Draw { ...@@ -282,7 +247,8 @@ class Draw {
this[_ctx_].lineWidth = width || this.toRpx(1) this[_ctx_].lineWidth = width || this.toRpx(1)
if (radius) { if (radius) {
radius = this.toRpx(radius) radius = this.toRpx(radius)
let arcArr = [{ let arcArr = [
{
moveTo: [startX, startY + radius], moveTo: [startX, startY + radius],
arcTo: [startX, startY, startX + radius, startY] arcTo: [startX, startY, startX + radius, startY]
}, },
...@@ -327,16 +293,7 @@ class Draw { ...@@ -327,16 +293,7 @@ class Draw {
} }
drawLine(lineParams, callback) { drawLine(lineParams, callback) {
this[_ctx_].beginPath() this[_ctx_].beginPath()
let { let { noTransition, opacity, startX, startY, width, color, endX, endY } = lineParams
noTransition,
opacity,
startX,
startY,
width,
color,
endX,
endY
} = lineParams
if (!noTransition) { if (!noTransition) {
startX = this.toRpx(startX) startX = this.toRpx(startX)
startY = this.toRpx(startY) startY = this.toRpx(startY)
...@@ -355,12 +312,7 @@ class Draw { ...@@ -355,12 +312,7 @@ class Draw {
if (callback) callback() if (callback) callback()
} }
setLineY = params => { setLineY = params => {
let { let { textDecoration, textBaseline, fontSize, y } = params
textDecoration,
textBaseline,
fontSize,
y
} = params
let type = { let type = {
underline: { underline: {
top: y + fontSize, top: y + fontSize,
...@@ -383,11 +335,7 @@ class Draw { ...@@ -383,11 +335,7 @@ class Draw {
} }
return type[textDecoration][textBaseline] return type[textDecoration][textBaseline]
} }
setLineX({ setLineX({ textAlign, text, x }) {
textAlign,
text,
x
}) {
let textWidth = this.getTextWidth(text) let textWidth = this.getTextWidth(text)
let type = { let type = {
left: x, left: x,
...@@ -396,13 +344,7 @@ class Draw { ...@@ -396,13 +344,7 @@ class Draw {
} }
return type[textAlign] return type[textAlign]
} }
drawRadiusRect({ drawRadiusRect({ borderRadius, height, width, x, y }, callBack) {
borderRadius,
height,
width,
x,
y
}, callBack) {
let radius = typeof borderRadius === 'string' ? ((Number(borderRadius.split('%')[0]) / 100) * width) / 2 : borderRadius / 2 let radius = typeof borderRadius === 'string' ? ((Number(borderRadius.split('%')[0]) / 100) * width) / 2 : borderRadius / 2
radius = radius || 0 radius = radius || 0
this[_ctx_].beginPath() this[_ctx_].beginPath()
...@@ -413,12 +355,7 @@ class Draw { ...@@ -413,12 +355,7 @@ class Draw {
} }
if (callBack) callBack() if (callBack) callBack()
} }
getFontWidth({ getFontWidth({ textAlign, fontSize, text, x }) {
textAlign,
fontSize,
text,
x
}) {
let type = { let type = {
left: x, left: x,
center: x - (fontSize * text.length) / 2, center: x - (fontSize * text.length) / 2,
...@@ -428,12 +365,7 @@ class Draw { ...@@ -428,12 +365,7 @@ class Draw {
} }
drawDecoration(params) { drawDecoration(params) {
let { let { newText, opacity, y, x } = params
newText,
opacity,
y,
x
} = params
let lineX = x let lineX = x
let lineY = y let lineY = y
lineX = this.setLineX(params) lineX = this.setLineX(params)
...@@ -505,10 +437,7 @@ const checkTextDecoration = textDecoration => { ...@@ -505,10 +437,7 @@ const checkTextDecoration = textDecoration => {
} }
/**网络图片转成本地资源 */ /**网络图片转成本地资源 */
const createLocalImg = ({ const createLocalImg = ({ filePath, fileId }, callBack) => {
filePath,
fileId
}, callBack) => {
wx.getImageInfo({ wx.getImageInfo({
src: filePath, src: filePath,
success(res) { success(res) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!