Commit 1fd3e5c1 by 张立顺

bug修复

1 parent 2675e99c
...@@ -6,26 +6,25 @@ Component({ ...@@ -6,26 +6,25 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
// 默认母链海报 不是须样式须单独处理 通过item.type 区分类型
item: { item: {
type: Object, type: Object,
observer(n) { observer(n) {
n.posterUrl && this.checkUrl() n.posterUrl &&
// this.check(n) this.checkUrl()
// .then(res => { .then(result => {
// if (res) result &&
// this.setData({ this.setData({
// poster: res, poster: result,
// show: true show: true
// }) })
// else this.begin() })
// }) .catch(err => {
// .catch(() => this.begin()) console.log(err)
this.begin()
})
} }
}, },
// findKey: {
// type: String,
// value: 'url'
// },
scrollImg: { scrollImg: {
type: Boolean, type: Boolean,
value: true value: true
...@@ -37,47 +36,58 @@ Component({ ...@@ -37,47 +36,58 @@ Component({
*/ */
data: { data: {
_item_: null, _item_: null,
findKey: 'urlLink' findKey: 'posterUrl',
height: '68%'
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
// 图片缓存 有取小程序缓存图片
checkUrl() { checkUrl() {
let { item } = this.data let { item: postObj } = this.data
const fileList = wx.$storage.get('fileList') || [], const fileList = wx.$storage.get('fileList') || [],
fn = wx.getFileSystemManager(), fn = wx.getFileSystemManager(),
{ findKey } = this.data { findKey } = this.data
// url
// return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (fileList.length) { return reject()
fn.readdir({ if (fileList.length) {
dirPath: wx.env.USER_DATA_PATH, fn.readdir({
success({ files }) { dirPath: wx.env.USER_DATA_PATH,
console.log(files, '文件列表') success({ files }) {
if (files.length < 21) { let obj = fileList.find(e => e[findKey] === postObj[findKey])
let item = fileList.find(e => e[findKey] === n[findKey]) const poster = files.find(s => obj?.path.includes(s))
if (item) { wx.hideLoading()
const poster = files.find(s => s.includes(item.fileId)) // console.log(poster)
wx.hideLoading() // 处理图片文件缓存太多的问题
if (poster) resolve(`${wx.env.USER_DATA_PATH}/${poster}`) let filesLength = files.length
else reject() console.log(files)
} else reject() if (filesLength > 21) {
} else { files.map((e, index) => {
wx.$storage.rm('fileList') // debugger
files.map(e => { // console.log(filesLength - index > 21)
fn.unlink({ filesLength - index > 21 &&
filePath: `${wx.env.USER_DATA_PATH}/${e}` index != 0 &&
fn.unlink({
filePath: `${wx.env.USER_DATA_PATH}/${e}`,
fail(res) {
console.error(res)
}
})
}) })
}) }
reject() // console.log(poster)
if (poster) {
resolve(`${wx.env.USER_DATA_PATH}/${poster}`)
} else {
reject()
}
} }
} })
}) } else reject()
} })
// else reject()
// })
}, },
begin() { begin() {
let { item } = this.data let { item } = this.data
...@@ -89,24 +99,25 @@ Component({ ...@@ -89,24 +99,25 @@ Component({
}) })
}, },
getImageInfo(n) { getImageInfo(n) {
console.log(n) // console.log(n)
wx.$api.showLoading('处理中') wx.$api.showLoading('处理中')
let that = this let that = this
wx.getImageInfo({ wx.getImageInfo({
src: `${n.posterUrl}?v=${Date.now()}`, src: `${n.posterUrl}?v=${Date.now()}`,
success: function (res) { success: function (res) {
console.log(res) // console.log(res)
// w = res.width // w = res.width
// h = res.height // h = res.height
that.init(n, res.width, res.height) that.init(n, res.width, res.height)
}, },
fail: function (res) { fail: function (res) {
console.log(res) // console.log(res)
wx.$api.showToast('生成失败') wx.$api.showToast('生成失败')
} }
}) })
}, },
async init(n, ImgWidth, ImgHeight) { async init(n, ImgWidth, ImgHeight) {
const { findKey } = this.data
// debugger // debugger
// const {pixelRatio} = wx.getWindowInfo() // const {pixelRatio} = wx.getWindowInfo()
let actualWidth = 247 //默认宽度 let actualWidth = 247 //默认宽度
...@@ -123,6 +134,11 @@ Component({ ...@@ -123,6 +134,11 @@ Component({
// console.log(actualHeight) // console.log(actualHeight)
// 默认母链海报 不是须单独处理
this.setData({
width: actualWidth + 32,
height: actualHeight + 82
})
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( // 大画布
{ {
...@@ -134,8 +150,10 @@ Component({ ...@@ -134,8 +150,10 @@ Component({
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 console.log(merchantName)
console.log(n.activityName)
// debugger
let imageList = [ let imageList = [
{ {
x: 0, x: 0,
...@@ -186,7 +204,8 @@ Component({ ...@@ -186,7 +204,8 @@ Component({
} }
} }
] ]
if ((n.type = 'warReport')) {
if (n.type == 'warReport') {
imageList = [ imageList = [
{ {
x: 0, x: 0,
...@@ -198,22 +217,50 @@ Component({ ...@@ -198,22 +217,50 @@ Component({
] ]
textList = [] textList = []
} }
let res = await drawfun.begin({ let res = await drawfun.begin({
imageList, imageList,
textList textList
}) })
console.log(res) // console.log(res)
wx.hideLoading() wx.hideLoading()
this.setData({ this.setData({
poster: res.path, poster: res.path,
show: true show: true
}) })
let fileList = wx.$storage.get('fileList') || [] let fileList = wx.$storage.get('fileList') || []
fileList.push({ // console.log([findKey])
// this.setData({
// [findKey]: n[findKey]
// })
// 去重
// debugger
// let fileLength = fileList.length
let obj = {
fileId: res.fileId, fileId: res.fileId,
path: res.path path: res.path,
// [findKey]: n[findKey] [findKey]: n[findKey]
}) }
// console.log(fileLength)
// if (fileLength) {
// fileList.forEach((item, index) => {
// // console.log(index)
// console.log(condition.posterUrl == n.posterUrl)
// if (condition.posterUrl == n.posterUrl) {
// item = obj
// } else if (index == fileLength) {
// fileList.unshift(obj)
// }
// })
// } else {
// fileList.unshift(obj)
// }
fileList.unshift(obj)
// console.log(fileList)
// fileList = [...fileList, ...fileList]
fileList = fileList.slice(0, 21)
// console.log(fileList)
wx.$storage.set('fileList', fileList) wx.$storage.set('fileList', fileList)
}, },
download() { download() {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
.poster { .poster {
box-sizing: border-box; box-sizing: border-box;
width: 500rpx; width: 500rpx;
height: 68%; max-height: 68%;
// height: 1108rpx; // height: 1108rpx;
overflow: scroll; overflow: scroll;
border-radius: 8rpx 8rpx 0 0; border-radius: 8rpx 8rpx 0 0;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<!-- catchtouchmove="noScroll" 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}}"> <view class="poster {{item.type == 'warReport'?'pd':''}}" style="height:{{height}}">
<view class="poster {{item.type == 'warReport'?'pd':''}}"> <block wx:if="{{scrollImg}}">
<scroll-view scroll-y scroll-x="false" style="height: 100%"> <scroll-view scroll-y scroll-x="false" style="height: 100%">
<image <image
src="{{poster}}" src="{{poster}}"
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
show-menu-by-longpress show-menu-by-longpress
bindlongpress="longpress" /> bindlongpress="longpress" />
</scroll-view> </scroll-view>
</view> <!-- </view> -->
</block> </block>
<block wx:else> <block wx:else>
<view class="poster {{item.type == 'warReport'?'pd':''}}"> <!-- <view class="poster {{item.type == 'warReport'?'pd':''}}"> -->
<scroll-view scroll-y scroll-x="false" style="height: 100%"> <scroll-view scroll-y scroll-x="false" style="height: 100%">
<image <image
src="{{poster}}" src="{{poster}}"
...@@ -23,8 +23,9 @@ ...@@ -23,8 +23,9 @@
show-menu-by-longpress show-menu-by-longpress
bindlongpress="longpress" /> bindlongpress="longpress" />
</scroll-view> </scroll-view>
</view> <!-- </view> -->
</block> </block>
</view>
<view class="btn"> <view class="btn">
<glsx-image src="output/longtap.png" class="icon" /> <glsx-image src="output/longtap.png" class="icon" />
长按图片转发 长按图片转发
......
...@@ -68,10 +68,8 @@ Page({ ...@@ -68,10 +68,8 @@ Page({
wx.$api.showToast('申请成功') wx.$api.showToast('申请成功')
setTimeout(() => { setTimeout(() => {
wx.$router.back(page => { wx.$router.back(page => {
// console.log()
// console.log(node.getClueInit)
let node = page.selectComponent('#indexclue') let node = page.selectComponent('#indexclue')
node.getClueInit && node.getClueInit() node && node.getClueInit()
}) })
}, 1000) }, 1000)
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import mineApi from '~/api/mineApi/index' import mineApi from '~/api/mineApi/index'
// import { handleCopy } from '~/utils/utils_wx' // import { handleCopy } from '~/utils/utils_wx'
import outputApi from '~/api/outputApi/index' import outputApi from '~/api/outputApi/index'
import { deleteSecond } from '~/utils/format'
// import drawQrcode from '~/utils/lib/weapp-qrcode.js' // import drawQrcode from '~/utils/lib/weapp-qrcode.js'
Component({ Component({
options: { options: {
...@@ -88,45 +89,49 @@ Component({ ...@@ -88,45 +89,49 @@ Component({
}, },
showPoster(e) { showPoster(e) {
const { item } = e.currentTarget.dataset const { item } = e.currentTarget.dataset
let updatedTime = deleteSecond(item.updatedTime)
this.setData({ this.setData({
// findKey: 'crowdFundActivityId', // findKey: 'crowdFundActivityId',
posterItem: { posterItem: {
activityName: item.activityName, activityName: item.activityName,
posterUrl: item.valueUrl, posterUrl: item.valueUrl,
crowdFundActivityId: item.valueUrl, updatedTime,
// crowdFundActivityId: item.valueUrl,
type: 'warReport' type: 'warReport'
} }
}) })
}, },
async copyLink(e) { async copyLink(e) {
const { item } = e.currentTarget.dataset, const { item } = e.currentTarget.dataset
posterObj = this.selectComponent('#poster') // posterObj = this.selectComponent('#poster')
// this.setData({ // this.setData({
// findKey: 'activityId' // findKey: 'activityId'
// }) // })
try { // try {
let flag = await posterObj.check(item) // let flag = await posterObj.check(item)
posterObj.setData({ // posterObj.setData({
poster: flag, // poster: flag,
show: true // show: true
// })
// } catch (error) {
wx.$api.showLoading('加载中...')
outputApi
.getPosterUrl({
id: item.crowdFundActivityId
}) })
} catch (error) { .then(res => {
wx.$api.showLoading('加载中...') item.posterUrl = res
outputApi item.type = 'motherChainPoster'
.getPosterUrl({ console.log(item)
id: item.crowdFundActivityId this.setData({
}) posterItem: item,
.then(res => { isShowTip: false
item.posterUrl = res
this.setData({
posterItem: item,
isShowTip: false
})
}) })
.catch(() => { })
wx.$api.showToast('下载海报失败') .catch(() => {
}) wx.$api.showToast('下载海报失败')
} })
// }
}, },
share(e) { share(e) {
// console.log(e) // console.log(e)
......
// pages/apply/apply.js
const navStyle = 'background-color: transparent;'
import { IMG_URL } from '~/utils/constantData.js'
import applyApi from '~/api/applyApi/index'
// `${IMG_URL}index/car2.png`,
//本地图片路径
let IMG_URLLocal = '../../images/'
Page({
/**
* 页面的初始数据
*/
data: {
navStyle,
IMG_URL,
carObj: {
name: '',
model: '',
selNum: '',
contact: '',
phone: ''
}
},
// navbar高度设置
navbarReady(e) {
let { height, statusBarHeight } = e.detail
this.setData({
tabBarStyle: height / 2 + statusBarHeight
// headerHeight: height / 2 + statusBarHeight + 88*2
})
},
// 提交信息
applyFn() {
let { name } = this.data.carObj
console.log('name: ', name)
if (!name) {
wx.pro.showToast({
title: '请输入开店名称',
icon: 'error'
})
return
}
this.submitForm()
// console.log(123)
},
submitForm() {
let { carObj, clueId } = this.data
let { userInfo } = wx.$storage.get()
let MerchantInfo = userInfo.subLoginUser
let params = {
serviceMerchantId: MerchantInfo.merchantId,
serviceMerchantName: MerchantInfo.merchantName,
serviceMerchantPhone: MerchantInfo.phone,
merchantContact: carObj.contact,
phone: carObj.phone,
applyMerchantName: carObj.name,
carType: carObj.model,
baseCustomer: carObj.selNum,
clueId
}
// return wx.$api.showToast('申请成功')
applyApi
.merchantApply(params)
.then(result => {
console.log(result)
if (result) {
wx.$api.showToast('申请成功')
setTimeout(() => {
wx.$router.back(page => {
let node = page.selectComponent('#indexclue')
node.getClueInit && node.getClueInit()
})
}, 1000)
}
})
.catch(err => {})
},
bindinputFn(e) {
// console.log("e: ", e);
let name = e.currentTarget.dataset.name
let content = e.detail.value
this.setData({
[`carObj.${name}`]: content
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
onRoute(params) {
// 线索id
this.setData({
clueId: params
})
// console.log('params: ', params)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
})
{
"usingComponents": {},
"navigationStyle": "custom",
"onReachBottomDistance": 10,
"enablePullDownRefresh": true
}
\ No newline at end of file \ No newline at end of file
/* pages/apply/apply.wxss */
page {
background: white;
height: 100%;
position: relative;
}
.apply {
.head {
width: 100%;
}
.introduce {
height: 360rpx;
}
.content {
padding: 16px 17px 0;
.item{
}
.top{
display: flex;
align-items: center;
.line{
width: 3px;
height: 14px;
background:var(--btnColor);
}
.title{
margin-left: 8px;
font-weight: 500;
font-size: 18px;
color: #323436;
}
}
.inp-wrap{
.title{
margin-top: 8px;
margin-bottom: 8px;
font-weight: 500;
font-size: 14px;
color: #323436;
.point{
color: #F35251;
}
}
.inp{
padding: 7px 12px;
border: 1px solid #E3E4E8;
border-radius: 2px;
}
.inp-placeholder {
font-family: PingFangSC-Regular;
font-size: 24rpx;
color: #8A8C90;
}
}
}
.btn {
width: 648rpx;
font-weight: 500;
font-size: 17px;
color: #ffffff;
background: var(--btnColor);
position: absolute;
bottom: 40rpx;
left: 50%;
transform: translateX(-50%);
}
}
<!-- pages/apply/apply.wxml -->
<navigation-bar showBack="{{true}}" bindnavbarReady="navbarReady" navStyle="{{navStyle}}">
申请业务
</navigation-bar>
<view class="apply">
<image class="head" src="{{IMG_URL}}index/apply-title.png" style="height:{{tabBarStyle}}px;" />
<image class="introduce" src="{{IMG_URL}}index/apply-bg.png" />
<view class="content" hover-class="none" hover-stop-propagation>
<view class="top">
<view class="line" hover-class="none" hover-stop-propagation="false" />
<view class="title" hover-class="none" hover-stop-propagation="false">开通门店账号</view>
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false" style="margin-top: 32rpx;">
开店名称
<text class="point">*</text>
</view>
<input class="inp" placeholder-class="inp-placeholder" value="{{carObj.name}}" bindinput="bindinputFn" data-name="name" maxlength="{{30}}" placeholder="请输入30个字符以内" />
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false">店面车型</view>
<input class="inp" placeholder-class="inp-placeholder" value="{{carObj.model}}" bindinput="bindinputFn" data-name="model" maxlength="{{30}}" placeholder="请输入30个字符以内" />
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false">店面新车销量/基盘客户</view>
<input class="inp" placeholder-class="inp-placeholder" value="{{carObj.selNum}}" bindinput="bindinputFn" data-name="selNum" maxlength="{{30}}" placeholder="请输入30个字符以内" />
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false">门店联系人</view>
<input class="inp" placeholder-class="inp-placeholder" value="{{carObj.contact}}" bindinput="bindinputFn" data-name="contact" placeholder="请输入联系人" />
</view>
<view class="inp-wrap">
<view class="title" hover-class="none" hover-stop-propagation="false">联系人手机号</view>
<input class="inp" placeholder-class="inp-placeholder" value="{{carObj.phone}}" bindinput="bindinputFn" data-name="phone" placeholder="请输入手机号" />
</view>
</view>
<button class="btn" bindtap="applyFn">提交开店信息</button>
</view>
\ No newline at end of file \ No newline at end of file
...@@ -438,14 +438,14 @@ Page({ ...@@ -438,14 +438,14 @@ 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,
crowdFundActivityId: item.valueUrl, // crowdFundActivityId: item.valueUrl,
updatedTime, updatedTime,
type: 'warReport' type: 'warReport'
} }
}) })
if (result.status && result.status != 2) { // if (result.status && result.status != 2) {
// debugger // }
} // debugger
}) })
.catch(err => {}) .catch(err => {})
}, },
......
...@@ -100,7 +100,8 @@ ...@@ -100,7 +100,8 @@
</form> </form>
</view> </view>
</view> </view>
<crowdfund-poster item="{{posterItem}}" /> <!-- -->
<crowdfund-poster wx:show="{{!guideShow}}" item="{{posterItem}}" />
<!-- 全屏视频组件 --> <!-- 全屏视频组件 -->
<FullscreenVideo id="videocomp" src="{{videoSrc}}" title="{{videoTitle}}" /> <FullscreenVideo id="videocomp" src="{{videoSrc}}" title="{{videoTitle}}" />
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!