zhaoxiaohai 3 роки тому
батько
коміт
57200e2f76

+ 10 - 2
pages/promotional/index.js

@@ -6,6 +6,7 @@ Page({
      * 页面的初始数据
      */
     data: {
+        tabsActiveIndex: 0,
         scrollHeight: 0, //滚动区域高度
         searchContent: "", //搜索内容
         mainActiveIndex: 0, //分类选择器打开分类的下标
@@ -31,7 +32,14 @@ Page({
         this.selectMenu();
         this.getList();
     },
-
+    tabChange({
+        detail
+    }) {
+        this.setData({
+            tabsActiveIndex: detail.index
+        });
+        this.getList(true);
+    },
     /* 查询列表 */
     getList(init = false) {
         if (init.detail != undefined) init = init.detail;
@@ -44,7 +52,7 @@ Page({
         if (this.data.sort[0]) content.sort = this.data.sort;
         _Http.basic({
             "classname": "saletool.sharematerial.sharematerial",
-            "method": "selectList",
+            "method": this.data.tabsActiveIndex == 0 ? "selectList" : "selectMyList",
             content
         }).then(res => {
             console.log("列表", res)

+ 2 - 2
pages/promotional/index.wxml

@@ -9,10 +9,10 @@
 </van-search>
 
 <!-- tabs -->
-<van-tabs sticky color='var(--assist)' title-active-color='var(--assist)' title-inactive-color='#999' z-index='9'>
+<van-tabs sticky color='var(--assist)' title-active-color='var(--assist)' bind:change='tabChange' title-inactive-color='#999' z-index='9'>
     <van-tab title="列表" />
     <van-tab title="我的素材" />
-    <van-tab title="拉新清单" />
+    <!-- <van-tab title="拉新清单" /> -->
 </van-tabs>
 
 <!-- 下拉菜单 -->

+ 1 - 1
pages/promotional/modules/productList.wxml

@@ -2,7 +2,7 @@
 <My_card custom-class='product-list'>
     <view class="item" wx:for="{{list}}">
         <navigator url="#" data-item="{{item}}" bindtap="toDetail">
-            <van-image width="336rpx" height="247rpx" fit='cover' src="{{item.cover}}" lazy-load />
+            <van-image width="336rpx" height="240rpx" fit='cover' src="{{item.cover}}" lazy-load />
             <view class="details">
                 <view class="title line-1">
                     {{item.title}}

+ 45 - 3
pages/promotional/upload.js

@@ -1,18 +1,52 @@
-// pages/promotional/upload.js
+const _Http = getApp().globalData.http;
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        "content": {
+            "title": "",
+            "sat_sharematerial_classid": 9999,
+            "notes": "",
+            "tag": [],
+            "canfiledownload": 1,
+            "content": "",
+            "sat_sharematerialid": 0
+        },
+        detailsData: {}
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
+        _Http.basic({
+            "classname": "webmanage.saletool.sharematerial.sharematerial",
+            "method": "insertOrUpdate",
+            content: this.data.content
+        }).then(res => {
+            console.log("新增", res)
+            this.setData({
+                detailsData: res.data[0]
+            })
+        })
+    },
 
+    titleInput({
+        detail
+    }) {
+        this.setData({
+            "content.title": detail.value.trim()
+        })
+    },
+
+    notesInput({
+        detail
+    }) {
+        this.setData({
+            "content.notes": detail.value.trim()
+        })
     },
 
     /**
@@ -40,7 +74,15 @@ Page({
      * 生命周期函数--监听页面卸载
      */
     onUnload() {
-
+        if (this.data.detailsData.status == '新建') _Http.basic({
+            "classname": "webmanage.saletool.sharematerial.sharematerial",
+            "method": "delete",
+            "content": {
+                "sat_sharematerialid": this.data.detailsData.sat_sharematerialid
+            }
+        }).then(res => {
+            console.log("删除", res)
+        })
     },
 
     /**

+ 3 - 1
pages/promotional/upload.json

@@ -1,4 +1,6 @@
 {
     "navigationBarTitleText": "发布素材",
-    "usingComponents": {}
+    "usingComponents": {
+        "My_upload": "/components/My_upload/index"
+    }
 }

+ 29 - 11
pages/promotional/upload.scss

@@ -20,29 +20,31 @@
         }
     }
 
-    .textarea {
-        height: 160rpx;
-        padding: 20rpx;
-    }
-
     .category {
-        display: flex;
-        align-items: center;
-        justify-content: space-between;
-        height: 90rpx;
-        padding: 0 20rpx;
-        font-family: PingFang SC-Regular, PingFang SC;
         color: #666666;
     }
+
+    .input {
+        display: inline-block;
+        width: 100% !important;
+        font-size: 28rpx;
+        color: #BBBBBB;
+    }
 }
 
 .base {
+    font-family: PingFang SC-Regular, PingFang SC;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
     width: 100%;
     border-radius: 16rpx;
     overflow: hidden;
     background-color: #ffffff;
     box-sizing: border-box;
     margin-top: 20rpx;
+    height: 90rpx;
+    padding: 0 20rpx;
 }
 
 .upload {
@@ -51,4 +53,20 @@
     background: #3874F6 !important;
     border-radius: 45rpx !important;
     margin-top: 100rpx;
+}
+
+/* 素材列表 */
+.file-list {
+    display: flex;
+    justify-content: space-between;
+    width: 690rpx;
+    margin: 20rpx auto 0;
+
+    .file-box {
+        width: 336rpx;
+        height: 170rpx;
+        border-radius: 8rpx;
+        background-color: red;
+        overflow: hidden;
+    }
 }

+ 19 - 2
pages/promotional/upload.wxml

@@ -1,12 +1,29 @@
 <My_card custom-class='box'>
     <view class="label">素材标题</view>
-    <textarea class="textarea base" placeholder-style='font-size: 24rpx;' placeholder='请输入标题'></textarea>
-    <view class="label">所属分类</view>
+    <input class="input base" bindinput='titleInput' value="{{content.title}}" placeholder-style='font-size: 28rpx;' placeholder='请输入标题' />
+
+    <view class="label">素材备注</view>
+    <input class="input base" bindinput='notesInput' value="{{content.notes}}" placeholder-style='font-size: 28rpx;' placeholder='请输入备注' />
+
+    <view class="label">素材内容</view>
+    <view class="input base" style="display: flex; justify-content: space-between; color: #999;">
+        请输入内容 <text style="color: #3874F6;">编辑/预览</text>
+    </view>
+    
+    <view class="label">素材分类</view>
     <navigator class="category base" url="#">
         <view>请选择素材分类</view>
         <van-icon name="arrow-down" />
     </navigator>
+
     <view class="label">素材<text>已上传2个</text></view>
+    <view class="file-list">
+        <view class="file-box"></view>
+        <My_upload accept='media'>
+            <view class="file-box"></view>
+        </My_upload>
+    </view>
+
 </My_card>
 
 <view style="width: 100%; text-align: center;">