messagesInfoDefault.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view class=" messagesInfoDefault">
  3. <view class="flex_1 flex-column-center">
  4. <image
  5. src="/static/img/service/aijiqiren.png"
  6. class="service-avatar"
  7. mode="widthFix"
  8. />
  9. <view class="bold font_size40 mt20">Hi~,我是财税小助手!</view>
  10. </view>
  11. <view class="padding30 border_radius_20 bg_color_fff mt20" v-if="adSearchList.length>0">
  12. <view class="font_size30 bold">AI赋能,专业解答财税问题</view>
  13. <view class="font_size25 mt20 padding20 bg_color_f5 border_radius_20"
  14. @click="sendMessage(item.dictValue)"
  15. v-for="(item,index) in adSearchList" :key="index">
  16. #{{item.dictValue}}
  17. </view>
  18. <view class="flex-center mt20">
  19. <view class="flex-center-between gray" @click="getAdSearchFn">
  20. <img src="/static/img/shuaxin.png" alt="" class="mr20" style="width:40rpx;height:40rpx;"/>
  21. <text>换一批</text>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- <view class="gray mt20 font_size25 flex-center">( 下拉获取历史数据 )</view> -->
  26. </view>
  27. </template>
  28. <script setup>
  29. import { ref,watch,nextTick } from "vue";
  30. import { getAdSearch } from "@/api/home";
  31. import { useAppStore } from "@/stores/app";
  32. import { onLoad } from '@dcloudio/uni-app'
  33. const appStore = useAppStore();
  34. const adSearchList = ref([]);
  35. const emit = defineEmits(['sendMessage']);
  36. defineExpose({
  37. getAdSearchFn
  38. });
  39. // watch(() => appStore.agentId, (state) => {
  40. // nextTick(()=>{
  41. // setTimeout(()=>{
  42. // getAdSearchFn();
  43. // },500)
  44. // })
  45. // });
  46. function getAdSearchFn(){
  47. getAdSearch(appStore.agentId).then(res=>{
  48. if(res.code == 200){
  49. adSearchList.value = res.data || [];
  50. }
  51. })
  52. }
  53. function sendMessage(msgContent){
  54. emit('sendMessage',{chatType:0,msgContent});
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .messagesInfoDefault{
  59. position: fixed;
  60. width: 100%;
  61. top: 40rpx;
  62. left: 0;
  63. padding: 30rpx;
  64. .service-avatar{
  65. width: 200rpx;
  66. }
  67. }
  68. </style>