Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-ces
Project
Project
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
wangqinghua
wisdom-ces
Commits
eb76b5e3
Commit
eb76b5e3
authored
Sep 27, 2018
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
ae1171e4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
125 deletions
+49
-125
app.component.ts
src/app/app.component.ts
+1
-1
login.html
src/pages/login/login.html
+0
-3
home.ts
src/pages/tabs/home/home.ts
+0
-108
version.html
src/pages/version/version.html
+5
-9
version.ts
src/pages/version/version.ts
+37
-4
appHttpService.ts
src/service/appHttpService.ts
+6
-0
No files found.
src/app/app.component.ts
View file @
eb76b5e3
...
...
@@ -45,7 +45,7 @@ export class MyApp {
console
.
log
(
'getVersionNumber:'
+
err
);
});
//log角标数目显示
badge
.
set
(
10
);
badge
.
set
(
2
);
});
}
}
src/pages/login/login.html
View file @
eb76b5e3
<ion-header>
<ion-toolbar>
<div
class=
"searchToolBar"
>
<!-- <button ion-button clear small navPop style="padding: 0;">
<img class="back-btn" src="./assets/imgs/back.png" />
</button> -->
<ion-title
text-center
>
用户登录
</ion-title>
...
...
src/pages/tabs/home/home.ts
View file @
eb76b5e3
...
...
@@ -159,7 +159,6 @@ export class HomePage {
ionViewWillEnter
()
{
//初始化日期
this
.
initDate
();
this
.
getHasNewActivity
();
this
.
getHasNewNotice
();
this
.
getHasNewPremanager
();
...
...
@@ -185,7 +184,6 @@ export class HomePage {
});
//初始化操作记录
this
.
initMineOperationInfo
();
}
goMyActivity
()
{
...
...
@@ -245,17 +243,6 @@ export class HomePage {
});
}
//获取公告
// getNotice(id) {
// this.appService.ObserverHttpPost("/wisdomgroup/modules/notice/getNoticeById", { id: id })
// .toPromise()
// .then(res => {
// let notice = res.json();
// })
// .catch(error => {
// });
// }
//获取报备
getPremanager
(
id
)
{
...
...
@@ -323,103 +310,8 @@ export class HomePage {
});
}
//获取当前是第几周
getWeekOfYear
()
{
var
today
=
new
Date
();
var
firstDay
=
new
Date
(
today
.
getFullYear
(),
0
,
1
);
var
dayOfWeek
=
firstDay
.
getDay
();
var
spendDay
=
1
;
if
(
dayOfWeek
!=
0
)
{
spendDay
=
7
-
dayOfWeek
+
1
;
}
firstDay
=
new
Date
(
today
.
getFullYear
(),
0
,
1
+
spendDay
);
var
d
=
Math
.
ceil
((
today
.
valueOf
()
-
firstDay
.
valueOf
())
/
86400000
);
var
result
=
Math
.
ceil
(
d
/
7
);
return
result
+
1
;
};
//初始化日历
initDate
()
{
this
.
weekNo
=
this
.
getWeekOfYear
();
var
date
=
new
Date
();
this
.
year
=
date
.
getFullYear
();
this
.
month
=
date
.
getMonth
()
+
1
;
//初始化周
var
day
=
date
.
getDay
();
var
today
=
date
.
getDate
();
for
(
let
item
of
this
.
week
)
{
var
count
=
item
.
id
-
day
;
var
now
=
new
Date
();
now
.
setTime
(
date
.
getTime
()
+
count
*
24
*
60
*
60
*
1000
);
item
.
date
=
now
.
getDate
();
if
(
count
==
0
)
{
item
.
isToday
=
true
;
}
}
}
//创建日历
myCalendar
()
{
this
.
calendar
.
createCalendar
(
'日历'
).
then
(
(
msg
)
=>
{
console
.
log
(
msg
);
},
(
err
)
=>
{
console
.
log
(
err
);
}
);
this
.
calendar
.
openCalendar
(
new
Date
()).
then
(
(
msg
)
=>
{
console
.
log
(
msg
);
},
(
err
)
=>
{
console
.
log
(
err
);
}
);
}
///操作记录
initMineOperationInfo
()
{
let
order
=
this
.
appService
.
ObserverHttpPost
(
"/wisdomgroup/opertion/searchOperationInfo"
,
{
"P_pageNumber"
:
0
,
"P_pageSize"
:
3
})
.
subscribe
((
res
:
Response
)
=>
{
let
data
=
res
.
json
();
this
.
operations
=
data
.
list
;
console
.
log
(
JSON
.
stringify
(
this
.
operations
));
this
.
operations
.
forEach
(
element
=>
{
let
timegap
=
Date
.
parse
(
new
Date
().
toString
())
-
Date
.
parse
(
element
[
"opertionTime"
].
toString
());
let
timegapvalue
=
this
.
timeshift
(
timegap
);
element
[
"timegapvalue"
]
=
timegapvalue
;
//显示25字
let
content
=
element
[
"opertionContent"
];
if
(
content
.
length
>
25
)
{
element
[
"opertionContent"
]
=
content
.
substr
(
0
,
25
)
+
"..."
;
}
});
},
error
=>
{
this
.
appService
.
alert
(
'网络异常!'
);
}
);
}
timeshift
(
timegap
:
number
):
string
{
let
result
:
string
;
let
nd
=
1000
*
24
*
60
*
60
;
//一天的毫秒数
let
nh
=
1000
*
60
*
60
;
//一小时的毫秒数
let
nm
=
1000
*
60
;
//一分钟的毫秒数
let
ns
=
1000
;
//一秒钟的毫秒数
let
day
=
Math
.
round
(
timegap
/
nd
);
//计算差多少天
let
hour
=
Math
.
round
(
timegap
%
nd
/
nh
);
//计算差多少小时
let
min
=
Math
.
round
(
timegap
%
nd
%
nh
/
nm
);
//计算差多少分钟
let
sec
=
Math
.
round
(
timegap
%
nd
%
nh
%
nm
/
ns
);
//计算差多少秒//输出结果
console
.
log
(
"时间相差:"
+
day
+
"天"
+
hour
+
"小时"
+
min
+
"分钟"
+
sec
+
"秒。"
);
if
(
day
>
0
)
{
result
=
day
+
"天前"
;
}
else
if
(
hour
>
0
)
{
result
=
hour
+
"小时前"
;
}
else
if
(
min
>
0
)
{
result
=
min
+
"分钟前"
;
}
else
{
result
=
sec
+
"几秒前"
;
}
//result = day+"天"+hour+"小时"+min+"分钟"+sec+"秒"+"前";
return
result
;
}
//消息通知
gotoNotice
(){
...
...
src/pages/version/version.html
View file @
eb76b5e3
<ion-header>
<ion-toolbar>
<div
class=
"searchToolBar"
>
<button
ion-button
clear
small
navPop
style=
"padding: 0;"
>
<img
class=
"back-btn"
src=
"./assets/imgs/back.png"
/>
</button>
<ion-navbar>
<ion-title
text-center
>
设置
</ion-title>
</div>
</ion-toolbar>
</ion-navbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item>
<ion-label>
是否接受推送消息
</ion-label>
<ion-toggle
checked=
"false
"
></ion-toggle>
<ion-toggle
[(
ngModel
)]="
pusNumber
"
(
ionChange
)="
savePush
()
"
></ion-toggle>
</ion-item>
<ion-item>
<span>
当前版本
</span>
<span
float-right
>
{{version}}
</span>
</ion-item>
</ion-list>
<button
class=
"submit-btn submit"
(
click
)="
log
inOut
()"
>
退出
</button>
<button
class=
"submit-btn submit"
(
click
)="
log
outApp
()"
>
退出
</button>
</ion-content>
\ No newline at end of file
src/pages/version/version.ts
View file @
eb76b5e3
...
...
@@ -3,6 +3,8 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
import
{
AppService
}
from
'../../service/appHttpService'
;
import
{
AppVersion
}
from
'@ionic-native/app-version'
;
import
{
AppUpdateService
}
from
'../../service/appUpdateService'
;
import
{
Storage
}
from
"@ionic/storage"
;
import
{
LoginPage
}
from
"../login/login"
;
@
IonicPage
()
@
Component
({
...
...
@@ -14,21 +16,41 @@ export class VersionPage {
version
:
string
=
''
;
latestVersion
:
string
=
''
;
isLatest
:
boolean
=
true
;
pusNumber
:
boolean
;
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
public
appService
:
AppService
,
private
appUpdateService
:
AppUpdateService
,
private
appVersion
:
AppVersion
private
appVersion
:
AppVersion
,
private
storage
:
Storage
)
{
}
ionViewWillEnter
()
{
this
.
getversion
();
this
.
getAppPush
();
}
//获取推送开关
getAppPush
(){
this
.
appService
.
ObserverHttpGet
(
'/wisdomgroup/modules/common/file/getAppPush'
,
null
)
.
subscribe
(
(
res
)
=>
{
this
.
pusNumber
=
res
.
json
();
}
)
}
//保存推送开关
savePush
(){
this
.
appService
.
ObserverHttpGetAdd
(
'/wisdomgroup/modules/common/file/addAppPush/'
,
this
.
pusNumber
)
.
subscribe
(
(
res
)
=>
{}
)
}
//获取最新版本信息
getversion
()
{
//检测是否需要更新
...
...
@@ -53,8 +75,19 @@ export class VersionPage {
this
.
appUpdateService
.
downloadApp
(
"/wisdomgroup/app/download"
);
}
loginOut
(){
//后台退出
logoutApp
()
{
let
length
=
this
.
navCtrl
.
length
();
this
.
navCtrl
.
remove
(
length
);
this
.
storage
.
clear
();
this
.
appService
.
ObserverHttpGet
(
"/wisdomgroup/app/logout"
,
null
)
.
subscribe
((
res
:
Response
)
=>
{
let
data
=
res
.
json
();
this
.
navCtrl
.
push
(
'LoginPage'
);
},
error
=>
{
this
.
appService
.
alert
(
'网络异常!'
);
}
);
}
}
src/service/appHttpService.ts
View file @
eb76b5e3
...
...
@@ -82,6 +82,12 @@ export class AppService {
return
this
.
http
.
get
(
url
,
params
)
//本地
}
//get请求
ObserverHttpGetAdd
(
url
,
params
):
Observable
<
any
>
{
// return this.http.get(AppGlobal.domain+url+ params) //app
return
this
.
http
.
get
(
url
+
params
)
//本地
}
//get请求带?的
ObserverHttpGetOption
(
url
,
params
):
Observable
<
any
>
{
// return this.http.get(AppGlobal.domain+url,{params: params}); //app
...
...
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