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 | 122 ++++++++++++++++++++++++++++++++++++----
1 files changed, 109 insertions(+), 13 deletions(-)
diff --git a/miniprogram/pages/user/pubulicty/index.ts b/miniprogram/pages/user/pubulicty/index.ts
index 2b71296..ff80cec 100644
--- a/miniprogram/pages/user/pubulicty/index.ts
+++ b/miniprogram/pages/user/pubulicty/index.ts
@@ -3,23 +3,119 @@
const userCause = getApp()
Page({
- data: {
- causeList:[],
- isShow:false
- },
- // 浜嬩欢澶勭悊鍑芥暟
- onLoad() {
- wx.request(
+ data: {
+ autoplay:true,
+ cardFig:true,
+ swcurrent: 0,
+ causeList: [],
+ isShow: false
+ },
+ register(e){
+ console.log(e);
+
+ },
+ detalnew(e){
+ console.log(e)
+ wx.navigateTo({
+ url: '/pages/user/pubulicty/detail/index?id='+e.currentTarget.dataset.id,
+ })
+ },
+ getMobile(){
+ // 鑾峰彇鎵嬫満鍙�
+ wx.request(
{
- url:userCause.globalData.url+"/publicity",
+ url:userCause.globalData.url+ "/wx/user/myself",
method:"GET",
+ data:{
+ id:wx.getStorageSync('id')
+ },
header:{'token':wx.getStorageSync('token')},
success:(res)=>{
- this.setData({
- causeList:res.data.data.records
- })
- console.log(this.data.causeList)
+ console.log(res)
+ if (res.data.data.userMobile) {
+ this.getUserRegister(res.data.data.userMobile)
+ }
}
})
- }
+
+ },
+ // 閫氳繃鎵嬫満鍙锋煡璇㈡槸鍚︽槸宸叉敞鍐岀敤鎴�
+ getUserRegister(phone){
+ wx.request(
+ {
+ url:userCause.globalData.url+ "/wx/isExist",
+ method:"GET",
+ data:{
+ phone:phone
+ },
+ header:{'token':wx.getStorageSync('token')},
+ success:(res)=>{
+ console.log(res)
+
+ }
+ })
+ },
+ // 浜嬩欢澶勭悊鍑芥暟
+ onLoad() {
+ 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
+ // })
+ // }
+ wx.request(
+ {
+ url: userCause.globalData.url + "/wx/publicity",
+ method: "GET",
+ // 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