浏览代码

富文本展示

zuy 1 年之前
父节点
当前提交
a40d7f05c3

+ 1 - 1
src/components/charge-station/charge-station.vue

@@ -12,7 +12,7 @@
       <view>
         <view class="flex flex-align-center">
           <view class="fs-32 fw-bold" @click.stop="detail">{{ title }}</view>
-          <image class="ml-10" src="/static/images/coupon-center.png" mode="widthFix" style="width:32rpx"/>
+          <image v-if="activityList&&activityList.length>0" class="ml-10" src="/static/images/coupon-center.png" mode="widthFix" style="width:32rpx"/>
           <view class="coupon-box ml-5" @click.stop="toCouponCenter"
                 v-if="activityList&&activityList.length>0"
                 @touchstart="touchstart"

+ 16 - 9
src/components/station-coupon/station-coupon.vue

@@ -10,8 +10,7 @@
             class="item mt-20 "
             v-for="(item, index) in couponList"
             :class="item.collected?'inactive':''"
-            :key="index"
-        >
+            :key="index">
           <image class="full-percent" src="/static/images/discount-bg.png"></image>
           <view class="absolute-full flex pt-8 pb-8">
             <view class="left  flex-justify-center pl-48">
@@ -40,7 +39,7 @@
 
                 </view>
 
-                <block >
+                <block>
                   <view class="fs-26 color-999 mt-8"
                         @click.stop="to(`/pages-common/activity/activity?id=${item.activityId}`)">
                     <view class="fs-26 color-999">到期时间:{{ item.endTime }}</view>
@@ -54,11 +53,19 @@
                 </block>
               </view>
               <view class="item-content_right">
-                <view class="item-status ml-10" @tap.stop="handleCollectCoupon(item,index)">{{item.collected?'已领取':'领取'}}</view>
+                <view class="item-status ml-10" @tap.stop="handleCollectCoupon(item,index)">{{ item.collected ? '已领取' : '领取' }}</view>
               </view>
             </view>
           </view>
         </view>
+
+        <view style="width: 100%;text-align: center;display: flex;flex-direction: column;align-content: center;align-items: center;">
+          <image v-if="!couponList||couponList.length==0"
+                 style="width: 240rpx;" mode="widthFix"
+                 src="/static/images/search-empty.png"></image>
+
+          <text style="font-size: 22rpx;">暂无优惠券</text>
+        </view>
       </view>
 
 
