Commit e55c563d authored by rockyl's avatar rockyl

打开项目直接使用本地

parent 2858b006
......@@ -160,6 +160,7 @@
"Save project successfully": "保存项目成功",
"There are conflicts in the project": "项目有冲突,请先解决冲突",
"Input version remark": "请务必认真输入版本备注",
"Are you sure to discard the local modification": "确定丢弃本地修改吗?",
"Input view name": "输入视图名",
"Invalid view name": "无效的视图名",
"Unsaved version found locally": "本地发现了未保存保本,请选择版本打开",
......@@ -252,7 +253,10 @@
},
"menu": {
"save": {
"label": "保存"
"label": "保存",
"sub": {
"drop-local-modification": "丢弃本地修改"
}
},
"details": {
"label": "详情"
......
......@@ -88,9 +88,9 @@
...mapState({
codeSyncServeConfig(state) {
return state.editor.codeSyncServeConfig;
},
operators: (state) => state.project.operators,
currentOperator: (state) => state.editor.operator,
},
operators: (state) => state.project.operators,
currentOperator: (state) => state.editor.operator,
}),
},
async mounted() {
......@@ -140,10 +140,10 @@
return false;
}
},
async loadProject() {
async loadProject(forceRemote) {
const {projectID, project, dataUrl} = this.$route.params;
if (await this.localVersionExist(projectID)) {
this.$confirm(this.$t('Unsaved version found locally'), this.$t('Alert'), {
if (!forceRemote && await this.localVersionExist(projectID)) {
/*this.$confirm(this.$t('Unsaved version found locally'), this.$t('Alert'), {
showClose: false,
closeOnClickModal: false,
closeOnPressEscape: false,
......@@ -158,7 +158,8 @@
} else {
console.log(e);
}
});
});*/
this.loadLocalVersion(projectID);
} else {
this.loadRemoteVersion(projectID, project, dataUrl);
}
......@@ -173,7 +174,10 @@
async loadRemoteVersion(projectID, project, dataUrl, projectData) {
if (projectID) {
this.ready = false;
let p = projectData ? (this.loadFromData({projectID, projectData})) : dataUrl ? this.loadFromDataUrl({projectID, dataUrl}) : this.loadFromRemote({projectID});
let p = projectData ? (this.loadFromData({
projectID,
projectData
})) : dataUrl ? this.loadFromDataUrl({projectID, dataUrl}) : this.loadFromRemote({projectID});
await playWaiting(p, this.$t('Preparing')).catch(e => {
this.$alert(this.$t('Project does not exist'), this.$t('Alert'), {
confirmButtonText: this.$t('Confirm'),
......@@ -236,7 +240,7 @@
},
checkAuth() {
let checkStatus = this.operators.includes(this.currentOperator);
if(!checkStatus) {
if (!checkStatus) {
this.$message({
message: this.$t('No permission'),
type: 'error',
......@@ -253,6 +257,16 @@
} catch (e) {
}
break;
case 'drop-local-modification':
await this.$confirm(i18n.t('Are you sure to discard the local modification'), i18n.t('Alert'), {
confirmButtonText: i18n.t('Confirm'),
cancelButtonText: i18n.t('Cancel'),
type: 'warning'
}).then(() => {
this.loadProject(true);
}).catch((e) => {
});
break;
case 'details':
this.$refs.dialogsDialog.show();
break;
......
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