index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
  5. <cHead @selectMenu="selectMenu" :activeKey="current">
  6. <template v-slot:info>
  7. <component v-show="current == 'home'" :is="home"> </component>
  8. <component v-show="current == 'brain'" :is="brain"> </component>
  9. <component v-show="current == 'news'" :is="news"> </component>
  10. <component v-show="current == 'demand'" :is="demand"> </component>
  11. <component v-show="current == 'achievement'" :is="achievement"> </component>
  12. <component v-show="current == 'innovation'" :is="innovation"> </component>
  13. </template>
  14. </cHead>
  15. </el-col>
  16. </el-row>
  17. <el-dialog v-model="dialog" title="智能客服">
  18. <el-col :span="24" class="dialog">
  19. <div class="content">
  20. <div class="title">智能客服为您服务</div>
  21. <div class="list">
  22. <el-image class="image" :src="kf" fit="fill" />
  23. <div class="message">Hi,遇到问题随时找智能客服哟~ 有什么需要我帮忙的吗?</div>
  24. </div>
  25. </div>
  26. <div class="foot">
  27. <textarea class="input" placeholder="输入消息"></textarea>
  28. <div class="button">
  29. <div class="send">发 送</div>
  30. </div>
  31. </div>
  32. </el-col>
  33. </el-dialog>
  34. </div>
  35. </template>
  36. <script setup lang="ts">
  37. // 基础
  38. import type { Ref } from 'vue';
  39. import { onMounted, ref } from 'vue';
  40. import { useRoute } from 'vue-router';
  41. // 图片引入
  42. import kf from '@/assets/kf.png';
  43. // 接口
  44. // import { ToolsStore } from '@/stores/tool';
  45. // import type { IQueryResult } from '@/util/types.util'
  46. // const toolsAxios = ToolsStore();
  47. // 组件
  48. import home from './components/home.vue';
  49. import brain from './components/brain.vue';
  50. import news from './components/news.vue';
  51. import demand from './components/demand.vue';
  52. import achievement from './components/achievement.vue';
  53. import innovation from './components/innovation.vue';
  54. // 路由
  55. const route = useRoute();
  56. // 加载中
  57. const loading: Ref<any> = ref(false);
  58. const current = ref(localStorage.getItem('href') || 'home'); // 创建一个响应式数据;
  59. // 是否弹框客服
  60. const dialog: Ref<any> = ref(false);
  61. // 请求
  62. onMounted(async () => {
  63. loading.value = true;
  64. search();
  65. loading.value = false;
  66. });
  67. const search = async () => {
  68. // let res: IQueryResult = await toolsAxios.dataCount();
  69. // if (res.errcode == '0') {
  70. // info.value = res.data;
  71. // }
  72. };
  73. // 菜单选择
  74. const selectMenu = async (item) => {
  75. current.value = item;
  76. localStorage.setItem('href', item);
  77. };
  78. </script>
  79. <style scoped lang="scss">
  80. :deep(.el-dialog__body) {
  81. padding: 0 !important;
  82. }
  83. .dialog {
  84. .content {
  85. padding: 20px;
  86. .title {
  87. padding-top: 23px;
  88. padding-bottom: 26px;
  89. display: flex;
  90. flex-direction: row;
  91. align-items: center;
  92. justify-content: center;
  93. font-size: 14px;
  94. color: rgba(0, 0, 0, 0.45);
  95. }
  96. .list {
  97. display: flex;
  98. align-items: center;
  99. .image {
  100. width: 60px;
  101. height: 60px;
  102. border-radius: 60px;
  103. margin: 0 10px 0 0;
  104. }
  105. .message {
  106. position: relative;
  107. max-width: 330px;
  108. border-radius: 4px;
  109. font-size: 14px;
  110. line-height: 22px;
  111. box-sizing: border-box;
  112. color: rgba(0, 0, 0, 0.65);
  113. padding: 16px 11px 16px 16px;
  114. background: #ffffff;
  115. box-shadow: 0px 2px 10px 1px rgba(0, 0, 0, 0.12);
  116. }
  117. }
  118. }
  119. .foot {
  120. height: 140px;
  121. background: rgba(0, 0, 0, 0.04);
  122. border: 1px solid rgba(0, 0, 0, 0.15);
  123. padding: 13px 20px;
  124. display: flex;
  125. flex-direction: column;
  126. align-items: stretch;
  127. .input {
  128. flex: 1;
  129. height: 0;
  130. resize: none;
  131. border: none;
  132. outline: none;
  133. background: transparent;
  134. font-size: 14px;
  135. line-height: 22px;
  136. }
  137. .button {
  138. margin-top: 8px;
  139. flex-shrink: 0;
  140. display: flex;
  141. flex-direction: row;
  142. justify-content: flex-end;
  143. .send {
  144. cursor: pointer;
  145. color: #fff;
  146. background: #2f54eb;
  147. border-radius: 4px;
  148. width: 64px;
  149. height: 32px;
  150. font-size: 14px;
  151. display: flex;
  152. align-items: center;
  153. justify-content: center;
  154. }
  155. }
  156. }
  157. }
  158. </style>