Selaa lähdekoodia

fix(controller): 直角弯垂直计算不正确

Zhou Jianjia 3 vuotta sitten
vanhempi
commit
1bd948d331
3 muutettua tiedostoa jossa 13 lisäystä ja 6 poistoa
  1. 1 1
      core/util.js
  2. 10 3
      pages/formula/anyangle.vue
  3. 2 2
      pages/formula/rightAngleVertical.vue

+ 1 - 1
core/util.js

xqd
@@ -79,7 +79,7 @@ const round = (number,percent) => {
     number = Math.floor(Math.abs(Number(number)) * i) / i
     if(arr.length > 1 ){
         let str = arr[1]
-        if(str.length > 2 && str[2] >= 5){
+        if((str.length > 2 && str[2] >= 5) || (str.length > 2 && str[3] > 8)){
             number = Math.ceil(number * i)
             number += 1;
             number = number / i;

+ 10 - 3
pages/formula/anyangle.vue

xqd
@@ -111,11 +111,18 @@
                     this.$u.toast('两边之后要大于第三边');
                     return;
                 }
-                left = (Math.pow(a,2) + Math.pow(c,2) - Math.pow(b,2)) / (2 * a * c)
-                right = (Math.pow(b,2) + Math.pow(c,2) - Math.pow(a,2)) / (2 * b * c)
+                left = (Math.pow(b,2) + Math.pow(c,2) - Math.pow(a,2)) / (2 * b * c)
+                right = (Math.pow(a,2) + Math.pow(c,2) - Math.pow(b,2)) / (2 * a * c)
+                top = (Math.pow(a,2) + Math.pow(b,2) - Math.pow(c,2)) / (2 * a * b)
+
                 this.rules.left.value = this.$util.acos(left)
                 this.rules.right.value = this.$util.acos(right)
-                this.rules.top.value = top = 180 - this.rules.left.value - this.rules.right.value
+                this.rules.top.value = this.$util.acos(top)
+
+
+                this.rules.left.value = this.rules.left.value > 90 ? Math.abs(180 - this.rules.left.value) : this.rules.left.value;
+                this.rules.left.value = this.rules.right.value > 90 ? Math.abs(180 - this.rules.right.value) : this.rules.left.value;
+                this.rules.left.value = this.rules.top.value > 90 ? Math.abs(180 - this.rules.top.value) : this.rules.left.value;
 
                 if(biangao){
                     if(this.formData.angle === '1'){ // 顶角

+ 2 - 2
pages/formula/rightAngleVertical.vue

xqd xqd
@@ -32,7 +32,7 @@
                 <u-image width="100%" height="300rpx" :src="mathImgs[name].calc" mode="aspectFit"></u-image>
             </view>
             <view class="title">切割图</view>
-            <u-image width="100%" height="300rpx" :src="mathImgs[name].slice" mode="aspectFit"></u-image>
+            <u-image width="100%" height="600rpx" :src="mathImgs[name].slice" mode="aspectFit"></u-image>
 
         </div>
     </view>
@@ -82,7 +82,7 @@
             },
             roundRules(){
                 for (const itemKey in this.rules) {
-                    this.rules[itemKey].value = this.$util.round(this.rules[itemKey].value,2);
+                    this.rules[itemKey].value = this.$util.round(this.$util.round(this.rules[itemKey].value,3),2);
                 }
             },
             initRules(){