This commit is contained in:
xyc 2025-04-16 16:15:01 +08:00
parent 1b9724ada9
commit ee27f6bf79
2 changed files with 197 additions and 177 deletions

View File

@ -1,178 +1,199 @@
<template>
<view class="content">
<view class="container">
<headers :titles="titles">
<uni-icons type="arrow-left" color="#000000" size="22px"></uni-icons>
</headers>
<view class="f-box">
<u-parse :content="content"></u-parse>
</view>
<view class="content">
<view class="container">
<headers :titles="titles">
<uni-icons type="arrow-left" color="#000000" size="22px"></uni-icons>
</headers>
<view class="f-box">
<u-parse :content="content"></u-parse>
</view>
<jushi-signature :settings="settings" base64 @cancel="signatureCancel"
@change="signatureChange"></jushi-signature>
</view>
<jushi-signature :settings="settings" base64 @cancel="signatureCancel"
@change="signatureChange"></jushi-signature>
</view>
</view>
</view>
</template>
<script>
import headers from '../../components/header/headers.vue'
import request from '@/utils/request.js'
import headers from '../../components/header/headers.vue'
import upload from '../../utils/upload';
import request from '@/utils/request.js'
export default {
data() {
return {
titles: "合同",
settings: { //
width: '750', //
height: '500', //
lineWidth: 4, //线
textColor: '#000' //
},
contentTemp: '',
content: '',
List: [],
show: false,
status: 'loading',
name: '',
Address: '',
tenantId: '',
contractData: {},
userData: {},
callback: null,
}
},
onLoad(options) {
/*this.name = option.name
this.Address = option.Address
this.tenantId = option.tenantId
console.log('name',this.name)
console.log('Address',this.Address)
console.log('tenantId',this.tenantId)*/
if (options.data) {
this.contractData = JSON.parse(decodeURIComponent(options.data));
this.callback = options.callback;
}
this.callback = options.callback;
this.userData = uni.getStorageSync('userInfo');
},
onShow() {
this.getdriveSchool()
// this.actList = ["1", "1", "1", "1", "1", ]
// 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
export default {
data() {
return {
titles: "合同",
settings: { //
width: '750', //
height: '500', //
lineWidth: 4, //线
textColor: '#000' //
},
contentTemp: '',
content: '',
userUrl: '',
List: [],
show: false,
status: 'loading',
name: '',
Address: '',
tenantId: '',
contractData: {},
userData: {},
callback: null,
}
},
onLoad(options) {
/*this.name = option.name
this.Address = option.Address
this.tenantId = option.tenantId
console.log('name',this.name)
console.log('Address',this.Address)
console.log('tenantId',this.tenantId)*/
if (options.data) {
this.contractData = JSON.parse(decodeURIComponent(options.data));
this.callback = options.callback;
}
this.callback = options.callback;
this.userData = uni.getStorageSync('userInfo');
// tempFilePath
uni.$off('tempFilePath');
uni.$on('tempFilePath', (data) => {
console.log('Received tempFilePath:', data);
//
upload({
url: '/app-api/small-upload/common/upload',
filePath: data,
}).then((res) => {
this.userUrl = res.data.url
console.log(this.userUrl, 'userUrl');
this.signatureChange()
})
});
//
for (const [key, value] of Object.entries(this.contractData)) {
this.content = this.content.replace(
new RegExp(`&nbsp;${key}&nbsp;|${key}`, 'g'),
value
);
}
},
onShow() {
this.getdriveSchool()
// this.actList = ["1", "1", "1", "1", "1", ]
// 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>`);
this.content = this.content.replace(/<u[^>]*>([^<]*)type([^<]*)<\/u>/g, `<u>$1${this.contractData.type}$2</u>`);
//
for (const [key, value] of Object.entries(this.contractData)) {
this.content = this.content.replace(
new RegExp(`&nbsp;${key}&nbsp;|${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() {
uni.navigateBack()
},
async signatureChange(e) {
this.imgUrl = e
let res = await request({
url: '/app-api/small/driveSchool/obtainContract',
method: 'post',
data: {
userName: this.contractData.name,
tenantId: this.tenantId,
userId: this.userData.id,
content: this.content,
}
})
console.log(res);
uni.showToast({
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) { // onLoadcallback
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); // 30003
signatureCancel() {
uni.navigateBack()
},
async signatureChange(e) {
this.imgUrl = e
let res = await request({
url: '/app-api/small/driveSchool/obtainContract',
method: 'post',
data: {
userName: this.contractData.name,
tenantId: this.tenantId,
userId: this.userData.id,
content: this.content,
userUrl: this.userUrl,
}
})
console.log(res);
uni.showToast({
title: '报名成功',
duration: 3000
// const index = e.lastIndexOf("/")
// let fileName = e.substring(index + 1, e.length)
// this.uploadFile(this.imgUrl, fileName)
});
},
goback() {
uni.navigateBack()
},
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2];
}
}
if (prevPage && (prevPage.route === 'pagesA/register/index' || prevPage.route ===
'/pagesA/register/index')) {
if (this.callback) { // onLoadcallback
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); // 30003
// const index = e.lastIndexOf("/")
// let fileName = e.substring(index + 1, e.length)
// this.uploadFile(this.imgUrl, fileName)
},
goback() {
uni.navigateBack()
},
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
.content {
background: #f4f5f6;
height: 100vh;
}
height: 100vh;
}
.container {
width: 100%;
background: #f4f5f6;
box-sizing: border-box;
padding-top: 88px;
}
.container {
width: 100%;
background: #f4f5f6;
box-sizing: border-box;
padding-top: 88px;
}
.f-box {
width: 100%;
box-sizing: border-box;
padding: 15px;
}
</style>
.f-box {
width: 100%;
box-sizing: border-box;
padding: 15px;
}
</style>

View File

@ -141,7 +141,7 @@
success: function(res) {
console.log(res, '签名');
//base64
that.emit(res.tempFilePath)
uni.$emit('tempFilePath', res.tempFilePath)
},
fail(e) {
console.log(JSON.stringify(e))
@ -149,20 +149,20 @@
}, this)
},
reset() {
let that = this
uni.getSystemInfo({
success: function(res) {
ctx.clearRect(0, 0, res.windowWidth, res.windowHeight)
ctx.draw(true)
// #ifdef MP-WEIXIN
that.setCanvasBg()
// #endif
that.setPaintStyle()
},
})
tempPoint = []
// emit
},
let that = this
uni.getSystemInfo({
success: function(res) {
ctx.clearRect(0, 0, res.windowWidth, res.windowHeight)
ctx.draw(true)
// #ifdef MP-WEIXIN
that.setCanvasBg()
// #endif
that.setPaintStyle()
},
})
tempPoint = []
// emit
},
emit(tempFilePath) {
this.$emit('change', tempFilePath)
},
@ -226,11 +226,11 @@
}
.clear {}
.reset {
background: #FF9900;
color: white;
}
background: #FF9900;
color: white;
}
.sign-area {
position: absolute;
@ -240,5 +240,4 @@
font-size: 130rpx;
transform: rotate(-20deg);
}
</style>