odc.xiaohui
2023-05-12 4b48bacef8646cee8b66f5e10b0ed7124534e93e
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,6 +57,11 @@
    },
    // 事件处理函数
    onLoad() {
        if (wx.getStorageSync('token')) {
            this.setData({
                cardFig:false
            })
        }
        // this.getMobile()
        // let  info=wx.getStorageSync('card')
        // console.log(info);
@@ -70,15 +82,40 @@
                // 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
        })
    },
})