修复图片路径、键盘监听事件导致详情无法正常渲染等问题

main
Connor 2024-06-08 18:03:43 +08:00
parent c43c960568
commit 7abf5166ee
3 changed files with 28 additions and 20 deletions

View File

@ -8,7 +8,7 @@
<!-- 头像 -->
<div class="avatar-container">
<u-avatar class="avatar-1" size="84rpx" :src="postValue.avatar"></u-avatar>
<image v-if="postValue.isOfficial" class="official-1" src="../static/images/icon/tu3-6.png"></image>
<image v-if="postValue.isOfficial" class="official-1" src="../../../static/images/icon/tu3-6.png"></image>
</div>
<!-- 用户名 -->
<view class="center-content-post-head-title">
@ -54,38 +54,38 @@
<!-- 靠左对齐 -->
<view class="">
<view class="p-item">
<image style="width: 40rpx; height: 40rpx;" src="../static/images/icon/tu2-9.png" mode=""></image>
<image style="width: 40rpx; height: 40rpx;" src="../../../static/images/icon/tu2-9.png" mode=""></image>
<text class="count">{{ postValue.transmitCount }}</text>
</view>
</view>
<!-- 靠右对齐 -->
<view class="flex alignCenter">
<view v-if="postValue.isLike" class="p-item" @click.stop="cancelCollection()">
<image style="width: 40rpx; height: 40rpx;" src="../static/images/icon/tu3-8.png" mode=""></image>
<image style="width: 40rpx; height: 40rpx;" src="../../../static/images/icon/tu3-8.png" mode=""></image>
<text class="count-like">{{ postValue.likeCount }}</text>
</view>
<!-- 靠右对齐 -->
<view v-if="!postValue.isLike" class="p-item" @click.stop="addCollection()">
<image style="width: 40rpx; height: 40rpx;" src="../static/images/icon/tu3-7.png" mode=""></image>
<image style="width: 40rpx; height: 40rpx;" src="../../../static/images/icon/tu3-7.png" mode=""></image>
<text class="count">{{ postValue.likeCount }}</text>
</view>
<!-- 靠右对齐 -->
<view class="p-item margin50">
<image style="width: 40rpx; height: 40rpx;" src="../static/images/icon/tu3-3.png" mode=""></image>
<image style="width: 40rpx; height: 40rpx;" src="../../../static/images/icon/tu3-3.png" mode=""></image>
<text class="count">{{ postValue.commentCount }}</text>
</view>
<!-- 靠右对齐 -->
<view class="p-item margin50" v-if="postValue.ifFavorite" @click.stop="cancelFavorite()">
<image style="width: 40rpx; height: 40rpx;" src="../static/images/icon/tu3-2.png" mode=""></image>
<image style="width: 40rpx; height: 40rpx;" src="../../../static/images/icon/tu3-2.png" mode=""></image>
<text class="count-favorite">{{ postValue.favoriteCount }}</text>
</view>
<!-- 靠右对齐 -->
<view class="p-item margin50" v-if="!postValue.ifFavorite" @click.stop="addFavorite()">
<image style="width: 40rpx; height: 40rpx;" src="../static/images/icon/tu3-1.png" mode=""></image>
<image style="width: 40rpx; height: 40rpx;" src="../../../static/images/icon/tu3-1.png" mode=""></image>
<text class="count">{{ postValue.favoriteCount }}</text>
</view>
</view>

View File

@ -14,14 +14,13 @@
</view>
</view>
</view>
</template>
<template class="img2Box" #center>
<view class="qiehuanBox">
<u-tabs lineColor="#B3D7FF" lineWidth="24" lineHeight="4"
:activeStyle="{ fontWeight: '600rpx',fontSize:'40rpx',color: '#000000'}"
:inactiveStyle="{fontWeight: '400rpx',fontSize:'36rpx',color: '#999999'}"
:list="list1" @click="click"></u-tabs>
:list="list1" :current="viewIndex" @click="click"></u-tabs>
</view>
</template>
@ -139,7 +138,7 @@ import PostView from "@/pages/common/postview/index.vue";
console.log('触底了')
})
const viewIndex = ref(0);
const viewIndex = ref(1);
const searchOpen = ref(false);
const lefther = ref(0);
const searchPrerequisite = ref('热门');

View File

@ -4,7 +4,7 @@
<view class="center-content-focus-line"></view>
<view class="comment">
<view class="flex justifyBetween alignCenter commentTop">
<text class="commentLabel">全部评论</text>
<text class="commentLabel">全部评论4</text>
<text class="report">举报</text>
</view>
<view v-if="!postList" class="no-comment">
@ -111,12 +111,14 @@
</template>
<script setup>
import { ref, reactive, computed, onMounted, getCurrentInstance } from 'vue';
import { ref, reactive, computed, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue';
import PostView from "@/pages/common/postview/index.vue";
const bottomVal = ref(0);
//
onMounted(async () => {
// if (!data.value) {
uni.onKeyboardHeightChange(res => {
if(res.height == 0) {
bottomVal.value = 0;
@ -125,6 +127,13 @@
bottomVal.value = res.height - 20;
console.log(bottomVal.value)
});
// }
})
onBeforeUnmount(async () => {
uni.offKeyboardHeightChange();
});
const postList = reactive([{
avatar: 'https://k.sinaimg.cn/n/sports/transform/400/w600h600/20220130/dd38-eed53ba750d1d8c87eca8b57eda879a5.jpg/w700d1q75cms.jpg?by=cms_fixed_width',