zhaoxiaohai 3 years ago
parent
commit
7d59086f96

+ 2 - 1
app.json

@@ -50,7 +50,8 @@
         "pages/instantMessaging/index",
         "pages/annunciate/index",
         "pages/annunciate/newAndChange",
-        "pages/annunciate/details"
+        "pages/annunciate/details",
+        "pages/annunciate/glanceover"
     ],
     "usingComponents": {
         "van-button": "@vant/weapp/button/index",

+ 1 - 1
components/My_MultipleChoice/index.js

@@ -27,7 +27,7 @@ Component({
         }
     },
     lifetimes: {
-        attached: function () {
+        ready: function () {
             // 在组件实例进入页面节点树时执行
             //选择合作方式
             if (this.data.type == 'annunciate') {

+ 28 - 7
pages/annunciate/details.js

@@ -2,8 +2,9 @@ import {
     ApiModel
 } from "../../utils/api";
 const _Http = new ApiModel();
-Page({
+var WxParse = require('../../wxParse/wxParse.js');
 
+Page({
     /**
      * 页面的初始数据
      */
@@ -14,7 +15,6 @@ Page({
         coverFiles: [], //封面
         defaultFiles: [], //附件
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
@@ -34,13 +34,15 @@ Page({
         };
         //开始阅读
         _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])
             }
+            var that = this;
+            var article = res.data[0].fcontent;
+            WxParse.wxParse('article', 'html', article, that, 5);
             this.setData({
                 tnoticeid: options.id,
                 msgObj: res.data[0],
@@ -50,14 +52,33 @@ Page({
             })
         })
     },
+    /* 下载附件 */
+    downLoadFiles(e) {
+        const {
+            index
+        } = e.currentTarget.dataset,
+            that = this,
+            data = this.data.defaultFiles[index];
+        // console.log(data)
+        wx.downloadFile({
+            url: data.fobsurl,
+            success: function (res) {
+                var filePath = res.tempFilePath;
+                //页面显示加载动画
+                wx.openDocument({
+                    filePath: filePath,
+                    success: function (res) {
+                        console.log('打开文档成功')
+                    }
+                })
+            },
 
+        })
+    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
-    onReady: function () {
-
-    },
-
+    onReady: function () {},
     /**
      * 生命周期函数--监听页面显示
      */

+ 17 - 7
pages/annunciate/details.wxml

@@ -5,22 +5,32 @@
             <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>
+                    <image wx:if="{{msgObj.headportraiturl}}" src="{{msgObj.headportraiturl}}" mode="aspectFill"></image>
+                    <image wx:else src="/static/tacitly-approve/MRuserImg.png" mode="aspectFill"></image>
                 </view>
-                <view class="header-userMessage-textMsg">{{particulars.createby}} {{particulars.checkdate}}</view>
+                <view class="header-userMessage-textMsg">{{msgObj.changeby}} {{msgObj.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 style="overflow-wrap: break-word;">
+                <import src="../../wxParse/wxParse.wxml" />
+                <template is="wxParse" data="{{wxParseData:article.nodes}}" />
             </view>
         </view>
+        <view style="width: 702rpx;height: 2rpx;margin:0 auto; background-color: rgba(151,151,151, .1); margin-bottom: 18rpx;"></view>
         <!-- 更多推荐 -->
-        <My_CenterTheTitle title='附件下载'></My_CenterTheTitle>
+        <My_CenterTheTitle title='附件查看'></My_CenterTheTitle>
+        <view class="filesList">
+            <navigator url="#" class="files-item" wx:for="{{defaultFiles}}" data-index="{{index}}" catchtap="downLoadFiles">
+                <view class="files-item-img">
+                    <image src="/static/annunciate/icon-file.png"></image>
+                </view>
+                <view class="files-item-name u-line-1">{{item.postfix}}附件<image src="/static/annunciate/icon-downLoad.png"></image>
+                </view>
+            </navigator>
+        </view>
     </scroll-view>
 </view>

+ 50 - 1
pages/annunciate/details.wxss

@@ -1 +1,50 @@
-@import "/pages/tabbar-pages/supplyAndDemand/particulars.wxss"
+@import "/pages/tabbar-pages/supplyAndDemand/particulars.wxss";
+@import "/wxParse/wxParse.wxss";
+
+page {
+    background-color: #ffffff;
+}
+
+.filesList {
+    display: flex;
+    flex-wrap: wrap;
+    width: 620rpx;
+    margin: 0 auto;
+}
+
+.files-item {
+    display: flex;
+    flex-direction: column;
+    width: 25%;
+    align-items: center;
+    padding-top: 20rpx;
+}
+
+.files-item-img {
+    width: 96rpx;
+    height: 68rpx;
+    overflow: hidden;
+}
+
+.files-item-img>image {
+    width: 100%;
+    height: 100%;
+}
+
+.files-item-name {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    font-size: 24rpx;
+    width: 100%;
+    height: 34rpx;
+    line-height: 34rpx;
+    color: rgba(51, 51, 51, 0.6);
+    margin-top: 10rpx;
+}
+
+.files-item-name>image {
+    width: 24rpx;
+    height: 24rpx;
+    margin-left: 6rpx;
+}

+ 94 - 0
pages/annunciate/glanceover.js

@@ -0,0 +1,94 @@
+import {
+    ApiModel
+} from "../../utils/api";
+const _Http = new ApiModel();
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        history: [], //浏览记录
+        viewRowIndex: -1,
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        if (options.id) {
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('userData').token,
+                "classname": "customer.noticemag.noticemag",
+                "method": "havereaduserlist",
+                "content": {
+                    "tnoticeid": options.id
+                }
+            }).then(res => {
+                if (res.msg != '成功') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                });
+                this.setData({
+                    history: res.data
+                })
+            })
+        }
+    },
+    viewRow(e) {
+        const {
+            index
+        } = e.currentTarget.dataset;
+        this.setData({
+            viewRowIndex: index
+        })
+    },
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 5 - 0
pages/annunciate/glanceover.json

@@ -0,0 +1,5 @@
+{
+  "usingComponents": {
+    "My_liveAccountMsg": "/components/My_liveAccountMsg/index"
+  }
+}

+ 16 - 0
pages/annunciate/glanceover.wxml

@@ -0,0 +1,16 @@
+<My_liveAccountMsg title="浏览数据">
+    <view slot='con' class="form-box clearfix">
+        <view class="header">
+            <view class="u-line-1" style="width: 155rpx;padding-left: 14rpx;">浏览用户</view>
+            <view class="u-line-1" style="width: 135rpx;">浏览次数</view>
+            <view class="u-line-1" style="width: 135rpx;">浏览时长</view>
+            <view class="u-line-1" style="width: 225rpx;">最新浏览时间</view>
+        </view>
+        <view class="row {{viewRowIndex==index?'active':''}}" wx:for="{{5}}" data-index="{{index}}" catchtap="viewRow">
+            <view class="u-line-1" style="width: 155rpx;padding-left: 14rpx;">好吃的薯片</view>
+            <view class="u-line-1" style="width: 135rpx;">1234533</view>
+            <view class="u-line-1" style="width: 135rpx;">小时</view>
+            <view class="u-line-1" style="width: 225rpx;">2022/01/15 12:12:21</view>
+        </view>
+    </view>
+</My_liveAccountMsg>

+ 48 - 0
pages/annunciate/glanceover.wxss

@@ -0,0 +1,48 @@
+.form-box {
+    width: 100%;
+    height: 100%;
+    padding: 0 10rpx;
+    box-sizing: border-box;
+}
+
+.header {
+    float: left;
+    width: 100%;
+    height: 64rpx;
+    line-height: 64rpx;
+    background: #F6F7F8;
+    border-radius: 8rpx 8rpx 0px 0px;
+    margin-top: 12rpx;
+    box-sizing: border-box;
+    border-bottom: 2rpx solid #E8E8E8;
+}
+
+.row {
+    float: left;
+    width: 100%;
+    height: 58rpx;
+    line-height: 58rpx;
+    box-sizing: border-box;
+    border-bottom: 2rpx solid #E8E8E8;
+}
+
+
+.header>view,
+.row>view {
+    float: left;
+    text-align: left;
+}
+
+.header>view {
+    font-size: 24rpx;
+    color: rgba(0, 0, 0, 0.85);
+}
+
+.row>view {
+    font-size: 20rpx;
+    color: rgba(0, 0, 0, 0.65);
+}
+
+.active {
+    background-color: #FAFAFA !important;
+}

+ 3 - 1
pages/annunciate/index.js

@@ -91,7 +91,9 @@ Page({
         const {
             index
         } = e.currentTarget.dataset;
-        console.log(index)
+        wx.navigateTo({
+            url: './glanceover?id=' + this.data.annunciateList[index].tnoticeid,
+        })
     },
     /* 发布公告 */
     toAnnounce() {

+ 12 - 1
pages/annunciate/newAndChange.js

@@ -110,11 +110,22 @@ Page({
                 "fcontent": this.data.fcontent,
             }
         }).then(res => {
-            console.log(res)
+            console.log("新增", res)
             if (res.msg != '成功') return wx.showToast({
                 title: res.data,
                 icon: "none"
             });
+            if (this.data.tnoticeid == 0) _Http.basic({
+                "accesstoken": wx.getStorageSync('userData').token,
+                "classname": "customer.noticemag.noticemag",
+                "method": "check",
+                "content": {
+                    "tnoticeid": res.data[0].tnoticeid,
+                    "fischeck": 1
+                }
+            }).then(s => {
+                console.log("修改上架", s)
+            })
             wx.showToast({
                 title: '保存成功',
             });

+ 1 - 1
pages/annunciate/newAndChange.wxml

@@ -27,7 +27,7 @@
 
 <!-- 弹出层 -->
 <van-action-sheet show="{{ popups }}" bind:close="showPop">
-    <My_MultipleChoice type='annunciate' title="发布范围" pitchOnItem="商户公告" bind:optionChange="radioChange"></My_MultipleChoice>
+    <My_MultipleChoice type='annunciate' title="发布范围" pitchOnItem="{{ftype}}" bind:optionChange="radioChange"></My_MultipleChoice>
 </van-action-sheet>
 
 <!-- 提交按钮 -->

+ 1 - 1
pages/tabbar-pages/supplyAndDemand/particulars.wxss

@@ -12,7 +12,7 @@ page {
 .header-box {
     width: 100vw;
     background-color: #ffffff;
-    padding: 0 24rpx 30rpx;
+    padding: 0 24rpx 40rpx;
     border-radius: 0px 0px 20rpx 20rpx;
     box-sizing: border-box;
 }

+ 2 - 1
pages/webView/index.js

@@ -14,12 +14,13 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+        console.log(options)
         //判断是否纯在登录态度
         if (!wx.getStorageSync('userData').token) {
             this.toLogin("当前未登录,是否前去登录", options.url);
         } else {
             _Http.basic({
-                "accesstoken": "6682a82c96fb72035e6b53f32dab4d7c",
+                "accesstoken": wx.getStorageSync('userData').token,
                 "classname": "customer.usercenter.usermsg.usermsg",
                 "method": "query_usermsg",
                 "content": {}

+ 14 - 0
project.private.config.json

@@ -163,6 +163,20 @@
                     "name": "发布通告",
                     "pathName": "pages/annunciate/newAndChange",
                     "query": "",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "通告详情",
+                    "pathName": "pages/annunciate/details",
+                    "query": "id=202&type=1",
+                    "launchMode": "default",
+                    "scene": null
+                },
+                {
+                    "name": "浏览记录",
+                    "pathName": "pages/annunciate/glanceover",
+                    "query": "id=619",
                     "scene": null,
                     "launchMode": "default"
                 }

BIN
static/annunciate/icon-downLoad.png


BIN
static/annunciate/icon-file.png