mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-30 09:24:46 +08:00
chore: structure change
This commit is contained in:
parent
e027fec6dc
commit
f4cd720ce8
1067
package-lock.json
generated
1067
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@
|
|||||||
"wangeditor": "^4.0.3",
|
"wangeditor": "^4.0.3",
|
||||||
"xe-ajax": "^4.0.5",
|
"xe-ajax": "^4.0.5",
|
||||||
"xe-utils": "^3.1.12",
|
"xe-utils": "^3.1.12",
|
||||||
"xgplayer": "^2.18.3"
|
"xgplayer": "^2.19.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mockjs": "^1.0.3",
|
"@types/mockjs": "^1.0.3",
|
||||||
|
10
src/components/BreadCrumb/index.ts
Normal file
10
src/components/BreadCrumb/index.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { App } from "vue"
|
||||||
|
import breadCrumb from "./src/BreadCrumb.vue"
|
||||||
|
|
||||||
|
export const BreadCrumb = Object.assign(breadCrumb, {
|
||||||
|
install(app: App) {
|
||||||
|
app.component(breadCrumb.name, breadCrumb)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default BreadCrumb
|
@ -21,7 +21,7 @@ import { ref, defineComponent, watch, Ref } from "vue";
|
|||||||
import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
|
import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "breadCrumb",
|
name: "BreadCrumb",
|
||||||
setup() {
|
setup() {
|
||||||
const levelList: Ref<RouteLocationMatched[]> = ref([]);
|
const levelList: Ref<RouteLocationMatched[]> = ref([]);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
10
src/components/Cropper/index.ts
Normal file
10
src/components/Cropper/index.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { App } from "vue"
|
||||||
|
import cropper from "./src/Cropper"
|
||||||
|
|
||||||
|
export const Cropper = Object.assign(cropper, {
|
||||||
|
install(app: App) {
|
||||||
|
app.component(cropper.name, cropper)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default Cropper
|
127
src/components/Cropper/src/Cropper.tsx
Normal file
127
src/components/Cropper/src/Cropper.tsx
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
import type { CSSProperties } from 'vue'
|
||||||
|
|
||||||
|
import { defineComponent, onBeforeMount, nextTick, ref, unref, computed, PropType, getCurrentInstance } from 'vue'
|
||||||
|
|
||||||
|
import { useAttrs } from '/@/utils/useAttrs'
|
||||||
|
import { emitter } from '/@/utils/mitt'
|
||||||
|
|
||||||
|
import Cropper from 'cropperjs'
|
||||||
|
import 'cropperjs/dist/cropper.css'
|
||||||
|
|
||||||
|
type Options = Cropper.Options
|
||||||
|
|
||||||
|
const defaultOptions: Cropper.Options = {
|
||||||
|
aspectRatio: 16 / 9,
|
||||||
|
zoomable: true,
|
||||||
|
zoomOnTouch: true,
|
||||||
|
zoomOnWheel: true,
|
||||||
|
cropBoxMovable: true,
|
||||||
|
cropBoxResizable: true,
|
||||||
|
toggleDragModeOnDblclick: true,
|
||||||
|
autoCrop: true,
|
||||||
|
background: true,
|
||||||
|
highlight: true,
|
||||||
|
center: true,
|
||||||
|
responsive: true,
|
||||||
|
restore: true,
|
||||||
|
checkCrossOrigin: true,
|
||||||
|
checkOrientation: true,
|
||||||
|
scalable: true,
|
||||||
|
modal: true,
|
||||||
|
guides: true,
|
||||||
|
movable: true,
|
||||||
|
rotatable: true,
|
||||||
|
}
|
||||||
|
export default defineComponent({
|
||||||
|
name: "Cropper",
|
||||||
|
props: {
|
||||||
|
src: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
alt: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: '360px',
|
||||||
|
},
|
||||||
|
crossorigin: {
|
||||||
|
type: String || Object,
|
||||||
|
default: undefined,
|
||||||
|
},
|
||||||
|
imageStyle: {
|
||||||
|
type: Object as PropType<CSSProperties>,
|
||||||
|
default: {},
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Object as PropType<Options>,
|
||||||
|
default: {},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setup(props) {
|
||||||
|
let vm: any
|
||||||
|
const cropper: any = ref<Nullable<Cropper>>(null)
|
||||||
|
|
||||||
|
const isReady = ref(false)
|
||||||
|
|
||||||
|
const getImageStyle = computed(
|
||||||
|
(): CSSProperties => {
|
||||||
|
return {
|
||||||
|
height: props.height,
|
||||||
|
width: props.width,
|
||||||
|
maxWidth: '100%',
|
||||||
|
...props.imageStyle,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const getWrapperStyle = computed(
|
||||||
|
(): CSSProperties => {
|
||||||
|
const { height, width } = props
|
||||||
|
return { width: `${width}`.replace(/px/, '') + 'px', height: `${height}`.replace(/px/, '') + 'px' }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
async function init() {
|
||||||
|
const imgEl = vm.refs.imgElRef
|
||||||
|
if (!imgEl) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
cropper.value = new Cropper(imgEl, {
|
||||||
|
...defaultOptions,
|
||||||
|
ready: () => {
|
||||||
|
isReady.value = true
|
||||||
|
},
|
||||||
|
...props.options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
vm = getCurrentInstance()
|
||||||
|
nextTick(() => {
|
||||||
|
init()
|
||||||
|
// tsx语法返回渲染模板,外部组件想调用内部方法或者获取setup里面的实例,暂时想到的办法是通过公共事件
|
||||||
|
emitter.emit("cropperInstance", unref(cropper))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return () => (
|
||||||
|
<>
|
||||||
|
<div class={useAttrs({ excludeListeners: true, excludeKeys: ['class'] })} style={unref(getWrapperStyle)}>
|
||||||
|
<img
|
||||||
|
ref="imgElRef"
|
||||||
|
src={props.src}
|
||||||
|
alt={props.alt}
|
||||||
|
crossorigin={props.crossorigin}
|
||||||
|
style={unref(getImageStyle)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
})
|
@ -1,3 +1,4 @@
|
|||||||
|
/**
|
||||||
<template>
|
<template>
|
||||||
<div :class="$attrs.class" :style="getWrapperStyle">
|
<div :class="$attrs.class" :style="getWrapperStyle">
|
||||||
<img
|
<img
|
||||||
@ -43,6 +44,7 @@
|
|||||||
rotatable: true,
|
rotatable: true,
|
||||||
};
|
};
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
name: "Cropper",
|
||||||
props: {
|
props: {
|
||||||
src: {
|
src: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -126,3 +128,4 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
*/
|
10
src/components/Flop/index.ts
Normal file
10
src/components/Flop/index.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { App } from "vue"
|
||||||
|
import flop from "./src/index.vue"
|
||||||
|
|
||||||
|
export const Flop = Object.assign(flop, {
|
||||||
|
install(app: App) {
|
||||||
|
app.component(flop.name, flop)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default Flop
|
@ -13,8 +13,9 @@
|
|||||||
|
|
||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import { ref, onBeforeMount, getCurrentInstance, nextTick } from "vue";
|
import { ref, onBeforeMount, getCurrentInstance, nextTick } from "vue";
|
||||||
import flippers from "./flipper.vue";
|
import flippers from "./Flipper.vue";
|
||||||
export default {
|
export default {
|
||||||
|
name: "Flop",
|
||||||
components: {
|
components: {
|
||||||
flippers,
|
flippers,
|
||||||
},
|
},
|
10
src/components/HamBurger/index.ts
Normal file
10
src/components/HamBurger/index.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { App } from "vue"
|
||||||
|
import hamBurger from "./src/HamBurger.vue"
|
||||||
|
|
||||||
|
export const HamBurger = Object.assign(hamBurger, {
|
||||||
|
install(app: App) {
|
||||||
|
app.component(hamBurger.name, hamBurger)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default HamBurger
|
@ -18,7 +18,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "hamBurger",
|
name: "HamBurger",
|
||||||
props: {
|
props: {
|
||||||
isActive: {
|
isActive: {
|
||||||
type: Boolean,
|
type: Boolean,
|
20
src/components/Map/index.ts
Normal file
20
src/components/Map/index.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { App } from "vue"
|
||||||
|
import amap from "./src/Amap.vue"
|
||||||
|
import baiduMap from "./src/BaiduMap.vue"
|
||||||
|
|
||||||
|
export const Amap = Object.assign(amap, {
|
||||||
|
install(app: App) {
|
||||||
|
app.component(amap.name, amap)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export const BaiduMap = Object.assign(baiduMap, {
|
||||||
|
install(app: App) {
|
||||||
|
app.component(baiduMap.name, baiduMap)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default {
|
||||||
|
Amap,
|
||||||
|
BaiduMap
|
||||||
|
}
|
@ -19,9 +19,10 @@ import {
|
|||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
|
|
||||||
import { mapJson } from "../../api/mock";
|
import { mapJson } from "/@/api/mock";
|
||||||
|
import { deviceDetection } from "/@/utils/deviceDetection"
|
||||||
|
|
||||||
import greenCar from "/@/assets/green.png";
|
import greenCar from "/@/assets/green.png";
|
||||||
import { deviceDetection } from "../../utils/deviceDetection"
|
|
||||||
|
|
||||||
let MarkerCluster = null;
|
let MarkerCluster = null;
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ export interface mapInter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
name: "Amap",
|
||||||
setup() {
|
setup() {
|
||||||
let vm: any;
|
let vm: any;
|
||||||
let map: MapConfigureInter;
|
let map: MapConfigureInter;
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
export default {
|
export default {
|
||||||
|
name: "BaiduMap",
|
||||||
setup(){
|
setup(){
|
||||||
return{
|
return{
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
import { App } from "vue"
|
import { App } from "vue"
|
||||||
import countTo from "./src/countTo"
|
import countTo from "./src/CountTo"
|
||||||
|
|
||||||
export const CountTo = Object.assign(countTo, {
|
export const CountTo = Object.assign(countTo, {
|
||||||
install(app: App) {
|
install(app: App) {
|
||||||
|
@ -25,7 +25,7 @@ export default defineComponent({
|
|||||||
timestamp: number | null
|
timestamp: number | null
|
||||||
rAF: any
|
rAF: any
|
||||||
remaining: number | null
|
remaining: number | null
|
||||||
color: any
|
color: string
|
||||||
fontSize: string
|
fontSize: string
|
||||||
}>({
|
}>({
|
||||||
localStartVal: props.startVal,
|
localStartVal: props.startVal,
|
||||||
|
@ -13,14 +13,8 @@ export const countToProps = {
|
|||||||
return value >= 0
|
return value >= 0
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
color: {
|
color: propTypes.string.def(),
|
||||||
type: String as PropType<string>,
|
fontSize: propTypes.string.def(),
|
||||||
require: false
|
|
||||||
},
|
|
||||||
fontSize: {
|
|
||||||
type: String as PropType<string>,
|
|
||||||
require: false
|
|
||||||
},
|
|
||||||
decimal: propTypes.string.def('.'),
|
decimal: propTypes.string.def('.'),
|
||||||
separator: propTypes.string.def(','),
|
separator: propTypes.string.def(','),
|
||||||
prefix: propTypes.string.def(''),
|
prefix: propTypes.string.def(''),
|
||||||
|
@ -57,7 +57,7 @@ import {
|
|||||||
watch,
|
watch,
|
||||||
nextTick,
|
nextTick,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { storageSession } from "../../utils/storage";
|
import { storageSession } from "/@/utils/storage";
|
||||||
|
|
||||||
export interface ContextProps {
|
export interface ContextProps {
|
||||||
userName: string;
|
userName: string;
|
||||||
@ -71,6 +71,7 @@ export interface ContextProps {
|
|||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
name: "Info",
|
||||||
props: {
|
props: {
|
||||||
ruleForm: {
|
ruleForm: {
|
||||||
type: Object as PropType<ContextProps>,
|
type: Object as PropType<ContextProps>,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { App } from "vue"
|
import { App } from "vue"
|
||||||
import selector from "./src/selector"
|
import selector from "./src/Selector"
|
||||||
|
|
||||||
export const Selector = Object.assign(selector, {
|
export const Selector = Object.assign(selector, {
|
||||||
install(app: App) {
|
install(app: App) {
|
||||||
|
@ -48,7 +48,7 @@ let selectedList = [];
|
|||||||
let overList = [];
|
let overList = [];
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "HsSelector",
|
name: "Selector",
|
||||||
props: {
|
props: {
|
||||||
HsKey: {
|
HsKey: {
|
||||||
type: Number || String,
|
type: Number || String,
|
||||||
|
@ -22,7 +22,7 @@ let overList = []
|
|||||||
let selectedList = []
|
let selectedList = []
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "HsSelector",
|
name: "Selector",
|
||||||
props: {
|
props: {
|
||||||
HsKey: {
|
HsKey: {
|
||||||
type: Number || String,
|
type: Number || String,
|
||||||
|
@ -36,11 +36,8 @@
|
|||||||
import {
|
import {
|
||||||
defineComponent,
|
defineComponent,
|
||||||
ref,
|
ref,
|
||||||
getCurrentInstance,
|
|
||||||
computed,
|
computed,
|
||||||
watch,
|
|
||||||
PropType,
|
PropType,
|
||||||
onBeforeMount,
|
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import resizer from "./resizer.vue";
|
import resizer from "./resizer.vue";
|
||||||
|
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
import * as echarts from 'echarts/core'
|
|
||||||
|
|
||||||
import {
|
|
||||||
BarChart,
|
|
||||||
LineChart,
|
|
||||||
PieChart,
|
|
||||||
MapChart,
|
|
||||||
PictorialBarChart,
|
|
||||||
RadarChart,
|
|
||||||
} from 'echarts/charts'
|
|
||||||
|
|
||||||
import {
|
|
||||||
TitleComponent,
|
|
||||||
TooltipComponent,
|
|
||||||
GridComponent,
|
|
||||||
PolarComponent,
|
|
||||||
AriaComponent,
|
|
||||||
ParallelComponent,
|
|
||||||
LegendComponent,
|
|
||||||
RadarComponent,
|
|
||||||
} from 'echarts/components'
|
|
||||||
|
|
||||||
import { SVGRenderer } from 'echarts/renderers'
|
|
||||||
|
|
||||||
echarts.use([
|
|
||||||
LegendComponent,
|
|
||||||
TitleComponent,
|
|
||||||
TooltipComponent,
|
|
||||||
GridComponent,
|
|
||||||
PolarComponent,
|
|
||||||
AriaComponent,
|
|
||||||
ParallelComponent,
|
|
||||||
BarChart,
|
|
||||||
LineChart,
|
|
||||||
PieChart,
|
|
||||||
MapChart,
|
|
||||||
RadarChart,
|
|
||||||
SVGRenderer,
|
|
||||||
PictorialBarChart,
|
|
||||||
RadarComponent,
|
|
||||||
])
|
|
||||||
|
|
||||||
export default echarts
|
|
@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<hamburger
|
<Hamburger
|
||||||
:is-active="sidebar.opened"
|
:is-active="sidebar.opened"
|
||||||
class="hamburger-container"
|
class="hamburger-container"
|
||||||
@toggleClick="toggleSideBar"
|
@toggleClick="toggleSideBar"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<breadcrumb class="breadcrumb-container" />
|
<Breadcrumb class="breadcrumb-container" />
|
||||||
|
|
||||||
<div class="right-menu">
|
<div class="right-menu">
|
||||||
<screenfull />
|
<screenfull />
|
||||||
@ -31,14 +31,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ref, reactive, defineComponent, onMounted, nextTick } from "vue";
|
import { ref, defineComponent, onMounted } from "vue";
|
||||||
import Breadcrumb from "../../components/breadCrumb/index.vue";
|
import Breadcrumb from "/@/components/BreadCrumb";
|
||||||
import Hamburger from "../../components/hamBurger/index.vue";
|
import Hamburger from "/@/components/HamBurger";
|
||||||
import screenfull from "../components/screenfull/index.vue";
|
import screenfull from "../components/screenfull/index.vue";
|
||||||
import { useMapGetters } from "../store";
|
import { useMapGetters } from "../store";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { mapGetters, useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
import { storageSession } from "../../utils/storage";
|
import { storageSession } from "/@/utils/storage";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import ch from "/@/assets/ch.png";
|
import ch from "/@/assets/ch.png";
|
||||||
import en from "/@/assets/en.png";
|
import en from "/@/assets/en.png";
|
||||||
|
@ -88,7 +88,7 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/components/countTo',
|
path: '/components/countTo',
|
||||||
component: () => import(/* webpackChunkName: "components" */ '../views/components/countTo/index.vue'),
|
component: () => import(/* webpackChunkName: "components" */ '../views/components/count-to/index.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'countTo',
|
title: 'countTo',
|
||||||
showLink: false,
|
showLink: false,
|
||||||
@ -106,7 +106,7 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// path: '/components/flowChart',
|
// path: '/components/flowChart',
|
||||||
// component: () => import(/* webpackChunkName: "components" */ '../views/components/flowChart/index.vue'),
|
// component: () => import(/* webpackChunkName: "components" */ '../views/components/flow-chart/index.vue'),
|
||||||
// meta: {
|
// meta: {
|
||||||
// title: 'flowChart',
|
// title: 'flowChart',
|
||||||
// showLink: false,
|
// showLink: false,
|
||||||
|
4
src/utils/mitt.ts
Normal file
4
src/utils/mitt.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import type { Emitter } from 'mitt';
|
||||||
|
import mitt from 'mitt';
|
||||||
|
|
||||||
|
export const emitter: Emitter = mitt();
|
39
src/utils/useAttrs.ts
Normal file
39
src/utils/useAttrs.ts
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import { getCurrentInstance, reactive, shallowRef, watchEffect } from 'vue'
|
||||||
|
import type { Ref } from 'vue'
|
||||||
|
interface Params {
|
||||||
|
excludeListeners?: boolean
|
||||||
|
excludeKeys?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const DEFAULT_EXCLUDE_KEYS = ['class', 'style']
|
||||||
|
const LISTENER_PREFIX = /^on[A-Z]/
|
||||||
|
|
||||||
|
export function entries<T>(obj: Recordable<T>): [string, T][] {
|
||||||
|
return Object.keys(obj).map((key: string) => [key, obj[key]])
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAttrs(params: Params = {}): Ref<Recordable> | {} {
|
||||||
|
const instance = getCurrentInstance()
|
||||||
|
if (!instance) return {}
|
||||||
|
|
||||||
|
const { excludeListeners = false, excludeKeys = [] } = params
|
||||||
|
const attrs = shallowRef({})
|
||||||
|
const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS)
|
||||||
|
|
||||||
|
// Since attrs are not reactive, make it reactive instead of doing in `onUpdated` hook for better performance
|
||||||
|
instance.attrs = reactive(instance.attrs)
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
const res = entries(instance.attrs).reduce((acm, [key, val]) => {
|
||||||
|
if (!allExcludeKeys.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))) {
|
||||||
|
acm[key] = val
|
||||||
|
}
|
||||||
|
|
||||||
|
return acm
|
||||||
|
}, {} as Recordable)
|
||||||
|
|
||||||
|
attrs.value = res
|
||||||
|
})
|
||||||
|
|
||||||
|
return attrs
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="margin: 10px">
|
<div style="margin: 10px">
|
||||||
<div class="cropper-container">
|
<div class="cropper-container">
|
||||||
<cropperImage ref="refCropper" :src="img" @cropperedInfo="cropperedInfo" style="width:45%" />
|
<Cropper ref="refCropper" :width="'45vw'" :src="img" />
|
||||||
<img :src="cropperImg" class="croppered" v-if="cropperImg" />
|
<img :src="cropperImg" class="croppered" v-if="cropperImg" />
|
||||||
</div>
|
</div>
|
||||||
<el-button type="primary" @click="onCropper">裁剪</el-button>
|
<el-button type="primary" @click="onCropper">裁剪</el-button>
|
||||||
@ -9,39 +9,47 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onBeforeMount, getCurrentInstance } from "vue";
|
import { defineComponent, ref, onBeforeMount, nextTick } from "vue";
|
||||||
import cropperImage from "../../../components/cropper/index.vue";
|
import Cropper from "/@/components/Cropper";
|
||||||
import img from "./picture.jpeg";
|
import img from "./picture.jpeg";
|
||||||
|
import { emitter } from "/@/utils/mitt";
|
||||||
|
|
||||||
|
let cropperInstance = null;
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
cropperImage
|
Cropper,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
let vm: any;
|
|
||||||
let info = ref("");
|
let info = ref("");
|
||||||
let cropperImg = ref("");
|
let cropperImg = ref("");
|
||||||
|
|
||||||
const onCropper = (): void => {
|
const onCropper = (): void => {
|
||||||
vm.refs.refCropper.croppered();
|
nextTick(() => {
|
||||||
|
let imgInfo = cropperInstance.getData();
|
||||||
|
cropperInstance.getCroppedCanvas().toBlob((blob) => {
|
||||||
|
let fileReader: FileReader = new FileReader();
|
||||||
|
fileReader.onloadend = (e: any) => {
|
||||||
|
cropperImg.value = e.target.result;
|
||||||
|
info.value = imgInfo;
|
||||||
|
};
|
||||||
|
fileReader.readAsDataURL(blob);
|
||||||
|
}, "image/jpeg");
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
vm = getCurrentInstance();
|
emitter.on("cropperInstance", (key) => {
|
||||||
|
cropperInstance = key;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function cropperedInfo({ imgBase64, imgInfo }) {
|
|
||||||
info.value = imgInfo;
|
|
||||||
cropperImg.value = imgBase64;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
img,
|
img,
|
||||||
info,
|
info,
|
||||||
cropperImg,
|
cropperImg,
|
||||||
onCropper,
|
onCropper,
|
||||||
cropperedInfo
|
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="map">
|
<div class="map">
|
||||||
<amap />
|
<Amap />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import amap from "../../../components/map/amap.vue";
|
import { Amap } from "/@/components/Map";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
amap
|
Amap
|
||||||
},
|
},
|
||||||
setup(){
|
setup(){
|
||||||
return{
|
return{
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import Selector from "/@/components/selector";
|
import Selector from "/@/components/Selector";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Selector },
|
components: { Selector },
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import splitpane, {
|
import splitpane, {
|
||||||
ContextProps,
|
ContextProps,
|
||||||
} from "../../../components/splitPane/index.vue";
|
} from "/@/components/SplitPane/index.vue";
|
||||||
import { reactive } from "vue";
|
import { reactive } from "vue";
|
||||||
export default {
|
export default {
|
||||||
name: "split",
|
name: "split",
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import { onMounted } from "vue";
|
import { onMounted } from "vue";
|
||||||
import Player from "xgplayer/dist/simple_player";
|
import Player from "xgplayer/dist/simple_player";
|
||||||
import { volume, playbackRate, screenShot } from "xgplayer/dist/controls";
|
import volume from 'xgplayer/dist/controls/volume';
|
||||||
import { deviceDetection } from "../../../utils/deviceDetection"
|
import playbackRate from 'xgplayer/dist/controls/playbackRate';
|
||||||
|
import screenShot from 'xgplayer/dist/controls/screenShot';
|
||||||
|
import { deviceDetection } from "/@/utils/deviceDetection"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
|
@ -13,11 +13,11 @@ import {
|
|||||||
reactive,
|
reactive,
|
||||||
onBeforeMount,
|
onBeforeMount,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import info, { ContextProps } from "../components/info/index.vue";
|
import info, { ContextProps } from "/@/components/Info/index.vue";
|
||||||
import { getVerify, getLogin } from "../api/user";
|
import { getVerify, getLogin } from "/@/api/user";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { storageSession } from "../utils/storage";
|
import { storageSession } from "/@/utils/storage";
|
||||||
import { warnMessage, successMessage } from "../utils/message";
|
import { warnMessage, successMessage } from "/@/utils/message";
|
||||||
export default {
|
export default {
|
||||||
name: "login",
|
name: "login",
|
||||||
components: {
|
components: {
|
||||||
|
@ -16,10 +16,10 @@ import {
|
|||||||
onBeforeMount,
|
onBeforeMount,
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import info, { ContextProps } from "../components/info/index.vue";
|
import info, { ContextProps } from "/@//components/Info/index.vue";
|
||||||
import { getRegist, getVerify } from "../api/user";
|
import { getRegist, getVerify } from "/@/api/user";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { warnMessage, successMessage } from "../utils/message";
|
import { warnMessage, successMessage } from "/@/utils/message";
|
||||||
export default {
|
export default {
|
||||||
name: "register",
|
name: "register",
|
||||||
components: {
|
components: {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
/>
|
/>
|
||||||
<span>{{ greetings }}</span>
|
<span>{{ greetings }}</span>
|
||||||
</div>
|
</div>
|
||||||
<flop v-if="!mobile" />
|
<Flop v-if="!mobile" />
|
||||||
</div>
|
</div>
|
||||||
</el-affix>
|
</el-affix>
|
||||||
|
|
||||||
@ -27,10 +27,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts'>
|
<script lang='ts'>
|
||||||
import flop from "../components/flop/index.vue";
|
import Flop from "/@/components/Flop";
|
||||||
import { ref, computed, onMounted, nextTick, onUpdated } from "vue";
|
import { ref, computed, onMounted, nextTick } from "vue";
|
||||||
import { deviceDetection } from "../utils/deviceDetection";
|
import { deviceDetection } from "/@/utils/deviceDetection";
|
||||||
import { echartsJson } from "../api/mock";
|
import { echartsJson } from "/@/api/mock";
|
||||||
import {
|
import {
|
||||||
useEventListener,
|
useEventListener,
|
||||||
tryOnUnmounted,
|
tryOnUnmounted,
|
||||||
@ -42,7 +42,7 @@ let brokenLine: any = null; //折线图实例
|
|||||||
export default {
|
export default {
|
||||||
name: "welcome",
|
name: "welcome",
|
||||||
components: {
|
components: {
|
||||||
flop,
|
Flop,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
let mobile = ref(deviceDetection());
|
let mobile = ref(deviceDetection());
|
||||||
|
@ -23,11 +23,17 @@
|
|||||||
"paths": {
|
"paths": {
|
||||||
"/@/*": [
|
"/@/*": [
|
||||||
"src/*"
|
"src/*"
|
||||||
|
],
|
||||||
|
"/#/*": [
|
||||||
|
"types/*"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"types": ["node"],
|
"types": [
|
||||||
|
"node"
|
||||||
|
],
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"./node_modules/@types/",
|
||||||
|
"./types"
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
@ -35,7 +41,10 @@
|
|||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
"src/**/*.vue",
|
"src/**/*.vue",
|
||||||
"tests/**/*.ts",
|
"tests/**/*.ts",
|
||||||
"src/utils/path.js"
|
"src/utils/path.js",
|
||||||
|
"types/**/*.d.ts",
|
||||||
|
"types/**/*.ts",
|
||||||
|
"types/shims-tsx.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
99
types/global.d.ts
vendored
Normal file
99
types/global.d.ts
vendored
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
import type {
|
||||||
|
ComponentRenderProxy,
|
||||||
|
VNode,
|
||||||
|
ComponentPublicInstance,
|
||||||
|
FunctionalComponent,
|
||||||
|
PropType as VuePropType,
|
||||||
|
} from 'vue'
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
const __APP_INFO__: {
|
||||||
|
pkg: {
|
||||||
|
name: string
|
||||||
|
version: string
|
||||||
|
dependencies: Recordable<string>
|
||||||
|
devDependencies: Recordable<string>
|
||||||
|
}
|
||||||
|
lastBuildTime: string
|
||||||
|
}
|
||||||
|
declare interface Window {
|
||||||
|
// Global vue app instance
|
||||||
|
__APP__: App<Element>
|
||||||
|
}
|
||||||
|
|
||||||
|
// vue
|
||||||
|
declare type PropType<T> = VuePropType<T>
|
||||||
|
|
||||||
|
export type Writable<T> = {
|
||||||
|
-readonly [P in keyof T]: T[P]
|
||||||
|
}
|
||||||
|
|
||||||
|
declare type Nullable<T> = T | null
|
||||||
|
declare type NonNullable<T> = T extends null | undefined ? never : T
|
||||||
|
declare type Recordable<T = any> = Record<string, T>
|
||||||
|
declare type ReadonlyRecordable<T = any> = {
|
||||||
|
readonly [key: string]: T
|
||||||
|
}
|
||||||
|
declare type Indexable<T = any> = {
|
||||||
|
[key: string]: T
|
||||||
|
}
|
||||||
|
declare type DeepPartial<T> = {
|
||||||
|
[P in keyof T]?: DeepPartial<T[P]>
|
||||||
|
}
|
||||||
|
declare type TimeoutHandle = ReturnType<typeof setTimeout>
|
||||||
|
declare type IntervalHandle = ReturnType<typeof setInterval>
|
||||||
|
|
||||||
|
declare interface ChangeEvent extends Event {
|
||||||
|
target: HTMLInputElement
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface WheelEvent {
|
||||||
|
path?: EventTarget[]
|
||||||
|
}
|
||||||
|
interface ImportMetaEnv extends ViteEnv {
|
||||||
|
__: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface ViteEnv {
|
||||||
|
VITE_PORT: number
|
||||||
|
VITE_USE_MOCK: boolean
|
||||||
|
VITE_USE_PWA: boolean
|
||||||
|
VITE_PUBLIC_PATH: string
|
||||||
|
VITE_PROXY: [string, string][]
|
||||||
|
VITE_GLOB_APP_TITLE: string
|
||||||
|
VITE_GLOB_APP_SHORT_NAME: string
|
||||||
|
VITE_USE_CDN: boolean
|
||||||
|
VITE_DROP_CONSOLE: boolean
|
||||||
|
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'
|
||||||
|
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
|
||||||
|
VITE_LEGACY: boolean
|
||||||
|
VITE_USE_IMAGEMIN: boolean
|
||||||
|
VITE_GENERATE_UI: string
|
||||||
|
}
|
||||||
|
|
||||||
|
declare function parseInt(s: string | number, radix?: number): number
|
||||||
|
|
||||||
|
declare function parseFloat(string: string | number): number
|
||||||
|
|
||||||
|
namespace JSX {
|
||||||
|
// tslint:disable no-empty-interface
|
||||||
|
type Element = VNode
|
||||||
|
// tslint:disable no-empty-interface
|
||||||
|
type ElementClass = ComponentRenderProxy
|
||||||
|
interface ElementAttributesProperty {
|
||||||
|
$props: any
|
||||||
|
}
|
||||||
|
interface IntrinsicElements {
|
||||||
|
[elem: string]: any
|
||||||
|
}
|
||||||
|
interface IntrinsicAttributes {
|
||||||
|
[elem: string]: any
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'vue' {
|
||||||
|
export type JSXComponent<Props = any> =
|
||||||
|
| { new(): ComponentPublicInstance<Props> }
|
||||||
|
| FunctionalComponent<Props>
|
||||||
|
}
|
26
types/index.d.ts
vendored
Normal file
26
types/index.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
declare interface Fn<T = any, R = T> {
|
||||||
|
(...arg: T[]): R
|
||||||
|
}
|
||||||
|
|
||||||
|
declare interface PromiseFn<T = any, R = T> {
|
||||||
|
(...arg: T[]): Promise<R>
|
||||||
|
}
|
||||||
|
|
||||||
|
declare type RefType<T> = T | null
|
||||||
|
|
||||||
|
declare type LabelValueOptions = {
|
||||||
|
label: string
|
||||||
|
value: any
|
||||||
|
}[]
|
||||||
|
|
||||||
|
declare type EmitType = (event: string, ...args: any[]) => void
|
||||||
|
|
||||||
|
declare type TargetContext = '_self' | '_blank'
|
||||||
|
|
||||||
|
declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
|
||||||
|
$el: T
|
||||||
|
}
|
||||||
|
|
||||||
|
declare type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null
|
||||||
|
|
||||||
|
declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>
|
Loading…
x
Reference in New Issue
Block a user