Quellcode durchsuchen

写好部分单点登录功能

yin_yu820 vor 2 Jahren
Ursprung
Commit
19f4353c23
5 geänderte Dateien mit 159 neuen und 29 gelöschten Zeilen
  1. 1 1
      public/index.html
  2. 33 14
      src/api/index.js
  3. 1 1
      src/config/index.js
  4. 122 11
      src/views/tab_a/tabAll.vue
  5. 2 2
      vue.config.js

+ 1 - 1
public/index.html

@@ -8,7 +8,7 @@
     <title><%= htmlWebpackPlugin.options.title %></title>
     <title><%= htmlWebpackPlugin.options.title %></title>
 
 
     <!--小程序SDK 只有在小程序容器中才能加载到 -->
     <!--小程序SDK 只有在小程序容器中才能加载到 -->
-	  <!-- <script src="shinemosdk://20000/index.js"></script> -->
+	  <script src="shinemosdk://20000/index.js"></script>
   </head>
   </head>
   <body>
   <body>
     <noscript>
     <noscript>

+ 33 - 14
src/api/index.js

@@ -5,22 +5,12 @@ export default  {
     login : {
     login : {
         VerifyLogin : {
         VerifyLogin : {
             url:`${config.baseUrl}/Mobile/VerifyLogin`,
             url:`${config.baseUrl}/Mobile/VerifyLogin`,
-            name:'测试',
+            name:'免登',
             post : function(params){
             post : function(params){
                 return http.post(this.url,params)
                 return http.post(this.url,params)
             }
             }
         }
         }
     },
     },
-    // 商品列表
-    main : {
-        ProductList : {
-            url:`${config.baseUrl}/Mobile/ProductList`,
-            name:'测试',
-            get : function(params){
-                return http.get(this.url,params)
-            }
-        }
-    },
     my: {
     my: {
         OrderList : {
         OrderList : {
             url:`${config.baseUrl}/Mobile/OrderList`,
             url:`${config.baseUrl}/Mobile/OrderList`,
@@ -37,14 +27,43 @@ export default  {
             }
             }
         }
         }
     },
     },
-    order : {
-        SaveOrder : {
-            url:`${config.baseUrl}/sys/login`,
+    yin : {
+        TokenLogin : {
+            url:`${config.baseUrl}/yzt/Login`,
             name:'测试',
             name:'测试',
+            get : function(params){
+                return http.get(this.url,params)
+            }
+        },
+        SchemaService : {
+            url:`${config.baseUrl}/SchemaService`,
+            name:'测试用户同步规则',
+            post : function(params){
+                return http.post(this.url,params)
+            }
+        },
+        UserCreateService : {
+            url:`${config.baseUrl}/UserCreateService`,
+            name:'测试用户新建',
+            post : function(params){
+                return http.post(this.url,params)
+            }
+        },
+        UserUpdateService : {
+            url:`${config.baseUrl}/UserUpdateService`,
+            name:'测试用户更新',
+            post : function(params){
+                return http.post(this.url,params)
+            }
+        },
+        UserDeleteService : {
+            url:`${config.baseUrl}/UserDeleteService`,
+            name:'测试用户删除',
             post : function(params){
             post : function(params){
                 return http.post(this.url,params)
                 return http.post(this.url,params)
             }
             }
         }
         }
+        
     },
     },
 }
 }
 
 

+ 1 - 1
src/config/index.js

@@ -4,7 +4,7 @@ var defaultConfig = {
   
   
     timeout : '50000',
     timeout : '50000',
 
 
-    api_key : '8C21178A017E712134B0FA9642F1ECDD049C13808219AF7EA4C8AFB0FF56AECA',
+    //api_key : '8C21178A017E712134B0FA9642F1ECDD049C13808219AF7EA4C8AFB0FF56AECA',
 
 
     ContentType : 'Content-Type'
     ContentType : 'Content-Type'
 }
 }

+ 122 - 11
src/views/tab_a/tabAll.vue

@@ -54,9 +54,9 @@
 	</div>	
 	</div>	
 
 
 	<van-grid :border="false" >
 	<van-grid :border="false" >
-		<van-grid-item icon="photo-o" text="场所活动" />
-		<van-grid-item icon="photo-o" text="私设聚会点" />
-		<van-grid-item icon="photo-o" text="信教群众异常" />
+		<van-grid-item icon="photo-o" text="场所活动" @click="getUser1"/>
+		<van-grid-item icon="photo-o" text="私设聚会点" @click="getUser2"/>
+		<van-grid-item icon="photo-o" text="信教群众异常" @click="getUser3"/>
 		<van-grid-item icon="photo-o" text="场所检查" />
 		<van-grid-item icon="photo-o" text="场所检查" />
 		<van-grid-item icon="photo-o" text="安防设施异常" />
 		<van-grid-item icon="photo-o" text="安防设施异常" />
 		<van-grid-item icon="photo-o" text="负责人会议" />
 		<van-grid-item icon="photo-o" text="负责人会议" />
@@ -81,6 +81,9 @@ import tool from "@/tool";
 		created(){
 		created(){
 			let id=this.$route.query.id;
 			let id=this.$route.query.id;
 			this.getSome();
 			this.getSome();
+			this.TokenLogin();
+			
+
 		},
 		},
 
 
 		methods:{
 		methods:{
@@ -88,26 +91,76 @@ import tool from "@/tool";
 				history.back();
 				history.back();
 			},
 			},
 
 
-			getSome(){
-	
+			
+
+			async TokenLogin(){
+
+				let that=this;
+
+				//SDK中 getToken() 方法获取免登token
+				// window.xm.getToken().then(async function(token){
+				// 	console.log(token);
+
+				// 	const inputForm ={
+				// 	'token': token
+				// 	}
+				// 	var res = await this.$API.yin.TokenLogin.get(inputForm);
+					
+				// })
+
+				
+				const inputForm ={
+					'token': "ssssssss"
+				}
+				var res = await this.$API.yin.TokenLogin.get(inputForm);
+				console.log(res);
 
 
+				//this.$store.commit('setUser',data);
 
 
 
 
-				//http://124.70.137.152:8095/api/accountApi/gettIsDealCount?username=admin
+				// if (res.type == 1) {
+				// 	this.$router.replace({
+				// 		path: "/main",
+				// 	});
+				// } else {
+				// 	Toast.fail(res.message);
+				// }
+
+			},
+
+
+			getSome(){
+	
+
 			},
 			},
 
 
 			async getsome2(){
 			async getsome2(){
+
+				let that=this;			
+				
+				//SDK中 getToken() 方法获取免登token
+				window.xm.getToken().then(function(token){
+					console.log(token);
+
+					that.con1="哈哈"+token;
+					window.xm.showToast({
+						message:that.con1
+					})
+
+				})
+
 				const inputForm ={
 				const inputForm ={
-					'username': '管理员',
-					'password': 'admin@2022',
-					'code': '',
-					'uuid': ''
+					'iamRequestId': '120010',
+					'iamRemoteUser': 'admin12022',
+					'iamRemotePwd': ''
 				  }
 				  }
 				// login(inputForm).then(({data}) => {
 				// login(inputForm).then(({data}) => {
 				// 	this.$store.commit('setUser',data);
 				// 	this.$store.commit('setUser',data);
 			   	// })
 			   	// })
 
 
-				var res = await this.$API.order.SaveOrder.post(inputForm);
+				//var res = await this.$API.yin.TokenLogin.post(inputForm);
+				var res = await this.$API.yin.SchemaService.post(inputForm);
+				
                 if (res.type == 1) {
                 if (res.type == 1) {
                     this.$router.replace({
                     this.$router.replace({
                         path: "/main",
                         path: "/main",
@@ -115,6 +168,7 @@ import tool from "@/tool";
                 } else {
                 } else {
                     Toast.fail(res.message);
                     Toast.fail(res.message);
                 }
                 }
+
 			},
 			},
 
 
 			async getsome3(){
 			async getsome3(){
@@ -128,6 +182,63 @@ import tool from "@/tool";
                 console.log(res);
                 console.log(res);
 			},
 			},
 
 
+
+			//用户数据同步测试用(用户保存)
+			async getUser1(){
+				const inputForm ={
+					'iamRequestId': '120010',
+					'iamRemoteUser': 'admin',
+					'iamRemotePwd': '11',
+					'loginName': 'yzt2',
+					'name': '同步用户2',
+					'password': '111',
+					'idcard': '320911199010000002',
+					'email': '818166662@qq.com',
+					'phone': '88868882',
+					'mobile': '1829999992',
+					'loginFlag': '1',
+					'photo': '',
+					'sign': '个性签名2',
+				  }
+				var res = await this.$API.yin.UserCreateService.post(inputForm);
+				
+                console.log(res);
+			},
+			//(用户更新)
+			async getUser2(){
+				const inputForm ={
+					'iamRequestId': '120010',
+					'iamRemoteUser': 'admin',
+					'iamRemotePwd': '11',
+					'uid': '1639158103696228354',
+					'loginName': 'yzt222',
+					'name': '11',
+					// 'password': '',
+					// 'idcard': '',
+					// 'email': '',
+					// 'phone': '',
+					// 'mobile': '',
+					// 'loginFlag': '',
+					// 'photo': '',
+					// 'sign': '',
+				  }
+				var res = await this.$API.yin.UserUpdateService.post(inputForm);
+				console.log(res);
+                
+			},
+			//(用户删除)
+			async getUser3(){
+				const inputForm ={
+					'iamRequestId': '120010',
+					'iamRemoteUser': 'admin',
+					'iamRemotePwd': '111',
+					'uid': '1639158103696228354',
+				  }
+				var res = await this.$API.yin.UserDeleteService.post(inputForm);				
+                console.log(res);
+				
+			},
+
 		},
 		},
 	 
 	 
 	};
 	};

+ 2 - 2
vue.config.js

@@ -8,8 +8,8 @@ module.exports = defineConfig({
     port:'8080',
     port:'8080',
     proxy:{
     proxy:{
       '/api':{
       '/api':{
-        target:'http://124.70.137.152:8095',// http://124.70.137.152:8095
-        //target:'http://localhost:8084',// 
+        //target:'http://124.70.137.152:8095',// http://124.70.137.152:8095
+        target:'http://localhost:8084',// 
         changeOrigin:true,
         changeOrigin:true,
         pathRewrite:{
         pathRewrite:{
           '^/api':'/'
           '^/api':'/'