Commit 8afe3245 authored by rockyl's avatar rockyl

修改过程属性链接方式

parent e1713b17
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
function verification(callback) {
var container = document.createElement('div');
container.style.position = 'fixed';
container.style.zIndex = '99999';
document.body.append(container);
var input = document.createElement('input');
input.placeholder = 'password';
container.append(input);
var button = document.createElement('button');
button.innerText = 'OK';
container.append(button);
button.onclick = function () {
callback(input.value === 'password');
}
var aaa = document.createElement('div');
document.body.append(aaa);
}
verification(function(result){
console.log(result);
})
</script>
</body>
</html>
\ No newline at end of file
module.exports = {
region: 'oss-cn-hangzhou',
id: 'LTAIqO2wblIxQvwc',
secret: '4brsaSRbRpjxw3oDIxJi6bNMcndIR6',
bucket: 'duiba',
output: '/editor/zeroing/v1'
};
......@@ -4,6 +4,8 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"upload": "cp dist/index.html ../duiba-aurora-node/src/public/index.html&&ali-oss-publish -c oss.config.js -e dist",
"build:upload": "npm run build&&npm run upload",
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
},
"dependencies": {
......@@ -27,6 +29,7 @@
"@kazupon/vue-i18n-loader": "^0.3.0",
"@vue/cli-plugin-babel": "^3.11.0",
"@vue/cli-service": "^3.11.0",
"ali-oss-publish": "^0.3.0",
"lodash": "^4.17.15",
"node-sass": "^4.9.2",
"sass": "^1.22.9",
......
public/favicon.ico

4.19 KB | W: | H:

public/favicon.ico

4.19 KB | W: | H:

public/favicon.ico
public/favicon.ico
public/favicon.ico
public/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
......@@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>zeroing-editor</title>
<title>烽火台</title>
</head>
<body>
<noscript>
......@@ -14,8 +14,8 @@
</noscript>
<script>
window.__data = {
token: 'eyJhbGciOiJIUzI1NiJ9.5Y2e6b6Z5Lqt.2fNMm0oJt0l0ZzsSYwo4ie8Bs7yLU9EmS2mtrmLPktY',
};
token : 'eyJhbGciOiJIUzI1NiJ9.5Yqz55Cq5bOw.wixVqBeqGS2FBY_VWF1cC_Vg5Zr0vYgRTfuncjGthYY'//'$TOKEN$'
}
</script>
<div id="app"></div>
<!-- built files will be auto injected -->
......
<template>
<div id="app" class="theme-light">
<router-view/>
<div class="invalid-route" v-if="ready && invalidRoute">
<p>无效的页面 {{cd}}秒后跳转</p>
<div class="error-tips" v-if="ready && showErrorTips">
<p>{{errorTipsStr}}</p>
<el-button @click="jump">direct link</el-button>
</div>
<router-view v-else/>
</div>
</template>
<script>
import i18n from "./i18n";
import {SSO_VERIFY_PAGE_URL} from "./config";
const errorTipsArr = [
'',
i18n.t('Access denied'),
i18n.t('Invalid router'),
];
export default {
name: "App",
......@@ -15,25 +24,38 @@
return {
cd: 5,
ready: false,
errorType: 0,
errorTips: '',
}
},
computed: {
invalidRoute() {
return !this.$route.matched || this.$route.matched.length === 0;
mounted() {
if (!window['zeroing_token']) {
this.dealError(1);
}
},
computed: {
showErrorTips() {
return !window['zeroing_token'] || !this.$route.matched || this.$route.matched.length === 0;
},
errorTipsStr() {
return this.errorTips + ' ' + this.$t('Jump after', {cd: this.cd});
},
},
watch: {
$route: {
handler: function(val, oldVal){
this.dealInvalidRoute();
this.ready = true;
handler: function (val, oldVal) {
this.dealError(2);
},
deep: true
}
},
methods: {
dealInvalidRoute(){
if (this.invalidRoute) {
dealError(type) {
this.errorType = type;
this.errorTips = errorTipsArr[type];
this.ready = true;
if (this.showErrorTips) {
this.cd = 5;
this.startCD();
}
......@@ -42,18 +64,28 @@
this.timer = setInterval(() => {
if (this.cd <= 0) {
clearInterval(this.timer);
this.$router.replace({name: 'home'});
this.jump();
return;
}
this.cd--;
}, 1000)
}
},
jump() {
switch (this.errorType) {
case 1:
location.href = SSO_VERIFY_PAGE_URL;
break;
case 2:
this.$router.replace({name: 'home'});
break;
}
},
},
}
</script>
<style>
.invalid-route {
.error-tips {
width: 100%;
height: 100%;
display: flex;
......
......@@ -3,11 +3,8 @@
*/
import {API_HOST} from "../config";
import cookie from "cookie";
import {stringify} from "querystringify";
const user_cookie = window.__data.token || cookie.parse(document.cookie).user_cookie;
class ApiError extends Error {
constructor(name, code, message) {
super();
......@@ -33,8 +30,9 @@ export async function fetchApi(uri, {params, method = 'get', contentType = 'json
const options = {
method,
headers: {
authorization: 'Bearer ' + user_cookie,
authorization: 'Bearer ' + window['zeroing_token'],
},
//credentials: 'include',
};
if (params) {
if (method.toLowerCase() === 'post') {
......
......@@ -9,6 +9,8 @@ export const API_HOST = 'http://10.10.95.74:7777';
export const UPLOAD_FILE_URL = API_HOST + '/api/uploadFile';
export const PARSE_BUNDLE_URL = API_HOST + '/api/parsePSD';
export const SSO_VERIFY_PAGE_URL = '/sso/logout';
export const DOCK_POINT_OFFSET = 4;
//文件类型图标 t表示展示缩略图
......
......@@ -43,6 +43,9 @@
"Packing": "Packing",
"Type": "Type",
"Group": "Group",
"Access denied": "Access denied",
"Invalid router": "Invalid router",
"Jump after": "Jump after {cd}s",
"Open in new tab": "Open in new tab",
"Pack project successfully": "Pack project successfully",
"Pack project failed": "Pack project failed",
......
......@@ -11,6 +11,8 @@ import './assets/style.css'
import './plugins/element.js'
import './themes/light/index.scss'
import './token'
new Vue({
router,
store,
......
......@@ -153,6 +153,12 @@ $dock-pin-width: 9px;
}
.linked-value {
display: flex;
align-items: center;
justify-content: flex-end;
}
.string-value {
text-align: right;
}
......@@ -232,7 +238,7 @@ $dock-pin-width: 9px;
display: flex;
flex-direction: column;
.linked{
.linked {
display: block;
height: 26px;
overflow: hidden;
......@@ -263,7 +269,7 @@ $dock-pin-width: 9px;
display: flex;
flex-direction: column;
.name-input{
.name-input {
}
......@@ -272,7 +278,7 @@ $dock-pin-width: 9px;
padding-top: 5px;
flex: 1;
.scrollbar-view{
.scrollbar-view {
padding-right: 10px;
}
......@@ -285,11 +291,11 @@ $dock-pin-width: 9px;
}
}
.node-select-container{
.node-select-container {
flex: 1;
}
.string-editor-container{
.string-editor-container {
flex: 1;
height: 28px;
}
......@@ -349,13 +355,13 @@ $dock-pin-width: 9px;
}
}
.node-select-popover{
.node-select-popover {
.tree-scrollbar {
width: 100%;
height: 200px;
}
.bottom-bar{
.bottom-bar {
margin-top: 5px;
display: flex;
align-items: center;
......@@ -363,3 +369,9 @@ $dock-pin-width: 9px;
}
}
.linked-prop-popover {
div + div {
margin-top: 5px;
}
}
/**
* Created by rockyl on 2019-11-16.
*/
import cookie from "cookie";
let user_cookie;
user_cookie = cookie.parse(document.cookie).user_cookie;
if (!user_cookie) {
try {
user_cookie = window.__data.token;
} catch (e) {
}
}
if (!user_cookie) {
console.log('Access denied');
}
window['zeroing_token'] = user_cookie;
......@@ -20,8 +20,6 @@ export const RENDERER_TYPES= {
CANVAS: 'canvas',
};
export const linkedFlag = '$_linked_$';
export function messageError(e) {
Message({
dangerouslyUseHTMLString: true,
......
......@@ -7,6 +7,7 @@
class="menu-item import-file"
:action="importFileUrl"
name="file"
:headers="uploadHeaders"
:show-file-list="false"
:on-success="uploadFileSuccess"
:on-error="uploadFileError"
......@@ -66,7 +67,10 @@ export default {
defaultProps: {
children: 'children',
label: 'name'
}
},
uploadHeaders: {
authorization: 'Bearer ' + window['zeroing_token'],
},
};
},
computed: {
......
......@@ -14,8 +14,9 @@
</div>
<div v-else class="field-item" v-for="(param, key, index) in meta.props" :key="index">
<span class="key">{{param.alias || key}}</span>:
<span class="" v-if="data.props[key] === linkedFlag">
<i class="el-icon-link linked-icon"></i>
<span class="linked-value" v-if="typeof data.props[key] === 'object'">
<span>{{data.props[key].alias || ''}}</span>
<i class="el-icon-link linked-icon"></i>
</span>
<template v-else>
<div v-if="param.type === 'color'">
......@@ -43,7 +44,6 @@
import {mapState} from "vuex";
import DockPin from "./DockPin";
import events from "../../../../global-events";
import {linkedFlag} from "../../../../utils";
export default {
name: "ProcessNode",
......@@ -57,7 +57,6 @@
height: 100,
inputMeta,
active: false,
linkedFlag,
}
},
mounted() {
......
......@@ -11,9 +11,14 @@
trigger="click"
:disabled="!editable"
>
<div>
<span>{{$t('Link to parent')}}: </span>
<el-switch :value="linked" @input="onChange"/>
<div class="linked-prop-popover">
<div>
<span>{{$t('Link to parent')}}: </span>
<el-switch :value="linked" @input="onChange"/>
</div>
<div v-if="linked">
<el-input size="mini" v-model="value.alias"/>
</div>
</div>
<el-link style="padding: 3px;" slot="reference" icon="el-icon-link" :underline="false"
:type="linked ? 'success' : 'default'" :disabled="!editable"/>
......@@ -24,7 +29,6 @@
<script>
import camelcase from 'camelcase'
import ElFormItem from "./form-item";
import {linkedFlag} from "../../../../utils";
export default {
name: "EditorWrapper",
......@@ -44,15 +48,27 @@
default: 0,
},
},
data(){
return {
}
},
watch: {
value(v){
}
},
computed: {
linked() {
return this.value === linkedFlag
return typeof this.value === 'object'
}
},
methods: {
onChange(v) {
if (v) {
this.$set(this.container.data.props, this.propertyName, linkedFlag);
this.$set(this.container.data.props, this.propertyName, {
alias: undefined,
});
} else {
this.$delete(this.container.data.props, this.propertyName);
}
......
<template>
<editor-wrapper :editable="editable" :value="value" :container="container" :property="property" :propertyName="propertyName">
<editor-wrapper :editable="editable" :value="value" :container="container" :property="property"
:propertyName="propertyName">
<div style="display: flex;flex: 1;">
<el-popover
placement="top"
......@@ -34,7 +35,8 @@
</el-button-group>
</div>
</div>
<el-input clearable slot="reference" v-model="editValue" @change="onInput" placeholder="unset" :readonly="!editable">
<el-input clearable slot="reference" v-model="editValue" @change="onInput" placeholder="unset"
:readonly="!editable">
<template slot="prepend">node://</template>
</el-input>
</el-popover>
......@@ -66,15 +68,20 @@
},
}
},
watch: {
value(v) {
this.editValueOrigin = v;
}
},
computed: {
...mapGetters([
'behavior_views'
]),
editValue: {
get(){
return this.editValueOrigin ? this.editValueOrigin.replace(nodeScheme) : '';
get() {
return this.editValueOrigin && typeof this.editValueOrigin !== 'object'? this.editValueOrigin.replace(nodeScheme, '') : '';
},
set(v){
set(v) {
this.editValueOrigin = v;
},
},
......
......@@ -39,7 +39,7 @@
<script>
import EditorWrapper from "./EditorWrapper";
import {getEditorDefaultValue, linkedFlag} from "../../../../utils";
import {getEditorDefaultValue} from "../../../../utils";
export default {
name: "StringEditor",
......
......@@ -14,7 +14,7 @@
<template slot-scope="scope">
<div class="project-info">
<span class="project-name">{{scope.row.name}}</span>
<el-tag size="mini" type="success">{{scope.row.creator}}</el-tag>
<el-tag size="mini" type="success">{{scope.row.operator}}</el-tag>
<el-tag size="mini" type="warning">{{moment(scope.row.update_time)}}</el-tag>
</div>
</template>
......
const serverHost = 'http://10.10.95.74:7777';
module.exports = {
publicPath: '',
publicPath: process.env.NODE_ENV === 'production' ? '//yun.duiba.com.cn/editor/zeroing/v1/' : '',
pluginOptions: {
i18n: {
locale: 'en',
......@@ -7,5 +9,20 @@ module.exports = {
localeDir: 'locales',
enableInSFC: true
}
},
devServer: {
host: '0.0.0.0',
port: '8080',
proxy: {
'/sso': {
target: serverHost,
},
'/api': {
target: serverHost,
},
}
},
configureWebpack: {
}
};
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment