From 4b48bacef8646cee8b66f5e10b0ed7124534e93e Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 12 五月 2023 17:10:47 +0800
Subject: [PATCH] 首页修改
---
miniprogram/pages/user/group/index.ts | 112 +++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 79 insertions(+), 33 deletions(-)
diff --git a/miniprogram/pages/user/group/index.ts b/miniprogram/pages/user/group/index.ts
index 3d4f850..707e8cf 100644
--- a/miniprogram/pages/user/group/index.ts
+++ b/miniprogram/pages/user/group/index.ts
@@ -6,19 +6,33 @@
data: {
groupList: []
},
- openGroup(e){
- console.log(e)
- wx.navigateTo({
- url:"../../user/group/message/index?id="+e.currentTarget.id+"&&ban="+e.currentTarget.dataset.ban+"&&reportId="+e.currentTarget.dataset.rptid
- })
+ toHome() {
+ wx.navigateBack()
},
- onLoad() {
+ onTabItemTap() {
+
+ this.getmessList()
+ },
+ openGroup(e) {
+ if (wx.getStorageSync('role')==1) {
+ wx.navigateTo({
+ url: "../../manager/group/message/index?id=" + e.currentTarget.id
+ })
+ }else{
+ wx.navigateTo({
+ url: "../../user/group/message/index?id=" + e.currentTarget.id + "&&ban=" + e.currentTarget.dataset.ban + "&&reportId=" + e.currentTarget.dataset.rptid
+ })
+ }
+
+
+ },
+ getmessList(){
var date = new Date()
var month = date.getMonth() + 1
var day = date.getDate()
- var hours=date.getHours()
- var minutes=date.getMinutes()
- var secends=date.getSeconds()
+ var hours = date.getHours()
+ var minutes = date.getMinutes()
+ var secends = date.getSeconds()
var time
if (month < 10) {
month = "0" + month
@@ -35,29 +49,61 @@
if (secends < 10) {
secends = "0" + secends
}
- time = date.getFullYear() + "-" + month + "-" + day + " " + hours+":"+minutes+":"+secends
-console.log(time)
-console.log("lastDate",wx.getStorageSync('time'))
-var lastTime=wx.getStorageSync('time')
- wx.request(
- {
- url: userGroup.globalData.url + "/wx/user/group/list",
- method: "GET",
- data:{
- id:wx.getStorageSync('id'),
- newDate:time,
- lastDate:lastTime
- },
- header: { 'token': wx.getStorageSync('token') },
- success: (res) => {
- console.log(res.data.data)
- this.setData({
- groupList: res.data.data
- })
- }
-
- })
-
-
+ time = date.getFullYear() + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + secends
+ var lastTime = wx.getStorageSync('time')
+ console.log(wx.getStorageSync('role'));
+ if (wx.getStorageSync('role')==1) {
+ wx.request(
+ {
+ url: userGroup.globalData.url + "/wx/manager/group/list",
+ method: "GET",
+ data: {
+ id: wx.getStorageSync('id'),
+ newDate: time,
+ lastDate: lastTime
+ },
+ header: { 'token': wx.getStorageSync('token') },
+ success: (res) => {
+ console.log(res.data.data)
+ res.data.data.map(item => {
+ if (item.time) {
+ item.time = item.time.substr(-8)
+ }
+ })
+ this.setData({
+ groupList: res.data.data
+ })
+ }
+
+ })
+ }else{
+ wx.request(
+ {
+ url: userGroup.globalData.url + "/wx/user/group/list",
+ method: "GET",
+ data: {
+ id: wx.getStorageSync('id'),
+ newDate: time,
+ lastDate: lastTime
+ },
+ header: { 'token': wx.getStorageSync('token') },
+ success: (res) => {
+ console.log(res.data.data)
+ res.data.data.map(item => {
+ console.log(item);
+ item.time = item.time.replace(/-/g,"/")
+ })
+ this.setData({
+ groupList: res.data.data
+ })
+ }
+ })
+ }
+ },
+ onLoad() {
+
+ this.getmessList()
+
+
}
})
--
Gitblit v1.8.0