直播路由 #30

Merged
theluyuan merged 1 commits from xbx into master 2020-10-10 14:34:48 +08:00
7 changed files with 48 additions and 20 deletions
Showing only changes of commit 3755425b0e - Show all commits

View File

@ -24,6 +24,7 @@ export async function loginpass(phone: string, password: string){
}else{ }else{
setToken(); setToken();
store.commit("login"); store.commit("login");
store.dispatch("setUserInfo");
router.push("/mine/archives") router.push("/mine/archives")
} }
} }
@ -34,7 +35,11 @@ export async function loginpass(phone: string, password: string){
*/ */
export async function userinfo(){ export async function userinfo(){
const user = await get<UserInfo>('personalInfo'); const user = await get<UserInfo>('personalInfo');
console.log(user.data?.img) // console.log(user.data?.img)
if(user.code == 1001){
router.push("/")
return '未登录';
}
return { return {
head: user.data?.img, head: user.data?.img,
username: user.data?.name, username: user.data?.name,

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="videoitem"> <div class="videoitem" @click="navto()">
<img src="" alt="" class="cover"> <img src="" alt="" class="cover">
<img src="@/static/images/play.png" alt="" class="play"> <img src="@/static/images/play.png" alt="" class="play">
<div class="title"> <div class="title">
@ -133,14 +133,34 @@
} }
</style> </style>
<script lang="ts"> <script lang="ts">
import router from '@/router';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
export default defineComponent({ export default defineComponent({
props:{ props:{
type: { type: {
type: Number, type: Number,
default:1 default:1
} }
}, },
setup(props){
function navto(){
let url = '';
switch (props.type) {
case 1:
url = '/regime/livedetail';
break;
case 2:
url = '/regime/livedetail';
break;
case 3:
url = '/regeime/liveing';
}
router.push(url)
}
return {
navto
}
}
}) })
</script> </script>

View File

@ -14,7 +14,7 @@
<img :src="i.icon" alt="" class="icon"> <img :src="i.icon" alt="" class="icon">
<div class="title">{{i.name}}</div> <div class="title">{{i.name}}</div>
</div> </div>
<img src="" alt="" class="right"> <img alt="" src="../static/images/jiantou.png" class="right">
</div> </div>
</div> </div>
<div style="overflow: hidden;"> <div style="overflow: hidden;">
@ -22,7 +22,7 @@
</div> </div>
<div class="item loginout"> <div class="item loginout">
<div class="route"> <div class="route">
<img src="" alt="" class="icon"> <img src="../static/images/tuichu.png" alt="" class="icon">
<div class="title"> <div class="title">
帐号退出 帐号退出
</div> </div>
@ -89,7 +89,6 @@
.right{ .right{
width: 5px; width: 5px;
height: 10px; height: 10px;
background-color: #0f0;
} }
} }
.loginout{ .loginout{
@ -119,6 +118,7 @@
import router from '@/router'; import router from '@/router';
import store from '@/store'; import store from '@/store';
import { computed, defineComponent, ref } from 'vue'; import { computed, defineComponent, ref } from 'vue';
import { useRoute } from 'vue-router';
export default defineComponent({ export default defineComponent({
setup(){ setup(){
@ -131,37 +131,37 @@ export default defineComponent({
// //
const list: Array<MenuItem> = [ const list: Array<MenuItem> = [
{ {
icon: "../static/images/wode1.ping", icon: require("../static/images/wode1.png"),
sleicon:"", sleicon:"",
name: "我的档案", name: "我的档案",
route: "/mine/archives" route: "/mine/archives"
}, },
{ {
icon: "../static/images/xiayig.ping", icon: require("../static/images/xiayig.png"),
sleicon:"", sleicon:"",
name: "发布直播", name: "发布直播",
route: "/mine/webcast" route: "/mine/webcast"
}, },
{ {
icon: "../static/images/shipin.png", icon: require("../static/images/shipin.png"),
sleicon:"shipin.png", sleicon:"shipin.png",
name: "上传视频", name: "上传视频",
route: "/mine/video" route: "/mine/video"
}, },
{ {
icon: "/static/images/yinhangka.png", icon: require("../static/images/yinhangka.png"),
sleicon:"", sleicon:"",
name: "我的钱包", name: "我的钱包",
route: "/mine/wallet" route: "/mine/wallet"
}, },
{ {
icon: "../static/images/tongji.png", icon: require("../static/images/tongji.png"),
sleicon:"", sleicon:"",
name: "列表统计", name: "列表统计",
route: "/mine/liststatistic" route: "/mine/liststatistic"
}, },
{ {
icon: "../static/images/bangzhu@2x.png", icon: require("../static/images/bangzhu.png"),
sleicon:"", sleicon:"",
name: "关于Beelink", name: "关于Beelink",
route: "/mine/aboutus" route: "/mine/aboutus"
@ -171,7 +171,12 @@ export default defineComponent({
const selnum = ref(0); const selnum = ref(0);
const userinfo = computed(() => store.state.userinfo) const userinfo = computed(() => store.state.userinfo)
console.log(userinfo.value) //
for(const i in list){
if(list[i].route == useRoute().path){
selnum.value = parseInt(i);
}
}
/** /**
* 跳转路由与赋值对应的下标 * 跳转路由与赋值对应的下标
* @param index 选中的下标 方便赋值与跳转 * @param index 选中的下标 方便赋值与跳转

View File

@ -134,7 +134,7 @@ export default defineComponent({
const nav: Array<Nav> = [ const nav: Array<Nav> = [
{ {
name: "直播管理", name: "直播管理",
route: "" route: "/regime/live"
}, },
{ {
name: "视频管理", name: "视频管理",
@ -142,7 +142,7 @@ export default defineComponent({
}, },
{ {
name: "订阅者管理", name: "订阅者管理",
route: "" route: "/regime/subscriber"
}, },
{ {
name: "个人中心", name: "个人中心",

View File

@ -11,7 +11,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.body{ .body{
display: flex; // display: flex;
width: 100%; width: 100%;
height: calc(100% - 57px); height: calc(100% - 57px);
overflow: auto; overflow: auto;

View File

@ -150,7 +150,6 @@ import { defineComponent, reactive, ref } from "vue";
import LoginTab from "@/components/login/LoginTab.vue"; import LoginTab from "@/components/login/LoginTab.vue";
import NavTop from "@/components/NavTop.vue" import NavTop from "@/components/NavTop.vue"
import { loginpass } from '@/api'; import { loginpass } from '@/api';
import store from '@/store';
export default defineComponent({ export default defineComponent({
name: "Login", name: "Login",
@ -198,9 +197,7 @@ export default defineComponent({
}; };
function login(): void { function login(): void {
console.log(userinfo.phone,userinfo.password) console.log(userinfo.phone,userinfo.password)
loginpass(userinfo.phone,userinfo.password).then(()=>{ loginpass(userinfo.phone,userinfo.password)
store.dispatch("setUserInfo");
})
} }
return { return {

View File

@ -271,6 +271,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding-bottom: 200px;
.top { .top {
display: flex; display: flex;
width: 1241px; width: 1241px;