fix(frontend): align reward modal with shared runtime
This commit is contained in:
1 parent
6037ca184b
commit
356f7fe5bd
14 files changed
+337
-630
No files matched your search
@@ -5232,248 +5232,6 @@ body.aksrt-body-scroll .aksrt-show-on-scroll {
|
|||||||
.aksrt-cursor-zoom-in {
|
.aksrt-cursor-zoom-in {
|
||||||
cursor: zoom-in;
|
cursor: zoom-in;
|
||||||
}
|
}
|
||||||
/* ============================================================
|
|
||||||
* 8. 打赏弹窗
|
|
||||||
* ============================================================ */
|
|
||||||
.reward-modal {
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
z-index: 99999;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
opacity: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
transition: opacity 0.3s, visibility 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal.is-open {
|
|
||||||
opacity: 1;
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__overlay {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
background: rgba(0,0,0,0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__card {
|
|
||||||
position: relative;
|
|
||||||
background: var(--surface-1, #fff);
|
|
||||||
border-radius: var(--radius-lg, 8px);
|
|
||||||
padding: 32px;
|
|
||||||
max-width: 360px;
|
|
||||||
width: 90%;
|
|
||||||
text-align: center;
|
|
||||||
box-shadow: 0 8px 32px rgba(0,0,0,0.15);
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__title {
|
|
||||||
margin: 0 0 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--color-ink);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__desc {
|
|
||||||
margin: 0 0 20px;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--color-ink-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__qr {
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
margin: 0 auto 16px;
|
|
||||||
border-radius: var(--radius, 10px);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__qr img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__close {
|
|
||||||
position: absolute;
|
|
||||||
top: 12px;
|
|
||||||
right: 12px;
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--surface-2, #F4F5F7);
|
|
||||||
color: var(--color-ink-3);
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
transition: background 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__close:hover {
|
|
||||||
background: var(--surface-3, #ECEEF1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.reward-modal__content > p {
|
|
||||||
margin: -4px 0 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
||||||
gap: 10px;
|
|
||||||
margin: 18px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amount {
|
|
||||||
min-height: 42px;
|
|
||||||
border: 1px solid var(--color-line-soft, rgba(15, 23, 42, 0.1));
|
|
||||||
border-radius: 10px;
|
|
||||||
background: var(--surface-2);
|
|
||||||
color: var(--color-ink-2);
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amount.is-active {
|
|
||||||
border-color: var(--color-primary);
|
|
||||||
background: var(--color-primary-soft);
|
|
||||||
color: var(--color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 12px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
color: var(--color-ink-3);
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom input {
|
|
||||||
width: 140px;
|
|
||||||
min-height: 40px;
|
|
||||||
border: 1px solid var(--color-line-soft, rgba(15, 23, 42, 0.1));
|
|
||||||
border-radius: 9px;
|
|
||||||
background: var(--surface-1);
|
|
||||||
color: var(--color-ink);
|
|
||||||
padding: 0 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__submit {
|
|
||||||
width: 100%;
|
|
||||||
min-height: 42px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__message {
|
|
||||||
min-height: 20px;
|
|
||||||
margin-top: 10px;
|
|
||||||
color: var(--color-primary);
|
|
||||||
font-size: 12px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
/* ---- reward amounts ---- */
|
|
||||||
.reward-amounts {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 8px;
|
|
||||||
justify-content: center;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__btn {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: baseline;
|
|
||||||
gap: 2px;
|
|
||||||
padding: 8px 16px;
|
|
||||||
border: 1px solid var(--color-line, #e5e7eb);
|
|
||||||
border-radius: var(--radius, 10px);
|
|
||||||
background: var(--surface-2, #F4F5F7);
|
|
||||||
color: var(--color-ink);
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__btn:hover {
|
|
||||||
border-color: var(--color-primary, #f04494);
|
|
||||||
background: rgba(240, 68, 148, 0.06);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__btn.is-active {
|
|
||||||
border-color: var(--color-primary, #f04494);
|
|
||||||
background: var(--color-primary, #f04494);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__currency {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__value {
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
/* ---- custom amount ---- */
|
|
||||||
.reward-custom {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__input {
|
|
||||||
flex: 1;
|
|
||||||
height: 40px;
|
|
||||||
padding: 0 12px;
|
|
||||||
border: 1px solid var(--color-line, #e5e7eb);
|
|
||||||
border-radius: var(--radius, 10px);
|
|
||||||
background: var(--surface-2, #F4F5F7);
|
|
||||||
color: var(--color-ink);
|
|
||||||
font-size: 14px;
|
|
||||||
text-align: center;
|
|
||||||
outline: none;
|
|
||||||
transition: border-color 0.2s;
|
|
||||||
-moz-appearance: textfield;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__input::-webkit-inner-spin-button,
|
|
||||||
.reward-custom__input::-webkit-outer-spin-button {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__input:focus {
|
|
||||||
border-color: var(--color-primary, #f04494);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__confirm {
|
|
||||||
flex-shrink: 0;
|
|
||||||
height: 40px;
|
|
||||||
padding: 0 20px;
|
|
||||||
border: none;
|
|
||||||
border-radius: var(--radius, 10px);
|
|
||||||
background: var(--color-primary, #f04494);
|
|
||||||
color: #fff;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: opacity 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__confirm:hover {
|
|
||||||
opacity: 0.85;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
* 9. 公告跑马灯 Widget
|
* 9. 公告跑马灯 Widget
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
:root{--color-primary: #f04494;--color-primary-hover: #e0307e;--color-primary-active: #c9206d;--color-primary-soft: rgba(240, 68, 148, .1);--color-primary-softer: rgba(240, 68, 148, .05);--color-on-primary: #FFFFFF;--color-ink: #333333;--color-ink-2: #4e5358;--color-ink-3: #777777;--color-ink-4: #999999;--surface-page: #f5f6f7;--surface-1: #FFFFFF;--surface-2: #eeeeee;--surface-3: #e9ecef;--surface-4: #f8f8f8;--color-line: rgba(50, 50, 50, .06);--color-line-soft: rgba(0, 0, 0, .03);--color-line-stronger: rgba(50, 50, 50, .12);--color-success: #10B981;--color-warning: #F59E0B;--color-error: #EF4444;--color-info: #3B82F6;--color-accent: #18a058;--color-accent-soft: rgba(24, 160, 88, .12);--color-accent-shadow: rgba(24, 160, 88, .28);--font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;--text-xs: .75rem;--text-sm: .875rem;--text-base: .875rem;--text-md: 1.125rem;--text-lg: 1.25rem;--text-xl: 1.5rem;--text-2xl: 1.875rem;--text-3xl: 2.25rem;--text-4xl: 3rem;--text-5xl: 3.75rem;--leading-tight: 1.2;--leading-snug: 1.4;--leading-normal: 1.6;--leading-relaxed: 1.6;--space-1: 4px;--space-2: 8px;--space-3: 12px;--space-4: 16px;--space-5: 20px;--space-6: 24px;--space-7: 32px;--space-8: 40px;--space-9: 48px;--space-10: 64px;--space-11: 80px;--space-12: 96px;--radius-xs: 3px;--radius-sm: 4px;--radius: 8px;--radius-lg: 8px;--radius-xl: 12px;--radius-2xl: 16px;--radius-pill: 100px;--radius-avatar: 50%;--shadow-xs: 0 1px 2px rgba(0, 0, 0, .03);--shadow-sm: 0 0 10px rgba(116, 116, 116, .08);--shadow: 0 0 10px rgba(116, 116, 116, .12);--shadow-lg: 0 12px 32px rgba(18, 18, 18, .1);--shadow-drawer: 0 18px 60px rgba(0, 0, 0, .2);--nav-height: 60px;--container: 1200px;--container-wide: 1440px;--container-read: 760px;--container-page: 880px;--sidebar-width: 311px;--content-gap: 24px;--section-gap: 24px;--sidebar-bp: 992px;--ease: cubic-bezier(.4, 0, .2, 1);--ease-out: cubic-bezier(.16, 1, .3, 1);--ease-spring: cubic-bezier(.34, 1.56, .64, 1);--dur-fast: .15s;--dur: .25s;--dur-slow: .4s;--focus-ring: 0 0 2px 3px rgba(253, 83, 161, .4);--z-dropdown: 100;--z-sticky: 200;--z-fixed: 300;--z-overlay: 400;--z-modal: 500;--z-popover: 600;--z-toast: 700;--z-tooltip: 800;--radius-btn: 4px;--btn-sm-h: 28px;--btn-md-h: 34px;--btn-lg-h: 44px;--card-padding: 15px;--card-padding-sm: 10px;--card-gap: 16px;--card-gap-lg: 20px;--color-primary-light: var(--color-primary-soft);--color-surface: var(--surface-1);--color-line-strong: var(--color-line);--color-bg-hover: var(--surface-2);--color-border-light: var(--color-line-soft);--color-fill: var(--surface-2);--color-warning-bg: #fffbe6;--color-warning-text: #ad6800;--text-secondary: var(--color-ink-3);--text-tertiary: var(--color-ink-4);--surface-active: var(--surface-2);--surface-card: var(--surface-1);--surface-hover: var(--surface-2);--surface-secondary: var(--surface-2);--radius-code: var(--radius);--radius-full: 100px;--shadow-xl: 0 0 10px rgba(116, 116, 116, .12);--space-16: 64px;--z-floating: 900;--transition-fast: .15s ease;--transition-base: .25s ease;--header-bg: var(--blur-bg);--header-color: var(--color-ink-2);--footer-bg: var(--surface-1);--footer-color: var(--color-ink-4);--blur-bg: rgba(255, 255, 255, .8);--float-btn-bg: rgba(200, 200, 200, .4);--font-heading: var(--font-ui);--radius-card: var(--radius);--radius-md: var(--radius);--color-primary-50: var(--color-primary-soft);--color-primary-dark: var(--color-primary-active);--shadow-md: var(--shadow);--mini-radius: calc(var(--radius) / 1.4);--aksrt-avatar-size-xs: 24px;--aksrt-avatar-size-sm: 32px;--aksrt-avatar-size: 40px;--aksrt-avatar-size-lg: 56px;--aksrt-avatar-size-xl: 80px;--aksrt-card-thumb-scale: 56.25%;--aksrt-rose: #f43f5e;--aksrt-rose-soft: rgba(244, 63, 94, .12);--aksrt-blue: #3b82f6;--aksrt-blue-soft: rgba(59, 130, 246, .12);--aksrt-green: #10b981;--aksrt-green-soft: rgba(16, 185, 129, .12);--aksrt-orange: #f97316;--aksrt-orange-soft:rgba(249, 115, 22, .12);--aksrt-purple: #8b5cf6;--aksrt-purple-soft:rgba(139, 92, 246, .12);--aksrt-cyan: #06b6d4;--aksrt-cyan-soft: rgba(6, 182, 212, .12);--aksrt-yellow: #eab308;--aksrt-yellow-soft:rgba(234, 179, 8, .12);--aksrt-red: #ef4444;--aksrt-red-soft: rgba(239, 68, 68, .12);--aksrt-teal: #14b8a6;--aksrt-teal-soft: rgba(20, 184, 166, .12);--aksrt-indigo: #6366f1;--aksrt-indigo-soft:rgba(99, 102, 241, .12);--aksrt-pink: #ec4899;--aksrt-pink-soft: rgba(236, 72, 153, .12);--aksrt-vip-gold-1: #f6d365;--aksrt-vip-gold-2: #fda085;--aksrt-grad-sunset-1: #f093fb;--aksrt-grad-sunset-2: #f5576c;--aksrt-graLine truncated
|
:root{--color-primary: #f04494;--color-primary-hover: #e0307e;--color-primary-active: #c9206d;--color-primary-soft: rgba(240, 68, 148, .1);--color-primary-softer: rgba(240, 68, 148, .05);--color-on-primary: #FFFFFF;--color-ink: #333333;--color-ink-2: #4e5358;--color-ink-3: #777777;--color-ink-4: #999999;--surface-page: #f5f6f7;--surface-1: #FFFFFF;--surface-2: #eeeeee;--surface-3: #e9ecef;--surface-4: #f8f8f8;--color-line: rgba(50, 50, 50, .06);--color-line-soft: rgba(0, 0, 0, .03);--color-line-stronger: rgba(50, 50, 50, .12);--color-success: #10B981;--color-warning: #F59E0B;--color-error: #EF4444;--color-info: #3B82F6;--color-accent: #18a058;--color-accent-soft: rgba(24, 160, 88, .12);--color-accent-shadow: rgba(24, 160, 88, .28);--font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;--font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;--text-xs: .75rem;--text-sm: .875rem;--text-base: .875rem;--text-md: 1.125rem;--text-lg: 1.25rem;--text-xl: 1.5rem;--text-2xl: 1.875rem;--text-3xl: 2.25rem;--text-4xl: 3rem;--text-5xl: 3.75rem;--leading-tight: 1.2;--leading-snug: 1.4;--leading-normal: 1.6;--leading-relaxed: 1.6;--space-1: 4px;--space-2: 8px;--space-3: 12px;--space-4: 16px;--space-5: 20px;--space-6: 24px;--space-7: 32px;--space-8: 40px;--space-9: 48px;--space-10: 64px;--space-11: 80px;--space-12: 96px;--radius-xs: 3px;--radius-sm: 4px;--radius: 8px;--radius-lg: 8px;--radius-xl: 12px;--radius-2xl: 16px;--radius-pill: 100px;--radius-avatar: 50%;--shadow-xs: 0 1px 2px rgba(0, 0, 0, .03);--shadow-sm: 0 0 10px rgba(116, 116, 116, .08);--shadow: 0 0 10px rgba(116, 116, 116, .12);--shadow-lg: 0 12px 32px rgba(18, 18, 18, .1);--shadow-drawer: 0 18px 60px rgba(0, 0, 0, .2);--nav-height: 60px;--container: 1200px;--container-wide: 1440px;--container-read: 760px;--container-page: 880px;--sidebar-width: 311px;--content-gap: 24px;--section-gap: 24px;--sidebar-bp: 992px;--ease: cubic-bezier(.4, 0, .2, 1);--ease-out: cubic-bezier(.16, 1, .3, 1);--ease-spring: cubic-bezier(.34, 1.56, .64, 1);--dur-fast: .15s;--dur: .25s;--dur-slow: .4s;--focus-ring: 0 0 2px 3px rgba(253, 83, 161, .4);--z-dropdown: 100;--z-sticky: 200;--z-fixed: 300;--z-overlay: 400;--z-modal: 500;--z-popover: 600;--z-toast: 700;--z-tooltip: 800;--radius-btn: 4px;--btn-sm-h: 28px;--btn-md-h: 34px;--btn-lg-h: 44px;--card-padding: 15px;--card-padding-sm: 10px;--card-gap: 16px;--card-gap-lg: 20px;--color-primary-light: var(--color-primary-soft);--color-surface: var(--surface-1);--color-line-strong: var(--color-line);--color-bg-hover: var(--surface-2);--color-border-light: var(--color-line-soft);--color-fill: var(--surface-2);--color-warning-bg: #fffbe6;--color-warning-text: #ad6800;--text-secondary: var(--color-ink-3);--text-tertiary: var(--color-ink-4);--surface-active: var(--surface-2);--surface-card: var(--surface-1);--surface-hover: var(--surface-2);--surface-secondary: var(--surface-2);--radius-code: var(--radius);--radius-full: 100px;--shadow-xl: 0 0 10px rgba(116, 116, 116, .12);--space-16: 64px;--z-floating: 900;--transition-fast: .15s ease;--transition-base: .25s ease;--header-bg: var(--blur-bg);--header-color: var(--color-ink-2);--footer-bg: var(--surface-1);--footer-color: var(--color-ink-4);--blur-bg: rgba(255, 255, 255, .8);--float-btn-bg: rgba(200, 200, 200, .4);--font-heading: var(--font-ui);--radius-card: var(--radius);--radius-md: var(--radius);--color-primary-50: var(--color-primary-soft);--color-primary-dark: var(--color-primary-active);--shadow-md: var(--shadow);--mini-radius: calc(var(--radius) / 1.4);--aksrt-avatar-size-xs: 24px;--aksrt-avatar-size-sm: 32px;--aksrt-avatar-size: 40px;--aksrt-avatar-size-lg: 56px;--aksrt-avatar-size-xl: 80px;--aksrt-card-thumb-scale: 56.25%;--aksrt-rose: #f43f5e;--aksrt-rose-soft: rgba(244, 63, 94, .12);--aksrt-blue: #3b82f6;--aksrt-blue-soft: rgba(59, 130, 246, .12);--aksrt-green: #10b981;--aksrt-green-soft: rgba(16, 185, 129, .12);--aksrt-orange: #f97316;--aksrt-orange-soft:rgba(249, 115, 22, .12);--aksrt-purple: #8b5cf6;--aksrt-purple-soft:rgba(139, 92, 246, .12);--aksrt-cyan: #06b6d4;--aksrt-cyan-soft: rgba(6, 182, 212, .12);--aksrt-yellow: #eab308;--aksrt-yellow-soft:rgba(234, 179, 8, .12);--aksrt-red: #ef4444;--aksrt-red-soft: rgba(239, 68, 68, .12);--aksrt-teal: #14b8a6;--aksrt-teal-soft: rgba(20, 184, 166, .12);--aksrt-indigo: #6366f1;--aksrt-indigo-soft:rgba(99, 102, 241, .12);--aksrt-pink: #ec4899;--aksrt-pink-soft: rgba(236, 72, 153, .12);--aksrt-vip-gold-1: #f6d365;--aksrt-vip-gold-2: #fda085;--aksrt-grad-sunset-1: #f093fb;--aksrt-grad-sunset-2: #f5576c;--aksrt-graLine truncated
|
||||||
@@ -1,3 +1 @@
|
|||||||
@import url("components/base.css");
|
|
||||||
@import url("components/reward-amounts.css");
|
|
||||||
@import url("components/custom-amount.css");
|
@import url("components/custom-amount.css");
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
/* ============================================================
|
|
||||||
* 8. 打赏弹窗
|
|
||||||
* ============================================================ */
|
|
||||||
.reward-modal {
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
z-index: 99999;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
opacity: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
transition: opacity 0.3s, visibility 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal.is-open {
|
|
||||||
opacity: 1;
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__overlay {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
background: rgba(0,0,0,0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__card {
|
|
||||||
position: relative;
|
|
||||||
background: var(--surface-1, #fff);
|
|
||||||
border-radius: var(--radius-lg, 8px);
|
|
||||||
padding: 32px;
|
|
||||||
max-width: 360px;
|
|
||||||
width: 90%;
|
|
||||||
text-align: center;
|
|
||||||
box-shadow: 0 8px 32px rgba(0,0,0,0.15);
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__title {
|
|
||||||
margin: 0 0 8px;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--color-ink);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__desc {
|
|
||||||
margin: 0 0 20px;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--color-ink-3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__qr {
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
margin: 0 auto 16px;
|
|
||||||
border-radius: var(--radius, 10px);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__qr img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__close {
|
|
||||||
position: absolute;
|
|
||||||
top: 12px;
|
|
||||||
right: 12px;
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--surface-2, #F4F5F7);
|
|
||||||
color: var(--color-ink-3);
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
transition: background 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__close:hover {
|
|
||||||
background: var(--surface-3, #ECEEF1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.reward-modal__content > p {
|
|
||||||
margin: -4px 0 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
||||||
gap: 10px;
|
|
||||||
margin: 18px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amount {
|
|
||||||
min-height: 42px;
|
|
||||||
border: 1px solid var(--color-line-soft, rgba(15, 23, 42, 0.1));
|
|
||||||
border-radius: 10px;
|
|
||||||
background: var(--surface-2);
|
|
||||||
color: var(--color-ink-2);
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amount.is-active {
|
|
||||||
border-color: var(--color-primary);
|
|
||||||
background: var(--color-primary-soft);
|
|
||||||
color: var(--color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 12px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
color: var(--color-ink-3);
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom input {
|
|
||||||
width: 140px;
|
|
||||||
min-height: 40px;
|
|
||||||
border: 1px solid var(--color-line-soft, rgba(15, 23, 42, 0.1));
|
|
||||||
border-radius: 9px;
|
|
||||||
background: var(--surface-1);
|
|
||||||
color: var(--color-ink);
|
|
||||||
padding: 0 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__submit {
|
|
||||||
width: 100%;
|
|
||||||
min-height: 42px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-modal__message {
|
|
||||||
min-height: 20px;
|
|
||||||
margin-top: 10px;
|
|
||||||
color: var(--color-primary);
|
|
||||||
font-size: 12px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
@@ -1,54 +1,3 @@
|
|||||||
/* ---- custom amount ---- */
|
|
||||||
.reward-custom {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__input {
|
|
||||||
flex: 1;
|
|
||||||
height: 40px;
|
|
||||||
padding: 0 12px;
|
|
||||||
border: 1px solid var(--color-line, #e5e7eb);
|
|
||||||
border-radius: var(--radius, 10px);
|
|
||||||
background: var(--surface-2, #F4F5F7);
|
|
||||||
color: var(--color-ink);
|
|
||||||
font-size: 14px;
|
|
||||||
text-align: center;
|
|
||||||
outline: none;
|
|
||||||
transition: border-color 0.2s;
|
|
||||||
-moz-appearance: textfield;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__input::-webkit-inner-spin-button,
|
|
||||||
.reward-custom__input::-webkit-outer-spin-button {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__input:focus {
|
|
||||||
border-color: var(--color-primary, #f04494);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__confirm {
|
|
||||||
flex-shrink: 0;
|
|
||||||
height: 40px;
|
|
||||||
padding: 0 20px;
|
|
||||||
border: none;
|
|
||||||
border-radius: var(--radius, 10px);
|
|
||||||
background: var(--color-primary, #f04494);
|
|
||||||
color: #fff;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: opacity 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-custom__confirm:hover {
|
|
||||||
opacity: 0.85;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
* 9. 公告跑马灯 Widget
|
* 9. 公告跑马灯 Widget
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
/* ---- reward amounts ---- */
|
|
||||||
.reward-amounts {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 8px;
|
|
||||||
justify-content: center;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__btn {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: baseline;
|
|
||||||
gap: 2px;
|
|
||||||
padding: 8px 16px;
|
|
||||||
border: 1px solid var(--color-line, #e5e7eb);
|
|
||||||
border-radius: var(--radius, 10px);
|
|
||||||
background: var(--surface-2, #F4F5F7);
|
|
||||||
color: var(--color-ink);
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__btn:hover {
|
|
||||||
border-color: var(--color-primary, #f04494);
|
|
||||||
background: rgba(240, 68, 148, 0.06);
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__btn.is-active {
|
|
||||||
border-color: var(--color-primary, #f04494);
|
|
||||||
background: var(--color-primary, #f04494);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__currency {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reward-amounts__value {
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
/* ---- 文章打赏:内容使用 AksrtModalRuntime,几何对齐参考主题 modal-mini ---- */
|
||||||
|
.aksrt-modal-runtime.aksrt-reward-modal:not(.aksrt-modal-runtime--bottom) .aksrt-modal-runtime__dialog {
|
||||||
|
width: min(400px, calc(100vw - 32px));
|
||||||
|
border-radius: var(--main-radius, 8px);
|
||||||
|
background: var(--main-bg-color, #fff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-modal-runtime.aksrt-reward-modal .aksrt-modal-runtime__content {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward-modal .modal-colorful-header + .aksrt-reward__body {
|
||||||
|
margin-top: 0;
|
||||||
|
padding: 135px 15px 15px;
|
||||||
|
color: var(--main-color, var(--color-ink, #333));
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__desc {
|
||||||
|
margin: 0 0 16px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__amounts {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
gap: 8px;
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__amount {
|
||||||
|
display: inline-flex;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 42px;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 2px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border: 1px solid var(--muted-border-color, var(--color-line-stronger, rgba(50, 50, 50, 0.12)));
|
||||||
|
border-radius: var(--main-radius, 8px);
|
||||||
|
background: var(--body-bg-color, var(--surface-2, #eee));
|
||||||
|
color: var(--main-color, var(--color-ink, #333));
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__amount:hover,
|
||||||
|
.aksrt-reward__amount.is-active {
|
||||||
|
border-color: var(--focus-color, var(--color-primary, #f04494));
|
||||||
|
background: var(--focus-color, var(--color-primary, #f04494));
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__currency {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__value {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__custom {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
margin: 0 0 16px;
|
||||||
|
color: var(--muted-color, var(--color-ink-3, #777));
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__input {
|
||||||
|
width: min(180px, 58%);
|
||||||
|
min-height: 40px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border: 1px solid var(--muted-border-color, var(--color-line-stronger, rgba(50, 50, 50, 0.12)));
|
||||||
|
border-radius: var(--main-radius, 8px);
|
||||||
|
background: var(--main-bg-color, #fff);
|
||||||
|
color: var(--main-color, var(--color-ink, #333));
|
||||||
|
text-align: right;
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__input::-webkit-inner-spin-button,
|
||||||
|
.aksrt-reward__input::-webkit-outer-spin-button {
|
||||||
|
margin: 0;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__input:focus {
|
||||||
|
border-color: var(--focus-color, var(--color-primary, #f04494));
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__submit {
|
||||||
|
min-height: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__submit:disabled {
|
||||||
|
cursor: wait;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-reward__message {
|
||||||
|
min-height: 20px;
|
||||||
|
margin-top: 8px;
|
||||||
|
color: var(--focus-color, var(--color-primary, #f04494));
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-modal-runtime--bottom.aksrt-reward-modal .aksrt-modal-runtime__dialog {
|
||||||
|
border-radius: 16px 16px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-modal-runtime--bottom.aksrt-reward-modal .modal-colorful-header {
|
||||||
|
border-radius: 16px 16px 0 0;
|
||||||
|
}
|
||||||
+155
-117
@@ -1,127 +1,165 @@
|
|||||||
/**
|
/**
|
||||||
* On-site wallet tipping modal.
|
* On-site wallet tipping content for the shared modal runtime.
|
||||||
*
|
*
|
||||||
* @package AKSRT
|
* @package AKSRT
|
||||||
*/
|
*/
|
||||||
;(function () {
|
;(function (window, document) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var cfg = window.aksrtData || {};
|
var cfg = window.aksrtData || {};
|
||||||
|
var titleSequence = 0;
|
||||||
|
|
||||||
function initReward() {
|
function rewardModal(target) {
|
||||||
var activeTrigger = null;
|
return target.closest('.aksrt-modal-runtime.aksrt-reward-modal');
|
||||||
|
|
||||||
function operationKey(modal) {
|
|
||||||
if (!modal.dataset.aksrtOperationKey) {
|
|
||||||
modal.dataset.aksrtOperationKey = window.AksrtRequest.createIdempotencyKey();
|
|
||||||
}
|
|
||||||
return modal.dataset.aksrtOperationKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeAll() {
|
|
||||||
document.querySelectorAll('.reward-modal.is-open').forEach(function (modal) {
|
|
||||||
modal.classList.remove('is-open');
|
|
||||||
modal.setAttribute('aria-hidden', 'true');
|
|
||||||
});
|
|
||||||
document.body.style.overflow = '';
|
|
||||||
if (activeTrigger) activeTrigger.focus();
|
|
||||||
activeTrigger = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function open(trigger) {
|
|
||||||
var userId = trigger.getAttribute('data-user-id') || '';
|
|
||||||
var modal = document.getElementById('reward-modal-' + userId);
|
|
||||||
if (!modal) return;
|
|
||||||
closeAll();
|
|
||||||
activeTrigger = trigger;
|
|
||||||
modal.dataset.postId = trigger.getAttribute('data-post-id') || modal.dataset.postId || '0';
|
|
||||||
modal.classList.add('is-open');
|
|
||||||
modal.setAttribute('aria-hidden', 'false');
|
|
||||||
document.body.style.overflow = 'hidden';
|
|
||||||
var first = modal.querySelector('[data-reward-amount], [data-aksrt-reward-custom]');
|
|
||||||
if (first) first.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('click', function (event) {
|
|
||||||
var opener = event.target.closest('[data-aksrt-reward-open]');
|
|
||||||
if (opener) {
|
|
||||||
event.preventDefault();
|
|
||||||
open(opener);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.target.closest('[data-aksrt-reward-close]')) {
|
|
||||||
event.preventDefault();
|
|
||||||
closeAll();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var amountButton = event.target.closest('[data-reward-amount]');
|
|
||||||
if (amountButton) {
|
|
||||||
var modal = amountButton.closest('.reward-modal');
|
|
||||||
delete modal.dataset.aksrtOperationKey;
|
|
||||||
modal.querySelectorAll('[data-reward-amount]').forEach(function (button) {
|
|
||||||
button.classList.toggle('is-active', button === amountButton);
|
|
||||||
});
|
|
||||||
var custom = modal.querySelector('[data-aksrt-reward-custom]');
|
|
||||||
if (custom) custom.value = '';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var submit = event.target.closest('[data-aksrt-reward-submit]');
|
|
||||||
if (!submit || submit.disabled) return;
|
|
||||||
var tipModal = submit.closest('.reward-modal');
|
|
||||||
var message = tipModal.querySelector('[data-aksrt-reward-message]');
|
|
||||||
var customInput = tipModal.querySelector('[data-aksrt-reward-custom]');
|
|
||||||
var selected = tipModal.querySelector('[data-reward-amount].is-active');
|
|
||||||
var amount = customInput && customInput.value ? customInput.value : (selected ? selected.dataset.rewardAmount : '');
|
|
||||||
if (customInput && customInput.dataset.aksrtIdempotencyBound !== '1') {
|
|
||||||
customInput.dataset.aksrtIdempotencyBound = '1';
|
|
||||||
customInput.addEventListener('input', function () { delete tipModal.dataset.aksrtOperationKey; });
|
|
||||||
}
|
|
||||||
|
|
||||||
submit.disabled = true;
|
|
||||||
submit.textContent = '赞赏中…';
|
|
||||||
if (message) message.textContent = '';
|
|
||||||
|
|
||||||
var body = new URLSearchParams();
|
|
||||||
body.set('action', 'aksrt_submit_tip');
|
|
||||||
body.set('nonce', cfg.nonce || '');
|
|
||||||
body.set('recipient_id', tipModal.dataset.userId || '');
|
|
||||||
body.set('post_id', tipModal.dataset.postId || '0');
|
|
||||||
body.set('amount', amount);
|
|
||||||
|
|
||||||
fetch(cfg.ajaxUrl || '/wp-admin/admin-ajax.php', {
|
|
||||||
method: 'POST',
|
|
||||||
credentials: 'same-origin',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
||||||
'Idempotency-Key': operationKey(tipModal)
|
|
||||||
},
|
|
||||||
body: body.toString()
|
|
||||||
}).then(function (response) {
|
|
||||||
return response.json();
|
|
||||||
}).then(function (response) {
|
|
||||||
var text = response && response.data && response.data.message ? response.data.message : '赞赏失败';
|
|
||||||
if (response && response.success) {
|
|
||||||
delete tipModal.dataset.aksrtOperationKey;
|
|
||||||
if (message) message.textContent = text;
|
|
||||||
setTimeout(closeAll, 900);
|
|
||||||
} else if (message) {
|
|
||||||
message.textContent = text;
|
|
||||||
}
|
|
||||||
}).catch(function () {
|
|
||||||
if (message) message.textContent = '网络错误,请稍后重试';
|
|
||||||
}).finally(function () {
|
|
||||||
submit.disabled = false;
|
|
||||||
submit.textContent = '余额赞赏';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener('keydown', function (event) {
|
|
||||||
if (event.key === 'Escape') closeAll();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery(document).off('auto_fun.aksrt-reward').on('auto_fun.aksrt-reward', initReward);
|
function rewardTemplate(modal) {
|
||||||
})();
|
return modal ? document.getElementById(modal.dataset.templateId || '') : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function operationKey(template) {
|
||||||
|
if (!template.dataset.aksrtOperationKey) {
|
||||||
|
template.dataset.aksrtOperationKey = window.AksrtRequest.createIdempotencyKey();
|
||||||
|
}
|
||||||
|
return template.dataset.aksrtOperationKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openReward(trigger) {
|
||||||
|
var runtime = window.AksrtModalRuntime;
|
||||||
|
if (!runtime || !window.AksrtRequest) {
|
||||||
|
if (trigger.dataset.aksrtRewardWaiting !== '1') {
|
||||||
|
trigger.dataset.aksrtRewardWaiting = '1';
|
||||||
|
document.addEventListener('aksrt:modal-runtime:ready', function () {
|
||||||
|
delete trigger.dataset.aksrtRewardWaiting;
|
||||||
|
if (document.contains(trigger)) openReward(trigger);
|
||||||
|
}, { once: true });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var templateId = trigger.getAttribute('data-template-id') || '';
|
||||||
|
var template = document.getElementById(templateId);
|
||||||
|
if (!template || !template.content) return;
|
||||||
|
|
||||||
|
var shell = runtime.open({
|
||||||
|
html: template.innerHTML,
|
||||||
|
className: 'aksrt-reward-modal modal-mini full-sm',
|
||||||
|
mobileBottom: true,
|
||||||
|
kind: 'generic',
|
||||||
|
});
|
||||||
|
shell.dataset.templateId = template.id;
|
||||||
|
shell.dataset.userId = trigger.getAttribute('data-user-id') || template.dataset.userId || '';
|
||||||
|
shell.dataset.postId = trigger.getAttribute('data-post-id') || template.dataset.postId || '0';
|
||||||
|
var title = shell.querySelector('.aksrt-reward__title');
|
||||||
|
if (title) {
|
||||||
|
title.id = 'aksrt-reward-title-' + (++titleSequence);
|
||||||
|
shell.setAttribute('aria-labelledby', title.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
var initialFocus = shell.querySelector('[data-reward-amount].is-active, [data-aksrt-reward-custom]');
|
||||||
|
if (initialFocus) initialFocus.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('click', function (event) {
|
||||||
|
var opener = event.target.closest('[data-aksrt-reward-open]');
|
||||||
|
if (opener) {
|
||||||
|
event.preventDefault();
|
||||||
|
openReward(opener);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var amountButton = event.target.closest('[data-reward-amount]');
|
||||||
|
if (amountButton) {
|
||||||
|
var amountModal = rewardModal(amountButton);
|
||||||
|
if (!amountModal) return;
|
||||||
|
var amountTemplate = rewardTemplate(amountModal);
|
||||||
|
if (amountTemplate) delete amountTemplate.dataset.aksrtOperationKey;
|
||||||
|
amountModal.querySelectorAll('[data-reward-amount]').forEach(function (button) {
|
||||||
|
var isActive = button === amountButton;
|
||||||
|
button.classList.toggle('is-active', isActive);
|
||||||
|
button.setAttribute('aria-pressed', isActive ? 'true' : 'false');
|
||||||
|
});
|
||||||
|
var customInput = amountModal.querySelector('[data-aksrt-reward-custom]');
|
||||||
|
if (customInput) customInput.value = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var submit = event.target.closest('[data-aksrt-reward-submit]');
|
||||||
|
if (!submit || submit.disabled) return;
|
||||||
|
|
||||||
|
var modal = rewardModal(submit);
|
||||||
|
var template = rewardTemplate(modal);
|
||||||
|
var runtime = window.AksrtModalRuntime;
|
||||||
|
if (!modal || !template || !runtime) return;
|
||||||
|
|
||||||
|
var message = modal.querySelector('[data-aksrt-reward-message]');
|
||||||
|
var custom = modal.querySelector('[data-aksrt-reward-custom]');
|
||||||
|
var selected = modal.querySelector('[data-reward-amount].is-active');
|
||||||
|
var amount = custom && custom.value ? custom.value : (selected ? selected.dataset.rewardAmount : '');
|
||||||
|
var key;
|
||||||
|
try {
|
||||||
|
key = operationKey(template);
|
||||||
|
} catch (error) {
|
||||||
|
if (message) message.textContent = error.message || '无法创建安全请求,请稍后重试';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
submit.disabled = true;
|
||||||
|
submit.textContent = '赞赏中…';
|
||||||
|
if (message) message.textContent = '';
|
||||||
|
|
||||||
|
var body = new URLSearchParams();
|
||||||
|
body.set('action', 'aksrt_submit_tip');
|
||||||
|
body.set('nonce', cfg.nonce || '');
|
||||||
|
body.set('recipient_id', modal.dataset.userId || '');
|
||||||
|
body.set('post_id', modal.dataset.postId || '0');
|
||||||
|
body.set('amount', amount);
|
||||||
|
var succeeded = false;
|
||||||
|
|
||||||
|
window.fetch(cfg.ajaxUrl || '/wp-admin/admin-ajax.php', {
|
||||||
|
method: 'POST',
|
||||||
|
credentials: 'same-origin',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||||
|
'Idempotency-Key': key,
|
||||||
|
},
|
||||||
|
body: body.toString(),
|
||||||
|
}).then(function (response) {
|
||||||
|
return response.json();
|
||||||
|
}).then(function (response) {
|
||||||
|
if (runtime.getActive() !== modal) return;
|
||||||
|
var text = response && response.data && response.data.message ? response.data.message : '赞赏失败';
|
||||||
|
if (response && response.success) {
|
||||||
|
succeeded = true;
|
||||||
|
delete template.dataset.aksrtOperationKey;
|
||||||
|
if (message) message.textContent = text;
|
||||||
|
window.setTimeout(function () {
|
||||||
|
if (runtime.getActive() === modal) runtime.close('success');
|
||||||
|
}, 900);
|
||||||
|
} else if (message) {
|
||||||
|
message.textContent = text;
|
||||||
|
}
|
||||||
|
}).catch(function () {
|
||||||
|
if (runtime.getActive() === modal && message) message.textContent = '网络错误,请稍后重试';
|
||||||
|
}).finally(function () {
|
||||||
|
submit.disabled = succeeded;
|
||||||
|
submit.textContent = '余额赞赏';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('input', function (event) {
|
||||||
|
if (!event.target.matches('[data-aksrt-reward-custom]')) return;
|
||||||
|
var modal = rewardModal(event.target);
|
||||||
|
var template = rewardTemplate(modal);
|
||||||
|
if (template) delete template.dataset.aksrtOperationKey;
|
||||||
|
if (!modal) return;
|
||||||
|
|
||||||
|
var hasCustomAmount = event.target.value !== '';
|
||||||
|
var firstAmount = modal.querySelector('[data-reward-amount]');
|
||||||
|
modal.querySelectorAll('[data-reward-amount]').forEach(function (button) {
|
||||||
|
var isActive = hasCustomAmount ? false : button === firstAmount;
|
||||||
|
button.classList.toggle('is-active', isActive);
|
||||||
|
button.setAttribute('aria-pressed', isActive ? 'true' : 'false');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})(window, document);
|
||||||
@@ -25,9 +25,11 @@ if (!function_exists('aksrt_get_rewards_button')) {
|
|||||||
$settings = \AKSRT\Settings\Settings::get_post_page_settings();
|
$settings = \AKSRT\Settings\Settings::get_post_page_settings();
|
||||||
$label = (string) ($settings['rewards_btn_text'] ?? __('赞赏', 'aksrt'));
|
$label = (string) ($settings['rewards_btn_text'] ?? __('赞赏', 'aksrt'));
|
||||||
$icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-money') : '';
|
$icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-money') : '';
|
||||||
|
$template_id = 'aksrt-reward-template-' . $user_id . '-' . $post_id;
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'<button type="button" class="%1$s aksrt-reward-open" data-aksrt-reward-open data-user-id="%2$d" data-post-id="%3$d">%4$s<text>%5$s</text></button>',
|
'<button type="button" class="%1$s aksrt-reward-open" data-aksrt-reward-open data-template-id="%2$s" data-user-id="%3$d" data-post-id="%4$d">%5$s<text>%6$s</text></button>',
|
||||||
esc_attr($class),
|
esc_attr($class),
|
||||||
|
esc_attr($template_id),
|
||||||
$user_id,
|
$user_id,
|
||||||
$post_id,
|
$post_id,
|
||||||
$icon, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup.
|
$icon, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup.
|
||||||
@@ -36,8 +38,8 @@ if (!function_exists('aksrt_get_rewards_button')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('aksrt_render_rewards_modal_for_user')) {
|
if (!function_exists('aksrt_render_rewards_template_for_user')) {
|
||||||
function aksrt_render_rewards_modal_for_user(int $user_id, int $post_id = 0): void {
|
function aksrt_render_rewards_template_for_user(int $user_id, int $post_id = 0): void {
|
||||||
static $done = [];
|
static $done = [];
|
||||||
$key = $user_id . ':' . $post_id;
|
$key = $user_id . ':' . $post_id;
|
||||||
if ($user_id <= 0 || isset($done[$key]) || !aksrt_rewards_enabled()) {
|
if ($user_id <= 0 || isset($done[$key]) || !aksrt_rewards_enabled()) {
|
||||||
@@ -58,27 +60,34 @@ if (!function_exists('aksrt_render_rewards_modal_for_user')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$recipient = get_userdata($user_id);
|
$recipient = get_userdata($user_id);
|
||||||
|
$template_id = 'aksrt-reward-template-' . $user_id . '-' . $post_id;
|
||||||
|
$title = (string) ($settings['rewards_text'] ?? __('赞赏', 'aksrt'));
|
||||||
|
$money_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-money') : '<i class="fa fas fa-money-bill-wave" aria-hidden="true"></i>';
|
||||||
|
$close_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-close', 'ic-close') : '<i class="fa fas fa-times" aria-hidden="true"></i>';
|
||||||
?>
|
?>
|
||||||
<div class="reward-modal" id="reward-modal-<?php echo (int) $user_id; ?>" data-user-id="<?php echo (int) $user_id; ?>" data-post-id="<?php echo (int) $post_id; ?>" aria-hidden="true">
|
<template id="<?php echo esc_attr($template_id); ?>" data-user-id="<?php echo (int) $user_id; ?>" data-post-id="<?php echo (int) $post_id; ?>">
|
||||||
<div class="reward-modal__overlay" data-aksrt-reward-close></div>
|
<div class="modal-colorful-header colorful-bg jb-blue">
|
||||||
<div class="reward-modal__dialog" role="dialog" aria-modal="true" aria-labelledby="reward-title-<?php echo (int) $user_id; ?>">
|
<button type="button" class="close" data-aksrt-modal-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><?php echo $close_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed theme icon markup. ?></button>
|
||||||
<button type="button" class="reward-modal__close" data-aksrt-reward-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fa fas fa-times" aria-hidden="true"></i></button>
|
<div class="colorful-make"></div>
|
||||||
<div class="reward-modal__content">
|
<div class="text-center">
|
||||||
<h3 id="reward-title-<?php echo (int) $user_id; ?>"><?php echo esc_html((string) ($settings['rewards_text'] ?? __('赞赏', 'aksrt'))); ?></h3>
|
<div class="em2x"><?php echo $money_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed theme icon markup. ?></div>
|
||||||
<p class="muted-2-color em09"><?php printf(esc_html__('赞赏将直接进入 %s 的站内余额', 'aksrt'), esc_html($recipient ? $recipient->display_name : __('作者', 'aksrt'))); ?></p>
|
<div class="mt10 em12 padding-w10 aksrt-reward__title" role="heading" aria-level="2"><?php echo esc_html($title); ?></div>
|
||||||
<div class="reward-amounts" data-aksrt-reward-amounts>
|
|
||||||
<?php foreach ($render_amounts as $index => $amount) : ?>
|
|
||||||
<button type="button" class="reward-amount<?php echo $index === 0 ? ' is-active' : ''; ?>" data-reward-amount="<?php echo esc_attr($amount); ?>">¥<?php echo esc_html($amount); ?></button>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
|
||||||
<?php if (!empty($settings['rewards_custom'])) : ?>
|
|
||||||
<label class="reward-custom"><span><?php esc_html_e('自定义金额', 'aksrt'); ?></span><input type="number" min="<?php echo esc_attr((string) ($settings['rewards_min'] ?? 1)); ?>" max="<?php echo esc_attr((string) ($settings['rewards_max'] ?? 1000)); ?>" step="0.01" data-aksrt-reward-custom placeholder="<?php esc_attr_e('输入金额', 'aksrt'); ?>"></label>
|
|
||||||
<?php endif; ?>
|
|
||||||
<button type="button" class="btn-primary reward-modal__submit" data-aksrt-reward-submit><?php esc_html_e('余额赞赏', 'aksrt'); ?></button>
|
|
||||||
<div class="reward-modal__message" data-aksrt-reward-message role="status"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="modal-body aksrt-reward__body">
|
||||||
|
<p class="aksrt-reward__desc muted-2-color em09"><?php printf(esc_html__('赞赏将直接进入 %s 的站内余额', 'aksrt'), esc_html($recipient ? $recipient->display_name : __('作者', 'aksrt'))); ?></p>
|
||||||
|
<div class="aksrt-reward__amounts">
|
||||||
|
<?php foreach ($render_amounts as $index => $amount) : ?>
|
||||||
|
<button type="button" class="aksrt-reward__amount<?php echo $index === 0 ? ' is-active' : ''; ?>" data-reward-amount="<?php echo esc_attr($amount); ?>" aria-pressed="<?php echo $index === 0 ? 'true' : 'false'; ?>"><span class="aksrt-reward__currency">¥</span><span class="aksrt-reward__value"><?php echo esc_html($amount); ?></span></button>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php if (!empty($settings['rewards_custom'])) : ?>
|
||||||
|
<label class="aksrt-reward__custom"><span><?php esc_html_e('自定义金额', 'aksrt'); ?></span><input class="aksrt-reward__input" type="number" min="<?php echo esc_attr((string) ($settings['rewards_min'] ?? 1)); ?>" max="<?php echo esc_attr((string) ($settings['rewards_max'] ?? 1000)); ?>" step="0.01" data-aksrt-reward-custom placeholder="<?php esc_attr_e('输入金额', 'aksrt'); ?>"></label>
|
||||||
|
<?php endif; ?>
|
||||||
|
<button type="button" class="but jb-blue btn-block aksrt-reward__submit" data-aksrt-reward-submit><?php esc_html_e('余额赞赏', 'aksrt'); ?></button>
|
||||||
|
<div class="aksrt-reward__message" data-aksrt-reward-message role="status" aria-live="polite"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ if (!function_exists('aksrt_single_render_actions')) :
|
|||||||
: '';
|
: '';
|
||||||
if ($reward_btn !== '') {
|
if ($reward_btn !== '') {
|
||||||
echo $reward_btn; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
echo $reward_btn; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
aksrt_render_rewards_modal_for_user($reward_author, $post_id);
|
aksrt_render_rewards_template_for_user($reward_author, $post_id);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ trait ScriptsPart1b {
|
|||||||
'needs_navigation' => 'single-post/navigation',
|
'needs_navigation' => 'single-post/navigation',
|
||||||
'needs_cover' => 'single-post/cover',
|
'needs_cover' => 'single-post/cover',
|
||||||
'needs_related_toc' => 'single-post/related-toc',
|
'needs_related_toc' => 'single-post/related-toc',
|
||||||
|
'needs_reward' => 'single-post/rewards',
|
||||||
'has_hidden_content' => 'single-post/hidden-content',
|
'has_hidden_content' => 'single-post/hidden-content',
|
||||||
'needs_pay_box' => 'pay-box',
|
'needs_pay_box' => 'pay-box',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ $reward_button = get_current_user_id() !== $author_id && function_exists('aksrt_
|
|||||||
<?php echo $follow_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
<?php echo $follow_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
<?php if ($reward_button !== '') : ?>
|
<?php if ($reward_button !== '') : ?>
|
||||||
<?php echo $reward_button; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
<?php echo $reward_button; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
<?php aksrt_render_rewards_modal_for_user($author_id, get_the_ID()); ?>
|
<?php aksrt_render_rewards_template_for_user($author_id, get_the_ID()); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ const routed = [
|
|||||||
'assets/js/author.js',
|
'assets/js/author.js',
|
||||||
'assets/js/credits.js',
|
'assets/js/credits.js',
|
||||||
'assets/js/order-center.js',
|
'assets/js/order-center.js',
|
||||||
'assets/js/reward.js',
|
|
||||||
'assets/js/routes/user-center.js',
|
'assets/js/routes/user-center.js',
|
||||||
'assets/js/signin.js',
|
'assets/js/signin.js',
|
||||||
'assets/js/section-navs.js',
|
'assets/js/section-navs.js',
|
||||||
@@ -99,6 +98,34 @@ test('routed modules use one namespaced auto_fun owner and no registry', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('wallet reward content opens in the shared modal runtime once', () => {
|
||||||
|
const reward = read('assets/js/reward.js');
|
||||||
|
const helper = read('inc/helpers/aksrt-rewards.php');
|
||||||
|
const authorBar = read('templates/parts/single-author-bar.php');
|
||||||
|
const singleActions = read('inc/helpers/aksrt-single-render.php');
|
||||||
|
const scripts = read('src/Core/ScriptsPart1b.php');
|
||||||
|
|
||||||
|
assert.match(reward, /runtime\.open\(\{/);
|
||||||
|
assert.match(reward, /className: 'aksrt-reward-modal modal-mini full-sm'/);
|
||||||
|
assert.match(reward, /mobileBottom: true/);
|
||||||
|
assert.match(reward, /shell\.setAttribute\('aria-labelledby', title\.id\)/);
|
||||||
|
assert.match(reward, /'Idempotency-Key': key/);
|
||||||
|
assert.equal((reward.match(/document\.addEventListener\('click'/g) || []).length, 1);
|
||||||
|
assert.doesNotMatch(reward, /auto_fun|reward-modal\.is-open/);
|
||||||
|
|
||||||
|
assert.equal((helper.match(/<template\b/g) || []).length, 1);
|
||||||
|
assert.match(helper, /data-template-id="%2\$s"/);
|
||||||
|
assert.match(helper, /static \$done = \[\]/);
|
||||||
|
assert.match(helper, /isset\(\$done\[\$key\]\)/);
|
||||||
|
assert.match(helper, /modal-colorful-header colorful-bg jb-blue/);
|
||||||
|
assert.match(helper, /data-aksrt-modal-close/);
|
||||||
|
assert.match(helper, /data-aksrt-reward-submit/);
|
||||||
|
assert.match(authorBar, /aksrt_render_rewards_template_for_user/);
|
||||||
|
assert.match(singleActions, /aksrt_render_rewards_template_for_user/);
|
||||||
|
assert.match(scripts, /'needs_reward'\s*=>\s*'single-post\/rewards'/);
|
||||||
|
assert.doesNotMatch(helper + authorBar + singleActions, /aksrt_render_rewards_modal_for_user|reward-modal__qr/);
|
||||||
|
});
|
||||||
|
|
||||||
test('user center navigation initializes once across auto_fun rescans', () => {
|
test('user center navigation initializes once across auto_fun rescans', () => {
|
||||||
const source = read('assets/js/routes/user-center.js');
|
const source = read('assets/js/routes/user-center.js');
|
||||||
const initAt = source.indexOf('function initDashboardNavigation()');
|
const initAt = source.indexOf('function initDashboardNavigation()');
|
||||||
|
|||||||
@@ -220,7 +220,6 @@ test('dead cover css is removed from every stylesheet surface', () => {
|
|||||||
'assets/css/main.min.css',
|
'assets/css/main.min.css',
|
||||||
'assets/css/build/public.css',
|
'assets/css/build/public.css',
|
||||||
'assets/css/build/public.min.css',
|
'assets/css/build/public.min.css',
|
||||||
'assets/css/frontend/enhancements/components/base.css',
|
|
||||||
]) {
|
]) {
|
||||||
const css = read(file);
|
const css = read(file);
|
||||||
assert.doesNotMatch(css, /\.single-cover-slide[,{ ]/, `${file} 不得再包含死的 .single-cover-slide 规则`);
|
assert.doesNotMatch(css, /\.single-cover-slide[,{ ]/, `${file} 不得再包含死的 .single-cover-slide 规则`);
|
||||||
|
|||||||
Reference in new issue
Block a user