Эх сурвалжийг харах

营销:适配商城装修组件【营销文章】

owen 1 жил өмнө
parent
commit
343b1fd5f6

+ 12 - 0
sheep/api/promotion/article.js

@@ -0,0 +1,12 @@
+import request from '@/sheep/request';
+
+export default {
+    // 获得文章详情
+    getArticle: (id) => {
+        return request({
+            url: '/app-api/promotion/article/get',
+            method: 'GET',
+            params: { id }
+        });
+    }
+}

+ 2 - 2
sheep/components/s-block-item/s-block-item.vue

@@ -23,8 +23,6 @@
     <s-video-block v-if="type === 'VideoPlayer'" :data="data" :styles="styles" />
     <!-- 基础组件:辅助线 -->
     <s-line-block v-if="type === 'lineBlock'" :data="data" />
-    <!-- 图文组件:富文字 -->
-    <s-richtext-block v-if="type === 'richtext'" :data="data" :styles="styles" />
     <!-- 图文组件:热区 -->
     <s-hotzone-block v-if="type === 'hotzone'" :data="data" :styles="styles" />
 
@@ -43,6 +41,8 @@
     <s-live-block v-if="type === 'mplive'" :data="data" :styles="styles" />
     <!-- 营销组件:优惠券 -->
     <s-coupon-block v-if="type === 'CouponCard'" :data="data" :styles="styles" />
+    <!-- 营销组件:文章 -->
+    <s-richtext-block v-if="type === 'PromotionArticle'" :data="data" :styles="styles" />
 
     <!-- 会员组件:会员卡片 -->
     <s-user-card v-if="type === 'userCard'" />

+ 3 - 5
sheep/components/s-richtext-block/s-richtext-block.vue

@@ -15,7 +15,7 @@
 </template>
 <script setup>
   import { reactive, onMounted } from 'vue';
-  import sheep from '@/sheep';
+  import ArticleApi from '@/sheep/api/promotion/article';
   const props = defineProps({
     data: {
       type: Object,
@@ -30,9 +30,7 @@
     content: '',
   });
   onMounted(async () => {
-    const { error, data } = await sheep.$api.data.richtext(props.data.id);
-    if (error === 0) {
-      state.content = data.content;
-    }
+    const { data } = await ArticleApi.getArticle(props.data.id);
+    state.content = data.content;
   });
 </script>