Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
b3b1dde262
|
@ -80,6 +80,7 @@ provide(injectKeySlideScale, scale)
|
|||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.slide-item {
|
||||
position: absolute;
|
||||
|
|
|
@ -198,7 +198,7 @@ export default (isLoader?: boolean = true) => {
|
|||
const touchInfo = ref<{ x: number; y: number; } | null>(null)
|
||||
|
||||
const touchStartListener = (e: TouchEvent) => {
|
||||
e.preventDefault() // 阻止默认事件
|
||||
// e.preventDefault() // 阻止默认事件
|
||||
touchInfo.value = {
|
||||
// x: e.changedTouches[0].pageX,
|
||||
// y: e.changedTouches[0].pageY,
|
||||
|
@ -208,6 +208,7 @@ export default (isLoader?: boolean = true) => {
|
|||
}
|
||||
const touchEndListener = (e: TouchEvent) => {
|
||||
if (!touchInfo.value) return
|
||||
// window.scrollTo(0, 0) // 滚动到顶部
|
||||
const offsetX = Math.abs(touchInfo.value.x - e.changedTouches[0].clientX)
|
||||
const offsetY = e.changedTouches[0].clientY - touchInfo.value.y
|
||||
if ( Math.abs(offsetY) > offsetX && Math.abs(offsetY) > 50 ) {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</li>
|
||||
<li v-if="computedregistertype!=4" :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</li>
|
||||
<li @click="onUserTo('/profile')">个人中心</li>
|
||||
<li v-if="isStadium() !== true" @click="onUserTo('/schoolManagement')">学校管理</li>
|
||||
<li v-if="isStadium() !== true && checkRole(['admin','headmaster'])" @click="onUserTo('/schoolManagement')">学校管理</li>
|
||||
<li v-if="isStadium() !== true" @click="onUserTo('/class')">班级中心</li>
|
||||
<li @click="logout">退出登录</li>
|
||||
</ul>
|
||||
|
@ -65,7 +65,7 @@ import pkc from "../../../../../package.json"
|
|||
import defaultUserImg from '@/assets/images/img-avatar.png'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import {toLinkLeftWeb} from "@/utils/tool"
|
||||
|
||||
import { checkRole } from '@/utils/permission'
|
||||
|
||||
const { ipcRenderer } = window.electron || {}
|
||||
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||
|
@ -86,6 +86,7 @@ const defaultImg = ['/img/avatar-default.jpg','/images/img-avatar.png','/src/ass
|
|||
|
||||
//是否是基地人员
|
||||
const isStadium = () => {
|
||||
console.log('isStadium',userStore.roles )
|
||||
let user = userStore.user
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
/**
|
||||
* 字符权限校验
|
||||
* @param {Array} value 校验值
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function checkPermi(value) {
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
const permissions = useUserStore().permissions
|
||||
const permissionDatas = value
|
||||
const all_permission = "*:*:*";
|
||||
|
||||
const hasPermission = permissions.some(permission => {
|
||||
return all_permission === permission || permissionDatas.includes(permission)
|
||||
})
|
||||
|
||||
if (!hasPermission) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色权限校验
|
||||
* @param {Array} value 校验值
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function checkRole(value) {
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
const roles = useUserStore().roles
|
||||
const permissionRoles = value
|
||||
const super_admin = "admin";
|
||||
|
||||
const hasRole = roles.some(role => {
|
||||
return super_admin === role || permissionRoles.includes(role)
|
||||
})
|
||||
|
||||
if (!hasRole) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
console.error(`need roles! Like checkRole="['admin','editor']"`)
|
||||
return false
|
||||
}
|
||||
}
|
|
@ -438,17 +438,23 @@ const toRousrceUrl = async (o) => {
|
|||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
let onLineUrl = '' // 线上地址
|
||||
if (!!o.zipPath) onLineUrl = pptMedia[o.zipPath] || '' // 是否已上传过
|
||||
let onLineUrl = '', typeExt = '' // 线上地址|文件后缀
|
||||
if (!!o.zipPath) {
|
||||
onLineUrl = pptMedia[o.zipPath] || '' // 是否已上传过
|
||||
typeExt = o.zipPath.split('.').pop()
|
||||
}
|
||||
if (onLineUrl) o.src = onLineUrl // 已存在线上地址直接赋值
|
||||
else { // 不存在重新上传
|
||||
if (isBase64) { // 相同资源处理
|
||||
const url = await getOnlineFileUrl(o.src)
|
||||
if(!typeExt) typeExt = 'png'
|
||||
const url = await getOnlineFileUrl(o.src, typeExt)
|
||||
url &&(o.src = url)
|
||||
url && o.zipPath && (pptMedia[o.zipPath] = url) // 缓存
|
||||
} else if (isBlobUrl) { // 视频和音频
|
||||
if(!typeExt) typeExt = o.type=='video'?'mp4':'mp3'
|
||||
const res = await fetch(o.src)
|
||||
const blob = await res.blob()
|
||||
const url = await getOnlineFileUrl(blob, o.type=='video'?'mp4':'mp3')
|
||||
const url = await getOnlineFileUrl(blob, typeExt)
|
||||
URL.revokeObjectURL(o.src) // 释放内存
|
||||
url &&(o.src = url)
|
||||
url && o.zipPath && (pptMedia[o.zipPath] = url) // 缓存
|
||||
|
|
|
@ -653,17 +653,23 @@ export default {
|
|||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
let onLineUrl = '' // 线上地址
|
||||
if (!!o.zipPath) onLineUrl = this.pptMedia[o.zipPath] || '' // 是否已上传过
|
||||
let onLineUrl = '', typeExt = '' // 线上地址|文件后缀
|
||||
if (!!o.zipPath) {
|
||||
onLineUrl = this.pptMedia[o.zipPath] || '' // 是否已上传过
|
||||
typeExt = o.zipPath.split('.').pop()
|
||||
}
|
||||
if (onLineUrl) o.src = onLineUrl // 已存在线上地址直接赋值
|
||||
else { // 不存在重新上传
|
||||
if (isBase64) { // 相同资源处理
|
||||
const url = await this.getOnlineFileUrl(o.src)
|
||||
if(!typeExt) typeExt = 'png'
|
||||
const url = await this.getOnlineFileUrl(o.src, typeExt)
|
||||
url &&(o.src = url)
|
||||
url && o.zipPath && (this.pptMedia[o.zipPath] = url) // 缓存
|
||||
} else if (isBlobUrl) { // 视频和音频
|
||||
if(!typeExt) typeExt = o.type=='video'?'mp4':'mp3'
|
||||
const res = await fetch(o.src)
|
||||
const blob = await res.blob()
|
||||
const url = await this.getOnlineFileUrl(blob, o.type=='video'?'mp4':'mp3')
|
||||
const url = await this.getOnlineFileUrl(blob, typeExt)
|
||||
URL.revokeObjectURL(o.src) // 释放内存
|
||||
url &&(o.src = url)
|
||||
url && o.zipPath && (this.pptMedia[o.zipPath] = url) // 缓存
|
||||
|
|
Loading…
Reference in New Issue