银花优选微信小程序修改后的最新版本代码

This commit is contained in:
ss001
2026-02-07 16:22:31 +08:00
commit c00caf5744
516 changed files with 41796 additions and 0 deletions

143
pages/news/index.js Normal file
View File

@@ -0,0 +1,143 @@
var WxParse = null;
var app = getApp()
var that=null
Page( {
data: {
loadingHidden:false,
nodataHidden:true,
bodyHidden:true,
Start: 0,
nav:0,
helps:[],
title:"",
body:""
},onShow: function () {
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
this.getTabBar().setData({
selected: 1
})
}
},
onLoad: function(options) {
that = this
WxParse = require('../../wxParse/wxParse.js')
that.clearCache();//清本页缓存
that.getlist(0);//第一次加载数据
}, getlist: function (gp) {
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"getnewslist",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId),
t:that.data.nav,
Start:that.data.Start
},
method:"GET",
dataType:"json",
header: {
"content-type": "application/json" // 默认值
},
success (res) {
var tmpArr = null;
tmpArr = that.data.helps;
tmpArr.push.apply(tmpArr,res.data.data);
that.setData({
helps: tmpArr,
Start: that.data.Start+res.data.data.length,
loadingHidden:true
})
if(gp==0||gp==1){
if(res.data.data.length==0){
that.setData({
nodataHidden:false
})
}else{
that.setData({
nodataHidden:true
})
}
}
}
})
},
// 下拉刷新
onPullDownRefresh: function () {
that.clearCache();
that.getlist(0);//第一次加载数据
},
// 页面上拉触底事件(上拉加载更多)
onReachBottom: function () {
that.getlist(1);//后台获取新数据并追加渲染
},
// 清缓存
clearCache:function(){
that.setData({
helps: [],
Start: 0,
loadingHidden:false
});
},ondetail:function(e) {
that.setData({
loadingHidden:false
})
var id = e.currentTarget.dataset.id
var userId = wx.getStorageSync("userId")
var LoginId = wx.getStorageSync("LoginId")
wx.request({
url: app.globalData.apiurl + "/xapiajax.ashx",
data: {
action:"getnewdetail",
userId:(!userId?"":userId),
LoginId:(!LoginId?"":LoginId),
id:id
},
method:"POST",
dataType:"json",
header: {
"content-type": "application/x-www-form-urlencoded" // 默认值
},
success (res) {
if(res.data.status==1){
WxParse.wxParse('body', 'html', res.data.content, that);
that.setData({
title:res.data.title,
bodyHidden:false
})
}else{
wx.showToast({
title: res.data.msg,
icon: "none",
duration: 3000
})
}
that.setData({
loadingHidden:true
})
}
})
},closeserver:function(e) {
that.setData({
bodyHidden:true
})
},inserver :function(e) {
},onnav:function(e) {
var index = e.currentTarget.dataset.id
that.setData({
nav:index
})
that.clearCache();
that.getlist(0);
}
})

3
pages/news/index.json Normal file
View File

@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "资讯"
}

40
pages/news/index.wxml Normal file
View File

@@ -0,0 +1,40 @@
<import src="../../wxParse/wxParse.wxml"/>
<view class="container">
<view class="myorder-menu">
<view class='{{nav==0?"hover":""}}' bindtap="onnav" data-id="0">公司公告</view>
<view class='{{nav==1?"hover":""}}' bindtap="onnav" data-id="1">新闻动态</view>
</view>
<view class="news-box" wx:for="{{helps}}" >
<view class="news-item" bindtap="ondetail" data-id="{{item.id}}">
<view class="createTime"><text>{{item.createTime}}</text></view>
<view class="item-box">
<view class="title">{{item.title}}</view>
<view class="createTime2">{{item.createTime2}}</view>
<view class="pic"><image src="{{item.pic}}"></image></view>
<view class="content"><text>{{item.content}}</text></view>
<view class="read"><text>阅读全文</text><image src="../../images/icon-arrowdown.png"></image></view>
</view>
</view>
</view>
<view class="nodata" hidden="{{nodataHidden}}">
<image src="../../images/order-null.png"/>
<view>暂无数据</view>
</view>
</view>
<view class="Hidden_box" hidden="{{bodyHidden}}" bindtap="closeserver">
<view class="Hidden_box_to" catchtap="inserver">
<view class="close" bindtap="closeserver"><image src="../../images/close.png" /></view>
<view class="title">查看详情</view>
<view class="body">
<view class="title">{{title}}</view>
<template is="wxParse" data="{{wxParseData:body.nodes}}"/>
</view>
</view>
</view>
<loading hidden="{{loadingHidden}}">
加载中...
</loading>

