{n(r.llmCallCount || 0)} 次
成 {n(r.llmSuccessCallCount || 0)} / 败 {n(r.llmFailedCallCount || 0)}
},
diff --git a/video-gen-api/alembic/versions/b7e2c4d91a63_expand_credit_addon_validity_months.py b/video-gen-api/alembic/versions/b7e2c4d91a63_expand_credit_addon_validity_months.py
new file mode 100644
index 00000000..9b56270b
--- /dev/null
+++ b/video-gen-api/alembic/versions/b7e2c4d91a63_expand_credit_addon_validity_months.py
@@ -0,0 +1,75 @@
+"""expand credit addon validity months to 1-36
+
+Revision ID: b7e2c4d91a63
+Revises: 1a4d1f095fa1
+Create Date: 2026-08-11 13:15:00
+"""
+
+from alembic import op
+
+
+revision = "b7e2c4d91a63"
+down_revision = "1a4d1f095fa1"
+branch_labels = None
+depends_on = None
+
+
+CONSTRAINT_NAME = "ck_credit_products_type_required_fields"
+
+
+def _drop_type_constraint_if_exists() -> None:
+ op.execute(
+ f"""
+ DO $$
+ BEGIN
+ IF EXISTS (
+ SELECT 1
+ FROM pg_constraint c
+ JOIN pg_class t ON t.oid = c.conrelid
+ JOIN pg_namespace n ON n.oid = t.relnamespace
+ WHERE n.nspname = current_schema()
+ AND t.relname = 'credit_products'
+ AND c.conname = '{CONSTRAINT_NAME}'
+ ) THEN
+ ALTER TABLE credit_products DROP CONSTRAINT {CONSTRAINT_NAME};
+ END IF;
+ END
+ $$;
+ """
+ )
+
+
+def _create_type_constraint(*, addon_condition: str) -> None:
+ op.create_check_constraint(
+ CONSTRAINT_NAME,
+ "credit_products",
+ "(product_type = 'subscription' AND tier_code IS NOT NULL AND tier_rank IS NOT NULL "
+ "AND billing_cycle IS NOT NULL AND monthly_grant_credits IS NOT NULL "
+ "AND first_purchase_price IS NOT NULL AND regular_price IS NOT NULL "
+ "AND grant_credits IS NULL AND validity_months IS NULL) "
+ "OR (product_type = 'credit_addon' AND grant_credits IS NOT NULL "
+ f"AND {addon_condition} AND tier_code IS NULL AND tier_rank IS NULL "
+ "AND billing_cycle IS NULL AND monthly_grant_credits IS NULL "
+ "AND first_purchase_price IS NULL AND regular_price IS NULL "
+ "AND activity_price IS NULL AND activity_start_at IS NULL AND activity_end_at IS NULL)",
+ )
+
+
+def upgrade() -> None:
+ # 当前版本中增值包被旧约束固定为 validity_months = 1。
+ # 先移除旧约束,再开放为1-36个自然月;不修改任何现有商品数据。
+ _drop_type_constraint_if_exists()
+ _create_type_constraint(addon_condition="validity_months BETWEEN 1 AND 36")
+
+
+def downgrade() -> None:
+ # 回退到旧版本时,旧约束只允许1个月。为保证 downgrade 可执行,
+ # 将现有增值包有效期恢复为旧版本唯一合法值1个月。
+ _drop_type_constraint_if_exists()
+ op.execute(
+ "UPDATE credit_products "
+ "SET validity_months = 1 "
+ "WHERE product_type = 'credit_addon' "
+ "AND validity_months IS DISTINCT FROM 1"
+ )
+ _create_type_constraint(addon_condition="validity_months = 1")
diff --git a/video-gen-api/app/api/admin/credit_management.py b/video-gen-api/app/api/admin/credit_management.py
index 8d8df660..2a980abc 100644
--- a/video-gen-api/app/api/admin/credit_management.py
+++ b/video-gen-api/app/api/admin/credit_management.py
@@ -35,7 +35,9 @@ def _apply_product_payload(product: CreditProduct, payload: dict) -> None:
mapping = {"features": "features_json"}
for key, value in payload.items():
setattr(product, mapping.get(key, key), value)
- if product.product_type == "credit_addon":
+ if product.product_type == "credit_addon" and product.validity_months is None:
+ # 兼容旧管理端未提交有效期的请求,新建增值包仍默认1个月;
+ # 更新时未提交该字段则保留原值。
product.validity_months = 1
if product.product_type == "subscription":
product.price = product.regular_price or 0
@@ -77,6 +79,8 @@ def _validate_product_entity(product: CreditProduct) -> None:
elif product.product_type == "credit_addon":
if product.grant_credits is None or product.price is None:
raise HTTPException(status_code=400, detail="积分增值包必须配置价格和积分数量")
+ if product.validity_months is None or not 1 <= int(product.validity_months) <= 36:
+ raise HTTPException(status_code=400, detail="积分增值包有效期必须为1-36个月")
else:
raise HTTPException(status_code=400, detail="不支持的积分商品类型")
diff --git a/video-gen-api/app/models/credit/product.py b/video-gen-api/app/models/credit/product.py
index 2027d7cf..d0c5ef1d 100644
--- a/video-gen-api/app/models/credit/product.py
+++ b/video-gen-api/app/models/credit/product.py
@@ -28,7 +28,7 @@ class CreditProduct(Base, TimestampMixin):
"AND first_purchase_price IS NOT NULL AND regular_price IS NOT NULL "
"AND grant_credits IS NULL AND validity_months IS NULL) "
"OR (product_type = 'credit_addon' AND grant_credits IS NOT NULL "
- "AND validity_months = 1 AND tier_code IS NULL AND tier_rank IS NULL "
+ "AND validity_months BETWEEN 1 AND 36 AND tier_code IS NULL AND tier_rank IS NULL "
"AND billing_cycle IS NULL AND monthly_grant_credits IS NULL "
"AND first_purchase_price IS NULL AND regular_price IS NULL "
"AND activity_price IS NULL AND activity_start_at IS NULL AND activity_end_at IS NULL)",
@@ -63,7 +63,7 @@ class CreditProduct(Base, TimestampMixin):
Boolean, nullable=False, default=True, server_default="true"
)
- # 积分增值包字段;当前固定一个自然月有效。
+ # 积分增值包字段;有效期按自然月配置,范围1-36个月。
grant_credits: Mapped[Decimal | None] = mapped_column(Numeric(20, 2), nullable=True)
validity_months: Mapped[int | None] = mapped_column(nullable=True)
diff --git a/video-gen-api/app/schemas/credit_product.py b/video-gen-api/app/schemas/credit_product.py
index a2a9c947..0cd9ef90 100644
--- a/video-gen-api/app/schemas/credit_product.py
+++ b/video-gen-api/app/schemas/credit_product.py
@@ -26,6 +26,7 @@ class CreditProductBase(BaseModel):
price: float = Field(default=0, ge=0, le=999999999.99)
grant_credits: float | None = Field(default=None, gt=0, le=999999999.99)
+ validity_months: int | None = Field(default=None, ge=1, le=36)
credit_level: Literal["promotional", "general"] = "general"
currency: str = Field(default="CNY", min_length=1, max_length=8)
is_active: bool = True
@@ -55,6 +56,8 @@ class CreditProductBase(BaseModel):
raise ValueError("积分增值包必须配置积分数量")
if self.price < 0:
raise ValueError("增值包价格不能小于0")
+ if self.validity_months is not None and not 1 <= self.validity_months <= 36:
+ raise ValueError("积分增值包有效期必须为1-36个月")
return self
@@ -79,6 +82,7 @@ class CreditProductUpdate(BaseModel):
renewal_enabled: bool | None = None
price: float | None = Field(default=None, ge=0, le=999999999.99)
grant_credits: float | None = Field(default=None, gt=0, le=999999999.99)
+ validity_months: int | None = Field(default=None, ge=1, le=36)
credit_level: Literal["promotional", "general"] | None = None
currency: str | None = Field(default=None, min_length=1, max_length=8)
is_active: bool | None = None
diff --git a/video-gen-api/app/services/credit/product_service.py b/video-gen-api/app/services/credit/product_service.py
index 817f95f5..452ed337 100644
--- a/video-gen-api/app/services/credit/product_service.py
+++ b/video-gen-api/app/services/credit/product_service.py
@@ -239,7 +239,7 @@ def product_to_dict(
"activity_end_at": product.activity_end_at,
"renewal_enabled": bool(product.renewal_enabled),
"grant_credits": float(product.grant_credits or 0),
- "validity_months": 1 if product.is_credit_addon else None,
+ "validity_months": int(product.validity_months or 1) if product.is_credit_addon else None,
"price": float(user_price if user_price is not None else product.price),
"current_price": float(user_price if user_price is not None else product.price),
"target_price": float(target_price) if target_price is not None else None,
diff --git a/video-gen-api/app/services/credit/subscription_service.py b/video-gen-api/app/services/credit/subscription_service.py
index 2fdd3e84..acfb07da 100644
--- a/video-gen-api/app/services/credit/subscription_service.py
+++ b/video-gen-api/app/services/credit/subscription_service.py
@@ -57,6 +57,7 @@ def _product_snapshot(product: CreditProduct) -> dict:
"regular_price": float(product.regular_price or 0),
"activity_price": float(product.activity_price) if product.activity_price is not None else None,
"grant_credits": float(product.grant_credits or 0),
+ "validity_months": int(product.validity_months or 1) if product.is_credit_addon else None,
"credit_level": product.credit_level,
"features": product.features_json or [],
}
@@ -83,6 +84,24 @@ def _snapshot_decimal(snapshot: dict, key: str) -> Decimal:
return to_credit_decimal(snapshot.get(key) or 0)
+def _snapshot_validity_months(snapshot: dict) -> int:
+ raw_value = snapshot.get("validity_months")
+ if raw_value is None:
+ # 兼容历史订单快照:旧版本增值包固定为1个自然月。
+ return 1
+ if isinstance(raw_value, bool):
+ raise ValueError("积分增值包有效期快照无效")
+ try:
+ months = int(raw_value)
+ except (TypeError, ValueError) as exc:
+ raise ValueError("积分增值包有效期快照无效") from exc
+ if isinstance(raw_value, float) and not raw_value.is_integer():
+ raise ValueError("积分增值包有效期快照无效")
+ if not 1 <= months <= 36:
+ raise ValueError("积分增值包有效期必须为1-36个月")
+ return months
+
+
async def _create_subscription(
db: AsyncSession,
*,
@@ -489,7 +508,7 @@ async def fulfill_payment_product(
description=f"购买积分增值包:{order.product_name_snapshot or snapshot.get('name') or '积分增值包'}",
source_type=CreditBalanceSourceType.CREDIT_ADDON.value,
valid_from=checked_at,
- expires_at=add_natural_months(checked_at, 1),
+ expires_at=add_natural_months(checked_at, _snapshot_validity_months(snapshot)),
credit_level=str(snapshot.get("credit_level") or "general"),
source_id=order.id,
product_id=order.product_id,
diff --git a/video-gen-app/dist/assets/index-Bni9FiTX.js b/video-gen-app/dist/assets/index-zFXYmniI.js
similarity index 96%
rename from video-gen-app/dist/assets/index-Bni9FiTX.js
rename to video-gen-app/dist/assets/index-zFXYmniI.js
index 917a117c..8a9b8096 100644
--- a/video-gen-app/dist/assets/index-Bni9FiTX.js
+++ b/video-gen-app/dist/assets/index-zFXYmniI.js
@@ -454,8 +454,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
animation: none !important;
filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.8)) !important;
}
- `})]})})})]}),(0,$.jsx)(`div`,{className:`desktop-content`,style:{flex:1,background:`#f1f2f3`,borderRadius:`20px`,boxShadow:`0 4px 32px rgba(0, 0, 0, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04)`,padding:`24px 32px 32px`,border:`1px solid rgba(0, 0, 0, 0.06)`,overflow:`auto`,minHeight:0},children:!Ce&&(0,$.jsx)(wt,{})})]}),(0,$.jsx)(`div`,{className:`mobile-header`,children:(0,$.jsxs)(`div`,{className:`mobile-header-content`,children:[(0,$.jsx)(`div`,{className:`mobile-menu-btn`,onClick:()=>M(!0),children:(0,$.jsx)(i6,{style:{fontSize:20}})}),(0,$.jsx)(`div`,{className:`mobile-header-title`,children:te}),(0,$.jsx)(`div`,{className:`mobile-header-right`,children:(0,$.jsxs)(`div`,{className:`mobile-credits-badge`,onClick:()=>c(!0),children:[(0,$.jsx)(U8,{}),(0,$.jsx)(`span`,{children:n?.credits||0})]})})]})}),(0,$.jsx)(`div`,{className:`mobile-content`,children:Ce&&(0,$.jsx)(wt,{})}),(0,$.jsxs)(_V,{title:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,$.jsx)(`div`,{style:{width:36,height:36,borderRadius:10,flexShrink:0,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 4px 12px rgba(99, 102, 241, 0.35)`},children:ne?(0,$.jsx)(`img`,{src:ne,alt:`logo`,style:{width:24,height:24,objectFit:`contain`}}):(0,$.jsx)(k8,{style:{fontSize:18,color:`#ffffff`}})}),(0,$.jsx)(`span`,{style:{fontWeight:700,fontSize:16,color:`#1e293b`},children:te})]}),placement:`left`,onClose:()=>M(!1),open:j,size:280,closable:!0,className:`mobile-menu-drawer`,styles:{header:{borderBottom:`1px solid #f1f5f9`,padding:`16px 20px`},body:{padding:`12px 8px`,display:`flex`,flexDirection:`column`}},children:[(0,$.jsxs)(`div`,{style:{flex:1,overflow:`auto`,paddingBottom:12},children:[(0,$.jsx)(`div`,{style:{padding:`12px 8px 16px`},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,$.jsx)(Bw,{size:44,style:{background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,flexShrink:0},children:(0,$.jsx)(z8,{})}),(0,$.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,$.jsx)(`div`,{style:{fontSize:15,fontWeight:600,color:`#1e293b`,marginBottom:2},children:n?.username||`用户`}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`},children:[(0,$.jsx)(U8,{style:{color:`#f59e0b`,marginRight:4}}),`积分: `,(0,$.jsx)(`span`,{style:{color:`#f59e0b`,fontWeight:600},children:n?.credits??0})]})]})]})}),(0,$.jsx)(a7,{data:xe}),Fe.map(e=>{let t=e.menu_type??e.menuType,n=Pe[e.id]&&Pe[e.id].length>0,r=e.path===Me,i=ee[e.id],a=o7[e.icon]||(0,$.jsx)(S3,{});return(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item ${r&&!n?`mobile-menu-item-active`:``} ${t===`group`?`mobile-menu-group`:``}`,onClick:()=>Ie(e),children:[t!==`group`&&(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:r?`#6366f1`:`#64748b`},children:a}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{paddingLeft:0,color:t===`group`?`#94a3b8`:r?`#4f46e5`:`#475569`,fontWeight:t===`group`||r?600:400,fontSize:t===`group`?12:15,textTransform:t===`group`?`uppercase`:`none`,letterSpacing:t===`group`?.5:0},children:e.label}),(t===`group`||n)&&(0,$.jsx)(`span`,{style:{fontSize:12,color:`#cbd5e1`,transition:`transform 0.2s ease`,transform:i?`rotate(90deg)`:`rotate(0deg)`},children:(0,$.jsx)(Bg,{})})]}),(t===`group`||n)&&i&&(0,$.jsx)(`div`,{className:`mobile-submenu`,children:(Pe[e.id]||[]).map(e=>{let t=e.path===Me,n=o7[e.icon]||(0,$.jsx)(S3,{});return(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-submenu-item ${t?`mobile-menu-item-active`:``}`,onClick:()=>Ie(e),children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:t?`#6366f1`:`#94a3b8`},children:n}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:t?`#4f46e5`:`#64748b`,fontWeight:t?600:400,fontSize:14},children:e.label})]},e.id)})})]},e.id)})]}),(0,$.jsxs)(`div`,{style:{padding:`8px 0`,borderTop:`1px solid #f1f5f9`},children:[(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=credits`),M(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#f59e0b`},children:(0,$.jsx)(U8,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`积分明细`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/user-center?tab=orders`),M(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#6366f1`},children:(0,$.jsx)(jV,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`订单记录`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{e(`/messages`),M(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#8b5cf6`},children:(0,$.jsx)(y2,{})}),(0,$.jsxs)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:[`消息中心`,k>0&&(0,$.jsx)(wQ,{color:`red`,style:{marginLeft:8,fontSize:11},children:k})]})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{o(!0),M(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#0ea5e9`},children:(0,$.jsx)(U3,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#475569`},children:`个人信息`})]}),(0,$.jsx)(`div`,{style:{height:8}}),(0,$.jsxs)(`div`,{className:`mobile-menu-item mobile-recharge-item`,onClick:()=>{c(!0),M(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#fff`},children:(0,$.jsx)(PI,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#fff`,fontWeight:600},children:`充值积分`})]}),(0,$.jsxs)(`div`,{className:`mobile-menu-item`,onClick:()=>{Ve(),M(!1)},children:[(0,$.jsx)(`span`,{className:`mobile-menu-icon`,style:{color:`#ef4444`},children:(0,$.jsx)(Y3,{})}),(0,$.jsx)(`span`,{className:`mobile-menu-label`,style:{color:`#ef4444`},children:`退出登录`})]})]})]}),(0,$.jsx)(NG,{title:(0,$.jsxs)(EV,{children:[(0,$.jsx)(d8,{}),`账号设置`]}),open:a,onCancel:()=>{o(!1),d.resetFields(),f.resetFields()},width:440,footer:null,children:(0,$.jsxs)(lL,{defaultActiveKey:`profile`,children:[(0,$.jsx)(lL.TabPane,{tab:`个人信息`,children:(0,$.jsxs)(bH,{form:f,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(bH.Item,{name:`username`,label:`用户名`,rules:[{required:!0,message:`请输入用户名`},{min:3,message:`用户名至少3位`}],children:(0,$.jsx)(tW,{placeholder:`请输入用户名`,size:`large`,prefix:(0,$.jsx)(z8,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(bH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:Be,style:{width:`100%`},children:`确认修改`})})]})},`profile`),(0,$.jsx)(lL.TabPane,{tab:`修改密码`,children:(0,$.jsxs)(bH,{form:d,layout:`vertical`,style:{marginTop:20},onValuesChange:()=>{},children:[(0,$.jsx)(bH.Item,{name:`oldPwd`,label:`原密码`,rules:[{required:!0,message:`请输入原密码`}],children:(0,$.jsx)(tW.Password,{placeholder:`请输入原密码`,size:`large`,prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(bH.Item,{name:`newPwd`,label:`新密码`,rules:[{required:!0,message:`请输入新密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(tW.Password,{placeholder:`请输入新密码(至少6位)`,size:`large`,prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(bH.Item,{name:`confirmPwd`,label:`确认新密码`,rules:[{required:!0,message:`请再次输入新密码`},({getFieldValue:e})=>({validator(t,n){return!n||e(`newPwd`)===n?Promise.resolve():Promise.reject(Error(`两次密码不一致`))}})],children:(0,$.jsx)(tW.Password,{placeholder:`请再次输入新密码`,size:`large`,prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}})})}),(0,$.jsx)(bH.Item,{children:(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:ze,style:{width:`100%`},children:`确认修改`})})]})},`password`)]})}),(0,$.jsx)(_V,{title:null,placement:`bottom`,open:s,onClose:()=>{c(!1),m(null)},height:`92vh`,className:`recharge-drawer`,styles:{header:{display:`none`},body:{padding:`24px`,overflowY:`auto`}},footer:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsxs)(EV,{children:[(0,$.jsx)(U8,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.Text,{children:`当前有效积分`}),(0,$.jsx)(Q.Text,{strong:!0,style:{color:`#6366f1`,fontSize:18},children:n?.credits??0})]}),(0,$.jsxs)(EV,{children:[(0,$.jsx)(X,{onClick:()=>{c(!1),m(null)},children:`取消`}),(0,$.jsx)(X,{type:`primary`,disabled:!p||!_e.alipay&&!_e.wechat,loading:ue,onClick:async()=>{let e=y.find(e=>e.id===p);if(e)try{de(!0);let t=await C5(e.id,ce),n=t.qrUrl||t.codeUrl||t.qr_code||t.code_url,r={price:Number(t.amount??e.currentPrice??e.price??0),credits:Number(e.monthlyGrantCredits||0),qrCode:n,method:t.paymentMethod};(t.paymentMethod===`alipay`||t.paymentMethod===`wechat`)&&n?(se(r),c(!1),q(!0),ge.current=t.orderNo,localStorage.setItem(De,JSON.stringify({orderNo:t.orderNo,...r,createdAt:t.createdAt||new Date().toISOString(),timeoutSeconds:180})),We(t.orderNo)):(Z.success(`订阅购买成功,首期积分已到账`),await n7.getState().refreshUser(),await w(),c(!1),m(null))}catch(e){Z.error(e?.message||`创建订阅订单失败`)}finally{de(!1)}},children:`确认购买`})]})]}),children:(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(ju,{style:{position:`absolute`,right:0,top:0,cursor:`pointer`,color:`#94a3b8`},onClick:()=>c(!1)}),(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:20},children:[(0,$.jsx)(Q.Title,{level:3,style:{marginBottom:8},children:`订阅套餐`}),(0,$.jsx)(Q.Text,{type:`secondary`,children:`订阅积分按自然月逐月发放;有效订阅只能升级同周期更高等级套餐,不能提前续费。`})]}),x&&(0,$.jsx)(`div`,{style:{marginBottom:20,padding:16,borderRadius:12,background:`#f8fafc`,border:`1px solid #e2e8f0`},children:(0,$.jsxs)(EV,{direction:`vertical`,size:4,children:[(0,$.jsxs)(Q.Text,{strong:!0,children:[`当前订阅:`,x.tierCode||`订阅套餐`,`(`,x.billingCycle===`monthly`?`月`:x.billingCycle===`quarterly`?`季`:`年`,`)`]}),(0,$.jsxs)(Q.Text,{type:`secondary`,children:[`已发放 `,x.grantedCount,`/`,x.grantCount,` 期,每月 `,Number(x.monthlyGrantCredits||0).toLocaleString(),` 积分`]}),(0,$.jsxs)(Q.Text,{type:`secondary`,children:[`订阅到期:`,new Date(x.expiresAt).toLocaleString(`zh-CN`,{timeZone:`Asia/Shanghai`,hour12:!1})]})]})}),(0,$.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,marginBottom:20},children:(0,$.jsxs)(BF.Group,{value:D,onChange:e=>{O(e.target.value),m(null)},buttonStyle:`solid`,children:[(0,$.jsx)(BF.Button,{value:`monthly`,children:`月套餐`}),(0,$.jsx)(BF.Button,{value:`quarterly`,children:`季套餐`}),(0,$.jsx)(BF.Button,{value:`yearly`,children:`年套餐`})]})}),y.filter(e=>e.billingCycle===D).length===0?(0,$.jsx)(`div`,{style:{padding:48,textAlign:`center`,color:`#94a3b8`},children:`暂无可订阅套餐,请联系管理员配置并上架套餐。`}):(0,$.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(250px, 1fr))`,gap:16},children:y.filter(e=>e.billingCycle===D).map((e,t)=>{let n=p===e.id,r=c7[t%c7.length];return(0,$.jsx)(`div`,{onClick:()=>e.canPurchase!==!1&&m(e.id),style:{border:n?`2px solid #6366f1`:`1px solid #e5e7eb`,borderRadius:16,padding:20,cursor:e.canPurchase===!1?`not-allowed`:`pointer`,opacity:e.canPurchase===!1?.6:1,background:`#fff`},children:(0,$.jsxs)(EV,{direction:`vertical`,size:8,style:{width:`100%`},children:[(0,$.jsxs)(EV,{children:[(0,$.jsx)(`div`,{style:{width:36,height:36,borderRadius:10,background:r.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`},children:r.icon}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:16},children:e.name}),(0,$.jsx)(`div`,{children:(0,$.jsx)(Q.Text,{type:`secondary`,children:e.description||e.tierCode})})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`span`,{style:{fontSize:28,fontWeight:800,color:`#6366f1`},children:[`¥`,e.currentPrice]}),(0,$.jsx)(wQ,{style:{marginLeft:8},children:e.priceType===`first_purchase`?`首充价`:e.priceType===`activity`?`活动价`:e.canUpgrade?`升级价`:`原价`})]}),e.canUpgrade&&Number(e.deductionAmount||0)>0&&(0,$.jsxs)(Q.Text,{type:`secondary`,children:[`目标套餐价 ¥`,e.targetPrice,`,已抵扣未生效月份 ¥`,e.deductionAmount]}),(0,$.jsxs)(wQ,{color:`purple`,children:[`每月发放 `,Number(e.monthlyGrantCredits||0).toLocaleString(),` 积分,共 `,e.grantCount,` 次`]}),(e.features||[]).map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Tu,{style:{color:`#6366f1`,marginRight:6}}),e]},e)),e.unavailableReason&&(0,$.jsx)(Q.Text,{type:`danger`,children:e.unavailableReason})]})},e.id)})}),(0,$.jsx)(`div`,{style:{marginTop:24},children:(0,$.jsx)(X,{type:`link`,icon:(0,$.jsx)(U8,{}),onClick:()=>{m(null),c(!1),E(!0)},children:`单独购买积分增值包`})}),!_e.alipay&&!_e.wechat&&(0,$.jsx)(`div`,{style:{marginTop:16,padding:12,background:`#fef2f2`,color:`#dc2626`,borderRadius:8},children:`暂无可用支付方式`}),(0,$.jsx)(`div`,{style:{marginTop:16},children:(0,$.jsxs)(BF.Group,{value:ce,onChange:e=>le(e.target.value),children:[_e.alipay&&(0,$.jsxs)(BF.Button,{value:`alipay`,children:[(0,$.jsx)(L0,{}),` 支付宝`]}),_e.wechat&&(0,$.jsxs)(BF.Button,{value:`wechat`,children:[(0,$.jsx)(K8,{}),` 微信支付`]})]})})]})}),(0,$.jsx)(NG,{title:(0,$.jsxs)(EV,{children:[(0,$.jsx)(U8,{style:{color:`#6366f1`}}),`积分充值`]}),open:T,onCancel:()=>{E(!1),m(null)},width:560,footer:(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,padding:`12px 0 0`,borderTop:`1px solid #f0f0f0`},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{E(!1),m(null)},style:{borderRadius:10,marginRight:12},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,disabled:!p||!_e.alipay&&!_e.wechat,loading:ue,onClick:async()=>{let e=_.find(e=>e.id===p);if(!e)return;let t=Number(e.grantCredits||0);try{de(!0);let n=await C5(e.id,ce),r=n.qrUrl||n.codeUrl||n.qr_code||n.code_url;(n.paymentMethod===`alipay`||n.paymentMethod===`wechat`)&&r?(se({price:Number(n.amount??e.currentPrice??e.price??0),credits:t,qrCode:r,method:n.paymentMethod}),E(!1),q(!0),ge.current=n.orderNo,localStorage.setItem(De,JSON.stringify({orderNo:n.orderNo,price:Number(n.amount??e.currentPrice??e.price??0),credits:t,qrCode:r,method:n.paymentMethod,createdAt:n.createdAt||new Date().toISOString(),timeoutSeconds:180})),We(n.orderNo)):(Z.success(`充值成功!积分已到账`),await n7.getState().refreshUser(),await w(),E(!1),m(null))}catch(e){Z.error(e?.message||`创建订单失败,请重试`)}finally{de(!1)}},style:{borderRadius:10,fontWeight:600,background:p?`linear-gradient(135deg, #6366f1, #8b5cf6)`:`#d1d5db`,border:`none`,boxShadow:p?`0 8px 24px rgba(99,102,241,0.3)`:`none`},children:`确认充值`})]}),children:(0,$.jsxs)(`div`,{style:{marginTop:16},children:[(0,$.jsxs)(EV,{style:{marginBottom:16},children:[(0,$.jsx)(U8,{style:{color:`#6366f1`}}),(0,$.jsx)(Q.Text,{style:{color:`#64748b`,letterSpacing:0},children:`当前积分余额`}),(0,$.jsx)(Q.Text,{strong:!0,style:{color:`#6366f1`,fontSize:20,fontWeight:600},children:n?.credits??0})]}),!_e.alipay&&!_e.wechat?(0,$.jsx)(`div`,{style:{marginBottom:16,padding:16,background:`#fef2f2`,borderRadius:12,border:`1px solid #fecaca`},children:(0,$.jsx)(Q.Text,{style:{color:`#dc2626`,fontSize:13},children:`⚠️ 暂无可用的支付方式,请联系管理员开启支付功能`})}):(0,$.jsxs)(`div`,{style:{marginBottom:16},children:[(0,$.jsx)(Q.Text,{style:{color:`#64748b`,fontSize:13,marginBottom:8,display:`block`},children:`选择支付方式`}),(0,$.jsxs)(BF.Group,{value:ce,onChange:e=>le(e.target.value),style:{display:`flex`,gap:12},children:[_e.alipay&&(0,$.jsxs)(BF.Button,{value:`alipay`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:ce===`alipay`?`#1677ff`:void 0,color:ce===`alipay`?`#1677ff`:void 0},children:[(0,$.jsx)(L0,{style:{fontSize:16,marginRight:6}}),`支付宝`]}),_e.wechat&&(0,$.jsxs)(BF.Button,{value:`wechat`,style:{flex:1,textAlign:`center`,borderRadius:10,height:44,lineHeight:`42px`,borderColor:ce===`wechat`?`#07c160`:void 0,color:ce===`wechat`?`#07c160`:void 0},children:[(0,$.jsx)(K8,{style:{fontSize:16,marginRight:6}}),`微信支付`]})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:12,flexWrap:`wrap`},children:[_.length===0&&(0,$.jsx)(`div`,{style:{width:`100%`,padding:32,textAlign:`center`,color:`#94a3b8`},children:`暂无可购买的积分增值包`}),_.map((e,t)=>{let n=s7[t%s7.length],r=Number(e.grantCredits||0);return(0,$.jsxs)(`div`,{onClick:()=>m(e.id),style:{flex:`1 1 45%`,minWidth:180,borderRadius:16,padding:`18px 14px`,background:p===e.id?`rgba(99,102,241,0.04)`:`#fafbff`,border:p===e.id?`2px solid #6366f1`:`1px solid #f0f0f5`,cursor:`pointer`,position:`relative`,transition:`all 0.2s`},children:[e.description&&(0,$.jsx)(wQ,{color:`purple`,style:{position:`absolute`,top:-10,left:`50%`,transform:`translateX(-50%)`,borderRadius:8,fontSize:11},children:e.description}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,$.jsx)(`div`,{style:{width:40,height:40,borderRadius:12,flexShrink:0,background:n.gradient,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:16,color:`#fff`,boxShadow:`0 6px 16px ${n.shadow}`},children:n.icon}),(0,$.jsxs)(`div`,{style:{flex:1},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:6},children:[(0,$.jsx)(Q.Text,{strong:!0,style:{fontSize:14},children:e.name}),(0,$.jsxs)(Q.Text,{style:{fontSize:13,fontWeight:600,color:`#6366f1`},children:[r.toLocaleString(),` 积分`]})]}),(0,$.jsxs)(`div`,{style:{fontSize:20,fontWeight:800,marginTop:2,background:n.gradient,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`},children:[`¥`,e.currentPrice||e.price]})]})]})]},e.id)})]})]})}),(0,$.jsx)(NG,{open:ae,onCancel:async()=>{if(Ue(),ge.current){try{await E5(ge.current)}catch{}ge.current=null}localStorage.removeItem(De),q(!1),se(null)},footer:null,width:400,closable:!1,styles:{body:{padding:0,borderRadius:16,overflow:`hidden`}},children:(0,$.jsxs)(`div`,{style:{padding:`24px`},children:[(0,$.jsxs)(`div`,{style:{textAlign:`center`,marginBottom:24},children:[(0,$.jsx)(`div`,{style:{width:48,height:48,background:oe?.method===`alipay`?`linear-gradient(135deg, #1677ff, #0958d9)`:`linear-gradient(135deg, #07c160, #06ae56)`,borderRadius:16,display:`flex`,alignItems:`center`,justifyContent:`center`,margin:`0 auto 12px`},children:oe?.method===`alipay`?(0,$.jsx)(L0,{style:{fontSize:24,color:`#fff`}}):(0,$.jsx)(K8,{style:{fontSize:24,color:`#fff`}})}),(0,$.jsx)(Q.Title,{level:4,style:{margin:0},children:oe?.method===`alipay`?`支付宝支付`:`微信支付`}),(0,$.jsx)(Q.Text,{style:{color:`#94a3b8`,fontSize:13},children:oe?.method===`alipay`?`请使用支付宝扫描二维码完成支付`:`请使用微信扫描二维码完成支付`})]}),(0,$.jsxs)(`div`,{style:{background:`#fff`,borderRadius:16,padding:20,display:`flex`,flexDirection:`column`,alignItems:`center`,boxShadow:`0 4px 20px rgba(0,0,0,0.08)`},children:[(0,$.jsx)(`div`,{style:{width:180,height:180,borderRadius:12,overflow:`hidden`,background:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:oe&&(0,$.jsx)(P0,{value:oe.qrCode,size:160,level:`M`,includeMargin:!1})}),(0,$.jsxs)(`div`,{style:{marginTop:16,textAlign:`center`},children:[(0,$.jsxs)(`div`,{style:{fontSize:28,fontWeight:700,color:`#1a1a2e`},children:[`¥`,oe?.price||0]}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#64748b`,marginTop:4},children:[`购买 `,oe?.credits||0,` 积分`]}),(0,$.jsx)(`div`,{style:{marginTop:12,padding:`8px 16px`,background:fe<=30?`#fef2f2`:`#f0f9ff`,borderRadius:8,border:fe<=30?`1px solid #fecaca`:`1px solid #bae6fd`,display:`inline-block`},children:(0,$.jsxs)(`span`,{style:{fontSize:14,fontWeight:600,color:fe<=30?`#dc2626`:`#0284c7`},children:[`订单将在 `,(0,$.jsx)(`span`,{style:{fontSize:16,fontWeight:800},children:fe}),` 秒后关闭`]})})]})]}),(0,$.jsx)(`div`,{style:{marginTop:20,padding:16,background:`#fef3c7`,borderRadius:12},children:(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8},children:[(0,$.jsx)(`div`,{style:{fontSize:16,marginTop:-2},children:`💡`}),(0,$.jsxs)(`div`,{style:{fontSize:13,color:`#92400e`},children:[(0,$.jsx)(`div`,{style:{fontWeight:500,marginBottom:4},children:`支付提示`}),(0,$.jsxs)(`ul`,{style:{margin:0,paddingLeft:16},children:[(0,$.jsx)(`li`,{style:{marginBottom:2},children:`请在支付后等待页面自动跳转`}),(0,$.jsx)(`li`,{children:`如支付成功但未到账,请联系客服`})]})]})]})}),(0,$.jsx)(`div`,{style:{marginTop:20},children:(0,$.jsx)(X,{size:`large`,block:!0,onClick:async()=>{if(Ue(),ge.current){try{await E5(ge.current)}catch{}ge.current=null}localStorage.removeItem(De),q(!1),se(null),m(null)},style:{borderRadius:10},children:`取消支付`})})]})}),(0,$.jsx)(mse,{}),(0,$.jsx)(`div`,{className:`contact-button-wrapper`,style:{right:`${R.x}px`,bottom:`${window.innerHeight-R.y}px`},children:(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`div`,{className:`contact-tooltip`,style:{opacity:+!!N},children:`联系我们`}),(0,$.jsx)(`button`,{className:`contact-button ${B?`dragging`:``}`,onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),onMouseDown:Oe,onMouseUp:Ae,children:(0,$.jsx)(s6,{style:{fontSize:20}})})]})}),(0,$.jsx)(NG,{title:(0,$.jsxs)(EV,{children:[(0,$.jsx)(s6,{}),`联系我们`]}),open:l,onCancel:()=>{u(!1),F.resetFields()},footer:null,width:480,className:`contact-modal`,children:(0,$.jsxs)(`div`,{style:{marginTop:8},children:[(0,$.jsxs)(bH,{form:F,layout:`vertical`,children:[(0,$.jsx)(bH.Item,{name:`name`,label:`姓名`,rules:[{required:!0,message:`请输入姓名`}],children:(0,$.jsx)(tW,{placeholder:`请输入您的姓名`,size:`large`})}),(0,$.jsx)(bH.Item,{name:`phone`,label:`手机号`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1[3-9]\d{9}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(tW,{placeholder:`请输入您的手机号`,size:`large`})}),(0,$.jsx)(bH.Item,{name:`companyName`,label:`公司名称`,rules:[{required:!0,message:`请输入公司名称`}],children:(0,$.jsx)(tW,{placeholder:`请输入公司名称`,size:`large`})}),(0,$.jsx)(bH.Item,{name:`industry`,label:`您的行业`,rules:[{required:!0,message:`请输入您的行业`}],children:(0,$.jsx)(tW,{placeholder:`请输入您的行业`,size:`large`})}),(0,$.jsx)(bH.Item,{name:`message`,label:`留言(选填)`,children:(0,$.jsx)(tW.TextArea,{placeholder:`请输入您的需求或问题`,rows:3,style:{borderRadius:10}})})]}),(0,$.jsxs)(`div`,{style:{marginTop:16,display:`flex`,gap:12},children:[(0,$.jsx)(X,{size:`large`,onClick:()=>{u(!1),F.resetFields()},style:{borderRadius:10,flex:1},children:`取消`}),(0,$.jsx)(X,{type:`primary`,size:`large`,onClick:He,loading:I,style:{borderRadius:10,background:`linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)`,border:`none`,flex:1},children:`提交`})]})]})})]})},vse=`http://localhost:8000/api`,yse=()=>{let{checkAuth:e}=n7(),[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(`password`),[a,o]=(0,S.useState)(`password`),[s]=On(),c=s.get(`redirect`),l=s.get(`tab`),[u,d]=(0,S.useState)(0),[f,p]=(0,S.useState)(0),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(!1),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(!1),[C,w]=(0,S.useState)(0),[T,E]=(0,S.useState)(!1),[D,O]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!1),j=(()=>{try{let e=localStorage.getItem(`siteInfo`);if(e){let t=JSON.parse(e);return{siteName:t.siteName||`智创`,siteLogo:t.siteLogo||``}}}catch{}return{siteName:`智创`,siteLogo:``}})(),[M,N]=(0,S.useState)(j.siteName),[P,F]=(0,S.useState)(j.siteLogo),[I,L]=(0,S.useState)(``),[R,z]=(0,S.useState)(!1),[B,V]=(0,S.useState)(``),[H,U]=(0,S.useState)(``),ee=Ye(),{login:W}=n7(),[te]=bH.useForm(),[G]=bH.useForm(),[ne]=bH.useForm();(0,S.useEffect)(()=>{_5().then(e=>{N(e.siteName),F(e.siteLogo),L(e.loginBgVideo||``),V(e.userAgreementPrivacyUrl),U(e.siteCopyright)}).catch(()=>{})},[]),(0,S.useEffect)(()=>{l===`register`&&i(`register`)},[l]);let K=()=>{if(c)try{ee(decodeURIComponent(c));return}catch{}ee(`/home`)},re=()=>m?!0:(Z.warning(`请先阅读并同意用户协议及隐私政策`),!1),ie=async()=>{if(re())try{let t=await te.validateFields();await W(t.phone,t.password,void 0,t.rememberMe),Z.success(`登录成功,欢迎回来`),await e(),K()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}},ae=async()=>{if(re())try{let t=G.getFieldsValue();if(!t.phone||!t.code){Z.error(`请填写手机号和验证码`);return}n(!0),await yae(t.phone,t.code),Z.success(`登录成功,欢迎回来`),await e(),K()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t)}finally{n(!1)}},q=async()=>{if(re())try{let t=await ne.validateFields();n(!0),await bae(t.phone,t.regCode,t.password),Z.success(`注册成功`),await e(),K()}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`注册失败`;Z.error(t)}finally{n(!1)}},oe=(e,t)=>{e(60);let n=setInterval(()=>{e(e=>e<=1?(clearInterval(n),_(!1),t?O(!0):A(!0),0):e-1)},1e3)};(0,S.useEffect)(()=>{u===0&&r===`phone`&&x(!1)},[u,r]);let se=async(e,t)=>{try{if(!e||!/^1\d{10}$/.test(e)){Z.error(`请输入正确的手机号`);return}if(t){_(!0),y(!1);return}if(!b){_(!0),x(!1);return}let n=``;n=r===`register`?`register`:`login`,await v5(e,n),oe(t?p:d),Z.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t),r===`register`?(y(!1),p(0)):(x(!1),d(0)),w(e=>e+1)}},ce=async(e=!1)=>{let t=r===`register`?ne.getFieldValue(`phone`):G.getFieldValue(`phone`);try{let e=``;e=r===`register`?`register`:`login`,await v5(t,e),r===`register`?(y(!0),oe(p,!0)):(x(!0),oe(d,!1)),Z.success(`验证码已发送`)}catch(e){let t=e?.response?.data?.detail||e?.response?.data?.message||e?.message||`登录失败`;Z.error(t),r===`register`?(y(!1),p(0),O(!0)):(x(!1),d(0),A(!0)),w(e=>e+1)}},le=e=>{o(e),i(e),d(0),p(0),x(!1),y(!1),_(!1),O(!1),A(!1),w(e=>e+1),e===`password`?te.resetFields():G.resetFields()},ue={background:`#fff`,border:`1.5px solid #e2e8f0`,color:`#1e293b`,borderRadius:10,fontSize:14},de=e=>{if(!e){Z.warning(`暂未上传协议文件`);return}e.startsWith(`http://`)||e.startsWith(`https://`)?window.open(e,`_blank`):window.open(`${vse.replace(/\/api$/,``)}${e}`,`_blank`)};return(0,$.jsxs)(`div`,{className:`login-page`,children:[(0,$.jsx)(bse,{src:I,onReady:()=>z(!0)}),(0,$.jsx)(`div`,{className:`login-bg-overlay`,style:{opacity:+!!R}}),(0,$.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,opacity:+!!R,transition:`opacity 0.5s ease`,pointerEvents:R?`auto`:`none`},children:[(0,$.jsx)(`div`,{className:`login-slogan`,children:(0,$.jsx)(`span`,{className:`login-slogan-text`,children:`AI赋能创意,素材触手可及`})}),(0,$.jsx)(`div`,{className:`login-center`,children:(0,$.jsxs)(dL,{className:`login-card`,styles:{body:{padding:`32px 32px`}},children:[(0,$.jsx)(`div`,{className:`login-card-header`,children:(0,$.jsxs)(`div`,{className:`login-logo-row`,children:[P?(0,$.jsx)(`img`,{src:P,alt:`logo`,className:`login-logo-img`}):(0,$.jsx)(`div`,{className:`login-logo-placeholder`,children:(0,$.jsx)(k8,{style:{fontSize:20,color:`#fff`}})}),(0,$.jsx)(`span`,{className:`login-site-name`,children:M})]})}),(0,$.jsx)(Q.Text,{className:`login-card-subtitle`,children:r===`register`?`注册新账号,开始创作视频`:`登录您的账号,开始创作`}),r!==`register`&&(0,$.jsx)(`div`,{className:`login-tabs`,children:[`password`,`phone`].map(e=>(0,$.jsx)(`div`,{onClick:()=>le(e),className:`login-tab ${a===e?`login-tab-active`:``}`,children:e===`password`?`密码登录`:`验证码登录`},e))}),r===`password`&&(0,$.jsxs)(bH,{form:te,size:`large`,layout:`vertical`,onFinish:ie,children:[(0,$.jsx)(bH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(tW,{prefix:(0,$.jsx)(u6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,style:ue})}),(0,$.jsx)(bH.Item,{name:`password`,rules:[{required:!0,message:`请输入密码`}],children:(0,$.jsx)(tW.Password,{prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入密码`,style:ue})}),(0,$.jsx)(bH.Item,{name:`rememberMe`,valuePropName:`checked`,style:{marginBottom:12},children:(0,$.jsx)(sR,{children:`记住我的登录状态`})}),(0,$.jsx)(bH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,htmlType:`submit`,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`phone`&&(0,$.jsxs)(bH,{form:G,size:`large`,layout:`vertical`,children:[(0,$.jsx)(bH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(tW,{prefix:(0,$.jsx)(u6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(bH.Item,{name:`code`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(EV.Compact,{style:{width:`100%`},children:[(0,$.jsx)(tW,{prefix:(0,$.jsx)(a8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!b,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:u>0,style:{fontSize:14,fontWeight:400},onClick:()=>{k?(x(!1),_(!0),w(e=>e+1)):g&&!b?(E(!0),setTimeout(()=>E(!1),500)):se(G.getFieldValue(`phone`))},className:`login-code-btn`,children:u>0?`${u}s`:k?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(bH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:b,shake:T})},C),(0,$.jsx)(bH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:ae,loading:t,block:!0,className:`login-submit-btn`,children:`登 录`})})]}),r===`register`&&(0,$.jsxs)(bH,{form:ne,size:`large`,layout:`vertical`,children:[(0,$.jsx)(bH.Item,{name:`phone`,rules:[{required:!0,message:`请输入手机号`},{pattern:/^1\d{10}$/,message:`请输入正确的手机号`}],children:(0,$.jsx)(tW,{prefix:(0,$.jsx)(u6,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入手机号`,maxLength:11,style:ue})}),(0,$.jsx)(bH.Item,{name:`regCode`,rules:[{required:!0,message:`请输入验证码`}],children:(0,$.jsxs)(EV.Compact,{style:{width:`100%`},children:[(0,$.jsx)(tW,{prefix:(0,$.jsx)(a8,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请输入验证码`,maxLength:6,disabled:!v,style:{...ue,borderRadius:`10px 0 0 10px`,flex:1}}),(0,$.jsx)(X,{disabled:f>0,style:{fontSize:14,fontWeight:400},onClick:()=>{D?(y(!1),_(!0),w(e=>e+1)):g&&!v?(E(!0),setTimeout(()=>E(!1),500)):se(ne.getFieldValue(`phone`),!0)},className:`login-code-btn`,children:f>0?`${f}s`:D?`重新发送`:`获取验证码`})]})}),g&&(0,$.jsx)(bH.Item,{style:{marginBottom:12},children:(0,$.jsx)(l7,{onSuccess:ce,isVerified:v,shake:T})},C),(0,$.jsx)(bH.Item,{name:`password`,rules:[{required:!0,message:`请设置密码`},{min:6,message:`密码至少6位`}],children:(0,$.jsx)(tW.Password,{prefix:(0,$.jsx)(U3,{style:{color:`#94a3b8`,marginRight:8}}),placeholder:`请设置密码(至少6位)`,style:ue})}),(0,$.jsx)(bH.Item,{style:{marginBottom:12},children:(0,$.jsx)(X,{type:`primary`,onClick:q,loading:t,block:!0,className:`login-submit-btn`,children:`注 册`})})]}),(0,$.jsx)(`div`,{className:`login-agreement`,children:(0,$.jsx)(sR,{checked:m,onChange:e=>h(e.target.checked),children:(0,$.jsxs)(`span`,{className:`login-agreement-text`,children:[`我已阅读并同意`,(0,$.jsx)(`span`,{onClick:e=>{e.stopPropagation(),de(B)},className:`login-link`,children:`《用户协议及隐私政策》`})]})})}),(0,$.jsx)(`div`,{className:`login-footer`,children:r===`register`?(0,$.jsx)(Q.Text,{className:`login-switch-btn`,onClick:()=>{i(`password`),o(`password`),O(!1),A(!1),y(!1),_(!1),w(e=>e+1),ne.resetFields()},children:`已有账号?去登录`}):(0,$.jsx)(Q.Text,{className:`login-switch-btn`,onClick:()=>{i(`register`),O(!1),A(!1),y(!1),_(!1),w(e=>e+1)},children:`没有账号?立即注册`})})]})}),H&&(0,$.jsx)(`div`,{className:`login-copyright-wrapper`,children:(0,$.jsx)(`div`,{className:`login-copyright`,children:H})})]})]})},bse=({src:e,onReady:t})=>{let[n,r]=(0,S.useState)(!1),i=S.useRef(null),a=()=>{n||(r(!0),i.current?.play().catch(()=>{}),t())};if(!e)return t(),null;let o=e.toLowerCase().endsWith(`.gif`),s=e.toLowerCase().endsWith(`.webp`);return o||s?(0,$.jsx)(`img`,{className:`login-bg-video`,src:e,alt:``,onLoad:a,onError:a}):(0,$.jsxs)($.Fragment,{children:[!n&&(0,$.jsx)(`div`,{className:`login-bg-video login-bg-placeholder`}),(0,$.jsx)(`video`,{ref:i,className:`login-bg-video`,style:{opacity:+!!n},autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:`auto`,onCanPlayThrough:a,onCanPlay:a,onError:a,children:(0,$.jsx)(`source`,{src:e,type:e.endsWith(`.webm`)?`video/webm`:e.endsWith(`.mov`)?`video/quicktime`:`video/mp4`})})]})},l7=({onSuccess:e,isVerified:t,shake:n})=>{let r=S.useRef(null),i=S.useRef(null),a=S.useRef(null),o=S.useRef(0),s=S.useRef(!1),[c,l]=S.useState(360),u=c-50;S.useEffect(()=>{let e=()=>{if(r.current){let e=r.current.offsetWidth;e>0&&l(e)}};e();let t=new ResizeObserver(e);return r.current&&t.observe(r.current),window.addEventListener(`resize`,e),()=>{t.disconnect(),window.removeEventListener(`resize`,e)}},[]);let d=n=>{if(s.current||t)return;let r=Math.max(0,Math.min(n,u));o.current=r,i.current&&(i.current.style.left=`${r}px`),a.current&&(a.current.style.width=`${r+50}px`),r>=u-5&&(s.current=!0,i.current&&(i.current.style.background=`#22c55e`,i.current.innerHTML=`