|
@@ -67,7 +67,7 @@
|
|
|
<div class="header_right el_button">
|
|
<div class="header_right el_button">
|
|
|
<i class="iconfont icon_nishizhen" @click="AnticlockwiseImage()"></i>
|
|
<i class="iconfont icon_nishizhen" @click="AnticlockwiseImage()"></i>
|
|
|
<i class="iconfont icon_shunshizhen" @click="ClockwiseImage()"></i>
|
|
<i class="iconfont icon_shunshizhen" @click="ClockwiseImage()"></i>
|
|
|
- <el-button type="primary" class="right_button_editor" @click="MarkBlankPage()">标记为空白页</el-button>
|
|
|
|
|
|
|
+ <!-- <el-button type="primary" class="right_button_editor" @click="MarkBlankPage()">标记为空白页</el-button> -->
|
|
|
<el-button type="primary" class="right_button_editor" style="margin-left: 0px;" @click="SavePositionImage()">保存</el-button>
|
|
<el-button type="primary" class="right_button_editor" style="margin-left: 0px;" @click="SavePositionImage()">保存</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -714,10 +714,112 @@ const GetCutStudentPosition = (points: any[]) => {
|
|
|
const AnticlockwiseImage = () => {
|
|
const AnticlockwiseImage = () => {
|
|
|
// TODO: 逆时针旋转
|
|
// TODO: 逆时针旋转
|
|
|
console.log('逆时针旋转')
|
|
console.log('逆时针旋转')
|
|
|
|
|
+ rotationAngle.value -= 90; // 减少90度(逆时针旋转)
|
|
|
|
|
+ let rotateValue = rotationAngle.value % 360;
|
|
|
|
|
+ // 如果角度为负数,转换为0-360度之间的正值
|
|
|
|
|
+ if (rotateValue < 0) {
|
|
|
|
|
+ rotateValue += 360;
|
|
|
|
|
+ }
|
|
|
|
|
+ rotationAngle.value = rotateValue;
|
|
|
|
|
+ console.log("打印旋转角度", rotationAngle.value);
|
|
|
|
|
+ console.log("打印当前试卷地址", currentPaperUrl.value);
|
|
|
|
|
+ SetPaperUrl(rotateValue);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 设置试卷地址(处理OSS图片旋转参数)
|
|
|
|
|
+const SetPaperUrl = (rotateValue: number) => {
|
|
|
|
|
+ let newUrl = '';
|
|
|
|
|
+
|
|
|
|
|
+ if(rotateValue === 0) {
|
|
|
|
|
+ // 如果旋转角度为0,移除所有旋转参数
|
|
|
|
|
+ if(currentPaperUrl.value.includes('x-oss-process=image')) {
|
|
|
|
|
+ if(currentPaperUrl.value.includes('rotate')) {
|
|
|
|
|
+ // 存在旋转参数,移除旋转参数
|
|
|
|
|
+ if (currentPaperUrl.value.includes('?')) {
|
|
|
|
|
+ // 如果有多个参数,只移除rotate部分
|
|
|
|
|
+ newUrl = currentPaperUrl.value.replace(/([&?])x-oss-process=image\/rotate,\d+&?/, '$1');
|
|
|
|
|
+ // 清理多余的&符号
|
|
|
|
|
+ newUrl = newUrl.replace(/\?&/, '?').replace(/&&/, '&');
|
|
|
|
|
+ // 如果最后是?或&,则移除
|
|
|
|
|
+ newUrl = newUrl.replace(/[?&]$/, '');
|
|
|
|
|
+
|
|
|
|
|
+ // 如果移除rotate后只剩下x-oss-process=image,则完全移除整个参数
|
|
|
|
|
+ if(newUrl.includes('x-oss-process=image') && newUrl.split('?')[1] === '') {
|
|
|
|
|
+ newUrl = newUrl.split('?')[0];
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果只有x-oss-process参数,则完全移除
|
|
|
|
|
+ newUrl = currentPaperUrl.value.split('?')[0];
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 存在x-oss-process=image但不存在旋转参数,直接使用原URL
|
|
|
|
|
+ newUrl = currentPaperUrl.value;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 不存在图片处理参数,直接使用原URL
|
|
|
|
|
+ newUrl = currentPaperUrl.value;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 旋转角度不为0的情况
|
|
|
|
|
+ if(currentPaperUrl.value.includes('x-oss-process=image')) {
|
|
|
|
|
+ // 存在图片处理参数
|
|
|
|
|
+ if(currentPaperUrl.value.includes('rotate')) {
|
|
|
|
|
+ // 存在旋转参数,替换旋转参数
|
|
|
|
|
+ if (currentPaperUrl.value.includes('?')) {
|
|
|
|
|
+ // 如果有多个参数,只替换rotate部分
|
|
|
|
|
+ newUrl = currentPaperUrl.value.replace(/([&?])x-oss-process=image\/rotate,\d+&?/, '$1');
|
|
|
|
|
+ // 清理多余的&符号
|
|
|
|
|
+ newUrl = newUrl.replace(/\?&/, '?').replace(/&&/, '&');
|
|
|
|
|
+ // 如果最后是?或&,则移除
|
|
|
|
|
+ newUrl = newUrl.replace(/[?&]$/, '');
|
|
|
|
|
+ // 重新添加旋转参数
|
|
|
|
|
+ newUrl = newUrl + '?x-oss-process=image/rotate,' + rotateValue;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果只有x-oss-process参数,则完全移除后重新添加
|
|
|
|
|
+ newUrl = currentPaperUrl.value.split('?')[0];
|
|
|
|
|
+ newUrl = newUrl + '?x-oss-process=image/rotate,' + rotateValue;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 存在x-oss-process=image但不存在旋转参数,在现有参数基础上追加旋转参数
|
|
|
|
|
+ if(currentPaperUrl.value.includes('?')) {
|
|
|
|
|
+ newUrl = currentPaperUrl.value + '&x-oss-process=image/rotate,' + rotateValue;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ newUrl = currentPaperUrl.value + '?x-oss-process=image/rotate,' + rotateValue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 不存在图片处理参数,追加参数
|
|
|
|
|
+ if(currentPaperUrl.value.includes('?')) {
|
|
|
|
|
+ // URL中已存在其他参数
|
|
|
|
|
+ newUrl = currentPaperUrl.value + '&x-oss-process=image/rotate,' + rotateValue;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // URL中没有参数
|
|
|
|
|
+ newUrl = currentPaperUrl.value + '?x-oss-process=image/rotate,' + rotateValue;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ currentPaperUrl.value = newUrl;
|
|
|
|
|
+ console.log("打印旋转后的地址", currentPaperUrl.value);
|
|
|
|
|
+
|
|
|
|
|
+ if(currentPaperList.value[currentPaperIndex.value]) {
|
|
|
|
|
+ currentPaperList.value[currentPaperIndex.value].recognizeUrl = newUrl;
|
|
|
|
|
+ currentPaperList.value[currentPaperIndex.value].rotate = rotateValue;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
const ClockwiseImage = () => {
|
|
const ClockwiseImage = () => {
|
|
|
// TODO: 顺时针旋转
|
|
// TODO: 顺时针旋转
|
|
|
console.log('顺时针旋转')
|
|
console.log('顺时针旋转')
|
|
|
|
|
+ rotationAngle.value += 90; // 增加90度(顺时针旋转)
|
|
|
|
|
+ let rotateValue = rotationAngle.value % 360;
|
|
|
|
|
+ // 如果角度超过360度,取模
|
|
|
|
|
+ if (rotateValue >= 360) {
|
|
|
|
|
+ rotateValue = rotateValue % 360;
|
|
|
|
|
+ }
|
|
|
|
|
+ rotationAngle.value = rotateValue;
|
|
|
|
|
+ console.log("打印旋转角度", rotationAngle.value);
|
|
|
|
|
+ console.log("打印当前试卷地址", currentPaperUrl.value);
|
|
|
|
|
+ SetPaperUrl(rotateValue);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 10. 标记为空白页
|
|
// 10. 标记为空白页
|