1.代码测试优化

sws 2024-08-26
v1.0.0
sws 2024-08-26 16:42:11 +08:00
parent ca9ace8e3a
commit 48babf6d19
3 changed files with 8 additions and 5 deletions

View File

@ -1,8 +1,8 @@
<template>
<div :style="style_container">
<div class="video re" :style="style">
<image-empty v-if="!video_img" error-img-style="width:60px;height:60px;"></image-empty>
<video v-else :src="video" :poster="video_img" class="w h"></video>
<image-empty v-if="!video_img" v-model="video_img" error-img-style="width:60px;height:60px;"></image-empty>
<video :src="video" :poster="video_img" class="w h"></video>
<img src="@/assets/images/components/model-video/video.png" class="middle box-shadow-sm round" width="60" height="60" />
</div>
</div>

3
src/types/stemp.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
const temp_token = 'f714594929c39071f21856b885f91556' || '';
// 导出token
export default temp_token;

View File

@ -1,7 +1,6 @@
import axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';
import { ElMessage, ElMessageBox } from 'element-plus';
import { get_cookie } from './index';
import temp_token from '@/types/temp.d';
// 创建 axios 实例
const index = window.location.href.lastIndexOf('?s=');
const pro_url = window.location.href.substring(0, index);
@ -12,11 +11,12 @@ const service = axios.create({
});
// 请求拦截器
service.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
async (config: InternalAxiosRequestConfig) => {
// 如果是本地则使用静态tonken如果是线上则使用cookie的token
const cookie = get_cookie('admin_info');
if (import.meta.env.VITE_APP_BASE_API == '/dev-api') {
config.url = config.url + '?token=' + temp_token;
let temp_token = await import('../types/stemp.d');
config.url = config.url + '?token=' + temp_token.default;
} else {
if (cookie) {
config.url = config.url + '&token=' + JSON.parse(cookie).token;