统一排行榜对齐星雀UI,页面资源后台配置实时刷新

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-06-27 01:26:11 +08:00
parent 1ab2e2080a
commit 21112173f2
292 changed files with 64010 additions and 81 deletions

View File

@@ -0,0 +1,25 @@
class EmojiDecoder {
emojiMap = null;
url = "";
patterns = [];
metaChars = /[[\]{}()*+?.\\|^$\-,&#\s]/g;
decode = this.decode;
constructor(url,emojiMap) {
this.url = url || '';
this.emojiMap = emojiMap || {};
for (let i in this.emojiMap) {
if (this.emojiMap.hasOwnProperty(i)){
this.patterns.push('('+i.replace(this.metaChars, "\\$&")+')');
}
}
}
decode (text) {
return text.replace(new RegExp(this.patterns.join('|'),'g'), (match) => {
return typeof this.emojiMap[match] != 'undefined' ? '<img height="20rpx" width="20rpx" src="'+this.url+this.emojiMap[match]+'" />' : match;
});
}
}
export default EmojiDecoder

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,146 @@
class RestApi {
//用户数据示例
users = [
{
id: '08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a',
name: 'Mattie',
password: '123',
avatar: '/static/images/Avatar-1.png',
email: 'Mattie@goeasy.io',
phone: '138xxxxxxxx',
},
{
id: '3bb179af-bcc5-4fe0-9dac-c05688484649',
name: 'Wallace',
password: '123',
avatar: '/static/images/Avatar-2.png',
email: 'Wallace@goeasy.io',
phone: '138xxxxxxxx',
},
{
id: 'fdee46b0-4b01-4590-bdba-6586d7617f95',
name: 'Tracy',
password: '123',
avatar: '/static/images/Avatar-3.png',
email: 'Tracy@goeasy.io',
phone: '138xxxxxxxx',
},
{
id: '33c3693b-dbb0-4bc9-99c6-fa77b9eb763f',
name: 'Juanita',
password: '123',
avatar: '/static/images/Avatar-4.png',
email: 'Juanita@goeasy.io',
phone: '138xxxxxxxx',
},
];
//群数据示例
groups = [
{
id: 'group-a42b-47b2-bb1e-15e0f5f9a19a',
name: '小程序交流群',
avatar: '/static/images/wx.png',
userList: [
'08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a',
'3bb179af-bcc5-4fe0-9dac-c05688484649',
'fdee46b0-4b01-4590-bdba-6586d7617f95',
'33c3693b-dbb0-4bc9-99c6-fa77b9eb763f',
],
},
{
id: 'group-4b01-4590-bdba-6586d7617f95',
name: 'UniApp交流群',
avatar: '/static/images/uniapp.png',
userList: [
'08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a',
'fdee46b0-4b01-4590-bdba-6586d7617f95',
'33c3693b-dbb0-4bc9-99c6-fa77b9eb763f',
],
},
{
id: 'group-dbb0-4bc9-99c6-fa77b9eb763f',
name: 'GoEasy交流群',
avatar: '/static/images/goeasy.jpeg',
userList: ['08c0a6ec-a42b-47b2-bb1e-15e0f5f9a19a', '3bb179af-bcc5-4fe0-9dac-c05688484649'],
},
];
// 订单
orders = [
{
id: '252364104325',
url: '/static/images/goods1-1.jpg',
name: '青桔柠檬气泡美式',
price: '¥23',
count: 1
},
{
id: '251662058022',
url: '/static/images/goods1-2.jpg',
name: '咸柠七',
price: '¥8',
count: 2
},
{
id: '250676186141',
url: '/static/images/goods1-3.jpg',
name: '黑糖波波鲜奶茶',
price: '¥12',
count: 1
}
];
findUsers() {
return this.users;
};
findFriends(user) {
return this.users.filter((v) => v.id !== user.id);
}
findGroups(user) {
return this.groups.filter((v) => v.userList.find((id) => id === user.id));
}
findUser(username, password) {
return this.users.find((user) => user.name === username && user.password === password);
}
getOrderList() {
return this.orders;
}
findGroupById(groupId) {
return this.groups.find((group) => group.id === groupId);
}
findUserById(userId) {
return this.users.find((user) => user.id === userId);
}
findGroupMembers (groupId) {
let members = [];
let group = this.groups.find(v => v.id === groupId);
this.users.map(user => {
let userId = group.userList.find((id)=>{
return id === user.id;
});
members.push(user);
});
return members;
}
findGroupMemberAvatars (groupId) {
let avatars = [];
let group = this.groups.find((v) => v.id === groupId);
this.users.map((user) => {
group.userList.forEach((userId) => {
if (user.id === userId) {
avatars.push(user.avatar);
}
});
});
return avatars;
}
}
export default new RestApi();

View File

@@ -0,0 +1,49 @@
/**
* 格式化日期
* @prama t 时间戳
* @return str MM-dd HH:mm
*/
export function formatDate(t) {
t = t || Date.now();
let time = new Date(t);
let str = time.getMonth() < 9 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1;
str += '-';
str += time.getDate() < 10 ? '0' + time.getDate() : time.getDate();
str += ' ';
str += time.getHours();
str += ':';
str += time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes();
return str;
};
/**
* 距当前时间点的时长
* @prama time 13位时间戳
* @return str x秒 / x分钟 / x小时
*/
export function formateTime(time) {
const second = 1000;
const minute = second * 60;
const hour = minute * 60;
const day = hour * 24;
const now = new Date().getTime();
const diffValue = now - time;
// 计算差异时间的量级
const secondC = diffValue / second;
const minC = diffValue / minute;
const hourC = diffValue / hour;
const dayC = diffValue / day;
if (dayC >= 1) {
return parseInt(dayC) + "天";
} else if (hourC >= 1) {
return parseInt(hourC) + "小时";
} else if (minC >= 1) {
return parseInt(minC) + "分钟";
} else if (secondC >= 1) {
return parseInt(secondC) + "秒";
} else {
return '0秒';
}
}