4.7 KiB
4.7 KiB
1. Admin content management page
- 1.1 Add
apps/admin/pages/content.vueloading all four kinds throughadmin.getContent()from@vmall/shared(inactive entries included) and add a content entry to theapps/adminnav beside existing platform operations. - 1.2 Implement one editor section per kind — banners, promos, quick links, floor adverts — with the exact per-entry fields the API accepts: image and destination URL for banners and promos,
{ en, zh }label, destination URL and inline SVG glyph for quick links, and image for floor adverts, plus an active flag on every row. - 1.3 Support ordered row editing per kind (add, remove, move up/down — no drag and drop) and pre-validate each row with the API rules (non-empty image and destination URLs, non-empty glyph, non-empty
enandzhquick-link labels), showing inline field errors before any request is sent. - 1.4 Save one kind at a time by submitting the whole displayed list through
admin.replaceContent(kind, items)so the API replaces that kind atomically and reindexes positions, leaving the other three kinds untouched; render a per-entry storefront preview (image, destination, glyph/label) and clear success feedback on save. - 1.5 On a rejected save keep the edited rows and show a visible failure message, and add the page's bilingual strings through the existing admin locale sources.
2. Admin brand management page
- 2.1 Add
apps/admin/pages/brands.vueloading the registry throughadmin.getBrands()and add a brands entry to theapps/adminnav beside existing platform operations. - 2.2 Edit the whole ordered list with add, remove and move up/down rows carrying slug, non-empty
{ en, zh }names and an active flag; pre-validate slugs against the API pattern (asciia-z,0-9,-) and reject duplicate slugs and incomplete bilingual names with inline errors before any request is sent. - 2.3 Save the full list through
admin.replaceBrands(items)so positions follow the displayed order, and render a preview row per brand as the public list serves it (slug and bilingual name) with clear success feedback on save. - 2.4 On a rejected save keep the edited rows and show a visible failure message, and add the page's bilingual strings through the existing admin locale sources.
3. Shop-admin profile editing
- 3.1 Add the minimal merchant-scoped endpoint
PUT /api/shop/profileinapps/api/src/modules/shop/: an authenticated write scoped withown_shopover the caller's shop, reusing the existing profile upsert and{ en, zh }bilingual validation, accepting logo, banner, company, region, address, notice and after_sale, and never storingscore_rating,score_agreement,score_serviceorscore_speed; the service returnsApiResult<ShopProfileView>. - 3.2 Add a
shop.updateMyProfilemethod to the@vmall/sharedcontract (own-profile input without score fields, returningShopProfile) with live-client wiring; all frontend calls go through this shared contract only. - 3.3 Add
apps/shop-admin/pages/shop-profile.vueediting the caller's own shop profile — logo and banner URLs, company, region and bilingual address, notice and after-sale copy — prefilled fromshop.getMyShop()and the composedgetShop(slug)read, with non-emptyenandzhvalidation on bilingual fields and no score fields in the form. - 3.4 Save through
shop.updateMyProfile, keep the form values and show a visible failure message when the write is refused (success feedback otherwise), and add the shop-profile nav entry toapps/shop-adminwith bilingual strings through the existing shop-admin locale sources.
4. Verification
- 4.1 Add integration coverage in
apps/api/tests/reusing thetests/common/mod.rsfixtures for the new endpoint: a merchant upsert round-trips to the public shop read, incomplete bilingual text is refused with the stored profile unchanged, submitted score values leave the stored scores unchanged, a user without a shop is refused, and another shop's profile is untouched; run the focusedcargo test -p vmall-api --test shops. - 4.2 Build all three frontends because the shared contract changes:
pnpm --filter @vmall/admin build,pnpm --filter @vmall/shop-admin build, andpnpm --filter @vmall/mall build. - 4.3 Run the API and browser-smoke the admin content page (edit, reorder, per-kind save reflected on the mall home with the other kinds untouched), the admin brands page (edit and save reflected in the public brand list), and the shop-admin profile page (edit, save, and the mall store page showing the new copy for that shop only).
- 4.4 Check every OpenSpec task and run
openspec change validate add-content-admin-ui --strictplusopenspec validate --all --strict.