refactor(components): 重构图片资源引用方式,使用动态路径
将静态图片路径改为从valueUrl动态获取,统一管理图片资源路径 添加新的SVG图标资源 修复BI组件401未授权时的登录跳转逻辑 优化签到组件图片资源路径
This commit is contained in:
@@ -145,7 +145,7 @@ class SignInBox extends HTMLElement {
|
||||
(t, i) => `
|
||||
<div class="rule-item flexacenter">
|
||||
<div class="rule-item-icon flexcenter">
|
||||
<img class="rule-item-img" src="${i == 0 ? "https://app.gter.net/image/miniApp/offer/bi.png" : "https://app.gter.net/image/miniApp/offer/hardworking-icon.png"}">
|
||||
<img class="rule-item-img" src="${i == 0 ? "https://app.gter.net/image/gter/commonCom/sign-in/img/bi.png" : "https://app.gter.net/image/gter/commonCom/sign-in/img/hardworking-icon.png"}">
|
||||
</div>
|
||||
<div class="rule-item-text flex1">${t}</div>
|
||||
</div>`
|
||||
@@ -155,6 +155,10 @@ class SignInBox extends HTMLElement {
|
||||
this.isInit = true;
|
||||
|
||||
this.getList();
|
||||
|
||||
const scrollWidth = window.innerWidth - document.documentElement.clientWidth;
|
||||
document.body.style.overflow = "hidden";
|
||||
document.body.style.paddingRight = `${scrollWidth}px`;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -205,7 +209,7 @@ class SignInBox extends HTMLElement {
|
||||
const row = Math.floor(index / 7);
|
||||
const showMobile = visibleRows.has(row) ? "show-mobile" : "";
|
||||
|
||||
items.push(`<div class="calendar-item flexcenter ${cls} row-${row} ${showMobile}">${name}<img class="yellow-tick" src="https://app.gter.net/image/miniApp/offer/yellow-tick.svg"></div>`);
|
||||
items.push(`<div class="calendar-item flexcenter ${cls} row-${row} ${showMobile}">${name}<img class="yellow-tick" src="https://app.gter.net/image/gter/commonCom/sign-in/img/yellow-tick.svg"></div>`);
|
||||
}
|
||||
box.innerHTML = items.join("");
|
||||
}
|
||||
@@ -278,7 +282,7 @@ class SignInBox extends HTMLElement {
|
||||
const todayItem = this.shadowRoot.querySelector(".calendar-item.today");
|
||||
todayItem.classList.remove("today");
|
||||
todayItem.classList.add("already");
|
||||
todayItem.innerHTML = `+${rewardT}<img class="yellow-tick" src="https://app.gter.net/image/miniApp/offer/yellow-tick.svg">`;
|
||||
todayItem.innerHTML = `+${rewardT}<img class="yellow-tick" src="https://app.gter.net/image/gter/commonCom/sign-in/img/yellow-tick.svg">`;
|
||||
|
||||
this.issign = 1;
|
||||
|
||||
@@ -342,6 +346,9 @@ class SignInBox extends HTMLElement {
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
resolve(xhr.response);
|
||||
} else if (xhr.status === 401) {
|
||||
if (typeof ajax_login === "function") ajax_login();
|
||||
else window.open("https://passport.gter.net/?referer=" + escape(location.href), "_self");
|
||||
}
|
||||
};
|
||||
xhr.send(JSON.stringify(data));
|
||||
@@ -374,11 +381,12 @@ class SignInBox extends HTMLElement {
|
||||
}
|
||||
|
||||
open() {
|
||||
const scrollWidth = window.innerWidth - document.documentElement.clientWidth;
|
||||
document.body.style.overflow = "hidden";
|
||||
document.body.style.paddingRight = `${scrollWidth}px`;
|
||||
if (this.isInit) this.shadowRoot.querySelector(".signInBox-mask").style.display = "flex";
|
||||
else {
|
||||
if (this.isInit) {
|
||||
this.shadowRoot.querySelector(".signInBox-mask").style.display = "flex";
|
||||
const scrollWidth = window.innerWidth - document.documentElement.clientWidth;
|
||||
document.body.style.overflow = "hidden";
|
||||
document.body.style.paddingRight = `${scrollWidth}px`;
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user