INFO
This commit is contained in:
@@ -1,25 +1,29 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 后台按钮组件 -->
|
||||
<!-- <zetank-backBar textcolor="#000" :showLeft="true" :showTitle="false" navTitle='标题'></zetank-backBar> -->
|
||||
<!-- 用户背景封面 -->
|
||||
<z-paging ref="paging" :fixed="true" @scroll="scroll" @query="queryData" :hide-empty-view="true">
|
||||
<image class="info-cover" @tap="fnMainBgPic"
|
||||
src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-5d36bb3d-8e98-4f00-ab8b-b018dc4f5dc6/17b0292c-8a63-4b7b-a6a6-724f416a9958.jpg"
|
||||
src="https://qnycdn.mymoyu.top/static/17b0292c-8a63-4b7b-a6a6-724f416a9958.jpg"
|
||||
mode="scaleToFill"></image>
|
||||
<!-- 用户头像关注 -->
|
||||
<view class="u-flex-wrap"
|
||||
style="padding-top: 18rpx;padding-bottom: 18rpx;position: relative;align-items: center;display: flex;flex-direction: row;justify-content: flex-end;">
|
||||
<view class="info-avatar">
|
||||
<image
|
||||
src="https://env-00jxt5y29hrd.normal.cloudstatic.cn/static/static/center/avatar.png?expire_at=1741142218&er_sign=2f723854c2a07dcb5571d2ede5458f7f"
|
||||
style="width: 135rpx;height: 135rpx;border-radius: 50%;"></image>
|
||||
<view class="info-avatar" >
|
||||
<cloud-image width="135rpx" height="135rpx" border-radius="50%"
|
||||
v-if="userinfo.avatar_file"
|
||||
:src="userinfo.avatar_file.url">
|
||||
</cloud-image>
|
||||
|
||||
</view>
|
||||
<view style="margin-right: 50rpx;" v-if="uid === userInfo._id">
|
||||
<u-tag v-if='showedit' text="编辑信息" mode="dark" shape="" bg-color="#f5991e" @click="UserEdit" />
|
||||
<view v-if='!showedit' style="height: 45rpx;"></view>
|
||||
</view>
|
||||
<view style="margin-right: 50rpx;" v-else>
|
||||
<u-tag v-if='showedit' :text="!isFollow?'关注':'取消关注'"
|
||||
@click="toFollow()"
|
||||
mode="dark" shape="" :bg-color="!isFollow?'#6699ff':'#ffcc66'" />
|
||||
<view v-if='!showedit' style="height: 45rpx;"></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 用户名 -->
|
||||
<view style="display: flex;align-items: center;margin-left: 50rpx;margin-top: 20rpx;"
|
||||
@@ -37,23 +41,14 @@
|
||||
<u-icon name="map-fill" size="32" color="#4baed5"></u-icon>
|
||||
<text style="font-size: 24rpx;color: #555555;margin-left: 10rpx;">{{userinfo.city}}</text>
|
||||
</view>
|
||||
<!-- <view style="display: flex;align-items: center;margin-left: 50rpx;margin-top: 20rpx;" v-if="userinfo.length!=0">
|
||||
<u-icon name="man-add-fill" size="32" color="#4baed5"></u-icon>
|
||||
<text style="font-size: 24rpx;color: #555555;margin-left: 10rpx;">{{userinfo.jor}}</text>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
<!-- 简介-->
|
||||
<view style="font-size: 24rpx;color: #555555;margin:20rpx 50rpx;" v-if="userinfo.length!=0">
|
||||
<u-tag v-if='membertype!=""' :text="membertype" mode="dark" shape="circle" bg-color="#4baed5" />
|
||||
<text style="margin-right: 20rpx;">{{Information==''?'暂无简介':Information}}</text>
|
||||
<text style="margin-right: 20rpx;">{{!Information?'暂无简介':Information}}</text>
|
||||
</view>
|
||||
<!-- <view style="display: flex;align-items: center;margin-left: 50rpx;margin-top: 20rpx;margin-bottom: 20rpx;" v-if="userinfo.length!=0">
|
||||
<text style="font-size: 32rpx;font-weight: bold;color: #555555;margin-right: 18rpx;">{{userinfo.good.length || 0}}</text><text style="font-size: 24rpx;color: gray;margin-right: 28rpx;">粉丝</text>
|
||||
<text style="font-size: 32rpx;font-weight: bold;color: #555555;margin-right: 18rpx;">{{userinfo.good.length || 0}}</text><text style="font-size: 24rpx;color: gray;margin-right: 28rpx;">关注</text>
|
||||
<text style="font-size: 32rpx;font-weight: bold;color: #555555;margin-right: 18rpx;">{{userinfo.good.length || 0}}</text><text style="font-size: 24rpx;color: gray;margin-right: 28rpx;">点赞</text>
|
||||
</view> -->
|
||||
|
||||
<!-- 选择导航 -->
|
||||
<view v-if="isFixed" style="height: 90rpx;line-height: 90rpx;background-color: white;margin-bottom: 18rpx;">
|
||||
</view>
|
||||
<view id="tabbar" :class="isFixed?'tabbar-fixed':''"
|
||||
@@ -86,11 +81,11 @@
|
||||
<template v-for="item in listData">
|
||||
<view class="" v-if="item.article_status === 1">
|
||||
<not-cover v-if="item.thumbnail && item.thumbnail.length === 0"
|
||||
:ctype="'historyList'" :data="getNewItem(item)"></not-cover>
|
||||
:data="getNewItem(item)"></not-cover>
|
||||
<right-small-cover v-else-if="item.thumbnail && item.thumbnail.length === 1"
|
||||
:ctype="'historyList'" :data="getNewItem(item)"></right-small-cover>
|
||||
:data="getNewItem(item)"></right-small-cover>
|
||||
<three-cover v-else-if="item.thumbnail && item.thumbnail.length === 3"
|
||||
:ctype="'historyList'" :data="getNewItem(item)"></three-cover>
|
||||
:data="getNewItem(item)"></three-cover>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -182,7 +177,7 @@
|
||||
import {
|
||||
parseImageUrl
|
||||
} from "@/uni_modules/uni-cms-article/common/parse-image-url";
|
||||
|
||||
import cloudImage from "@/components/cloud-image.vue"
|
||||
|
||||
const db = uniCloud.database();
|
||||
const articleDBName = 'uni-cms-articles'
|
||||
@@ -192,7 +187,7 @@
|
||||
import {
|
||||
store,
|
||||
mutations
|
||||
} from '@/uni_modules/uni-id-pages/common/store.js';
|
||||
} from '@/pages3/uni_modules/uni-id-pages/common/store.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -200,7 +195,8 @@
|
||||
refreshBox,
|
||||
notCover,
|
||||
rightSmallCover,
|
||||
threeCover
|
||||
threeCover,
|
||||
cloudImage
|
||||
},
|
||||
computed: {
|
||||
userInfo() {
|
||||
@@ -232,22 +228,6 @@
|
||||
|
||||
},
|
||||
colList1() {
|
||||
if (this.where_flag === false) {
|
||||
return [
|
||||
db.collection("cms-articles-collect")
|
||||
.where({
|
||||
user_id: "xxxx"
|
||||
})
|
||||
.getTemp(),
|
||||
db.collection(articleDBName)
|
||||
.field('_id,thumbnail,title,publish_date,user_id, excerpt, article_status')
|
||||
.getTemp(),
|
||||
db.collection(userDBName)
|
||||
.field('_id,nickname')
|
||||
.getTemp()
|
||||
|
||||
];
|
||||
}
|
||||
return [
|
||||
db.collection("cms-articles-collect")
|
||||
.where(this.where)
|
||||
@@ -268,6 +248,7 @@
|
||||
tags: [
|
||||
|
||||
],
|
||||
isFollow:false,
|
||||
showRefresh: false, // 是否显示刷新按钮
|
||||
listHeight: 0, // 列表高度
|
||||
mpButtonLeftPlaceholderSize: 0, // 小程序左侧icon占位大小
|
||||
@@ -289,7 +270,7 @@
|
||||
|
||||
where_flag: false,
|
||||
where:{
|
||||
user_id: "xxxxxx"
|
||||
user_id: ""
|
||||
},
|
||||
Information: '本人性格热情开朗,待人友好,为人诚实谦虚。工作勤奋,认真负责,能吃苦耐劳,尽职 尽责,有耐心。具有亲和力,平易近人,善于与人沟通',
|
||||
membertype: '',
|
||||
@@ -313,11 +294,10 @@
|
||||
}
|
||||
},
|
||||
async onLoad(option) {
|
||||
|
||||
|
||||
// 等待0.3秒页面渲染,$nextTick使用不能准确
|
||||
setTimeout(() => {
|
||||
this.getInfo(option);
|
||||
this.getIsFollow(option);
|
||||
uni.hideLoading()
|
||||
// 获取导航条距顶部高度
|
||||
this.setTabbarTop();
|
||||
@@ -333,6 +313,73 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
async getIsFollow(option) {
|
||||
console.log(this.userInfo)
|
||||
console.log(option)
|
||||
const res = await uniCloud.importObject("follow").getIsFollow({
|
||||
uid: this.userInfo._id,
|
||||
fid: option.uid
|
||||
})
|
||||
console.log(res)
|
||||
if (res.code === 200) this.isFollow = res.isFollow;
|
||||
else {
|
||||
console.log("关注检测异常")
|
||||
}
|
||||
},
|
||||
async toFollow() {
|
||||
|
||||
console.log(this.isFollow)
|
||||
try {
|
||||
|
||||
if (this.isFollow === false) {
|
||||
const res = await uniCloud.importObject("follow").follow({
|
||||
uid: this.userInfo._id,
|
||||
fid: this.uid
|
||||
});
|
||||
if (res.code === 200) {
|
||||
console.log(res);
|
||||
this.isFollow = true;
|
||||
} else {
|
||||
console.log(res.msg);
|
||||
}
|
||||
}
|
||||
else if (this.isFollow === true) {
|
||||
const res = await uniCloud.importObject("follow").reFollow({
|
||||
uid: this.userInfo._id,
|
||||
fid: this.uid
|
||||
});
|
||||
if (res.code === 200) {
|
||||
if (res.code === 200) {
|
||||
console.log(res);
|
||||
this.isFollow = false;
|
||||
}
|
||||
} else {
|
||||
console.log(res.msg)
|
||||
}
|
||||
}
|
||||
}catch(e) {
|
||||
console.log(e.message)
|
||||
}
|
||||
},
|
||||
checkUrlProtocol(url) {
|
||||
try {
|
||||
const protocolSeparatorIndex = url.indexOf('://');
|
||||
if (protocolSeparatorIndex === -1) {
|
||||
return 'invalid';
|
||||
}
|
||||
const protocol = url.substring(0, protocolSeparatorIndex).toLowerCase();
|
||||
|
||||
if (protocol === 'http' || protocol === 'https') {
|
||||
return 'http/https';
|
||||
} else if (protocol === 'cloud') {
|
||||
return 'cloud';
|
||||
} else {
|
||||
return 'other';
|
||||
}
|
||||
} catch (error) {
|
||||
return 'invalid';
|
||||
}
|
||||
},
|
||||
async getInfo(option) {
|
||||
this.uid = option.uid;
|
||||
if (this.uid) { // ID 不为空,则发起查询
|
||||
@@ -345,18 +392,20 @@
|
||||
|
||||
console.log(this.where)
|
||||
|
||||
await uniCloud.importObject("user-info").get_user_info({
|
||||
const res = await uniCloud.importObject("user-info").get_user_info({
|
||||
uid: this.uid
|
||||
})
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
this.userinfo = res.data;
|
||||
this.gender = res.data.gender;
|
||||
this.userinfo.city = res.data.last_login_ip;
|
||||
this.userinfo.nickname = res.data.nickname;
|
||||
this.Information = res.data.personal_profile;
|
||||
this.$refs.udb.loadData()
|
||||
})
|
||||
});
|
||||
if (res) console.log(res);
|
||||
if (res.code === 200 ) {
|
||||
this.userinfo = res.data;
|
||||
this.gender = res.data.gender;
|
||||
this.userinfo.city = res.data.last_login_ip;
|
||||
this.userinfo.nickname = res.data.nickname;
|
||||
this.userinfo.avatar_file = res.data.avatar_file;
|
||||
this.userinfo._id = res.data._id;
|
||||
this.Information = res.data.personal_profile;
|
||||
this.$refs.udb.loadData()
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
@@ -394,11 +443,9 @@
|
||||
}
|
||||
this.listData = this.loadType === 'loadMore' ? this.listData.concat(listData) : listData
|
||||
this.loadType = null
|
||||
console.log(111);
|
||||
} else {
|
||||
this.listData = this.loadType === 'loadMore' ? this.listData.concat([]) :[];
|
||||
this.loadType = null
|
||||
console.log(111);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -426,11 +473,9 @@
|
||||
|
||||
this.listData1 = this.loadType === 'loadMore' ? this.listData1.concat(listData1) : listData1
|
||||
this.loadType = null
|
||||
console.log(111);
|
||||
} else {
|
||||
this.listData1 = this.loadType === 'loadMore' ? this.listData1.concat([]) : []
|
||||
this.loadType = null;
|
||||
console.log(111);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -608,6 +653,7 @@
|
||||
}
|
||||
|
||||
.info-avatar {
|
||||
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -56rpx;
|
||||
|
||||
Reference in New Issue
Block a user