|
@@ -5,6 +5,7 @@
|
|
<view class="notice-list" v-if="noticeList !='' && noticeList != null">
|
|
<view class="notice-list" v-if="noticeList !='' && noticeList != null">
|
|
<!-- 公告项1 -->
|
|
<!-- 公告项1 -->
|
|
<view class="notice-item" v-for="(item, index) in noticeList" :key="index" @click="handleItemClick(item)">
|
|
<view class="notice-item" v-for="(item, index) in noticeList" :key="index" @click="handleItemClick(item)">
|
|
|
|
+ <navigator class="navigator_item" open-type="navigate" :url="'/pages/notice/detail?id=' + item.id">
|
|
<view class="notice-icon">
|
|
<view class="notice-icon">
|
|
<image
|
|
<image
|
|
class="notice-icon-image"
|
|
class="notice-icon-image"
|
|
@@ -16,8 +17,8 @@
|
|
<view class="notice-title">{{ item.title }}</view>
|
|
<view class="notice-title">{{ item.title }}</view>
|
|
<view class="notice-time">{{ formatTimestamp(item.insert_time)}}</view>
|
|
<view class="notice-time">{{ formatTimestamp(item.insert_time)}}</view>
|
|
</view>
|
|
</view>
|
|
- <navigator class="navigator_item" open-type="navigate" :url="'/pages/notice/detail?id=' + item.id">
|
|
|
|
- <view class="notice-link">
|
|
|
|
|
|
+
|
|
|
|
+ <view class="notice-link" :style="{top: item.isTwoLines ? '67rpx' : '30rpx'}">
|
|
<image
|
|
<image
|
|
class="notice-link-image"
|
|
class="notice-link-image"
|
|
src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/jYNQJdKYavtqeVoq7bxwYFuF258jFm3sNWVSX1SS.png"
|
|
src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/jYNQJdKYavtqeVoq7bxwYFuF258jFm3sNWVSX1SS.png"
|
|
@@ -56,8 +57,24 @@ export default {
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
this.handleScroll();
|
|
this.handleScroll();
|
|
|
|
+ this.checkTitleLines();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ checkTitleLines() {
|
|
|
|
+ // 使用setTimeout确保DOM已经渲染完成
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.noticeList.forEach((item, index) => {
|
|
|
|
+ const query = uni.createSelectorQuery().in(this);
|
|
|
|
+ query.select(`.notice-title`).boundingClientRect(data => {
|
|
|
|
+ if (data && data.height > 40) { // 假设单行高度约为40rpx
|
|
|
|
+ this.$set(item, 'isTwoLines', true);
|
|
|
|
+ } else {
|
|
|
|
+ this.$set(item, 'isTwoLines', false);
|
|
|
|
+ }
|
|
|
|
+ }).exec();
|
|
|
|
+ });
|
|
|
|
+ }, 300);
|
|
|
|
+ },
|
|
handleScroll() {
|
|
handleScroll() {
|
|
const observer = uni.createIntersectionObserver(this);
|
|
const observer = uni.createIntersectionObserver(this);
|
|
observer.relativeToViewport({bottom: 100}).observe('.loading-status', (res) => {
|
|
observer.relativeToViewport({bottom: 100}).observe('.loading-status', (res) => {
|
|
@@ -127,7 +144,6 @@ export default {
|
|
padding: 24rpx 30rpx;
|
|
padding: 24rpx 30rpx;
|
|
border-bottom: 1rpx solid #eee;
|
|
border-bottom: 1rpx solid #eee;
|
|
position: relative;
|
|
position: relative;
|
|
- height: 128rpx;
|
|
|
|
.notice-icon {
|
|
.notice-icon {
|
|
position: absolute;
|
|
position: absolute;
|
|
top: 22rpx;
|
|
top: 22rpx;
|
|
@@ -142,7 +158,6 @@ export default {
|
|
width: 50rpx;
|
|
width: 50rpx;
|
|
height: 50rpx;
|
|
height: 50rpx;
|
|
margin-right: 20rpx;
|
|
margin-right: 20rpx;
|
|
- top:67rpx;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
.notice-link-image,
|
|
.notice-link-image,
|