浏览代码

fix(controller): 任意角度弯

xiansin 3 年之前
父节点
当前提交
a97887d33b
共有 6 个文件被更改,包括 12 次插入9 次删除
  1. 1 0
      core/http.interceptor.js
  2. 1 1
      core/util.js
  3. 2 2
      pages/formula/anyangle.vue
  4. 2 1
      pages/index/index.vue
  5. 3 4
      pages/login/login.vue
  6. 3 1
      store/index.js

+ 1 - 0
core/http.interceptor.js

xqd
@@ -35,6 +35,7 @@ const install = (Vue, vm) => {
 				Vue.prototype.$u.vuex(Vue.prototype.$const.USER_TOKEN,null)
 				Vue.prototype.$u.vuex(Vue.prototype.$const.USER_DATA,null)
 				Vue.prototype.$util.login();
+				return false;
 			}else {
 				uni.showModal({
 					title: '提示',

+ 1 - 1
core/util.js

xqd
@@ -80,7 +80,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] >= 6) || (str.length > 2 && str[3] >= 6)){
+        if((str.length > 2 && str[2] >= 6) || (str.length > 2 && str[3] >= 5 && str[2] >= 5)){
             number = Math.ceil(number * i)
             number += 1;
             number = number / i;

+ 2 - 2
pages/formula/anyangle.vue

xqd
@@ -111,8 +111,8 @@
                     this.$u.toast('两边之后要大于第三边');
                     return;
                 }
-                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)
+                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)
                 top = (Math.pow(a,2) + Math.pow(b,2) - Math.pow(c,2)) / (2 * a * b)
 
                 this.rules.left.value = this.$util.acos(left)

+ 2 - 1
pages/index/index.vue

xqd xqd
@@ -71,7 +71,7 @@
 			},
 			handleBind(){
 				this.$u.api.userBind({scene:this.scene}).then(res => {
-
+					this.$u.vuex(this.$const.USER_SCENE, null);
 				})
 			},
 			getSetting(){
@@ -82,6 +82,7 @@
 		},
 		onLoad(options){
 			this.scene = options.scene;
+			console.log('-->data',this.scene)
 			if(this.scene){
 				this.$u.vuex(this.$const.USER_SCENE,this.scene);
 				this.handleBind()

+ 3 - 4
pages/login/login.vue

xqd xqd xqd
@@ -39,8 +39,6 @@
         },
         methods: {
             login(){
-                console.log('-->data',this.vuex_user_secne)
-                return
                 let _this = this;
                 uni.showLoading({title: '登录中...'})
                 uni.login({
@@ -60,6 +58,7 @@
                                     uni.hideLoading();
                                     _this.$u.vuex(_this.$const.USER_TOKEN,loginRes.token)
                                     _this.$u.vuex(_this.$const.USER_DATA,loginRes.user)
+                                    _this.handleBind()
                                     if(loginRes.user.nickname === '微信用户'){
                                         _this.modal.show = true;
                                     }else{
@@ -104,8 +103,8 @@
                 });
             },
             handleBind(){
-                this.$u.api.userBind({scene:this.scene}).then(res => {
-
+                this.$u.api.userBind({scene:this.vuex_user_scene}).then(res => {
+                    this.$u.vuex(this.$const.USER_SCENE, null);
                 })
             }
         },

+ 3 - 1
store/index.js

xqd xqd
@@ -13,7 +13,7 @@ try{
 }
 
 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
-let saveStateKeys = [constant.USER_TOKEN,constant.USER_DATA];
+let saveStateKeys = [constant.USER_TOKEN,constant.USER_DATA,constant.USER_SCENE];
 
 // 保存变量到本地存储中
 const saveStorage = function(key, value){
@@ -34,6 +34,8 @@ const store = new Vuex.Store({
 		vuex_user_token: lifeData[constant.USER_TOKEN],
 		// 用户信息
 		vuex_user_data: lifeData[constant.USER_DATA],
+		// 用户信息
+		vuex_user_scene: lifeData[constant.USER_SCENE],
 	},
 	mutations: {
 		$uStore(state, payload) {