|
@@ -11,19 +11,20 @@
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="image-view-actions" v-if="actions.length">
|
|
|
- <Button
|
|
|
- size="small"
|
|
|
- icon="md-refresh"
|
|
|
- @click="toRotate(image)"
|
|
|
- v-if="canRotate"
|
|
|
- ></Button>
|
|
|
<Button
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
@click="toSaveRotate(image)"
|
|
|
- v-if="canRotate && image['deg']"
|
|
|
+ :disabled="saving"
|
|
|
+ v-if="canRotate && image['stepDeg']"
|
|
|
>保存</Button
|
|
|
>
|
|
|
+ <Button
|
|
|
+ size="small"
|
|
|
+ icon="md-refresh"
|
|
|
+ @click="toRotate(image)"
|
|
|
+ v-if="canRotate"
|
|
|
+ ></Button>
|
|
|
<Button
|
|
|
:type="image.missing ? 'error' : 'default'"
|
|
|
size="small"
|
|
@@ -63,7 +64,8 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
curImageIndex: 0,
|
|
|
- stepDeg: 0
|
|
|
+ stepDeg: 0,
|
|
|
+ saving: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -83,7 +85,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
toRotate(image) {
|
|
|
- if (!image["stepDeg"]) image.stepDeg = 0;
|
|
|
+ if (!image["stepDeg"]) this.$set(image, "stepDeg", 0);
|
|
|
image.deg += 90;
|
|
|
if (image.deg === 360) image.deg = 0;
|
|
|
image.stepDeg += 90;
|
|
@@ -93,9 +95,16 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
async toSaveRotate(image) {
|
|
|
+ if (this.saving) return;
|
|
|
if (!image.stepDeg) return;
|
|
|
+ this.saving = true;
|
|
|
|
|
|
- await rotatePaper(image.id, image.stepDeg);
|
|
|
+ let result = true;
|
|
|
+ await rotatePaper(image.id, image.stepDeg).catch(() => {
|
|
|
+ result = false;
|
|
|
+ });
|
|
|
+ this.saving = false;
|
|
|
+ if (!result) return;
|
|
|
image.stepDeg = 0;
|
|
|
this.$Message.success("保存成功!");
|
|
|
},
|