Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
schedule
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fengzhaoyu
schedule
Commits
22b0868b
Commit
22b0868b
authored
Oct 09, 2020
by
xiexiaoqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: 添加websocket
parent
115d8100
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
61 deletions
+48
-61
index.js
pages/index/index.js
+48
-61
No files found.
pages/index/index.js
View file @
22b0868b
import
{
RRule
}
from
"rrule"
;
import
{
getDynamicList
,
meetingCollection
,
updateMeetingTask
,
getHomeUserSchedule1
}
from
"../../api/request"
;
...
...
@@ -20,13 +19,14 @@ import {
getCreateShowTime
}
from
"../../utils/utils"
;
import
{
checkFullScren
}
from
"../../utils/checkFullScren"
;
import
create
from
"dd-store"
;
import
pageStore
from
'../meetingDetail/store'
;
const
currentDate
=
new
Date
();
const
minYear
=
2020
;
const
minYear
=
currentDate
.
getFullYear
()
;
const
maxYear
=
currentDate
.
getFullYear
()
+
1
;
let
DateMap
=
getDateMap
(
minYear
,
maxYear
);
const
weekList
=
[
"周日"
,
"周一"
,
"周二"
,
"周三"
,
"周四"
,
"周五"
,
"周六"
];
import
create
from
"dd-store"
;
let
maxClickCount
=
5
;
create
.
Page
({
...
...
@@ -51,7 +51,6 @@ create.Page({
pages
:
1
,
listLoading
:
true
,
isIPX
:
checkFullScren
(),
scheduleListIndex
:
''
},
scrollTop
:
0
,
pageSize
:
10
,
...
...
@@ -125,6 +124,45 @@ create.Page({
await
this
.
addOnceMeeting
(
content
)
}
this
.
update
();
this
.
connect_start
();
// 注意: 回调方法的注册在整个小程序启动阶段只要做一次,调多次会有多次回调
dd
.
onSocketOpen
((
res
)
=>
{
dd
.
alert
({
content
:
'连接已打开!'
});
setInterval
(()
=>
{
dd
.
sendSocketMessage
({
data
:
'heartbeat'
,
// 需要发送的内容
success
:
(
res
)
=>
{
dd
.
alert
({
content
:
'数据发送!'
+
'heartbeat'
});
},
});
},
1000
)
});
dd
.
onSocketError
(
function
(
res
)
{
dd
.
alert
(
'WebSocket 连接打开失败,请检查!'
+
res
);
});
// 注意: 回调方法的注册在整个小程序启动阶段只要做一次,调多次会有多次回调
dd
.
onSocketMessage
((
res
)
=>
{
dd
.
alert
({
content
:
'收到数据!'
+
JSON
.
stringify
(
res
)
});
});
},
connect_start
()
{
dd
.
connectSocket
({
url
:
`ws://139.196.213.18:9999/meet-websocket/websocket/
${
getApp
().
globalData
.
userid
}
`
,
// 开发者服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名
success
:
(
res
)
=>
{
},
fail
:
()
=>
{
dd
.
showToast
({
content
:
'fail'
,
// 文字内容
});
}
});
},
//添加单次会议
async
addOnceMeeting
(
content
)
{
...
...
@@ -221,26 +259,14 @@ create.Page({
});
},
onHide
()
{
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
//
clearInterval(this.timer);
//
this.timer = null;
},
refresh
()
{
this
.
isNeverShowSchedulePage
=
true
;
this
.
isLoaded
=
false
;
this
.
onLoad
();
},
//动态列表侧滑的时候禁止页面上下滑动
setBodyDisableScroll
(
isStopBodyScroll
)
{
this
.
setData
({
isStopBodyScroll
});
},
//点击页面关闭侧滑模块
closeSwipe
()
{
if
(
this
.
$store
.
closeActiveSwipe
)
{
this
.
$store
.
closeActiveSwipe
();
}
},
getPages
(
current
,
callBack
)
{
getDynamicList
()
.
then
(
res
=>
{
...
...
@@ -276,47 +302,6 @@ create.Page({
}
});
},
//动态置顶
changeCollection
(
e
)
{
const
{
index
,
scheduleId
,
collection
}
=
e
.
target
.
dataset
;
meetingCollection
({
scheduleId
,
collection
}).
then
(
res
=>
{
//取消置顶
if
(
collection
===
"N"
)
{
// 重新获取第一页的数据
this
.
getPages
(
1
,
()
=>
{
dd
.
showToast
({
content
:
"取消成功"
});
});
}
else
{
//置顶
const
dynamicList
=
this
.
data
.
dynamicList
;
const
replaceItem
=
dynamicList
[
index
];
dynamicList
[
index
].
traceTime
=
res
.
data
.
data
;
dynamicList
.
splice
(
index
,
1
);
dynamicList
.
unshift
(
replaceItem
);
this
.
setData
(
{
dynamicList
:
dynamicList
},
()
=>
{
dd
.
showToast
({
content
:
"置顶成功"
});
}
);
}
});
},
//动态上拉加载分页数据
// onScrollToLower() {
// if (this.data.current < this.data.pages) {
// this.getPages(this.data.current + 1);
// }
// },
//动态修改状态
onChangeTaskStatusOnList
(
e
)
{
const
data
=
{
...
...
@@ -765,8 +750,8 @@ create.Page({
dd
.
navigateTo
({
url
:
"./../createMeeting/createMeeting"
});
},
nextDetail
:
throttle
(
function
(
e
)
{
const
{
item
}
=
e
.
target
.
dataset
;
const
scheduleItem
=
{
scheduleId
:
item
.
meetingId
||
item
.
id
,
scheduleTemplateId
:
item
.
scheduleTemplateId
,
planDate
:
item
.
planDate
}
const
{
item
,
groupId
}
=
e
.
target
.
dataset
;
const
scheduleItem
=
{
groupId
,
scheduleId
:
item
.
meetingId
||
item
.
id
,
scheduleTemplateId
:
item
.
scheduleTemplateId
,
planDate
:
item
.
planDate
}
dd
.
navigateTo
({
url
:
`./../meetingDetail/meetingDetail?scheduleItem=
${
encodeURIComponent
(
JSON
.
stringify
(
scheduleItem
))}
`
});
...
...
@@ -832,9 +817,11 @@ create.Page({
//切换到动态页面时,日程重置成当前日期
if
(
tabbar
==
"0"
)
{
this
.
lastOffset
=
this
.
data
.
offset
;
setTimeout
(()
=>
{
this
.
setData
({
offset
:
"stop"
});
},
500
)
}
else
if
(
!
this
.
isNeverShowSchedulePage
)
{
this
.
setData
({
offset
:
this
.
lastOffset
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment