Răsfoiți Sursa

```
feat(index): 添加弹窗公告功能

- 集成vant overlay组件用于显示弹窗覆盖层
- 新增showPopup和imageUrl数据属性控制弹窗显示
- 实现getDialog方法获取弹窗配置信息
- 实现onClickHide方法隐藏弹窗功能
- 在页面onShow生命周期中调用弹窗获取方法
- 添加弹窗样式和图片展示功能

fix(http): 修复登录请求方法大小写问题

- 将method参数从"get"改为"GET"以符合HTTP规范

chore(config): 注释掉测试环境域名配置

- 临时注释cpolar测试域名避免环境混淆
```

wenjie 1 lună în urmă
părinte
comite
499279e572
6 a modificat fișierele cu 46 adăugiri și 4 ștergeri
  1. 2 1
      app.json
  2. 24 1
      pages/index/index.js
  3. 6 0
      pages/index/index.wxml
  4. 12 0
      pages/index/index.wxss
  5. 1 1
      utils/config.js
  6. 1 1
      utils/http.js

+ 2 - 1
app.json

@@ -150,6 +150,7 @@
     "navbar": "/components/topNavtar/topNavtar",
     "tabbar": "/components/tabbar/tabbar",
     "van-loading": "@vant/weapp/loading/index",
-    "van-action-sheet": "@vant/weapp/action-sheet/index"
+    "van-action-sheet": "@vant/weapp/action-sheet/index",
+    "van-overlay": "@vant/weapp/overlay/index"
   }
 }

+ 24 - 1
pages/index/index.js

@@ -9,6 +9,8 @@ import eventBus from '../../utils/eventBus';
 
 Page({
   data: {
+    showPopup:false,
+    imageUrl:'',
     isHand:false,
     shopList:[],
     showShopList:false,
@@ -278,6 +280,27 @@ Page({
       }
     });
   },
+  /**
+   * 弹窗公告
+   */
+  getDialog: function () {
+    var params = {
+      url: "/popup/config",
+      method: "GET",
+      data: {
+      },
+      callBack: (res) => {
+       this.setData({
+        showPopup:res.showPopup,
+        imageUrl:res.imageUrl
+       })
+      }
+    };
+    http.request(params);
+  },
+  onClickHide:function(){
+    this.setData({showPopup:false})
+  },
   /**
    * 广告位
    */
@@ -735,7 +758,7 @@ Page({
   },
 
   onShow: function () {
-    
+    this.getDialog()
     // this.get_test()
     this.setData({
       select_address: wx.getStorageSync('ADDRESS')

+ 6 - 0
pages/index/index.wxml

@@ -287,6 +287,12 @@
     </view>
   </view>
 
+      <van-overlay show="{{ showPopup }}" bind:click="onClickHide">
+        <view class="wrapper">
+          <image class="img" src="{{imageUrl}}" mode=""></image>
+        </view>
+      </van-overlay>
+
     <tabbar active="0" isScroll="{{isScroll}}"></tabbar>
 
   </view>

+ 12 - 0
pages/index/index.wxss

@@ -1048,4 +1048,16 @@ swiper.pic-swiper .banner {
   font-size: 24rpx;
   color: #FFFFFF;
   margin-left: 20rpx;
+}
+
+.wrapper {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: 100%;
+}
+
+.wrapper .img{
+  width: 750rpx;
+  height: 784rpx;
 }

+ 1 - 1
utils/config.js

@@ -5,7 +5,7 @@
 var domain = "https://shop.api.zswlgz.com"; //统一接口域名,正式环境 
 var wsDomain = "wss://shop-h5.dev.zswllife.cn/api"; //统一接口域名,正式环境 
 // var domain = "http://47.109.84.152:8112"; //统一接口域名,测试环境 
-var domain = "https://3af85f91.r36.cpolar.top"; //统一接口域名,正式环境 
+// var domain = "https://3af85f91.r36.cpolar.top"; //统一接口域名,正式环境 
 // var wsDomain = "wss://shop.haimamart.com/api"; //统一接口域名,正式环境 
 
 // var domain = "http://192.168.1.206:8112"; //统一接口域名,测试环境

+ 1 - 1
utils/http.js

@@ -151,7 +151,7 @@ var getToken = function (fn) {
       request({
         login: true,
         url: '/p/user/miniAppLogin',
-        method:"get",
+        method:"GET",
         data: {
           code: res.code,
           appType: 1