联系社区功能

This commit is contained in:
qiuyuan 2025-07-28 10:40:48 +08:00
parent 76660dd3f4
commit 62235ef6fb

View File

@ -26,7 +26,7 @@
<!-- 功能按钮区域 --> <!-- 功能按钮区域 -->
<view class="function-card"> <view class="function-card">
<view class="button-item" v-for="(item, index) in choseList" :key="index" @click="goPage(item.pageUrl)"> <view class="button-item" v-for="(item, index) in choseList" :key="index" @click="goPage(item)">
<view class="button-content"> <view class="button-content">
<image class="icon" :src='item.url' mode="aspectFit"></image> <image class="icon" :src='item.url' mode="aspectFit"></image>
<text class="label">{{item.name}}</text> <text class="label">{{item.name}}</text>
@ -85,6 +85,14 @@
</view> </view>
</u-modal> </u-modal>
<u-modal :show="showPhoneDialog" title="联系社区" confirm-text="拨打" cancel-text="取消" @confirm="callCommunityPhone"
@cancel="showPhoneDialog = false">
<view class="phone-dialog-content">
<text>社区电话</text>
<text class="phone-number">{{communityPhone}}</text>
</view>
</u-modal>
<Footer></Footer> <Footer></Footer>
</view> </view>
</template> </template>
@ -158,6 +166,8 @@
name: '联系社区', name: '联系社区',
}, },
], ],
communityPhone: '0513-59000051',
showPhoneDialog: false
} }
}, },
onShow() { onShow() {
@ -550,19 +560,52 @@
}, },
// //
goPage(page) { goPage(item) {
if (item.key === 6) { //
this.handleContactCommunity();
return;
}
if (!this.checkLogin()) { if (!this.checkLogin()) {
this.showEditModal = true; this.showEditModal = true;
return; return;
} }
if (page) { if (item.pageUrl) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/${page}/index` url: `/pages/${item.pageUrl}/index`
}); });
} }
}, },
//
handleContactCommunity() {
if (!this.checkLogin()) {
this.showEditModal = true;
return;
}
this.showPhoneDialog = true;
},
//
callCommunityPhone() {
uni.makePhoneCall({
phoneNumber: this.communityPhone,
success: () => {
console.log('拨打电话成功');
},
fail: (err) => {
uni.showToast({
title: '拨打电话失败',
icon: 'none'
});
console.error('拨打电话失败:', err);
}
});
this.showPhoneDialog = false;
},
// //
checkLogin() { checkLogin() {
const token = uni.getStorageSync('token'); const token = uni.getStorageSync('token');
@ -825,7 +868,8 @@
opacity: 0.9; opacity: 0.9;
} }
.wechat-icon, .phone-icon { .wechat-icon,
.phone-icon {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
margin-right: 15rpx; margin-right: 15rpx;
@ -839,5 +883,17 @@
text-align: center; text-align: center;
} }
} }
.phone-dialog-content {
padding: 40rpx;
text-align: center;
font-size: 32rpx;
.phone-number {
font-weight: bold;
color: #2979ff;
margin-left: 10rpx;
}
}
} }
</style> </style>