zhaoxiaohai vor 3 Jahren
Ursprung
Commit
25f8d0cc58

+ 5 - 2
app.json

@@ -49,7 +49,8 @@
         "pages/teamManagement/applyFor",
         "pages/instantMessaging/index",
         "pages/annunciate/index",
-        "pages/annunciate/newAndChange"
+        "pages/annunciate/newAndChange",
+        "pages/annunciate/details"
     ],
     "usingComponents": {
         "van-button": "@vant/weapp/button/index",
@@ -75,7 +76,9 @@
         "My_DisplayItem": "/components/My_DisplayItem/index",
         "My_fixedButton": "/components/My_fixedButton/index",
         "van-popup": "@vant/weapp/popup/index",
-        "My_MultipleChoice": "/components/My_MultipleChoice/index"
+        "My_MultipleChoice": "/components/My_MultipleChoice/index",
+        "My_SupplyAndDemandItemBox": "/components/My_SupplyAndDemandItemBox/index",
+        "My_CenterTheTitle": "/components/My_CenterTheTitle/index"
     },
     "window": {
         "backgroundTextStyle": "light",

+ 1 - 1
components/My_DisplayItem/index.wxss

@@ -12,7 +12,7 @@
     height: 162rpx;
     border-radius: 15rpx;
     overflow: hidden;
-    margin-right: 30rpx;
+    margin-right: 20rpx;
 }
 
 /* 图片 */

+ 1 - 2
components/My_MultipleChoice/index.js

@@ -38,7 +38,7 @@ Component({
                     }, {
                         ftype: "团队公告"
                     }]
-                }
+                };
                 return this.returnClassify(res)
             };
             //默认供需分类
