Browse Source

feat: 未登录调用项目列表接口

test2
xuesinan 4 years ago
parent
commit
aab6489113
  1. 2
      App.vue
  2. 1
      CHANGELOG.md
  3. 8
      manifest.json
  4. 3
      pages.json
  5. 33
      pages/index/index.vue
  6. 37
      utils/cacheAndRequest.js

2
App.vue

@ -14,7 +14,7 @@ export default {
async onLaunch(options) {
// this.loadTheme();
console.log('onLaunch options: ', options);
// console.log('onLaunch options: ', options);
this.checkNetwork(); //
this.getSystemInfo(); //

1
CHANGELOG.md

@ -9,6 +9,7 @@
- | 插件面板分开显示 | [fb5e86b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/fb5e86b)
- | 登录、日历页小绿点、二级项目列表 | [e676cf0](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e676cf0)
- | 更新代码 | [392c8cc](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/392c8cc)
- | 获取手机唯一码 | [3f60cf8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3f60cf8)
- | 日历页首页 | [561c8e6](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/561c8e6)
- | 日历页添加 | [1b46a91](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1b46a91)
- | 时间轴接口 | [a95d005](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a95d005)

8
manifest.json

@ -77,6 +77,9 @@
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
},
"splashscreen" : {
"androidStyle" : "common"
}
}
},
@ -102,5 +105,8 @@
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3"
"vueVersion" : "3",
"h5" : {
"title" : "时物链"
}
}

3
pages.json

@ -3,7 +3,8 @@
{
"path": "pages/index/index",
"style": {
"navigationBarText": "TALL"
"navigationBarText": "TALL",
"navigationStyle": "custom"
}
},
{

33
pages/index/index.vue

@ -1,13 +1,15 @@
<template>
<!-- <view class="flex flex-col h-full bg-gray-50" @click="openAuth"> -->
<view class="flex flex-col h-full bg-gray-50">
<view class="relative" @touchmove="onMove">
<view class="relative">
<!-- <view class="relative" @touchmove="onMove"> -->
<!-- 日历 -->
<Calendar @selected-change="onDateChange" :show-back="true" ref="calendar" @handleFindPoint="handleFindPoint" />
<!-- 上传 导入wbs -->
<Upload @success="onUploadSuccess" @error="onUploadError" />
</view>
<u-button @click="toLogin">登录</u-button>
</view>
<u-button class="mt-4" @click="toLogin">登录</u-button>
<!-- 项目列表 -->
<Projects @getProjects="getProjects" class="flex-1 overflow-y-auto" />
@ -96,18 +98,19 @@
};
// /
function onMove(event) {
const y = event.changedTouches[0].pageY;
if (y - prevY > 0) {
// weekMode=true weekMode=false
data.calendar.weekMode && (data.calendar.weekMode = false);
} else if (y - prevY < 0) {
// weekMode=false weekMode=true
!data.calendar.weekMode && (data.calendar.weekMode = true);
}
prevY = y;
data.calendar.initDate();
}
// function onMove(event) {
// const y = event.changedTouches[0].pageY;
// const prevY = 0;
// if (y - prevY > 0) {
// // weekMode=true weekMode=false
// data.calendar.weekMode && (data.calendar.weekMode = false);
// } else if (y - prevY < 0) {
// // weekMode=false weekMode=true
// !data.calendar.weekMode && (data.calendar.weekMode = true);
// }
// prevY = y;
// data.calendar.initDate();
// }
function toLogin() {
uni.navigateTo({

37
utils/cacheAndRequest.js

@ -22,6 +22,7 @@ export default {
*/
getProjects(startTime, endTime, fn) {
let remote = false;
if (store.getters.useStorage) {
// 有缓存 且 服务端数据未返回 就先返回缓存
uni.$cache
@ -31,19 +32,29 @@ export default {
})
.catch(err => !remote && fn(err));
}
waitTokenRequest(() => {
// 拿到api数据后 再用api的数据
uni.$u.api
.getProjects(startTime, endTime)
.then(data => {
remote = true;
fn(null, data);
// 存api到cache里
uni.$cache.putProjects(data);
})
.catch(err => fn(err));
});
uni.$u.api
.getProjects(startTime, endTime)
.then(data => {
remote = true;
fn(null, data);
// 存api到cache里
uni.$cache.putProjects(data);
})
.catch(err => fn(err));
// waitTokenRequest(() => {
// // 拿到api数据后 再用api的数据
// uni.$u.api
// .getProjects(startTime, endTime)
// .then(data => {
// remote = true;
// fn(null, data);
// // 存api到cache里
// uni.$cache.putProjects(data);
// })
// .catch(err => fn(err));
// });
},
/**

Loading…
Cancel
Save