更新
This commit is contained in:
parent
1b9724ada9
commit
ee27f6bf79
@ -1,178 +1,199 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<headers :titles="titles">
|
<headers :titles="titles">
|
||||||
<uni-icons type="arrow-left" color="#000000" size="22px"></uni-icons>
|
<uni-icons type="arrow-left" color="#000000" size="22px"></uni-icons>
|
||||||
</headers>
|
</headers>
|
||||||
<view class="f-box">
|
<view class="f-box">
|
||||||
<u-parse :content="content"></u-parse>
|
<u-parse :content="content"></u-parse>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<jushi-signature :settings="settings" base64 @cancel="signatureCancel"
|
<jushi-signature :settings="settings" base64 @cancel="signatureCancel"
|
||||||
@change="signatureChange"></jushi-signature>
|
@change="signatureChange"></jushi-signature>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import headers from '../../components/header/headers.vue'
|
import headers from '../../components/header/headers.vue'
|
||||||
import request from '@/utils/request.js'
|
import upload from '../../utils/upload';
|
||||||
|
import request from '@/utils/request.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
titles: "合同",
|
titles: "合同",
|
||||||
settings: { //签名设置
|
settings: { //签名设置
|
||||||
width: '750', //签名区域的宽
|
width: '750', //签名区域的宽
|
||||||
height: '500', //签名区域的高
|
height: '500', //签名区域的高
|
||||||
lineWidth: 4, //签名时线宽
|
lineWidth: 4, //签名时线宽
|
||||||
textColor: '#000' //签名文字颜色
|
textColor: '#000' //签名文字颜色
|
||||||
},
|
},
|
||||||
contentTemp: '',
|
contentTemp: '',
|
||||||
content: '',
|
content: '',
|
||||||
List: [],
|
userUrl: '',
|
||||||
show: false,
|
List: [],
|
||||||
status: 'loading',
|
show: false,
|
||||||
name: '',
|
status: 'loading',
|
||||||
Address: '',
|
name: '',
|
||||||
tenantId: '',
|
Address: '',
|
||||||
contractData: {},
|
tenantId: '',
|
||||||
userData: {},
|
contractData: {},
|
||||||
callback: null,
|
userData: {},
|
||||||
}
|
callback: null,
|
||||||
},
|
}
|
||||||
onLoad(options) {
|
},
|
||||||
/*this.name = option.name
|
onLoad(options) {
|
||||||
this.Address = option.Address
|
/*this.name = option.name
|
||||||
this.tenantId = option.tenantId
|
this.Address = option.Address
|
||||||
console.log('name',this.name)
|
this.tenantId = option.tenantId
|
||||||
console.log('Address',this.Address)
|
console.log('name',this.name)
|
||||||
console.log('tenantId',this.tenantId)*/
|
console.log('Address',this.Address)
|
||||||
if (options.data) {
|
console.log('tenantId',this.tenantId)*/
|
||||||
this.contractData = JSON.parse(decodeURIComponent(options.data));
|
if (options.data) {
|
||||||
this.callback = options.callback;
|
this.contractData = JSON.parse(decodeURIComponent(options.data));
|
||||||
}
|
this.callback = options.callback;
|
||||||
this.callback = options.callback;
|
}
|
||||||
this.userData = uni.getStorageSync('userInfo');
|
this.callback = options.callback;
|
||||||
},
|
this.userData = uni.getStorageSync('userInfo');
|
||||||
onShow() {
|
// 监听 tempFilePath 事件
|
||||||
this.getdriveSchool()
|
uni.$off('tempFilePath');
|
||||||
// this.actList = ["1", "1", "1", "1", "1", ]
|
uni.$on('tempFilePath', (data) => {
|
||||||
// this.status = "nomore" 底部刷新结束
|
console.log('Received tempFilePath:', data);
|
||||||
},
|
//上传图片
|
||||||
onPullDownRefresh() {
|
upload({
|
||||||
console.log("刷新");
|
url: '/app-api/small-upload/common/upload',
|
||||||
uni.stopPullDownRefresh()
|
filePath: data,
|
||||||
},
|
}).then((res) => {
|
||||||
onReachBottom() {
|
this.userUrl = res.data.url
|
||||||
// this.show = true
|
console.log(this.userUrl, 'userUrl');
|
||||||
setTimeout(() => {
|
this.signatureChange()
|
||||||
console.log("加载执行");
|
})
|
||||||
}, 2000)
|
});
|
||||||
},
|
|
||||||
components: {
|
|
||||||
headers
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async getdriveSchool() {
|
|
||||||
let res = await request({
|
|
||||||
url: `/app-api/small/driveSchool/obtainContract/tenantId/${this.contractData.tenantId}`,
|
|
||||||
method: 'get',
|
|
||||||
})
|
|
||||||
this.content = res.data.content
|
|
||||||
|
|
||||||
// 执行替换
|
},
|
||||||
for (const [key, value] of Object.entries(this.contractData)) {
|
onShow() {
|
||||||
this.content = this.content.replace(
|
this.getdriveSchool()
|
||||||
new RegExp(` ${key} |${key}`, 'g'),
|
// this.actList = ["1", "1", "1", "1", "1", ]
|
||||||
value
|
// this.status = "nomore" 底部刷新结束
|
||||||
);
|
},
|
||||||
}
|
onPullDownRefresh() {
|
||||||
|
console.log("刷新");
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
// this.show = true
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("加载执行");
|
||||||
|
}, 2000)
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
headers
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getdriveSchool() {
|
||||||
|
let res = await request({
|
||||||
|
url: `/app-api/small/driveSchool/obtainContract/tenantId/${this.contractData.tenantId}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
this.content = res.data.content
|
||||||
|
|
||||||
// 处理特殊格式的占位符(如下划线格式)
|
// 执行替换
|
||||||
this.content = this.content.replace(/<u[^>]*>([^<]*)name([^<]*)<\/u>/g, `<u>$1${this.contractData.name}$2</u>`);
|
for (const [key, value] of Object.entries(this.contractData)) {
|
||||||
this.content = this.content.replace(/<u[^>]*>([^<]*)type([^<]*)<\/u>/g, `<u>$1${this.contractData.type}$2</u>`);
|
this.content = this.content.replace(
|
||||||
|
new RegExp(` ${key} |${key}`, 'g'),
|
||||||
|
value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理特殊格式的占位符(如下划线格式)
|
||||||
|
this.content = this.content.replace(/<u[^>]*>([^<]*)name([^<]*)<\/u>/g,
|
||||||
|
`<u>$1${this.contractData.name}$2</u>`);
|
||||||
|
this.content = this.content.replace(/<u[^>]*>([^<]*)type([^<]*)<\/u>/g,
|
||||||
|
`<u>$1${this.contractData.type}$2</u>`);
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
signatureCancel() {
|
signatureCancel() {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
},
|
},
|
||||||
async signatureChange(e) {
|
async signatureChange(e) {
|
||||||
this.imgUrl = e
|
this.imgUrl = e
|
||||||
let res = await request({
|
let res = await request({
|
||||||
url: '/app-api/small/driveSchool/obtainContract',
|
url: '/app-api/small/driveSchool/obtainContract',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: {
|
data: {
|
||||||
userName: this.contractData.name,
|
userName: this.contractData.name,
|
||||||
tenantId: this.tenantId,
|
tenantId: this.tenantId,
|
||||||
userId: this.userData.id,
|
userId: this.userData.id,
|
||||||
content: this.content,
|
content: this.content,
|
||||||
}
|
userUrl: this.userUrl,
|
||||||
})
|
}
|
||||||
console.log(res);
|
})
|
||||||
uni.showToast({
|
console.log(res);
|
||||||
title: '报名成功',
|
uni.showToast({
|
||||||
duration: 3000
|
title: '报名成功',
|
||||||
|
duration: 3000
|
||||||
});
|
|
||||||
|
|
||||||
const pages = getCurrentPages();
|
|
||||||
const prevPage = pages[pages.length - 2];
|
|
||||||
|
|
||||||
if (prevPage && (prevPage.route === 'pagesA/register/index' || prevPage.route === '/pagesA/register/index')) {
|
|
||||||
if (this.callback) { // 从onLoad中获取的callback
|
|
||||||
try {
|
|
||||||
const callback = decodeURIComponent(this.callback);
|
|
||||||
if (prevPage.$vm && typeof prevPage.$vm[callback] === 'function') {
|
|
||||||
prevPage.$vm[callback]();
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('回调执行失败:', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
// 在这里写需要延迟执行的代码
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/newPages/newIndex/index'
|
|
||||||
})
|
|
||||||
}, 2600); // 3000毫秒即为3秒
|
|
||||||
|
|
||||||
// const index = e.lastIndexOf("/")
|
});
|
||||||
// let fileName = e.substring(index + 1, e.length)
|
|
||||||
// this.uploadFile(this.imgUrl, fileName)
|
|
||||||
|
|
||||||
},
|
const pages = getCurrentPages();
|
||||||
|
const prevPage = pages[pages.length - 2];
|
||||||
goback() {
|
|
||||||
uni.navigateBack()
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
if (prevPage && (prevPage.route === 'pagesA/register/index' || prevPage.route ===
|
||||||
}
|
'/pagesA/register/index')) {
|
||||||
|
if (this.callback) { // 从onLoad中获取的callback
|
||||||
|
try {
|
||||||
|
const callback = decodeURIComponent(this.callback);
|
||||||
|
if (prevPage.$vm && typeof prevPage.$vm[callback] === 'function') {
|
||||||
|
prevPage.$vm[callback]();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('回调执行失败:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
// 在这里写需要延迟执行的代码
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/newPages/newIndex/index'
|
||||||
|
})
|
||||||
|
}, 2600); // 3000毫秒即为3秒
|
||||||
|
|
||||||
|
// const index = e.lastIndexOf("/")
|
||||||
|
// let fileName = e.substring(index + 1, e.length)
|
||||||
|
// this.uploadFile(this.imgUrl, fileName)
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
goback() {
|
||||||
|
uni.navigateBack()
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.content {
|
.content {
|
||||||
background: #f4f5f6;
|
background: #f4f5f6;
|
||||||
|
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #f4f5f6;
|
background: #f4f5f6;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding-top: 88px;
|
padding-top: 88px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.f-box {
|
.f-box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -141,7 +141,7 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log(res, '签名');
|
console.log(res, '签名');
|
||||||
//强制返回base64
|
//强制返回base64
|
||||||
that.emit(res.tempFilePath)
|
uni.$emit('tempFilePath', res.tempFilePath)
|
||||||
},
|
},
|
||||||
fail(e) {
|
fail(e) {
|
||||||
console.log(JSON.stringify(e))
|
console.log(JSON.stringify(e))
|
||||||
@ -149,20 +149,20 @@
|
|||||||
}, this)
|
}, this)
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
let that = this
|
let that = this
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
ctx.clearRect(0, 0, res.windowWidth, res.windowHeight)
|
ctx.clearRect(0, 0, res.windowWidth, res.windowHeight)
|
||||||
ctx.draw(true)
|
ctx.draw(true)
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
that.setCanvasBg()
|
that.setCanvasBg()
|
||||||
// #endif
|
// #endif
|
||||||
that.setPaintStyle()
|
that.setPaintStyle()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
tempPoint = []
|
tempPoint = []
|
||||||
// 注意:这里不触发任何emit事件
|
// 注意:这里不触发任何emit事件
|
||||||
},
|
},
|
||||||
emit(tempFilePath) {
|
emit(tempFilePath) {
|
||||||
this.$emit('change', tempFilePath)
|
this.$emit('change', tempFilePath)
|
||||||
},
|
},
|
||||||
@ -226,11 +226,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.clear {}
|
.clear {}
|
||||||
|
|
||||||
.reset {
|
.reset {
|
||||||
background: #FF9900;
|
background: #FF9900;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sign-area {
|
.sign-area {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -240,5 +240,4 @@
|
|||||||
font-size: 130rpx;
|
font-size: 130rpx;
|
||||||
transform: rotate(-20deg);
|
transform: rotate(-20deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue
Block a user