From 05b5babcbd1be78561572dccf37fd5ea589a2af4 Mon Sep 17 00:00:00 2001 From: zyronon Date: Thu, 28 Mar 2024 18:55:09 +0800 Subject: [PATCH] save --- src/api/videos.js | 3 +++ src/components/Comment.vue | 8 +++++++- src/mock/index.js | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/api/videos.js b/src/api/videos.js index e712022..c3c9248 100644 --- a/src/api/videos.js +++ b/src/api/videos.js @@ -22,4 +22,7 @@ export function privateVideo(params, data) { export function likeVideo(params, data) { return request({url: '/video/like', method: 'get', params, data}) +} +export function videoComments(params, data) { + return request({url: '/video/comments', method: 'get', params, data}) } \ No newline at end of file diff --git a/src/components/Comment.vue b/src/components/Comment.vue index cc3b37e..2352481 100644 --- a/src/components/Comment.vue +++ b/src/components/Comment.vue @@ -133,10 +133,13 @@ import Loading from "./Loading"; import Search from "./Search"; import {$no} from "@/utils"; import {useBaseStore} from "@/store/pinia"; +import {videoComments} from "@/api/videos"; +import Popover from "@/pages/login/components/Tooltip.vue"; export default { name: "Comment", components: { + Popover, AutoInput, ConfirmDialog, FromBottomDialog, @@ -207,6 +210,8 @@ export default { this.isCall = false }, async getData() { + let res = await videoComments() + console.log('res', res) await this.$sleep(500) this.comments = [ { @@ -360,7 +365,8 @@ export default { .right { display: flex; gap: 12rem; - + position: relative; + z-index: 9; svg { background: rgb(242, 242, 242); padding: 4rem; diff --git a/src/mock/index.js b/src/mock/index.js index 387b0fe..d6d26e5 100644 --- a/src/mock/index.js +++ b/src/mock/index.js @@ -5,6 +5,7 @@ import {BASE_URL} from "@/config"; import {useBaseStore} from "@/store/pinia"; import axiosInstance from "@/utils/request"; import MockAdapter from "axios-mock-adapter"; +import Mock from "mockjs"; const mock = new MockAdapter(axiosInstance, {delayResponse: 300}); @@ -200,5 +201,40 @@ export async function startMock() { }] }) + mock.onGet(/video\/comments/).reply(async (config) => { + return new Promise(function (resolve, reject) { + setTimeout(()=>{ + requestIdleCallback(() => { + let data = Mock.mock({ + 'list|5-50': [{ + name: '@cname', + text: '@cparagraph(3)', + createTime: '@date("T")', + collect_count: '@int(3,1000)' + }] + }) + + data.list.map(v => [ + v.children = Mock.mock({ + 'list|0-5': [{ + name: '@cname', + text: '@cparagraph(3)', + createTime: '@date("T")', + collect_count: '@int(3,1000)' + }] + }) + ]) + + resolve([200, { + data: { + total: data.list.length, + list: data.list, + }, code: 200, msg: '', + }]) + }) + }) + }); + }) + setTimeout(fetchData, 1000) } \ No newline at end of file