index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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" :currentIndex="current" :is_foot="is_foot" :is_head="is_head">
  6. <template v-slot:info>
  7. <component v-if="current == 'home'" :is="home"> </component>
  8. <component v-else-if="current == 'tran'" :is="transaction"> </component>
  9. <component v-else-if="current == 'achieve'" :is="achievement"> </component>
  10. <component v-else-if="current == 'demand'" :is="demand"> </component>
  11. <component v-else-if="current == 'service'" :is="service"> </component>
  12. <component v-else-if="current == 'activity'" :is="activity"> </component>
  13. </template>
  14. </cHead>
  15. </el-col>
  16. </el-row>
  17. <div class="tool tool1" v-if="isOpen" @click="toOpen">
  18. <el-col :span="24" class="tool_1" v-for="(item, index) in toolList" :key="index" @click="toCommon(item)">
  19. <el-image class="image" :src="item.url" fit="fill" />
  20. <span>{{ item.name }}</span>
  21. </el-col>
  22. </div>
  23. <div class="tool tool2" v-else @click="toOpen">
  24. <div class="bgc">
  25. <el-image class="image" src="/src/assets/logo.png" fit="fill" />
  26. </div>
  27. </div>
  28. <el-dialog v-model="dialog" title="智能客服">
  29. <el-col :span="24" class="dialog">
  30. <div class="content">
  31. <div class="title">智能客服为您服务</div>
  32. <div class="list">
  33. <el-image class="image" src="/src/assets/kf.png" fit="fill" />
  34. <div class="message">Hi,遇到问题随时找智能客服哟~ 有什么需要我帮忙的吗?</div>
  35. </div>
  36. </div>
  37. <div class="foot">
  38. <textarea class="input" placeholder="输入消息"></textarea>
  39. <div class="button">
  40. <div class="send">发 送</div>
  41. </div>
  42. </div>
  43. </el-col>
  44. </el-dialog>
  45. </div>
  46. </template>
  47. <script setup lang="ts">
  48. // 基础
  49. import type { Ref } from 'vue';
  50. import { onMounted, ref } from 'vue';
  51. // 接口
  52. // import { ToolsStore } from '@/stores/tool';
  53. // import type { IQueryResult } from '@/util/types.util'
  54. // const toolsAxios = ToolsStore();
  55. // 组件
  56. import home from './components/home.vue';
  57. import transaction from './components/transaction.vue';
  58. import achievement from './components/achievement.vue';
  59. import demand from './components/demand.vue';
  60. import service from './components/service.vue';
  61. import activity from './components/activity.vue';
  62. // 加载中
  63. const loading: Ref<any> = ref(false);
  64. const current = ref('tran'); // 创建一个响应式数据
  65. const is_head: Ref<any> = ref(true);
  66. const is_foot: Ref<any> = ref(true);
  67. // 菜单
  68. const toolList: Ref<any> = ref([
  69. { name: '我要交易', url: '/src/assets/service_1.png', route: 'tran' },
  70. { name: '找成果', url: '/src/assets/service_3.png', route: 'achieve' },
  71. { name: '找项目', url: '/src/assets/service_2.png', route: 'demand' },
  72. { name: '找服务', url: '/src/assets/service_4.png', route: 'service' },
  73. // { name: '发布成果', url: '/src/assets/service_4.png' },
  74. // { name: '发布需求', url: '/src/assets/service_4.png' },
  75. { name: '智能客服', url: '/src/assets/service_5.png', type: '0' },
  76. { name: '返回顶部', url: '/src/assets/service_6.png', type: '1' }
  77. ]);
  78. // 是否展开
  79. const isOpen: Ref<any> = ref(false);
  80. // 是否弹框客服
  81. const dialog: Ref<any> = ref(false);
  82. // 请求
  83. onMounted(async () => {
  84. loading.value = true;
  85. search();
  86. loading.value = false;
  87. });
  88. const search = async () => {
  89. // let res: IQueryResult = await toolsAxios.dataCount();
  90. // if (res.errcode == '0') {
  91. // info.value = res.data;
  92. // }
  93. };
  94. // 菜单选择
  95. const selectMenu = async (item) => {
  96. if (item.key == 'home') {
  97. is_head.value = false;
  98. is_foot.value = false;
  99. } else {
  100. is_head.value = true;
  101. is_foot.value = true;
  102. }
  103. current.value = item.key;
  104. };
  105. // 展开菜单
  106. const toOpen = () => {
  107. isOpen.value = !isOpen.value;
  108. };
  109. // 菜单按钮
  110. const toCommon = (item) => {
  111. if (item.route) {
  112. current.value = item.route;
  113. } else {
  114. if (item.type == '0') dialog.value = true;
  115. else window.scrollTo(0, 0);
  116. }
  117. };
  118. </script>
  119. <style scoped lang="scss">
  120. .tool {
  121. position: fixed;
  122. right: 8px;
  123. top: 50%;
  124. z-index: 20;
  125. }
  126. .tool1 {
  127. position: fixed;
  128. right: 12px;
  129. top: 20%;
  130. box-shadow: 0 6px 20px 0 #255bda;
  131. border-radius: 56px;
  132. width: 70px;
  133. padding: 15px 0;
  134. background-image: linear-gradient(-34deg, #255bda, #3471f0 96%);
  135. .tool_1 {
  136. display: flex;
  137. flex-direction: column;
  138. align-items: center;
  139. margin: 5px;
  140. .image {
  141. width: 30px;
  142. height: 30px;
  143. margin: 5px 0 0 0;
  144. }
  145. span {
  146. font-size: 12px;
  147. color: #ffffff;
  148. }
  149. }
  150. }
  151. .tool2 {
  152. .bgc {
  153. background: linear-gradient(#fff, #448de0);
  154. animation: bgc 2s infinite linear;
  155. }
  156. /* 渐变色背景旋转动画 */
  157. @keyframes bgc {
  158. 0% {
  159. transform: rotateZ(0);
  160. }
  161. 100% {
  162. transform: rotateZ(360deg);
  163. }
  164. }
  165. .image {
  166. width: 50px;
  167. height: 50px;
  168. border-radius: 50px;
  169. }
  170. }
  171. :deep(.el-dialog__body) {
  172. padding: 0 !important;
  173. }
  174. .dialog {
  175. .content {
  176. padding: 20px;
  177. .title {
  178. padding-top: 23px;
  179. padding-bottom: 26px;
  180. display: flex;
  181. flex-direction: row;
  182. align-items: center;
  183. justify-content: center;
  184. font-size: 14px;
  185. color: rgba(0, 0, 0, 0.45);
  186. }
  187. .list {
  188. display: flex;
  189. align-items: center;
  190. .image {
  191. width: 60px;
  192. height: 60px;
  193. border-radius: 60px;
  194. margin: 0 10px 0 0;
  195. }
  196. .message {
  197. position: relative;
  198. max-width: 330px;
  199. border-radius: 4px;
  200. font-size: 14px;
  201. line-height: 22px;
  202. box-sizing: border-box;
  203. color: rgba(0, 0, 0, 0.65);
  204. padding: 16px 11px 16px 16px;
  205. background: #ffffff;
  206. box-shadow: 0px 2px 10px 1px rgba(0, 0, 0, 0.12);
  207. }
  208. }
  209. }
  210. .foot {
  211. height: 140px;
  212. background: rgba(0, 0, 0, 0.04);
  213. border: 1px solid rgba(0, 0, 0, 0.15);
  214. padding: 13px 20px;
  215. display: flex;
  216. flex-direction: column;
  217. align-items: stretch;
  218. .input {
  219. flex: 1;
  220. height: 0;
  221. resize: none;
  222. border: none;
  223. outline: none;
  224. background: transparent;
  225. font-size: 14px;
  226. line-height: 22px;
  227. }
  228. .button {
  229. margin-top: 8px;
  230. flex-shrink: 0;
  231. display: flex;
  232. flex-direction: row;
  233. justify-content: flex-end;
  234. .send {
  235. cursor: pointer;
  236. color: #fff;
  237. background: #2f54eb;
  238. border-radius: 4px;
  239. width: 64px;
  240. height: 32px;
  241. font-size: 14px;
  242. display: flex;
  243. align-items: center;
  244. justify-content: center;
  245. }
  246. }
  247. }
  248. }
  249. </style>