41
pages/news/index.wxss Normal file
View File

@@ -0,0 +1,41 @@
page{
background: #f5f5f5;
}
.container {
position: relative;
width: 100%;
height: 100%;
font-size: 14px;
color: #000;
}
.myorder-menu{display: flex;flex-direction: row;align-items: center;justify-content: center;width:100%; background-color: #fff;}
.myorder-menu view{display: flex;flex: 1; height:2.5em; line-height: 2.5em; text-align: center; border:1px solid #f1f1f1; border-left:0;border-top: 0; align-items: center;justify-content: center;}
.myorder-menu view.hover{border-bottom:1px solid #00B050;color:#00B050;}
.news-box{width:100%; padding:0 1em;box-sizing: border-box;}
.news-item{position: relative; float:left; width:100%; margin:1em 0; padding:0; box-sizing: border-box; text-align: left; }
.news-item .createTime{width: 100%;}
.news-item .createTime text{display: block;margin:0.5em auto; height: 1.5em; line-height: 1.5em; max-width:7em; padding:0.2em; text-align: center;background-color: #c9c9c9;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;}
.news-item .item-box{position:relative; padding:1em;width: 100%;border:1px solid #ededed;border-radius:10px;box-sizing:border-box;background-color: #fff;}
.news-item .item-box .title{width: 100%;background-color:#fff; line-height:1.2em;}
.news-item .item-box .createTime2{width: 100%;color:#939393}
.news-item .item-box .pic{width: 100%;margin-top:0.5em;}
.news-item .item-box .pic image{width:100%;height:12.5em;}
.news-item .item-box .content{margin-top:0.5em;width: 100%;color:#939393;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height:1.2em;}
.news-item .item-box .read{margin-top:0.8em;width: 100%; height:2.5em; line-height:2.5em; border-top:1px solid #ededed;}
.news-item .item-box .read image{ float:right; margin-top:0.8em; width:1.2em;height: 1.2em;}
.Hidden_box{ position: fixed;display: flex;align-items: center; justify-content: center; top:0; left:0; width:100%;height:100vh; background:rgba(0, 0, 0, 0.5);}
.Hidden_box_to{position: relative; padding: 8px; width:95%;height:auto; background-color: #fff; box-sizing: border-box; border-radius:0.5em;}
.Hidden_box_to.addcart_box{ position: absolute; bottom:0; width:100%;border-radius:0.5em 0.5em 0 0;}
.Hidden_box_to .close{position: absolute; right:0.5em; top:0.5em; width:1.5em; height:1.5em; padding:0.15em; background-color:#fff;border:1px solid #f1f1f1;border-radius:50%;box-sizing:border-box;}
.Hidden_box_to .close image{width:100%;height:100%;}
.Hidden_box_to .title{ width:100%;height:2.5em;line-height: 2.5em; font-weight: 800; border-bottom:1px solid #f1f1f1;}
.Hidden_box_to .body{line-height:1.5em; color:#939393;max-height:80vh; overflow-y: auto;}
.Hidden_box_to .body .title{ width:100%;height:2.5em; line-height: 2.5em; text-align: center;}
.Hidden_box_to .body img{max-width:100%;}
.nodata{padding-top:1em; text-align: center; line-height: 1.5em; color:#939393;}
.nodata image {
width: 80px;
height: 80px;
}