123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- import {
- ApiModel
- } from "../../utils/api";
- const _Http = new ApiModel();
- let processingData = require('../../utils/processingData.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- swiperBannerList: [], //轮播图
- tabsList: ['通告列表', '历史发布'], //tab列表
- tabsIndex: 0, //tab选中项
- showType: "官方", //请求列表类型
- pageNumber: 1, //获取页码
- pageTotal: 1, //总页码
- /* 圆角按钮tabs列表 */
- roundedList: ["家纺城通告", "合作商通告", "团队通告"],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- /* //分类
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "enterprise.system.notice",
- "method": "query_typeselectList",
- "content": {}
- }).then(res => {
- console.log(res)
- }) */
- /* 获取轮播图 */
- const bannerList = wx.getStorageSync('bannerDataList').filter(value => value.flocation == 'home_head');
- this.setData({
- swiperBannerList: bannerList[0].banner
- });
- },
- /* 跳转详情 */
- toDetails(e) {
- const {
- index
- } = e.currentTarget.dataset;
- wx.navigateTo({
- url: './details?id=' + this.data.annunciateList[index].tnoticeid + '&type=' + this.data.tabsIndex,
- })
- },
- /* 获取列表 */
- getList() {
- //历史发布
- let data = {
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.notice.notice",
- "method": "query_noticeList",
- "content": {
- "getdatafromdbanyway": true,
- "pageNumber": this.data.pageNumber,
- "pageSize": 20,
- "where": {
- "condition": "",
- "ftype": this.data.showType
- }
- }
- };
- if (this.data.tabsIndex == 1) {
- data.classname = 'customer.noticemag.noticemag';
- data.content.where.ftype = '';
- };
- _Http.basic(data).then(res => {
- let list = processingData.annunciateCheckdate(res.data),
- data = [];
- if (this.data.pageNumber == 1) {
- data = processingData.imageType(list, 'cover');
- } else {
- let L = this.data.annunciateList;
- data = L.concat(processingData.imageType(list, 'cover'));
- }
- this.setData({
- annunciateList: data,
- pageTotal: res.pageTotal
- })
- })
- },
- /* 历史发布修改 */
- toChang(e) {
- const {
- index
- } = e.currentTarget.dataset;
- wx.navigateTo({
- url: './newAndChange?id=' + this.data.annunciateList[index].tnoticeid,
- });
- },
- /* 查询数据 */
- toQueryData(e) {
- const {
- index
- } = e.currentTarget.dataset;
- wx.navigateTo({
- url: './glanceover?id=' + this.data.annunciateList[index].tnoticeid,
- })
- },
- /* 发布公告 */
- toAnnounce() {
- wx.navigateTo({
- url: '/pages/annunciate/newAndChange',
- })
- },
- /* tab切换 */
- setIndex({
- detail
- }) {
- this.setData({
- tabsIndex: detail
- });
- this.initializePage();
- this.getList();
- },
- /* tabs回调 */
- tabsSelectedIitem({
- detail
- }) {
- let showType = null;
- switch (detail) {
- case "家纺城通告":
- showType = '官方'
- break;
- case "合作商通告":
- showType = '商户'
- break;
- case "团队通告":
- showType = '团队'
- break;
- default:
- showType = ''
- break;
- }
- this.setData({
- showType
- });
- this.initializePage();
- this.getList();
- },
- /* 初始化分页数据 */
- initializePage() {
- this.setData({
- pageNumber: 1,
- pageTotal: 1
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getList()
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- if (this.data.pageNumber < this.data.pageTotal) {
- this.setData({
- pageNumber: this.data.pageNumber + 1
- });
- this.getList()
- }
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|