Ver código fonte

新增修改身份

eraser 4 anos atrás
pai
commit
6a4c3ba801
4 arquivos alterados com 78 adições e 132 exclusões
  1. 0 23
      components/login/login.vue
  2. 1 0
      components/login/loginByPWD.vue
  3. 75 98
      components/manager/user.vue
  4. 2 11
      myData.js

+ 0 - 23
components/login/login.vue

@@ -10,50 +10,27 @@
 			</view>
 			<!-- 中间竖线 -->
 			<view class="login-middleline"></view>
-			<!-- <ChooseRole v-show="visibleChooseRole" v-on:onChoose="onChoose"></ChooseRole> -->
 			<LoginByPWD class="showborder" v-show="visibleLoginByPWD" v-on:onLogin="onLogin" v-on:onForget="onForget"></LoginByPWD>
-			<!-- <ResetPWD v-show="visibleResetPWD" v-on:onLogin="onLogin"></ResetPWD> -->
 		</view>
 	</view>
 </template>
 
 <script>
-	// import ChooseRole from './chooseRole.vue'
 	import LoginByPWD from './loginByPWD.vue'
-	// import ResetPWD from './resetPWD.vue'
 	export default {
 		components: {
-			// ChooseRole,
 			LoginByPWD,
-			// ResetPWD
 		},
 		data() {
 			return {
-				// visibleChooseRole: false,
 				visibleLoginByPWD: true,
-				// visibleResetPWD: false,
-				//当前登录类型T教师S学生
-				roleType: '',
 			}
 		},
 		methods: {
 			onLogin: function() {
-				// console.log("登录成功login");
 				this.$emit("onLogin");
-				// this.visibleChooseRole = false;
 				this.visibleLoginByPWD = false;
-				// this.visibleResetPWD = false;
 			},
-			// onChoose(type) {
-			// 	console.log("onChoose", type)
-			// 	this.roleType = type;
-			// 	this.visibleChooseRole = false;
-			// 	this.visibleLoginByPWD = true;
-			// },
-			// onForget() {
-			// 	this.visibleLoginByPWD = false;
-			// 	this.visibleResetPWD = true;
-			// }
 		}
 	}
 </script>

+ 1 - 0
components/login/loginByPWD.vue

@@ -70,6 +70,7 @@
 							console.log("登陆成功",this.account,data);
 							mydata_userInfo.account = this.account;
 							mydata_userInfo.userID=data.UserID;
+							mydata_userInfo.type=data.Type;
 							// console.log("登陆以后的用户信息",mydata_userInfo);
 							this.$emit("onLogin");
 						}

+ 75 - 98
components/manager/user.vue

@@ -14,6 +14,7 @@
 						<th>电话</th>
 						<th>ilab账户</th>
 						<th>注册时间</th>
+						<th>身份</th>
 						<th>分数</th>
 						<th>修改信息</th>
 						<th>删除</th>
@@ -28,6 +29,7 @@
 						<th>{{dataUser.PhoneNum}}</th>
 						<th>{{dataUser.IlabAccount}}</th>
 						<th>{{dataUser.SignTime}}</th>
+						<th>{{dataUser.Type}}</th>
 						<th>{{dataUser.TotalScore}}</th>
 						<th class="btn_bg"><button type="default" size="mini" class="m_edit" @click="modify(dataUser)">修改</button></th>
 						<th class="btn_bg"><button type="default" size="mini" class="m_delete" @click="deleteUser(dataUser)">删除</button></th>
@@ -133,7 +135,7 @@
 						for (let j = 0; j < UserScore.length; j++) {
 							
 							let ascore = Number(UserScore[j].Score);
-							console.log('ascore=',ascore)
+							// console.log('ascore=',ascore)
 							if (ascore!=-1) {
 								totalScore += ascore;
 							}
@@ -207,7 +209,7 @@
 							}
 						]					
 					}
-					console.log('添加用户data===',data)
+					// console.log('添加用户data===',data)
 					
 					uni.showLoading({
 					    title: '上传中'  
@@ -225,7 +227,36 @@
 							//100成功
 							if (res.data.Code == 100) {
 								console.log("添加用户成功", res);
-								_self.paging(_self.currentPage);
+								
+								data = {
+									"UserID":dataUser.Id,
+									"Type":content_arr[15].input,					
+								}
+								uni.request({
+									header: {
+										'Content-Type': 'application/json;charset=UTF-8'
+									},
+									url: mydata_api + '/user/setusertype',
+									method: 'POST',
+									data: data,
+									dataType: 'json',
+									success: (res) => {
+										//100成功
+										if (res.data.Code == 100) {
+											console.log("设置用户Type成功", res);
+											_self.paging(_self.currentPage);
+										}
+										//200失败
+										else {
+											console.log('设置用户Type失败200', res);	
+										}
+										uni.hideLoading();
+									},
+									fail: (res) => {
+										console.log("设置用户Type失败");
+										uni.hideLoading();
+									}
+								});
 							}
 							//200失败
 							else {
@@ -314,100 +345,13 @@
 						'name':'证件号码',
 						'input':'',
 						'type' :'text'
+					},
+					{
+						'name':'身份',
+						'input':'学生',
+						'type' :'text'
 					}
 				],callback);
-				// this.$refs.popForm.setContent([
-				// 	{
-				// 		'name':'Ilab账号',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'设置用户',
-				// 		'input':mydata_userInfo.userID,
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'被设置用户ID',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'姓名',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'学校',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'院系',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'专业',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'班级',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'学号',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'Post',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'职务',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'电话',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'邮箱',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'民族',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'政治面貌',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'籍贯',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'证件类型',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	},
-				// 	{
-				// 		'name':'证件号码',
-				// 		'input':'',
-				// 		'type' :'text'
-				// 	}
-				// ],callback);	
 			},
 			modify(dataUser)
 			{
@@ -453,7 +397,36 @@
 								//100成功
 								if (res.data.Code == 100) {
 									console.log("修改用户信息成功", res);
-									_self.paging(_self.currentPage);
+									
+									data = {
+										"UserID":dataUser.Id,
+										"Type":content_arr[4].input,					
+									}
+									uni.request({
+										header: {
+											'Content-Type': 'application/json;charset=UTF-8'
+										},
+										url: mydata_api + '/user/setusertype',
+										method: 'POST',
+										data: data,
+										dataType: 'json',
+										success: (res) => {
+											//100成功
+											if (res.data.Code == 100) {
+												console.log("设置用户Type成功", res);
+												_self.paging(_self.currentPage);
+											}
+											//200失败
+											else {
+												console.log('设置用户Type失败200', res);	
+											}
+											uni.hideLoading();
+										},
+										fail: (res) => {
+											console.log("设置用户Type失败");
+											uni.hideLoading();
+										}
+									});
 								}
 								//200失败
 								else {
@@ -466,8 +439,7 @@
 								console.log("修改用户信息失败");
 								uni.hideLoading();
 							}
-						});
-					
+						});			
 				};
 				this.$refs.popForm.setContent([
 					
@@ -490,6 +462,11 @@
 						'name':'电话',
 						'input':dataUser.PhoneNum,
 						'type' :'text'
+					},
+					{
+						'name':'身份',
+						'input':dataUser.Type,
+						'type' :'text'
 					}
 				],callback);
 			},

+ 2 - 11
myData.js

@@ -11,17 +11,8 @@ topMenuS = {
 }
 mydata_userInfo={
 	"account":null,
-	"UserID":''
+	"UserID":'',
+	type:'',
 }
-// mydata_userInfo = {
-// 	"account":null,
-// 	"avatarSrc": require('assets/login/loginPic3.png'),
-// 	"role": '老师',
-// 	"Name": "张林",
-// 	"UserID": "12321zxc",
-// 	"email":'',
-// 	"Position":''
-// }
 
-// mydata_api='http://39.105.166.141:8085'
 mydata_api='http://8.140.128.1:8085'