@@ -96,7 +96,6 @@ Component({
         },
         /* 返回分类 */
         returnClassify(res) {
-            console.log(res)
             if (res.msg != "成功") return wx.showToast({
                 title: '数据加载失败,请重新进入页面',
                 icon: "none",

+ 6 - 3
components/My_UploadFiles/index.js

@@ -39,7 +39,6 @@ Component({
             type: Number,
             value: 2 // 1 是登录样式  2 是产品上传图片样式
         },
-
         /* 文本行高 */
         lineHeight: {
             type: String,
@@ -347,7 +346,7 @@ Component({
                         }]
                     }
                 }).then(res => {
-                    console.log(res)
+                    console.log("修改附件", res)
                 })
             }
         },
@@ -365,7 +364,11 @@ Component({
                     "tattachmentid": type.tattachmentid
                 }
             }).then(s => {
-                if (s.msg != '成功') return;
+                console.log(s)
+                if (s.msg != '成功') return wx.showToast({
+                    title: "删除失败,请稍后再试!",
+                    icon: "none"
+                })
                 let fileList = that.data.fileList;
                 fileList.splice(index, 1);
                 that.triggerEvent("imageChange", {

+ 113 - 0
pages/annunciate/details.js

@@ -0,0 +1,113 @@
+import {
+    ApiModel
+} from "../../utils/api";
+const _Http = new ApiModel();
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        pageType: {}, //类型 0 为广场进入 1为发布历史进入
+        tnoticeid: {}, //公告id
+        msgObj: {}, //详情
+        coverFiles: [], //封面
+        defaultFiles: [], //附件
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        //默认通告广场
+        let data = {
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.notice.notice",
+            "method": "query_noticeMain",
+            "content": {
+                "tnoticeid": options.id
+            }
+        };
+        //历史发布
+        if (options.type == 1) {
+            data.classname = "customer.noticemag.noticemag";
+        };
+        //开始阅读
+        _Http.basic(data).then(res => {
+            console.log(res)
+            let attinfos = res.data[0].attinfos,
+                coverFiles = [],
+                defaultFiles = [];
+            for (let i = 0; i < attinfos.length; i++) {
+                (attinfos[i].ftype == "default") ? defaultFiles.push(attinfos[i]): coverFiles.push(attinfos[i])
+            }
+            this.setData({
+                tnoticeid: options.id,
+                msgObj: res.data[0],
+                coverFiles,
+                defaultFiles,
+                pageType: options.type
+            })
+        })
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+        if (this.data.pageType == 0) {
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('userData').token,
+                "classname": "customer.notice.notice",
+                "method": "noticeexit",
+                "content": {
+                    "tnoticeid": this.data.tnoticeid
+                }
+            }).then(res => {
+                console.log(res)
+            })
+        }
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 3 - 0
pages/annunciate/details.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 26 - 0
pages/annunciate/details.wxml

@@ -0,0 +1,26 @@
+<view class="box">
+    <!-- 供需标题和用户信息 -->
+    <view class="title-and-usercenter">
+        <view class="title-and-userMessage">
+            <view class="header-title">{{msgObj.ftitle}}</view>
+            <view class="header-userMessage">
+                <view class="header-userMessage-img">
+                    <image wx:if="{{particulars.headportraiturl}}" src="{{particulars.headportraiturl}}" mode="aspectFit"></image>
+                    <image wx:else src="/static/tacitly-approve/MRuserImg.png" mode="aspectFit"></image>
+                </view>
+                <view class="header-userMessage-textMsg">{{particulars.createby}} {{particulars.checkdate}}</view>
+            </view>
+        </view>
+    </view>
+    <scroll-view scroll-y style="flex: 1; height: 1px;">
+        <!-- 产品详情 -->
+        <view class="header-box">
+            <view style="overflow-wrap: break-word;">{{particulars.fcontent}}</view>
+            <view class="detailed-description">
+                <image wx:for="{{particulars.attinfos}}" src="{{item.fobsurl}}" mode="widthFix" catchtap="previewImage"></image>
+            </view>
+        </view>
+        <!-- 更多推荐 -->
+        <My_CenterTheTitle title='附件下载'></My_CenterTheTitle>
+    </scroll-view>
+</view>

+ 1 - 0
pages/annunciate/details.wxss

@@ -0,0 +1 @@
+@import "/pages/tabbar-pages/supplyAndDemand/particulars.wxss"

+ 67 - 9
pages/annunciate/index.js

@@ -2,6 +2,7 @@ import {
     ApiModel
 } from "../../utils/api";
 const _Http = new ApiModel();
+let processingData = require('../../utils/processingData.js');
 Page({
 
     /**
@@ -11,6 +12,9 @@ Page({
         swiperBannerList: [], //轮播图
         tabsList: ['通告列表', '历史发布'], //tab列表
         tabsIndex: 0, //tab选中项
+        showType: "官方", //请求列表类型
+        pageNumber: 1, //获取页码
+        pageTotal: 1, //总页码
         /* 圆角按钮tabs列表 */
         roundedList: ["家纺城通告", "合作商通告", "团队通告"],
     },
@@ -28,7 +32,6 @@ Page({
         }).then(res => {
             console.log(res)
         }) */
-        this.getList();
 
         /* 获取轮播图 */
         const bannerList = wx.getStorageSync('bannerDataList').filter(value => value.flocation == 'home_head');
@@ -36,24 +39,60 @@ Page({
             swiperBannerList: bannerList[0].banner
         });
     },
+    /* 跳转详情 */
+    toDetails(e) {
+        const {
+            index
+        } = e.currentTarget.dataset;
+        wx.navigateTo({
+            url: './details?id=' + this.data.annunciateList[index].tnoticeid + '&type=' + this.data.tabsIndex,
+        })
+    },
     /* 获取列表 */
     getList() {
-        _Http.basic({
+        //历史发布
+        let data = {
             "accesstoken": wx.getStorageSync('userData').token,
-            "classname": "customer.noticemag.noticemag",
+            "classname": "customer.notice.notice",
             "method": "query_noticeList",
             "content": {
                 "getdatafromdbanyway": true,
-                "pageNumber": 1,
+                "pageNumber": this.data.pageNumber,
                 "pageSize": 20,
                 "where": {
-                    "condition": ""
+                    "condition": "",
+                    "ftype": this.data.showType
                 }
             }
-        }).then(res => {
+        };
+        if (this.data.tabsIndex == 1) {
+            data.classname = 'customer.noticemag.noticemag';
+            data.content.where.ftype = '';
+        };
+        _Http.basic(data).then(res => {
             console.log(res)
+            this.setData({
+                annunciateList: processingData.imageType(res.data, 'cover'),
+                pageTotal: res.pageTotal
+            })
         })
     },
+    /* 历史发布修改 */
+    toChang(e) {
+        const {
+            index
+        } = e.currentTarget.dataset;
+        wx.navigateTo({
+            url: './newAndChange?id=' + this.data.annunciateList[index].tnoticeid,
+        });
+    },
+    /* 查询数据 */
+    toQueryData(e) {
+        const {
+            index
+        } = e.currentTarget.dataset;
+        console.log(index)
+    },
     /* 发布公告 */
     toAnnounce() {
         wx.navigateTo({
@@ -66,13 +105,32 @@ Page({
     }) {
         this.setData({
             tabsIndex: detail
-        })
+        });
+        this.getList();
     },
     /* tabs回调 */
     tabsSelectedIitem({
         detail
     }) {
-        console.log(detail)
+        let showType = null;
+        switch (detail) {
+            case "家纺城通告":
+                showType = '官方'
+                break;
+            case "合作商通告":
+                showType = '商户'
+                break;
+            case "团队通告":
+                showType = '团队'
+                break;
+            default:
+                showType = ''
+                break;
+        }
+        this.setData({
+            showType
+        });
+        this.getList();
     },
 
     /**
@@ -86,7 +144,7 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
-
+        this.getList()
     },
 
     /**

+ 35 - 9
pages/annunciate/index.wxml

@@ -1,18 +1,44 @@
 <My_BannerSwiper swiperBannerList="{{swiperBannerList}}"></My_BannerSwiper>
 <My_NavTabs tabsList="{{tabsList}}" tabsIndex="{{tabsIndex}}" bindsetIndex="setIndex" />
-<view class="annunciatr_box">
+<!-- 通告广场 -->
+<view class="annunciatr_box" wx:if="{{tabsIndex==0}}">
     <!-- 圆角按钮tabs -->
     <My_RoundedCornerButtonTabs list="{{roundedList}}" bind:tabsSelectedIitem="tabsSelectedIitem"></My_RoundedCornerButtonTabs>
     <!-- 列表展示区 -->
-    <view slot="display-box-showList">
-        <My_DisplayItem wx:for="{{productList}}" content="{{item}}" padTop="{{index==0?'0':'20'}}" borTop="{{index==0?'0':'2'}}" anonymity="true">
-            <!-- <view class="display-box-showList-button-box" slot="button">
-                <van-button custom-class="display-box-showList-button" catchtap="contact" color="linear-gradient(180deg, #84E3EC 0%, #4DC2D4 100%)"></van-button>
-                <view class="display-box-showList-button-text">
-                    一键联系
+    <view class="ann-box" wx:for="{{annunciateList}}" data-index="{{index}}" catchtap="toDetails">
+        <view class="ann-img">
+            <image wx:if="{{item.attinfos[0].fobsurl}}" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+            <image src="/static/tacitly-approve/MRproduct.png" mode="aspectFill"></image>
+        </view>
+        <view class="ann-text">
+            <view class="ann-text-title  u-line-1">{{item.ftitle}}</view>
+            <view class="ann-text-center u-line-1">{{item.fsummary}}</view>
+            <view class="ann-text-bottom u-line-1">
+                <view>12-07 12:24</view>
+                <view></view>
+            </view>
+        </view>
+    </view>
+</view>
+<!-- 历史发布 -->
+<view class="annunciatr_box" wx:if="{{tabsIndex==1}}" style="padding-top: 2rpx; padding-bottom: 0;">
+    <!-- 列表展示区 -->
+    <view class="ann-box" wx:for="{{annunciateList}}" data-index="{{index}}" catchtap="toDetails">
+        <view class="ann-img">
+            <image wx:if="{{item.attinfos[0].fobsurl}}" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+            <image src="/static/tacitly-approve/MRproduct.png" mode="aspectFill"></image>
+        </view>
+        <view class="ann-text ls">
+            <view class="ann-text-title  u-line-1">{{item.ftitle}}</view>
+            <view class="ann-text-center u-line-1">{{item.fsummary}}</view>
+            <view class="ann-text-bottom u-line-1">
+                <view>12-07 12:24</view>
+                <view class="change">
+                    <van-button block custom-class='custom-class l' data-index="{{index}}" catchtap="toQueryData">浏览数据</van-button>
+                    <van-button block custom-class='custom-class r' data-index="{{index}}" catchtap="toChang">编辑通告</van-button>
                 </view>
-            </view> -->
-        </My_DisplayItem>
+            </view>
+        </view>
     </view>
 </view>
 <!-- 右侧吸附固定按钮 -->

+ 95 - 0
pages/annunciate/index.wxss

@@ -8,4 +8,99 @@
     padding: 24rpx;
     padding-top: 40rpx;
     box-sizing: border-box;
+}
+
+/* 盒子 */
+.ann-box {
+    display: flex;
+    width: 662rpx;
+    height: 162rpx;
+    padding-bottom: 30rpx;
+    border-bottom: 1px solid rgba(151, 151, 151, .1);
+    margin-top: 28rpx;
+}
+
+.ann-img {
+    width: 162rpx;
+    height: 162rpx;
+    border-radius: 10rpx;
+    overflow: hidden;
+    flex-shrink: 0;
+    margin-right: 20rpx;
+}
+
+.ann-img>image {
+    width: 100%;
+    height: 100%;
+}
+
+.ann-text {
+    flex: 1;
+    height: 100%;
+}
+
+.ann-text>view {
+    max-width: 480rpx;
+}
+
+.ann-text-title {
+    font-family: PingFangSC-Medium, PingFang SC;
+    height: 40rpx;
+    font-size: 28rpx;
+    font-weight: 550;
+    color: #000000;
+    line-height: 40rpx;
+}
+
+.ann-text-center {
+    height: 34rpx;
+    font-size: 24rpx;
+    color: #333333;
+    line-height: 34rpx;
+    opacity: .7;
+    margin-top: 16rpx;
+}
+
+.ann-text-bottom {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    height: 28rpx;
+    font-size: 20rpx;
+    color: #333333;
+    line-height: 28rpx;
+    opacity: .7;
+    margin-top: 44rpx;
+}
+
+/* 历史通告 */
+.ls .ann-text-bottom {
+    height: 40rpx;
+
+}
+
+.ls .change {
+    display: flex;
+    justify-content: space-between;
+    width: 240rpx;
+}
+
+.ls .custom-class {
+    width: 112rpx;
+    height: 40rpx;
+    border-radius: 22rpx;
+}
+
+.ls .l {
+    font-size: 20rpx;
+    color: #8B8B8B;
+    border: 2rpx solid #EFEFEF !important;
+}
+
+.ls .r {
+    font-size: 20rpx !important;
+    font-family: PingFangSC-Medium, PingFang SC !important;
+    font-weight: 550 !important;
+    color: #FFFFFF !important;
+    background: linear-gradient(136deg, #53CDE0 0%, #84E3EC 100%) !important;
 }

+ 74 - 4
pages/annunciate/newAndChange.js

@@ -17,17 +17,79 @@ Page({
         fcontent: "", //通告内容
         ftype: "", //通告类型
         popups: false,
+        coverFiles: [], //封面
+        defaultFiles: [], //附件
         errTips: {
             ftitle: false,
             fsummary: false,
-            fcontent: false
+            fcontent: false,
+            ftype: false
         }
     },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        //修改
+        if (options.id) {
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('userData').token,
+                "classname": "customer.noticemag.noticemag",
+                "method": "query_noticeMain",
+                "content": {
+                    "tnoticeid": options.id
+                }
+            }).then(res => {
+                console.log(res)
+                if (res.msg != '成功') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                });
+                let data = res.data[0],
+                    attinfos = res.data[0].attinfos,
+                    coverFiles = [],
+                    defaultFiles = [],
+                    ftype = (data.ftype == '商户') ? '商户公告' : '团队公告';
+                for (let i = 0; i < attinfos.length; i++) {
+                    let img = {
+                        name: attinfos[i].serialnumber,
+                        url: attinfos[i].fobsurl,
+                        ownerid: attinfos[i].ownerid,
+                        tattachmentid: attinfos[i].tattachmentid,
+                        ftype: attinfos[i].ftype,
+                        ownertable: attinfos[i].ownertable
+                    };
+                    (img.ftype == "default") ? defaultFiles.push(img): coverFiles.push(img)
+                }
+                this.setData({
+                    tnoticeid: data.tnoticeid,
+                    ftitle: data.ftitle,
+                    fsummary: data.fsummary,
+                    fcontent: data.fcontent,
+                    ftype: ftype,
+                    coverFiles,
+                    defaultFiles
+                })
+            })
+        }
+    },
+    /* 修改图片回调 */
+    imageChange(e) {
+        const {
+            fileList
+        } = e.detail;
+        this.setData({
+            coverFiles: fileList
+        })
+    },
+    /* 修改附加回调 */
+    filesChange(e) {
+        const {
+            fileList
+        } = e.detail;
+        this.setData({
+            defaultFiles: fileList
+        })
     },
     /* 提交代码 */
     submit() {
@@ -35,13 +97,14 @@ Page({
             title: '请检查表单内容',
             icon: "error"
         });
+        let ftype = (this.data.ftype == '团队公告') ? '团队' : '商户';
         _Http.basic({
             "accesstoken": wx.getStorageSync('userData').token,
             "classname": "customer.noticemag.noticemag",
             "method": "insertOrModify",
             "content": {
                 "tnoticeid": this.data.tnoticeid,
-                "ftype": this.data.ftype,
+                "ftype": ftype,
                 "ftitle": this.data.ftitle,
                 "fsummary": this.data.fsummary,
                 "fcontent": this.data.fcontent,
@@ -72,6 +135,7 @@ Page({
         let errTips = this.data.errTips,
             verify = true;
         /* 验证标题  */
+
         if (!_Verify.required(this.data.ftitle)) {
             errTips.ftitle = true;
             verify = false;
@@ -86,6 +150,11 @@ Page({
             errTips.fcontent = true;
             verify = false;
         }
+        /* 发布范围 */
+        if (!_Verify.required(this.data.ftype)) {
+            errTips.ftype = true;
+            verify = false;
+        }
         this.setData({
             errTips
         })
@@ -133,7 +202,8 @@ Page({
     }) {
         this.setData({
             ftype: detail,
-            popups: false
+            popups: false,
+            'errTips.ftype': false
         })
     },
     /* 打开类目选择 */

+ 8 - 6
pages/annunciate/newAndChange.wxml

@@ -11,21 +11,23 @@
                 编辑/预览
             </view>
         </My_GreyRectangleForm>
-        <My_GreyRectangleForm title="通告封面">
-            <My_UploadFiles id="UploadFiles" fileList="{{attinfos}}" upType="annunciate" UploadShow="2" previewSize="60px" maxCount="1" previewSize="65px" bindimageChange="imageChange"></My_UploadFiles>
+        <My_GreyRectangleForm title="通告封面" required>
+            <My_UploadFiles id="UploadFiles" fileList="{{coverFiles}}" upType="annunciate" UploadShow="2" previewSize="60px" maxCount="1" previewSize="63px" bindimageChange="imageChange"></My_UploadFiles>
         </My_GreyRectangleForm>
         <My_GreyRectangleForm title="上传附件">
-            <My_UploadFiles filesType='file' id="UpFiles" fileList="{{attinfos}}" upType="annunciate" UploadShow="2" previewSize="60px" maxCount="3" previewSize="65px" bindimageChange="imageChange"></My_UploadFiles>
+            <view style="width: 430rpx; display: flex; justify-content: flex-end;">
+                <My_UploadFiles filesType='file' id="UpFiles" fileList="{{defaultFiles}}" upType="annunciate" UploadShow="2" previewSize="60px" maxCount="99" previewSize="63px" bindimageChange="filesChange"></My_UploadFiles>
+            </view>
         </My_GreyRectangleForm>
-        <My_GreyRectangleForm title="发布范围">
-            <view class="clickPop {{ftype==''?'':'selected'}}" style="color: {{errTips.ftype?'#EF2C48':'#000'}};" bindtap="showPop">{{ftype?ftype:"点击选择"}}</view>
+        <My_GreyRectangleForm title="发布范围" required>
+            <view class="clickPop {{ftype==''?'':'selected'}}" style="color: {{errTips.ftype?'#EF2C48':'#000'}};opacity:{{errTips.ftype?'1':'0.3'}} ;" bindtap="showPop">{{ftype?ftype:"点击选择"}}</view>
         </My_GreyRectangleForm>
     </view>
 </My_GeneralTemplate>
 
 <!-- 弹出层 -->
 <van-action-sheet show="{{ popups }}" bind:close="showPop">
-    <My_MultipleChoice type='annunciate' title="发布范围" pitchOnItem="{{ftype}}" bind:optionChange="radioChange"></My_MultipleChoice>
+    <My_MultipleChoice type='annunciate' title="发布范围" pitchOnItem="商户公告" bind:optionChange="radioChange"></My_MultipleChoice>
 </van-action-sheet>
 
 <!-- 提交按钮 -->

+ 1 - 1
pages/annunciate/newAndChange.wxss

@@ -14,5 +14,5 @@
 
 /* 已选择分类和时间 */
 .selected {
-    opacity: 1;
+    opacity: 1 !important;
 }

+ 1 - 4
pages/tabbar-pages/supplyAndDemand/particulars.json

@@ -1,6 +1,3 @@
 {
-  "usingComponents": {
-    "My_SupplyAndDemandItemBox": "/components/My_SupplyAndDemandItemBox/index",
-    "My_CenterTheTitle":"/components/My_CenterTheTitle/index"
-  }
+  "usingComponents": {}
 }

+ 2 - 1
pages/teamManagement/change.js

@@ -82,8 +82,9 @@ Page({
             console.log("转让主账号", res)
             if (res.data != '成功') return;
             const that = this;
+            /* 已将验证码发送到受让方 */
             wx.showToast({
-                title: '已将验证码发送到受让方',
+                title: res.msg,
                 icon: "none",
                 duration: 3000
             })