Skip to content

Commit

Permalink
-1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
QlQlqiqi committed Sep 10, 2021
1 parent 780b4e8 commit 53891b0
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 58 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@

#### 设计前想好页面架构、页面间数据通信方式、前后端交互方式和时机,页面设计不能只依靠 absolute。

### 1.3.0:
### 1.3.0:

#### 完全重构数据交互和存储方式
##### -完全重构数据交互和存储方式

- 以前:
- 数据以本地为主,每一定时间(30s)同步到服务器一次。
Expand All @@ -49,6 +49,10 @@
- 数据以服务器为主,每次数据的更改都会及时同步到服务器。
- 需要 put / delete / post 的数据分别采用不同的方式,只针对该数据进行更改。

### 1.3.1

##### -修复部分机型标题栏高度过低的问题

### 小结

总的来说,此次项目较为简单,但是还有的地方没有处理好(左侧栏在特定情况下位置会偏移),作为上手的第一个项目较为合适。
4 changes: 3 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
App({
globalData: {
url: 'http://297mo66766.imdo.co/'
url: 'https://witime.wizzstudio.com/'
},
onLaunch() {
// 获取设备相关信息
Expand All @@ -18,6 +18,8 @@ App({
this.globalData.windowHeight = res.windowHeight;
// 可使用窗口宽度
this.globalData.windowWidth = res.windowWidth;
// 750 / windowWidth
this.globalData.ratio = 750 / res.windowWidth;
},
fail(err) {
console.error(err);
Expand Down
2 changes: 1 addition & 1 deletion src/components/evaluate/evaluate.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<view style="height: 406rpx;">
<view class="evaluate-feeling-title">任务感想</view>
<textarea placeholder="请输入你的感想" placeholder-style="font-size: 24rpx;"
maxlength="{{ 1000 }}" focus="{{ true }}" class="evaluate-feeling-desc"
maxlength="{{ 1000 }}" class="evaluate-feeling-desc"
value="{{ feeling }}" catch:input="handleInput" disabled="{{ disabled }}"
></textarea>
</view>
Expand Down
9 changes: 5 additions & 4 deletions src/components/navbar/navbar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const App = getApp();
const app = getApp();

Component({
options: {
Expand Down Expand Up @@ -38,9 +38,10 @@ Component({
lifetimes: {
attached: function () {
this.setData({
navHeight: App.globalData.navHeight,
navTop: App.globalData.navTop,
windowWidth: App.globalData.windowWidth
navHeight: app.globalData.navHeight,
navTop: app.globalData.navTop,
windowWidth: app.globalData.windowWidth,
ratio: app.globalData.ratio
})
}
},
Expand Down
6 changes: 3 additions & 3 deletions src/components/navbar/navbar.wxml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<view class="navbar custom-class" style='height:{{navHeight * (750 / windowWidth)}}rpx; background-color:{{bgColor}}; position: fixed;'>
<view wx:if="{{showNav}}" class="navbar-action-wrap navbar-action-group row item-center" style='top:{{navTop * (750 / windowWidth)}}rpx;background-color:rgba(255,255,255,.6)'>
<view class="navbar custom-class" style='height:{{navHeight * 2}}rpx; background-color:{{bgColor}}; position: fixed;'>
<view wx:if="{{showNav}}" class="navbar-action-wrap navbar-action-group row item-center" style='top:{{navTop * 2}}rpx;background-color:rgba(255,255,255,.6)'>
<slot name="backIcon"></slot>
</view>
<view class='navbar-title' style='top:{{navTop * (750 / windowWidth)}}rpx;'>
<view class='navbar-title' style='top:{{navTop * 2}}rpx;'>
<slot name="leftIcon"></slot>
{{ pageName }}
<slot name="rightIcon"></slot>
Expand Down
1 change: 0 additions & 1 deletion src/components/navbar/navbar.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@
.navbar-action-group .last {
border-right: none;
}

2 changes: 1 addition & 1 deletion src/pages/add-self-list/add-self-list.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<view style="position: relative; height: {{ navHeight * (750 / windowWidth) }}rpx;"></view>
<view style="position: relative; height: {{ navHeight * 2 }}rpx;"></view>
<!-- 导航栏 -->
<navbar page-name="添加清单">
<image slot="backIcon" src="/src/image/back.png" catch:tap="handleBack" mode="aspectFit" style="width: 48rpx; height: 48rpx;"></image>
Expand Down
37 changes: 6 additions & 31 deletions src/pages/collection/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,32 +271,6 @@ Component({
// 拉取并设置数据
onLoad: async function() {
let {token, owner} = await util.getTokenAndOwner(app.globalData.url + 'login/login/');
// console.log(token, owner);
// util.myRequest({
// url: app.globalData.url + 'check/check/?owner=' + JSON.stringify(owner),
// header: { Authorization: 'Token ' + token },
// method: 'POST',
// data:
// {"url":app.globalData.url + 'check/check/?owner=' + JSON.stringify(owner),
// "task_num":761,
// "repeat":0,
// "s_date":"2021-08-09",
// "c_time":"2021-08-09T02:07:20.468192Z",
// "e_time":"2021-08-09T10:05:32Z",
// "text":"UI重做",
// "priority":0,
// "finish":0,
// "fin_date":"2021-08-09T10:05:32Z",
// "star":1,
// "star_text":"default",
// "todo_delete":0,
// "todo_desc":"ui重做",
// "owner": app.globalData.url + 'login/user/' + owner + '/',
// "tag":app.globalData.url + "check/taglist/1/"
// }
// })
// .then(res => console.log(res));
// return;
// 从后端拉取数据
wx.showLoading({
title: '正在获取数据',
Expand Down Expand Up @@ -337,9 +311,9 @@ Component({
listsLocal,
{owner, token}
);

// 设置 id
tasksLocal.forEach(item => util.setUniqueId(item.id));
tasksLocal.forEach(item => item.id = util.getUniqueId());

// 如果存在一个今天会发生的重复任务,则修改该任务为非重复任务,并自动产生一个日期顺延的重复任务
// 如果以前完成了一个重复任务,不管其设置的日期是什么时候,同上处理
Expand Down Expand Up @@ -405,17 +379,18 @@ Component({
if(signText.length)
signTextLocal = signText[0].signText;
else {
signText = '好好学习 天天向上';
signTextLocal = '好好学习 天天向上';
util.myRequest({
url: app.globalData.url + 'check/sign/?owner=' + JSON.stringify(owner),
header: { Authorization: "Token " + token },
method: "POST",
data: {
signText: signText,
signText: signTextLocal,
owner: app.globalData.url + 'login/user/' + owner + "/"
}
});
}
wx.setStorageSync('signText', JSON.stringify(signTextLocal));

// 设置机型相关信息
let {navHeight, navTop, windowHeight, windowWidth} = app.globalData;
Expand All @@ -430,7 +405,7 @@ Component({
windowWidth
})
this._saveAllDataToLocal();
console.log(this.data.tasks);
console.log(this.data);

wx.hideLoading({
success: () => {
Expand Down
10 changes: 5 additions & 5 deletions src/pages/collection/collection.wxml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<view style="position: relative; height: {{ navHeight * (750 / windowWidth) }}rpx;"></view>
<view style="position: relative; height: {{ navHeight * 2 }}rpx;"></view>
<!-- 导航栏 -->
<navbar page-name="收集箱">
<image slot="backIcon" src="/src/image/navbar-menu.svg" bind:tap="handleShowMenu" mode="aspectFit" style="width: 48rpx; height: 48rpx;"></image>
</navbar>
<!-- 背景遮掩 -->
<view wx:if="{{ showMenu }}" class="menu-mask" style="height: {{ (windowHeight - navHeight) * (750 / windowWidth) }}rpx; z-index: 1;"
<view wx:if="{{ showMenu }}" class="menu-mask" style="height: {{ (windowHeight - navHeight) * 2 }}rpx; z-index: 1;"
bind:tap="handleCloseMask" catch:touchmove="catchTouchMove"
></view>
<!-- 左侧菜单 -->
<view wx:if="{{ showMenu }}" style="position: relative; height: 0; top: {{ -navHeight * (750 / windowWidth) }}rpx;">
<view wx:if="{{ showMenu }}" style="position: relative; height: 0; top: {{ -navHeight * 2 }}rpx;">
<menu style="position: relative; width: 600rpx; top: {{ menuTop }}rpx;"
menuHeight="{{ windowHeight * (750 / windowWidth) }}" menuBottomBlcakHeight="{{ 180 }}"
menuHeight="{{ windowHeight * 2 }}" menuBottomBlcakHeight="{{ 180 }}"
show="{{ showMenu }}" lists="{{ listsShow }}" todoListNum="{{ todayTasks.length }}" signText="{{ signText }}"
catch:handleNavigateToAddList="handleNavigateToAddList"
catch:handleNavigateToToday="handleNavigateToToday" catch:handleNavigateToFuture="handleNavigateToFuture"
Expand All @@ -20,7 +20,7 @@
></menu>
</view>

<view style="position: relative; height: {{ (windowHeight - navHeight) * (750 / windowWidth) }}rpx; overflow-y: scroll;">
<view style="position: relative; height: {{ (windowHeight - navHeight) * 2 }}rpx; overflow-y: scroll;">
<view style="padding-bottom: 500rpx;">
<!-- 今天的任务清单 -->
<view class="collection-task-title">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/editor/editor.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
listRange:可选清单的数组,默认为:["个人清单", "工作清单"]
-->

<view style="position: relative; height: {{ navHeight * (750 / windowWidth) }}rpx;"></view>
<view style="position: relative; height: {{ navHeight * 2 }}rpx;"></view>
<!-- 导航栏 -->
<navbar page-name="编辑代办">
<image slot="backIcon" src="/src/image/back.png" bind:tap="handleBack" mode="aspectFit" style="width: 48rpx; height: 48rpx;"></image>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/history/history.wxml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!--
接收一个 tasks 数组,包含所有任务
-->
<view style="position: relative; height: {{ navHeight * (750 / windowWidth) }}rpx;"></view>
<view style="position: relative; height: {{ navHeight * 2 }}rpx;"></view>
<navbar page-name="历史">
<image slot="backIcon" src="/src/image/back.png" bind:tap="handleBack" mode="aspectFit" style="width: 48rpx; height: 48rpx;"></image>
</navbar>


<!-- 背景遮掩 -->
<view wx:if="{{ showFeeling }}" class="history-mask" style="height: {{ (windowHeight - navHeight) * (750 / windowWidth) }}rpx; z-index: 1;"
<view wx:if="{{ showFeeling }}" class="history-mask" style="height: {{ (windowHeight - navHeight) * 2 }}rpx; z-index: 1;"
bind:tap="handleCloseMask" catch:touchmove="catchTouchMove"
></view>

Expand Down
3 changes: 2 additions & 1 deletion src/pages/list/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Component({
// 各种清单
else
res = data.tasks.filter(item =>
!item.list.title.localeCompare(data.pageName)
item.date.localeCompare(todayDate) >= 0
&& !item.list.title.localeCompare(data.pageName)
&& !item.delete
);
res.sort((a, b) => a.date.localeCompare(b.date) );
Expand Down
2 changes: 1 addition & 1 deletion src/pages/list/list.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
isDelete:该清单是否可以删除
disabled:是否可以编辑
-->
<view style="position: relative; height: {{ navHeight * (750 / windowWidth) }}rpx;"></view>
<view style="position: relative; height: {{ navHeight * 2 }}rpx;"></view>
<!-- 导航栏 -->
<navbar page-name="{{ pageName }}">
<image slot="backIcon" src="/src/image/back.png" catch:tap="handleBack" mode="aspectFit" style="width: 48rpx; height: 48rpx;"></image>
Expand Down
8 changes: 4 additions & 4 deletions src/pages/review/review.wxml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<view style="position: relative; height: {{ navHeight * (750 / windowWidth) }}rpx;"></view>
<view style="position: relative; height: {{ navHeight * 2 }}rpx;"></view>
<navbar page-name="今日回顾">
<image slot="backIcon" src="/src/image/navbar-menu.svg" bind:tap="handleShowMenu" mode="aspectFit" style="width: 48rpx; height: 48rpx;"></image>
</navbar>
<!-- 背景遮掩 -->
<view wx:if="{{ showMenu || showFeeling }}" class="menu-mask" style="height: {{ (windowHeight - navHeight) * (750 / windowWidth) }}rpx; z-index: 1;"
<view wx:if="{{ showMenu || showFeeling }}" class="menu-mask" style="height: {{ (windowHeight - navHeight) * 2 }}rpx; z-index: 1;"
bind:tap="handleCloseMask" catch:touchmove="catchTouchMove"
></view>
<!-- 左侧菜单 -->
<view wx:if="{{ showMenu }}" style="position: relative; height: 0; top: {{ -navHeight * (750 / windowWidth) }}rpx;">
<view wx:if="{{ showMenu }}" style="position: relative; height: 0; top: {{ -navHeight * 2 }}rpx;">
<menu style="position: relative; width: 600rpx; top: {{ menuTop }}rpx;"
menuHeight="{{ windowHeight * (750 / windowWidth) }}" menuBottomBlcakHeight="{{ 180 }}"
menuHeight="{{ windowHeight * 2 }}" menuBottomBlcakHeight="{{ 180 }}"
show="{{ showMenu }}" lists="{{ listsShow }}" todoListNum="{{ todayTasks.length }}" signText="{{ signText }}"
catch:handleNavigateToAddList="handleNavigateToAddList"
catch:handleNavigateToToday="handleNavigateToToday" catch:handleNavigateToFuture="handleNavigateToFuture"
Expand Down

0 comments on commit 53891b0

Please sign in to comment.