Browse Source

上传修改

master
前端-胡立永 3 weeks ago
parent
commit
52d1a09a57
25 changed files with 374 additions and 63 deletions
  1. +5
    -5
      api/api.js
  2. +11
    -1
      api/http.js
  3. +48
    -1
      api/model/contact.js
  4. +13
    -5
      components/canvas-drag/index.vue
  5. +3
    -0
      components/list/bossList/index.vue
  6. +5
    -1
      components/list/userList/index.vue
  7. +2
    -1
      components/list/userList/userItem.vue
  8. +2
    -0
      components/list/userList/userListSwipe.vue
  9. +2
    -1
      components/list/workList/index.vue
  10. +2
    -1
      components/list/workList/workItem.vue
  11. +4
    -1
      components/list/workList/workListSwipe.vue
  12. BIN
      doc/5284.png_860.psd
  13. BIN
      doc/j.psd
  14. +1
    -1
      pages/index/center.vue
  15. +1
    -1
      pages/index/index.vue
  16. +1
    -0
      pages_order/auth/certification.vue
  17. +24
    -3
      pages_order/contract/contractManage.vue
  18. +178
    -33
      pages_order/contract/contractManageEdit.vue
  19. +12
    -6
      pages_order/mine/collect.vue
  20. +6
    -2
      pages_order/mine/seeMy.vue
  21. BIN
      pages_order/static/contract/j.png
  22. BIN
      pages_order/static/contract/jf.png
  23. BIN
      pages_order/static/contract/yf.png
  24. +25
    -0
      utils/utils.js
  25. +29
    -0
      utils/wxBase64src.js

+ 5
- 5
api/api.js View File

@ -123,7 +123,7 @@ export function api(key, data, callback, loadingTitle) {
if (!req) {
console.error('无效key' + key);
return
return Promise.reject()
}
if (typeof callback == 'string') {
@ -140,7 +140,7 @@ export function api(key, data, callback, loadingTitle) {
let storageKey = req.url
let storage = limit[storageKey]
if (storage && new Date().getTime() - storage < req.limit) {
return
return Promise.reject()
}
limit[storageKey] = new Date().getTime()
}
@ -150,7 +150,7 @@ export function api(key, data, callback, loadingTitle) {
if (!uni.getStorageSync('token')) {
utils.toLogin()
console.error('需要登录')
return
return Promise.reject()
}
}
@ -174,10 +174,10 @@ export function api(key, data, callback, loadingTitle) {
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
}, req.debounce)
return
return Promise.reject()
}
http.http(req.url, data, callback, req.method,
return http.http(req.url, data, callback, req.method,
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
}


+ 11
- 1
api/http.js View File

@ -10,6 +10,12 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
title: title || '加载中...'
});
}
let reject, resolve;
let promise = new Promise((res, rej) => {
reject = rej
resolve = res
})
uni.request({
url: Vue.prototype.$config.baseUrl + uri,
@ -42,10 +48,12 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
});
}
callback(res.data)
callback && callback(res.data)
resolve(res.data)
},
fail: () => {
reject()
uni.showLoading({})
setTimeout(()=>{
uni.hideLoading()
@ -57,6 +65,8 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
}
}
});
return promise
}
function deleted(uri, data, callback) {


+ 48
- 1
api/model/contact.js View File

@ -33,13 +33,60 @@ const api = {
method: 'GET',
auth: true,
},
//电子合同-根据id查询电子合同详情
queryContracById: {
url: '/employ/contract/queryContracById',
method: 'GET',
auth: true,
},
//电子合同-修改
updateContract: {
url: '/employ/contract/updateContract',
method: 'POST',
auth: true,
},
//电子合同-添加
addContract: {
url: '/employ/contract/addContract',
method: 'POST',
auth: true,
},
//电子合同模板-列表
queryContractTemplateList: {
url: '/employ/contract/queryContractTemplateList',
method: 'GET',
auth: true,
},
//电子合同模板-添加
addContractTemplate: {
url: '/employ/contract/addContractTemplate',
method: 'POST',
auth: true,
},
//电子合同模板-详情
queryContractTemplateById: {
url: '/employ/contract/queryContractTemplateById',
method: 'GET',
auth: true,
},
//电子合同模板-修改
updateContractTemplate: {
url: '/employ/contract/updateContractTemplate',
method: 'POST',
auth: true,
},
//工具-图片转pdf
image2pdf: {
url: '/employ/contract/image2pdf',
method: 'GET',
auth: true,
},
//工具-pdf转图片base64
pdf2imagebase64: {
url: '/employ/contract/pdf2imagebase64',
method: 'GET',
auth: true,
},
}

