shuisheng 2 سال پیش
والد
کامیت
f39359131d

+ 1 - 4
src/api/area.ts

@@ -6,10 +6,7 @@ export function fetchAreaList() {
     method: 'get',
   });
 }
-export function fetchAreaLiveRoomList(params: {
-  orderName: string;
-  orderBy: string;
-}) {
+export function fetchAreaLiveRoomList(params) {
   return request.instance({
     url: '/area/area_live_room_list',
     method: 'get',

+ 1 - 6
src/api/live.ts

@@ -1,11 +1,6 @@
 import request from '@/utils/request';
 
-export function fetchLiveList(params: {
-  orderName: string;
-  orderBy: string;
-  nowPage?: number;
-  pageSize?: number;
-}) {
+export function fetchLiveList(params) {
   return request.instance({
     url: '/live/list',
     method: 'get',

+ 1 - 4
src/api/liveRoom.ts

@@ -1,9 +1,6 @@
 import request from '@/utils/request';
 
-export function fetchLiveRoomList(params: {
-  orderName: string;
-  orderBy: string;
-}) {
+export function fetchLiveRoomList(params) {
   return request.instance({
     url: '/live_room/list',
     method: 'get',

+ 1 - 4
src/api/user.ts

@@ -37,10 +37,7 @@ export function fetchLogin({ id, password }) {
 }
 
 export function fetchUserInfo() {
-  return request.instance({
-    url: '/user/get_user_info',
-    method: 'get',
-  });
+  return request.get<IUser>('/user/get_user_info');
 }
 export function fetchFindUser(userId: number) {
   return request.instance({

+ 2 - 0
src/assets/constant.scss

@@ -33,6 +33,8 @@ $w-250: 250px;
 $w-200: 200px;
 
 $theme-color-gold: #ffd700;
+// $theme-color-papayawhip: white;
+$theme-color-papayawhip: papayawhip;
 $header-height: 60px;
 
 // 自定义滚动条:https://developer.mozilla.org/zh-CN/docs/Web/CSS/::-webkit-scrollbar

+ 26 - 9
src/components/LoginModal/index.vue

@@ -75,9 +75,9 @@
               </n-button>
             </n-tab-pane>
             <n-tab-pane
-              v-if="MODULE_CONFIG_SWITCH.wechatLogin"
+              v-if="MODULE_CONFIG_SWITCH.wechatQrcodeLogin && !isMobile()"
               name="qrcodelogin"
-              tab="微信登录"
+              tab="微信扫码登录"
             >
               <div
                 class="qrcode"
@@ -103,7 +103,8 @@
               src="@/assets/img/qq_logo.webp"
             />
           </div>
-          <!-- <div
+          <div
+            v-if="MODULE_CONFIG_SWITCH.wechatLogin"
             class="logo-wrap"
             @click="handleWechatLogin()"
           >
@@ -111,7 +112,7 @@
               class="logo"
               src="@/assets/img/wechat_logo.webp"
             />
-          </div> -->
+          </div>
           <div
             v-if="MODULE_CONFIG_SWITCH.githubLogin"
             class="logo-wrap"
@@ -130,12 +131,13 @@
 
 <script lang="ts" setup>
 import { LockClosedOutline, PersonOutline } from '@vicons/ionicons5';
+import { getRandomString, isMobile, isWechat } from 'billd-utils';
 import QRCode from 'qrcode';
-import { onUnmounted, reactive, ref } from 'vue';
+import { onMounted, onUnmounted, reactive, ref } from 'vue';
 
 import { fetchQrcodeLogin, fetchQrcodeLoginStatus } from '@/api/user';
 import { MODULE_CONFIG_SWITCH, QRCODE_LOGIN_URI } from '@/constant';
-import { useQQLogin } from '@/hooks/use-login';
+import { useQQLogin, useWechatLogin } from '@/hooks/use-login';
 import { useAppStore } from '@/store/app';
 import { useUserStore } from '@/store/user';
 
@@ -162,6 +164,9 @@ const currentTab = ref('pwdlogin'); // qrcodelogin,pwdlogin
 const loopTimer = ref();
 const emits = defineEmits(['close']);
 
+onMounted(() => {
+  console.log('onMountedonMounted');
+});
 onUnmounted(() => {
   clearInterval(loopTimer.value);
 });
@@ -186,7 +191,19 @@ function handleQQLogin() {
   useQQLogin({ exp: 24 });
 }
 
-async function handleWechatLogin() {
+function handleWechatLogin() {
+  if (!isWechat()) {
+    window.$message.warning('请在微信打开!');
+  } else {
+    useWechatLogin({
+      platform: 'wechat',
+      exp: 24,
+      loginId: getRandomString(8),
+    });
+  }
+}
+
+async function handleWechatQrcodeLogin() {
   const res = await fetchQrcodeLogin({
     platform: qrcodeParams.platform,
     exp: qrcodeParams.exp,
@@ -238,7 +255,7 @@ function handleClose() {
 const handleLogin = async () => {
   let token = null;
   if (currentTab.value === 'qrcodelogin') {
-    handleWechatLogin();
+    handleWechatQrcodeLogin();
   } else {
     token = await userStore.pwdLogin({
       id: +loginForm.value.id,
@@ -264,7 +281,7 @@ const tabChange = (v) => {
   currentTab.value = v;
   clearInterval(loopTimer.value);
   if (currentTab.value === 'qrcodelogin') {
-    handleWechatLogin();
+    handleWechatQrcodeLogin();
   }
 };
 const focus = ref(false);

+ 45 - 0
src/constant.ts

@@ -61,6 +61,49 @@ export const QINIU_LIVE = {
   },
 };
 
+export const DEFAULT_AUTH_INFO = {
+  ALL_AUTH: {
+    id: 1,
+    auth_value: 'ALL_AUTH',
+  },
+  USER_MANAGE: {
+    id: 2,
+    auth_value: 'USER_MANAGE',
+  },
+  ROLE_MANAGE: {
+    id: 3,
+    auth_value: 'ROLE_MANAGE',
+  },
+  AUTH_MANAGE: {
+    id: 4,
+    auth_value: 'AUTH_MANAGE',
+  },
+  COMMONENT_MANAGE: {
+    id: 5,
+    auth_value: 'COMMONENT_MANAGE',
+  },
+  LOG_MANAGE: {
+    id: 6,
+    auth_value: 'LOG_MANAGE',
+  },
+  LIVE_MANAGE: {
+    id: 7,
+    auth_value: 'LIVE_MANAGE',
+  },
+  LIVE_PUSH: {
+    id: 8,
+    auth_value: 'LIVE_PUSH',
+  },
+  LIVE_PULL: {
+    id: 9,
+    auth_value: 'LIVE_PULL',
+  },
+  LIVE_PULL_SVIP: {
+    id: 10,
+    auth_value: 'LIVE_PULL_SVIP',
+  },
+};
+
 // 全局的cookie的key
 export const COOKIE_KEY = {
   thirdLoginInfo: 'thirdLoginInfo',
@@ -104,6 +147,8 @@ export const MODULE_CONFIG_SWITCH = {
   // qq登录
   qqLogin: true,
   // 微信扫码登录
+  wechatQrcodeLogin: false,
+  // 微信登录
   wechatLogin: false,
   // github登录
   githubLogin: true,

+ 16 - 0
src/hooks/use-login.ts

@@ -4,6 +4,7 @@ import { createApp } from 'vue';
 import { fetchQQLogin } from '@/api/qqUser';
 import { fullLoading } from '@/components/FullLoading';
 import {
+  DEFAULT_AUTH_INFO,
   QQ_CLIENT_ID,
   QQ_OAUTH_URL,
   QQ_REDIRECT_URI,
@@ -71,6 +72,21 @@ export function loginTip(show = false) {
   return true;
 }
 
+export function commentAuthTip() {
+  const userStore = useUserStore();
+  if (
+    !userStore.auths?.find(
+      (v) => v.auth_value === DEFAULT_AUTH_INFO.COMMONENT_MANAGE.auth_value
+    )
+  ) {
+    window.$message.error(
+      `没有${DEFAULT_AUTH_INFO.COMMONENT_MANAGE.auth_value}权限!`
+    );
+    return false;
+  }
+  return true;
+}
+
 export function loginMessage() {
   window.addEventListener('message', handleQQLogin);
 }

+ 7 - 0
src/hooks/use-pull.ts

@@ -1,6 +1,7 @@
 import { onUnmounted, ref, watch } from 'vue';
 import { useRoute } from 'vue-router';
 
+import { commentAuthTip, loginTip } from '@/hooks/use-login';
 import { useFlvPlay, useHlsPlay } from '@/hooks/use-play';
 import { useSrsWs } from '@/hooks/use-srs-ws';
 import {
@@ -370,6 +371,12 @@ export function usePull() {
   }
 
   function sendDanmu() {
+    if (!loginTip()) {
+      return;
+    }
+    if (!commentAuthTip()) {
+      return;
+    }
     if (!danmuStr.value.trim().length) {
       window.$message.warning('请输入弹幕内容!');
       return;

+ 7 - 1
src/hooks/use-push.ts

@@ -14,7 +14,7 @@ import { useNetworkStore } from '@/store/network';
 import { useUserStore } from '@/store/user';
 import { createVideo, generateBase64 } from '@/utils';
 
-import { loginTip } from './use-login';
+import { commentAuthTip, loginTip } from './use-login';
 import { useSrsWs } from './use-srs-ws';
 import { useTip } from './use-tip';
 
@@ -314,6 +314,12 @@ export function usePush() {
   }
 
   function sendDanmu() {
+    if (!loginTip()) {
+      return;
+    }
+    if (!commentAuthTip()) {
+      return;
+    }
     if (!danmuStr.value.length) {
       window.$message.warning('请输入弹幕内容!');
       return;

+ 67 - 15
src/interface.ts

@@ -210,35 +210,65 @@ export enum LiveRoomUseCDNEnum {
   no = 2,
 }
 
+/** 直播间状态 */
+export enum LiveRoomStatusEnum {
+  /** 正常 */
+  normal,
+  /** 禁用 */
+  disable,
+}
+
+/** 直播间是否显示 */
+export enum LiveRoomIsShowEnum {
+  /** 显示 */
+  yes,
+  /** 不显示 */
+  no,
+}
+
 export interface ILiveRoom {
   id?: number;
-  /** 用户信息 */
-  user?: IUser;
-  /** 用户信息 */
-  users?: IUser[];
-  /** 分区信息 */
-  area?: IArea;
-  /** 分区信息 */
-  areas?: IArea[];
-  /** 直播信息 */
-  live?: ILive;
-  user_live_room?: IUserLiveRoom & { user: IUser };
+  /** 直播间名称 */
   name?: string;
+  /** 直播间简介 */
   desc?: string;
+  /** 直播间备注 */
+  remark?: string;
+  /** 是否使用cdn */
   cdn?: LiveRoomUseCDNEnum;
+  /** 拉流是否需要鉴权 */
+  pull_is_should_auth?: LiveRoomPullIsShouldAuthEnum;
   /** 权重 */
   weight?: number;
   /** 推流秘钥 */
   key?: string;
   /** 直播间类型 */
   type?: LiveRoomTypeEnum;
-  /** 拉流是否需要鉴权 */
-  pull_is_should_auth?: LiveRoomPullIsShouldAuthEnum;
+  /** 开播预览图 */
   cover_img?: string;
+  /** 直播间背景图 */
   bg_img?: string;
+  /** 直播间状态 */
+  status?: LiveRoomStatusEnum;
+  /** 直播间是否显示 */
+  is_show?: LiveRoomIsShowEnum;
+
+  /** 用户信息 */
+  user?: IUser;
+  /** 用户信息 */
+  users?: IUser[];
+  /** 分区信息 */
+  area?: IArea;
+  /** 分区信息 */
+  areas?: IArea[];
+  /** 直播信息 */
+  live?: ILive;
+  user_live_room?: IUserLiveRoom & { user: IUser };
+
   rtmp_url?: string;
   flv_url?: string;
   hls_url?: string;
+
   created_at?: string;
   updated_at?: string;
   deleted_at?: string;
@@ -365,10 +395,13 @@ export interface IQqUser {
 export interface IArea {
   id?: number;
   name?: string;
+  /** 备注 */
   remark?: string;
   /** 权重 */
   weight?: number;
   area_live_rooms?: IAreaLiveRoom[];
+  live_room_is_show?: LiveRoomIsShowEnum;
+  live_room_status?: LiveRoomStatusEnum;
   created_at?: string;
   updated_at?: string;
   deleted_at?: string;
@@ -387,24 +420,43 @@ export interface IAreaLiveRoom {
   deleted_at?: string;
 }
 
-export interface ILive {
+export interface ISrsPublishStream {
+  /** 客户端在获取信息时,必须检查ServerID是否改变,改变时就是服务器重启,之前所有的数据都应该作废了。 */
+  srs_server_id?: string;
+  srs_service_id?: string;
+  srs_action?: string;
+  srs_client_id?: string;
+  srs_ip?: string;
+  srs_vhost?: string;
+  srs_app?: string;
+  srs_tcUrl?: string;
+  srs_stream?: string;
+  srs_param?: string;
+  srs_stream_url?: string;
+  srs_stream_id?: string;
+}
+
+export interface ILive extends ISrsPublishStream {
   id?: number;
   /** 用户信息 */
   user?: IUser;
   /** 直播间信息 */
   live_room?: ILiveRoom;
+
   socket_id?: string;
   user_id?: number;
   live_room_id?: number;
+  live_room_is_show?: LiveRoomIsShowEnum;
+  live_room_status?: LiveRoomStatusEnum;
   /** 1开启;2关闭 */
   track_video?: number;
   /** 1开启;2关闭 */
   track_audio?: number;
+
   created_at?: string;
   updated_at?: string;
   deleted_at?: string;
 }
-
 export enum MediaTypeEnum {
   camera,
   screen,

+ 78 - 22
src/layout/mobile/head/index.vue

@@ -5,21 +5,46 @@
         class="logo"
         @click="router.push({ name: mobileRouterName.h5 })"
       ></div>
-      <a
-        v-if="MODULE_CONFIG_SWITCH.github"
-        class="github"
-        target="_blank"
-        href="https://github.com/galaxy-s10/billd-live"
-      >
-        <img
-          :src="githubStar"
-          alt=""
-        />
-        <img
-          :src="githubFork"
-          alt=""
-        />
-      </a>
+      <div class="top-right">
+        <a
+          v-if="MODULE_CONFIG_SWITCH.github"
+          class="github"
+          target="_blank"
+          href="https://github.com/galaxy-s10/billd-live"
+        >
+          <img
+            :src="githubStar"
+            alt=""
+          />
+          <img
+            :src="githubFork"
+            alt=""
+          />
+        </a>
+        <template v-if="!userStore.userInfo">
+          <div class="qqlogin">
+            <div
+              class="btn"
+              @click="appStore.showLoginModal = true"
+            >
+              登录
+            </div>
+          </div>
+        </template>
+        <n-dropdown
+          v-else
+          trigger="click"
+          :options="options"
+          @select="handleSelect"
+        >
+          <div
+            class="btn"
+            :style="{
+              backgroundImage: `url(${userStore.userInfo.avatar})`,
+            }"
+          ></div>
+        </n-dropdown>
+      </div>
     </div>
     <nav class="nav-list">
       <div
@@ -42,15 +67,17 @@ import { useRoute } from 'vue-router';
 import { MODULE_CONFIG_SWITCH } from '@/constant';
 import router, { mobileRouterName } from '@/router';
 import { AppRootState, useAppStore } from '@/store/app';
+import { useUserStore } from '@/store/user';
 
 const githubStar = ref();
 const githubFork = ref();
 const route = useRoute();
 const appStore = useAppStore();
-
-function changeRoute(item: AppRootState['navList'][0]) {
-  router.push({ name: item.routeName });
-}
+const userStore = useUserStore();
+const options = [
+  // { label: '个人信息', key: '1' },
+  { label: '退出登录', key: 'logout' },
+];
 
 onMounted(() => {
   githubStar.value =
@@ -58,6 +85,16 @@ onMounted(() => {
   githubFork.value =
     'https://img.shields.io/github/forks/galaxy-s10/billd-live?label=Fork&logo=GitHub&labelColor=white&logoColor=black&style=social&cacheSeconds=3600';
 });
+
+function handleSelect(key) {
+  if (key === 'logout') {
+    userStore.logout();
+  }
+}
+
+function changeRoute(item: AppRootState['navList'][0]) {
+  router.push({ name: item.routeName });
+}
 </script>
 
 <style lang="scss" scoped>
@@ -77,10 +114,29 @@ onMounted(() => {
 
       @include setBackground('@/assets/img/logo-txt.png');
     }
-    .github {
+    .top-right {
       display: flex;
-      img {
-        margin-left: 6px;
+      align-items: center;
+      .github {
+        display: flex;
+        img {
+          margin-left: 6px;
+        }
+      }
+      .btn {
+        margin-left: 10px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        box-sizing: border-box;
+        width: 35px;
+        height: 35px;
+        border-radius: 50%;
+        background-color: papayawhip;
+        font-size: 13px;
+        cursor: pointer;
+
+        @extend %containBg;
       }
     }
   }

+ 5 - 0
src/layout/mobile/index.vue

@@ -4,11 +4,16 @@
     <router-view v-slot="{ Component }">
       <component :is="Component"></component>
     </router-view>
+    <LoginModal v-if="appStore.showLoginModal"></LoginModal>
   </div>
 </template>
 
 <script lang="ts" setup>
+import { useAppStore } from '@/store/app';
+
 import HeadCpt from './head/index.vue';
+
+const appStore = useAppStore();
 </script>
 
 <style lang="scss" scoped></style>

+ 20 - 14
src/store/user/index.ts

@@ -1,39 +1,44 @@
 import { defineStore } from 'pinia';
 
 import { fetchLogin, fetchUserInfo } from '@/api/user';
-import { IRole, IUser } from '@/interface';
+import { IAuth, IRole, IUser } from '@/interface';
 import cache from '@/utils/cache';
 
 type UserRootState = {
-  userInfo: IUser | null;
-  token: string | null;
-  roles: IRole[] | null;
+  userInfo?: IUser;
+  token?: string;
+  roles?: IRole[];
+  auths?: IAuth[];
 };
 
 export const useUserStore = defineStore('user', {
   state: (): UserRootState => {
     return {
-      token: null,
-      roles: null,
-      userInfo: null,
+      token: undefined,
+      roles: undefined,
+      userInfo: undefined,
+      auths: undefined,
     };
   },
   actions: {
-    setUserInfo(res) {
+    setUserInfo(res: UserRootState['userInfo']) {
       this.userInfo = res;
     },
-    setToken(res, exp: number) {
+    setToken(res: UserRootState['token'], exp: number) {
       cache.setStorageExp('token', res, exp);
       this.token = res;
     },
-    setRoles(res) {
+    setRoles(res: UserRootState['roles']) {
       this.roles = res;
     },
+    setAuths(res: UserRootState['auths']) {
+      this.auths = res;
+    },
     logout() {
       cache.clearStorage('token');
-      this.token = null;
-      this.userInfo = null;
-      this.roles = null;
+      this.token = undefined;
+      this.userInfo = undefined;
+      this.roles = undefined;
     },
     async pwdLogin({ id, password }) {
       try {
@@ -50,9 +55,10 @@ export const useUserStore = defineStore('user', {
     },
     async getUserInfo() {
       try {
-        const { code, data }: any = await fetchUserInfo();
+        const { code, data } = await fetchUserInfo();
         this.setUserInfo(data);
         this.setRoles(data.roles);
+        this.setAuths(data.auths);
         return { code, data };
       } catch (error) {
         return error;

+ 5 - 0
src/views/h5/index.vue

@@ -81,10 +81,13 @@ import { fetchAreaLiveRoomList } from '@/api/area';
 import {
   IArea,
   IAreaLiveRoom,
+  LiveRoomIsShowEnum,
   LiveRoomPullIsShouldAuthEnum,
 } from '@/interface';
 import router, { mobileRouterName, routerName } from '@/router';
+import { useAppStore } from '@/store/app';
 
+const appStore = useAppStore();
 const liveRoomList = ref<IArea[]>([]);
 
 const swiperList = ref([
@@ -98,6 +101,7 @@ const currentSwiper = ref(swiperList.value[0]);
 async function getLiveRoomList() {
   try {
     const res = await fetchAreaLiveRoomList({
+      live_room_is_show: LiveRoomIsShowEnum.yes,
       orderName: 'created_at',
       orderBy: 'desc',
     });
@@ -141,6 +145,7 @@ onMounted(() => {
 
 onUnmounted(() => {
   clearInterval(swiperTimer.value);
+  appStore.showLoginModal = false;
 });
 </script>
 

+ 2 - 0
src/views/h5/room/index.vue

@@ -182,6 +182,7 @@
         发送
       </n-button>
     </div>
+    <LoginModal v-if="appStore.showLoginModal"></LoginModal>
   </div>
 </template>
 
@@ -230,6 +231,7 @@ const {
 onUnmounted(() => {
   closeWs();
   closeRtc();
+  appStore.showLoginModal = false;
 });
 
 onMounted(() => {

+ 2 - 0
src/views/home/index.vue

@@ -207,6 +207,7 @@ import { usePull } from '@/hooks/use-pull';
 import {
   ILive,
   LiveLineEnum,
+  LiveRoomIsShowEnum,
   LiveRoomPullIsShouldAuthEnum,
   LiveRoomTypeEnum,
 } from '@/interface';
@@ -312,6 +313,7 @@ function changeLiveRoom(item: ILive) {
 async function getLiveRoomList() {
   try {
     const res = await fetchLiveList({
+      live_room_is_show: LiveRoomIsShowEnum.yes,
       orderName: 'created_at',
       orderBy: 'desc',
     });

+ 6 - 0
src/views/oauth/index.vue

@@ -10,9 +10,12 @@ import { useRoute } from 'vue-router';
 import { fetchWechatLogin } from '@/api/wechatUser';
 import { handleQQLogin } from '@/hooks/use-login';
 import { PlatformEnum } from '@/interface';
+import router, { routerName } from '@/router';
+import { useUserStore } from '@/store/user';
 import { clearThirdLoginInfo, getThirdLoginInfo } from '@/utils/cookie';
 
 const route = useRoute();
+const userStore = useUserStore();
 
 const errMsg = ref('');
 const currentOauth = ref('');
@@ -97,6 +100,9 @@ onMounted(async () => {
       });
       if (res.code === 200) {
         window.$message.success('登录成功!');
+        userStore.setToken(res.data, qrcodeExp);
+        userStore.getUserInfo();
+        router.push({ name: routerName.h5 });
       } else {
         window.$message.error(res.message);
       }

+ 16 - 4
src/views/pull/index.vue

@@ -268,7 +268,7 @@ import { onMounted, onUnmounted, ref, watch } from 'vue';
 
 import { fetchGoodsList } from '@/api/goods';
 import { MODULE_CONFIG_SWITCH, QINIU_LIVE } from '@/constant';
-import { loginTip } from '@/hooks/use-login';
+import { commentAuthTip, loginTip } from '@/hooks/use-login';
 import { usePull } from '@/hooks/use-pull';
 import { useUpload } from '@/hooks/use-upload';
 import { DanmuMsgTypeEnum, GoodsTypeEnum, IGoods } from '@/interface';
@@ -383,10 +383,22 @@ function getBg() {
 }
 
 function handleWait() {
+  if (!loginTip()) {
+    return;
+  }
+  if (!commentAuthTip()) {
+    return;
+  }
   window.$message.warning('敬请期待!');
 }
 
 function mockClick() {
+  if (!loginTip()) {
+    return;
+  }
+  if (!commentAuthTip()) {
+    return;
+  }
   uploadRef.value?.click();
 }
 
@@ -512,7 +524,7 @@ function handleScrollTop() {
     width: $w-1000;
     height: 100%;
     border-radius: 6px;
-    background-color: papayawhip;
+    background-color: $theme-color-papayawhip;
     color: #61666d;
     vertical-align: top;
     .head {
@@ -724,7 +736,7 @@ function handleScrollTop() {
     box-sizing: border-box;
     width: $w-250;
     border-radius: 6px;
-    background-color: papayawhip;
+    background-color: $theme-color-papayawhip;
     color: #9499a0;
     .tab {
       display: flex;
@@ -737,7 +749,7 @@ function handleScrollTop() {
       overflow-y: scroll;
       padding: 0 15px;
       height: 100px;
-      background-color: papayawhip;
+      background-color: $theme-color-papayawhip;
 
       @extend %customScrollbar;
       .item {

+ 13 - 0
src/views/push/index.vue

@@ -358,6 +358,7 @@ import { useRoute } from 'vue-router';
 import * as workerTimers from 'worker-timers';
 
 import { QINIU_LIVE, mediaTypeEnumMap } from '@/constant';
+import { commentAuthTip, loginTip } from '@/hooks/use-login';
 import { usePush } from '@/hooks/use-push';
 import { useRTCParams } from '@/hooks/use-rtcParams';
 import { useUpload } from '@/hooks/use-upload';
@@ -500,10 +501,22 @@ function handleSendBlob(event: BlobEvent) {
 }
 
 function mockClick() {
+  if (!loginTip()) {
+    return;
+  }
+  if (!commentAuthTip()) {
+    return;
+  }
   uploadRef.value?.click();
 }
 
 function handleWait() {
+  if (!loginTip()) {
+    return;
+  }
+  if (!commentAuthTip()) {
+    return;
+  }
   window.$message.warning('敬请期待!');
 }
 

+ 8 - 2
src/views/rank/index.vue

@@ -86,7 +86,7 @@
             <div
               v-if="item.live?.live && currRankType === RankTypeEnum.liveRoom"
               class="living-tag"
-              @click="handleJoin(item.live)"
+              @click.stop="handleJoin(item.live)"
             >
               直播中
             </div>
@@ -105,7 +105,12 @@ import { fetchLiveRoomList } from '@/api/liveRoom';
 import { fetchBlogUserList, fetchUserList } from '@/api/user';
 import { fetchWalletList } from '@/api/wallet';
 import { fullLoading } from '@/components/FullLoading';
-import { ILiveRoom, IUser, RankTypeEnum } from '@/interface';
+import {
+  ILiveRoom,
+  IUser,
+  LiveRoomIsShowEnum,
+  RankTypeEnum,
+} from '@/interface';
 import router, { routerName } from '@/router';
 
 export interface IRankType {
@@ -240,6 +245,7 @@ async function getLiveRoomList() {
   try {
     fullLoading({ loading: true });
     const res = await fetchLiveRoomList({
+      is_show: LiveRoomIsShowEnum.yes,
       orderName: 'updated_at',
       orderBy: 'desc',
     });