From 4b48bacef8646cee8b66f5e10b0ed7124534e93e Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 12 五月 2023 17:10:47 +0800
Subject: [PATCH] 首页修改

---
 miniprogram/pages/user/pubulicty/index.ts |   66 +++++++++++++++++++++++++-------
 1 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/miniprogram/pages/user/pubulicty/index.ts b/miniprogram/pages/user/pubulicty/index.ts
index 36c2870..ff80cec 100644
--- a/miniprogram/pages/user/pubulicty/index.ts
+++ b/miniprogram/pages/user/pubulicty/index.ts
@@ -4,6 +4,7 @@
 
 Page({
     data: {
+        autoplay:true,
         cardFig:true,
         swcurrent: 0,
         causeList: [],
@@ -12,6 +13,12 @@
     register(e){
         console.log(e);
         
+    },
+    detalnew(e){
+        console.log(e)
+        wx.navigateTo({
+            url: '/pages/user/pubulicty/detail/index?id='+e.currentTarget.dataset.id,
+        })
     },
     getMobile(){
      // 鑾峰彇鎵嬫満鍙�
@@ -50,36 +57,65 @@
     },
     // 浜嬩欢澶勭悊鍑芥暟
     onLoad() {
-        this.getMobile()
-        let  info=wx.getStorageSync('card')
-        console.log(info);
+        if (wx.getStorageSync('token')) {
+            this.setData({
+                cardFig:false
+            })
+        }
+        // this.getMobile()
+        // let  info=wx.getStorageSync('card')
+        // console.log(info);
         
-                            if (info) {
-                              this.setData({
-                                  cardFig :false
-                              })
-                            }else{
-                                this.setData({
-                                    cardFig :true
-                                })
-                            }
+        //                     if (info) {
+        //                       this.setData({
+        //                           cardFig :false
+        //                       })
+        //                     }else{
+        //                         this.setData({
+        //                             cardFig :true
+        //                         })
+        //                     }
         wx.request(
             {
                 url: userCause.globalData.url + "/wx/publicity",
                 method: "GET",
-                header: { 'token': wx.getStorageSync('token') },
+                // header: { 'token': wx.getStorageSync('token') },
                 success: (res) => {
-
                     res.data.data.map(i => {
+                        let imgarr=[]
                         if (i.photoStr != null) {
                             i.photoStr = i.photoStr.split(",").map(i => userCause.globalData.imageUrl + "/img/" + i),
                                 this.data.images = i.photoStr
+                                i.photoStr.map(j=>{
+                                    let type=j.substring(j.lastIndexOf(".")+1)
+
+                                   
+                                    let obj={
+                                        url: j,
+                                        type:'png'
+                                     }
+                                     if (type=='mp4') {
+                                        obj.type = 'mp4'
+                                    }else{
+                                        obj.type = 'png'
+                                    }
+                                    imgarr.push(obj)
+                                })
+                                i.imagarr=imgarr
                         }
+                        i.releaseTime = i.releaseTime.replace(/-/g,"/")
                     })
                     this.setData({
                         causeList: res.data.data
                     })
                 }
             })
-    }
+    },
+    videoplay(e){
+        console.log(e);
+        
+        this.setData({
+            autoplay:false
+        })
+    },
 })

--
Gitblit v1.8.0