瀏覽代碼

fix(controller): 任意角度弯计算不正确

Zhou Jianjia 3 年之前
父節點
當前提交
efc88a2f9b
共有 2 個文件被更改,包括 6 次插入6 次删除
  1. 5 5
      pages/formula/anyangle.vue
  2. 1 1
      static/css/math.scss

+ 5 - 5
pages/formula/anyangle.vue

xqd xqd xqd
@@ -30,7 +30,7 @@
         <div class="footer">
             <view class="result dir-top-wrap cross-center" v-if="showResult">
                 <view v-for="item in rules" v-if="item.value && item.show">
-                    <text>{{item.name}}=</text>{{item.value}}{{item.unit}}
+                    <text>{{item.name}}=</text>{{$util.round(item.value,2)}}{{item.unit}}
                     <text v-if="item.isHalf">{{$util.round(item.value/2,2)}}{{item.unit}}</text>
                 </view>
             </view>
@@ -119,11 +119,11 @@
 
                 if(biangao){
                     if(this.formData.angle === '1'){ // 顶角
-                        slice = biangao * this.$util.csc(this.rules.top.value)
+                        slice = biangao * this.$util.tan(this.rules.top.value/2)*2
                     }else if(this.formData.angle === '2'){ // 左底角
-                        slice = biangao * this.$util.csc(this.rules.left.value)
+                        slice = biangao * this.$util.tan(this.rules.left.value/2)*2
                     }else{
-                        slice = biangao * this.$util.csc(this.rules.right.value)
+                        slice = biangao * this.$util.tan(this.rules.right.value/2)*2
                     }
                 }
 
@@ -132,7 +132,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.rules[itemKey].value,2);
                 }
             },
             initRules(){

+ 1 - 1
static/css/math.scss

xqd
@@ -32,7 +32,7 @@
                 font-size: 24rpx;
                 font-weight: normal;
                 &:last-child{
-                    margin-left: 10rpx;
+                    margin-left: 20rpx;
                 }
             }
         }