This commit is contained in:
zyronon 2024-03-26 18:11:13 +08:00
parent 7c262f403d
commit 66733efaf7
15 changed files with 28 additions and 47 deletions

View File

@ -1,7 +0,0 @@
import videos from './videos'
import user from './user'
export default {
videos,
// user,
}

View File

@ -1,14 +1,5 @@
import request from "../utils/request";
export default {
friends(params, data) {
return request({url: '/user/friends', method: 'get', params, data})
},
author(params, data) {
return request({url: '/user/author', method: 'get', params, data})
},
}
export function userinfo(params, data) {
return request({url: '/user/userinfo', method: 'get', params, data})
}

View File

@ -1,15 +1,15 @@
import request from "../utils/request";
export default {
recommended(params, data) {
return request({url: '/video/recommended', method: 'get', params, data})
},
historyVideo(params, data) {
return request({url: '/video/historyVideo', method: 'get', params, data})
},
historyOther(params, data) {
return request({url: '/video/historyOther', method: 'get', params, data})
},
export function historyOther(params, data) {
return request({url: '/video/historyOther', method: 'get', params, data})
}
export function historyVideo(params, data) {
return request({url: '/video/history', method: 'get', params, data})
}
export function recommendedVideo(params, data) {
return request({url: '/video/recommended', method: 'get', params, data})
}
export function myVideo(params, data) {

View File

@ -3,7 +3,6 @@ import App from './App.vue'
import mitt from 'mitt'
import './assets/less/index.less'
import {startMock} from './mock'
import api from './api'
import router from "./router";
import store from "./store";
import mixin from "./utils/mixin";
@ -17,7 +16,6 @@ const pinia = createPinia()
const emitter = mitt()
const app = Vue.createApp(App)
app.config.globalProperties.$api = {...api}
app.config.globalProperties.emitter = emitter
app.config.unwrapInjectedRef = true
app.provide('mitt', emitter)

View File

@ -171,7 +171,7 @@ export async function startMock() {
return [200, {data: v, code: 200}]
})
mock.onGet(/historyVideo/).reply(async (config) => {
mock.onGet(/video\/history/).reply(async (config) => {
let page = getPage2(config.params)
return [200, {
data: {

View File

@ -124,8 +124,6 @@
import {onMounted, reactive} from "vue";
import {useNav} from "@/utils/hooks/useNav";
import api from "@/api";
import SlideList from "@/pages/home/slide/SlideList.vue";
import Utils, {$no} from "@/utils";
import Scroll from "@/components/Scroll.vue";
import goods from "@/assets/data/goods";

View File

@ -2,9 +2,9 @@
import {computed, onMounted, onUnmounted, reactive, ref, watch} from "vue";
import {uniqueId} from "lodash-es";
import api from "@/api";
import {useStore} from "vuex";
import {_checkImgUrl, _duration, _formatNumber} from "@/utils";
import {recommendedVideo} from "@/api/videos";
const store = useStore()
const loading = computed(() => store.state.loading)
@ -39,7 +39,7 @@ function loadMore() {
async function getData(refresh = false) {
if (loading.value) return
store.commit('setLoading', true)
let res = await api.videos.recommended({pageNo: refresh ? 0 : state.pageNo, pageSize: state.pageSize})
let res = await recommendedVideo({pageNo: refresh ? 0 : state.pageNo, pageSize: state.pageSize})
console.log('getSlide4Data-', 'refresh', refresh, res)
store.commit('setLoading', false)
if (res.code === 200) {

View File

@ -47,7 +47,7 @@
<SlideList
:active="props.active"
:style="{background: 'black',marginTop:state.subTypeVisible?state.subTypeHeight:0}"
:api="api.videos.recommended"
:api="recommendedVideo"
@touchstart="pageClick"
/>
</SlideItem>
@ -58,8 +58,8 @@ import SlideItem from '@/components/slide/SlideItem.vue'
import {onMounted, onUnmounted, reactive, ref} from "vue";
import bus, {EVENT_KEY} from "@/utils/bus";
import Utils from "@/utils";
import api from "@/api";
import SlideList from './SlideList.vue';
import {recommendedVideo} from "@/api/videos";
const props = defineProps({
cbs: {

View File

@ -17,7 +17,7 @@
<SlideList
:active="props.active"
:style="{background: 'black',marginTop:state.subTypeVisible?state.subTypeHeight:0}"
:api="api.videos.recommended"
:api="recommendedVideo"
@touchstart="pageClick"
/>
</SlideItem>
@ -28,8 +28,8 @@ import SlideItem from '@/components/slide/SlideItem.vue'
import {onMounted, onUnmounted, reactive, ref} from "vue";
import bus, {EVENT_KEY} from "@/utils/bus";
import Utils from "@/utils";
import api from "@/api";
import SlideList from './SlideList.vue';
import {recommendedVideo} from "@/api/videos";
const props = defineProps({
active: {

View File

@ -3,15 +3,15 @@
<SlideList
style="background:#000;"
:active="props.active"
:api="api.videos.recommended"
:api="recommendedVideo"
/>
</SlideItem>
</template>
<script setup lang="jsx">
import SlideItem from '@/components/slide/SlideItem.vue'
import api from "@/api";
import SlideList from './SlideList.vue';
import {recommendedVideo} from "@/api/videos";
const props = defineProps({
active: {

View File

@ -45,6 +45,7 @@
import Posters from "../../../components/Posters";
import Scroll from "../../../components/Scroll";
import NoMore from "../../../components/NoMore";
import {historyOther, historyVideo} from "@/api/videos";
export default {
name: "lookHistory",
@ -94,7 +95,7 @@ export default {
this.historyVideo.pageNo++
}
this.loadingVideo = true
let res = await this.$api.videos.historyVideo({pageNo: this.historyVideo.pageNo, pageSize: this.pageSize,})
let res = await historyVideo({pageNo: this.historyVideo.pageNo, pageSize: this.pageSize,})
console.log(res)
this.loadingVideo = false
if (res.code === this.SUCCESS) {
@ -109,7 +110,7 @@ export default {
if (!init) {
this.historyOther.pageNo++
}
let res = await this.$api.videos.historyOther({pageNo: this.historyOther.pageNo, pageSize: this.pageSize,})
let res = await historyOther({pageNo: this.historyOther.pageNo, pageSize: this.pageSize,})
this.loadingOther = false
if (res.code === this.SUCCESS) {
this.historyOther.list = this.historyOther.list.concat(res.data.list)

View File

@ -35,6 +35,7 @@ import {mapState} from "vuex";
import axios from "axios";
import Check from "../../components/Check";
import {forIn} from "lodash-es";
import {friends} from "@/api/user";
export default {
name: "Share2Friend",
@ -72,7 +73,7 @@ export default {
}
},
async getFriends() {
let res = await this.$api.user.friends()
let res = await friends()
if (res.code === this.SUCCESS) {
this.friends = res.data
this.friends.all = this.friends.all.sort((a, b) => {

View File

@ -144,6 +144,7 @@ import {mapState} from "vuex";
import axios from "axios";
import Check from "../../components/Check";
import {forIn} from "lodash-es";
import {friends} from "@/api/user";
export default {
name: "Share2Friend",
@ -271,7 +272,7 @@ export default {
}
},
async getFriends() {
let res = await this.$api.user.friends()
let res = await friends()
console.log('getFriends', res)
if (res.code === this.SUCCESS) {
this.friends = res.data

View File

@ -120,8 +120,6 @@
import {onMounted, reactive} from "vue";
import {useNav} from "@/utils/hooks/useNav";
import api from "@/api";
import SlideList from "@/pages/home/slide/SlideList.vue";
import Utils, {$no} from "@/utils";
import Scroll from "@/components/Scroll.vue";
import goods from "@/assets/data/goods";

View File

@ -1,8 +1,8 @@
import * as Vuex from "vuex";
import enums from '../utils/enums'
import api from '../api/index'
import CONST_VAR from "../utils/const_var";
import resource from "../assets/data/resource";
import {friends} from "@/api/user";
const store = Vuex.createStore({
state: {
@ -79,7 +79,7 @@ const store = Vuex.createStore({
},
actions: {
async getFriends(context) {
let res = await api.user.friends()
let res = await friends()
if (res.code === CONST_VAR.SUCCESS) {
context.commit('setFriends', res.data)
}