xiaohaizhao 2 سال پیش
والد
کامیت
eb98aef38d

+ 23 - 0
pages/index/message/detail.js

@@ -0,0 +1,23 @@
+const _Http = getApp().globalData.http;
+Page({
+  data: {
+    detailsData: []
+  },
+  onLoad(options) {
+    _Http.basic({
+      "classname": "system.message.Message",
+      "method": "readMessage",
+      "content": {
+        "messageid": options.id
+      }
+    }).then(res => {
+      if (res.msg != '成功') return wx.showToast({
+        title: res.msg,
+        icon: "none"
+      })
+      this.setData({
+        detailsData: res.data
+      })
+    })
+  },
+})

+ 3 - 0
pages/index/message/detail.json

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

+ 38 - 0
pages/index/message/detail.scss

@@ -0,0 +1,38 @@
+.msg-mian {
+	width: 750rpx;
+	padding: 30rpx;
+	box-sizing: border-box;
+	background-color: #ffffff;
+
+	.title {
+			font-size: 30rpx;
+			font-family: PingFang SC-Bold, PingFang SC;
+			font-weight: bold;
+			color: #333333;
+	}
+
+	.time {
+			width: 100%;
+			margin-top: 20rpx;
+			font-size: 20rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #999999;
+			padding-bottom: 30rpx;
+			border-bottom: 1rpx dashed #CCCCCC;
+	}
+
+	.content {
+			margin-top: 30rpx;
+			font-size: 28rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #666666;
+
+			>text {
+					display: inline-block;
+					width: 200rpx;
+					font-size: 28rpx;
+					font-family: PingFang SC-Regular, PingFang SC;
+					color: #3874F6;
+			}
+	}
+}

+ 8 - 0
pages/index/message/detail.wxml

@@ -0,0 +1,8 @@
+<view class="msg-mian">
+    <view class="title multi-line">{{detailsData.title}}</view>
+    <view class="time">{{detailsData.readdate}}</view>
+    <view class="content multi-line">{{detailsData.message}}</view>
+  <!--   <view class="content" wx:if="{{detailsData.type=='应用'}}" bindtap="toDetails">请前往 <text>{{type.query(detailsData.objectname)}} >
+        </text></view> -->
+</view>
+<wxs module="type" src='./modules/determineType.wxs' />

+ 61 - 0
pages/index/message/index.js

@@ -0,0 +1,61 @@
+const _Http = getApp().globalData.http;
+Component({
+  properties: {
+
+  },
+  options: {
+    addGlobalClass: true
+  },
+  data: {
+    height: 0,
+    list: [],
+    content: {
+      nocache: true,
+      pageNumber: 1,
+      pageSize: 20,
+      pageTotal: 1,
+      type: "应用",
+      where: {}
+    },
+    total: 0,
+  },
+  methods: {
+    init() {
+      this.getlist(true)
+    },
+    getlist(init = false) {
+      if (init.detail != undefined) init = init.detail;
+      if (init) this.setData({
+        ['content.pageNumber']: 1
+      })
+      if (this.data.content.pageNumber > this.data.content.pageTotal) return;
+      _Http.basic({
+        "classname": "system.message.Message",
+        "method": "queryMessage",
+        content: this.data.content
+      }).then(res => {
+        this.selectComponent("#ListBox").setHeight("#tabs", this);
+        this.selectComponent('#ListBox').RefreshToComplete();
+        if (res.msg != '成功') return wx.showToast({
+          title: res.msg,
+          icon: "none"
+        })
+        this.setData({
+          total: res.total,
+          list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
+          ['content.pageNumber']: res.pageNumber + 1,
+          ['content.pageTotal']: res.pageTotal
+        })
+      })
+    },
+    toDetails(e) {
+      const {
+        item
+      } = e.currentTarget.dataset;
+      wx.navigateTo({
+        url: '/pages/index/message/detail?id=' + item.messageid,
+      })
+    },
+
+  }
+})

+ 4 - 0
pages/index/message/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 73 - 0
pages/index/message/index.scss

@@ -0,0 +1,73 @@
+
+/* 未读 */
+.unread {
+	width: 750rpx;
+	height: 34rpx;
+	text-align: center;
+	font-size: 24rpx;
+	font-family: PingFang SC-Regular, PingFang SC;
+	color: #999999;
+	margin: 12rpx 0 -5rpx 0;
+}
+
+page {
+	padding: 0 !important;
+	overflow: hidden !important;
+}
+
+.tab-active-class {
+	color: var(--assist) !important;
+	font-size: 28rpx !important;
+	font-family: PingFang SC-Bold, PingFang SC !important;
+	font-weight: bold !important;
+}
+
+/* 消息列表 */
+.list {
+	position: relative;
+	height: 194rpx;
+	width: 690rpx;
+	box-sizing: border-box;
+	border-radius: 16rpx;
+	overflow: hidden;
+	background: #ffffff;
+	margin: 20rpx auto 0;
+	padding: 30rpx;
+
+	.title {
+			height: 40rpx;
+			font-size: 28rpx;
+			font-family: PingFang SC-Medium, PingFang SC;
+			font-weight: 500;
+			color: #333333;
+	}
+
+	.content {
+			width: 620rpx;
+			font-size: 24rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #666666;
+			margin-top: 16rpx;
+	}
+
+	.time {
+			font-size: 20rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #999999;
+			margin-top: 16rpx;
+
+			.tag {
+					margin-right: 10rpx;
+			}
+	}
+
+	.unread-item {
+			position: absolute;
+			width: 16rpx;
+			height: 16rpx;
+			background: var(--error);
+			border-radius: 50%;
+			top: 6rpx;
+			right: 6rpx;
+	}
+}

