Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #152 from longguikeji/dev/pl-update
Browse files Browse the repository at this point in the history
Dev/pl update
  • Loading branch information
welylongguikeji authored Jul 1, 2021
2 parents a59eb4c + 85e447b commit 69e246d
Show file tree
Hide file tree
Showing 84 changed files with 1,479 additions and 1,351 deletions.
29 changes: 29 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<script lang="ts">
import { Component, Vue, Watch } from 'vue-property-decorator'
import ServiceWorkerUpdatePopup from './pwa/components/ServiceWorkerUpdatePopup.vue'
import { runFlowByFile } from '@/arkfbp/index'
import { GlobalValueModule } from '@/store/modules/global-value'
import { removeToken } from '@/utils/auth'
@Component({
name: 'App',
Expand All @@ -18,6 +21,32 @@ import ServiceWorkerUpdatePopup from './pwa/components/ServiceWorkerUpdatePopup.
}
})
export default class extends Vue {
private beforeUnloadTime
private interval
get closePageAutoLogout() {
return GlobalValueModule.closePageAutoLogout
}
mounted() {
window.addEventListener('beforeunload', () => this.beforeunloadHandler())
window.addEventListener('unload', () => this.unloadHandler())
}
destroyed() {
window.removeEventListener('beforeunload', () => this.beforeunloadHandler())
window.removeEventListener('unload', () => this.unloadHandler())
}
beforeunloadHandler() {
this.beforeUnloadTime = new Date().getTime()
}
async unloadHandler() {
this.interval = new Date().getTime() - this.beforeUnloadTime
if (this.interval <= 5 && this.closePageAutoLogout) {
removeToken()
}
}
}
</script>
5 changes: 0 additions & 5 deletions src/admin/FormPage/FormPageState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ export interface FormPage extends CardState {
forms?: {[value:string]: FormState}
bottomButtons?: Array<ButtonState> // form 结构中的底部按钮内容
actions?: { [name: string]: (IFlow | string)[] }
}

export default interface FromPageState {
type?: string // FormPage
state?: FormPage
}
47 changes: 24 additions & 23 deletions src/admin/FormPage/index.vue
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
<template>
<div class="form-page">
<Card :path="getChildPath('')">
<Select
v-if="state.select"
slot="header"
:path="getChildPath('select')"
<Card
:path="getChildPath('')"
class="form-page"
>
<Select
v-if="state.select"
slot="header"
:path="getChildPath('select')"
/>
<Form :path="formPath" />
<template v-if="state.bottomButtons">
<ButtonArray
:path="getChildPath('bottomButtons')"
class="form__page__buttons"
/>
<Form :path="formPath" />
<template v-if="state.bottomButtons">
<ButtonArray
:path="getChildPath('bottomButtons')"
class="form__page__buttons"
/>
</template>
<template v-if="state.dialogs">
<Dialog
v-for="dialogName in Object.keys(state.dialogs)"
:key="dialogName"
:path="getChildPath('dialogs.' + dialogName)"
/>
</template>
</Card>
</div>
</template>
<template v-if="state.dialogs">
<Dialog
v-for="dialogName in Object.keys(state.dialogs)"
:key="dialogName"
:path="getChildPath('dialogs.' + dialogName)"
/>
</template>
</Card>
</template>

<script lang="ts">
Expand Down Expand Up @@ -57,7 +58,7 @@ export default class extends Mixins(BaseVue) {
</script>
<style lang="scss" scoped>
.form-page {
height: calc(100vh - 84px);
height: auto;
.el-card {
height: 100% !important;
}
Expand Down
5 changes: 0 additions & 5 deletions src/admin/TablePage/TablePageState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,4 @@ export interface TablePage extends BaseState {
data?: Array<ListItemState>
}
actions?: { [name: string]: (IFlow | string)[] }
}

export default interface TablePageState {
type?: string // TablePage
state?: TablePage
}
7 changes: 1 addition & 6 deletions src/admin/TreePage/TreePageState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ export interface TreePage extends BaseState {
data?: Array<ListItemState>
}
actions?: { [name: string]: Array<IFlow | string> }
}

