优化站内信图标和哈夫币发布校验
This commit is contained in:
@@ -43,6 +43,7 @@ import {
|
||||
const draftSaveDelay = 400
|
||||
const multiScreenshotLimit = 3
|
||||
const multiScreenshotKeys = new Set(['tencentSecurity', 'skin'])
|
||||
const coinUnitPerM = 1000000
|
||||
|
||||
interface UsePublishFormOptions {
|
||||
draftKey: string
|
||||
@@ -684,7 +685,7 @@ export function usePublishForm(options: UsePublishFormOptions) {
|
||||
server_region: form.server_region,
|
||||
login_platform: form.login_method,
|
||||
rank_level: form.rank_level,
|
||||
haf_coin_amount: pricing.coinMAmount.value * 1000000,
|
||||
haf_coin_amount: toHafCoinAmount(pricing.coinMAmount.value),
|
||||
asset_summary: buildAssetSummary(),
|
||||
screenshot_urls: pricing.screenshotUrls.value,
|
||||
price_cent: yuanToCent(pricing.calculatedFinalPrice.value),
|
||||
@@ -728,6 +729,7 @@ export function usePublishForm(options: UsePublishFormOptions) {
|
||||
|
||||
function validateForm() {
|
||||
if (!form.server_region) return '请选择区服'
|
||||
if (!Number.isFinite(pricing.coinMAmount.value)) return '哈夫币/M格式不正确'
|
||||
if (pricing.coinMAmount.value <= 0) return '请填写哈夫币/M'
|
||||
if (!form.rank_level) return '请选择段位'
|
||||
if (!form.fire_level) return '请填写烽火等级'
|
||||
@@ -899,6 +901,10 @@ export function usePublishForm(options: UsePublishFormOptions) {
|
||||
return pricing.screenshotSlots.value.find(item => item.key === key)?.label || '该截图'
|
||||
}
|
||||
|
||||
function toHafCoinAmount(coinM: number) {
|
||||
return Math.round(coinM * coinUnitPerM)
|
||||
}
|
||||
|
||||
function recordValue(value: unknown): Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
||||
? (value as Record<string, unknown>)
|
||||
|
||||
Reference in New Issue
Block a user