first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
<template>
<div id="app">
<router-view/>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style lang="less">
@import "~@mixins/clear";
</style>

View File

@@ -0,0 +1,75 @@
import { Axios } from "axios";
import config from "@/config";
import { Toast } from 'vant';
class Api extends Axios {
constructor() {
super({
baseURL: config.checkBaseUrl(),
timeout: 10000,
headers: {
"Content-Type": "application/json; charset=utf-8;"
}
})
this.inter()
}
async getRequest(params) {
return await this.get(params.url, {
params: params.data,
headers: params.header
})
}
async postRequest(params) {
return await this.post(params.url, params.data, {
headers: params.header
})
}
inter() {
// 添加请求拦截器
this.interceptors.request.use(function (config) {
Toast.loading({
duration: 0,
message: '加载中..'
});
// 在发送请求之前做些什么
return config;
}, function (error) {
// 对请求错误做些什么
return Promise.reject(error);
});
// 添加响应拦截器
this.interceptors.response.use(function (response) {
Toast.clear();
response.data = JSON.parse(response.data)
switch (response.data.status) {
case 200:
return response.data.data
break;
case 404:
Toast.fail(response.data.message);
throw new Error(response.data.message);
break;
default:
break;
}
// 2xx 范围内的状态码都会触发该函数。
// 对响应数据做点什么
return response;
}, function (error) {
// 超出 2xx 范围的状态码都会触发该函数。
// 对响应错误做点什么
return Promise.reject(error);
});
}
}
export default new Api()

View File

@@ -0,0 +1,4 @@
@import "./color.less";
@import "./size.less";

View File

@@ -0,0 +1,73 @@
@black: #000;
@white: #fff;
@gray-1: #f7f8fa;
@gray-2: #f2f3f5;
@gray-3: #ebedf0;
@gray-4: #dcdee0;
@gray-5: #c8c9cc;
@gray-6: #969799;
@gray-7: #646566;
@gray-8: #323233;
@red: #ee0a24;
@blue: #1989fa;
@orange: #ff976a;
@orange-dark: #ed6a0c;
@orange-light: #fffbe8;
@green: #07c160;
// Gradient Colors
@gradient-red: linear-gradient(to right, #ff6034, #ee0a24);
@gradient-orange: linear-gradient(to right, #ffd01e, #ff8917);
// Component Colors
@primary-color: var(--van-blue);
@success-color: var(--van-green);
@danger-color: var(--van-red);
@warning-color: var(--van-orange);
@text-color: var(--van-gray-8);
@text-color-2: var(--van-gray-6);
@text-color-3: var(--van-gray-5);
@text-link-color: #576b95;
@active-color: var(--van-gray-2);
@active-opacity: 0.6;
@disabled-opacity: 0.5;
@background-color: var(--van-gray-1);
@background-color-light: var(--van-white);
// Padding
@padding-base: 4px;
@padding-xs: @padding-base * 2;
@padding-sm: @padding-base * 3;
@padding-md: @padding-base * 4;
@padding-lg: @padding-base * 6;
@padding-xl: @padding-base * 8;
// Font
@font-size-xs: 10px;
@font-size-sm: 12px;
@font-size-md: 14px;
@font-size-lg: 16px;
@font-weight-bold: 500;
@line-height-xs: 14px;
@line-height-sm: 18px;
@line-height-md: 20px;
@line-height-lg: 22px;
@base-font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB',
'Microsoft Yahei', sans-serif;
@price-integer-font-family: Avenir-Heavy, PingFang SC, Helvetica Neue, Arial,
sans-serif;
// Animation
@animation-duration-base: 0.3s;
@animation-duration-fast: 0.2s;
@animation-timing-function-enter: ease-out;
@animation-timing-function-leave: ease-in;
// Border
@border-color: var(--van-gray-3);
@border-width-base: 1px;
@border-radius-sm: 2px;
@border-radius-md: 4px;
@border-radius-lg: 8px;
@border-radius-max: 999px;

View File

@@ -0,0 +1,19 @@
@f12: 12px;
@f13: 13px;
@f14: 14px;
@f15: 15px;
@f16: 16px;
@f17: 17px;
@f18: 18px;
@f19: 19px;
@f20: 20px;
@f21: 21px;
@f22: 22px;
@f23: 23px;
@f24: 24px;
@f25: 25px;
@f26: 26px;
@f27: 27px;
@f28: 28px;
@f29: 29px;
@f30: 30px;

View File

@@ -0,0 +1,111 @@
@import "../config/color.less";
:root {
// Color Palette
--van-black: @black;
--van-white: @white;
--van-gray-1: @gray-1;
--van-gray-2: @gray-2;
--van-gray-3: @gray-3;
--van-gray-4: @gray-4;
--van-gray-5: @gray-5;
--van-gray-6: @gray-6;
--van-gray-7: @gray-7;
--van-gray-8: @gray-8;
--van-red: @red;
--van-blue: @blue;
--van-orange: @orange;
--van-orange-dark: @orange-dark;
--van-orange-light: @orange-light;
--van-green: @green;
// Gradient Colors
--van-gradient-red: @gradient-red;
--van-gradient-orange: @gradient-orange;
// Component Colors
--van-primary-color: @primary-color;
--van-success-color: @success-color;
--van-danger-color: @danger-color;
--van-warning-color: @warning-color;
--van-text-color: @text-color;
--van-text-color-2: @text-color-2;
--van-text-color-3: @text-color-3;
--van-text-link-color: @text-link-color;
--van-active-color: @active-color;
--van-active-opacity: @active-opacity;
--van-disabled-opacity: @disabled-opacity;
--van-background-color: @background-color;
--van-background-color-light: @background-color-light;
// Padding
--van-padding-base: @padding-base;
--van-padding-xs: @padding-xs;
--van-padding-sm: @padding-sm;
--van-padding-md: @padding-md;
--van-padding-lg: @padding-lg;
--van-padding-xl: @padding-xl;
// Font
--van-font-size-xs: @font-size-xs;
--van-font-size-sm: @font-size-sm;
--van-font-size-md: @font-size-md;
--van-font-size-lg: @font-size-lg;
--van-font-weight-bold: @font-weight-bold;
--van-line-height-xs: @line-height-xs;
--van-line-height-sm: @line-height-sm;
--van-line-height-md: @line-height-md;
--van-line-height-lg: @line-height-lg;
--van-base-font-family: @base-font-family;
--van-price-integer-font-family: @price-integer-font-family;
// Animation
--van-animation-duration-base: @animation-duration-base;
--van-animation-duration-fast: @animation-duration-fast;
--van-animation-timing-function-enter: @animation-timing-function-enter;
--van-animation-timing-function-leave: @animation-timing-function-leave;
// Border
--van-border-color: @border-color;
--van-border-width-base: @border-width-base;
--van-border-radius-sm: @border-radius-sm;
--van-border-radius-md: @border-radius-md;
--van-border-radius-lg: @border-radius-lg;
--van-border-radius-max: @border-radius-max;
}
body,h1,h2,h3,h4,h5,h6,ul,li,p {
margin: 0;
padding: 0;
}
body {
/* font-size: 0; */
}
li {
list-style: none;
}
input {
border: none;
outline: none;
padding: 0;
flex: 1;
margin: 0 10px;
border-radius: 20px;
height: 32px;
}
a {
text-decoration: none;
color: #333;
}
::-webkit-scrollbar {
width: 0;
height: 0;
}
img {
width: 100%;
}

View File

@@ -0,0 +1,68 @@
@import "../config/_.less";
.clearfix() {
&:after,
&:before {
content: " ";
display: table;
}
&:after {
clear: both;
}
}
.ellipsis() {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.no-scrollbar() {
&::-webkit-scrollbar {
display: none !important;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
opacity: 0 !important;
}
}
.hairline-common() {
position: absolute;
box-sizing: border-box;
content: ' ';
pointer-events: none;
}
.hairline(@color: var(--van-border-color)) {
.hairline-common();
top: -50%;
right: -50%;
bottom: -50%;
left: -50%;
border: 0 solid @color;
transform: scale(0.5);
}
.hairline-top(@color: var(--van-border-color), @left: 0, @right: 0) {
.hairline-common();
top: 0;
right: @right;
left: @left;
border-top: 1px solid @color;
transform: scaleY(0.5);
}
.hairline-bottom(@color: var(--van-border-color), @left: 0, @right: 0) {
.hairline-common();
right: @right;
bottom: 0;
left: @left;
border-bottom: 1px solid @color;
transform: scaleY(0.5);
}

View File

@@ -0,0 +1,9 @@
@import "../config/_.less";
@import "../mixins/index.less";
.home {
h2 {
color: @green;
font-size: @f20;
.ellipsis();
}
}

View File

@@ -0,0 +1,19 @@
<template>
<div class="Live">
Live
</div>
</template>
<script>
export default {
name: 'Live',
data () {
return {}
},
methods: {}
}
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,100 @@
<template>
<div class="Radio">
<cvideo :show="false" v-if="videoSrc.length != 0" :url="videoSrc"></cvideo>
<div class="title">{{ list.play_title }}</div>
<img class="music" :src="list.play_img" alt="">
<img class="gif" :src="status ? require('@sta/sound_spectrum.gif') : require('@sta/sound_spectrum.png') " alt="">
<ul class="menu">
<li>
<img src="@sta/live_broadcast_icon.png" alt="">
<div>当前直播</div>
</li>
<li>
<img @click="PlayVideo" :src="status ? require('@sta/radio_stop.png') : require('@sta/radio_up.png') " alt="">
</li>
<li>
<img src="@sta/program_list_icon.png" alt="">
<div>节目列表</div>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'Radio',
data () {
return {
videoSrc: [],
list: {},
status: false, // false 未播放状态, true 播放状态
}
},
created () {
this.getRadio();
},
methods: {
async getRadio() {
this.list = await this.$http.index.radio();
this.videoSrc = [
{
type: "application/x-mpegURL",
src: this.list.play_url
}
]
},
PlayVideo() {
this.status ? this.$children[0].PlayerPause() : this.$children[0].PlayerPlay()
this.status = !this.status
}
}
}
</script>
<style scoped lang="less">
.Radio {
text-align: center;
.title {
font-family: PingFangSC-Bold;
font-size: 0.48rem;
color: #000000;
margin-top: 1.347rem;
margin-bottom: 0.84rem;
}
.music {
width: 7.467rem;
height: 7.467rem;
margin-bottom: 0.667rem;
}
.gif {
width: 7.467rem;
height: 1.2rem;
margin-bottom: 0.733rem;
}
.menu {
display: flex;
align-items: center;
width: 7.467rem;
justify-content: space-between;
margin: 0 auto;
li {
img {
width: 0.52rem;
height: 0.52rem;
}
&:nth-child(2) {
img {
width: 1.6rem;
height: 1.6rem;
}
}
div {
font-family: PingFang-SC-Medium;
font-size: 0.267rem;
color: #999999;
}
}
}
}
</style>

View File

@@ -0,0 +1,33 @@
<template>
<div class="TV">
<TvList :arr="tvList"></TvList>
</div>
</template>
<script>
import TvList from './TvList'
export default {
name: 'TV',
data () {
return {
tvList: []
}
},
created() {
this.getTv()
},
methods: {
async getTv() {
this.tvList = await this.$http.index.tv();
console.log(this.tvList)
}
},
components: {
TvList
}
}
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,62 @@
<template>
<ul class="TvList">
<li v-for="(item,index) in arr" @click="enterInfo(item.id)">
<span :class=" item.id == $route.query.id && show ? 'active' : '' ">{{ item.title }}</span>
<img v-if="item.id == $route.query.id && show" src="@sta/act-list.gif" alt="">
</li>
</ul>
</template>
<script>
export default {
name: 'TvList',
data () {
return {}
},
props: {
show: {
type: Boolean,
default: false
},
arr: {
type: Array,
default: () => []
}
},
methods: {
enterInfo(id) {
this.$router.push({
name: 'TvInfo',
query: { id }
})
}
}
}
</script>
<style scoped lang="less">
.TvList {
li {
display: flex;
align-items: center;
justify-content: space-between;
height: 1.6rem;
background-color: #ffffff;
border-bottom: 0.013rem solid #e5e5e5;
padding-left: 0.547rem;
padding-right: 0.36rem;
span {
font-family: PingFangSC-Bold;
font-size: 0.427rem;
color: #333333;
}
.active {
color: #d0302c;
}
img {
width: 0.36rem;
height: 0.4rem;
}
}
}
</style>

View File

@@ -0,0 +1,64 @@
<template>
<div class="Video">
<video-player v-show="show" class="video-player-box"
ref="videoPlayer"
:options="playerOptions"
:playsinline="true">
</video-player>
</div>
</template>
<script>
import { videoPlayer } from 'vue-video-player'
import 'videojs-contrib-hls'
import 'video.js/dist/video-js.css'
export default {
name: 'Video',
props: {
url: {
type: Array,
default: () => []
},
show: {
type: Boolean,
default: true
}
},
data () {
return {
playerOptions: {
muted: false,
language: 'zh',
aspectRatio: '16:9',
playbackRates: [0.7, 1.0, 1.5, 2.0],
sources: this.url,
poster: "/static/images/author.jpg",
}
}
},
computed: {
player() {
return this.$refs.videoPlayer.player
}
},
mounted () {
console.log(this.player)
},
methods: {
PlayerPlay() {
this.player.play()
},
PlayerPause() {
this.player.pause()
},
},
components: {
videoPlayer
}
}
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,22 @@
export default {
devBaseUrl: 'http://127.0.0.1:3000/api/json',
prodBaseUrl: '',
apiList: {
radio: '/radio',
tv: '/tv'
},
checkBaseUrl() {
switch (process.env.NODE_ENV) {
case "development":
return this.devBaseUrl
break;
case "production":
return this.prodBaseUrl
break;
default:
break;
}
}
}

View File

@@ -0,0 +1,22 @@
import 'amfe-flexible'
import Vue from 'vue'
import App from './App'
import router from './router'
import _ from './serve/_'
import Video from './components/Video'
import Vant from 'vant'
import 'vant/lib/index.css'
Vue.prototype.$http = _
Vue.component('cvideo', Video)
Vue.config.productionTip = false
Vue.use(Vant);
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})

