Browse Source

feat: 登录按钮

test2
xuesinan 4 years ago
parent
commit
527b0e5508
  1. 1
      CHANGELOG.md
  2. 51
      pages/index/index.vue
  3. BIN
      static/headimg.png

1
CHANGELOG.md

@ -39,6 +39,7 @@
- | 刷新token重新运行api | [02fb4bf](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/02fb4bf)
- | 添加 timeline | [72dad2b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/72dad2b)
- | 未登录调用项目列表接口 | [aab6489](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/aab6489)
- | 细节调整;解开查所有成员的api | [ee18175](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ee18175)
- | 项目操作面板 | [3beb05e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3beb05e)
- | 项目列表 | [a52e6d5](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a52e6d5)
- | 项目列表新 | [88cf48d](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/88cf48d)

51
pages/index/index.vue

@ -13,7 +13,7 @@
<!-- #endif -->
<!-- <view class="flex flex-col h-full bg-gray-50" @click="openAuth"> -->
<theme class="flex flex-col h-full bg-gray-50">
<theme class="relative flex flex-col h-full bg-gray-50">
<view class="relative">
<!-- <view class="relative" @touchmove="onMove"> -->
<!-- 日历 -->
@ -23,7 +23,12 @@
<Upload @success="onUploadSuccess" @error="onUploadError" />
</view>
<u-button class="mt-4" @click="toLogin">登录</u-button>
<view class="login-box absolute" @click="toLogin">
<text v-if="!userInfo">游客</text>
<image v-else src="../../static/headimg.png" mode=""></image>
</view>
<!-- <u-button class="mt-4" @click="toLogin">登录</u-button> -->
<!-- 项目列表 -->
<Projects @getProjects="getProjects" class="flex-1 overflow-y-auto" />
@ -42,6 +47,7 @@
const uTips = ref(null);
// const firstOpenApp = computed(() => store.state.firstOpenApp);
// const isOpenApp = computed(() => store.state.isOpenApp); // APP
const userInfo = computed(() => store.state.user.user);
const data = reactive({
calendar: null,
@ -52,13 +58,17 @@
handleFindPoint();
// token
// watchEffect(() => {
watchEffect(() => {
const user = uni.$storage.getStorageSync('user');
if (!userInfo.value && user) {
store.commit('user/setUser', JSON.parse(user));
}
// if (!token.value) return;
// if (token.value) {
// getProjects();
// handleFindPoint();
// }
// });
});
//
function getProjects(start = dayjs().startOf('day').valueOf(), end = dayjs().endOf('day').valueOf()) {
@ -129,9 +139,12 @@
// }
function toLogin() {
uni.navigateTo({
url: '/pages/user/login'
});
console.log(11)
if (!userInfo.value) {
uni.navigateTo({
url: '/pages/user/login'
});
}
}
</script>
@ -161,4 +174,28 @@
font-size: 36rpx;
color: #8f8f94;
}
.login-box {
top: 10px;
right: 10px;
z-index: 999;
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
border-radius: 50%;
background-color: #eeeeee;
text-align: center;
line-height: 50px;
border: 1px solid #ddd;
overflow: hidden;
image {
display: inline-block;
width: 40px;
height: 40px;
object-fit: cover;
}
}
</style>

BIN
static/headimg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Loading…
Cancel
Save