修复BUG

修复部分BUG,切换线上接口
This commit is contained in:
unknown 2024-09-30 16:54:33 +08:00
parent d4d9984851
commit 1cd7aaffed
7 changed files with 280 additions and 243 deletions

View File

@ -10,12 +10,12 @@ App({
// DOMAIN_NAME: 'http://192.168.0.30:9227', //接口域名 // DOMAIN_NAME: 'http://192.168.0.30:9227', //接口域名
// IMG_NAME: 'http://192.168.0.30:9227', // IMG_NAME: 'http://192.168.0.30:9227',
// 生产 // 生产
// DOMAIN_NAME_PREFIX: 'https://baoxiu.jsgdha.com/shoot-hand', DOMAIN_NAME_PREFIX: 'https://baoxiu.jsgdha.com/shoot-hand',
// DOMAIN_NAME: 'https://baoxiu.jsgdha.com/shoot-hand', //接口域名 DOMAIN_NAME: 'https://baoxiu.jsgdha.com/shoot-hand', //接口域名
// IMG_NAME: 'https://baoxiu.jsgdha.com/shoot-hand', IMG_NAME: 'https://baoxiu.jsgdha.com/shoot-hand',
DOMAIN_NAME_PREFIX: 'https://company.haxy.com.cn:4443/shoot-hand', // DOMAIN_NAME_PREFIX: 'https://company.haxy.com.cn:4443/shoot-hand',
DOMAIN_NAME: 'https://company.haxy.com.cn:4443/shoot-hand', //接口域名 // DOMAIN_NAME: 'https://company.haxy.com.cn:4443/shoot-hand', //接口域名
IMG_NAME: 'https://company.haxy.com.cn:4443/shoot-hand', // IMG_NAME: 'https://company.haxy.com.cn:4443/shoot-hand',
globals: { globals: {
refreshMyPages: false, refreshMyPages: false,
homedata: {}, homedata: {},

View File

@ -105,7 +105,8 @@ Page({
let year = date.getFullYear() let year = date.getFullYear()
let month = date.getMonth() + 1 let month = date.getMonth() + 1
let day = date.getDate() let day = date.getDate()
let chooseTime = year + '-' + month + '-' + day + ' 00:00:00' // IOS不支持-,必须用/
let chooseTime = year + '/' + month + '/' + day + ' 00:00:00'
let chooseTimeStr = new Date(chooseTime).getTime() let chooseTimeStr = new Date(chooseTime).getTime()
wx.navigateTo({ wx.navigateTo({
url: '/pages/meeting/meetingReservation/meetingReservation?time=' + chooseTimeStr + '&dep=' + this.data.depName + '&depId=' + this.data.depId, url: '/pages/meeting/meetingReservation/meetingReservation?time=' + chooseTimeStr + '&dep=' + this.data.depName + '&depId=' + this.data.depId,

View File

@ -38,7 +38,7 @@
<!-- 提示框 --> <!-- 提示框 -->
<van-dialog use-slot title="请认证所在单位" show="{{ showLogin }}" show-cancel-button bind:close="onCloseLogin" bind:confirm="orderLogin" beforeClose="{{ beforeClose }}" zIndex="109"> <van-dialog use-slot title="请认证所在单位" show="{{ showLogin }}" show-cancel-button bind:close="onCloseLogin" bind:confirm="orderLogin" beforeClose="{{ beforeClose }}" zIndex="109">
<van-cell-group style="margin: 20px;"> <van-cell-group style="margin: 20px;">
<van-field bind:change="onChangeUsername" value="{{ username }}" clearable label="用户名" placeholder="请输入用户名" /> <van-field bind:change="onChangeUsername" value="{{ username }}" clearable label="用户名" placeholder="请输入用户名" border="{{ false }}" />
<van-field bind:change="onChangePwd" value="{{ pwd }}" type="password" clearable label="密码" placeholder="请输入密码" /> <van-field bind:change="onChangePwd" value="{{ pwd }}" type="password" clearable label="密码" placeholder="请输入密码" border="{{ false }}" />
</van-cell-group> </van-cell-group>
</van-dialog> </van-dialog>

View File

@ -474,7 +474,8 @@ Page({
let year = date.getFullYear() let year = date.getFullYear()
let month = date.getMonth() + 1 let month = date.getMonth() + 1
let day = date.getDate() let day = date.getDate()
let chooseTime = year + '-' + month + '-' + day + ' 00:00:00' // IOS不支持-,必须用/
let chooseTime = year + '/' + month + '/' + day + ' 00:00:00'
let chooseTimeStr = new Date(chooseTime).getTime() let chooseTimeStr = new Date(chooseTime).getTime()
// 加入rId参数为预约id用于重新修改 // 加入rId参数为预约id用于重新修改
wx.navigateTo({ wx.navigateTo({

View File

@ -483,7 +483,8 @@ Page({
let year = date.getFullYear() let year = date.getFullYear()
let month = date.getMonth() + 1 let month = date.getMonth() + 1
let day = date.getDate() let day = date.getDate()
let chooseTime = year + '-' + month + '-' + day + ' 00:00:00' // IOS不支持-,必须用/
let chooseTime = year + '/' + month + '/' + day + ' 00:00:00'
let chooseTimeStr = new Date(chooseTime).getTime() let chooseTimeStr = new Date(chooseTime).getTime()
// 加入rId参数为预约id用于重新修改 // 加入rId参数为预约id用于重新修改
wx.navigateTo({ wx.navigateTo({

View File

@ -528,7 +528,8 @@ Page({
let year = date.getFullYear() let year = date.getFullYear()
let month = date.getMonth() + 1 let month = date.getMonth() + 1
let day = date.getDate() let day = date.getDate()
let chooseTime = year + '-' + month + '-' + day + ' 00:00:00' // IOS不支持-,必须用/
let chooseTime = year + '/' + month + '/' + day + ' 00:00:00'
let chooseTimeStr = new Date(chooseTime).getTime() let chooseTimeStr = new Date(chooseTime).getTime()
// 加入rId参数为预约id用于重新修改 // 加入rId参数为预约id用于重新修改
wx.navigateTo({ wx.navigateTo({

View File

@ -3,154 +3,175 @@ let app = getApp();
//返回 例 2017 //返回 例 2017
const formatYear = data => { const formatYear = data => {
var date = data.date; var date = data.date;
var types = data.types; var types = data.types;
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
const day = date.getDate() const day = date.getDate()
const hour = date.getHours() const hour = date.getHours()
const minute = date.getMinutes() const minute = date.getMinutes()
const second = date.getSeconds() const second = date.getSeconds()
if (types == 'year') { if (types == 'year') {
return [year].map(formatNumber).join('-') return [year].map(formatNumber).join('-')
} else if (types == 'month') { } else if (types == 'month') {
return [month].map(formatNumber).join('-') return [month].map(formatNumber).join('-')
} else if (types == 'day') { } else if (types == 'day') {
return [day].map(formatNumber).join('-') return [day].map(formatNumber).join('-')
} }
} }
//返回 例 12月02日 //返回 例 12月02日
const formatDate2 = date => { const formatDate2 = date => {
const month = date.getMonth() + 1 const month = date.getMonth() + 1
const day = date.getDate() const day = date.getDate()
return [month].map(formatNumber) + '月' + [day].map(formatNumber) + '日' return [month].map(formatNumber) + '月' + [day].map(formatNumber) + '日'
} }
//返回 例 2017-12-12 //返回 例 2017-12-12
const formatDate = date => { const formatDate = date => {
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
const day = date.getDate() const day = date.getDate()
const hour = date.getHours() const hour = date.getHours()
const minute = date.getMinutes() const minute = date.getMinutes()
const second = date.getSeconds() const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-') return [year, month, day].map(formatNumber).join('-')
} }
//返回 例 2017-12-12 12:30:00 //返回 例 2017-12-12 12:30:00
const formatTime = date => { const formatTime = date => {
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
const day = date.getDate() const day = date.getDate()
const hour = date.getHours() const hour = date.getHours()
const minute = date.getMinutes() const minute = date.getMinutes()
const second = date.getSeconds() const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':') return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
} }
//返回 例 12-12 12:30:00 //返回 例 12-12 12:30:00
const formatTime2 = date => { const formatTime2 = date => {
const month = date.getMonth() + 1 const month = date.getMonth() + 1
const day = date.getDate() const day = date.getDate()
const hour = date.getHours() const hour = date.getHours()
const minute = date.getMinutes() const minute = date.getMinutes()
return [month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':') return [month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':')
} }
//返回 小时12:00:00 //返回 小时12:00:00
const formatHour = data => { const formatHour = data => {
var date = data.date; var date = data.date;
var types = data.types; var types = data.types;
const hour = date.getHours() const hour = date.getHours()
const minute = date.getMinutes() const minute = date.getMinutes()
const second = date.getSeconds() const second = date.getSeconds()
if (types == 'hour') { if (types == 'hour') {
return [hour].map(formatNumber) return [hour].map(formatNumber)
} else if (types == 'minute') { } else if (types == 'minute') {
return [minute].map(formatNumber).join('-') return [minute].map(formatNumber).join('-')
} else if (types == 'second') { } else if (types == 'second') {
return [second].map(formatNumber) return [second].map(formatNumber)
} }
}
function isString(value) {
return typeof value === "string";
} }
//返回 指定秒数59 2017-12-12 12:30:59 //返回 指定秒数59 2017-12-12 12:30:59
function selfFormatTimeReturnSecond59(time) { function selfFormatTimeReturnSecond59(time) {
let date = new Date(time); if (typeof time === "string" && time.includes('-')) {
let year = date.getFullYear() time = time.replaceAll('-', '/')
let month = date.getMonth() + 1 }
let day = date.getDate() let date = new Date(time);
let hour = date.getHours() let year = date.getFullYear()
let minute = date.getMinutes() let month = date.getMonth() + 1
let second = date.getSeconds() let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, '59'].map(formatNumber).join(':') return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, '59'].map(formatNumber).join(':')
} }
//返回 2017-12-12 12:30:59 //返回 2017-12-12 12:30:59
function selfFormatTimeYMDHMS(time) { function selfFormatTimeYMDHMS(time) {
let date = new Date(time); if (typeof time === "string" && time.includes('-')) {
let year = date.getFullYear() time = time.replaceAll('-', '/')
let month = date.getMonth() + 1 }
let day = date.getDate() let date = new Date(time);
let hour = date.getHours() let year = date.getFullYear()
let minute = date.getMinutes() let month = date.getMonth() + 1
let second = date.getSeconds() let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':') return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
} }
//返回 2017-12-12 12:30 //返回 2017-12-12 12:30
function selfFormatTimeYMDHM(time) { function selfFormatTimeYMDHM(time) {
let date = new Date(time); if (typeof time === "string" && time.includes('-')) {
let year = date.getFullYear() time = time.replaceAll('-', '/')
let month = date.getMonth() + 1 }
let day = date.getDate() let date = new Date(time);
let hour = date.getHours() let year = date.getFullYear()
let minute = date.getMinutes() let month = date.getMonth() + 1
let second = date.getSeconds() let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':') return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':')
} }
//返回 2017-12-12 12 //返回 2017-12-12 12
function selfFormatTimeYMDH(time) { function selfFormatTimeYMDH(time) {
let date = new Date(time); if (typeof time === "string" && time.includes('-')) {
let year = date.getFullYear() time = time.replaceAll('-', '/')
let month = date.getMonth() + 1 }
let day = date.getDate() let date = new Date(time);
let hour = date.getHours() let year = date.getFullYear()
let minute = date.getMinutes() let month = date.getMonth() + 1
let second = date.getSeconds() let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour].map(formatNumber).join(':') return [year, month, day].map(formatNumber).join('-') + ' ' + [hour].map(formatNumber).join(':')
} }
//返回 例 2017-12-12 //返回 例 2017-12-12
function selfFormatTimeYMD(time) { function selfFormatTimeYMD(time) {
let date = new Date(time) if (typeof time === "string" && time.includes('-')) {
let year = date.getFullYear() time = time.replaceAll('-', '/')
let month = date.getMonth() + 1 }
let day = date.getDate() let date = new Date(time)
let hour = date.getHours() let year = date.getFullYear()
let minute = date.getMinutes() let month = date.getMonth() + 1
let second = date.getSeconds() let day = date.getDate()
return [year, month, day].map(formatNumber).join('-') let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-')
} }
//返回 12:30 //返回 12:30
function selfFormatTimeHM(time) { function selfFormatTimeHM(time) {
let date = new Date(time); if (typeof time === "string" && time.includes('-')) {
let year = date.getFullYear() time = time.replaceAll('-', '/')
let month = date.getMonth() + 1 }
let day = date.getDate() let date = new Date(time);
let hour = date.getHours() let year = date.getFullYear()
let minute = date.getMinutes() let month = date.getMonth() + 1
let second = date.getSeconds() let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
return [hour, minute].map(formatNumber).join(':') return [hour, minute].map(formatNumber).join(':')
} }
/** /**
@ -160,29 +181,35 @@ function selfFormatTimeHM(time) {
* @return 1天2时3分5秒 * @return 1天2时3分5秒
*/ */
function twoTimeInterval(startTime, endTime) { function twoTimeInterval(startTime, endTime) {
// 开始时间 if (typeof startTime === "string" && startTime.includes('-')) {
let date1 = new Date(startTime); startTime = startTime.replaceAll('-', '/')
// 结束时间 }
let date2 = new Date(endTime); if (typeof endTime === "string" && endTime.includes('-')) {
// 时间相差秒数 endTime = endTime.replaceAll('-', '/')
let dateDiff = date2.getTime() - date1.getTime(); }
// 计算出相差天数 // 开始时间
let days = Math.floor(dateDiff / (24 * 3600 * 1000)); let date1 = new Date(startTime);
// 计算出小时数 // 结束时间
let residue1 = dateDiff % (24 * 3600 * 1000); // 计算天数后剩余的毫秒数 let date2 = new Date(endTime);
let hours = Math.floor(residue1 / (3600 * 1000)); // 时间相差秒数
// 计算相差分钟数 let dateDiff = date2.getTime() - date1.getTime();
let residue2 = residue1 % (3600 * 1000); // 计算小时数后剩余的毫秒数 // 计算出相差天数
let minutes = Math.floor(residue2 / (60 * 1000)); let days = Math.floor(dateDiff / (24 * 3600 * 1000));
// 计算相差秒数 // 计算出小时数
let residue3 = residue2 % (60 * 1000); // 计算分钟数后剩余的毫秒数 let residue1 = dateDiff % (24 * 3600 * 1000); // 计算天数后剩余的毫秒数
let seconds = Math.round(residue3 / 1000); let hours = Math.floor(residue1 / (3600 * 1000));
let returnVal = // 计算相差分钟数
((days == 0) ? "" : days + "天") + let residue2 = residue1 % (3600 * 1000); // 计算小时数后剩余的毫秒数
((hours == 0) ? "" : hours + "时") + let minutes = Math.floor(residue2 / (60 * 1000));
((minutes == 0) ? "" : minutes + "分") // 计算相差秒数
// + ((seconds == 0) ? "" : seconds + "秒"); let residue3 = residue2 % (60 * 1000); // 计算分钟数后剩余的毫秒数
return returnVal; let seconds = Math.round(residue3 / 1000);
let returnVal =
((days == 0) ? "" : days + "天") +
((hours == 0) ? "" : hours + "时") +
((minutes == 0) ? "" : minutes + "分")
// + ((seconds == 0) ? "" : seconds + "秒");
return returnVal;
} }
@ -193,75 +220,81 @@ function twoTimeInterval(startTime, endTime) {
* @return 12 * @return 12
*/ */
function twoTimeIntervalReturnHours(startTime, endTime) { function twoTimeIntervalReturnHours(startTime, endTime) {
// 开始时间 if (typeof startTime === "string" && startTime.includes('-')) {
let date1 = new Date(startTime); startTime = startTime.replaceAll('-', '/')
// 结束时间 }
let date2 = new Date(endTime); if (typeof endTime === "string" && endTime.includes('-')) {
// 时间相差秒数 endTime = endTime.replaceAll('-', '/')
let dateDiff = date2.getTime() - date1.getTime(); }
// 计算出小时数 // 开始时间
let hours = Math.floor(dateDiff / (3600 * 1000)); let date1 = new Date(startTime);
return hours; // 结束时间
let date2 = new Date(endTime);
// 时间相差秒数
let dateDiff = date2.getTime() - date1.getTime();
// 计算出小时数
let hours = Math.floor(dateDiff / (3600 * 1000));
return hours;
} }
const formatNumber = n => { const formatNumber = n => {
n = n.toString() n = n.toString()
return n[1] ? n : '0' + n return n[1] ? n : '0' + n
} }
// 数组sum合计 // 数组sum合计
function selfArrSum(list) { function selfArrSum(list) {
let count = 0; let count = 0;
list.map(item => { list.map(item => {
count = count + item count = count + item
}) })
return count return count
} }
// 返回url参数对象 // 返回url参数对象
function getUrlParamsObj(url) { function getUrlParamsObj(url) {
// 通过 ? 分割获取后面的参数字符串 // 通过 ? 分割获取后面的参数字符串
let urlStr = url.split('?')[1] let urlStr = url.split('?')[1]
// 创建空对象存储参数 // 创建空对象存储参数
let obj = {}; let obj = {};
// 再通过 & 将每一个参数单独分割出来 // 再通过 & 将每一个参数单独分割出来
let paramsArr = urlStr.split('&') let paramsArr = urlStr.split('&')
for (let i = 0, len = paramsArr.length; i < len; i++) { for (let i = 0, len = paramsArr.length; i < len; i++) {
// 再通过 = 将每一个参数分割为 key:value 的形式 // 再通过 = 将每一个参数分割为 key:value 的形式
let arr = paramsArr[i].split('=') let arr = paramsArr[i].split('=')
obj[arr[0]] = arr[1]; obj[arr[0]] = arr[1];
} }
return obj return obj
} }
// 判断是否是图片 // 判断是否是图片
function checkIsImg(url) { function checkIsImg(url) {
if (!/\.(jpg|jpeg|png|GIF|JPG|PNG)$/.test(url)) { if (!/\.(jpg|jpeg|png|GIF|JPG|PNG)$/.test(url)) {
return false; return false;
} else { } else {
return true; return true;
} }
} }
function uploadFile(url) { function uploadFile(url) {
let _this = this let _this = this
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.uploadFile({ wx.uploadFile({
url: app.DOMAIN_NAME + '/api/dfs/upload', url: app.DOMAIN_NAME + '/api/dfs/upload',
filePath: url, filePath: url,
name: 'file', name: 'file',
header: { header: {
"Authorization": 'Bearer ' + wx.getStorageSync('token') "Authorization": 'Bearer ' + wx.getStorageSync('token')
}, },
formData: {}, formData: {},
success: res => { success: res => {
resolve(JSON.parse(res.data)); resolve(JSON.parse(res.data));
}, },
fail: err => { fail: err => {
reject(err); reject(err);
} }
})
}) })
})
} }
@ -270,75 +303,75 @@ function uploadFile(url) {
// repairId : 工单id报修人不传 // repairId : 工单id报修人不传
// operate : repair报修feedback维修eval评价 // operate : repair报修feedback维修eval评价
function repairAttachUpload(data) { function repairAttachUpload(data) {
let _this = this let _this = this
let paramUrl = "?a=a" let paramUrl = "?a=a"
if (data.repairId) { if (data.repairId) {
paramUrl = paramUrl + '&repairId=' + data.repairId paramUrl = paramUrl + '&repairId=' + data.repairId
} }
if (data.operate) { if (data.operate) {
paramUrl = paramUrl + '&operate=' + data.operate paramUrl = paramUrl + '&operate=' + data.operate
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.uploadFile({ wx.uploadFile({
url: app.DOMAIN_NAME + '/app/repairAttach/upload' + paramUrl, url: app.DOMAIN_NAME + '/app/repairAttach/upload' + paramUrl,
filePath: data.url, filePath: data.url,
name: 'file', name: 'file',
header: { header: {
"Authorization": 'Bearer ' + wx.getStorageSync('token') "Authorization": 'Bearer ' + wx.getStorageSync('token')
}, },
formData: {}, formData: {},
success: res => { success: res => {
resolve(JSON.parse(res.data)); resolve(JSON.parse(res.data));
}, },
fail: err => { fail: err => {
reject(err); reject(err);
} }
})
}) })
})
} }
// 报修上传语音 // 报修上传语音
// url: localhost:9227/app/repairAttach/upload/voice // url: localhost:9227/app/repairAttach/upload/voice
function uploadVoice(url) { function uploadVoice(url) {
let _this = this let _this = this
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.uploadFile({ wx.uploadFile({
url: app.DOMAIN_NAME + '/app/repairAttach/upload/voice', url: app.DOMAIN_NAME + '/app/repairAttach/upload/voice',
filePath: url, filePath: url,
name: 'file', name: 'file',
header: { header: {
"Authorization": 'Bearer ' + wx.getStorageSync('token') "Authorization": 'Bearer ' + wx.getStorageSync('token')
}, },
formData: {}, formData: {},
success: res => { success: res => {
resolve(JSON.parse(res.data)); resolve(JSON.parse(res.data));
}, },
fail: err => { fail: err => {
reject(err); reject(err);
} }
})
}) })
})
} }
module.exports = { module.exports = {
formatTime: formatTime, formatTime: formatTime,
formatDate: formatDate, formatDate: formatDate,
formatYear: formatYear, formatYear: formatYear,
formatDate2: formatDate2, formatDate2: formatDate2,
formatHour: formatHour, formatHour: formatHour,
formatTime2: formatTime2, formatTime2: formatTime2,
selfFormatTimeReturnSecond59, selfFormatTimeReturnSecond59,
selfFormatTimeYMDHMS, selfFormatTimeYMDHMS,
selfFormatTimeYMDHM, selfFormatTimeYMDHM,
selfFormatTimeYMD, selfFormatTimeYMD,
selfFormatTimeHM, selfFormatTimeHM,
selfFormatTimeYMDH, selfFormatTimeYMDH,
twoTimeInterval, twoTimeInterval,
twoTimeIntervalReturnHours, twoTimeIntervalReturnHours,
selfArrSum, selfArrSum,
getUrlParamsObj, getUrlParamsObj,
checkIsImg, checkIsImg,
uploadFile, uploadFile,
repairAttachUpload, repairAttachUpload,
uploadVoice uploadVoice
} }