|
@@ -6,19 +6,19 @@ function isDataEmpty(data) {
|
|
|
if (data === null || data === undefined) {
|
|
if (data === null || data === undefined) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (typeof data === 'string' && data.trim() === '') {
|
|
if (typeof data === 'string' && data.trim() === '') {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (Array.isArray(data) && data.length === 0) {
|
|
if (Array.isArray(data) && data.length === 0) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (typeof data === 'object' && Object.keys(data).length === 0) {
|
|
if (typeof data === 'object' && Object.keys(data).length === 0) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -28,11 +28,14 @@ function formatDate(timestamp) {
|
|
|
const year = date.getFullYear();
|
|
const year = date.getFullYear();
|
|
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
|
const day = date.getDate().toString().padStart(2, '0');
|
|
const day = date.getDate().toString().padStart(2, '0');
|
|
|
- return `${year}-${month}-${day}`;
|
|
|
|
|
|
|
+ const hour = date.getHours().toString().padStart(2,'0');
|
|
|
|
|
+ const minutes = date.getMinutes().toString().padStart(2,'0');
|
|
|
|
|
+ const secoonds = date.getSeconds().toString().padStart(2,'0');
|
|
|
|
|
+ return `${year}-${month}-${day} ${hour}:${minutes}:${secoonds}`;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 日期转换
|
|
// 日期转换
|
|
|
-function dateFormatYmd(dateStr) {
|
|
|
|
|
|
|
+function dateFormatYmd(dateStr) {
|
|
|
const timestamp = new Date(dateStr).getTime();
|
|
const timestamp = new Date(dateStr).getTime();
|
|
|
const date = new Date(timestamp);
|
|
const date = new Date(timestamp);
|
|
|
const year = date.getFullYear();
|
|
const year = date.getFullYear();
|
|
@@ -42,27 +45,27 @@ function dateFormatYmd(dateStr) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取服务器图片
|
|
// 获取服务器图片
|
|
|
-async function getImgUrlByOssId(ossId){
|
|
|
|
|
|
|
+async function getImgUrlByOssId(ossId){
|
|
|
console.log(ossId)
|
|
console.log(ossId)
|
|
|
if(ossId){
|
|
if(ossId){
|
|
|
try {
|
|
try {
|
|
|
- const res = await uni.$u.http.get('/resource/oss/listByIds/'+ossId,{data: {auth: true}});
|
|
|
|
|
|
|
+ const res = await uni.$u.http.get('/resource/oss/listByIds/'+ossId,{data: {auth: true}});
|
|
|
if(res.length > 0){
|
|
if(res.length > 0){
|
|
|
console.log(res[0].url);
|
|
console.log(res[0].url);
|
|
|
const url = res[0].url;
|
|
const url = res[0].url;
|
|
|
return url.replace(/^http:/, "https:");
|
|
return url.replace(/^http:/, "https:");
|
|
|
}
|
|
}
|
|
|
- } catch (err) {
|
|
|
|
|
- await uni.showToast({
|
|
|
|
|
- title: "操作失败"
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ await uni.showToast({
|
|
|
|
|
+ title: "操作失败"
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 刷新用户登录信息
|
|
// 刷新用户登录信息
|
|
|
-async function refreshUserLoginInfo(){
|
|
|
|
|
|
|
+async function refreshUserLoginInfo(){
|
|
|
uni.$u.http.get('/member/wechat/getUserInfo',{data: {auth: true}}).then((res)=>{
|
|
uni.$u.http.get('/member/wechat/getUserInfo',{data: {auth: true}}).then((res)=>{
|
|
|
// 数据获取token
|
|
// 数据获取token
|
|
|
this.$store.commit('updateLoginUserInfo', res);
|
|
this.$store.commit('updateLoginUserInfo', res);
|
|
@@ -87,4 +90,4 @@ export default {
|
|
|
getImgUrlByOssId,
|
|
getImgUrlByOssId,
|
|
|
refreshUserLoginInfo,
|
|
refreshUserLoginInfo,
|
|
|
replaceHttpWithHttps
|
|
replaceHttpWithHttps
|
|
|
-};
|
|
|
|
|
|
|
+};
|