Browse Source

新增消息列表

master
杜叶春 2 years ago
parent
commit
727ef6347f
  1. 4
      pages/distribution/detail.wxml
  2. 15
      pages/notice/index.js
  3. 3
      pages/notice/index.json
  4. 4
      pages/notice/index.wxml
  5. 10
      pages/notice/notice.js
  6. 3
      pages/notice/notice.json
  7. 23
      pages/notice/notice.wxml
  8. 25
      pages/notice/notice.wxss
  9. 2
      wxParse/wxParse.wxml

4
pages/distribution/detail.wxml

@ -71,11 +71,11 @@
<view class="df_1 l_h15 pt5"> <view class="df_1 l_h15 pt5">
<view bindtap="addFavorites" class='{{wsc}}'> <view bindtap="addFavorites" class='{{wsc}}'>
<image class="icon_kf" src="/images/shc.png" style="width: 23px;height: 23px;margin-top: 6px;"></image> <image class="icon_kf" src="/images/xinghui.png" style="width: 23px;height: 23px;margin-top: 6px;"></image>
<!-- <view class="dbtext">收藏</view> --> <!-- <view class="dbtext">收藏</view> -->
</view> </view>
<view bindtap="delFavorites" class='{{sc}}'> <view bindtap="delFavorites" class='{{sc}}'>
<image class="icon_kf" src="/images/shced.png" style="width: 23px;height: 23px;margin-top: 6px;"></image> <image class="icon_kf" src="/images/xinghei.png" style="width: 23px;height: 23px;margin-top: 6px;"></image>
<!-- <view class="dbtext">已收藏</view> --> <!-- <view class="dbtext">已收藏</view> -->
</view> </view>
</view> </view>

15
pages/notice/index.js

