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 39947d4..8e27b17 100644
Binary files a/images/icon/warning.png and b/images/icon/warning.png differ
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/'
}