From 8260925b7125e26ff94c2bd3f3a3bfd48fda6b70 Mon Sep 17 00:00:00 2001
From: Leo_Ding <2405260743@qq.com>
Date: Wed, 6 Aug 2025 18:11:05 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E8=AE=AE=E5=AE=A4=E9=A2=84=E7=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 33 ++-
main.js | 2 +
pages.json | 6 +
pages/docList/index.vue | 79 +++++++
pages/meetingDetail/index.vue | 385 +++++++++++++++++++++-------------
pages/meetingList/index.vue | 2 +-
pages/mine/index.vue | 16 +-
pages/sign/sign.vue | 115 ++++++----
static/imgs/word.png | Bin 0 -> 3648 bytes
utils/download.js | 92 ++++++++
utils/router.js | 27 +++
11 files changed, 556 insertions(+), 201 deletions(-)
create mode 100644 pages/docList/index.vue
create mode 100644 static/imgs/word.png
create mode 100644 utils/download.js
create mode 100644 utils/router.js
diff --git a/App.vue b/App.vue
index 1d9a972..03dd0d9 100644
--- a/App.vue
+++ b/App.vue
@@ -1,5 +1,28 @@
-
+
\ No newline at end of file
diff --git a/main.js b/main.js
index 36b642d..0c0f578 100644
--- a/main.js
+++ b/main.js
@@ -4,6 +4,8 @@ import App from './App'
import Vue from 'vue'
import uView from "uview-ui";
Vue.use(uView);
+// 2. 引入 uView 样式
+import 'uview-ui/index.scss';
import './uni.promisify.adaptor'
uni.$u.config.unit = 'rpx'
Vue.config.productionTip = false
diff --git a/pages.json b/pages.json
index 21380d6..24850f5 100644
--- a/pages.json
+++ b/pages.json
@@ -208,6 +208,12 @@
"style": {
"navigationBarTitleText": "电子签名"
}
+ },
+ {
+ "path": "pages/docList/index",
+ "style": {
+ "navigationBarTitleText": "文件下载"
+ }
}
],
diff --git a/pages/docList/index.vue b/pages/docList/index.vue
new file mode 100644
index 0000000..d1d352c
--- /dev/null
+++ b/pages/docList/index.vue
@@ -0,0 +1,79 @@
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/meetingDetail/index.vue b/pages/meetingDetail/index.vue
index 58f96a9..167fc5d 100644
--- a/pages/meetingDetail/index.vue
+++ b/pages/meetingDetail/index.vue
@@ -39,59 +39,62 @@
事由主题
-
+
-
+
+
-
+
{{applyName}}
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -108,19 +111,19 @@
开始
- {{ selectedStartTime }}
+ {{ startTime }}
—
结束
- {{ selectedEndTime }}
+ {{ endTime }}
-
+
-
+
+
+
+
- -->
-
+
-
- 立即预订
+ 立即预订
@@ -169,13 +165,7 @@
@confirm="handleEndTimeConfirm" @cancel="showEndTimePicker = false" ref="endTimePicker">
-
-
-
-
-
-
-
+
@@ -197,9 +187,9 @@
usages,
thingThemes
} from '@/utils/dict.js'
- import signature from '../../components/signature.vue';
+ // import signature from '../sign/sign.vue';
export default {
- components:{signature},
+
data() {
const now = new Date();
const year = now.getFullYear();
@@ -217,24 +207,41 @@
if (endHours >= 24) endHours = 0;
return {
- chargeName: '',
- chargePhone: '',
companyName: '',
- userCard: '',
- userName: '',
- session:'',
- num:'',
+ applyRules: {
+ userPhone: '申请人手机号',
+ userName: '申请人姓名',
+ userCardId: '申请人身份证号',
+ userAddress: '申请人地址',
+ concatName: '负责人姓名',
+ concatPhone: '负责人电话',
+ companyName: '公司名称',
+ startTime: '开始时间',
+ endTime: '结束时间',
+ num: "人数",
+ counter: '场次'
+ },
+ userName: '丁',
+ userPhone: "13667879876",
+ userCardId: '1234',
+ userAddress: '北京二环',
+ counter: '10',
+ num: '100',
// 会议室图片数组
- thingTheme: [],
+ applyTheme: 1,
+ applyArea:1,
thingThemes: thingThemes.getAll(),
- usage:[],
- usages:usages.getAll(),
+ usage: [],
+ usages: usages.getAll(),
list1: [],
detail: {},
- signatureShow:false,
+ signatureShow: false,
isSelfStudy: true, //dateTime,yearmonth
mode: 'datetime',
precision: null,
+ concatPhone: '',
+ reason: '',
+ applySign: '', //签名地址
// 日历控制(默认隐藏)
showCalendar: false,
calendarKey: 0,
@@ -242,7 +249,10 @@
applyTypeColumns: [
['个人申请', '单位申请']
],
- applyName: '',
+ applyType: 1, //个人1 企业2
+ applyName: '个人申请',
+ concatName: '', //联系人姓名
+ concatPhone: '', //联系人电话
// 时间选择器控制
showStartTimePicker: false,
showEndTimePicker: false,
@@ -257,8 +267,8 @@
maxDate: `${year + 1}-12-31`,
// 时间相关
- selectedStartTime: ``,
- selectedEndTime: ``,
+ startTime: `2025-08`,
+ endTime: `2025-10`,
startTimeValue: `${startHours.toString().padStart(2, '0')}:${startMinutes.toString().padStart(2, '0')}`,
endTimeValue: `${endHours.toString().padStart(2, '0')}:${endMinutes.toString().padStart(2, '0')}`,
@@ -275,14 +285,10 @@
Id: '',
};
},
- onReady() {
- // 微信小程序需要用此写法
- // this.$refs.startTimePicker.setFormatter(this.formatter)
- // this.$refs.endTimePicker.setFormatter(this.formatter)
- },
onLoad(options) {
if (options && options.Id) {
this.Id = options.Id;
+ this.isSelfStudy=JSON.parse(options.isSelfStudy)
this.mode = options.isSelfStudy === 'true' ? 'year-month' : 'datetime'
}
},
@@ -304,18 +310,9 @@
this.getDetail();
},
methods: {
- formatter(type, value) {
- if (type === 'year') {
- return `${value}年`
- }
- if (type === 'month') {
- return `${value}月`
- }
- if (type === 'day') {
- return `${value}日`
- }
-
- return value
+ showApplyTypeClick(){
+ if(this.isSelfStudy) return
+ this.showApplyType=true
},
// 获取详情页面
async getDetail() {
@@ -339,15 +336,27 @@
}
},
thingCheckboxChange(e) {
- console.log(e);
+ this.applyTheme = JSON.parse(e.detail.value)
},
- usagesCheckboxChange(e){
+ areaCheckboxChange(e) {
+ this.applyArea = JSON.parse(e.detail.value)
+ },
+ usagesCheckboxChange(e) {
console.log(e);
},
applyConfirm(e) {
- console.log(e)
+ console.log(e.value[0])
+ const list=['个人申请','单位申请']
this.applyName = e.value[0]
- this.showApplyType = false
+ const index = list.findIndex((item) => item === e.value[0])
+ console.log(index)
+ if(index!=-1){
+ this.applyType = parseInt(index + 1)
+ this.showApplyType = false
+ }else{
+ console.log('未找到');
+ }
+
},
handleDateConfirm(e) {
let selectedDate;
@@ -373,29 +382,54 @@
},
handleStartTimeConfirm(e) {
- const date = new Date(e.value)
- const dateString = this.mode === 'year-month' ? `${date.getFullYear()}-${date.getMonth()+1}` :
- `${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()} ${date.getHours()}:00`
- this.selectedStartTime = dateString;
+ const date = new Date(e.value);
+
+ // 补零函数:确保数字是两位数
+ const padZero = num => num.toString().padStart(2, '0');
+
+ const year = date.getFullYear();
+ const month = padZero(date.getMonth() + 1); // 月份补零
+ const day = padZero(date.getDate()); // 日期补零
+ const hours = padZero(date.getHours()); // 小时补零
+
+ const dateString = this.mode === 'year-month' ?
+ `${year}-${month}` // 年月模式:2023-01
+ :
+ `${year}-${month}-${day} ${hours}:00`; // 完整模式:2023-01-02 09:00
+
+ this.startTime = dateString;
this.startTimePickerValue = dateString;
this.showStartTimePicker = false;
- // this.adjustEndTime();
},
handleEndTimeConfirm(e) {
- const date = new Date(e.value)
- const dateString = this.mode === 'year-month' ? `${date.getFullYear()}-${date.getMonth()+1}` :
- `${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()} ${date.getHours()}:00`
- this.selectedEndTime = dateString;
+ const date = new Date(e.value);
+
+ // 补零函数:确保数字是两位数
+ const padZero = num => num.toString().padStart(2, '0');
+
+ const year = date.getFullYear();
+ const month = padZero(date.getMonth() + 1); // 月份补零
+ const day = padZero(date.getDate()); // 日期补零
+ const hours = padZero(date.getHours()); // 小时补零
+
+ const dateString = this.mode === 'year-month' ?
+ `${year}-${month}` // 年月模式:2023-01
+ :
+ `${year}-${month}-${day} ${hours}:00`; // 完整模式:2023-01-02 09:00
+
+ this.endTime = dateString;
this.endTimePickerValue = dateString;
this.showEndTimePicker = false;
- // this.validateTime();
+
+ console.log('格式化后的结束时间:', this.endTime);
+ // this.validateTime(); // 如果需要验证时间范围,取消注释
},
adjustEndTime() {
- console.log(this.selectedStartTime)
- const [startH, startM] = this.selectedStartTime.split(':').map(Number);
- let [endH, endM] = this.selectedEndTime.split(':').map(Number);
+ console.log(this.startTime)
+ const [startH, startM] = this.startTime.split(':').map(Number);
+ let [endH, endM] = this.endTime.split(':').map(Number);
const startTotal = startH * 60 + startM;
let endTotal = endH * 60 + endM;
@@ -404,15 +438,15 @@
endTotal = startTotal + 60;
endH = Math.floor(endTotal / 60);
endM = endTotal % 60;
- this.selectedEndTime = `${endH.toString().padStart(2, '0')}:${endM.toString().padStart(2, '0')}`;
+ this.endTime = `${endH.toString().padStart(2, '0')}:${endM.toString().padStart(2, '0')}`;
this.endTimeValue = `${endH}:${endM}`;
- this.endTimePickerValue = this.selectedEndTime;
+ this.endTimePickerValue = this.endTime;
}
},
validateTime() {
- const [startH, startM] = this.selectedStartTime.split(':').map(Number);
- const [endH, endM] = this.selectedEndTime.split(':').map(Number);
+ const [startH, startM] = this.startTime.split(':').map(Number);
+ const [endH, endM] = this.endTime.split(':').map(Number);
const duration = (endH * 60 + endM) - (startH * 60 + startM);
if (duration < 30) {
@@ -423,56 +457,106 @@
this.adjustEndTime();
}
},
-
- handleBook() {
- this.validateTime();
-
- // 构建预订信息对象
- const bookingInfo = {
- startAt: new Date(`${this.selectedDate} ${this.selectedStartTime}`),
- endAt: new Date(`${this.selectedDate} ${this.selectedEndTime}`),
- remark: this.remark,
- roomId: this.Id
- };
-
-
- console.log('提交的预订信息:', bookingInfo);
-
- uni.showToast({
- title: `已预订 ${this.formattedSelectedDate} ${this.selectedStartTime}-${this.selectedEndTime}`,
- icon: 'none'
- });
-
- // 这里可以添加实际的API调用
- post('/api/v1/app_auth/metting-room/order/register', bookingInfo).then((res) => {
- console.log("===res", res)
- if (!res || !res.success) {
- throw new Error('会议室预定失败');
+ /**
+ * 验证对象属性是否为空(Promise版)
+ * @param {Object} obj - 要验证的对象
+ * @param {Object} applyRules - 验证规则对象
+ * @returns {Promise} 返回Promise,resolve通过验证,reject失败信息
+ */
+ validateObject(obj, applyRules = {}) {
+ return new Promise((resolve, reject) => {
+ // 参数校验
+ if (!obj || typeof obj !== 'object') {
+ return reject(new Error('参数必须是一个对象'));
}
- uni.showToast({
- title: '会议室预定成功!',
- icon: 'success'
- });
- this.remark = null;
- setTimeout(() => {
+
+ const keys = Object.keys(obj);
+ let firstInvalidKey = null;
+ console.log(keys);
+ // 遍历检查每个属性
+ for (const item of keys) {
+ console.log(item)
+ const value = obj[item];
+ console.log(value);
+ // 检查空值且该属性在验证规则中
+ if ((value === '' || value === null) && applyRules.hasOwnProperty(item)) {
+ firstInvalidKey = item;
+ break;
+ }
+ }
+ console.log(firstInvalidKey)
+ if (firstInvalidKey) {
+ // 返回具体的错误信息
+ const errorMsg = `${applyRules[firstInvalidKey]}不能为空`;
+ reject(new Error(errorMsg));
+ } else {
+ resolve('所有属性验证通过');
+ }
+ });
+ },
+ async handleBook() {
+ try {
+ console.log(this.applyType);
+ let bookingInfo = {
+ roomId: this.Id,
+ applyType: this.applyType,
+ reason: this.reason,
+ applyTheme: this.applyTheme
+ };
+ if (this.applyType === 1) {
+ const userApplyInfo = {
+ userName: this.userName,
+ userPhone: this.userPhone,
+ userAddress: this.userAddress,
+ userCardId: this.userCardId,
+ startTime: this.startTime,
+ endTime: this.endTime,
+ counter: this.counter,
+ num: this.num
+ }
+ await this.validateObject(userApplyInfo, this.applyRules)
+ const applyInfo = Object.assign(bookingInfo, userApplyInfo)
+ // 页面A设置参数
+ const app = getApp()
+ app.globalData.applyInfo = applyInfo
uni.navigateTo({
- url: `/pages/meetingList/index`,
- success: () => {
- console.log('导航成功,ID:', id);
- },
- fail: (err) => {
- console.error('导航失败:', err);
- uni.showToast({
- title: '打开详情页失败',
- icon: 'none'
- });
- }
+ url: `/pages/sign/sign?isSelfStudy=${this.isSelfStudy}`
+ })
+ }
+ if (this.applyType === 2) {
+ const userApplyInfo = {
+ concatName: this.concatName,
+ concatPhone: this.concatPhone,
+ companyName: this.companyName,
+ startTime: this.startTime,
+ endTime: this.endTime,
+ counter: this.counter,
+ num: this.num
+ }
+ await this.validateObject(userApplyInfo, this.applyRules)
+ const applyInfo = Object.assign(bookingInfo, userApplyInfo)
+ // 这里可以添加实际的API调用
+ const res = await post('/api/v1/app_auth/metting-room/order/register', applyInfo)
+ if (!res || !res.success) {
+ throw new Error('会议室预定失败');
+ }
+ uni.showToast({
+ title: '会议室预定成功!',
+ icon: 'success'
});
- }, 4000)
+ if(res.success==true){
+ uni.navigateTo({
+ url:`/pages/docList/index?files=${JSON.stringify(res.data)}&&isSelfStudy=${this.isSelfStudy}`
+ })
+ }
+ }
+ } catch (error) {
+ uni.showToast({
+ title: error.message,
+ icon: 'none'
+ })
+ }
-
- })
- // this.submitBooking(bookingInfo);
},
}
@@ -688,6 +772,7 @@
padding: 20rpx;
background: #fff;
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.08);
+ z-index: 999;
.u-button {
height: 88rpx;
diff --git a/pages/meetingList/index.vue b/pages/meetingList/index.vue
index b521681..4905ed7 100644
--- a/pages/meetingList/index.vue
+++ b/pages/meetingList/index.vue
@@ -254,7 +254,7 @@
// 安全获取ID(兼容各种可能的字段名)
const id = item.id;
- const isSelfStudy=item.title==='自习室'?'true':'false'
+ const isSelfStudy=item.title==='自习室'?true:false
if (!id) {
uni.showToast({
title: '会议室信息异常',
diff --git a/pages/mine/index.vue b/pages/mine/index.vue
index fc8bb00..f9d158a 100644
--- a/pages/mine/index.vue
+++ b/pages/mine/index.vue
@@ -113,7 +113,7 @@
IMAGE_BASE_URL,
BASE_URL
} from '@/utils/config';
-
+import { navigateTo } from '@/utils/router';
export default {
components: {
Footer
@@ -582,24 +582,22 @@
goPage(item) {
if (item.key === 6) { // 联系社区的特殊处理
this.handleContactCommunity();
-
return;
}
-
if (item.key === 5) { // 设置的特殊处理
this.handleEditClick(); // 调用编辑用户信息的方法
return;
}
- if (!this.checkLogin()) {
- this.showEditModal = true;
- return;
- }
+ // if (!this.checkLogin()) {
+ // this.showEditModal = true;
+ // return;
+ // }
if (item.pageUrl) {
- uni.navigateTo({
+ navigateTo({
url: `/pages/${item.pageUrl}/index`
- });
+ },false);
}
},
diff --git a/pages/sign/sign.vue b/pages/sign/sign.vue
index 8d05552..6bdcd0c 100644
--- a/pages/sign/sign.vue
+++ b/pages/sign/sign.vue
@@ -1,31 +1,33 @@
+
+
+
+
-
+ class="red-select"> -->
-
-
+
+
-
-
-
-
- 请签名
-
+
+
@@ -33,8 +35,10 @@