From 6741d563afe9a5b31a6b73653020091463eb5b33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=B9=81=E8=8A=B1=E4=BC=BC=E9=94=A6=E7=BE=8E=E5=80=BE?=
=?UTF-8?q?=E5=9F=8E?= <1506151208@qq.com>
Date: Mon, 29 Nov 2021 12:21:48 +0000
Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E8=92=8B=E5=AD=90?=
=?UTF-8?q?=E8=B1=AA-2020302778-=E7=AC=AC=E4=BA=8C=E6=AC=A1mini=20?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../.keep" | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 "\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/.keep"
diff --git "a/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/.keep" "b/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/.keep"
new file mode 100644
index 0000000..e69de29
--
Gitee
From 8cfdf3335769f47fac1d0c3de3f94e8aa920d47f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=B9=81=E8=8A=B1=E4=BC=BC=E9=94=A6=E7=BE=8E=E5=80=BE?=
=?UTF-8?q?=E5=9F=8E?= <1506151208@qq.com>
Date: Mon, 29 Nov 2021 12:24:01 +0000
Subject: [PATCH 2/2] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AC=A1=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=20js=E3=80=81wxml=E3=80=81wxss=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../index.js" | 278 ++++++++++++++++++
.../index.wxml" | 56 ++++
.../index.wxss" | 112 +++++++
3 files changed, 446 insertions(+)
create mode 100644 "\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.js"
create mode 100644 "\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.wxml"
create mode 100644 "\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.wxss"
diff --git "a/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.js" "b/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.js"
new file mode 100644
index 0000000..1c63524
--- /dev/null
+++ "b/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.js"
@@ -0,0 +1,278 @@
+var oprt = new Array();
+var rslt = ""
+
+Page({
+ data:{
+ result: "",
+ operotor: "",
+ },
+ butn(e){
+ var str = ""
+ str = e.target.dataset.val
+ if(str.length != 1){
+ oprt.push(str)
+ }
+ else{
+ if(oprt.length!=0){
+ var tem = oprt[oprt.length-1][oprt[oprt.length-1].length-1]
+ if(tem <= "9" && tem >= "0"){
+ if(str <= "9" && str >= "0" || str == "."){
+ oprt[oprt.length-1] += str
+ }
+ else{
+ oprt.push(str)
+ }
+ }
+ else if(tem == "."){
+ if(str <= "9" && str >= "0"){
+ oprt[oprt.length-1] += str
+ }
+ else{
+ oprt.push(str)
+ }
+ }
+ else if(tem == "-" && oprt.length == 1){
+ if(str <= "9" && str >= "0" || str == "." || str == "π" || str == "e"){
+ oprt[oprt.length-1] += str
+ }
+ else{
+ oprt.push(str)
+ }
+ }
+ else{
+ if(str == ".") str = "0" + str
+ oprt.push(str)
+ }
+ }
+ else{
+ if(str == ".") str = "0" + str
+ oprt.push(str)
+ }
+ }
+ this.calculate()
+ str = oprt.join("")
+ this.setData({
+ operotor: str,
+ result: rslt
+ })
+ },
+ acbut(){
+ oprt.splice(0,oprt.length)
+ rslt = ""
+ this.setData({
+ operotor: "",
+ result: ""
+ })
+ },
+ eqbut(){
+ oprt.splice(0,oprt.length)
+ oprt.push(rslt)
+ var str = oprt.join("")
+ rslt = ""
+ this.setData({
+ operotor: str,
+ result: rslt
+ })
+ },
+ delbut(){
+ oprt.pop()
+ this.calculate()
+ var str = oprt.join("")
+ this.setData({
+ operotor: str,
+ result: rslt
+ })
+ },
+
+ calculate(){
+//-------------------------------转化逆波兰----------------------------------------------
+ var lastop = new Array
+ var trans = new Array
+ for(var i = 0; i < oprt.length; i++){
+ var temp = oprt[i]
+ if(temp[0] >= "0" && temp[0] <= "9"){
+ temp = Number(temp)
+ trans.push(temp)
+ }
+ else if(temp[0] == "π"){
+ temp = Math.PI
+ trans.push(temp)
+ }
+ else if(temp[0] == "e"){
+ temp = Math.E
+ trans.push(temp)
+ }
+ else if(temp[0] == "-" && i == 0){
+ temp = Number(temp)
+ trans.push(temp)
+ }
+ else{
+ if(temp == "+" || temp == "-"){
+ while(lastop.length != 0){
+ trans.push(lastop[lastop.length-1])
+ lastop.pop()
+ }
+ lastop.push(temp)
+ }
+ else if(temp == "×" || temp == "÷"){
+ lastop.push(temp)
+ }
+ else{
+ while(lastop.length != 0 && lastop[lastop.length-1] != "+" && lastop[lastop.length-1] != "-"){
+ trans.push(lastop[lastop.length-1])
+ lastop.pop()
+ }
+ lastop.push(temp)
+ }
+ }
+ }
+ while(lastop.length != 0){
+ trans.push(lastop[lastop.length-1])
+ lastop.pop()
+ }
+//--------------------------------后缀表达式计算-----------------------------------------------------------------------------
+ var ifcanop = 1
+ var i = 0
+ for(; i < trans.length; i++){
+ if(typeof(trans[i]) == "number"){
+ lastop.push(trans[i])
+ }
+ else{
+ switch(trans[i]){
+ case "+":
+ if(lastop.length < 2){
+ ifcanop = 0
+ break
+ }
+ var s = lastop[lastop.length-2] + lastop[lastop.length-1]
+ lastop.pop()
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "-":
+ if(lastop.length < 2){
+ ifcanop = 0
+ break
+ }
+ var s = lastop[lastop.length-2] - lastop[lastop.length-1]
+ lastop.pop()
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "×":
+ if(lastop.length < 2){
+ ifcanop = 0
+ break
+ }
+ var s = lastop[lastop.length-2] * lastop[lastop.length-1]
+ lastop.pop()
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "÷":
+ if(lastop.length < 2){
+ ifcanop = 0
+ break
+ }
+ var s = lastop[lastop.length-2] / lastop[lastop.length-1]
+ lastop.pop()
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "sin":
+ if(lastop.length < 1){
+ ifcanop = 0
+ break
+ }
+ var s = Math.sin(lastop[lastop.length-1])
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "cos":
+ if(lastop.length < 1){
+ ifcanop = 0
+ break
+ }
+ var s = Math.cos(lastop[lastop.length-1])
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "tan":
+ if(lastop.length < 1){
+ ifcanop = 0
+ break
+ }
+ var s = Math.tan(lastop[lastop.length-1])
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "lg":
+ if(lastop.length < 1){
+ ifcanop = 0
+ break
+ }
+ var s = Math.log10(lastop[lastop.length-1])
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "ln":
+ if(lastop.length < 1){
+ ifcanop = 0
+ break
+ }
+ var s = Math.log(lastop[lastop.length-1])
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "√":
+ if(lastop.length < 1){
+ ifcanop = 0
+ break
+ }
+ var s = Math.sqrt(lastop[lastop.length-1])
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "%":
+ if(lastop.length < 1){
+ ifcanop = 0
+ break
+ }
+ var s = lastop[lastop.length-1]/100
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "^":
+ if(lastop.length < 2){
+ ifcanop = 0
+ break
+ }
+ var s = Math.pow(lastop[lastop.length-2],lastop[lastop.length-1])
+ lastop.pop()
+ lastop.pop()
+ lastop.push(s)
+ break
+ case "^2":
+ if(lastop.length < 1){
+ ifcanop = 0
+ break
+ }
+ var s = Math.pow(lastop[lastop.length-1],2)
+ lastop.pop()
+ lastop.push(s)
+ break
+ }
+ }
+ if(!ifcanop) break
+ }
+ if(lastop.length == 1 && ifcanop == 1){
+ rslt = lastop[0].toFixed(8)
+ }
+ else if(ifcanop == 0 || i != trans.length-1){
+ rslt = "wrong"
+ }
+ else{
+ rslt = "wrong"
+ }
+ }
+})
diff --git "a/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.wxml" "b/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.wxml"
new file mode 100644
index 0000000..8f5ef2f
--- /dev/null
+++ "b/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.wxml"
@@ -0,0 +1,56 @@
+
+
+ {{operotor}}
+ {{result}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git "a/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.wxss" "b/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.wxss"
new file mode 100644
index 0000000..e836726
--- /dev/null
+++ "b/\350\222\213\345\255\220\350\261\252-2020302778-\347\254\254\344\272\214\346\254\241mini \344\275\234\344\270\232/index.wxss"
@@ -0,0 +1,112 @@
+page{
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+}
+
+.showboard{
+ height: 30%;
+ width: 100%;
+ background-color: rgb(241, 241, 241);
+}
+
+.showoperotor{
+ height: 50%;
+ width: 100%;
+ text-align:right;
+ font-size: 100rpx;
+ padding-top: 10%;
+ overflow: scroll;
+}
+
+.showresult{
+ height: 30%;
+ width: 100%;
+ font-size: 60rpx;
+ text-align: right;
+ color: rgb(124, 124, 124);
+ overflow: scroll;
+}
+
+.keyboard{
+ height: 70%;
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.line1{
+ height: 16.66%;
+ width: 100%;
+ display:flex;
+}
+
+.line2{
+ height: 33.33%;
+ width: 100%;
+ display: flex;
+}
+
+.but_1{
+ margin: 1%;
+ background-color: rgb(241, 241, 241);
+ border-radius: 20%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-size: 60rpx;
+}
+
+.but_2{
+ margin: 1%;
+ background-color: rgb(217, 238, 255);
+ border-radius: 20%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-size: 60rpx;
+ color: rgb(63, 150, 221);
+}
+
+.but_3{
+ height: 45%;
+ margin: 5%;
+ background-color: rgb(241, 241, 241);
+ border-radius: 20%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-size: 60rpx;
+}
+
+.but_4{
+ height: 92%;
+ margin-top: 5%;
+ background-color: rgb(76, 163, 117);
+ border-radius: 10%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-size: 60rpx;
+ color: rgb(255, 255, 255);
+}
+
+.row2{
+ width: 20%;
+ height: 100%;
+}
+
+.but_1hov{
+ background-color: rgb(158, 158, 158);
+ color: rgb(37, 37, 37);
+}
+
+.but_2hov{
+ color: rgb(38, 72, 100);
+ background-color: rgb(155, 169, 180);
+}
+
+.but_4hov{
+ color: rgb(196, 196, 196);
+ background-color: rgb(53, 107, 78);
+}
\ No newline at end of file
--
Gitee