Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mp_snapshot
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄秀兰
mp_snapshot
Commits
91e8a06b
Commit
91e8a06b
authored
Jul 20, 2017
by
黄秀兰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改昵称
parent
471c8d96
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
18 deletions
+82
-18
components/dialog/dialog.js
+3
-1
components/dialog/dialog.wxml
+1
-1
pages/index/index.js
+61
-15
pages/index/index.wxml
+6
-0
pages/index/index.wxss
+1
-0
reducers.js
+10
-1
No files found.
components/dialog/dialog.js
View file @
91e8a06b
...
...
@@ -43,7 +43,8 @@ function verifyNickName ( value ) {
return
true
;
};
}
module
.
exports
=
{
export
default
{
getNickName
:
getNickName
,
changeNickName
:
changeNickName
}
\ No newline at end of file
components/dialog/dialog.wxml
View file @
91e8a06b
<template name="dialog">
<view class="dialog"
wx:if="{{ is_show_
dialog }}">
<view class="dialog"
hidden="{{
dialog }}">
<view class="dialog-wrap">
<input type="text" placeholder="请输入你在米拍使用的昵称" bindcomfirm="getNickName" bindblur="getNickName"/>
<button bindtap="changeNickName">确认</button>
...
...
pages/index/index.js
View file @
91e8a06b
...
...
@@ -8,9 +8,11 @@ import addPhoto from '../../util/addPhoto'
import
getRoute
from
'../../util/getRoute'
import
isEmptyObj
from
'../../util/isEmptyObj'
import
packingRequest
from
'../../util/packingRequest'
import
getAsynUserData
from
'../../util/getAsynUserData'
import
Load
from
'../../components/load/load'
import
sliderFunc
from
'../../components/slider/slider'
import
dialog
from
'../../components/dialog/dialog'
const
app
=
getApp
();
const
root
=
app
.
host
.
root
;
...
...
@@ -36,11 +38,12 @@ Page({
date_range
:
root_reducer
.
date_range
,
load_state
:
root_reducer
.
load_state
,
slider
:
root_reducer
.
slider
slider
:
root_reducer
.
slider
,
dialog
:
root_reducer
.
dialog
},
onLoad
:
function
()
{
var
_this
=
this
;
var
load_state
=
this
.
data
.
load_state
;
// 时间
var
now
=
Date
.
now
();
...
...
@@ -48,11 +51,36 @@ Page({
now
=
now_obj
.
year
+
'-'
+
now_obj
.
month
+
'-'
+
now_obj
.
date
;
this
.
changeDate
(
now
);
this
.
init
().
then
(
res
=>
{
getAsynUserData
(
function
(
user
)
{
if
(
typeof
user
==
'number'
&&
user
==
200012
)
{
_this
.
setData
({
dialog
:
false
});
}
});
},
err
=>
{
console
.
log
(
err
);
});
// 初始化加载更多
this
.
load
=
new
Load
(
url
.
photos
);
this
.
loadingHandler
=
this
.
load
.
throttel
(
this
.
loadMore
,
3000
);
// 下拉刷新
this
.
is_pull_down_refresh
=
false
;
},
init
:
function
()
{
var
_this
=
this
;
var
load_state
=
this
.
data
.
load_state
;
// 快拍第一
var
p1
=
this
.
loadTopPhoto
(
''
);
// 投稿作品
var
p2
=
this
.
loadPhotos
(
''
);
this
.
refreshData
(
p1
,
p2
).
then
(
res
=>
{
return
this
.
refreshData
(
p1
,
p2
).
then
(
res
=>
{
var
top
=
res
[
0
]
var
photos
=
res
[
1
];
var
len
=
photos
.
length
;
...
...
@@ -70,6 +98,9 @@ Page({
top_photo
:
top
,
photos
:
photos
});
wx
.
hideLoading
();
return
Promise
.
resolve
(
res
);
},
err
=>
{
var
status_code
=
err
.
statusCode
;
...
...
@@ -80,14 +111,10 @@ Page({
_this
.
setData
({
load_state
:
load_state
});
});
// 初始化加载更多
this
.
load
=
new
Load
(
url
.
photos
);
this
.
loadingHandler
=
this
.
load
.
throttel
(
this
.
loadMore
,
3000
);
wx
.
hideLoading
();
// 下拉刷新
this
.
is_pull_down_refresh
=
false
;
return
Promise
.
reject
(
err
);
})
;
},
renderTopPhoto
:
function
(
obj
)
{
var
render_obj
=
{};
...
...
@@ -172,6 +199,9 @@ Page({
var
current
=
obj
.
works_date
;
var
current_arr
=
current
.
split
(
'-'
);
var
current_month
=
+
current_arr
[
1
];
if
(
0
<
current_month
<
10
)
{
current_month
=
'0'
+
current_month
;
};
var
current_date
=
current_arr
[
2
];
var
current_day
=
new
Date
(
current
).
getDay
();
...
...
@@ -191,6 +221,9 @@ Page({
var
pre_arr
=
pre
.
split
(
'-'
);
var
pre_month
=
+
current_arr
[
1
];
var
pre_date
=
pre_arr
[
2
];
if
(
0
<
pre_month
<
10
)
{
pre_month
=
'0'
+
pre_month
;
};
render_date
.
pre_month
=
pre_month
;
render_date
.
pre_date
=
pre_date
;
};
...
...
@@ -364,6 +397,9 @@ Page({
},
getCurrent
:
function
(
date
,
type
)
{
var
_this
=
this
;
var
today_obj
=
this
.
formatTimeStamp
(
Date
.
now
());
var
today
=
today_obj
.
year
+
'-'
+
today_obj
.
month
+
'-'
+
today_obj
.
date
;
wx
.
showLoading
({
mask
:
true
});
...
...
@@ -389,6 +425,10 @@ Page({
};
}
else
{
if
(
today
==
date
)
{
_this
.
init
();
};
if
(
len
==
0
)
{
return
_this
.
circleGetCurrent
(
date
,
type
);
};
...
...
@@ -414,7 +454,6 @@ Page({
var
p1
=
this
.
loadTopPhoto
(
current
);
var
p2
=
this
.
loadPhotos
(
current
);
this
.
refreshData
(
p1
,
p2
).
then
(
res
=>
{
var
top
=
res
[
0
];
var
photos
=
res
[
1
];
...
...
@@ -494,6 +533,8 @@ Page({
var
route
=
getRoute
(
this
);
addPhoto
(
route
);
},
getNickName
:
dialog
.
getNickName
,
changeNicName
:
dialog
.
changeNickName
,
openSlider
:
sliderFunc
.
openSlider
,
closeSlider
:
sliderFunc
.
closeSlider
,
sliderNumChange
:
sliderFunc
.
sliderNumChange
,
...
...
@@ -543,13 +584,17 @@ Page({
},
onShareAppMessage
:
function
()
{
var
top
=
this
.
data
.
top_photo
;
var
name
=
'米拍|天天快拍 '
;
if
(
isEmptyObj
(
top
)
)
{
var
name
=
'米拍|天天快拍'
;
var
path
=
'/pages/index/index'
;
if
(
!
isEmptyObj
(
top
)
)
{
name
=
name
+
' TOP1'
;
}
else
{
return
{
title
:
name
,
path
:
path
}
}
});
\ No newline at end of file
pages/index/index.wxml
View file @
91e8a06b
<import src="../../components/load/load.wxml"></import>
<import src="../../components/slider/slider.wxml"></import>
<import src="../../components/dialog/dialog.wxml"></import>
<!-- 头部:日期选择 -->
<view class="head">
...
...
@@ -81,5 +82,9 @@
<!-- 查看大图 -->
<template is="slider" data="{{ slider }}"></template>
<!-- dialog -->
<template is="dialog" data="{{ dialog }}"></template>
<!-- 快拍 -->
<view class="btn-fastphoto" bindtap="uploadPhoto">快拍</view>
\ No newline at end of file
pages/index/index.wxss
View file @
91e8a06b
@import '../../components/nine-photo-layout/nine-photo-layout.wxss';
@import '../../components/load/load.wxss';
@import '../../components/slider/slider.wxss';
@import '../../components/dialog/dialog.wxss';
page {
padding-top: 80rpx;
...
...
reducers.js
View file @
91e8a06b
...
...
@@ -120,9 +120,17 @@ export default {
},
action
)
{
switch
(
action
.
type
)
{
case
'CHANGE_SLIDER'
:
return
action
.
slider
return
action
.
slider
default
:
return
state
}
},
dialog
(
state
=
true
,
action
)
{
switch
(
action
.
type
)
{
case
'SHOW_DIALOG'
:
return
action
.
dialog
default
:
return
state
;
}
}
}
\ No newline at end of file
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