85 lines
1.6 KiB
Vue
85 lines
1.6 KiB
Vue
<template>
|
|
<view v-if="showImg" class="ai-entrance">
|
|
<image
|
|
:src="settingInfo.mainImage"
|
|
mode="widthFix"
|
|
class="img"
|
|
@click="enterAiChat()"
|
|
/>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getAiSystemInfoSetting
|
|
} from '@/api/public'
|
|
import {
|
|
getCountyAiDetail
|
|
} from '@/api/chat/index'
|
|
export default {
|
|
name: 'AiEntrance',
|
|
props: {
|
|
cityName: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
countyId: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
showImg: false,
|
|
settingInfo: {},
|
|
localCityName: uni.getStorageSync('locationCityName') || ''
|
|
}
|
|
},
|
|
created() {
|
|
this.init()
|
|
},
|
|
methods: {
|
|
init() {
|
|
if (this.countyId) {
|
|
getCountyAiDetail({
|
|
countyId: this.countyId
|
|
}).then(res => {
|
|
const { success, data } = res
|
|
if (success) {
|
|
const aiImage = data.aiImage || ''
|
|
this.settingInfo.mainImage = aiImage
|
|
this.showImg = !!aiImage
|
|
}
|
|
})
|
|
return
|
|
}
|
|
getAiSystemInfoSetting().then(res => {
|
|
const { success, data } = res
|
|
if (success) {
|
|
this.settingInfo = data
|
|
this.showImg = data.showOnAppIndex === 1
|
|
}
|
|
})
|
|
},
|
|
enterAiChat() {
|
|
uni.navigateTo({
|
|
url: '/aiChat/views/index?click=1&cityName=' + (this.cityName || this.localCityName) + '&countyId=' + (this.countyId || '')
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.ai-entrance {
|
|
position: fixed;
|
|
right: 0;
|
|
top: 50%;
|
|
z-index: 5;
|
|
transform: translateY(-50%);
|
|
.img {
|
|
width: 88rpx;
|
|
}
|
|
}
|
|
</style>
|