@ -3,7 +3,7 @@ var WxParse = require('../../wxParse/wxParse.js');
var WXAPI = require('../../utils/server.js'); var WXAPI = require('../../utils/server.js');
Page({ Page({
data: { data: {
notice: [], notice: {},
radioindex: '', radioindex: '',
pro_id: 0, pro_id: 0,
num: 0, num: 0,
@ -21,19 +21,20 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
wx.setNavigationBarTitle({ var index = options.index
title: '公告详情', //修改页面标题
});
var that = this; var that = this;
WXAPI.messageList({ WXAPI.messageList({
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
}).then(res => { }).then(res => {
if (res.code == 200) { if (res.code == 200) {
var data = res.data var data = res.data
var notice = data.message; var notice = data.message[index];
var detail = data.message[0].detail; var detail = data.message[index].content;
WxParse.wxParse('detail', 'html', detail, that, 5);//处理规则的富文本框 WxParse.wxParse('detail', 'html', detail, that, 5);//处理规则的富文本框
if (notice == '') { if (notice == '') {
var notice = [] var notice = {}
} }
that.setData({ that.setData({
notice: notice notice: notice

3
pages/notice/index.json

@ -1,4 +1,5 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {},
"navigationBarTitleText": "公告详情"
} }

4
pages/notice/index.wxml

@ -2,9 +2,9 @@
<view class="function" style='background:#fff'> <view class="function" style='background:#fff'>
<view> <view>
<view style='font-size:27px;text-align:left;margin:10px;'> <view style='font-size:27px;text-align:left;margin:10px;'>
{{notice[0].name}} {{notice.title}}
</view> </view>
<view style='font-size:10px;width:30%;float:right;margin:10px 10px 20px;'>{{notice[0].time}} </view> <view style='font-size:10px;width:30%;float:right;margin:10px 10px 20px;'>{{notice.time}} </view>
</view> </view>
<view style='clear:both;'> <view style='clear:both;'>
</view> </view>

10
pages/notice/notice.js

@ -22,9 +22,6 @@ Page({
this.DataonLoad(); this.DataonLoad();
}, },
onLoad: function (options) { onLoad: function (options) {
wx.setNavigationBarTitle({
title: '公告', //修改页面标题
});
var that = this; var that = this;
WXAPI.messageList({ WXAPI.messageList({
accessId: app.globalData.accessId, accessId: app.globalData.accessId,
@ -66,5 +63,12 @@ Page({
} }
}) })
}, },
navToIndex: function (e) {
var item = e.currentTarget.dataset.item
var index = e.currentTarget.dataset.index
wx.navigateTo({
url: '/pages/notice/index?id=' + item.id+'&index='+index,
})
}
}) })

3
pages/notice/notice.json

@ -1,4 +1,5 @@
{ {
"component": true, "component": true,
"usingComponents": {} "usingComponents": {},
"navigationBarTitleText": "公告"
} }

23
pages/notice/notice.wxml

@ -1,17 +1,14 @@
<!--pages/notice.wxml--> <!--pages/notice.wxml-->
<view class="function" style='background:#fff'> <view class="container">
<view class='tab_tab' wx:for="{{notice}}" wx:key="key"> <view class='tab_tab' wx:for="{{notice}}" wx:key="key" data-index="{{index}}" data-item="{{item}}" bindtap="navToIndex">
<navigator url="../notice/index?Id={{item.id}}"> <view class="function_list">
<view class="function_list" lang="zh_CN"> <view class='function_left'>
<view class='function_left'> <view class='function_time'>{{item.time}} </view>
<view class='function_text'>{{item.content}} </view> <view class='function_text'>{{item.content}} </view>
<view class='function_text'>{{item.time}} </view>
</view>
<view class='function_right'>
<image class="jiantou" src="../../images/x_right.png"></image>
</view>
</view> </view>
<view class='function_right'>
</navigator> <image class="jiantou" src="../../images/x_right.png"></image>
</view>
</view>
</view> </view>
</view> </view>

25
pages/notice/notice.wxss

@ -4,30 +4,25 @@ page{
height: 100%; height: 100%;
background:#eee !important; background:#eee !important;
} }
.function{
width:95%;
margin: 10px auto;
border-radius: 5px;
}
.mor{ .mor{
color: gray; color: gray;
font-size: 12px; font-size: 12px;
} }
.tab_tab{
padding-top: 25rpx;
padding-bottom: 25rpx;
margin: 25rpx 25rpx 0rpx 25rpx;
background-color: white;
border-radius: 10rpx;
}
.function_list{ .function_list{
display:flex; display:flex;
justify-content:space-between; justify-content:space-between;
background:#fff; background:#fff;
margin:0rpx;
padding:0;
color:#666;
border-bottom:20rpx solid #eee;
height: 150rpx;
} }
.function_left{ .function_left{
/* display: flex; */
font-size:16px; font-size:16px;
margin-left:10px; margin-left:10px;
padding-top: 3px;
} }
.function .iconfont { .function .iconfont {
line-height:27px; line-height:27px;
@ -35,6 +30,12 @@ page{
.function_text{ .function_text{
margin-top:10px; margin-top:10px;
margin-left:5px; margin-left:5px;
color:#666;
}
.function_time{
margin-left:5px;
font-size:15px;
color:#999;
} }
.jiantou{ .jiantou{
margin-top:40rpx; margin-top:40rpx;

2
wxParse/wxParse.wxml

@ -25,7 +25,7 @@
<template name="WxEmojiView"> <template name="WxEmojiView">
<view class="WxEmojiView wxParse-inline" style="{{item.styleStr}}"> <view class="WxEmojiView wxParse-inline" style="{{item.styleStr}}">
<block wx:for="{{item.textArray}}" wx:key=""> <block wx:for="{{item.textArray}}" wx:key="key">
<block class="{{item.text == '\\n' ? 'wxParse-hide':''}}" wx:if="{{item.node == 'text'}}">{{item.text}}</block> <block class="{{item.text == '\\n' ? 'wxParse-hide':''}}" wx:if="{{item.node == 'text'}}">{{item.text}}</block>
<block wx:elif="{{item.node == 'element'}}"> <block wx:elif="{{item.node == 'element'}}">
<image class="wxEmoji" src="{{item.baseSrc}}{{item.text}}" /> <image class="wxEmoji" src="{{item.baseSrc}}{{item.text}}" />

Loading…
Cancel
Save