bobo 3 lat temu
rodzic
commit
ea37745140

+ 2 - 2
api/luck-draw.js

@@ -46,12 +46,12 @@ class LuckDraw extends request {
     /**
      * 分享回调
      */
-    static shareActivity(activityId, mobile) {
+    static shareActivity(activityId, mobile, catchErrorFunc) {
         const params = {
             activityId,
             mobile
         }
-        return this.postRequest(`${this.BASE_URL}open/luck-draw/share-activity`, params, true)
+        return this.postRequest(`${this.BASE_URL}open/luck-draw/share-activity`, params, true, catchErrorFunc)
     }
 
     static getTimes(activityId, mobile) {

+ 1 - 1
pages/luckDraw/detail.js

@@ -457,7 +457,7 @@ Page({
      * 用户点击右上角分享
      */
     onShareAppMessage: function (res) {
-        LuckDraw.shareActivity(this.data.activityId, getMobileCache()).then(res => {
+        LuckDraw.shareActivity(this.data.activityId, getMobileCache(), res.from != 'button').then(res => {
             if (res.code == 200) {
                 this.getDrawTimes()
             }

+ 8 - 1
pages/luckDraw/detail.wxss

@@ -1,4 +1,7 @@
 /* pages/luckDraw/detail.wxss */
+.page {
+    padding-bottom: 100rpx;
+}
 .head-bg {
     width: 750rpx;
     height: 576rpx;
@@ -257,9 +260,13 @@
 }
 
 .hit-record-list {
-    width: 600rpx;
+    width: 750rpx;
+    padding: 0 75rpx;
     margin: auto;
     min-height: 300rpx;
+    height: 780rpx;
+    overflow-y: auto;
+    box-sizing: border-box;
 }
 .hit-record-list ._item {
     display: flex;

+ 1 - 0
pages/welfareMall/activityList/activityList.wxss

@@ -42,6 +42,7 @@ Page {
   margin-top: 24rpx;
   background-color: #FFFFFF;
   border-radius: 10rpx;
+  margin: 24rpx auto 0;
 }
 
 .coupon_item_img{

+ 5 - 1
pages/welfareMall/index/index.js

@@ -74,7 +74,11 @@ Page({
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {
-
+    return {
+        title: "沪上阿姨福利GO",
+        path: "/pages/welfareMall/index",
+        imageUrl: this.bannerList[0]?.figure
+    }
   },
   swiperChange: function(e) {
     // console.log(e.detail.source)

+ 20 - 14
utils/request.js

@@ -1,4 +1,4 @@
-import util from './util.js'
+import util, { isFunc } from './util.js'
 class request {
 
     //本地的
@@ -37,9 +37,9 @@ class request {
   /**
    * POST类型的网络请求
    */
-  static postRequest(url, data, notUseLoading) {
+  static postRequest(url, data, notUseLoading, catchErrorFunc) {
       let  headerSign = this.getSignHead();
-      return this.requestAll(url, data, headerSign, 'POST', notUseLoading)
+      return this.requestAll(url, data, headerSign, 'POST', notUseLoading, catchErrorFunc)
   }
 
   static upload(url, name, path, ortherData, header = this.HEAD){
@@ -98,7 +98,7 @@ class request {
   /**
    * 网络请求
    */
-  static requestAll(url, data, header, method, notUseLoading) {
+  static requestAll(url, data, header, method, notUseLoading, catchErrorFunc) {
       if (!notUseLoading) {
         getApp().showLoading()
       }
@@ -113,16 +113,22 @@ class request {
                       //200: 服务端业务处理正常结束
                       resolve(res?.data)
                   } else {
-                    wx.showToast({
-                        title: res?.data?.msg,
-                        icon: "none"
-                    })
-                      //其它错误,提示用户错误信息
-                      if (this._errorHandler != null) {
-                          //如果有统一的异常处理,就先调用统一异常处理函数对异常进行处理
-                          this._errorHandler(res)
-                      }
-                      reject(res)
+                    if (catchErrorFunc) {
+                        if (isFunc(catchErrorFunc)) {
+                            catchErrorFunc(res?.data)
+                        }
+                    } else {
+                        wx.showToast({
+                            title: res?.data?.msg,
+                            icon: "none"
+                        })
+                    }
+                    //其它错误,提示用户错误信息
+                    if (this._errorHandler != null) {
+                        //如果有统一的异常处理,就先调用统一异常处理函数对异常进行处理
+                        this._errorHandler(res)
+                    }
+                    reject(res)
                   }
               }),
               fail: (res => {

+ 6 - 1
utils/util.js

@@ -154,6 +154,10 @@ function isEmpty(v, eZ) {
   return v === null
 }
 
+function isFunc(v) {
+  return typeof v == "function"
+}
+
 module.exports = {
   formatTime,
   sha1,
@@ -162,6 +166,7 @@ module.exports = {
   add0,
   getQueryVariable,
   parseTime,
-  isEmpty
+  isEmpty,
+  isFunc
 }