+ 13
- 5
components/canvas-drag/index.vue View File

@ -10,12 +10,13 @@
let DRAG_ICON = '/static/components/canvas-drag/scale.png'; //
//
const STROKE_COLOR = 'red';
const ROTATE_ENABLED = true;
const ROTATE_ENABLED = false;
let isMove = false; //
//
const DEBUG_MODE = false; //
//
const dragGraph = function({
id,
x = 30,
y = 30,
w,
@ -44,7 +45,8 @@
this.w = w;
this.h = h;
}
this.id = id
this.x = x;
this.y = y; // 4
this.permitSelected = permitSelected; // 4
@ -906,15 +908,21 @@
emitDrawArrChange(){
let arr = this.drawArr.map(item => {
return {
let map = {}
let arr = this.drawArr.map((item, index) => {
let p = {
x : item.x,
y : item.y,
w : item.w,
h : item.h,
id : item.id || index,
}
map[p.id] = p
return p
})
this.$emit('onDrawArrChange', arr)
this.$emit('onDrawArrChange', map)
},
exportFun() {


+ 3
- 0
components/list/bossList/index.vue View File

@ -51,6 +51,9 @@
if(res.code == 200){
this.list = res.result.records || res.result
this.total = res.result.total || res.result.length
this.$emit('total', this.total)
}else{
this.$emit('total', 0)
}
})
},


+ 5
- 1
components/list/userList/index.vue View File

@ -5,7 +5,8 @@
@scrolltolower="loadMoreData">
<view class="bossList">
<view
@click="$utils.navigateTo('/pages_order/work/userDetail?id=' + item.id)"
@click="$utils.navigateTo('/pages_order/work/userDetail?id=' +
(keyName ? item[keyName] : item).id)"
:key="index"
v-for="(item, index) in list">
<userItem :item="keyName && item[keyName] ? item[keyName] : item"
@ -81,6 +82,9 @@
this.list = res.result.records || res.result
this.total = res.result.total || res.result.length
this.handleData && this.handleData(this)
this.$emit('total', this.total)
}else{
this.$emit('total', 0)
}
})
},


+ 2
- 1
components/list/userList/userItem.vue View File

@ -1,5 +1,6 @@
<template>
<view class="boss-item">
<view class="boss-item"
@click="$emit('click')">
<view class="head">
<view class="headImage">
<image :src="item.hanHaiMember.headImage" mode=""></image>


+ 2
- 0
components/list/userList/userListSwipe.vue View File

@ -9,6 +9,8 @@
@click="e => clickSwipeAction(e, item)"
:options="options">
<userItem :item="keyName ? item[keyName] : item"
@click="$utils.navigateTo('/pages_order/work/userDetail?id=' +
(keyName ? item[keyName] : item).id)"
:createTime="item.createTime"/>
</uv-swipe-action-item>
</view>


+ 2
- 1
components/list/workList/index.vue View File

@ -5,7 +5,8 @@
@scrolltolower="loadMoreData">
<view class="workList">
<view
@click="$utils.navigateTo('/pages_order/work/workDetail?id=' + item.id)"
@click="$utils.navigateTo('/pages_order/work/workDetail?id=' +
(keyName ? item[keyName] : item).id)"
:key="index"
v-for="(item, index) in list">
<workItem :item="keyName ? item[keyName] : item"/>


+ 2
- 1
components/list/workList/workItem.vue View File

@ -1,5 +1,6 @@
<template>
<view class="work-item">
<view class="work-item"
@click="$emit('click')">
<view class="top">
<view class="title">
{{ item.title }}


+ 4
- 1
components/list/workList/workListSwipe.vue View File

