提交 730d3267 authored 作者: 王鹏飞's avatar 王鹏飞

chore: update

上级 24bab73e
......@@ -40,4 +40,4 @@ function generateUploadTarget(src, dist) {
})
}
generateUploadTarget('./dist', '/website/prod/saas-lab')
generateUploadTarget('./dist', '/website/prod/zws')
差异被折叠。
......@@ -17,27 +17,28 @@
"axios": "^1.1.3",
"blueimp-md5": "^2.19.0",
"element-plus": "^2.2.19",
"pinia": "^2.0.17",
"pinia": "^2.0.23",
"qs": "^6.11.0",
"vue": "^3.2.37",
"vue-router": "^4.1.3"
"vue": "^3.2.41",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.1.4",
"@rushstack/eslint-patch": "^1.2.0",
"@types/blueimp-md5": "^2.18.0",
"@types/node": "^16.11.47",
"@vitejs/plugin-vue": "^3.0.1",
"@vue/eslint-config-typescript": "^11.0.0",
"@types/node": "^18.11.8",
"@types/qs": "^6.9.7",
"@vitejs/plugin-vue": "^3.2.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/tsconfig": "^0.1.3",
"ali-oss": "^6.17.1",
"chalk": "^5.1.2",
"eslint": "^8.21.0",
"eslint-plugin-vue": "^9.3.0",
"eslint": "^8.26.0",
"eslint-plugin-vue": "^9.6.0",
"npm-run-all": "^4.1.5",
"sass": "^1.55.0",
"typescript": "~4.7.4",
"typescript": "~4.8.4",
"unplugin-auto-import": "^0.11.4",
"vite": "^3.0.4",
"vue-tsc": "^0.39.5"
"vite": "^3.2.1",
"vue-tsc": "^1.0.9"
}
}
......@@ -14,7 +14,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
prefix: 'upload/saas-lab/'
prefix: 'upload/zws/'
})
const emit = defineEmits(['update:modelValue', 'success'])
......
<script lang="ts">
const DEFAULT_OPTIONS = {
controls: true,
autoplay: false,
controlBar: {
pictureInPictureToggle: false
},
// fluid: true,
responsive: true
// playbackRates: [0.5, 1, 1.5, 2]
}
const DEFAULT_EVENTS = [
'abort',
'canplay',
'canplaythrough',
'durationchange',
'emptied',
'ended',
'error',
'loadeddata',
'loadedmetadata',
'pause',
'play',
'playing',
'progress',
'ratechange',
'resize',
'seeked',
'seeking',
'stalled',
'suspend',
'timeupdate',
'volumechange',
'waiting'
]
</script>
<script setup lang="ts">
import videojs from 'video.js'
import type { VideoJsPlayerOptions, VideoJsPlayer } from 'video.js'
import 'video.js/dist/video-js.css'
interface Props {
src?: string | { src: string; type?: string }
options?: VideoJsPlayerOptions
}
const props = defineProps<Props>()
const emit = defineEmits(['ready', ...DEFAULT_EVENTS])
let player = $ref<VideoJsPlayer | null>()
const videoRef = $ref<HTMLVideoElement>()
const videoOptions = $computed<VideoJsPlayerOptions>(() => {
return Object.assign({}, DEFAULT_OPTIONS, props.options)
})
watch(
() => props.src,
src => {
src && changeSrc(src)
},
{ deep: true, immediate: true }
)
// 初始化播放器
function initPlayer() {
if (!videoRef) return
if (player) {
player.dispose()
player = null
}
player = videojs(videoRef, videoOptions, function onPlayerReady() {
props.src && changeSrc(props.src)
// 注册事件
DEFAULT_EVENTS.forEach(eventName => {
this.on(eventName, (...arg) => {
// console.log(eventName, ...arg)
emit(eventName, ...arg)
})
})
emit('ready', this)
})
return player
}
function changeSrc(src: string | { src: string; type?: string }) {
if (!player || !src) return
// if (!player.paused()) {
// console.log(2)
// player.pause()
// }
player.src(src)
// player.load()
// player.play()
}
onMounted(() => {
initPlayer()
})
onUnmounted(() => {
player && player.dispose()
})
</script>
<template>
<video class="video-js vjs-default-skin vjs-big-play-centered" ref="videoRef"></video>
</template>
<style>
.video-js {
font-size: 12px;
}
</style>
<script setup lang="ts">
import Editor from '@tinymce/tinymce-vue'
import md5 from 'blueimp-md5'
import { getSignature, uploadFile } from '@/api/base'
const props = defineProps({
height: {
type: Number,
default: 600
}
})
const ImageUploadHandler = (blobInfo: any) =>
new Promise((resolve, reject) => {
const file = blobInfo.blob()
getSignature()
.then((response: any) => {
const prefix = 'upload/admin/'
const key = prefix + md5(file.name + new Date().getTime()) + file.name.substr(file.name.lastIndexOf('.'))
const { accessid, policy, signature, host } = response
const params = {
key,
OSSAccessKeyId: accessid,
policy,
signature,
success_action_status: '200',
file,
url: `${host}/${key}`
}
uploadFile(params)
.then((res: any) => {
resolve(res.url)
})
.catch(() => {
reject('上传失败')
})
})
.catch(() => {
reject('获取Signature失败')
})
})
const init = {
language: 'zh-Hans',
height: props.height,
menubar: false,
statusbar: false,
plugins: 'table charmap fullscreen lists link code preview quickbars',
toolbar:
'undo redo | fontsizeselect lineheight bold italic underline strikethrough forecolor backcolor | link quickimage image media table | align hangingindent indent outdent numlist bullist | charmap blockquote hr fullscreen | code preview',
// font_formats:
// '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Times New Roman',
fontsize_formats: '8px 10px 12px 14px 15px 16px 17px 18px 20px 24px',
lineheight_formats: '0.5 1 1.2 1.5 2',
images_upload_handler: ImageUploadHandler,
automatic_uploads: true,
quickbars_insert_toolbar: false,
// style_formats: [{ title: '悬挂缩进', block: 'p', styles: { textIndent: '-2em', paddingLeft: '2em' } }],
content_style: 'img {max-width:100%;}'
}
</script>
<template>
<editor :init="init" v-bind="$attrs" style="width: 100%" />
</template>
import { defineStore } from 'pinia'
import { getMapList } from '@/api/base'
interface State {
mapList: IMapState[]
}
interface IMapState {
id: string
key: string
name: string
remark: string
values: IValuesList[]
}
interface IValuesList {
data_dictionary_id: string
id: string
label: string
remark: string
sort: string
value: string
}
export const useMapStore = defineStore({
id: 'map',
state: (): State => {
return {
mapList: []
}
},
getters: {
getMapValuesByKey: state => {
return (key: string) => state.mapList.find(map => map.key === key)?.values || []
}
},
actions: {
async getMapList() {
const res = await getMapList()
this.mapList = res.data || []
}
}
})
useMapStore().getMapList()
// json to array
export const json2Array = function (data, isValueToNumber = true) {
export const json2Array = function (data: any, isValueToNumber = true) {
return Object.keys(data).map(value => ({ label: data[value], value: isValueToNumber ? parseInt(value) : value }))
}
// 组卷模式
export const paperType = {
1: '选题组卷',
2: '自动组卷',
3: '自由组卷'
}
// 组卷模式列表
export const paperTypeList = json2Array(paperType)
// 试题类型
export const questionType = {
1: '单选题',
2: '多选题',
3: '问答题',
5: '案例题',
6: '判断题',
7: '实操题',
8: '情景题'
}
// 试题类型列表
export const questionTypeList = json2Array(questionType, false)
// 试题难度
export const questionDifficulty = {
1: '易',
2: '中',
3: '难',
0: '无'
}
// 试题难度列表
export const questionDifficultyList = json2Array(questionDifficulty, false)
......@@ -7,7 +7,7 @@ import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
export default defineConfig(({ mode }) => ({
base: mode === 'prod' ? 'https://webapp-pub.ezijing.com/website/prod/saas-lab/' : '/',
base: mode === 'prod' ? 'https://webapp-pub.ezijing.com/website/prod/zws/' : '/',
plugins: [
vue({ reactivityTransform: true }),
AutoImport({
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论