邹能昇 3 сар өмнө
parent
commit
0b2204e874

+ 18 - 1
nova-werun/pages/home/share/index.js

@@ -17,6 +17,15 @@ Page({
         contentpadding: 0, //顶部padding高度
 
         sharList: [],
+
+        images: [
+            'https://tse2-mm.cn.bing.net/th/id/OIP-C.kACuwmhGcHKV4G4Og9AFqgHaLG?rs=1&pid=ImgDetMain',
+            'https://tse1-mm.cn.bing.net/th/id/OIP-C.LYrbU3wnasLo4nvoAqs_HQHaLH?rs=1&pid=ImgDetMain',
+            'https://tse3-mm.cn.bing.net/th/id/OIP-C.KKzj-pCKvzmWJ9MU5pE5KwHaKq?rs=1&pid=ImgDetMain',
+            'https://ts1.cn.mm.bing.net/th/id/R-C.d8333a26a5494dfe1dc88e9fdd04fb31?rik=08fpnYZSbboHfQ&riu=http%3a%2f%2fpic.ibaotu.com%2fspiders%2f33817-59a6262d3ff70.jpg&ehk=fKs2FTTgk2k0kqet%2fVO%2bAS3D0Q6zlNyUPmT8UE%2bvpdY%3d&risl=&pid=ImgRaw&r=0',
+            'https://pic.nximg.cn/file/20230420/12106414_122949747127_2.jpg'
+        ],
+        randomImage:''
     },
 
     /**
@@ -42,6 +51,7 @@ Page({
             contentHeight
         });
         this.order()
+        this.showRandomImage()
     },
 
     /**
@@ -124,7 +134,7 @@ Page({
             itemData.currentTime = formattedTime; // 将当前时间添加到 item 中
             return itemData;
         });
-        let sharList=[]
+        let sharList = []
         todayList.forEach((item, index) => {
             if (item.user.objectId == currentUser.id) {
                 sharList.push({
@@ -139,4 +149,11 @@ Page({
         });
         console.log(this.data.sharList);
     },
+    //随机展示图片
+    showRandomImage: function () {
+        const randomIndex = Math.floor(Math.random() * this.data.images.length);
+        this.setData({
+            randomImage: this.data.images[randomIndex]
+        });
+    },
 })

+ 1 - 1
nova-werun/pages/home/share/index.wxml

@@ -2,7 +2,7 @@
 <nav type="back" title="转发分享" background-color="{{'#73AEF9'}}" front-color="{{'#ffffff'}}"></nav>
 <view class="all" style="height: {{contentHeight}}rpx;">
     <view class="box">
-        <image class="picture" src="https://file-cloud.fmode.cn//tmp/sBX4tFxdGjkk1fea2c9db35cbd67b50b01dd3bae1592.png?imageView2/1/w/200/h/200"></image>
+        <image class="picture" src="{{randomImage}}" mode="aspectFit"></image>
         <view class="namebox">
             <image src="{{sharList[0].user.avatar}}"></image>
             <view class="textbox">