添加登录代码
This commit is contained in:
@@ -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'
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user