瀏覽代碼

推广素材

zhaoxiaohai 3 年之前
父節點
當前提交
4a6376547e

+ 5 - 4
pages/promotional/details.js

@@ -10,12 +10,16 @@ Page({
      */
     data: {
         detailsData: {},
+        dataType: 0
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
+        this.setData({
+            dataType: options.type
+        })
         _Http.basic({
             "classname": "saletool.sharematerial.sharematerial",
             "method": "selectDetail",
@@ -29,7 +33,6 @@ Page({
                 icon: "none"
             })
             let data = res.data;
-            // if (data.content.length) data.content = unescape(data.content);
             if (data.content.length) data.content = weAtob(data.content);
             if (data.attinfos.length) data.attinfos = MFT.fileList(data.attinfos);
             this.setData({
@@ -44,9 +47,7 @@ Page({
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady() {
-
-    },
+    onReady() {},
 
     /**
      * 生命周期函数--监听页面显示

+ 1 - 2
pages/promotional/details.json

@@ -1,7 +1,6 @@
 {
     "navigationBarTitleText": "素材详情",
     "usingComponents": {
-        "mp-html": "/components/mp-html/index",
-        "van-sticky": "@vant/weapp/sticky/index"
+        "mp-html": "/components/mp-html/index"
     }
 }

+ 4 - 1
pages/promotional/details.scss

@@ -1,9 +1,13 @@
 /* 头部 */
 .header {
+    position: sticky;
     width: 750rpx;
     padding: 30rpx;
     background-color: #ffffff;
     box-sizing: border-box;
+    top: 0;
+    left: 0;
+    z-index: 9999;
 
     .title {
         font-size: 30rpx;
@@ -38,7 +42,6 @@
     font-size: 28rpx;
     font-family: PingFang SC-Regular, PingFang SC;
     color: #666666;
-    margin-top: 20rpx;
     width: 750rpx;
     padding: 30rpx;
     box-sizing: border-box;

+ 23 - 23
pages/promotional/details.wxml

@@ -1,32 +1,32 @@
-<van-sticky>
-    <view class="header">
-        <view class="title multi-line">{{detailsData.title}}</view>
-        <view class="display-data">
-            <view>{{detailsData.changedate}}</view>
-            <view>
-                <text>浏览:{{detailsData.readcount}}</text>
-                <text>分享:{{detailsData.sharecount}}</text>
-                <text>拉新:{{detailsData.newcount}}</text>
-            </view>
+<view class="header">
+    <view class="title multi-line">{{detailsData.title}}</view>
+    <view class="display-data">
+        <view>{{detailsData.changedate}}</view>
+        <view>
+            <text>浏览:{{detailsData.readcount}}</text>
+            <text>分享:{{detailsData.sharecount}}</text>
+            <text>拉新:{{detailsData.newcount}}</text>
         </view>
     </view>
-</van-sticky>
-<view />
-
-<view class="explain" wx:if="{{detailsData.content}}">
-    <mp-html content="{{detailsData.content}}" />
 </view>
-
-<view class="explain" wx:if="{{detailsData.attinfos[0]}}">
-    <view class="title" style="margin-bottom: 20rpx;">附件</view>
-    <view wx:for="{{detailsData.attinfos}}">
-        <van-image wx:if="{{item.fileType=='image'}}" width="690rpx" height="360rpx" data-item="{{item}}" bindtap="openFile" radius='16rpx' src="{{item.url}}" lazy-load />
-        <video class="video" wx:elif="{{item.fileType=='video'}}" src="{{item.url}}" />
+<view style="height: 20rpx;" />
+<!-- 图文 -->
+<block wx:if="{{dataType==3}}">
+    <view class="explain" wx:if="{{detailsData.content}}">
+        <mp-html content="{{detailsData.content}}" />
+    </view>
+</block>
+<!-- 媒体 -->
+<block wx:else>
+    <view style="width: 690rpx; margin: 0 auto;" wx:for="{{detailsData.attinfos}}">
+        <van-image wx:if="{{item.fileType=='image'}}" width="690rpx" fit='widthFix' data-item="{{item}}" bindtap="openFile" radius='16rpx' src="{{item.url}}" lazy-load />
+        <video class="video" wx:elif="{{item.fileType=='video'}}" style="width: 690rpx; margin: 0 auto; border-radius: 16rpx;" src="{{item.url}}" />
         <view style="height:20rpx;" />
     </view>
-</view>
+</block>
+
+<view style="height: 60px;" />
 
-<view style="height: 50px;" />
 <view class="footer">
     <van-button custom-class='footer-button' color="var(--warning)">分享</van-button>
 </view>

+ 2 - 1
pages/promotional/modules/productList.js

@@ -32,8 +32,9 @@ Component({
             const {
                 item
             } = e.currentTarget.dataset;
+            //type 1图片 2视频 3图文
             wx.navigateTo({
-                url: `/pages/promotional/details?id=${item.sat_sharematerialid}`,
+                url: `/pages/promotional/details?id=${item.sat_sharematerialid}&type=${item.type}`,
             })
 
         }

+ 9 - 6
pages/promotional/upload.js

@@ -2,7 +2,6 @@ const _Http = getApp().globalData.http,
     MFT = require("../../utils/matchingFeilType"),
     CF = require("../../utils/checkFile");
 import {
-    weAtob,
     weBtoa
 } from "../../utils/weapp-jwt";
 Page({
@@ -62,7 +61,7 @@ Page({
                 detailsData: res.data,
                 "content.sat_sharematerialid": res.data.sat_sharematerialid
             })
-        })
+        });
     },
     submit() {
         let content = this.data.content;
@@ -70,10 +69,14 @@ Page({
             title: '请检查素材标题或所属分类',
             icon: "none"
         });
-        if (this.data.uploadType == 'image' || this.data.uploadType == 'video' && this.data.detailsData.attinfos.length == 0) return wx.showToast({
-            title: '您还未上传素材附件',
-            icon: "none"
-        });
+        console.log(this.data.detailsData.attinfos)
+        if (this.data.uploadType == 'image' || this.data.uploadType == 'video') {
+            if (this.data.detailsData.attinfos.length == 0) return wx.showToast({
+                title: '您还未上传素材附件',
+                icon: "none"
+            });
+        };
+        console.log(231423423423423)
         if (this.data.uploadType == 'richtext' && this.data.content.content.length < 8) return wx.showToast({
             title: '您还未编辑或保存图文内容',
             icon: "none"