浏览代码

系统消息

liuwei 1 周之前
父节点
当前提交
b5a67da94a
共有 5 个文件被更改,包括 153 次插入45 次删除
  1. 14 13
      common/storage.js
  2. 59 29
      mixin/index.js
  3. 6 0
      pages.json
  4. 7 3
      pages/message/index.vue
  5. 67 0
      pages/message/systemInfo.vue

+ 14 - 13
common/storage.js

@@ -33,14 +33,15 @@ const ICONS = {
 	add: `${QINIU_URL}FqLEWbMe8DcnQtNz6GdDDD87ObZK`,
 	placeholder: `${QINIU_URL}FpKvfFNSDbx0d9RDwyGAQdFb7Kt6`
 }
-const activeTabs = [{
-		name: i18n.t('开机'),
-		type:'turnOnOrOff',
-		iconUrl: `${QINIU_URL}Fp5T9lSNakoiioji6S7W4DmFQ_ys`,
-		offUrl: `${QINIU_URL}FqxGx0H169EOJN0__Ym2Ls8x2i03`,
-		isLock: true,
-		isTurnOn:1
-	},
+// {
+// 		name: i18n.t('开机'),
+// 		type:'turnOnOrOff',
+// 		iconUrl: `${QINIU_URL}Fp5T9lSNakoiioji6S7W4DmFQ_ys`,
+// 		offUrl: `${QINIU_URL}FqxGx0H169EOJN0__Ym2Ls8x2i03`,
+// 		isLock: true,
+// 		isTurnOn:1
+// 	},
+const activeTabs = [
 	{
 		name: i18n.t('闪灯鸣笛'),
 		type:'findCar',
@@ -55,15 +56,15 @@ const activeTabs = [{
 		name: i18n.t('打开尾箱'),
 		type:'openTailBox',
 		iconUrl: `${QINIU_URL}Fv3KLuYWEeV5IM4_2sMbmur7yZtz`
-	}
-]
-const toBeSelectTabs = [{
+	},
+	{
 		name:i18n.t('胎压'),
 		type:'tirePressure',
 		url:'',
 		iconUrl: `${QINIU_URL}FmbcjmvoB4J3CT1hrbjNX4kxv9Zq`
-	},
-	{
+	}
+]
+const toBeSelectTabs = [{
 		name: i18n.t('电池信息'),
 		type:'batteryInfo',
 		url:'/pages/batteryDetail/batteryDetail',

+ 59 - 29
mixin/index.js

@@ -88,34 +88,34 @@ export default {
 				// 判断车辆是否在线状态 true 在线调用接口 不在线提示连接蓝牙
 				if (this.carOnline) {
 					if (this.cmdType == 'turnOnOrOff') {
-						const switchType = this.contrilList.find(item => item.isTurnOn).isTurnOn
-						const pData = {
-							car_sn: car_info.car_sn,
-							switch: switchType
-						}
-						const me=this
-						common.loading();
-						http.postApi(config.API_FLK_CAR_SWITCH, pData, (resp) => {
-							uni.hideLoading();
-							if (resp.data.code === 200) {
-								common.simpleToast(me.popText + '成功');
-								const activeTag = me.contrilList.map(item => {
-									if('isLock' in item){
-										item.isTurnOn = (item.isTurnOn == 1) ? 0 : 1
-										item.name = i18n.t((item.isTurnOn == 1) ? '关机' : '开机')
-									}
-									return item
-								})
-								const tag = getFunctionTag().tag
-								setFunctionTag({
-									activeTag,
-									tag
-								})
-								me.$emit('loadCarDetail',pData,car_sn)
-							} else {
-								common.simpleToast(resp.data.msg);
-							}
-						});
+						// const switchType = this.contrilList.find(item => item.isTurnOn).isTurnOn
+						// const pData = {
+						// 	car_sn: car_info.car_sn,
+						// 	switch: switchType
+						// }
+						// const me=this
+						// common.loading();
+						// http.postApi(config.API_FLK_CAR_SWITCH, pData, (resp) => {
+						// 	uni.hideLoading();
+						// 	if (resp.data.code === 200) {
+						// 		common.simpleToast(me.popText + '成功');
+						// 		const activeTag = me.contrilList.map(item => {
+						// 			if('isLock' in item){
+						// 				item.isTurnOn = (item.isTurnOn == 1) ? 0 : 1
+						// 				item.name = i18n.t((item.isTurnOn == 1) ? '关机' : '开机')
+						// 			}
+						// 			return item
+						// 		})
+						// 		const tag = getFunctionTag().tag
+						// 		setFunctionTag({
+						// 			activeTag,
+						// 			tag
+						// 		})
+						// 		me.$emit('loadCarDetail',pData,car_sn)
+						// 	} else {
+						// 		common.simpleToast(resp.data.msg);
+						// 	}
+						// });
 					}else{
 						const testArr=[
 							{type:'findCar',opt_type:1},
@@ -147,8 +147,8 @@ export default {
 			//蓝牙是否已经连接 未连接提示去连接 已连接下发对应指令
 			const isBluetoothConnect = app.globalData.nearLockCheck
 			if(isBluetoothConnect){
+				//改成判断开关锁
 				const isTurnOn=this.contrilList.find(item => item.isTurnOn).isTurnOn==1
-				console.log(isTurnOn,this.cmdType,this.contrilList);
 				const bluetoothCommands = {
 					'turnOnOrOff': isTurnOn?bluetooth.turnOnCar:bluetooth.turnOffCar,
 					'findCar': bluetooth.findCarCmd,
@@ -191,6 +191,36 @@ export default {
 					complete: function(res) {},
 				})
 			}
+		},
+		trunOn(){
+			const switchType = this.contrilList.find(item => item.isTurnOn).isTurnOn
+			const pData = {
+				car_sn: car_info.car_sn,
+				switch: switchType
+			}
+			const me=this
+			common.loading();
+			http.postApi(config.API_FLK_CAR_SWITCH, pData, (resp) => {
+				uni.hideLoading();
+				if (resp.data.code === 200) {
+					common.simpleToast(me.popText + '成功');
+					const activeTag = me.contrilList.map(item => {
+						if('isLock' in item){
+							item.isTurnOn = (item.isTurnOn == 1) ? 0 : 1
+							item.name = i18n.t((item.isTurnOn == 1) ? '关机' : '开机')
+						}
+						return item
+					})
+					const tag = getFunctionTag().tag
+					setFunctionTag({
+						activeTag,
+						tag
+					})
+					me.$emit('loadCarDetail',pData,car_sn)
+				} else {
+					common.simpleToast(resp.data.msg);
+				}
+			});
 		}
 	},
 

+ 6 - 0
pages.json

@@ -69,6 +69,12 @@
 		{
 			"path": "pages/message/deviceInfo",
 			"style": {
+				
+			}
+		},{
+			"path": "pages/message/systemInfo",
+			"style": {
+				"navigationBarTitleText": "系统详情"
 			}
 		},
 		{

+ 7 - 3
pages/message/index.vue

@@ -23,10 +23,10 @@
 			您还没有设备消息
 		</view>
         
-        <view v-if="isSys==='1' && sysMsgList.length > 0 " style="margin-top: 20rpx;" class="sys-msg-wrap base-wrap">
+        <view v-if="isSys==='1' && sysMsgList.length > 0 " style="margin-top: 20rpx;" class="sys-msg-wrap base-wrap" >
             <view class="title">{{ $t('系统消息') }}</view>
 			
-            <view class="msg-item" v-for="(item, index) in sysMsgList" :key="index">
+            <view class="msg-item" v-for="(item, index) in sysMsgList" :key="index" @tap="toSystemMsgPage(item)">
                 <view class="msg">
                     {{ item.title }}
                     <view v-if="item.type === 1" class="btn">绑定设备</view>
@@ -70,8 +70,12 @@ export default {
 			await request.postApi(config.API_MESSAGE_READ_MESSAGE,{msg_type:2,car_id:0})
 		},
         toDeviceMsgPage(itemData) {
-            const { car_id } = itemData
+            const { id } = itemData
             uni.navigateTo({ url: `/pages/message/deviceInfo?car_id=${car_id}` })
+        }, 
+		toSystemMsgPage(itemData) {
+            const { id } = itemData
+            uni.navigateTo({ url: `/pages/message/systemInfo?id=${id}` })
         },
         queryDeviceMsg() {
             http.postApi(config.API_DEVICE_MSG, {}, res => {

+ 67 - 0
pages/message/systemInfo.vue

@@ -0,0 +1,67 @@
+<template>
+	<view class="">
+		<navBar name="系统消息"/>
+		<view class="info-title">{{systemInfo.title}}</view>
+		<view class="info-time">{{tools.formatTime(systemInfo.ctime)}}</view>
+		<view class="nodes">
+			<rich-text v-if="systemInfo.content" :nodes="systemInfo.content"></rich-text>
+		</view>
+	</view>
+</template>
+<script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
+<script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
+<script>
+const config = require('@/common/config.js');
+const http = require('@/common/http.js');
+const request = require('@/common/request.js');
+const common = require('@/common/common.js');
+export default {
+    data() {
+        return {
+            systemInfo:{},
+			id:''
+        }
+    },
+	onLoad(options){
+		this.id = options.id || ''
+		this.querySystemMsg()
+	},
+    methods: {
+        querySystemMsg() {
+			const pData={
+				id:this.id,
+				type:'PLAT'
+			}
+            http.postApi(config.API_MESSAGE_DTL, pData, res => {
+                if (res.succeed) {
+                    this.systemInfo = res.body.data
+                }
+            })
+        },
+    }
+}
+</script>
+
+
+<style>
+	.info-title{
+		font-family: PingFangSC, PingFang SC;
+		font-weight: 600;
+		font-size: 36rpx;
+		color: #060809;
+		padding: 20rpx 32rpx;
+	}
+	.info-time{
+		font-family: Futura, Futura;
+		font-weight: 500;
+		font-size: 24rpx;
+		color: #060809;
+		opacity: 0.4;
+		padding: 20rpx 32rpx;
+	}
+	.nodes{
+		color: #333;
+		font-size: 28rpx;
+		padding: 34rpx 32rpx 32rpx;
+	}
+</style>