Commit 91e8a06b by 黄秀兰

修改昵称

parent 471c8d96
...@@ -43,7 +43,8 @@ function verifyNickName ( value ) { ...@@ -43,7 +43,8 @@ function verifyNickName ( value ) {
return true; return true;
}; };
} }
module.exports = {
export default {
getNickName: getNickName, getNickName: getNickName,
changeNickName: changeNickName changeNickName: changeNickName
} }
\ No newline at end of file
<template name="dialog"> <template name="dialog">
<view class="dialog" wx:if="{{ is_show_dialog }}"> <view class="dialog" hidden="{{ dialog }}">
<view class="dialog-wrap"> <view class="dialog-wrap">
<input type="text" placeholder="请输入你在米拍使用的昵称" bindcomfirm="getNickName" bindblur="getNickName"/> <input type="text" placeholder="请输入你在米拍使用的昵称" bindcomfirm="getNickName" bindblur="getNickName"/>
<button bindtap="changeNickName">确认</button> <button bindtap="changeNickName">确认</button>
......
...@@ -8,9 +8,11 @@ import addPhoto from '../../util/addPhoto' ...@@ -8,9 +8,11 @@ import addPhoto from '../../util/addPhoto'
import getRoute from '../../util/getRoute' import getRoute from '../../util/getRoute'
import isEmptyObj from '../../util/isEmptyObj' import isEmptyObj from '../../util/isEmptyObj'
import packingRequest from '../../util/packingRequest' import packingRequest from '../../util/packingRequest'
import getAsynUserData from '../../util/getAsynUserData'
import Load from '../../components/load/load' import Load from '../../components/load/load'
import sliderFunc from '../../components/slider/slider' import sliderFunc from '../../components/slider/slider'
import dialog from '../../components/dialog/dialog'
const app = getApp(); const app = getApp();
const root = app.host.root; const root = app.host.root;
...@@ -36,11 +38,12 @@ Page({ ...@@ -36,11 +38,12 @@ Page({
date_range: root_reducer.date_range, date_range: root_reducer.date_range,
load_state: root_reducer.load_state, load_state: root_reducer.load_state,
slider: root_reducer.slider slider: root_reducer.slider,
dialog: root_reducer.dialog
}, },
onLoad: function () { onLoad: function () {
var _this = this; var _this = this;
var load_state = this.data.load_state;
// 时间 // 时间
var now = Date.now(); var now = Date.now();
...@@ -48,11 +51,36 @@ Page({ ...@@ -48,11 +51,36 @@ Page({
now = now_obj.year + '-' + now_obj.month + '-' + now_obj.date; now = now_obj.year + '-' + now_obj.month + '-' + now_obj.date;
this.changeDate(now); 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 p1 = this.loadTopPhoto('');
// 投稿作品 // 投稿作品
var p2 = this.loadPhotos(''); var p2 = this.loadPhotos('');
this.refreshData(p1, p2).then(res => {
return this.refreshData(p1, p2).then(res => {
var top = res[0] var top = res[0]
var photos = res[1]; var photos = res[1];
var len = photos.length; var len = photos.length;
...@@ -70,6 +98,9 @@ Page({ ...@@ -70,6 +98,9 @@ Page({
top_photo: top, top_photo: top,
photos: photos photos: photos
}); });
wx.hideLoading();
return Promise.resolve(res);
}, err => { }, err => {
var status_code = err.statusCode; var status_code = err.statusCode;
...@@ -80,14 +111,10 @@ Page({ ...@@ -80,14 +111,10 @@ Page({
_this.setData({ _this.setData({
load_state: load_state load_state: load_state
}); });
}); wx.hideLoading();
// 初始化加载更多
this.load = new Load(url.photos);
this.loadingHandler = this.load.throttel(this.loadMore, 3000);
// 下拉刷新 return Promise.reject(err);
this.is_pull_down_refresh = false; });
}, },
renderTopPhoto: function ( obj ) { renderTopPhoto: function ( obj ) {
var render_obj = {}; var render_obj = {};
...@@ -172,6 +199,9 @@ Page({ ...@@ -172,6 +199,9 @@ Page({
var current = obj.works_date; var current = obj.works_date;
var current_arr = current.split('-'); var current_arr = current.split('-');
var current_month = +current_arr[1]; var current_month = +current_arr[1];
if ( 0 < current_month < 10 ) {
current_month = '0' + current_month;
};
var current_date = current_arr[2]; var current_date = current_arr[2];
var current_day = new Date( current ).getDay(); var current_day = new Date( current ).getDay();
...@@ -191,6 +221,9 @@ Page({ ...@@ -191,6 +221,9 @@ Page({
var pre_arr = pre.split('-'); var pre_arr = pre.split('-');
var pre_month = +current_arr[1]; var pre_month = +current_arr[1];
var pre_date = pre_arr[2]; 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_month = pre_month;
render_date.pre_date = pre_date; render_date.pre_date = pre_date;
}; };
...@@ -364,6 +397,9 @@ Page({ ...@@ -364,6 +397,9 @@ Page({
}, },
getCurrent: function ( date, type ) { getCurrent: function ( date, type ) {
var _this = this; var _this = this;
var today_obj = this.formatTimeStamp(Date.now());
var today = today_obj.year + '-' + today_obj.month + '-' + today_obj.date;
wx.showLoading({ wx.showLoading({
mask: true mask: true
}); });
...@@ -389,6 +425,10 @@ Page({ ...@@ -389,6 +425,10 @@ Page({
}; };
} }
else { else {
if ( today == date ) {
_this.init();
};
if ( len == 0 ) { if ( len == 0 ) {
return _this.circleGetCurrent(date, type); return _this.circleGetCurrent(date, type);
}; };
...@@ -414,7 +454,6 @@ Page({ ...@@ -414,7 +454,6 @@ Page({
var p1 = this.loadTopPhoto(current); var p1 = this.loadTopPhoto(current);
var p2 = this.loadPhotos(current); var p2 = this.loadPhotos(current);
this.refreshData(p1, p2).then(res => { this.refreshData(p1, p2).then(res => {
var top = res[0]; var top = res[0];
var photos = res[1]; var photos = res[1];
...@@ -494,6 +533,8 @@ Page({ ...@@ -494,6 +533,8 @@ Page({
var route = getRoute(this); var route = getRoute(this);
addPhoto(route); addPhoto(route);
}, },
getNickName: dialog.getNickName,
changeNicName: dialog.changeNickName,
openSlider: sliderFunc.openSlider, openSlider: sliderFunc.openSlider,
closeSlider: sliderFunc.closeSlider, closeSlider: sliderFunc.closeSlider,
sliderNumChange: sliderFunc.sliderNumChange, sliderNumChange: sliderFunc.sliderNumChange,
...@@ -543,13 +584,17 @@ Page({ ...@@ -543,13 +584,17 @@ Page({
}, },
onShareAppMessage: function () { onShareAppMessage: function () {
var top = this.data.top_photo; 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
<import src="../../components/load/load.wxml"></import> <import src="../../components/load/load.wxml"></import>
<import src="../../components/slider/slider.wxml"></import> <import src="../../components/slider/slider.wxml"></import>
<import src="../../components/dialog/dialog.wxml"></import>
<!-- 头部:日期选择 --> <!-- 头部:日期选择 -->
<view class="head"> <view class="head">
...@@ -81,5 +82,9 @@ ...@@ -81,5 +82,9 @@
<!-- 查看大图 --> <!-- 查看大图 -->
<template is="slider" data="{{ slider }}"></template> <template is="slider" data="{{ slider }}"></template>
<!-- dialog -->
<template is="dialog" data="{{ dialog }}"></template>
<!-- 快拍 --> <!-- 快拍 -->
<view class="btn-fastphoto" bindtap="uploadPhoto">快拍</view> <view class="btn-fastphoto" bindtap="uploadPhoto">快拍</view>
\ No newline at end of file
@import '../../components/nine-photo-layout/nine-photo-layout.wxss'; @import '../../components/nine-photo-layout/nine-photo-layout.wxss';
@import '../../components/load/load.wxss'; @import '../../components/load/load.wxss';
@import '../../components/slider/slider.wxss'; @import '../../components/slider/slider.wxss';
@import '../../components/dialog/dialog.wxss';
page { page {
padding-top: 80rpx; padding-top: 80rpx;
......
...@@ -120,9 +120,17 @@ export default { ...@@ -120,9 +120,17 @@ export default {
}, action ) { }, action ) {
switch ( action.type ) { switch ( action.type ) {
case 'CHANGE_SLIDER': case 'CHANGE_SLIDER':
return action.slider return action.slider
default: default:
return state return state
} }
},
dialog ( state = true, action ) {
switch ( action.type ) {
case 'SHOW_DIALOG':
return action.dialog
default:
return state;
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment