|
@@ -118,10 +118,17 @@
|
|
|
this.httpUrl = 'http://test.wefanbot.com:18993'
|
|
this.httpUrl = 'http://test.wefanbot.com:18993'
|
|
|
}
|
|
}
|
|
|
if (this.getQueryParam('memberId')) {
|
|
if (this.getQueryParam('memberId')) {
|
|
|
- // 已授权
|
|
|
|
|
- this.memberId = this.getQueryParam('memberId')
|
|
|
|
|
- this.getQyWxSign()
|
|
|
|
|
- this.executeDetail()
|
|
|
|
|
|
|
+ if (this.isUnknownType(this.getQueryParam('memberId'))) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '员工未激活',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 已授权
|
|
|
|
|
+ this.memberId = this.getQueryParam('memberId')
|
|
|
|
|
+ this.getQyWxSign()
|
|
|
|
|
+ this.executeDetail()
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
// 授权
|
|
// 授权
|
|
|
this.getAuth()
|
|
this.getAuth()
|
|
@@ -270,20 +277,29 @@
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
formatTime(seconds) {
|
|
formatTime(seconds) {
|
|
|
- if (seconds === undefined || seconds === '' || seconds === null) {
|
|
|
|
|
- return '--'
|
|
|
|
|
|
|
+ // 处理无效输入(空值/非数字)
|
|
|
|
|
+ if (seconds == null || seconds === '' || typeof seconds !== 'number') {
|
|
|
|
|
+ return '--';
|
|
|
}
|
|
}
|
|
|
- if (seconds >= 3600) {
|
|
|
|
|
- // 转换为小时并保留整数部分
|
|
|
|
|
- const hour = this.formatNumber(seconds / 3600);
|
|
|
|
|
- return `${hour}小时`;
|
|
|
|
|
- } else if (seconds >= 60) {
|
|
|
|
|
- // 转换为分钟并保留整数部分
|
|
|
|
|
- const minutes = this.formatNumber(seconds / 60);
|
|
|
|
|
- return `${minutes}分钟`;
|
|
|
|
|
|
|
+ // 确定时间符号和绝对值
|
|
|
|
|
+ const isNegative = seconds < 0;
|
|
|
|
|
+ const absSeconds = Math.abs(seconds);
|
|
|
|
|
+ // 内部格式化函数(处理绝对值)
|
|
|
|
|
+ const format = (val, unit) => {
|
|
|
|
|
+ const num = Math.round(val);
|
|
|
|
|
+ return `${num}${unit}${num > 1 ? '们' : ''}`;
|
|
|
|
|
+ };
|
|
|
|
|
+ // 根据绝对值大小转换单位
|
|
|
|
|
+ let formatted;
|
|
|
|
|
+ if (absSeconds >= 3600) {
|
|
|
|
|
+ formatted = format(absSeconds / 3600, '小时');
|
|
|
|
|
+ } else if (absSeconds >= 60) {
|
|
|
|
|
+ formatted = format(absSeconds / 60, '分钟');
|
|
|
} else {
|
|
} else {
|
|
|
- return `${seconds}秒`;
|
|
|
|
|
|
|
+ formatted = format(absSeconds, '秒');
|
|
|
}
|
|
}
|
|
|
|
|
+ // 添加负号(当原始值为负时)
|
|
|
|
|
+ return isNegative ? `-${formatted}` : formatted;
|
|
|
},
|
|
},
|
|
|
formatNumber(num) {
|
|
formatNumber(num) {
|
|
|
const number = Number(num);
|
|
const number = Number(num);
|
|
@@ -311,6 +327,11 @@
|
|
|
// 返回指定参数的值,如果不存在则返回null
|
|
// 返回指定参数的值,如果不存在则返回null
|
|
|
return urlParams.get(paramName);
|
|
return urlParams.get(paramName);
|
|
|
},
|
|
},
|
|
|
|
|
+ isUnknownType(value) {
|
|
|
|
|
+ // 1. 先检查是否为字符串类型
|
|
|
|
|
+ // 2. 再检查是否以"unknown"开头(区分大小写)
|
|
|
|
|
+ return typeof value === 'string' && value.startsWith('unknown');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|