Commit a36ddfbb by shibukun

首页

parent 1e1439d8
<template> <template>
<view> <view class="layout">
<<<<<<< HEAD <view class="title">懒人企业福利社</view>
<view class="layout"> <view class="header">
<view class="title">懒人企业福利社</view> <view class="header-top">
<view class="header"> <text v-if="isLogin" class="header-name">你好,{{ name }}</text>
<view class="header-top"> <text v-else class="header-login" @click="goLogin()">请登录</text>
<text class="header-name">你好,{{name}}</text> <view class="integral-detail">积分明细 ></view>
<view class="integral-detail">积分明细 ></view> </view>
</view> <view class="header-center">
<view class="header-center"> <view class="header-integral">{{ integralCount }}</view>
<view class="header-integral">{{integralCount}}</view> <view class="header-integral-tip">当前积分</view>
<view class="header-integral-tip">当前积分</view>
</view>
</view> </view>
<view class="list"> </view>
<view class="item" v-for="(item, index) in brandList" :key='index'> <view class="list">
<image class="icon"></image> <view class="item" v-for="(item, index) in brandList" :key="index">
<view class="item-right"> <image class="icon"></image>
<text class="item-title">叮咚买菜</text> <view class="item-right">
<text class="item-desc">最高70%返现</text> <text class="item-title">叮咚买菜</text>
</view> <text class="item-desc">最高70%返现</text>
</view> </view>
</view> </view>
<uni-load-more v-if="brandList.length>0" :status="loadingType"></uni-load-more>
=======
<view class="" @click="goLogin()">
11111
>>>>>>> d5c91777203b7e81e24f3d0960a9eb78343180ea
</view> </view>
<uni-load-more v-if="brandList.length > 0" :status="loadingType"></uni-load-more>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
<<<<<<< HEAD name: '',
name: '', integralCount: '0',
integralCount: '', loadingType: 'more',
loadingType: 'more', brandList: [],
brandList: [], page: 1,
page: 1, pageSize: 20,
pageSize: 20 isLogin: false
======= };
>>>>>>> d5c91777203b7e81e24f3d0960a9eb78343180ea },
}; created() {
this.getData();
},
onShow() {
this.getUserInfo()
},
methods: {
goLogin() {
this.$router.push('Login');
}, },
created() { getUserInfo() {
this.getData() if(this.$net.tokenGet().length > 0) {
this.isLogin = true
this.$net.get('/staff/detail', {})
.then(res => {
this.name = res.accountName
this.integralCount = res.allIntegral
})
.catch(err => {
console.log(err)
})
} else {
// 未登录
this.isLogin = false
}
}, },
methods: { getData() {
goLogin() { this.$net
this.$router.push('Login') .get('/goods/brand', { page: this.page, pageSize: this.pageSize })
},
getData() {
this.$net.get('/goods/brand', {page: this.page, pageSize: this.pageSize})
.then(res => { .then(res => {
if(res.list.length > 0) { if (res.list.length > 0) {
this.brandList.concat(res.list) this.brandList.concat(res.list);
} }
this.loadingType = res.list.length < this.pageSize ? 'more' : 'noMore' this.loadingType = res.list.length < this.pageSize ? 'more' : 'noMore';
}) })
.catch(err => { .catch(err => {
console.log(err) console.log(err);
}) });
}
} }
} }
};
</script> </script>
<<<<<<< HEAD
<style lang="scss"> <style lang="scss">
.layout { .layout {
width: 100%; width: 100%;
...@@ -99,14 +110,19 @@ ...@@ -99,14 +110,19 @@
margin-left: 30rpx; margin-left: 30rpx;
.header-name { .header-name {
font-size: 24rpx; font-size: 24rpx;
color: #FFFFFF; color: #ffffff;
}
.header-login {
font-size: 24rpx;
color: #ffffff;
text-decoration: underline;
} }
.integral-detail { .integral-detail {
background-image: url(../../static/integral-detail-bg.png); background-image: url(../../static/integral-detail-bg.png);
width: 174rpx; width: 174rpx;
height: 58rpx; height: 58rpx;
font-size: 26rpx; font-size: 26rpx;
color: #FFFFFF; color: #ffffff;
line-height: 58rpx; line-height: 58rpx;
text-align: center; text-align: center;
} }
...@@ -118,18 +134,18 @@ ...@@ -118,18 +134,18 @@
.header-integral { .header-integral {
font-size: 82rpx; font-size: 82rpx;
font-weight: bolder; font-weight: bolder;
color: #FFFFFF; color: #ffffff;
margin-top: 15rpx; margin-top: 15rpx;
} }
.header-integral-tip { .header-integral-tip {
font-size: 24rpx; font-size: 24rpx;
color: #FFFFFF; color: #ffffff;
} }
} }
.list { .list {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
background: #FFEEEE; background: #ffeeee;
border-radius: 30rpx 30rpx 0rpx 0rpx; border-radius: 30rpx 30rpx 0rpx 0rpx;
padding-top: 25rpx; padding-top: 25rpx;
.item { .item {
...@@ -160,8 +176,4 @@ ...@@ -160,8 +176,4 @@
} }
} }
} }
=======
<style lang="scss" scoped>
>>>>>>> d5c91777203b7e81e24f3d0960a9eb78343180ea
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment