Sfoglia il codice sorgente

PDA设备注册,登录关联

aleyds 4 anni fa
parent
commit
b8866c0e3f
6 ha cambiato i file con 58 aggiunte e 31 eliminazioni
  1. 33 19
      App.vue
  2. 10 7
      common/apiurl.js
  3. 1 1
      common/config.js
  4. 4 1
      common/http.api.js
  5. 6 2
      manifest.json
  6. 4 1
      pages/login/login.vue

+ 33 - 19
App.vue

@@ -1,31 +1,45 @@
 <script>
+	var AndroidLog = uni.requireNativePlugin("AndroidLog")
+	var device = uni.requireNativePlugin("DeviceInfo")
 	export default {
 		onLaunch: function() {
-			// console.log('App Launch')
 			//判断客户端类别
-			if (/MicroMessenger/.test(window.navigator.userAgent)) {
-				uni.setStorage({
-					key:'userAgent',
-					data:'wxAgent'
+			const _handlePush = function(message) {  
+						// console.log("接收到推送消息:" ,message);
+						// alert(message)
+						AndroidLog.info({message: message})
+			        };  
+					
+		setTimeout(()=>{
+			var pinf = plus.push.getClientInfo();
+			var cid = pinf.clientid;//客户端标识  
+			if(cid != null && cid !=  '' && cid != 'null'){
+				//注册设备
+				var deviceInfo = device.getDeviceInfo()
+				this.$u.api.deviceReg({deviceNo:deviceInfo.deviceId,pushCid: cid})
+				.then(res=>{
+						if (res.code == 200){
+							plus.nativeUI.toast('设备注册成功');
+						}else{
+							plus.nativeUI.toast('设备注册失败');
+						}
+				}).catch(err=>{
+					plus.nativeUI.toast('设备注册失败');
 				});
-				// console.log('handleAliPay 微信客户端');
-			} else if (/AlipayClient/.test(window.navigator.userAgent)) {
-				uni.setStorage({
-					key:'userAgent',
-					data:'aliAgent'
-				});
-				// console.log('handleAliPay 支付宝客户端');
-			} else {
-				uni.setStorage({
-					key:'userAgent',
-					data:'otherAgent'
-				});
-				// console.log('handleAliPay 其他浏览器');
-			};
+				clearTimeout()
+			}
+		}, 400);
+			
+			//监听系统通知栏消息点击事件  
+			plus.push.addEventListener('click', _handlePush,false);  
+			
+			//监听接收透传消息事件
+			plus.push.addEventListener('receive', _handlePush,false);  
 			// this.$wxApi.config();
 		},
 		onShow: function() {
 			// console.log('App Show')
+			
 		},
 		onHide: function() {
 			// console.log('App Hide')

+ 10 - 7
common/apiurl.js

@@ -1,23 +1,26 @@
 const apiurl = {
 	//登录
-	loginUrl:'/auth/login',
+	loginUrl:'/payee/auth/login',
 	//首页信息
-	getIndexUrl:'/index',
+	getIndexUrl:'/payee/index',
 	//路段车位列表
-	getRoadspaceUrl:'/roadspace',
+	getRoadspaceUrl:'/payee/roadspace',
 	//车辆入场
-	entranceUrl:'/orderinfo/entranceIn',
+	entranceUrl:'/payee/orderinfo/entranceIn',
 	//车辆出场
-	getOutUrl:'/orderinfo/entranceOut',
+	getOutUrl:'/payee/orderinfo/entranceOut',
 	
 	//车辆出场
 	baiduOcrUrl:'/file/baidu/ocr',
 	
 	//车辆出场详情
-	entranceOutDetailUrl:'/orderinfo/entranceOutDetail/',
+	entranceOutDetailUrl:'/payee/orderinfo/entranceOutDetail/',
 	
 	//收费员密码修改
-	modifyPwdUrl:'/payeeinfo/modifyPwd',
+	modifyPwdUrl:'/payee/payeeinfo/modifyPwd',
+	
+	//设备注册
+	deviceReg: '/device/pda/accept'
 
 }
 

+ 1 - 1
common/config.js

@@ -3,7 +3,7 @@ const host = 'http://wx.hw.hongweisoft.com/parking';
 const config = {
 	wxAppid:'wxbe90cc7c5233dd84',// wxAppid 
 	// baseUrl:'http://wx.hw.hongweisoft.com/parking/client',//64
-	baseUrl:`${host}/payee`,//殷登顺
+	baseUrl:`${host}`,//殷登顺
 	fileUrl:`${host}/file`,
 	
 	

+ 4 - 1
common/http.api.js

@@ -21,6 +21,8 @@ const install = (Vue, vm) => {
 	
 	let modifyPwd = (params = {}) => vm.$u.put(apiurl.modifyPwdUrl, params);
 	
+	let deviceReg = (params = {}) => vm.$u.post(apiurl.deviceReg, params);
+	
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
 		login,
@@ -30,7 +32,8 @@ const install = (Vue, vm) => {
 		getIndex,
 		baiduOcr,
 		entranceOutDetail,
-		modifyPwd
+		modifyPwd,
+		deviceReg
 	};
 }
 

+ 6 - 2
manifest.json

@@ -19,7 +19,7 @@
         },
         /* 模块配置 */
         "modules" : {
-            "Payment" : {}
+            "Push" : {}
         },
         /* 应用发布信息 */
         "distribute" : {
@@ -67,7 +67,11 @@
                         "appid" : "",
                         "UniversalLinks" : ""
                     }
-                }
+                },
+                "push" : {
+                    "unipush" : {}
+                },
+                "ad" : {}
             },
             "orientation" : [ "portrait-primary" ],
             "splashscreen" : {

+ 4 - 1
pages/login/login.vue

@@ -23,6 +23,7 @@
 </template>
 
 <script>
+	var device = uni.requireNativePlugin("DeviceInfo")
 	export default {
 		data() {
 			return {
@@ -31,7 +32,8 @@
 				form:{
 					name:'9345',
 					password:'000000',
-					passCheck:false
+					passCheck:false,
+					deviceNo: ''
 				},
 				
 				
@@ -67,6 +69,7 @@
 			// 	}
 			// },
 			handleLogin(){
+				this.form.deviceNo = device.getDeviceInfo().deviceId;
 				this.$u.api.login(this.form)
 				.then(res=>{
 					this.$refs.uToast.show({