liuwei 2 weeks ago
parent
commit
65ab0dc676

+ 2 - 2
js_sdk/wa-permission/permission.js

@@ -273,8 +273,8 @@ function requestAndroidPermissions() {
 	// const runningPermission=checkBackgroundRunningPermission()
 	// const lockStatus=checkAppLockStatus()
 	const permissionArr=[
-		{type: 'location',state:locationPermission},
-		{type: 'battery',state:optimizationStatus},
+		{type: 'location',state:locationPermission,title: ('位置权限'), desc: '打开手机定位,并运行APP始终使用'},
+		{type: 'battery',state:optimizationStatus,title: ('电池优化'),  desc: '打开电池优化设置, 将弗兰克APP加入保护名单'},
 		// {type: 'appLock',state:lockStatus},
 		// {type: 'backstage',state:runningPermission},
 		// {type: 'appLock',state:lockStatus},

+ 0 - 1
pages/bluetoothUnlock/bluetoothUnlockAuth.vue

@@ -30,7 +30,6 @@ export default {
     methods: {
         open() {
             this.show = true;
-            console.log(111, this.platform)
         },
         _initPlatform() {
             const systemInfo = uni.getSystemInfoSync();

+ 20 - 35
pages/bluetoothUnlock/components/AndroidUnlockAuth.vue

@@ -13,8 +13,8 @@
             <view class="desc-wrap">
               <view class="title-row">
                 <view class="title">{{ item.title }}</view>
-                <view :class="['turn-on-switch', permisionCheckObj[item.type] && 'is-open']">
-                  {{ permisionCheckObj[item.type] ? $t('已开启') : $t('未开启') }}
+                <view :class="['turn-on-switch', item.state && 'is-open']">
+                  {{ item.state ? $t('已开启') : $t('未开启') }}
                 </view>
               </view>
               <view class="desc">{{ item.desc }}</view>
@@ -28,7 +28,9 @@
 </template>
 
 <script>
+	var app = getApp();
 	var bluetooth = require('@/common/bluetooth.js');
+	var common = require('@/common/common.js');
 import permision from "@/js_sdk/wa-permission/permission.js"
 export default {
   props: {
@@ -44,20 +46,22 @@ export default {
   data() {
     return {
       showDialog: this.value,
-      permisionCheckObj: {}
-    }
-  },
-  computed: {
-    authStepList() {
-      const lang = v => this.$t(v)
-      return [
-        { title: ('位置权限'), type: 'location', desc: '打开手机定位,并运行APP始终使用' },
-        { title: ('电池优化'), type: 'battery', desc: '打开电池优化设置, 将弗兰克APP加入保护名单' },
-        { title: ('后台运行'), type: 'backstage', desc: '打开后台运行权限 清选择手动控制' },
-        { title: ('打开应用锁'), type: 'appLock', desc: '打开应用权限锁' }
-      ]
+      permisionCheckObj: {},
+	  authStepList:[],
+	  isOpenAllPermission:false,//是否打开所有需要权限
     }
   },
+  // computed: {
+  //   authStepList() {
+  //     const lang = v => this.$t(v)
+  //     return [
+  //       { title: ('位置权限'), type: 'location', desc: '打开手机定位,并运行APP始终使用' },
+  //       { title: ('电池优化'), type: 'battery', desc: '打开电池优化设置, 将弗兰克APP加入保护名单' },
+  //       // { title: ('后台运行'), type: 'backstage', desc: '打开后台运行权限 清选择手动控制' },
+  //       // { title: ('打开应用锁'), type: 'appLock', desc: '打开应用权限锁' }
+  //     ]
+  //   }
+  // },
   watch: {
     value(newValue) {
       this.showDialog = newValue
@@ -68,24 +72,7 @@ export default {
   },
   methods: {
     async _initCheckdPermission() {
-      
-	  
-	  for (const { key, permission } of authStepList) {
-		  // this.$set(this.permisionCheckObj, key, result)
-	  }
-  //     const permissionsToCheck = [
-  //       { key: 'location', permission: 'android.permission.ACCESS_FINE_LOCATION' },
-  //       { key: 'backstage', permission: 'android.permission.FOREGROUND_SERVICE' },
-  //       { key: 'battery', permission: 'android.permission.BATTERY_STATS' },//电池优化
-  //     ]
-
-		// console.log(permissionsToCheck,'permissionsToCheck');
-  //     for (const { key, permission } of permissionsToCheck) {
-		//   if(key)
-  //       const result = await this.requestAndroidPermission(permission)
-		
-  //       this.$set(this.permisionCheckObj, key, result)
-  //     }
+		this.authStepList=app.globalData.permissionArr
     },
     // vue的method里编写如下代码
     async requestAndroidPermission(permisionID) {
@@ -116,8 +103,7 @@ export default {
     },
     linkTo() {
 		uni.navigateTo({ url: '/pages/bluetoothUnlock/bluetoothPair' })
-      // const allPermissionsGranted = Object.values(this.permisionCheckObj).every(value => value === true);
-      // if (allPermissionsGranted) {
+      // if (!this.isOpenAllPermission) {
       //   this.close()
       //   uni.navigateTo({ url: '/pages/bluetoothUnlock/bluetoothPair' })
       // } else {
@@ -128,7 +114,6 @@ export default {
       this.$emit('input', false)
     },
 		bluetoothClose: function() {
-		console.log(11112222);
 			bluetooth.closeBluetoothAdapter();
 			bluetooth.closeDevice(
 				"900000997",

+ 2 - 2
pages/common/wxs/tools.sjs

@@ -71,7 +71,7 @@ var formatTimeDate = function(datetime) {
 	return formatNumber(month) + '月' + formatNumber(day) + '日 ' + formatNumber(hour) + ':' + formatNumber(minute);
 }
 
-// 时间戳格式化 返回x月x日 x:x
+// 时间戳格式化 返回x-x x:x
 var formatTimeSecond = function(datetime) {
 	if (datetime == 0) {
 		return ""
@@ -82,7 +82,7 @@ var formatTimeSecond = function(datetime) {
 	var hour = date.getHours()
 	var minute = date.getMinutes()
 	var second = date.getSeconds()
-	return formatNumber(month) + '.' + formatNumber(day) + '-' + formatNumber(hour) + ':' + formatNumber(minute);
+	return formatNumber(month) + '-' + formatNumber(day) + ' ' + formatNumber(hour) + ':' + formatNumber(minute);
 }
 
 var formatDateSplit = function(dateString) {

+ 1 - 1
pages/common/wxs/tools.wxs

@@ -159,7 +159,7 @@ var formatTimeSecond = function(datetime) {
 	var hour = date.getHours()
 	var minute = date.getMinutes()
 	var second = date.getSeconds()
-	return formatNumber(month) + '.' + formatNumber(day) + '-' + formatNumber(hour) + ':' + formatNumber(minute);
+	return formatNumber(month) + '-' + formatNumber(day) + ' ' + formatNumber(hour) + ':' + formatNumber(minute);
 }
 
 var countToDay = function(count, unit) {

+ 29 - 15
pages/index/index.vue

@@ -18,18 +18,20 @@
 			</view> -->
 			<view class="car-img-view">
 				<view class="quantity-view flex-row">
-					<text class="quantity flex-row">88 <text style="font-size: 28rpx;font-weight: 500;">%</text></text>
-					<u-line-progress style="width: 100rpx;" active-color="#2ADA62" height="10" :show-percent="false" :percent="70"></u-line-progress>
+					<text class="quantity flex-row">{{car_info.soc}} <text style="font-size: 28rpx;font-weight: 500;">%</text></text>
+					<u-line-progress style="width: 100rpx;" active-color="#2ADA62" height="10" :show-percent="false" :percent="car_info.soc"></u-line-progress>
 					<text class="quantity-text flex-row">
 						<text style="font-weight:400;font-size: 22rpx;">{{$t("续航")}}</text>
-						<text style="font-size: 36rpx;">54</text><text style="font-size: 30rpx;">km</text> 
+						<text style="font-size: 36rpx;">{{endurance}}</text><text style="font-size: 30rpx;">km</text> 
 					</text>
 				</view>
-				<img src="https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX" style="width: 100%;height: 526rpx;" alt="">
+				<!-- <img :src="car_info.model_images||'https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX'" style="width: 100%;height: 526rpx;" alt=""> -->
+				<img :src="'https://qiniu.bms16.com/Fg8_p7083jpsy8BXG4bR6yMs7jQX'" style="width: 100%;height: 526rpx;" alt="">
 				<view class="flex-row align-center update-time-view" >
-					<text style="margin-right: 10rpx;">{{$t("车辆已关机")}} </text>
-					<text style="margin-right: 10rpx;">{{$t("更新于")}} {{car_info.heart_time}}11-25 23:05 </text>
-					<img src="https://qiniu.bms16.com/FsL6XWGoIhfsVB7jRg6EGFVsuaTZ" style="width: 24rpx;height: 32rpx;" alt="">
+					<text v-if="car_info.acc_state==0" style="margin-right: 10rpx;">{{$t("车辆已关机")}} </text>
+					<text v-if="car_info.acc_state==1" style="margin-right: 10rpx;">{{$t("更新于")}} {{tools.formatTimeSecond(car_info.heart_time)}} </text>
+					<!-- <img src="https://qiniu.bms16.com/FsL6XWGoIhfsVB7jRg6EGFVsuaTZ" style="width: 24rpx;height: 32rpx;" alt=""> -->
+					<img src="https://qiniu.bms16.com/FmhdBxGmadYQYMjwdR9U61Gg-rfs" style="width: 24rpx;height: 32rpx;" alt="">
 				</view>
 			</view>
 			<Control :contrilList="contrilList" />
@@ -46,7 +48,7 @@
 							</view>
 							<view @tap.stop="isTrackOrAll=!isTrackOrAll"><img style="width: 24rpx;height: 20rpx;" src="https://qiniu.bms16.com/FltPK-o7KGS3dQ2pfQHXGSxOdzaN" alt=""></view>
 						</view>
-						<view class="card-top-text">27.4<text class="font_24">km</text></view>
+						<view class="card-top-text">{{car_info.current_mail}}<text class="font_24">km</text></view>
 					</view>
 					
 					<view class="card-bg">
@@ -73,7 +75,7 @@
 					<view class="margin_r_20"><img class="icon_style_64"  src="https://qiniu.bms16.com/FhKkijkN__9UzhYNgamBFSggIlYo" alt=""></view>
 					<view class="flex-row config-text-view">
 						<view class="flex-row font_w_600">{{$t("用车人管理")}}</view>
-						<view class="flex-row tip-text-config">{{$t("个家庭账号")}}</view>
+						<view class="flex-row tip-text-config">{{car_info.share_num + $t("个家庭账号")}}</view>
 					</view>
 					<img class="icon_style_28" src="https://qiniu.bms16.com/FqnbZ2iKHmzCGJA8XD30sf5g_CAm" alt="">
 				</view>
@@ -81,7 +83,7 @@
 					<view class="margin_r_20"><img class="icon_style_64" src="https://qiniu.bms16.com/FsAg6mHEBJfbtpgIHBrDdNiPo1iH" alt=""></view>
 					<view class="flex-row config-text-view">
 						<view  class="flex-row font_w_600">{{$t("设备信息")}}</view>
-						<view class="flex-row tip-text-config">{{$t("软件版本")}}</view>
+						<view class="flex-row tip-text-config">{{$t("软件版本") + (firmware.firmware||'')}}</view>
 					</view>
 					<img class="icon_style_28" src="https://qiniu.bms16.com/FqnbZ2iKHmzCGJA8XD30sf5g_CAm" alt="">
 				</view>
@@ -100,10 +102,10 @@
 <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
 <script>
 	var app = getApp();
-	var config = require('../../common/config.js');
-	var common = require('../../common/common.js');
-	var http = require('../../common/http.js');
-	var storage = require('../../common/storage.js');
+	var config = require('@/common/config.js');
+	var common = require('@/common/common.js');
+	var http = require('@/common/http.js');
+	var storage = require('@/common/storage.js');
 	import Control from './components/control/control'
 	import MapCard from './components/mapCard/mapCard'
 	import UnleasedPages from './components/unleasedPages/unleasedPages'
@@ -167,6 +169,7 @@
 		 */
 		onShow: function() {
 			// const permissionArr=permision.requestAndroidPermissions()
+			// app.globalData.permissionArr=permissionArr
 			// permision.gotoAppPermissionSetting()
 			// let status = checkBatteryOptimizationStatus();
 			// if (!permissionArr) {
@@ -240,7 +243,18 @@
 			},
 			inductiveUnlockHandle() {
 				this.isHideInduction=false
-				this.$refs.bluetoothUnlockAuth.open();
+				let isOpenAllPermission=false
+				app.globalData.permissionArr.map(item=>{
+					if(!item.state) isOpenAllPermission=true
+				})
+				// console.log(this.isOpenAllPermission,'this.isOpenAllPermission');
+				if(!isOpenAllPermission){
+					common.simpleToast('所需权限开启成功,前往开启蓝牙配对...');
+					uni.navigateTo({ url: '/pages/bluetoothUnlock/bluetoothPair' })
+				}else{
+					this.$refs.bluetoothUnlockAuth.open();	
+				}
+				
 			},
 			showInduction(){
 				this.isHideInduction=true