Merge branch 'dev-wangyiming'
# Conflicts: # src/views/AppMain.vue # src/views/equip/detail.vue # src/views/equip/list.vue
This commit is contained in:
commit
7a847933cf
|
|
@ -1,5 +1,10 @@
|
|||
import { post,get } from '../index'
|
||||
|
||||
export const getList = () => {
|
||||
return get('/dev/list',{})
|
||||
// 获取装备列表
|
||||
export const getList = (params = {}) => {
|
||||
return post('/dev/list',params)
|
||||
}
|
||||
|
||||
export const getDetail = (id = '') => {
|
||||
return get(`/dev/${id}`)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@
|
|||
import axios from 'axios'
|
||||
import NProgress from 'nprogress'
|
||||
import { useStore } from 'store/main'
|
||||
import {ElMessage} from "element-plus";
|
||||
import router from "@/router"
|
||||
const store = useStore()
|
||||
// const CancelToken = axios.CancelToken
|
||||
// const source = CancelToken.source()
|
||||
const baseUrl = import.meta.env.VITE_API_URL
|
||||
// const mode = import.meta.env.VITE_BUILD_MODE
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: baseUrl,
|
||||
timeout: 60000
|
||||
|
|
@ -15,7 +18,7 @@ const service = axios.create({
|
|||
|
||||
service.interceptors.request.use(
|
||||
(config) => {
|
||||
config.headers['Authorization'] = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6Ijc5MjRkNDc1LTRjMmUtNGViYy05ZDU0LTA2NzNmNWU0MDhiMyIsInVzZXJuYW1lIjoiYWRtaW4ifQ.M3H9jHnfFAKJ3szdiDb79hIHfiS8AWvaI51mP65l01Q2G0jcLSTvjlub8FykYV3A27If7V6GBRo83u8spRDquw"
|
||||
config.headers['Authorization'] = store.token
|
||||
return config
|
||||
},
|
||||
(error) => {
|
||||
|
|
@ -25,7 +28,15 @@ service.interceptors.request.use(
|
|||
// 响应拦截
|
||||
service.interceptors.response.use(
|
||||
(res) => {
|
||||
return res.data
|
||||
const { data } = res
|
||||
if(data.code == '200'){
|
||||
return data
|
||||
}else if(data.code == '403'){
|
||||
ElMessage.error('请重新登录')
|
||||
router.push('/login')
|
||||
}else{
|
||||
return data
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
|
||||
|
|
|
|||
|
|
@ -208,12 +208,11 @@ const router = createRouter({
|
|||
router.beforeEach((to, from, next) => {
|
||||
const store = useStore()
|
||||
|
||||
if (store.token) {
|
||||
if (store.token || to.path == '/login') {
|
||||
next()
|
||||
} else {
|
||||
next({ path: '/login' })
|
||||
next('/login')
|
||||
}
|
||||
|
||||
// chrome
|
||||
document.body.scrollTop = 0;
|
||||
// firefox 兼容火狐
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ export const useStore = defineStore('main', {
|
|||
state: () => {
|
||||
return {
|
||||
loadingFlag: false, //loading控制,
|
||||
token: ''
|
||||
token: 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6Ijc5MjRkNDc1LTRjMmUtNGViYy05ZDU0LTA2NzNmNWU0MDhiMyIsInVzZXJuYW1lIjoiYWRtaW4ifQ.M3H9jHnfFAKJ3szdiDb79hIHfiS8AWvaI51mP65l01Q2G0jcLSTvjlub8FykYV3A27If7V6GBRo83u8spRDquw'
|
||||
}
|
||||
},
|
||||
getters: {},
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
<template>
|
||||
<div class="equipShowImg">
|
||||
<div class="show">
|
||||
<img :src="activeUrl">
|
||||
<img :src="urlList[activeUrl]">
|
||||
</div>
|
||||
<div class="loop">
|
||||
<div class="prev btn">
|
||||
<div class="prev btn" @click="changeActive(-1)">
|
||||
<el-icon><ArrowLeftBold /></el-icon>
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="item" @mouseenter="mouseenter($event,v)" :class="v == activeUrl && 'activeUrl'" v-for="(v,i) in urlList" :key="i">
|
||||
<img :src="v">
|
||||
<div class="line" :style="`transform: translateX(calc((-100% - 10px) / 3 * ${activeUrl - 3}))`">
|
||||
<div class="item" @mouseenter="mouseenter($event,i)" :class="i == activeUrl && 'activeUrl'" v-for="(v,i) in urlList" :key="i">
|
||||
<img :src="v">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="next btn">
|
||||
<div class="next btn" @click="changeActive(1)">
|
||||
<el-icon><ArrowRightBold /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -33,10 +35,11 @@
|
|||
}
|
||||
})
|
||||
|
||||
const activeUrl = ref('')
|
||||
|
||||
//激活图片下标
|
||||
const activeUrl = ref(0)
|
||||
|
||||
const init = () => {
|
||||
activeUrl.value = props.urlList ? props.urlList[0] : ''
|
||||
|
||||
}
|
||||
init()
|
||||
|
||||
|
|
@ -44,6 +47,15 @@
|
|||
activeUrl.value = val
|
||||
}
|
||||
|
||||
const changeActive = (val) => {
|
||||
activeUrl.value = activeUrl.value + val
|
||||
if(activeUrl.value < 0){
|
||||
activeUrl.value = 0
|
||||
}else if(activeUrl.value == props.urlList?.length){
|
||||
activeUrl.value = props.urlList.length - 1
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.equipShowImg{
|
||||
|
|
@ -83,9 +95,13 @@
|
|||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
height: 100%;
|
||||
.line{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.item{
|
||||
height: 100%;
|
||||
margin-right: 5px;
|
||||
|
|
|
|||
Loading…
Reference in New Issue