Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-editor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-editor
Commits
b4cc384b
Commit
b4cc384b
authored
May 11, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善多人协作
parent
925e5d79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
project.js
src/store/modules/project.js
+14
-5
Editor.vue
src/views/Editor.vue
+6
-2
No files found.
src/store/modules/project.js
View file @
b4cc384b
...
@@ -93,8 +93,12 @@ export const projectStore = {
...
@@ -93,8 +93,12 @@ export const projectStore = {
makeProjectDirty
()
{
makeProjectDirty
()
{
},
},
updateProjectUpdateTime
(
state
,
updateTime
)
{
updateProjectUpdateTime
(
state
,
{
time
,
dirty
=
true
})
{
state
.
update_time
=
updateTime
;
state
.
update_time
=
time
;
if
(
dirty
){
this
.
commit
(
'makeProjectDirty'
);
}
},
},
updateProject
(
state
,
project
)
{
updateProject
(
state
,
project
)
{
const
{
id
,
name
,
creator
,
data
,
operators
,
operator
,
update_time
}
=
project
;
const
{
id
,
name
,
creator
,
data
,
operators
,
operator
,
update_time
}
=
project
;
...
@@ -730,17 +734,22 @@ export const projectStore = {
...
@@ -730,17 +734,22 @@ export const projectStore = {
commit
(
'updateProject'
,
project
);
commit
(
'updateProject'
,
project
);
},
},
async
saveToRemote
({
state
,
dispatch
,
getters
,
commit
},
{
remark
,
data
})
{
async
saveToRemote
({
state
,
dispatch
,
getters
,
commit
},
{
remark
,
data
})
{
if
(
data
)
{
//如果已经合并了冲突
commit
(
'updateProjectUpdateTime'
,
{
time
:
state
.
base_time
});
}
let
project
=
Object
.
assign
({},
getters
.
project
);
let
project
=
Object
.
assign
({},
getters
.
project
);
if
(
data
)
{
if
(
data
)
{
project
.
data
=
data
;
project
.
data
=
data
;
project
.
force
=
true
;
}
}
let
resp
=
await
projectApi
.
saveOne
(
project
,
remark
);
let
resp
=
await
projectApi
.
saveOne
(
project
,
remark
);
if
(
resp
.
result
)
{
if
(
resp
.
result
)
{
commit
(
'updateProjectUpdateTime'
,
resp
.
project
.
update_time
);
commit
(
'updateProjectUpdateTime'
,
{
time
:
resp
.
project
.
update_time
,
dirty
:
false
}
);
dispatch
(
'deleteLocalVersion'
,
state
.
id
);
dispatch
(
'deleteLocalVersion'
,
state
.
id
);
}
}
resp
.
localData
=
project
.
data
;
resp
.
localData
=
data
||
project
.
data
;
if
(
!
resp
.
result
)
{
state
.
base_time
=
resp
.
updateTime
;
}
return
resp
;
return
resp
;
},
},
async
updateProject
({
commit
},
projectID
)
{
async
updateProject
({
commit
},
projectID
)
{
...
...
src/views/Editor.vue
View file @
b4cc384b
...
@@ -220,6 +220,7 @@
...
@@ -220,6 +220,7 @@
type
:
'success'
type
:
'success'
});
});
}
else
{
}
else
{
cancel
=
true
;
await
this
.
$confirm
(
i18n
.
t
(
'There are conflicts in the project'
),
i18n
.
t
(
'Alert'
),
{
await
this
.
$confirm
(
i18n
.
t
(
'There are conflicts in the project'
),
i18n
.
t
(
'Alert'
),
{
confirmButtonText
:
i18n
.
t
(
'Confirm'
),
confirmButtonText
:
i18n
.
t
(
'Confirm'
),
cancelButtonText
:
i18n
.
t
(
'Cancel'
),
cancelButtonText
:
i18n
.
t
(
'Cancel'
),
...
@@ -227,6 +228,7 @@
...
@@ -227,6 +228,7 @@
}).
then
(()
=>
{
}).
then
(()
=>
{
this
.
$refs
.
projectConflictResolveDialog
.
show
(
resp
.
remoteData
,
resp
.
localData
);
this
.
$refs
.
projectConflictResolveDialog
.
show
(
resp
.
remoteData
,
resp
.
localData
);
}).
catch
((
e
)
=>
{
}).
catch
((
e
)
=>
{
this
.
$loading
({}).
close
();
});
});
}
}
}
}
...
@@ -235,8 +237,10 @@
...
@@ -235,8 +237,10 @@
},
},
async
onConflictResolved
(
data
)
{
async
onConflictResolved
(
data
)
{
const
{
projectID
,
project
}
=
this
.
$route
.
params
;
const
{
projectID
,
project
}
=
this
.
$route
.
params
;
await
this
.
saveProject
(
true
,
data
);
let
cancel
=
await
this
.
saveProject
(
true
,
data
);
this
.
loadRemoteVersion
(
projectID
,
project
,
undefined
,
data
);
if
(
!
cancel
){
this
.
loadRemoteVersion
(
projectID
,
project
,
undefined
,
data
);
}
},
},
checkAuth
()
{
checkAuth
()
{
let
checkStatus
=
this
.
operators
.
includes
(
this
.
currentOperator
);
let
checkStatus
=
this
.
operators
.
includes
(
this
.
currentOperator
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment