소스 검색

Merge branch 'master' of http://81.70.224.233:10080/yichael/ZhongChuang_front_2

eraser 4 년 전
부모
커밋
c1fb791b1d
5개의 변경된 파일161개의 추가작업 그리고 20개의 파일을 삭제
  1. 3 0
      App.vue
  2. 142 19
      components/home/simulationCore.vue
  3. 4 0
      components/home/sy.vue
  4. 1 0
      components/login/login.vue
  5. 11 1
      pages/home.vue

+ 3 - 0
App.vue

@@ -7,6 +7,9 @@
 <script>
 	import Home from './pages/home.vue'
 	export default {
+		globalData:{
+			bLogin:false,
+		},
 		data() {
 			return {}
 		},

+ 142 - 19
components/home/simulationCore.vue

@@ -13,8 +13,11 @@
 				</view>
 			</view>
 		</view>
-
 		<view class="s_footer" style="text-align: center;padding: 80rpx;">
+			<button size="mini" class="m_btn_download" style="" @click="goToProjectMange">进入项目管理中心</button>
+		</view>
+		
+		<!-- <view class="s_footer" style="text-align: center;padding: 80rpx;">
 			<view class="s_title" v-text="'推荐项目'">
 
 			</view>
@@ -26,26 +29,24 @@
 							<th>名称</th>
 							<th>类型</th>
 							<th>介绍</th>
-							<th>进度</th>
 							<th>项目文件</th>
 							<th>项目成员</th>
 						</tr>
 					</thead>
 					<tbody>
 						<tr v-for="(item,index) in projectData" :key="index">
+							<th>{{item.Id}}</th>
 							<th>{{item.ProjectName}}</th>
-							<th>{{item.ProjectName}}</th>
-							<th>类型</th>
-							<th>介绍</th>
-							<th>进度</th>
-							<th class="m_yl"><button type="default" size="mini" class="m_edit">预览</button></th>
-							<th style="position: relative;"><button type="default" @click="projectRemove(item)" size="mini" class="m_delete">删除</button></th>
+							<th>{{item.Type}}</th>
+							<th>{{item.Intro}}</th>
+							<th class="m_yl"><button type="default" size="mini" class="m_edit" @click="preview(item)">预览</button></th>
+							<th style="position: relative;"><button type="default" @click="deleteMember(item)" size="mini" class="m_delete">删除</button></th>
 						</tr>
 					</tbody>
 				</table>
 			</view>
 
-		</view>
+		</view> -->
 	</view>
 </template>
 
@@ -57,27 +58,140 @@
 				projectData: []
 			}
 		},
-		created() {
-			this.getlist();
-		},
+		
 		methods: {
-			getlist() {
+			init(){
+				console.log('simulationCore init');
+				// uni.chooseFile({
+				//     success: (chooseImageRes) => {
+				//         const tempFilePaths = chooseImageRes.tempFilePaths;
+				//         uni.uploadFile({
+				//             url: this.$Api + "/project/uploadprojectfile", //仅为示例,非真实的接口地址
+				//             filePath: tempFilePaths[0],
+				//             name: 'file',
+				//             formData: {
+				// 				'UserID':'1e9c969f-8990-40f2-8a8c-ecbafc5720b2',                // 创建用户 id
+				// 				'Name':'11',           // 项目名称
+				// 				'Type':'11',              // 项目描述
+				// 				'ProjectID':'2',                 // 科幻 现实 历史 主旋律 纪录片
+				//             },
+				//             success: (uploadFileRes) => {
+				//                 console.log('upload ok=',uploadFileRes.data);
+				//             }
+				//         });
+				//     }
+				// });
+				// this.getProjectsID();
+			},
+			goToProjectMange(){
+				
+			},
+			getProjectsID() {
+				// console.log('userID=',this.$UserId)
 				uni.request({
-					url: this.$Api + "/project/getprojectcontent",
+					url: this.$Api + "/project/getprojects",
 					data: {
 						"UserID": this.$UserId
 					},
 					method: "POST",
 					dataType: "json",
 					success: res => {
-						var {
-							data
-						} = res;
-						this.projectData = data.Project;
-
+						// console.log('res=',res)
+						console.log('Projects=',res.data.Projects)
+						let Projects = res.data.Projects;
+						for(let i=0;i<Projects.length;i++)
+						{
+							let data = {};
+							data.Id = Projects[i].Id;
+							data.ProjectName = Projects[i].ProjectName;
+							data.Type = Projects[i].Type;
+							data.Intro = '';
+							data.File = [];
+							data.Member = [];
+							this.projectData.push(data);
+						}
+						
+						for(let i=0;i<this.projectData.length;i++)
+						{
+							this.getProjectsCtcontent(i);
+						}
 					}
 				})
 			},
+			getProjectsCtcontent(index) {
+				// console.log('UserID=',this.$UserId)
+				// console.log('ProjectID=',this.projectData[index].Id)
+			
+				uni.request({
+					url: this.$Api + "/project/getprojectcontent",
+					data: {
+						"UserID": this.$UserId,
+						"ProjectID": this.projectData[index].Id
+					},
+					method: "POST",
+					dataType: "json",
+					success: res => {
+						console.log('res=',res)
+						if(res.data.ProjectItem.length!=0)
+						{
+							this.projectData[index].Intro = res.data.ProjectItem[0].Type;
+							this.projectData[index].File = res.data.ProjectItem[0].URL;
+						}
+						
+						this.getMember(index);
+					}
+				})
+			},
+			getMember(index) {
+				uni.request({
+					url: this.$Api + "/project/getmember",
+					data: {
+						"ProjectID": this.projectData[index].Id
+					},
+					method: "POST",
+					dataType: "json",
+					success: res => {
+						// console.log('res=',res)
+						// console.log('Projects=',res.data.Users[0].User.Id)
+						for(let i=0;i<res.data.Users.length;i++)
+						{
+							console.log('Projects=',res.data.Users[i].User.Id)
+							this.projectData[index].Member.push(res.data.Users[i].User.Id);
+						}
+					}
+				})
+			},
+			preview(item){
+				uni.downloadFile({
+					url: item.File,
+					success: (res) => {
+						if (res.statusCode === 200) {
+							uni.openDocument({
+								filePath: res.tempFilePath, 
+								// 如果文件名包含中文,建议使用escape(res.tempFilePath)转码,防止ios和安卓客户端导致的差异
+								success: function(res) {
+									console.log('打开文档成功');
+								}
+							});
+						}
+					},
+				});
+			},
+			deleteMember(item){
+				uni.request({
+					url: this.$Api + "/project/deletemember",
+					data: {
+						"userID" : this.$UserId,
+						"DeleteUserID":item.Id
+					},
+					method: "POST",
+					dataType: "json",
+					success: res => {
+						console.log('res=',res)
+						// this.projectData.splice(index,index);
+					}
+				})
+			}
 		}
 	}
 </script>
@@ -182,4 +296,13 @@
 		line-height: 120rpx;
 		font-size: 40rpx;
 	}
+	
+	.m_btn_download {
+		height: 80rpx;
+		line-height: 80rpx;
+		padding: 0 70rpx;
+		background: #EA252C;
+		color: #fff;
+		font-family: MicrosoftYaHei;
+	}
 </style>

+ 4 - 0
components/home/sy.vue

@@ -89,6 +89,10 @@
 				this.$forceUpdate()
 			},
 			onClick_menu(index) {
+				if(!getApp().globalData.bLogin) {
+					alert('请先登录')
+					return
+				};
 				this.showIndex = index;
 			},
 			onClick_menu_btn(index) {

+ 1 - 0
components/login/login.vue

@@ -44,6 +44,7 @@
 			},
 			onLogin: function() {
 				// console.log("登录成功login");
+				getApp().globalData.bLogin = true;
 				this.$emit("onLogin");
 				this.visibleChooseRole = false;
 				this.visibleLoginByPWD = false;

+ 11 - 1
pages/home.vue

@@ -136,6 +136,10 @@
 		},
 		methods: {
 			onTopSYClick(index) {
+				if(!getApp().globalData.bLogin) {
+					alert('请先登录')
+					return
+				};
 				// console.log("点击了首页标题", index, myData_QXZB_SYQY.length);
 				let pageIndex = -1;
 				switch (index) {
@@ -157,7 +161,7 @@
 				this.showPage(pageIndex);
 			},
 			onLogin: function() {
-				// console.log("登陆成功home");
+				console.log("登陆成功home");
 				this.$refs.TopMenu.switchLoginState(true);
 				this.showPage(4);
 
@@ -312,6 +316,10 @@
 			},
 			//顶部导航左上角icon点击事件
 			onTopMenuIconClick() {
+				if(!getApp().globalData.bLogin) {
+					alert('请先登录')
+					return
+				};
 				let indexArr = [];
 				switch (this.curShowPage) {
 					case 0: //登录
@@ -465,6 +473,7 @@
 					case 2: //管理中心
 						targetPage = 11;
 						topMiddleState = topMenuS.home3;
+						this.$refs.simulationcore.init();
 						break;
 					case 3: //拍摄基地
 						targetPage = 12;
@@ -475,6 +484,7 @@
 				}
 				this.showPage(targetPage);
 				this.$refs.TopMenu.switchMiddleState(topMiddleState, index);
+				
 				this.$forceUpdate();
 			},
 			//项目管理平台