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) { async onLaunch(options) {
// this.loadTheme(); // this.loadTheme();
console.log('onLaunch options: ', options); // console.log('onLaunch options: ', options);
this.checkNetwork(); // this.checkNetwork(); //
this.getSystemInfo(); // this.getSystemInfo(); //

1
CHANGELOG.md

@ -9,6 +9,7 @@
- | 插件面板分开显示 | [fb5e86b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/fb5e86b) - | 插件面板分开显示 | [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) - | 登录、日历页小绿点、二级项目列表 | [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) - | 更新代码 | [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) - | 日历页首页 | [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) - | 日历页添加 | [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) - | 时间轴接口 | [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" "spotlight@3x" : "unpackage/res/icons/120x120.png"
} }
} }
},
"splashscreen" : {
"androidStyle" : "common"
} }
} }
}, },
@ -102,5 +105,8 @@
"uniStatistics" : { "uniStatistics" : {
"enable" : false "enable" : false
}, },
"vueVersion" : "3" "vueVersion" : "3",
"h5" : {
"title" : "时物链"
}
} }

3
pages.json

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

33
pages/index/index.vue

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

37
utils/cacheAndRequest.js

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