@@ -81,7 +88,7 @@ const stationId = ref(null);
 const visible = ref(false);
 
 const handleClose = () => {
- visible.value = false;
+  visible.value = false;
 }
 
 onPullDownRefresh(() => {
@@ -92,8 +99,8 @@ const changeTab = (tab: number) => {
   mode.value = tab;
 }
 
-const handleCollectCoupon = (coupon: any,index:number) => {
-  if(coupon.collected)return;
+const handleCollectCoupon = (coupon: any, index: number) => {
+  if (coupon.collected) return;
   collectCoupon(coupon.id).then((res) => {
     console.log(res)
     uni.showToast({
@@ -101,9 +108,9 @@ const handleCollectCoupon = (coupon: any,index:number) => {
       icon: "success"
     });
     couponList.value[index].collected = true;
-  }).catch(e=>{
+  }).catch(e => {
     console.error(e)
-    if(e.errMsg){
+    if (e.errMsg) {
       uni.showToast({
         title: e.errMsg,
         icon: "none"

+ 3 - 1
src/pages-charge/machines/machines.vue

@@ -30,7 +30,9 @@
       <view class="station flex-column" v-if="canUseCount >= 0">
         <view style="display: inline-flex;align-items: center;">
           <view class="fs-40 fw-600 color-000">{{ title }}</view>
-          <image class="ml-10" src="/static/images/coupon-center.png" mode="widthFix" style="width:32rpx"/>
+          <image class="ml-10"
+                 v-if="location.activityList&&location.activityList.length>0"
+                 src="/static/images/coupon-center.png" mode="widthFix" style="width:32rpx"/>
           <view class="coupon-box ml-5"
                 v-if="location.activityList&&location.activityList.length>0"
                 @tap.stop="toCouponCenter"

+ 38 - 23
src/pages-common/activity/activity.vue

@@ -1,39 +1,43 @@
 <template>
   <view class="page">
     <block v-if="activity">
-      <navigation-bar
-        :title="activity.name"
-        :color="'#fff'"
-        :placeholder="false"
-        :background="'#3F3EC2'"
-      ></navigation-bar>
+      <!--      <navigation-bar
+              :title="activity.name"
+              :color="'#fff'"
+              :placeholder="false"
+              :background="'#fff'"
+            ></navigation-bar>-->
       <image
-        v-if="activity.activityDescPage"
-        style="width: 100%"
-        mode="widthFix"
-        :src="activity.activityDescPage"
+          v-if="activity.activityDescPage"
+          style="width: 100%"
+          mode="widthFix"
+          :src="activity.activityDescPage"
       ></image>
     </block>
-    <view class="desc">
+    <view class="desc" v-if="desc&&desc.length>0">
       <view class="flex mb-40" v-for="(item, index) in desc" :key="index">
         <view
-          class="width-40 height-40 br-round fs-28 color-fff flex-center flex-shrink mr-20"
-          style="
+            class="width-40 height-40 br-round fs-28 color-fff flex-center flex-shrink mr-20"
+            style="
             shadow: 0px 1px 1px rgba(0, 0, 0, 0.25));
             background: linear-gradient(180deg, #9767f8 0%, #564eed 100%);
           "
-          >{{ index + 1 }}</view
+        >{{ index + 1 }}
+        </view
         >
         <view class="fs-28 lh-40 flex-grow" style="color: rgba(8, 0, 61, 0.8)">{{ item }}</view>
       </view>
     </view>
+    <view class="desc">
+      <view v-html="activity && activity.activityDesc"></view>
+    </view>
   </view>
 </template>
 
 <script setup lang="ts">
-import { fetchProfile } from "../../api/user";
-import { onLoad } from "@dcloudio/uni-app";
-import { ref } from "vue";
+import {fetchProfile} from "../../api/user";
+import {onLoad} from "@dcloudio/uni-app";
+import {ref} from "vue";
 
 const desc = ref<string[]>([]);
 const activity = ref();
@@ -43,9 +47,15 @@ onLoad((options: any) => {
     title: "加载中",
   });
   fetchProfile().then((res) => {
-    const a = res.activityList.find((item: any) => item.id === options.id);
-    desc.value = a?.activityDesc?.split("\n");
+    //TODO 改为活动接口查询
+    const a = res.activityList.find((item: any) => item.id == options.id);
+    // desc.value = a?.activityDesc?.split("\n");
     activity.value = a;
+    if (a && a.name) {
+      uni.setNavigationBarTitle({
+        title: a.name
+      });
+    }
     uni.hideLoading();
   });
 });
@@ -53,18 +63,23 @@ onLoad((options: any) => {
 
 <style lang="scss">
 page {
-  background-color: #716ffc;
+  //background-color: #716ffc;
 }
+
 .page {
   position: relative;
+
   .desc {
     position: absolute;
     width: 100%;
     left: 0;
-    top: 650rpx;
+    //top: 650rpx;
     box-sizing: border-box;
-    padding: 0 68rpx;
-    padding-top: 100rpx;
+    padding: 40rpx;
+
+    img {
+      max-width: 95%;
+    }
   }
 }
 </style>

+ 2 - 0
src/pages.json

@@ -169,6 +169,8 @@
         {
           "path": "activity/activity",
           "style": {
+            "navigationStyle": "default",
+            "navigationBarTitleText": "活动明细"
           }
         }
       ]

+ 2 - 0
src/utils/navigate.ts

@@ -1,8 +1,10 @@
 export function to(path: string) {
+  console.log(path)
   if (nextPageIsPrevPage(path)) {
     uni.navigateBack();
     return;
   }
+
   uni.navigateTo({
     url: path,
   });