123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <template>
- <div id="index">
- <el-row>
- <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
- <cHead @selectMenu="selectMenu" :currentIndex="current" :is_foot="is_foot" :is_head="is_head">
- <template v-slot:info>
- <component v-if="current == 'home'" :is="home"> </component>
- <component v-else-if="current == 'tran'" :is="transaction"> </component>
- <component v-else-if="current == 'achieve'" :is="achievement"> </component>
- <component v-else-if="current == 'demand'" :is="demand"> </component>
- <component v-else-if="current == 'service'" :is="service"> </component>
- <component v-else-if="current == 'activity'" :is="activity"> </component>
- </template>
- </cHead>
- </el-col>
- </el-row>
- <div class="tool tool1" v-if="isOpen" @click="toOpen">
- <el-col :span="24" class="tool_1" v-for="(item, index) in toolList" :key="index" @click="toCommon(item)">
- <el-image class="image" :src="item.url" fit="fill" />
- <span>{{ item.name }}</span>
- </el-col>
- </div>
- <div class="tool tool2" v-else @click="toOpen">
- <div class="bgc">
- <el-image class="image" src="/src/assets/logo.png" fit="fill" />
- </div>
- </div>
- <el-dialog v-model="dialog" title="智能客服">
- <el-col :span="24" class="dialog">
- <div class="content">
- <div class="title">智能客服为您服务</div>
- <div class="list">
- <el-image class="image" src="/src/assets/kf.png" fit="fill" />
- <div class="message">Hi,遇到问题随时找智能客服哟~ 有什么需要我帮忙的吗?</div>
- </div>
- </div>
- <div class="foot">
- <textarea class="input" placeholder="输入消息"></textarea>
- <div class="button">
- <div class="send">发 送</div>
- </div>
- </div>
- </el-col>
- </el-dialog>
- </div>
- </template>
- <script setup lang="ts">
- // 基础
- import type { Ref } from 'vue';
- import { onMounted, ref } from 'vue';
- // 接口
- // import { ToolsStore } from '@/stores/tool';
- // import type { IQueryResult } from '@/util/types.util'
- // const toolsAxios = ToolsStore();
- // 组件
- import home from './components/home.vue';
- import transaction from './components/transaction.vue';
- import achievement from './components/achievement.vue';
- import demand from './components/demand.vue';
- import service from './components/service.vue';
- import activity from './components/activity.vue';
- // 加载中
- const loading: Ref<any> = ref(false);
- const current = ref('tran'); // 创建一个响应式数据
- const is_head: Ref<any> = ref(true);
- const is_foot: Ref<any> = ref(true);
- // 菜单
- const toolList: Ref<any> = ref([
- { name: '我要交易', url: '/src/assets/service_1.png', route: 'tran' },
- { name: '找成果', url: '/src/assets/service_3.png', route: 'achieve' },
- { name: '找项目', url: '/src/assets/service_2.png', route: 'demand' },
- { name: '找服务', url: '/src/assets/service_4.png', route: 'service' },
- // { name: '发布成果', url: '/src/assets/service_4.png' },
- // { name: '发布需求', url: '/src/assets/service_4.png' },
- { name: '智能客服', url: '/src/assets/service_5.png', type: '0' },
- { name: '返回顶部', url: '/src/assets/service_6.png', type: '1' }
- ]);
- // 是否展开
- const isOpen: Ref<any> = ref(false);
- // 是否弹框客服
- const dialog: Ref<any> = ref(false);
- // 请求
- onMounted(async () => {
- loading.value = true;
- search();
- loading.value = false;
- });
- const search = async () => {
- // let res: IQueryResult = await toolsAxios.dataCount();
- // if (res.errcode == '0') {
- // info.value = res.data;
- // }
- };
- // 菜单选择
- const selectMenu = async (item) => {
- if (item.key == 'home') {
- is_head.value = false;
- is_foot.value = false;
- } else {
- is_head.value = true;
- is_foot.value = true;
- }
- current.value = item.key;
- };
- // 展开菜单
- const toOpen = () => {
- isOpen.value = !isOpen.value;
- };
- // 菜单按钮
- const toCommon = (item) => {
- if (item.route) {
- current.value = item.route;
- } else {
- if (item.type == '0') dialog.value = true;
- else window.scrollTo(0, 0);
- }
- };
- </script>
- <style scoped lang="scss">
- .tool {
- position: fixed;
- right: 8px;
- top: 50%;
- z-index: 20;
- }
- .tool1 {
- position: fixed;
- right: 12px;
- top: 20%;
- box-shadow: 0 6px 20px 0 #255bda;
- border-radius: 56px;
- width: 70px;
- padding: 15px 0;
- background-image: linear-gradient(-34deg, #255bda, #3471f0 96%);
- .tool_1 {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin: 5px;
- .image {
- width: 30px;
- height: 30px;
- margin: 5px 0 0 0;
- }
- span {
- font-size: 12px;
- color: #ffffff;
- }
- }
- }
- .tool2 {
- .bgc {
- background: linear-gradient(#fff, #448de0);
- animation: bgc 2s infinite linear;
- }
- /* 渐变色背景旋转动画 */
- @keyframes bgc {
- 0% {
- transform: rotateZ(0);
- }
- 100% {
- transform: rotateZ(360deg);
- }
- }
- .image {
- width: 50px;
- height: 50px;
- border-radius: 50px;
- }
- }
- :deep(.el-dialog__body) {
- padding: 0 !important;
- }
- .dialog {
- .content {
- padding: 20px;
- .title {
- padding-top: 23px;
- padding-bottom: 26px;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- font-size: 14px;
- color: rgba(0, 0, 0, 0.45);
- }
- .list {
- display: flex;
- align-items: center;
- .image {
- width: 60px;
- height: 60px;
- border-radius: 60px;
- margin: 0 10px 0 0;
- }
- .message {
- position: relative;
- max-width: 330px;
- border-radius: 4px;
- font-size: 14px;
- line-height: 22px;
- box-sizing: border-box;
- color: rgba(0, 0, 0, 0.65);
- padding: 16px 11px 16px 16px;
- background: #ffffff;
- box-shadow: 0px 2px 10px 1px rgba(0, 0, 0, 0.12);
- }
- }
- }
- .foot {
- height: 140px;
- background: rgba(0, 0, 0, 0.04);
- border: 1px solid rgba(0, 0, 0, 0.15);
- padding: 13px 20px;
- display: flex;
- flex-direction: column;
- align-items: stretch;
- .input {
- flex: 1;
- height: 0;
- resize: none;
- border: none;
- outline: none;
- background: transparent;
- font-size: 14px;
- line-height: 22px;
- }
- .button {
- margin-top: 8px;
- flex-shrink: 0;
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- .send {
- cursor: pointer;
- color: #fff;
- background: #2f54eb;
- border-radius: 4px;
- width: 64px;
- height: 32px;
- font-size: 14px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- }
- }
- </style>
|