congming_huose-apk/pages/kongjian/anquanxq.vue

259 lines
6.3 KiB
Vue

<template>
<view class="device-detail">
<!-- 顶部导航 -->
<view class="tabback">
<view class="rtjt" @click="btnback" style="font-size: 50rpx;"></view>
<view class="name">{{ $i18n.t('securityCompanyDetail') }}</view>
<view style="width: 36rpx;"></view>
</view>
<view class="img">
<image :src="xqobj.logo" mode=""></image>
</view>
<view class="guanli">
<view class="hezi" style="border-bottom: 1px solid #D8D8D8;">
<view class="lt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uhAjj5mjJXEJsm5g8fiG" mode=""></image>
<view class="">
<text class="one">{{ $i18n.t('companyName') }}</text>
<text class="two">{{xqobj.name}}</text>
</view>
</view>
<view class=""></view>
</view>
<view class="hezi" style="border-bottom: 1px solid #D8D8D8;" @click="btntel">
<view class="lt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uwlbogrtVgcOMQElD4Fw" mode=""></image>
<view class="">
<text class="one">{{ $i18n.t('companyPhone') }}</text>
<text class="two">{{xqobj.phone}}</text>
</view>
</view>
<image style="width: 72rpx;height: 72rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uB6FO31UpSNWjbz0zVS7" mode=""></image>
</view>
<view class="hezi" style="border-bottom: 1px solid #D8D8D8;" @click="btnemail">
<view class="lt">
<image src="https://api.ccttiot.com/smartmeter/img/static/umwKb6l3vZpGW1xEwgDW" mode=""></image>
<view class="">
<text class="one">{{ $i18n.t('emailLabel') }}</text>
<text class="two">{{xqobj.email}}</text>
</view>
</view>
<image style="width: 72rpx;height: 72rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uwEfRqaz2EHNqZ5soFAI" mode=""></image>
</view>
<view class="hezi" style="border-bottom: 1px solid #D8D8D8;">
<view class="lt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uTHcfYtX8VZA6nbV4yin" mode=""></image>
<view class="">
<text class="one">{{ $i18n.t('websiteLabel') }}</text>
<text class="two">{{xqobj.website == null ? '--' : xqobj.website}}</text>
</view>
</view>
<image style="width: 72rpx;height: 72rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uEXyvsA6LzF56VBUGve7" mode=""></image>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
xqobj:{},
id:''
}
},
computed: {
// 计算当前语言,用于触发更新
currentLanguage() {
return this.$i18n.getCurrentLanguage();
}
},
watch: {
// 监听语言变化,强制更新组件
currentLanguage() {
console.log('安全公司详情页面语言变化:', this.currentLanguage);
this.$forceUpdate();
}
},
onLoad(option) {
this.id = option.id
this.getxq()
},
onShow() {
// 页面显示时强制更新
this.$forceUpdate();
},
mounted() {
// 监听语言变化事件
uni.$on('languageChanged', this.handleLanguageChange);
},
beforeDestroy() {
// 移除事件监听
uni.$off('languageChanged', this.handleLanguageChange);
},
methods: {
// 处理语言变化
handleLanguageChange() {
this.$forceUpdate();
},
// 点击拨打电话
btntel(){
uni.makePhoneCall({
phoneNumber: this.xqobj.phone,
success: function() {
console.log(this.$i18n.t('phoneCallSuccess'))
},
fail: function() {
console.log(this.$i18n.t('phoneCallFailed'))
}
})
},
// 点击发送邮件
btnemail(){
// 检查邮箱是否存在
if(!this.xqobj.email){
uni.showToast({
title: this.$i18n.t('emailNotExists'),
icon: 'none'
})
return
}
// 使用 plus.runtime.openURL 打开邮件客户端
// #ifdef APP-PLUS
plus.runtime.openURL(`mailto:${this.xqobj.email}`, function(res) {
console.log(this.$i18n.t('emailClientOpenedSuccess'))
}, function(err) {
console.log(this.$i18n.t('emailClientOpenFailed') + err.message)
// 如果打开邮件客户端失败,显示提示
uni.showToast({
title: this.$i18n.t('cannotOpenEmailClient'),
icon: 'none'
})
})
// #endif
// #ifdef H5
// H5环境下使用 window.location.href
window.location.href = `mailto:${this.xqobj.email}`
// #endif
// #ifdef MP-WEIXIN
// 小程序环境下复制邮箱地址到剪贴板
uni.setClipboardData({
data: this.xqobj.email,
success: function() {
uni.showToast({
title: this.$i18n.t('emailCopiedToClipboard'),
icon: 'success'
})
},
fail: function() {
uni.showToast({
title: this.$i18n.t('copyFailed'),
icon: 'none'
})
}
})
// #endif
},
// 请求安全公司详情
getxq(){
this.$http.get(`/app/company/detail?id=${this.id}`).then(res =>{
if(res.code == 200){
this.xqobj = res.data[0]
}
})
},
// 点击返回上一级
btnback(){
uni.navigateBack()
}
}
}
</script>
<style scoped lang="less">
.guanli{
background-color: #fff;
margin-top: 60rpx;
.hezi{
display: flex;
justify-content: space-between;
height: 122rpx;
align-items: center;
padding: 0 32rpx;
.lt{
font-size: 30rpx;
color: #3D3D3D;
display: flex;
align-items: center;
view{
.one{
font-size: 26rpx;
color: #727272;
}
.two{
font-size: 30rpx;
color: #3D3D3D;
margin-top: 4rpx;
}
text{
display: block;
}
}
image{
width: 80rpx;
height: 80rpx;
// background: #D8D8D8;
border-radius: 6rpx 6rpx 6rpx 6rpx;
margin-right: 50rpx;
}
}
}
}
.img{
width: 252rpx;
height: 252rpx;
background: #D8D8D8;
border-radius: 20rpx 20rpx 20rpx 20rpx;
margin: auto;
margin-top: 60rpx;
image{
width: 252rpx;
height: 252rpx;
border-radius: 20rpx 20rpx 20rpx 20rpx;
}
}
.device-detail{
background-color: #F3F5F6;
}
.tabback {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 100rpx;
padding: 0 20rpx;
box-sizing: border-box;
background-color: #fff;
margin-top: 80rpx;
box-shadow: 0rpx 0rpx 0rpx 0rpx;
.rtjt {
font-size: 36rpx;
color: #333;
}
.name {
font-size: 36rpx;
font-weight: bold;
color: #333;
}
}
.device-detail {
height: 93vh;
}
</style>