直播路由 #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

View File

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

View File

@ -1,5 +1,5 @@
<template>
<div class="videoitem">
<div class="videoitem" @click="navto()">
<img src="" alt="" class="cover">
<img src="@/static/images/play.png" alt="" class="play">
<div class="title">
@ -133,6 +133,7 @@
}
</style>
<script lang="ts">
import router from '@/router';
import { defineComponent } from 'vue';
export default defineComponent({
@ -142,5 +143,24 @@ export default defineComponent({
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>

View File

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

View File

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

View File

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

View File

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

View File

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