123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- const app = require('../../utils/util.js');
- const tools = require('../../utils/tools.js');
- Page({
- data: {
- active: 0,
- wdArr: [],
- ydArr: [],
- showNull: false,
- showNull1: false
- },
- getNotice(){
- wx.showLoading();
- wx.getStorage({
- key: 'noticeArr',
- success:(res)=>{
- console.log(res);
- wx.hideLoading();
- this.setData({
- wdArr:res.data.data.notReadAfficheList,
- ydArr:res.data.data.readAfficheList,
- showNull:res.data.data.notReadAfficheList.length>0?false:true,
- showNull1:res.data.data.readAfficheList.length>0?false:true,
- })
-
- },
- fail:()=>{
- wx.hideLoading();
- }
- })
- },
- getNoticeArr(sessionKey,active){
- console.log("getNoticeArr");
- wx.showLoading();
- wx.request({
- url: app.globalData.publicUrl + '/wx/eduNoticeSee/afficheLists',
- method: "post",
- data: {
- sessionKey: sessionKey,
- // isSee: 1
- // // isNotice: 0
- },
- success: (res) => {
- console.log(res);
- wx.hideLoading();
- if (res.data.code == 0) {
-
-
- if(active){
- console.log("1");
- if(active==0){
-
- this.setData({
- wdArr:res.data.data.notReadAfficheList,
- ydArr:res.data.data.readAfficheList,
-
- showNull1:res.data.data.readAfficheList.length>0?false:true,
- })
- }else{
- this.setData({
- wdArr:res.data.data.notReadAfficheList,
- ydArr:res.data.data.readAfficheList,
- showNull:res.data.data.notReadAfficheList.length>0?false:true,
-
- })
- }
- }else{
- console.log("2");
- this.setData({
- wdArr:res.data.data.notReadAfficheList,
- ydArr:res.data.data.readAfficheList,
- showNull:res.data.data.notReadAfficheList.length>0?false:true,
- showNull1:res.data.data.readAfficheList.length>0?false:true,
- })
- }
- } else {
- if(active){
- if(active==0){
- this.setData({
- wdArr:res.data.data.notReadAfficheList,
- ydArr:res.data.data.readAfficheList,
-
- showNull1:res.data.data.readAfficheList.length>0?false:true,
- })
- }else{
- this.setData({
- wdArr:res.data.data.notReadAfficheList,
- ydArr:res.data.data.readAfficheList,
- showNull:res.data.data.notReadAfficheList.length>0?false:true,
-
- })
- }
- }
-
- }
- },
- fail: () => {
- console.log("fal");
- console.log("active",typeof active);
- wx.hideLoading();
- wx.showModal({
- showCancel: false,
- content: "网络错误"
- })
- // if(typeof active=="number"){
-
- // if(active==0){
-
- // console.log("weidu");
- // this.setData({
- // wdArr:[],
- // showNull:true,
- // })
- // }else{
- // this.setData({
- // ydArr:[],
- // showNull1:true,
-
- // })
- // }
- // }
- }
- })
- },
- getArr(sessionKey) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/eduNoticeSee/list',
- method: "post",
- data: {
- sessionKey: sessionKey,
- isSee: 1
- // isNotice: 0
- },
- success: (res) => {
- if (res.data.code == 0) {
- if (res.data.list.length !== 0) {
- this.setData({
- showNull: false,
- wdArr: res.data.list
- })
- } else {
- this.setData({
- wdArr: res.data.list,
- showNull: true
- })
- }
- } else {
- this.setData({
- showNull: true
- })
- }
- },
- fail: () => {
- this.setData({
- showNull: true
- })
- }
- })
- },
- getArr1(sessionKey) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/eduNoticeSee/list',
- method: "post",
- data: {
- sessionKey: sessionKey,
- isSee: 0
- // isNotice: 0
- },
- success: (res) => {
- if (res.data.code == 0) {
- if (res.data.list.length !== 0) {
- this.setData({
- showNull1: false,
- ydArr: res.data.list
- })
- } else {
- this.setData({
- ydArr: res.data.list,
- showNull1: true
- })
- }
- } else {
- this.setData({
- showNull1: true
- })
- }
- },
- fail: () => {
- this.setData({
- showNull1: true
- })
- }
- })
- },
- async onChange(event) {
- console.log("onCHange");
- const sessionKey = await tools.checkSessionAndLogin();
- this.getNoticeArr(sessionKey,event.detail.index);
-
- },
- meRead(sessionKey, noticeId) {
- wx.request({
- url: app.globalData.publicUrl + '/wx/eduNoticeSee/edit',
- method: "post",
- data: {
- sessionKey: sessionKey,
- isSee: 0,
- noticeId: noticeId
- },
- success: () => {
- console.log("meRead",noticeId);
- this.getNoticeArr(sessionKey)
- }
- })
- },
- async btn(e) {
- console.log(e.currentTarget.dataset.item.id);
- let noticeId = e.currentTarget.dataset.item.id;
- const sessionKey = await tools.checkSessionAndLogin();
- this.meRead(sessionKey, noticeId);
- },
- async onLoad() {
- const sessionKey = await tools.checkSessionAndLogin();
- this.getNotice();
- //this.getArr(sessionKey);
- }
- })
|