no message

SPY×FAMILY
鹿和sa0ChunLuyu 4 years ago
parent 04b2375bd1
commit 635bc8c7e8

@ -13,7 +13,10 @@ export const $post = async ({
data = {}
}) => {
let token = getToken() ? getToken() : '';
if (noLogin.indexOf(url) === -1 && token === '') return false
if (noLogin.indexOf(url) === -1 && token === '') {
uni.$lu.toast("请登录")
return false
}
if (requests[url]) return false;
requests[url] = true
let res = await uni.request({

@ -0,0 +1,17 @@
const format = (value = Date.now(), format = "Y-M-D h:m:s") => {
const formatNumber = n => `0${n}`.slice(-2);
const date = new Date(value);
const formatList = ["Y", "M", "D", "h", "m", "s"];
const resultList = [];
resultList.push(date.getFullYear().toString());
resultList.push(formatNumber(date.getMonth() + 1));
resultList.push(formatNumber(date.getDate()));
resultList.push(formatNumber(date.getHours()));
resultList.push(formatNumber(date.getMinutes()));
resultList.push(formatNumber(date.getSeconds()));
for (let i = 0; i < resultList.length; i++) {
format = format.replace(formatList[i], resultList[i]);
}
return format;
}
export default format

@ -1,4 +1,6 @@
import toast from './toast.js';
export default {
toast,
};
import toast from './toast.js';
import format from './format.js';
export default {
toast,
format
};

Loading…
Cancel
Save