1313 <q-tree v-if =" final" ref =" treeObj" :nodes =" final" node-key =" key"
1414 selected-color =" primary" v-model:selected =" key" @update:selected =" select(key)" default-expand-all />
1515 </div >
16- <div class =" container" >
17- <div class =" content" >
18- <div class =" box" >
19- <span >file name</span >
20- <input type =" text" class =" input" v-model =" selectFile" >
21- </div >
22- <div class =" box" >
23- <Editor style =" z-index : 50 " v-model =" content" @imgAdd =" imgAdd" />
24- <div class =" q-mt-md row justify-end" >
25- <q-btn class =" bg-primary text-white" style =" width : 5rem ;" @click =" save()" >Save</q-btn >
26- </div >
27- </div >
16+ <div style =" width : 100vw ;display : flex " >
17+ <div class =" q-ma-sm" >file name</div >
18+ <input type =" text" class =" input" v-model =" selectFile" >
19+ </div >
20+ <div style =" width : 100vw " >
21+ <Editor style =" z-index : 50 " v-model =" content" @imgAdd =" imgAdd" />
22+ <div class =" q-mt-md row justify-end" >
23+ <q-btn class =" bg-primary text-white" style =" width : 5rem ;" @click =" save()" >Save</q-btn >
2824 </div >
2925 </div >
3026 </div >
@@ -37,6 +33,7 @@ import {ref, onMounted} from 'vue';
3733import axios from ' axios' ;
3834import Swal from ' sweetalert2'
3935import {useQuasar } from ' quasar' ;
36+
4037const $q = useQuasar ();
4138const copyed = ref (false );
4239const moved = ref (false );
@@ -49,7 +46,7 @@ const key = ref('');
4946const treeObj = ref (null );
5047const selectNode = ref (null );
5148const selectFolder = ref (' ' );
52- const touch = () => {
49+ const touch = () => {
5350 if (selectFolder .value === null ) Swal .fire (' Please select folder' , ' ' , ' warning' )
5451 else {
5552 Swal .fire ({
@@ -62,7 +59,7 @@ const touch=()=>{
6259 confirmButtonText: ' Create' ,
6360 showLoaderOnConfirm: true ,
6461 preConfirm : (login ) => {
65- commandReq (5 , selectFolder .value + login,' ' ).then (res => {
62+ commandReq (5 , selectFolder .value + login, ' ' ).then (res => {
6663 if (res .data .code === 200 ) Swal .fire (' Success' , ' ' , ' success' ).then (() => {
6764 commandReq (0 , ' ' , ' ' ).then (res => {
6865 tree (JSON .parse (res .data .message ));
@@ -72,7 +69,7 @@ const touch=()=>{
7269 })
7370 }
7471 })
75- }
72+ }
7673
7774}
7875const addFolder = () => {
@@ -88,7 +85,7 @@ const addFolder = () => {
8885 confirmButtonText: ' Create' ,
8986 showLoaderOnConfirm: true ,
9087 preConfirm : (login ) => {
91- commandReq (4 , selectFolder .value + login,' ' ).then (res => {
88+ commandReq (4 , selectFolder .value + login, ' ' ).then (res => {
9289 if (res .data .code === 200 ) Swal .fire (' Success' , ' ' , ' success' ).then (() => {
9390
9491 commandReq (0 , ' ' , ' ' ).then (res => {
@@ -103,7 +100,7 @@ const addFolder = () => {
103100}
104101
105102const deleteFile = () => {
106- if (selectFile .value === ' ' && selectFolder .value === ' ' ) Swal .fire (' Please select file or folder' , ' ' , ' warning' )
103+ if (selectFile .value === ' ' && selectFolder .value === ' ' ) Swal .fire (' Please select file or folder' , ' ' , ' warning' )
107104 else {
108105 Swal .fire ({
109106 title: ' Confirm delete?' ,
@@ -116,7 +113,7 @@ const deleteFile = () => {
116113 }).then ((result ) => {
117114 if (result .isDismissed ) return ;
118115 commandReq (3 , selectNode .value .path , ' ' )
119- Swal .fire (' Success' , ' ' , ' success' ).then (()=> {
116+ Swal .fire (' Success' , ' ' , ' success' ).then (() => {
120117
121118 commandReq (0 , ' ' , ' ' ).then (res => {
122119 tree (JSON .parse (res .data .message ));
@@ -142,7 +139,7 @@ const save = () => {
142139 if (result .isDismissed ) return ;
143140 const json = JSON .stringify ({
144141 content: content .value ,
145- filename: selectFolder .value + ' /' + selectFile .value ,
142+ filename: selectFolder .value + ' /' + selectFile .value ,
146143 // time: new Date().getTime()
147144 });
148145 axios .post (' http://8.130.48.157:8081/api/file/save' , json, {
@@ -159,11 +156,11 @@ const save = () => {
159156const select = (key ) => {
160157 selectNode .value = treeObj .value .getNodeByKey (key);
161158 if (selectNode .value .icon === ' folder' ) {
162- selectFolder .value = selectNode .value .path + ' /' ;
159+ selectFolder .value = selectNode .value .path + ' /' ;
163160 content .value = ' ' ;
164161 } else {
165162 selectFile .value = selectNode .value .label ;
166- selectFolder .value = selectFolder .value === selectFile .value ? selectNode .value .path + ' /' : selectNode .value .path .slice (0 , selectNode .value .path .length - selectFile .value .length - 1 ) ;
163+ selectFolder .value = selectFolder .value === selectFile .value ? selectNode .value .path + ' /' : selectNode .value .path .slice (0 , selectNode .value .path .length - selectFile .value .length - 1 );
167164 commandReq (6 , selectNode .value .path , ' ' ).then (res => {
168165 content .value = res .data .message .toString ();
169166 })
@@ -176,7 +173,7 @@ onMounted(() => {
176173})
177174const tree = (res ) => {
178175 raw .value = res;
179- transform (raw .value [0 ], ' 0' ,' .' );
176+ transform (raw .value [0 ], ' 0' , ' .' );
180177 raw .value .pop ();
181178 final .value = raw .value ;
182179}
@@ -189,10 +186,11 @@ const transform = (item, key, path) => {
189186 item .key = key;
190187 item .children = item .contents ;
191188 delete item .contents ;
192- if (item .children ){
193- item .children .forEach ((child , index ) => {
194- transform (child, key + ' -' + index, path + ' /' + child .name );
195- })}
189+ if (item .children ) {
190+ item .children .forEach ((child , index ) => {
191+ transform (child, key + ' -' + index, path + ' /' + child .name );
192+ })
193+ }
196194 } else {
197195 item .icon = ' insert_drive_file'
198196 item .key = key
@@ -247,10 +245,10 @@ const transform = (item, key, path) => {
247245const cpmv = (n ) => {
248246 if (n === 1 ) {
249247 copyed .value = true ;
250- copyfile .value = selectFolder .value + ' /' + selectFile .value ;
248+ copyfile .value = selectFolder .value + ' /' + selectFile .value ;
251249 } else {
252250 moved .value = true ;
253- movefile .value = selectFolder .value + ' /' + selectFile .value ;
251+ movefile .value = selectFolder .value + ' /' + selectFile .value ;
254252 }
255253}
256254const paste = (n ) => {
@@ -287,7 +285,6 @@ const paste = (n) => {
287285// }
288286
289287
290-
291288let content = ref (' ' );
292289const imgAdd = (pos , file ) => {
293290 console .log (file);
@@ -307,57 +304,4 @@ const imgAdd = (pos, file) => {
307304 </script >
308305
309306<style lang="scss" scoped>
310- .container {
311- flex :1 ;
312- }
313- .content {
314- padding : 24px ;
315- .box {
316- padding : 24px ;
317- border : 1px solid #e3e6e8 ;
318- border-radius : 3px ;
319- display : flex ;
320- flex-direction : column ;
321- margin-top : 12px ;
322-
323- span {
324- padding-bottom : 1em ;
325- }
326-
327- .input {
328- flex : 1 ;
329- outline : rgb (107 , 137 , 147 );
330- border : 1px solid #babfc4 ;
331- border-radius : 3px ;
332- display : flex ;
333-
334- & :focus {
335- border : 1px solid #6bbbf7 ;
336- box-shadow : 0 0 0 4px hsla (206 , 100% , 40% , .15 );
337- }
338-
339- input {
340- border : none ;
341- outline : none ;
342- flex : 1 ;
343- padding : .6em .7em ;
344- }
345- }
346-
347- input {
348- padding : .6em .7em ;
349- }
350- }
351-
352- }
353-
354- .pill {
355- display : inline-block ;
356- margin : 2px ;
357- background : #e1ecf4 ;
358- padding : 8px ;
359- color : #39739d ;
360- border-radius : 3px ;
361- font-size : 12px ;
362- }
363307 </style >
0 commit comments