refactor(components): 重构多个组件并优化公共样式
重构了item-head、item-bottom、item-offer、item-summary和item-tenement组件,优化了props传递和数据处理逻辑 将公共头部和导航样式提取到public.css中,避免重复代码 修复了item-tenement组件中图片显示和数据处理的问题 更新了item-bottom组件的点赞和收藏逻辑,增加错误提示 优化了item-head组件的用户信息显示逻辑 调整了多个组件的样式细节,包括间距、图标大小等
This commit is contained in:
48
js/public.js
48
js/public.js
@@ -25,7 +25,8 @@ const ajax = (url, data) => {
|
||||
resolve(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.response.status == 401)
|
||||
reject();
|
||||
if (err.response?.status == 401)
|
||||
showWindow("login", "https://passport.gter.net/login/ajax", "get", -1, {
|
||||
cover: true,
|
||||
});
|
||||
@@ -336,3 +337,48 @@ const goSendMessage = (uin) => {
|
||||
}
|
||||
redirectToExternalWebsite(`https://bbs.gter.net/home.php?mod=space&showmsg=1&uid=${uin}`);
|
||||
};
|
||||
|
||||
const lang = {
|
||||
money: { 1: "3000以下", 2: "3000-4000", 3: "4000-5000", 4: "5000-6500", 5: "6500-8000", 6: "8000-10000", 7: "10000-20000", 8: "20000-30000", 9: "30000-40000", 10: "40000-50000", 11: "50000以上" },
|
||||
leaseterm: { 1: "长租", 2: "短租" },
|
||||
intermediary: { 1: "中介", 2: "非中介", 3: "房东", 4: "有房招室友", 5: "其他", 6: "求房源" },
|
||||
property: { 1: "唐楼", 2: "洋楼", 3: "酒店式公寓", 4: "村屋", 5: "其他", 6: "学生公寓", 7: "house", 8: "屋苑", 9: "酒店" },
|
||||
elevator: { 1: "有电梯", 2: "无电梯", "-1": "不限" },
|
||||
sunshinearea: { 1: "阳台", 2: "天台", "-1": "无" },
|
||||
floor: { 1: "低层", 2: "中层", 3: "高层", 4: "地下", 5: "不要一楼", 6: "不要顶层" },
|
||||
tenementtype: { 1: "合租", 2: "整租", 1.5: "独卫套房", 1.1: "房间", 1.2: "床位", 1.3: "客厅", 1.4: "其他", 2.1: "studio", 2.2: "一房", 2.3: "两房", 2.4: "三房", 2.5: "四房以上" },
|
||||
gender: { 1: "女性", 2: "男性", 3: "男女皆可" },
|
||||
location: { 1: "港岛", 2: "九龙", 3: "新界", 1.1: "上环/中环/金钟", 1.2: "湾仔/铜锣湾", 1.3: "天后/炮台山", 1.4: "北角/则鱼涌", 1.5: "太古/西湾河", 1.6: "筲箕湾/柴湾", 1.7: "西营盘/坚尼地城/石塘咀", 1.8: "薄扶林", 1.9: "赤柱/香港仔", 1.11: "半山/山顶", 1.12: "南区", 2.1: "九龙站/奥运/南昌", 2.2: "尖沙咀/佐敦", 2.3: "长沙湾/深水埗/荔枝角", 2.4: "美孚/荔景", 2.5: "红磡/黄埔", 2.6: "土瓜湾/何文田", 2.7: "九龙城/启德", 2.8: "石夹尾/九龙塘", 2.9: "乐富/黄大仙", 2.11: "钻石山/彩虹", 2.12: "牛头角/九龙湾/观塘", 2.13: "蓝田/油塘", 2.14: "调景岭", 2.15: "油麻地/旺角/太子", 3.1: "葵芳/葵兴", 3.2: "荃湾", 3.3: "将军澳/坑口/宝琳", 3.4: "大埔仔/西贡", 3.5: "康城", 3.6: "大围/沙田", 3.7: "马鞍山", 3.8: "大埔/火炭/太和", 3.9: "粉岭/上水", 3.11: "赤泥坪/大埔尾/樟树滩", 3.12: "元朗/天水围/屯门", 3.13: "青衣", 3.14: "东涌/马湾/愉景湾", 3.15: "长洲" },
|
||||
apartmentschool: [
|
||||
{ id: 1, name: "港大", sid: 309 },
|
||||
{ id: 2, name: "城大", sid: 311 },
|
||||
{ id: 3, name: "理工", sid: 312 },
|
||||
{ id: 4, name: "浸会", sid: 313 },
|
||||
{ id: 5, name: "中大", sid: 308 },
|
||||
{ id: 6, name: "教大", sid: 453 },
|
||||
{ id: 7, name: "科大", sid: 310 },
|
||||
{ id: 8, name: "岭大", sid: 314 },
|
||||
{ id: 9, name: "都大", sid: 315 },
|
||||
],
|
||||
rentalduration: { 1: "1个月", 2: "2个月", 3: "3个月", 4: "4个月", 5: "5个月", 6: "6个月", 7: "7个月", 8: "8个月", 9: "9个月", 10: "10个月", 11: "11个月", 12: "1年", 13: "1年1个月", 14: "1年2个月", 15: "1年3个月", 16: "1年4个月", 17: "1年5个月", 18: "1年6个月", 24: "2年", 36: "3年" },
|
||||
};
|
||||
|
||||
let copyUid = (text) => {
|
||||
if (navigator.clipboard)
|
||||
copyUid = () => {
|
||||
navigator.clipboard.writeText(text);
|
||||
creationAlertBox("success", "复制成功");
|
||||
};
|
||||
else {
|
||||
copyUid = () => {
|
||||
var tempInput = document.createElement("input");
|
||||
tempInput.value = text;
|
||||
document.body.appendChild(tempInput);
|
||||
tempInput.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(tempInput);
|
||||
creationAlertBox("success", "复制成功");
|
||||
};
|
||||
}
|
||||
copyUid();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user