主题添加

dev
Esdese 3 years ago
parent dd7e982dff
commit c8623f628b

@ -0,0 +1,8 @@
var method = {
stringify: function (val) {
return JSON.stringify(val)
}
}
module.exports = {
stringify: method.stringify
}

@ -0,0 +1,95 @@
// pages/varComm/pages/addEvent/index.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
active: 0,
result:[],
themeList:[],
themeData:[],
issList:[],
titleList:[
{
title:'我的主题',
index:0,
active:true
},{
title:'往期主题',
index:1,
active:false
}
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getData()
},
changeTitle(e){
let index = e.currentTarget.dataset.index
let arr = this.data.titleList
for(let[index1,i] of arr.entries()){
if(index1==index){
i.active=true
}else{
i.active =false
}
}
this.setData({
titleList:arr,
active:index
})
},
onChange(event) {
const {
detail
} = event
let themeData=[]
for(let i of detail){
themeData.push(JSON.parse(i))
}
themeData.len=6
this.setData({
result: detail,
themeData,
})
wx.setStorageSync('themeData', themeData)
wx.navigateBack({
delta: 1,
})
},
getData(){
let themeData = wx.getStorageSync('themeData')
let result =[]
themeData.forEach(ele=>{
if(ele)result.push(JSON.stringify(ele)),this.data.themeData.push(ele)
})
this.setData({
result
})
app.globalData.request({
action: 'getSchemeDataToTheme',
token: wx.getStorageSync('token'),
sType:'now'
}).then(res=>{
this.setData({
themeList: res
})
})
app.globalData.request({
action: 'getSchemeDataToTheme',
token: wx.getStorageSync('token'),
sType:'former '
}).then(res=>{
this.setData({
issList: res
})
})
}
})

@ -0,0 +1,6 @@
{
"usingComponents": {},
"navigationBarTitleText": "添加主题",
"navigationBarTextStyle":"black",
"navigationBarBackgroundColor": "#ffffff"
}

@ -0,0 +1,75 @@
<view class="top_box">
<view wx:for="{{titleList}}" class="{{item.active?'active_title':'title'}}" wx:key="index" bindtap="changeTitle" data-index="{{index}}">
<view class="">{{item.title}}</view>
<view class="line" wx:if="{{item.active}}"></view>
</view>
</view>
<wxs src="./filter.wxs" module="filter"></wxs>
<van-checkbox-group value="{{ result }}" bind:change="onChange">
<view class="my_theme" wx:if="{{active==0}}">
<view class="event_card" wx:for="{{themeList}}" wx:key="idxa">
<view class="card_head">
<van-checkbox name="{{filter.stringify(item)}}" shape="square" class="van-checkbox"></van-checkbox>
<view style=" font-size: 24rpx;color: rgba(153, 153, 153, 1); width:240rpx;">
{{item.AddTime}}
</view>
<view class="tag"> 已完成</view>
</view>
<view class="card_title">
<text>{{item.Name}}</text>
</view>
<view class="card_label" style="margin-top: 32rpx;">
<text style="color: rgba(153, 153, 153, 1);">相关报道(条)</text>
<text>{{item.ReportSum}}</text>
</view>
<view class="card_label" style="margin-top: 24rpx;">
<text style="color: rgba(153, 153, 153, 1);">开始时间</text>
<text>{{item.StartTime}}</text>
</view>
<view class="card_label" style="margin-top: 24rpx;">
<text style="color: rgba(153, 153, 153, 1);">结束时间</text>
<text>{{item.EndTime}}</text>
</view>
<view class="card_label" style="margin-top: 24rpx;">
<text style="color: rgba(153, 153, 153, 1);">传播周期(条)</text>
<text>{{item.events_influence}}</text>
</view>
</view>
</view>
<view class="issue_theme" wx:if="{{active==1}}">
<view class="event_card" wx:for="{{issList}}" wx:key="idxa">
<view class="card_head">
<van-checkbox name="{{filter.stringify(item)}}" shape="square" class="van-checkbox"></van-checkbox>
<view style=" font-size: 24rpx;color: rgba(153, 153, 153, 1); width:240rpx;">
{{item.AddTime}}
</view>
<view class="tag"> 已完成</view>
</view>
<view class="card_title">
<text>{{item.Name}}</text>
</view>
<view class="card_label" style="margin-top: 32rpx;">
<text style="color: rgba(153, 153, 153, 1);">相关报道(条)</text>
<text>{{item.ReportSum}}</text>
</view>
<view class="card_label" style="margin-top: 24rpx;">
<text style="color: rgba(153, 153, 153, 1);">开始时间</text>
<text>{{item.StartTime}}</text>
</view>
<view class="card_label" style="margin-top: 24rpx;">
<text style="color: rgba(153, 153, 153, 1);">结束时间</text>
<text>{{item.EndTime}}</text>
</view>
<view class="card_label" style="margin-top: 24rpx;">
<text style="color: rgba(153, 153, 153, 1);">传播周期(条)</text>
<text>{{item.events_influence}}</text>
</view>
</view>
</view>
</van-checkbox-group>

@ -0,0 +1,99 @@
.top_box{
background: white;
display: flex;
}
.title{
width: 50%;
height: 88rpx;
text-align: center;
line-height: 88rpx;
font-size: 28rpx;
color: #b3b3b3;
/* border-bottom: 4rpx solid #027bff; */
}
.active_title{
width: 50%;
height: 88rpx;
text-align: center;
line-height: 88rpx;
font-size: 28rpx;
font-weight: bold;
color: black;
}
.my_theme{
/* height: 10000rpx;
background: pink; */
}
.line{
height: 4rpx;
background: #007bff;
width:30%;
position: relative;
left: 50%;
transform: translateX(-50%);
bottom: 4rpx;
border-radius: 4rpx;
}
.event_card {
width: 686rpx;
height: 350rpx;
background-color: white;
margin-top: 32rpx;
padding-top: 36rpx;
margin-left: 32rpx;
}
.card_head {
display: flex;
justify-content: space-around;
align-items: center;
}
checkbox .wx-checkbox-input {
height: 32rpx;
width: 32rpx;
}
.tag {
background: #f0f8ff;
color: rgba(0, 132, 255, 1);
width: 128rpx;
height: 40rpx;
font-size: 24rpx;
text-align: center;
line-height: 40rpx;
margin-left: 160rpx;
/* margin-right: 32rpx; */
}
.card_title{
overflow:hidden;
text-overflow: ellipsis;
display:-webkit-box;
-webkit-line-clamp:1;
-webkit-box-orient: vertical;
margin-left: 32rpx;
margin-top: 24rpx;
font-size: 32rpx;
font-weight: bolder;
}
.card_label{
width: 622rpx;
margin-left: 32rpx;
display: flex;
font-size: 28rpx;
height: 24rpx;
justify-content:space-between;
}
.van-checkbox__icon {
margin-left: 32rpx ;
font-size: 32rpx !important;
}
.van-image{
margin-left: 48rpx;
margin-top: 6rpx;
}
.card_head .van-checkbox{
display: inline-block !important;
}
Loading…
Cancel
Save