Commit bd586ef6 by 黄秀兰

up

parent cc1a9f0c
......@@ -26,6 +26,8 @@ App({
_this.api[key] = promisify(wx[key]);
});
wx.setStorageSync('user', '');
// 登录
login(this);
},
......
......@@ -49,7 +49,7 @@ function renderSliderData ( res, root_images ) {
// create_time
var create_time;
create_time = exif.create_time;
if ( exif.create_time.search(/\//g) == -1 ) {
if ( exif.create_time.search(/\//g) == -1 && create_time ) {
var create_time_arr = exif.create_time.split(' ');
var create_time_date= create_time_arr[0].split(':').join('-');
......
......@@ -453,13 +453,16 @@ Page({
var _this = this;
var p1 = this.loadTopPhoto(current);
var p2 = this.loadPhotos(current);
var today_obj = this.formatTimeStamp(Date.now());
var today = today_obj.year + '-' + today_obj.month + '-' + today_obj.date;
this.refreshData(p1, p2).then(res => {
var top = res[0];
var photos = res[1];
var len = photos.length;
if ( len == 0 ) {
if ( len == 0 && isEmptyObj(top) ) {
var date;
var timestamp = new Date(current).getTime();
......@@ -476,12 +479,16 @@ Page({
date = next_obj.year + '-' + next_obj.month + '-' + next_obj.date;
}
if ( today == current ) {
_this.init();
};
_this.circleGetCurrent(date, type);
}
else {
wx.hideLoading();
_this.changeDate(current);
_this.setData({
return _this.setData({
top_photo: top,
photos: photos,
load_state: root_reducer.load_state
......
......@@ -59,9 +59,22 @@ Page({
this.is_uploading = false;
this.renderTags();
app.globalData.puzzelData.forEach(function ( item, idx ) {
item.index = idx;
});
var len = app.globalData.puzzelData.length;
// 一次性添加了大于9张图片
if ( len > 9 ) {
app.globalData.puzzelData.splice(9);
wx.showToast({
title: '最多上传9张图片'
});
};
len = app.globalData.puzzelData.length;
assignImgInfo(len, app.globalData.puzzelData);
this.setData({
photos: app.globalData.puzzelData
......@@ -207,8 +220,54 @@ Page({
});
}, err => {
console.log(err);
var code = err.data.code;
var msg = err.data.message;
if ( code === 500002 ) {
var tags = _this.data.tags;
var selectedTags = _this.data.selectedTags;
var len = tags.length;
var tag_id = err.data.data.id;
var idx;
var is_exit = tags.some(function ( item, index ) {
if ( item.id == tag_id ) {
idx = index;
}
return item.id == tag_id
});
if ( !is_exit ) {
var tag = {};
tag.id = tag_id;
tag.text = err.data.data.text;
tag.is_selected = true;
tags.push(tag);
selectedTags.push(tag);
return _this.setData({
tags: tags,
selectedTags: selectedTags,
value: ''
});
}
else {
if ( !tags[idx].is_selected ) {
tags[idx].is_selected = true;
selectedTags.push(tags[idx]);
return _this.setData({
tags: tags,
selectedTags: selectedTags,
value: ''
});
}
}
};
if ( msg ) {
wx.showToast({
title: msg
......@@ -290,7 +349,8 @@ Page({
});
wx.showLoading({
title: '图片正在上传中'
title: '图片正在上传中',
mask: true
});
if ( !this.is_uploading ) {
......@@ -467,10 +527,23 @@ Page({
var _this = this;
addPhoto().then( photos => {
var len = photos.length;
if ( len > 9 ) {
photos.splice(9);
wx.showToast({
title: '最多上传9张图片'
});
}
photos.forEach(function ( item, idx ) {
item.index = idx;
});
len = photos.length;
assignImgInfo(len, photos);
_this.setData({
photos: photos
});
......
<block wx:if="{{ route == 'puzzel' }}">
<view class="puzzel">
<button class="btn btn-add-photo" bindtap="addPhoto">添加照片</button>
<view class="tips" wx:if="{{ photos.length > 1 }}">拖动图片可以调整顺序</view>
<view class="tips" wx:if="{{ photos.length > 1 }}">拖动可调整顺序,长按删除,预览方向不影响上传结果</view>
<view class="photos photos-{{ photos.length }}" bindtouchstart="startMove" bindtouchmove="move" bindtouchend="endMove" bindlongtap="delPhoto">
<block wx:for="{{ photos }}" wx:key="item">
<image data-index="{{ index }}" src="{{ item.src }}" class="photo photo-{{ index + 1 }}" mode="aspectFill" style="width: {{ item.width }}px; height: {{ item.height }}px; top: {{ item.y }}px; left: {{ item.x }}px; opacity: {{ item.opacity }}; z-index: {{ item.zIndex }}"></image>
......@@ -21,7 +21,7 @@
<!-- 编辑框 -->
<view class="edit-content">
<textarea placeholder="说点什么吧~限140字" placeholder-style="color: #999" bindblur="getContentValue" bindinput="changeTips" value="{{ content }}"/>
<textarea placeholder="和大家分享分享照片背后的故事(限140字)" placeholder-style="color: #999" bindblur="getContentValue" bindinput="changeTips" value="{{ content }}"/>
<view class="tips" hidden="{{ remain.hidden }}">还可以输入{{ remain.num }}字</view>
</view>
......
......@@ -41,8 +41,6 @@ function addPhoto ( route ) {
console.log(err);
});
})).then( arr => {
var total_len = app.globalData.puzzelData.length;
assignImgInfo(total_len, app.globalData.puzzelData);
if ( route ) {
var is_navigate = route_arr.some(function ( item ) {
......@@ -52,20 +50,14 @@ function addPhoto ( route ) {
});
if ( is_navigate ) {
wx.navigateTo({
return wx.navigateTo({
url: '../upload-photo/upload-photo'
});
}
}
if ( total_len > 9 ) {
app.globalData.puzzelData.splice(9);
return wx.showToast({
title: '最多上传9张图片'
});
};
return Promise.resolve(app.globalData.puzzelData);
}, err => {
console.log(err);
......
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