| 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>
|
| xqd
@@ -111,19 +111,32 @@
|
|
|
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)
|
|
|
+
|
|
|
+ /* if(this.rules.left.value > 90){
|
|
|
+ this.rules.left.value = Math.abs(180 - this.rules.left.value)
|
|
|
+ }else if(this.rules.right.value > 90){
|
|
|
+ this.rules.left.value = Math.abs(180 - this.rules.right.value)
|
|
|
+ }else if(this.rules.top.value > 90){
|
|
|
+ this.rules.left.value = Math.abs(180 - this.rules.top.value)
|
|
|
+ }*/
|
|
|
+ this.rules.left.value = this.rules.left.value > 90 ? Math.abs(180 - this.rules.left.value) : this.rules.left.value;
|
|
|
+ this.rules.right.value = this.rules.right.value > 90 ? Math.abs(180 - this.rules.right.value) : this.rules.right.value;
|
|
|
+ this.rules.top.value = this.rules.top.value > 90 ? Math.abs(180 - this.rules.top.value) : this.rules.top.value;
|
|
|
|
|
|
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
|
|
|
}
|
|
|
}
|
|
|
|
| xqd
@@ -132,7 +145,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(){
|