From 665a249451f62b670e63e7cbe0c3eb9ab46d095c Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Thu, 11 Sep 2025 16:37:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E5=87=BA=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/index.js | 16 ++ images/icon/warning.png | Bin 898 -> 821 bytes subpages/goOut/goOut/goOut.js | 193 ++++++++++++++++-------- subpages/goOut/goOut/goOut.wxml | 25 +++- subpages/goOut/goOut/goOut.wxss | 28 ++++ subpages/goOut/mygoOut/mygoOut.js | 21 ++- subpages/goOut/mygoOut/mygoOut.wxml | 219 +++++++--------------------- subpages/goOut/mygoOut/mygoOut.wxss | 12 ++ utils/config.js | 4 +- 9 files changed, 284 insertions(+), 234 deletions(-) diff --git a/api/index.js b/api/index.js index e5bf3d2..78f0875 100644 --- a/api/index.js +++ b/api/index.js @@ -87,3 +87,19 @@ export function spaceInfo(pamars) { export function queryAppointTime(pamars) { return fly.get(`/bys/mzShareSpace/queryAppointTime`, pamars); } +// 外出申请-提交 +export function goOutSubmit(data) { + return fly.post(`/bysmp/goingOut/apply`, data); +} +// 我的外出申请 +export function myGoOut(pamars) { + return fly.get(`/bysmp/goingOut/myApplyList/` + pamars.graduateId); +} +// 外出申请-详情 +export function getgoOutInfo(data) { + return fly.get(`/bysmp/goingOut/editById/` + data.id); +} +// 外出申请-重新提交 +export function goOutReSubmit(data) { + return fly.post(`/bysmp/goingOut/updateById`, data); +} \ No newline at end of file diff --git a/images/icon/warning.png b/images/icon/warning.png index 39947d4020a8e6bf609f3ee18a279c3d03a7f88d..8e27b17b765763c63e9d593c1617f9a820954bcc 100644 GIT binary patch literal 821 zcmV-51Iqk~P)n3ywGfBuKEp!mbAPMOt&`Ds4lGHr-`h7BT4B^Mv#-Jx>Df+p4b<#<~ zNyYRwxr_fzx})T|J4s&dr^!oq4lxLG2`(bgr$zGT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@j)u~`>R>yDpvv{NY=?7DE~G?D@5>m*Ail})c2WobF7k? zov>hV0%H)+B=ruU*OoBT(6tqGj9OqQ^=`gD;$B7lkm3W2_gqvXq)aolV(=Ae9|WwO0~}Wm zf)HwN-`#w-q_k&lxx}ao%R<411?4Qt{1Y_zwU80RR8;b0&-c000I_L_t&o Y0HbhKcqCut$^ZZW07*qoM6N<$f_12>YXATM diff --git a/subpages/goOut/goOut/goOut.js b/subpages/goOut/goOut/goOut.js index cd4a90c..2d301c8 100644 --- a/subpages/goOut/goOut/goOut.js +++ b/subpages/goOut/goOut/goOut.js @@ -1,5 +1,7 @@ // subpages/goOut/goOut/goOut.js var config = require('../../../utils/config') +import { goOutSubmit,getgoOutInfo } from '../../../api/index' +const app = getApp() Page({ /** @@ -7,6 +9,7 @@ Page({ */ data: { reasonName: '', + reasonId: '', currentDateStart: '', currentDateEnd: '', showReason: false, @@ -18,15 +21,34 @@ Page({ endMinDate: null, // 结束时间最小日期 endMaxDate: null, // 结束时间最大日期 fileList: [], // 上传的文件列表 - submitting: false, // 提交状态 - showSuccessModal: true, // 显示成功弹框 + showSuccessModal: false, // 显示成功弹框 + info: false, // 是否是重新提交 + id: '', // 外出申请id + nextFileNo: 1, // 文件编号自增,避免重名 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + if (options.id) { + this.setData({ + id: options.id, + info: true + }) + getgoOutInfo({id: options.id}).then(res=>{ + if (res.code === 200) { + this.setData({ + reasonName: this.data.options[res.data.reason], + currentDateStart: res.data.startTime, + currentDateEnd: res.data.endTime, + fileList: res.data.imgs, + reasonId: res.data.reason, + nextFileNo: (res.data.imgs && res.data.imgs.length ? res.data.imgs.length : 0) + 1 + }) + } + }) + } }, /** @@ -78,6 +100,13 @@ Page({ }, handleReason() { + if (this.data.info) { + wx.showToast({ + title: '无法修改原因', + icon: 'none' + }); + return + } this.setData({ showReason: true }) @@ -89,17 +118,28 @@ Page({ } = e.detail; console.log(index); this.setData({ + reasonId: index, reasonName: value, showReason: false }) }, oncancel() { + if (this.data.info) { + return + } this.setData({ reasonName: '', showReason: false }) }, handleDateStart() { + if (this.data.info) { + wx.showToast({ + title: '无法修改开始时间', + icon: 'none' + }); + return + } console.log('handleDateStart'); this.setData({ @@ -107,6 +147,9 @@ Page({ }) }, oncancelStart() { + if (this.data.info) { + return + } this.setData({ currentDateStart: '', showDateStart: false @@ -134,18 +177,31 @@ Page({ }) }, oncancelEnd() { + if (this.data.info) { + return + } this.setData({ currentDateEnd: '', showDateEnd: false }) }, onconfirmEnd(e) { + if (this.data.info) { + return + } this.setData({ showDateEnd: false, currentDateEnd: this.formatDate(e.detail) }) }, handleDateEnd() { + if (this.data.info) { + wx.showToast({ + title: '无法修改结束时间', + icon: 'none' + }); + return + } this.setData({ showDateEnd: true }) @@ -159,13 +215,25 @@ Page({ sizeType: ['compressed'], sourceType: ['album', 'camera'], success: (res) => { + console.log(res); + const files = res.tempFiles || []; + const oversize = files.some(f => typeof f.size === 'number' && f.size > 8 * 1024 * 1024); + if (oversize) { + wx.showToast({ + title: '单张图片不能超过8MB', + icon: 'none' + }); + return; + } + const startNo = this.data.nextFileNo; const tempFiles = res.tempFilePaths.map((path, index) => ({ url: path, - name: `证明材料${this.data.fileList.length + index + 1}.jpg`, + name: `证明材料${startNo + index}.jpg`, isImage: true })); this.setData({ - fileList: [...this.data.fileList, ...tempFiles] + fileList: [...this.data.fileList, ...tempFiles], + nextFileNo: startNo + tempFiles.length }); } }); @@ -173,10 +241,21 @@ Page({ afterRead(event) { const { file } = event.detail; + const files = Array.isArray(file) ? file : [file]; + const oversize = files.some(f => typeof f.size === 'number' && f.size > 8 * 1024 * 1024); + if (oversize) { + wx.showToast({ + title: '单张图片不能超过8MB', + icon: 'none' + }); + return; + } + const selected = Array.isArray(file) ? file[0] : file; const _this = this + wx.showLoading({ title: '上传中...', mask: true }) wx.uploadFile({ url: `${config.BASEURL()}/common/upload`, // 仅为示例,非真实的接口地址 - filePath: file.url, + filePath: selected.url, name: 'file', header: { "Content-type": "multipart/form-data", @@ -184,10 +263,21 @@ Page({ }, success(res) { const res1 = JSON.parse(res.data) + const nextNo = _this.data.nextFileNo; _this.setData({ - fileList: _this.data.fileList.concat([{ url: res1.url, name: `证明材料${_this.data.fileList.length + 1}.jpg` }]) + fileList: _this.data.fileList.concat([{ url: res1.url, name: `证明材料${nextNo}.jpg` }]), + nextFileNo: nextNo + 1 }); }, + fail() { + wx.showToast({ + title: '上传失败,请重试', + icon: 'none' + }) + }, + complete() { + wx.hideLoading() + } }); // 这里可以添加上传到服务器的逻辑 console.log('文件上传成功:', file); @@ -200,50 +290,24 @@ Page({ fileList.splice(index, 1); this.setData({ fileList }); }, - - // 提交申请 - submit() { - // 表单验证 - if (!this.data.reasonName) { - wx.showToast({ - title: '请选择外出原因', - icon: 'none' - }); - return; - } - if (!this.data.currentDateStart) { - wx.showToast({ - title: '请选择开始时间', - icon: 'none' - }); - return; - } - if (!this.data.currentDateEnd) { - wx.showToast({ - title: '请选择结束时间', - icon: 'none' - }); - return; - } - if (this.data.fileList.length === 0) { - wx.showToast({ - title: '请上传证明材料', - icon: 'none' - }); - return; + // 自定义文件名列表删除 + removeFile(e) { + const { index } = e.currentTarget.dataset; + const fileList = [...this.data.fileList]; + if (index >= 0 && index < fileList.length) { + fileList.splice(index, 1); + this.setData({ fileList }); } - - this.setData({ submitting: true }); - - // 模拟提交过程 - setTimeout(() => { - this.setData({ submitting: false }); - wx.showToast({ - title: '提交成功', - icon: 'success' - }); - // 这里可以添加实际的提交逻辑 - }, 2000); + }, + // 预览图片 + previewFile(e){ + const { index } = e.currentTarget.dataset; + const urls = (this.data.fileList || []).map(i => i.url); + if (!urls.length) return; + wx.previewImage({ + current: urls[index] || urls[0], + urls + }) }, submit() { if (!this.data.reasonName) { @@ -275,19 +339,24 @@ Page({ return } let parms = { - reasonName: this.data.reasonName, - currentDateStart: this.data.currentDateStart, - currentDateEnd: this.data.currentDateEnd, - fileList: this.data.fileList + reason: this.data.reasonId, + startTime: this.data.currentDateStart, + endTime: this.data.currentDateEnd, + imgs: this.data.fileList, + graduateId: app.globalData.userInfo.graduateId, } - // goOutSubmit(parms).then(res => { - // if (res.code === 200) { - // wx.showToast({ - // title: '提交成功', - // icon: 'success' - // }); - // } - // }) + goOutSubmit(parms).then(res => { + if (res.code === 200) { + this.setData({ + showSuccessModal: true + }) + } + }).catch(err=>{ + wx.showToast({ + title: err.msg, + icon:'none' + }) + }) }, closeSuccessModal() { this.setData({ diff --git a/subpages/goOut/goOut/goOut.wxml b/subpages/goOut/goOut/goOut.wxml index 7a3eca8..e53972a 100644 --- a/subpages/goOut/goOut/goOut.wxml +++ b/subpages/goOut/goOut/goOut.wxml @@ -17,14 +17,14 @@ - + - + @@ -37,14 +37,31 @@ 只能上传jpg、jpeg文件,文件最多5个且不超过8M - + 点击上传 + + + + {{item.name || '证明材料'}}{{index + 1}} + × + + + -提交申请 +提交申请 diff --git a/subpages/goOut/goOut/goOut.wxss b/subpages/goOut/goOut/goOut.wxss index 006d7c0..8f0acbd 100644 --- a/subpages/goOut/goOut/goOut.wxss +++ b/subpages/goOut/goOut/goOut.wxss @@ -76,6 +76,34 @@ width: 200rpx; } +/* 自定义文件名列表 */ +.file-list{ + margin-top: 20rpx; +} +.file-item{ + display: flex; + align-items: center; + justify-content: space-between; + padding: 16rpx 0; + border-bottom: 1rpx solid #f0f0f0; +} +.file-name{ + font-size: 28rpx; + color: #333; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + max-width: 520rpx; +} +.file-remove{ + font-size: 32rpx; + color: #999; + padding: 0 12rpx; +} +.file-remove:active{ + color: #ff4d4f; +} + .upload-icon { width: 60rpx; diff --git a/subpages/goOut/mygoOut/mygoOut.js b/subpages/goOut/mygoOut/mygoOut.js index a1a61a5..a8dfa59 100644 --- a/subpages/goOut/mygoOut/mygoOut.js +++ b/subpages/goOut/mygoOut/mygoOut.js @@ -1,18 +1,20 @@ // subpages/goOut/mygoOut/mygoOut.js +import { myGoOut} from '../../../api/index' +const app = getApp() Page({ /** * 页面的初始数据 */ data: { - + goOutList: [], + options: ['本人及其直系亲属因病因伤住院', '就业创业人员因公出差/培训', '就业人员法定节假日期间单位假期多于法定日期'], }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - }, /** @@ -26,7 +28,14 @@ Page({ * 生命周期函数--监听页面显示 */ onShow() { - + myGoOut({graduateId: app.globalData.userInfo.graduateId}).then(res => { + this.setData({ + goOutList: res.rows + }) + console.log(this.data.goOutList) + }).catch(err => { + console.log(err) + }) }, /** @@ -62,5 +71,11 @@ Page({ */ onShareAppMessage() { + }, + reSubmit(e) { + const item = e.currentTarget.dataset.item + wx.navigateTo({ + url: `/subpages/goOut/goOut/goOut?id=${item.id}` + }) } }) \ No newline at end of file diff --git a/subpages/goOut/mygoOut/mygoOut.wxml b/subpages/goOut/mygoOut/mygoOut.wxml index a875ab7..3b679fa 100644 --- a/subpages/goOut/mygoOut/mygoOut.wxml +++ b/subpages/goOut/mygoOut/mygoOut.wxml @@ -1,168 +1,61 @@ - - - - - 通过 - - - - - - 外出时间: - - - 2025-01-01 - - - - - 外出原因: - - - 外出原因测测测 - - - - - 外出原因: - - - 外出原因测测测 - - - - - 证明材料: - - - - - - - - - - 申请时间: - - - 2025-01-01 + + + + + + + + {{item.status == 1 ? '通过' :item.status == 2 ? '未通过' :item.status == 3 ? '驳回':'待审核'}} + + + + + + 外出时间: + + + {{item.startTime}}-{{item.endTime}} + + + + + 外出原因: + + + {{options[item.reason]}} + + + + + 证明材料: + + + + + + + + 申请时间: + + + {{item.createTime}} + + + + + + {{item.status == 3 ? '驳回原因' : '不通过原因'}}: + + + 证明材料不充分 + + + 重新提交 + + - - - - 通过 - - - - - - 外出时间: - - - 2025-01-01 - - - - - 外出原因: - - - 外出原因测测测 - - - - - 外出原因: - - - 外出原因测测测 - - - - - 证明材料: - - - - - - - - - - 申请时间: - - - 2025-01-01 - - - - - - - - 通过 - - - - - - 外出时间: - - - 2025-01-01 - - - - - 外出原因: - - - 外出原因测测测 - - - - - 外出原因: - - - 外出原因测测测 - - - - - 证明材料: - - - - - - - - - - 申请时间: - - - 2025-01-01 - - - - - - - - 不通过原因: - - - 不通过原因测测测 - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/subpages/goOut/mygoOut/mygoOut.wxss b/subpages/goOut/mygoOut/mygoOut.wxss index 0ded9dd..6c772e2 100644 --- a/subpages/goOut/mygoOut/mygoOut.wxss +++ b/subpages/goOut/mygoOut/mygoOut.wxss @@ -29,3 +29,15 @@ page{ flex: 1; font-size: 28rpx; } +.item-content-btn{ + width: 140rpx; + height: 48rpx; + line-height: 48rpx; + border-radius: 48pt; + background-color: rgba(241,161,19,1); + color: rgba(255,255,255,1); + font-size: 28rpx; + text-align: center; + font-family: PingFangSC-regular + +} \ No newline at end of file diff --git a/utils/config.js b/utils/config.js index 62064f1..02ccc2c 100644 --- a/utils/config.js +++ b/utils/config.js @@ -13,8 +13,8 @@ module.exports = { }; function BASEURL() { - return 'https://zsbz.qdcfy.com/mz-api' - // return 'http://219.146.91.110:30801/mz-api' + // return 'https://zsbz.qdcfy.com/mz-api' + return 'http://219.146.91.110:30801/mz-api' // return 'https://epmet-test.elinkservice.cn/api/' }