添加登录代码

This commit is contained in:
2023-05-15 14:30:16 +08:00
parent 8e3beb44d9
commit 9cb8aa0bac
16 changed files with 330 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
// pages/star/star.ts
const api = require("../../api/index")
const app = getApp<IAppOption>()
Page({
/**
@@ -78,12 +79,21 @@ Page({
},
async getList() {
const res = await api.getMyWineList({
current:1,
size:10
})
if(res.code === 200) {
console.log(app.globalData.isLogin)
if(app.globalData.isLogin) {
const res = await api.getMyWineList({
current:1,
size:10
})
if(res.code === 200) {
}
}
else{ // 跳转登录页
wx.navigateTo({
url:'../login/login'
})
}
}
})

View File

@@ -1,5 +1,5 @@
<view class="container" style="padding: 10px;">
<view class="list-part c-part">
<view class="list-part c-part" wx:if="isLogin">
<view class="lp-card" wx:for="{{list}}" wx:for-item="item" wx:key="id">
<view class="lpc-name-box">
<view class="lpc-name text-ellipsis-1" style="margin-bottom: 5px;"> {{item.name}}</view>