Browse Source

bug 修复

lilei 3 years ago
parent
commit
2f90304cd7
7 changed files with 73 additions and 25 deletions
  1. 2 2
      App.vue
  2. 3 2
      pages.json
  3. 25 9
      pages/index/index.vue
  4. 3 3
      pages/login/login.vue
  5. 36 8
      pages/scan-frame/scan-frame.vue
  6. 1 0
      pages/vinInput/confirmVin.vue
  7. 3 1
      store/index.js

+ 2 - 2
App.vue

@@ -1,8 +1,8 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.16.156:9110/saas/clz/', // 本地
-			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
+			baseUrl: 'http://192.168.16.156:9110/saas/clz/', // 本地
+			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {

+ 3 - 2
pages.json

@@ -7,7 +7,8 @@
 			"path": "pages/index/index",
 			"style": {
 				"navigationBarTitleText": "首页",
-				"navigationStyle":"custom"
+				"navigationStyle":"custom",
+				"enablePullDownRefresh": true
 			}
 		},
 		{
@@ -37,7 +38,7 @@
 		{
 			"path": "pages/xieyi/index",
 			"style": {
-				"navigationBarTitleText": "用户协议"
+				"navigationBarTitleText": "用户协议和隐私政策"
 			}
 		},
 		{

+ 25 - 9
pages/index/index.vue

@@ -100,24 +100,40 @@
 		},
 		onReady() {
 			// 检测是否登录
-			this.$store.dispatch('checkLogin')
+			this.$store.dispatch('checkLogin',()=>{
+				this.pageInit()
+			})
 		},
 		onLoad() {
 			// 获取数据字典
 			this.getListLookUp();
 			// 获取支付,收款方式
 			this.getLookUpList('PAY_PROCUCT_TYPE', 'vuex_paymentTypeList');
+			// 刷新首页数据
+			uni.$on("refashHome",()=>{
+				this.pageInit()
+			})
 		},
-		onShow() {
-			if(this.hasLogin){
-				// 查询是否有数字货架
-				this.getStoreShelf()
-				// 获取扫描记录
-				this.getVinLog()
-			}
-			this.getScrollLog()
+		onUnload() {
+			uni.$off('refashHome')
+		},
+		// 下拉刷新
+		onPullDownRefresh(){
+			this.pageInit()
+			setTimeout(function () {
+				uni.stopPullDownRefresh();
+			}, 1000);
 		},
 		methods: {
+			pageInit(){
+				if(this.hasLogin){
+					// 查询是否有数字货架
+					this.getStoreShelf()
+					// 获取扫描记录
+					this.getVinLog()
+				}
+				this.getScrollLog()
+			},
 			//  获取数据字典
 			getListLookUp() {
 				const _this = this;

+ 3 - 3
pages/login/login.vue

@@ -6,15 +6,15 @@
 			</view>
 		    <view class="login-btns">
 				<u-button shape="circle" :custom-style="wxButton" class="login-btn" type="success" :hair-line="false" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
-					微信一键登录
+					微信手机号快捷登录
 				</u-button>
 				<u-button shape="circle" :custom-style="phoneButton" class="login-btn phoneBtn" @click="phoneLogin" :hoverClass='none'>
-					手机登录
+					手机验证码登录
 				</u-button>
 		    </view>
 		</view>
 		<view class="xieyi" @click="gotoXieyi()">
-			首次登录代表同意 <text>《用户协议》</text>及<text>《隐私政策》</text>
+			登录即代表同意 <text>《用户协议》和《隐私政策》</text>
 		</view>
 	</view>
     

+ 36 - 8
pages/scan-frame/scan-frame.vue

@@ -42,11 +42,19 @@ export default {
   	   success(res) {
   	      console.log(res.authSetting['scope.camera'])
   		  if(!res.authSetting['scope.camera']){
-  			  uni.openSetting({
-  			    success(res) {
-  			      console.log(res.authSetting)
-  			    }
-  			  })
+			  uni.showModal({
+			  	title: '您未开启摄像机权限',
+			  	content: '请点击右上角,然后在设置里面开启。',
+			  	success: (ret) => {
+			  	  if(ret.confirm){
+					  uni.openSetting({
+					    success(res) {
+					      console.log(res.authSetting)
+					    }
+					  })
+			  	  }
+			  	}
+			  })
   		  }
   	   }
   	})
@@ -70,6 +78,17 @@ export default {
         }
       })
     },
+	delImgs(filePath){
+	   // #ifdef MP-WEIXIN
+		const fs = wx.getFileSystemManager();
+		try {
+		  const res = fs.unlinkSync(filePath)
+		  console.log(res)
+		} catch(e) {
+		  console.error(e)
+		}
+	   // #endif
+	},
 	// 裁剪图片
 	cutImg(fileUrl){
 		const vm = this
@@ -96,6 +115,8 @@ export default {
 			  success: function(res) {
 			    // 在H5平台下,tempFilePath 为 base64
 				vm.parseImgs(res.tempFilePath)
+				// 删除临时文件
+				// vm.delImgs(fileUrl)
 			  } 
 			})
 		})
@@ -166,10 +187,17 @@ export default {
 			imageByte: data
 		}).then(res => {
 			console.log(res, '识别VIN')
+			if(res.status == 200){
+				uni.redirectTo({
+					url: "/pages/vinInput/confirmVin?verifyCode=123456ads11234567&filePath="+base64Str + "&verifyCode="+res.data
+				})
+			}else{
+				uni.showToast({
+					icon: 'none',
+					title: res.message
+				})
+			}
 			uni.hideLoading()
-			uni.redirectTo({
-				url: "/pages/vinInput/confirmVin?verifyCode=123456ads11234567&filePath="+base64Str + "&verifyCode="+res.data
-			})
 		}).catch(err => {
 			uni.hideLoading()
 			uni.showToast({

+ 1 - 0
pages/vinInput/confirmVin.vue

@@ -104,6 +104,7 @@
 					year: data.year
 				}).then(res => {
 					console.log(res)
+					uni.$emit("refashHome")
 				})
 			},
 			// 提交并匹配车型

+ 3 - 1
store/index.js

@@ -131,10 +131,12 @@ const store = new Vuex.Store({
 			})
 		},
 		// 检测是否登录
-		checkLogin(context,data){
+		checkLogin(context,callback){
+			console.log(callback)
 			checkLogin().then(res => {
 				if(res.status == '200'){
 					context.commit('setHasLogin',true)
+					callback&&callback()
 				}else{
 					context.commit('logout')
 				}