修改我的页面样式
This commit is contained in:
parent
32341e345d
commit
9360e03584
@ -1,293 +1,293 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view style="position: absolute;">
|
<view style="position: absolute;">
|
||||||
<u-navbar :custom-back="onBack" back-icon-color="#0c0000" :background="background" :border-bottom="false">
|
<u-navbar :custom-back="onBack" back-icon-color="#0c0000" :background="background" :border-bottom="false">
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
</view>
|
</view>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view class="info-wrap">
|
<view class="info-wrap">
|
||||||
<u-avatar class="avatar" :src="userInfo.avatar" :show-level='userInfo.type == 1'
|
<u-avatar class="avatar" :src="userInfo.avatar" :show-level='userInfo.type == 1'
|
||||||
level-bg-color="#8072f3" size="130"></u-avatar>
|
level-bg-color="#8072f3" size="130"></u-avatar>
|
||||||
<view class="user-style">
|
<view class="user-style">
|
||||||
<view class="username">{{userInfo.username}}
|
<view class="username">{{userInfo.username}}
|
||||||
<text class="iconfont icon-nan kong" v-if="userInfo.gender=='男'"></text>
|
<text class="iconfont icon-nan kong" v-if="userInfo.gender=='男'"></text>
|
||||||
<text class="iconfont icon-nv kong" v-else-if="userInfo.gender=='女'"></text>
|
<text class="iconfont icon-nv kong" v-else-if="userInfo.gender=='女'"></text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<text class="desc">{{userInfo.intro}}</text>
|
<text class="desc">{{userInfo.intro}}</text>
|
||||||
<text class="desc" v-if="userInfo.city">IP:{{userInfo.city}}</text>
|
<text class="desc" v-if="userInfo.city">IP:{{userInfo.city}}</text>
|
||||||
|
|
||||||
<view class="btn-box" v-if="currUid!=uid">
|
<view class="btn-box" v-if="currUid!=uid">
|
||||||
<u-button v-show="!userInfo.isFollow" @click="follow" :custom-style="btnStyle" class="btn"
|
<u-button v-show="!userInfo.isFollow" @click="follow" :custom-style="btnStyle" class="btn"
|
||||||
shape="circle" size="mini">
|
shape="circle" size="mini">
|
||||||
<u-icon name="plus"></u-icon>
|
<u-icon name="plus"></u-icon>
|
||||||
<text>关注</text>
|
<text>关注</text>
|
||||||
</u-button>
|
</u-button>
|
||||||
<u-button v-show="userInfo.isFollow" @click="cancelFollow" :custom-style="btnStyle2" class="btn"
|
<u-button v-show="userInfo.isFollow" @click="cancelFollow" :custom-style="btnStyle2" class="btn"
|
||||||
shape="circle" size="mini">
|
shape="circle" size="mini">
|
||||||
<text>已关注</text>
|
<text>已关注</text>
|
||||||
</u-button>
|
</u-button>
|
||||||
<u-button :custom-style="btnStyle2" @click="chat" shape="circle" size="mini">
|
<u-button :custom-style="btnStyle2" @click="chat" shape="circle" size="mini">
|
||||||
<text style="margin: 0 15rpx;">私信</text>
|
<text style="margin: 0 15rpx;">私信</text>
|
||||||
</u-button>
|
</u-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 帖子 -->
|
<!-- 帖子 -->
|
||||||
<view>
|
<view>
|
||||||
<view class="title-desc">发布的动态</view>
|
<view class="title-desc">发布的动态</view>
|
||||||
<post-list :list="postList" :loadStatus="loadStatus"></post-list>
|
<post-list :list="postList" :loadStatus="loadStatus"></post-list>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 发贴入口 -->
|
<!-- 发贴入口 -->
|
||||||
<add-post-tag></add-post-tag>
|
<add-post-tag></add-post-tag>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import postList from '../../components/post-list/post-list.vue';
|
import postList from '../../components/post-list/post-list.vue';
|
||||||
import addPostTag from '../../components/add-post-tag/add-post-tag.vue';
|
import addPostTag from '../../components/add-post-tag/add-post-tag.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
postList
|
postList
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
btnStyle: {
|
btnStyle: {
|
||||||
color: "#fff",
|
color: "#fff",
|
||||||
backgroundColor: '#000000'
|
backgroundColor: '#000000'
|
||||||
},
|
},
|
||||||
btnStyle2: {
|
btnStyle2: {
|
||||||
border: '1px solid #000000',
|
border: '1px solid #000000',
|
||||||
color: "#000000"
|
color: "#000000"
|
||||||
},
|
},
|
||||||
background: {
|
background: {
|
||||||
backgroundColor: 'unset'
|
backgroundColor: 'unset'
|
||||||
},
|
},
|
||||||
tabs: [{
|
tabs: [{
|
||||||
tab_name: '帖子'
|
tab_name: '帖子'
|
||||||
}],
|
}],
|
||||||
current: 1,
|
current: 1,
|
||||||
uid: 0,
|
uid: 0,
|
||||||
postList: [],
|
postList: [],
|
||||||
topicList: [],
|
topicList: [],
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
userJson: "",
|
userJson: "",
|
||||||
loadStatus: "loading",
|
loadStatus: "loading",
|
||||||
page: 1,
|
page: 1,
|
||||||
currUid: 0
|
currUid: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.uid = options.uid;
|
this.uid = options.uid;
|
||||||
this.getUserInfo();
|
this.getUserInfo();
|
||||||
this.getPostList();
|
this.getPostList();
|
||||||
if (uni.getStorageSync('userInfo').uid) {
|
if (uni.getStorageSync('userInfo').uid) {
|
||||||
this.currUid = uni.getStorageSync('userInfo').uid;
|
this.currUid = uni.getStorageSync('userInfo').uid;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
this.page++;
|
this.page++;
|
||||||
this.getPostList();
|
this.getPostList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onBack() {
|
onBack() {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
},
|
},
|
||||||
follow() {
|
follow() {
|
||||||
this.$H.post('user/addFollow', {
|
this.$H.post('user/addFollow', {
|
||||||
id: this.userInfo.uid
|
id: this.userInfo.uid
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.userInfo.isFollow = true;
|
this.userInfo.isFollow = true;
|
||||||
} else {
|
} else {
|
||||||
this.$u.toast(res.msg);
|
this.$u.toast(res.msg);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
cancelFollow() {
|
cancelFollow() {
|
||||||
this.$H.post('user/cancelFollow', {
|
this.$H.post('user/cancelFollow', {
|
||||||
id: this.userInfo.uid
|
id: this.userInfo.uid
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.userInfo.isFollow = false;
|
this.userInfo.isFollow = false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getPostList() {
|
getPostList() {
|
||||||
this.loadStatus = "loading";
|
this.loadStatus = "loading";
|
||||||
this.$H.post('post/list', {
|
this.$H.post('post/list', {
|
||||||
page: this.page,
|
page: this.page,
|
||||||
uid: this.uid
|
uid: this.uid
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.postList = this.postList.concat(res.result.data);
|
this.postList = this.postList.concat(res.result.data);
|
||||||
if (res.result.current_page === res.result.last_page || res.result.last_page === 0) {
|
if (res.result.current_page === res.result.last_page || res.result.last_page === 0) {
|
||||||
this.loadStatus = "nomore";
|
this.loadStatus = "nomore";
|
||||||
} else {
|
} else {
|
||||||
this.loadStatus = "loadmore"
|
this.loadStatus = "loadmore"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
chat(){
|
chat() {
|
||||||
this.$u.toast('开源版暂未开放')
|
this.$u.toast('开源版暂未开放')
|
||||||
},
|
},
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
this.$H.post('user/userInfoById', {
|
this.$H.post('user/userInfoById', {
|
||||||
uid: this.uid
|
uid: this.uid
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.userInfo = res.result;
|
this.userInfo = res.result;
|
||||||
if (res.result.gender === 1) {
|
if (res.result.gender === 1) {
|
||||||
this.userInfo.gender = '男'
|
this.userInfo.gender = '男'
|
||||||
} else if (res.result.gender === 2) {
|
} else if (res.result.gender === 2) {
|
||||||
this.userInfo.gender = '女'
|
this.userInfo.gender = '女'
|
||||||
} else {
|
} else {
|
||||||
this.userInfo.gender = '保密'
|
this.userInfo.gender = '保密'
|
||||||
}
|
}
|
||||||
|
|
||||||
let user = {
|
let user = {
|
||||||
uid: res.result.uid,
|
uid: res.result.uid,
|
||||||
username: res.result.username,
|
username: res.result.username,
|
||||||
avatar: res.result.avatar,
|
avatar: res.result.avatar,
|
||||||
}
|
}
|
||||||
this.userJson = JSON.stringify(user)
|
this.userJson = JSON.stringify(user)
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: this.userInfo.username
|
title: this.userInfo.username
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
});
|
});
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.container {
|
.container {
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 100rpx;
|
top: 100rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrap {
|
.info-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 130rpx;
|
width: 130rpx;
|
||||||
height: 130rpx;
|
height: 130rpx;
|
||||||
border-radius: 100rpx !important;
|
border-radius: 100rpx !important;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
margin: 150rpx 550rpx 100rpx 50rpx;
|
margin: 150rpx 550rpx 100rpx 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrap .user-style {
|
.info-wrap .user-style {
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
border-radius: 30rpx;
|
border-radius: 30rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 85rpx;
|
top: 85rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-shadow: 5rpx 10rpx 20rpx #e6e6e6;
|
box-shadow: 5rpx 10rpx 20rpx #e6e6e6;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrap .user-style .username {
|
.info-wrap .user-style .username {
|
||||||
font-size: 34rpx;
|
font-size: 34rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin: 10rpx 10rpx 10rpx 90rpx;
|
margin: 10rpx 10rpx 10rpx 90rpx;
|
||||||
|
|
||||||
.kong {
|
.kong {
|
||||||
margin-left: 25rpx;
|
margin-left: 25rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrap .user-style .num-box {
|
.info-wrap .user-style .num-box {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
margin: 20rpx 0;
|
margin: 20rpx 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrap .user-style .num-box .txt {
|
.info-wrap .user-style .num-box .txt {
|
||||||
color: #999;
|
color: #999;
|
||||||
margin-left: 5rpx;
|
margin-left: 5rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrap .user-style .num-box text {
|
.info-wrap .user-style .num-box text {
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrap .user-style .desc {
|
.info-wrap .user-style .desc {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
margin: 1rpx 20rpx 20rpx 140rpx;
|
margin: 1rpx 20rpx 20rpx 140rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrap .user-style .btn-box {
|
.info-wrap .user-style .btn-box {
|
||||||
margin: 0rpx 30rpx 10rpx 90rpx;
|
margin: 0rpx 30rpx 10rpx 90rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-wrap .user-style .btn-box .btn {
|
.info-wrap .user-style .btn-box .btn {
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-box {
|
.tab-box {
|
||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-c {
|
.info-c {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-c>text {
|
.info-c>text {
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-c .level-box {
|
.info-c .level-box {
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: #999;
|
color: #999;
|
||||||
|
|
||||||
.level {
|
.level {
|
||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 5rpx 10rpx;
|
padding: 5rpx 10rpx;
|
||||||
background-color: #333333;
|
background-color: #333333;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
margin-right: 10rpx;
|
margin-right: 10rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-desc {
|
.title-desc {
|
||||||
// margin-left: 30rpx;
|
// margin-left: 30rpx;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #565656;
|
color: #565656;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user