Commit 2892c6cd by 张立顺

合并v4.16.0代码

1 parent 7e1ca638
...@@ -33,6 +33,7 @@ App({ ...@@ -33,6 +33,7 @@ App({
getUpdateManager() getUpdateManager()
// 如果是带参数的小程序码进入 会处理后把参数存到wx.$SCENE // 如果是带参数的小程序码进入 会处理后把参数存到wx.$SCENE
// options.query.scene = 2 //调试用 // options.query.scene = 2 //调试用
console.log(options, 'options')
if (options) { if (options) {
let res = checkScene(options) let res = checkScene(options)
// 如果需要重新登录 // 如果需要重新登录
......
image{ image {
width: 100%; width: 100%;
height: 100%; height: 100%;
vertical-align: top; vertical-align: top;
} }
.y-center{
.y-center {
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
} }
.x-center{
.x-center {
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
} }
.box-center{
.box-center {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%,-50%); transform: translate(-50%, -50%);
} }
.text-hide { .text-hide {
white-space:nowrap; white-space: nowrap;
overflow:hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow: ellipsis;
} }
.text-center{
.text-center {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.isFullSucreen { .isFullSucreen {
padding-bottom: 34px !important; padding-bottom: 34px !important;
} }
...@@ -34,17 +40,19 @@ image{ ...@@ -34,17 +40,19 @@ image{
.isFullSucreen-bottom { .isFullSucreen-bottom {
bottom: 34px !important; bottom: 34px !important;
} }
.list-nothing{
.list-nothing {
padding: 30rpx 0; padding: 30rpx 0;
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;
color: #666666; color: #666666;
} }
.list-not{
.list-not {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #999; color: #999;
font-size: 24rpx; font-size: 24rpx;
height: 100%; height: 100%;
} }
\ No newline at end of file \ No newline at end of file
import { commonApi, equityApi } from '../../../api/api'
Page({
data: {
tempFilePath: '',
hideModal: true,
hasDraw: false,
canvasName: '#handWriting',
ctx: '',
canvasWidth: 0,
canvasHeight: 0,
startPoint: {
x: 0,
y: 0,
},
selectColor: 'black',
lineColor: '#282829', // 颜色
lineSize: 3, // 笔记倍数
radius: 1.5, //画圆的半径
showPlaceHoder: true,
signImage: ''
},
onLoad(options) {
let carInfo = JSON.parse(decodeURIComponent(options.carInfo))
let that = this
let query = wx.createSelectorQuery().in(this); //获取自定义组件的SelectQuery对象
this.canvasCtx = wx.createCanvasContext('signature', that)
// 设置线的样式
this.canvasCtx.setFillStyle("white");
this.canvasCtx.fillRect(0, 0, 600, 600);
this.canvasCtx.setLineCap("round");
this.canvasCtx.setLineJoin("round");
// 初始化颜色
this.canvasCtx.setStrokeStyle(that.data.selectColor);
let str = ''
let temp = []
if(carInfo){
carInfo.serviceItemsList.forEach(item=>{
temp.push(item.serviceItemName)
})
}
str = temp.join('、')
query.select('.modal-canvas').boundingClientRect(rect => {
this.setData({
canvasWidth: rect.width,
canvasHeight: rect.height,
carInfo,
serviceItemStr:str
});
}).exec();
},
scaleStart(event) {
if (event.type != 'touchstart') return false;
let currentPoint = {
x: event.touches[0].x,
y: event.touches[0].y
}
this.drawCircle(currentPoint);
this.setData({
startPoint: currentPoint,
hasDraw: true,
showPlaceHoder: false
});
},
scaleMove(event) {
if (event.type != "touchmove") return false;
let {
startPoint
} = this.data
let currentPoint = {
x: event.touches[0].x,
y: event.touches[0].y
}
this.drawLine(startPoint, currentPoint)
this.setData({
startPoint: currentPoint
})
},
scaleEnd(e) {
this.setData({
isStart: true
})
},
drawCircle(point) { //这里负责点
let ctx = this.canvasCtx;
ctx.beginPath();
// ctx.fillStyle = this.data.lineColor;
ctx.setFillStyle(this.data.lineColor)
//笔迹粗细由圆的大小决定
ctx.arc(point.x, point.y, this.data.radius, 0, 2 * Math.PI);
ctx.fill();
ctx.closePath();
ctx.draw(true)
},
drawLine(sourcePoint, targetPoint) {
let ctx = this.canvasCtx;
this.drawCircle(targetPoint);
ctx.beginPath();
// ctx.strokeStyle = this.data.lineColor;
ctx.setStrokeStyle(this.data.lineColor)
// ctx.lineWidth = this.data.radius * 2; //这里乘2是因为线条的粗细要和圆的直径相等
ctx.setLineWidth(this.data.radius * 2)
ctx.moveTo(sourcePoint.x, sourcePoint.y);
ctx.lineTo(targetPoint.x, targetPoint.y);
ctx.stroke();
ctx.closePath();
},
clearCanvas() { //清空画布
let ctx = this.canvasCtx;
ctx.clearRect(0, 0, this.data.canvasWidth, this.data.canvasHeight);
ctx.fillStyle = 'rgba(0, 0, 0, .1)';
ctx.draw()
this.setData({
hasDraw: false, //未签字
showPlaceHoder: true,
signImage: ''
})
},
getTempFile() {
return {
tempFilePath: this.data.tempFilePath
}
},
saveToImage() {
let {
hasDraw,
canvasHeight,
canvasWidth
} = this.data
let that = this
if (!hasDraw) {
wx.showToast({
title: '还未签字哟!',
icon: 'none',
mask: true
})
return
}
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: canvasWidth,
height: canvasHeight,
canvasId: 'signature',
// fileType:'jpg',
success(res) {
if (res.tempFilePath) {
that.toUploadImage(res.tempFilePath)
}
},
fail(err) {
console.log(err);
}
}, that)
},
toRedirect() {
wx.redirectTo({
url: '/packageEquity/pages/claimsNoteDetail/claimsNoteDetail'
})
},
toFullPage() {
wx.navigateTo({
url: '/packageEquity/pages/fullSignture/fullSignture?writeOffCode='+this.data.carInfo.writeOffCode,
});
},
// 上传图片
toUploadImage(tempFilePaths) {
let _this = this
const tempFiles = tempFilePaths
let imgType = tempFiles.split('.')[1]
let type = imgType == 'unknown' ? 'jpg' : imgType
wx.getFileSystemManager().readFile({
filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式
success(_res) {
wx.$util.showLoading('上传中...')
commonApi.uploadImg({
file: `${type}@${_res.data}`
}).then(img => {
_this.saveToHttp(img)
})
},
fail() {
wx.$util.hideLoading()
}
})
},
// 上传签名到后端
saveToHttp(signUrl) {
let para = {
writeOffCode: this.data.carInfo.writeOffCode,
signUrl
}
equityApi.signSumbit(para).then(res => {
wx.$util.hideLoading()
wx.navigateBack({
delta: 1
});
})
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
page {
background: white;
}
.signature-wrap {
padding: 16rpx 32rpx;
}
.h3 {
text-indent: 2em;
}
.descText {
font-size: 28rpx;
font-weight: 400;
color: #282829;
line-height: 44rpx;
}
.title {
font-size: 32rpx;
font-weight: 500;
color: #282829;
line-height: 44rpx;
margin-top: 32rpx;
margin-bottom: 16rpx;
}
.canvas_wrap {
width: 686rpx;
height: 560rpx;
border-radius: 8rpx;
border: 2rpx solid rgba(201, 202, 204, 0.3);
position: relative;
}
.coverImage{
width: 686rpx;
height: 560rpx;
}
.full_icon{
position: absolute;
right: 16rpx;
top: 16rpx;
z-index: 10000;
}
.full_icon .icon{
width: 40rpx;
height: 40rpx;
}
.full_icon .full_text{
font-size: 24rpx;
font-weight: 400;
color: #CCCCCC;
}
.placehoder {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-size: 32rpx;
font-weight: 500;
color: #DFDFDF;
}
.btn_group {
margin-top: 64rpx;
}
.btn_group .btn {
width: calc(50% - 13px);
height: 88rpx;
border-radius: 8rpx;
border: 2rpx solid #B1B1B3;
font-size: 32rpx;
font-weight: 500;
color: #656566;
}
.btn_group .btn_active{
background: #FC5B32;
color: #FFFFFF;
border: none;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
.flex_scb {
display: flex;
align-items: center;
justify-content: space-between;
}
.modal-canvas {
width: 686rpx;
height: 560rpx;
margin: 0 auto;
margin-bottom: 30rpx;
border-radius: 18rpx;
box-sizing: border-box;
overflow: hidden;
background-color: #FFFFFF;
}
\ No newline at end of file \ No newline at end of file
<view class="signature-wrap">
<view class="descprion_wrap">
<view class="descText">尊敬的客户,您好!</view>
<view class="h3 descText">感谢您对我们的数字化无忧卡权益服务的认可与支持!</view>
<view class="h3 descText">
为进一步提高权益服务质量,您申请的{{serviceItemStr}}已被受理,请确认您的爱车(车架号:{{carInfo.vin}},车型:{{carInfo.vehicleBrandName || ''}}{{carInfo.vehicleSeriesName || ''}}{{carInfo.vehicleShapeName || ''}}),是否已到{{carInfo.merchantName}}进行服务。
</view>
<view class="h3 descText">
为保障您的权益,与您约定如下,您同意本次权益服务申请,以实物赔付形式,完成此次权益服务赔付,保障范围内的补偿费用由我司直接与程辉丰田店结算。 感谢您的配合,请在确认以上信息后在下面的空白框内签字确认,谢谢!
</view>
</view>
<view class="title">签字处</view>
<view wx:if="{{!signImage}}" class="canvas_wrap">
<canvas canvas-id="signature" class="modal-canvas" disable-scroll="{{true}}" id="handWriting" bindtouchstart="scaleStart" bindtouchmove="scaleMove" bindtouchend="scaleEnd"></canvas>
<view wx:if="{{showPlaceHoder}}" class="placehoder">手写签名</view>
<cover-view bind:tap="toFullPage" class="full_icon flex_scb">
<cover-image webp mode="widthFix" class="icon" src="{{IMGURL}}equity/claims/sign_full.png?v={{img_version}}" />
<cover-view class="full_text">全屏</cover-view>
</cover-view>
</view>
<view wx:else class="canvas_wrap">
<image class="coverImage" src="{{signImage}}" />
</view>
<view class="btn_group flex_scb">
<view bind:tap="clearCanvas" class="btn flex_cc">重签</view>
<view bind:tap="saveToImage" class="btn flex_cc btn_active">确认</view>
</view>
<view style="height:68rpx"></view>
</view>
\ No newline at end of file \ No newline at end of file
{ {
"setting": { "setting": {
"compileHotReLoad": true, "compileHotReLoad": true,
"urlCheck": false "urlCheck": false,
"preloadBackgroundData": false
}, },
"projectname": "dj-car-boutique-work-wechat", "projectname": "dj-car-boutique-work-wechat",
"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",
...@@ -130,5 +131,5 @@ ...@@ -130,5 +131,5 @@
] ]
} }
}, },
"libVersion": "2.28.1" "libVersion": "2.22.1"
} }
\ No newline at end of file \ No newline at end of file
// const api = wx.$request // const api = wx.$request
import api from '~/utils/request/request.js' import api from '~/utils/request/request.js'
// const api = wx.$request
module.exports = { module.exports = {
/** 预约列表 */ /** 预约列表 */
getInviteList(data) { getInviteList(data) {
......
// const api = wx.$request
import api from '~/utils/request/request.js' import api from '~/utils/request/request.js'
// const api = wx.$request
module.exports = { module.exports = {
/**获取当前登录账号能查看的园区店列表 */ /**获取当前登录账号能查看的园区店列表 */
getYQList() { getYQList() {
......
// const api = wx.$request // const api = wx.$request
import api from '~/utils/request/request.js' import api from '~/utils/request/request.js'
// const api = wx.$request
module.exports = { module.exports = {
/**退出*/ /**退出*/
logout() { logout() {
......
// const api = wx.$request // const api = wx.$request
import api from '~/utils/request/request.js' import api from '~/utils/request/request.js'
// const api = wx.$request
module.exports = { module.exports = {
/**获取当前登录账号能查看的园区店列表 */ /**获取当前登录账号能查看的园区店列表 */
getYQList() { getYQList() {
......
// const api = wx.$request // const api = wx.$request
import api from '~/utils/request/request.js' import api from '~/utils/request/request.js'
// const api = wx.$request
module.exports = { module.exports = {
/** 工单列表 */ /** 工单列表 */
getWorkList(data) { getWorkList(data) {
......
/**
* 设置监听器
*/
const watch = page => {
let {
watch
} = page
if(watch){
Object.keys(watch).forEach(val => {
let key = val.split('.')
let nowData = page
for (let i = 0; i < key.length - 1; i++) {
nowData = nowData[key[i]]
}
let lastKey = key[key.length - 1]
let watchFun = watch[val].handler || watch[val]
let deep = watch[val].deep
observe(nowData, lastKey, watchFun, deep, page)
})
}
}
/**
* 监听属性 并执行监听函数
*/
const observe = (obj, key, watchFun, deep, page) => {
let val = obj[key]
if (deep && val != null && typeof val === 'object') {
Object.keys(val).forEach(childKey => {
observe(val, childKey, watchFun, deep, page)
})
}
Object.defineProperty(obj, key, {
configurable: true,
enumerable: true,
set(value) {
watchFun.call(page, value, val)
val = value
if (deep) {
observe(obj, key, watchFun, deep, page)
}
},
get() {
return val
}
})
}
export default watch
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!