+ 18 - 0
pages/index/message/index.wxml

@@ -0,0 +1,18 @@
+<van-tabs id='tabs' active="{{ content.type }}" color='var(--assist)' tab-active-class='tab-active-class' bind:change="tabChange">
+    <van-tab title="应用消息" name='应用' />
+    <van-tab title="系统消息" name='系统' />
+</van-tabs>
+<Yl_ListBox id="ListBox" height="{{height}}" bind:getlist='getlist'>
+    <view class="unread">总共{{total}}条</view>
+    <navigator url="#" class='list' wx:for="{{list}}" data-item="{{item}}" bindtap="toDetails">
+        <view class="title line-1">{{item.title}}</view>
+        <view class="content line-1">{{item.message}}</view>
+        <view class="time">
+            <van-tag class="tag" wx:if="{{item.objectname}}" plain type="primary">{{type.query(item.objectname)}}</van-tag>{{item.createdate}}
+        </view>
+        <view wx:if="{{item.isread=='0'}}" class="unread-item" />
+    </navigator>
+    <Yl_Empty wx:if="{{!list.length}}" />
+    <view style="height: 180rpx;" />
+</Yl_ListBox>
+<wxs module="type" src='./modules/determineType.wxs' />

+ 27 - 0
pages/index/message/modules/determineType.wxs

@@ -0,0 +1,27 @@
+module.exports.query = function (name) {
+    var showName = '';
+    switch (name) {
+        case 'sat_courseware':
+            showName = '商学院';
+            break;
+        case 'sat_sharematerial':
+            showName = '推广素材';
+            break;
+        case 'sat_notice':
+            showName = '通告';
+            break;
+        case 'sat_submitedit':
+            showName = '提报';
+            break;
+        case 'sat_orderclue':
+            showName = '销售线索';
+            break;
+        case 'sys_attachment':
+            showName = '营销物料';
+            break;
+        default:
+            showName = '其他应用';
+            break;
+    }
+    return showName;
+}

+ 68 - 0
pages/index/message/modules/tabs.js

@@ -0,0 +1,68 @@
+// pages/tabbar/message/modules/tabs.js
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        list: {
+            type: Array,
+            value: [{
+                label: '系统消息',
+                nubmer: "9"
+            }, {
+                label: '应用消息',
+                nubmer: "15"
+            }]
+        },
+        onChange: {
+            type: Function
+        }
+    },
+
+    lifetimes: {
+        ready() {
+            this.setBorBotLeft()
+        }
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        animationData: {}, //横线平移动画
+        acIndex: 0,
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        /* 改变选中 */
+        changeTab(e) {
+            if (this.data.acIndex == e.currentTarget.dataset.index) return;
+            this.setData({
+                acIndex: e.currentTarget.dataset.index
+            })
+            this.triggerEvent("onChange", e.currentTarget.dataset.item)
+            this.setBorBotLeft()
+        },
+        //更改横线位置
+        setBorBotLeft() {
+            let animation = wx.createAnimation({
+                duration: 1000,
+                timingFunction: 'ease',
+            })
+            let that = this;
+            let query = wx.createSelectorQuery().in(this)
+            query.select('.acTitle').boundingClientRect();
+            query.exec(function (res) {
+                animation.translate(res[0].left).step({
+                    duration: 300
+                })
+                that.setData({
+                    animationData: animation.export()
+                })
+            })
+        },
+    }
+})

+ 4 - 0
pages/index/message/modules/tabs.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 44 - 0
pages/index/message/modules/tabs.scss

@@ -0,0 +1,44 @@
+.tabs {
+    position: relative;
+    display: flex;
+    width: 750rpx;
+    height: 90rpx;
+    background: #fff;
+
+    .item {
+        flex: 1;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+
+        .title {
+            position: relative;
+            font-size: 28rpx;
+            font-family: PingFang SC-Bold, PingFang SC;
+            font-weight: bold;
+            color: #999999;
+            letter-spacing: 2rpx;
+
+            .badge {
+                position: absolute;
+                top: 50%;
+                right: -30rpx;
+            }
+        }
+
+        .acTitle {
+            color: var(--assist);
+        }
+
+
+    }
+
+    .my-bor-bot {
+        position: absolute;
+        width: 128rpx;
+        height: 4rpx;
+        background: #0486FE;
+        left: 0;
+        bottom: 0;
+    }
+}

+ 9 - 0
pages/index/message/modules/tabs.wxml

@@ -0,0 +1,9 @@
+<view class="tabs">
+    <view class="item" wx:for="{{list}}" wx:key="{{item.label}}" data-index="{{index}}" data-item="{{item}}" bindtap="changeTab">
+        <view class="title {{index==acIndex?'acTitle':''}}">
+            {{item.label}}
+            <!-- <van-icon wx:if="{{item.nubmer}}" class="badge" info="{{item.nubmer}}" /> -->
+        </view>
+    </view>
+    <view animation="{{animationData}}" class="my-bor-bot" />
+</view>

+ 0 - 66
pages/index/orderForm/modules/setBrand/index.js

@@ -1,66 +0,0 @@
-// pages/index/orderForm/modules/setBrand/index.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad(options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
-  }
-})

+ 0 - 2
pages/index/orderForm/modules/setBrand/index.wxml

@@ -1,2 +0,0 @@
-<!--pages/index/orderForm/modules/setBrand/index.wxml-->
-<text>pages/index/orderForm/modules/setBrand/index.wxml</text>