Commit e55c563d authored by rockyl's avatar rockyl

打开项目直接使用本地

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