export default interface TreePageState {
type?: string // TreePage
state?: TreePage
}
}
1 change: 1 addition & 0 deletions src/admin/common/Form/Input/InputState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ export default interface InputState extends BaseState {
format?: string // 输入的内容所需要遵循的格式,可以在 utils/rules中进行查找
hint?: string // 输入后如果不符合格式要求则显示提示信息
required?: boolean // 是否为必填项
file?: File // 当input输入框为link时,可以上传图片文件
}
35 changes: 34 additions & 1 deletion src/admin/common/Form/Input/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,22 @@
:autocomplete="state.autocomplete"
@blur="onBlur"
@paste.native.capture="onPaste"
/>
>
<template
v-if="state.type === 'link'"
slot="append"
>
<el-upload
action=""
:http-request="upload"
:show-file-list="false"
>
<el-button size="small">
点击上传
</el-button>
</el-upload>
</template>
</el-input>
<svg-icon
v-if="state.required"
class="required"
Expand All @@ -40,6 +55,7 @@ import InputState from './InputState'
import BaseVue from '@/admin/base/BaseVue'
import { validate } from '@/utils/rules'
import { preventPaste } from '@/utils/event'
import { runFlowByFile } from '@/arkfbp/index'
@Component({
name: 'Input',
Expand All @@ -60,6 +76,23 @@ export default class extends Mixins(BaseVue) {
onPaste(event: Event) {
preventPaste(event, this.state.name)
}
async upload(data: any) {
this.state.file = data.file
const type = data.file.type
if (type) {
const t = type.split('/')[0]
if (t === 'image') {
await runFlowByFile('arkfbp/flows/upload', { com: this })
} else {
this.$message({
message: '文件类型不符合',
type: 'error',
showClose: true
})
}
}
}
}
</script>

Expand Down
6 changes: 0 additions & 6 deletions src/admin/common/Form/InputLink/InputLinkState.ts

This file was deleted.

82 changes: 0 additions & 82 deletions src/admin/common/Form/InputLink/index.vue

This file was deleted.

2 changes: 1 addition & 1 deletion src/admin/common/Others/Dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:append-to-body="state.appendToBody || true"
:lock-scroll="state.lockScroll"
:custom-class="state.customClass"
:close-on-click-modal="state.closeOnClickModal || true"
:close-on-click-modal="state.closeOnClickModal || false"
:close-on-press-escape="state.closeOnPressEscape"
:show-close="state.showClose"
:center="state.center"
Expand Down
7 changes: 4 additions & 3 deletions src/admin/common/Password/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
import { Component, Mixins } from 'vue-property-decorator'
import PasswordState from './PasswordState'
import BaseVue from '@/admin/base/BaseVue'
import { RULES } from '@/utils/rules'
import { getPasswordRule } from '@/utils/rules'
import { RULES } from '@/login/util/rules'
@Component({
name: 'Password',
Expand All @@ -84,12 +85,12 @@ export default class extends Mixins(BaseVue) {
],
password: [
RULES.required,
RULES.password,
getPasswordRule(),
{ validator: this.validateCheckPassword, trigger: 'blur' }
],
checkPassword: [
RULES.required,
RULES.password,
getPasswordRule(),
{ validator: this.checkSecondPassword, trigger: 'blur' }
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
:on-success="handleSuccess"
:before-upload="beforeUpload"
class="editor-slide-upload"
action="https://httpbin.org/post"
action="/api/v1/upload/"
list-type="picture-card"
>
<el-button
Expand All @@ -47,6 +47,7 @@
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import { ElUploadInternalRawFile } from 'element-ui/types/upload'
import { SettingsModule } from '@/store/modules/settings'
export interface IUploadObject {
hasSuccess: boolean
Expand All @@ -57,11 +58,9 @@ export interface IUploadObject {
}
@Component({
name: 'EditorImageUpload'
name: 'EditorImage'
})
export default class extends Vue {
@Prop({ required: true }) private color!: string
private dialogVisible = false
private listObj: { [key: string]: IUploadObject } = {}
private defaultFileList = []
Expand All @@ -70,6 +69,10 @@ export default class extends Vue {
return Object.keys(this.listObj).every(item => this.listObj[item].hasSuccess)
}
get color() {
return SettingsModule.theme
}
private handleSubmit() {
const arr = Object.keys(this.listObj).map(v => this.listObj[v])
if (!this.checkAllSuccess()) {
Expand Down
8 changes: 7 additions & 1 deletion src/admin/common/Rich/RichState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { BaseState } from '@/admin/base/BaseVue'

export default interface RichState extends BaseState {
value: string; //内容
value: string
id?: string
height?: string
width?: string
toolbar?: string[]
menubar?: string
isDisabledUploadImage?: boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export const plugins = ['advlist anchor autolink autosave code codesample direct

// Here is the list of toolbar control components
// Details see: https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols
export const toolbar = ['searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen']
export const toolbar = ['searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table forecolor backcolor fullscreen']
Loading

0 comments on commit 69e246d

Please sign in to comment.