소스 검색

fix(progress): 添加 NProgress 进度条启动调用

feat(route): 初始化动态路由时打印佛祖保佑艺术图案并移除调试日志

fix(api): 将 sku 图片字段设为必填项

feat(goods): 展示 sku 首张图片并支持懒加载;处理渠道商品价格数据映射
zhangtao 3 주 전
부모
커밋
7da8f5498c
4개의 변경된 파일38개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 0
      src/router/guard/progress.ts
  2. 25 1
      src/store/modules/route/index.ts
  3. 1 1
      src/typings/api.d.ts
  4. 11 1
      src/views/goods/store-goods/index.vue

+ 1 - 0
src/router/guard/progress.ts

@@ -3,6 +3,7 @@ import type { Router } from 'vue-router';
 export function createProgressGuard(router: Router) {
   router.beforeEach((_to, _from, next) => {
     window.NProgress?.start?.();
+
     next();
   });
   router.afterEach(_to => {

+ 25 - 1
src/store/modules/route/index.ts

@@ -213,10 +213,34 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
   /** Init dynamic auth route */
   async function initDynamicAuthRoute() {
     const { data, error } = await fetchGetUserRoutes();
+    console.log(
+      [
+        '                   _ooOoo_',
+        '                  o8888888o',
+        '                  88" . "88',
+        '                  (| -_- |)',
+        '                  O\\  =  /O',
+        "               ____/`---'\\____",
+        "             .'  \\\\|     |//  `.",
+        '            /  \\\\|||  :  |||//  \\',
+        '           /  _||||| -:- |||||-  \\',
+        '           |   | \\\\\\  -  /// |   |',
+        "           | \\_|  ''\\---/''  |   |",
+        '           \\  .-\\__  `-`  ___/-. /',
+        "         ___`. .'  /--.--\\  `. . __",
+        '      ."" \'<  `.___\\_<|>_/___.\'  >\'"".',
+        '     | | :  `- \\`.;`\\ _ /`;.`/ - ` : | |',
+        '     \\  \\ `-.   \\_ __\\ /__ _/   .-` /  /',
+        "======`-.____`-.___\\_____/___.-`____.-'======",
+        "                   `=---='",
+        '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^',
+        '         佛祖保佑       永无BUG       代码和人有一个能跑就行'
+      ].join('\n')
+    );
+
     if (!error) {
       const menu = convertMenuData({ menuList: data?.menuList });
       addAuthRoutes(menu);
-      console.log(menu, '请求成功menu');
 
       handleConstantAndAuthRoutes();
 

+ 1 - 1
src/typings/api.d.ts

@@ -261,7 +261,7 @@ declare namespace Api {
       /**
        * sku图片
        */
-      pic?: string;
+      pic: string;
       /**
        * 价格
        */

+ 11 - 1
src/views/goods/store-goods/index.vue

@@ -36,9 +36,10 @@ const columns: NaiveUI.TableColumn<Api.goods.ShopSku>[] = [
       if (!row.sku) {
         return '---';
       }
+      const img = row.sku.pic?.split(',');
       return (
         <div class={'flex items-center'}>
-          <NImage src={row.sku.pic} class="h-[80px] min-w-80px w-[80px]" />
+          <NImage src={img[0]} class="h-[80px] min-w-80px w-[80px]" lazy />
           <div class={'ml-[10px]'}>
             <div class={'text-[16px] font-semibold'}>{row.sku.skuName || '--'}</div>
             <div class={'text-gray'}>海博商品ID: {row.sku.hbSkuId || '--'} </div>
@@ -259,6 +260,15 @@ function openImportModal() {
 }
 function handleModalPrice(row: Api.goods.ShopSku) {
   selectData.value = row;
+  if (row.channelProdList) {
+    PriceData.value = row.channelProdList?.map(it => {
+      return {
+        channelId: Number(it.channelId),
+        channelProdPrice: Number(it.channelProdPrice),
+        id: Number(it.id)
+      };
+    });
+  }
   openPriceModal();
 }
 function handleAddPrice() {