联系社区功能
This commit is contained in:
parent
76660dd3f4
commit
62235ef6fb
@ -26,7 +26,7 @@
|
||||
|
||||
<!-- 功能按钮区域 -->
|
||||
<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">
|
||||
<image class="icon" :src='item.url' mode="aspectFit"></image>
|
||||
<text class="label">{{item.name}}</text>
|
||||
@ -85,6 +85,14 @@
|
||||
</view>
|
||||
</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>
|
||||
</view>
|
||||
</template>
|
||||
@ -158,6 +166,8 @@
|
||||
name: '联系社区',
|
||||
},
|
||||
],
|
||||
communityPhone: '0513-59000051',
|
||||
showPhoneDialog: false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
@ -550,19 +560,52 @@
|
||||
},
|
||||
|
||||
// 跳转页面
|
||||
goPage(page) {
|
||||
goPage(item) {
|
||||
if (item.key === 6) { // 联系社区的特殊处理
|
||||
this.handleContactCommunity();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.checkLogin()) {
|
||||
this.showEditModal = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (page) {
|
||||
if (item.pageUrl) {
|
||||
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() {
|
||||
const token = uni.getStorageSync('token');
|
||||
@ -825,7 +868,8 @@
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.wechat-icon, .phone-icon {
|
||||
.wechat-icon,
|
||||
.phone-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 15rpx;
|
||||
@ -839,5 +883,17 @@
|
||||
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>
|
||||
Loading…
x
Reference in New Issue
Block a user