@ -8,7 +8,10 @@
<uv-swipe-action-item
@click="e => clickSwipeAction(e, item)"
:options="options">
<workItem :item="keyName ? item[keyName] : item"/>
<workItem
@click="$utils.navigateTo('/pages_order/work/workDetail?id=' +
(keyName ? item[keyName] : item).id)"
:item="keyName ? item[keyName] : item"/>
</uv-swipe-action-item>
</view>
</uv-swipe-action>


BIN
doc/5284.png_860.psd View File


BIN
doc/j.psd View File


+ 1
- 1
pages/index/center.vue View File

@ -20,7 +20,7 @@
手机号{{phone}}
</view>
<view>
{{UserExtensionInfo.vipType}}
{{ UserExtensionInfo.vipType || '' }}
</view>
</view>


+ 1
- 1
pages/index/index.vue View File

@ -280,7 +280,7 @@
right: 30rpx;
bottom: 300rpx;
image{
width: 100rpx;
width: 130rpx;
}
}
}


+ 1
- 0
pages_order/auth/certification.vue View File

@ -157,6 +157,7 @@
let self = this
e.file.forEach(file => {
self.$Oss.ossUpload(file.url).then(url => {
console.log(url);
self.fileList.push({
url
})


+ 24
- 3
pages_order/contract/contractManage.vue View File

@ -7,6 +7,8 @@
<view class="content">
<view class="projectContent"
v-for="(item, index) in list"
:key="item.id"
@click="$utils.navigateTo('/pages_order/contract/contractManageEdit')"
>
<image src="../static/contract/contract.png" alt="" />
@ -22,7 +24,7 @@
</view>
</view>
<view class="run"
@click.stop="$utils.navigateTo('/pages_order/contract/contractManageEdit')">
>
<uv-icon
name="arrow-right"
color="#2979ff"
@ -30,15 +32,22 @@
</view>
</view>
</view>
<image src="/static/image/1.png" mode=""></image>
<view class="plus-contract"
@click="$utils.navigateTo('/pages_order/contract/contractManageEdit')">
<uv-icon size="40rpx" color="#fff" name="plus" />
</view>
</view>
</template>
<script>
import mixinList from '@/mixins/list.js'
export default {
mixins : [mixinList],
data() {
return {
mixinsListApi : 'queryContractTemplateList',
}
},
methods: {
@ -84,5 +93,17 @@
}
}
}
.plus-contract{
position: fixed;
top: 55%;
right: 80rpx;
display: flex;
width: 100rpx;
height: 100rpx;
border-radius: 50%;
align-items: center;
justify-content: center;
background-color: $uni-color;
}
}
</style>

+ 178
- 33
pages_order/contract/contractManageEdit.vue View File

@ -12,10 +12,10 @@
<view class="btn-list">
<view class="uni-color-btn" @tap="onAddImage">新建签名</view>
<!-- <view class="uni-color-btn" @tap="onAddImage">新建签名</view> -->
<view class="uni-color-btn" @tap="onChangeBgImage">导入合同</view>
<view class="uni-color-btn" @tap="onUndo">后退</view>
<view class="uni-color-btn" @tap="onClearCanvas">清空</view>
<!-- <view class="uni-color-btn" @tap="onClearCanvas">清空</view> -->
<view class="uni-color-btn" @tap="submit">保存</view>
<!-- <view class="uni-color-btn" @tap="onExportJSON">导出模板</view> -->
<!-- <view class="uni-color-btn" @tap="onAddText">添加文字</view> -->
@ -26,6 +26,7 @@
<script>
import canvasDrag from "@/components/canvas-drag/index";
import setData from "@/components/canvas-drag/setData.js";
import wxBase64src from '@/utils/wxBase64src.js'
export default {
components: {
canvasDrag
@ -35,61 +36,156 @@
return {
height: 750,
width: 700,
drawArr : [],
drawArr : {},
form : {
template : 'https://img.teyizhao.com/2025-01-29/891f7516-dd40-42a4-82e5-d8efc46f4ea7.pdf',
employeePage : 0,//()
employeePosition : '',//()
bossPage : 0,//()
bossPosition : '',//()
title : '',
},
imagesIndex : 0,
imageArr : [],
id : 0,
}
},
onLoad() {
onLoad({id}) {
uni.request({
url : 'http://192.168.1.5:5173/arr',
method: 'GET',
success : res => {
this.imageArr = res.data
this.onChangeBgImage()
}
})
this.id = id
this.getDetail()
},
mounted() {
console.log("mounted mounted mounted");
},
mounted() {},
methods: {
//
onDrawArrChange(arr){
console.log(arr);
this.drawArr = arr
},
/**
* 添加签名位置
*/
onAddImage() {
wx.chooseImage({
success: res => {
// wx.chooseImage({
// success: res => {
// this.setData({
// graph: {
// w: 100,
// h: 50,
// type: 'image',
// url: res.tempFilePaths[0]
// }
// });
// }
// });
uni.getImageInfo({
src: 'https://img.teyizhao.com/2025-02-03/45a56422-7294-41a0-88af-cf2a41cb9554.png',
success : res => {
this.setData({
graph: {
id : 'a',
w: 100,
h: 50,
type: 'image',
url: res.tempFilePaths[0]
url : res.path
}
});
},
fail(e) {
console.log(e);
}
});
})
uni.getImageInfo({
src: 'https://img.teyizhao.com/2025-02-03/45a56422-7294-41a0-88af-cf2a41cb9554.png',
success : res => {
this.setData({
graph: {
id : 'b',
w: 100,
h: 50,
type: 'image',
url : res.path
}
});
},
fail(e) {
console.log(e);
}
})
},
/**
* 导入合同
*/
onChangeBgImage() {
async onChangeBgImage() {
let self = this
wx.chooseImage({
success: res => {
uni.getImageInfo({
src: res.tempFilePaths[0],
success: image => {
console.log(image);
let allwh = image.height + image.width
let imgw = (image.width / allwh).toFixed(2)
let imgh = (image.height / allwh).toFixed(2)
self.height = imgh * Math.ceil(this.width / imgw)
self.$nextTick(() => {
this.$refs.canvasRef.changeBgImage(image.path)
})
}
// let pdfUrl = await self.loadFDP()
// console.log(pdfUrl);
// this.form.template = pdfUrl
// this.pdf2imagebase64()
this.changeBgImage()
},
async changeBgImage(){
let self = this
let src = await wxBase64src.base64src(this.imageArr[this.imagesIndex])
uni.getImageInfo({
src,
success: image => {
console.log(image);
let allwh = image.height + image.width
let imgw = (image.width / allwh).toFixed(2)
let imgh = (image.height / allwh).toFixed(2)
self.height = imgh * Math.ceil(this.width / imgw)
self.$nextTick(() => {
this.$refs.canvasRef.changeBgImage(image.path)
})
},
fail(err) {
console.log(err);
}
});
})
},
loadFDP(){
let that = this
return new Promise((success, error) => {
uni.chooseMessageFile({
count: 1, //
type: 'file',
extension: ['.pdf'], //
success(res) {
// that.$Oss.ossUpload(res.tempFiles[0].path)
success(that.$Oss.ossUpload(res.tempFiles[0].path))
},
fail: (err) => {
error(err)
console.log(err, 'err');
}
});
})
},
// 退
onUndo(event) {
@ -128,9 +224,57 @@
});
this.$refs.canvasRef.clearCanvas();
},
submit() {
uni.setStorageSync('drawArrJson', JSON.stringify(this.drawArr))
uni.navigateBack(-1)
async submit() {
let bossPosition = {
// ...this.drawArr.a,
x : this.$utils.rpxSystemInfoInt(this.drawArr.a.x),
y : this.$utils.rpxSystemInfoInt(this.drawArr.a.y),
w : this.$utils.rpxSystemInfoInt(this.drawArr.a.w),
h : this.$utils.rpxSystemInfoInt(this.drawArr.a.h),
}
let employeePosition = {
// ...this.drawArr.b,
x : this.$utils.rpxSystemInfoInt(this.drawArr.b.x),
y : this.$utils.rpxSystemInfoInt(this.drawArr.b.y),
w : this.$utils.rpxSystemInfoInt(this.drawArr.b.w),
h : this.$utils.rpxSystemInfoInt(this.drawArr.b.h),
}
this.form.bossPosition = JSON.stringify(bossPosition)
this.form.employeePosition = JSON.stringify(employeePosition)
this.$api(this.id ? 'updateContractTemplate' :
'addContractTemplate', this.form).then(res => {
if(res.code == 200){
uni.navigateBack(-1)
}
})
},
pdf2imagebase64(){
this.$api('pdf2imagebase64', {
}, res => {
})
},
//
saveOrUpdate(){
},
// pdfbase64
async pdf2imagebase64(){
let res = await this.$api('pdf2imagebase64', {
pdfPath : this.form.template
})
this.imageArr = res.result
console.log(this.imageArr);
},
getDetail(){
if(!this.id){
this.onAddImage()
return
}
},
}
}
@ -143,7 +287,8 @@
display: flex;
flex-wrap: wrap;
padding: 20rpx;
gap: 20rpx;
gap: 60rpx;
justify-content: center;
.uni-color-btn {
margin: 0;
border-radius: 10rpx;


+ 12
- 6
pages_order/mine/collect.vue View File

@ -60,12 +60,18 @@
},
methods: {
clickSwipeAction({e, item}){
console.log(e, item);
if(this.role){
this.addResumeCollection(item.employResume.id)
}else{
this.addJobCollection(item.employJob.id)
}
uni.showModal({
title: '确认删除吗?',
success : res => {
if(res.confirm){
if(this.role){
this.addResumeCollection(item.employResume.id)
}else{
this.addJobCollection(item.employJob.id)
}
}
}
})
},
addJobCollection(jobId) {
let data = {


+ 6
- 2
pages_order/mine/seeMy.vue View File

@ -10,9 +10,13 @@
<!-- <statisticsNumber title="简历被查看量" /> -->
<statisticsNumber :title="role ? '招工被查看量' : '简历被查看量'" :num="total"/>
<userList :api="mixinsListApi" ref="list" v-if="role" keyName="employResume"/>
<userList :api="mixinsListApi" ref="list"
@total="e => total = e"
v-if="role" keyName="employResume"/>
<bossList :api="mixinsListApi" ref="list" v-else/>
<bossList :api="mixinsListApi"
@total="e => total = e"
ref="list" v-else/>
</view>


BIN
pages_order/static/contract/j.png View File

Before After
Width: 822  |  Height: 446  |  Size: 85 KiB

BIN
pages_order/static/contract/jf.png View File

Before After
Width: 822  |  Height: 446  |  Size: 99 KiB

BIN
pages_order/static/contract/yf.png View File

Before After
Width: 822  |  Height: 446  |  Size: 100 KiB

+ 25
- 0
utils/utils.js View File

@ -1,3 +1,11 @@
let sys = null
uni.getSystemInfoAsync().then(res => {
sys = res
})
function toArray(data) {
if (!data) return []
if (data instanceof Array){
@ -165,6 +173,21 @@ export const toLogin = function(){
}
}()
/**
* 将a的数字计算成rpx单位数字
* @param {Integer} a 数字
*/
export function rpxSystemInfoInt(a, fixed = 2){
return (a * 750 / sys.screenWidth).toFixed(fixed)
}
/**
* 将a的数字计算成实际屏幕单位数字
* @param {Integer} a 数字
*/
export function screenSystemInfoInt(a, fixed = 2){
return (a * sys.screenWidth / 750).toFixed(fixed)
}
export default {
toArray,
generateUUID,
@ -180,4 +203,6 @@ export default {
copyText,
stringFormatHtml,
toLogin,
rpxSystemInfoInt,
screenSystemInfoInt,
}

+ 29
- 0
utils/wxBase64src.js View File

@ -0,0 +1,29 @@
const fsm = wx.getFileSystemManager();
const FILE_BASE_NAME = 'tmp_base64src';
const base64src = function(base64data) {
return new Promise((resolve, reject) => {
const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64data) || [];
if (!format) {
reject(new Error('ERROR_BASE64SRC_PARSE'));
}
const filePath = `${wx.env.USER_DATA_PATH}/${FILE_BASE_NAME}.${format}`;
const buffer = wx.base64ToArrayBuffer(bodyData);
fsm.writeFile({
filePath,
data: buffer,
encoding: 'binary',
success() {
resolve(filePath);
},
fail() {
reject(new Error('ERROR_BASE64SRC_WRITE'));
},
});
});
};
export default {
base64src,
};

Loading…
Cancel
Save