View File

@@ -0,0 +1,13 @@
<template>
<div class="about">我的</div>
</template>
<script>
export default {
}
</script>
<style lang="less" scoped>
@import "~@page/About";
</style>

View File

@@ -0,0 +1,49 @@
<template>
<div class="home">
<van-tabs v-model="active" swipeable animated line-width="0.32rem" border>
<van-tab title="包河Radio">
<Radio></Radio>
</van-tab>
<van-tab title="包河TV">
<TV></TV>
</van-tab>
<van-tab title="溶媒直播">
<Live></Live>
</van-tab>
</van-tabs>
</div>
</template>
<script>
import Radio from "@/components/Radio"
import TV from "@/components/TV"
import Live from "@/components/Live"
export default {
data() {
return {
active: 0
}
},
created() {
// this.getData()
},
methods: {
async getData() {
var res = await this.$http.index.getMechanismList({
page: 1,
id: 82
});
console.log(res);
}
},
components: {
Radio,TV,Live
}
}
</script>
<style lang="less" scoped>
@import "~@page/Home";
</style>

View File

@@ -0,0 +1,49 @@
<template>
<div class="TvInfo">
<cvideo v-if="videoSrc.length != 0" :url="videoSrc"></cvideo>
<van-tabs v-model="active" border>
<van-tab title="频道">
<TvList :show="true" :arr="info.list"></TvList>
</van-tab>
<van-tab title="评论">评论</van-tab>
</van-tabs>
</div>
</template>
<script>
import TvList from '@/components/TvList'
export default {
name: 'TvInfo',
data () {
return {
videoSrc: [],
info: {},
active: 0
}
},
created() {
this.getTvInfo()
},
methods: {
async getTvInfo() {
this.info = await this.$http.index.tvInfo({
id: this.$route.query.id
});
this.videoSrc = [
{
type: "application/x-mpegURL",
src: this.info.current.play_url
}
]
console.log( this.info)
}
},
components: {
TvList
}
}
</script>
<style scoped lang="less">
</style>

View File

@@ -0,0 +1,24 @@
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'Home',
component: () => import(/* webpackChunkName: "Home" */ '@/page/Home.vue')
},
{
path: '/about',
name: 'About',
component: () => import(/* webpackChunkName: "About" */ '@/page/About.vue')
},
{
path: '/TvInfo',
name: 'TvInfo',
component: () => import(/* webpackChunkName: "TvInfo" */ '@/page/TvInfo.vue')
}
]
})

View File

@@ -0,0 +1,5 @@
import HomeServe from "./home";
export default {
index: new HomeServe()
}

View File

@@ -0,0 +1,18 @@
import api from "@/api/api";
import config from "@/config";
export default class HomeServe {
async radio(data = {}, header = {}) {
return await api.getRequest({
url: config.apiList.radio,
data, header
})
}
async tv(data = {}, header = {}) {
return await api.getRequest({
url: config.apiList.tv,
data, header
})
}
}