eraser 4 лет назад
Родитель
Сommit
9ce69d6282

+ 36 - 10
components/home/teacher/create.vue

@@ -71,16 +71,42 @@
 					alert("请输入项目类型~");
 					return false;
 				}
-				let data = {
-					"CreateUserID":mydata_userInfo.UserID,
-					"ProjectName":this.model.projectName,
-					"Describe":this.model.describe,
-					"Type":this.model.type
-				}
-				console.log("请求创建项目",data);
-				MyRequest.CreateProjectNew(data,function(res){
-					console.log("创建项目成功",res);
-				},null);
+				// let data = {
+				// 	"CreateUserID":mydata_userInfo.UserID,
+				// 	"ProjectName":this.model.projectName,
+				// 	"Describe":this.model.describe,
+				// 	"Type":this.model.type
+				// }
+				// console.log("请求创建项目",data);
+				// MyRequest.CreateProjectNew(data,function(res){
+				// 	console.log("创建项目成功",res);
+				// },null);
+
+				console.log("创建项目自己ID",mydata_userInfo.UserID);
+				uni.chooseImage({
+					success: (chooseImageRes) => {
+						const tempFilePaths = chooseImageRes.tempFilePaths;
+						uni.uploadFile({
+							url: 'http://39.105.166.141:8085/project/createprojectnew', //仅为示例,非真实的接口地址
+							filePath: tempFilePaths[0],
+							name: 'file',
+							formData: {
+								"CreateUserID": mydata_userInfo.UserID,
+								// "CreateUserID":"1e9c969f-8990-40f2-8a8c-ecbafc5720b2",
+								"ProjectName": this.model.projectName,
+								"Describe": this.model.describe,
+								"Type": this.model.type
+							},
+							success: (uploadFileRes) => {
+								console.log('upload ok=', uploadFileRes.data);
+								alert("创建成功");
+								this.model.projectName='';
+								this.model.describe='';
+								this.model.type='科幻';
+							}
+						});
+					}
+				});
 			},
 			clear() {
 				this.model = {

+ 4 - 1
components/home/teacher/project.vue

@@ -8,7 +8,7 @@
 					<view class="m_row_link">
 
 					</view>
-					<view class="m_row_title" v-text="'成员管理'">
+					<view class="m_row_title" v-text="'项目管理'">
 
 					</view>
 					<view style="position: relative;margin-left: 40rpx;">
@@ -279,6 +279,9 @@
 					}
 				})
 
+			},
+			viewProject(obj) {
+				this.projectData = [obj];
 			}
 		}
 	}

+ 10 - 7
components/home/teacher/table.vue

@@ -14,11 +14,11 @@
 				</thead>
 				<tbody>
 					<tr v-for="(item,index) in tabledata" :key="index">
+						<th>{{'项目'+(index+1)}}</th>
 						<th>{{item.ProjectName}}</th>
-						<th></th>
-						<th></th>
+						<th>{{item.Type}}</th>
 						<th>{{item.CreateUserName}}</th>
-						<th style="position: relative;"><button type="default" @click="find(item)" size="mini" class="m_delete">查看</button></th>
+						<th style="position: relative;"><button type="default" @click="find(item,index)" size="mini" class="m_delete">查看</button></th>
 					</tr>
 				</tbody>
 			</table>
@@ -59,7 +59,8 @@
 				uni.request({
 					url: this.$Api + "/project/getprojects",
 					data: {
-						"UserID": this.$UserId
+						// "UserID": this.$UserId
+						"UserID": mydata_userInfo.UserID
 					},
 					method: "POST",
 					dataType: "json",
@@ -67,12 +68,14 @@
 						var {
 							data
 						} = res;
-						this.tabledata = res.Projects
+						this.tabledata = res.data.Projects
+						console.log("table页面请求所有项目",res);
 					}
 				})
 			},
-			find(obj){
-				
+			//查看项目
+			find(obj,index){
+				this.$emit('viewProject',obj,index)
 			}
 		}
 	}

+ 15 - 14
components/home/teacherCreation.vue

@@ -30,14 +30,14 @@
 		</view>
 
 		<scroll-view class="rightBox" scroll-y="true" :scroll-top="scrollTop" @scroll="scroll">
-		<!-- <view class="rightBox"> -->
+			<!-- <view class="rightBox"> -->
 			<!-- showboder -->
 			<teacher ref="teacher" v-show="index==1" @paging="paging"></teacher>
 			<create ref="create" v-show="index==3"></create>
-			<vtable ref="table" v-show="index==2"></vtable>
+			<vtable ref="table" v-show="index==2" v-on:viewProject='viewProject'></vtable>
 			<project ref="project" v-show="index==4"></project>
 			<location ref="location" v-show="index==2||index==4"></location>
-		<!-- </view> -->
+			<!-- </view> -->
 		</scroll-view>
 	</view>
 </template>
@@ -69,7 +69,7 @@
 					title: '选择项目',
 					list: [{
 						id: 4,
-						title: "项目",
+						title: "项目",
 						select: false
 					}]
 				}],
@@ -100,13 +100,8 @@
 					obj.select = true;
 				}
 
-				if(obj.id==2){
-					let data={
-						"UserID" : mydata_userInfo.account,
-					}
-					MyRequest.GetProjects(data,function(res){
-						console.log("请求所有项目成功",res);
-					},null);
+				if (obj.id == 2) {
+					this.$refs.table.getList();
 				}
 			},
 			paging(obj) {
@@ -126,6 +121,12 @@
 				this.$nextTick(() => {
 					this.scrollTop = 0
 				});
+			},
+			viewProject(obj, index) {
+				console.log("查看项目", obj, index);
+				this.menu[1].list[0].title = '项目' + (index + 1);
+				this.checkMenu(this.menu[1].list[0],1);
+				this.$refs.project.viewProject(obj);
 			}
 		}
 	}
@@ -133,9 +134,9 @@
 
 <style scoped lang="scss">
 	@import '../../assets/icon/iconfont.css';
-	
-	.rightBox{
-		flex:1;
+
+	.rightBox {
+		flex: 1;
 	}
 
 	.m_menu_right {

+ 20 - 0
pages/home.vue

@@ -160,6 +160,26 @@
 				// console.log("登陆成功home");
 				this.$refs.TopMenu.switchLoginState(true);
 				this.showPage(4);
+
+				// uni.chooseImage({
+				// 	success: (chooseImageRes) => {
+				// 		const tempFilePaths = chooseImageRes.tempFilePaths;
+				// 		uni.uploadFile({
+				// 			url: 'http://39.105.166.141:8085/project/createprojectnew', //仅为示例,非真实的接口地址
+				// 			filePath: tempFilePaths[0],
+				// 			name: 'file',
+				// 			formData: {
+				// 				'CreateUserID': 'lyy22', // 创建用户 id
+				// 				'ProjectName': 'test22', // 项目名称
+				// 				'Describe': 'aaa22', // 项目描述
+				// 				'Type': 'bbbbb22', // 科幻 现实 历史 主旋律 纪录片
+				// 			},
+				// 			success: (uploadFileRes) => {
+				// 				console.log('upload ok=', uploadFileRes.data);
+				// 			}
+				// 		});
+				// 	}
+				// });
 			},
 			showPage(index) {
 				this.curShowPage = index;