Browse Source

add is public display

yichael 4 years ago
parent
commit
1f76fb4945
3 changed files with 39 additions and 19 deletions
  1. 14 18
      components/home/teacher/create.vue
  2. 16 0
      components/home/teacher/table.vue
  3. 9 1
      components/student/table.vue

+ 14 - 18
components/home/teacher/create.vue

@@ -8,7 +8,7 @@
 					<input class="form-input"  style="width: 70%;margin-left: -6%;" v-model="model.projectName" name="input" placeholder="请输入项目名称" />
 					<checkbox-group>
 					    <label>
-					        <checkbox value="check-is-public" @click="onClickCheck" :checked="bPublic" />是否为公共项目
+					        <checkbox @click="onClickCheck" :checked="bPublic" />是否为公共项目
 					    </label>
 					</checkbox-group>
 				</view>
@@ -76,18 +76,14 @@
 					alert("请输入项目类型~");
 					return false;
 				}
-				// let data = {
-				// 	"CreateUserID":mydata_userInfo.UserID,
-				// 	"ProjectName":this.model.projectName,
-				// 	"Describe":this.model.describe,
-				// 	"Type":this.model.type
-				// }
-				// console.log("请求创建项目",data);
-
-				console.log("创建项目用户ID",mydata_userInfo.UserID);
+				
 				uni.chooseImage({
 					success: (chooseImageRes) => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
+						
+						
+						let isPublic = Number(this.bPublic);
+						console.log('1111=',isPublic)
 						uni.uploadFile({
 							url: mydata_api + '/project/createprojectnew', //仅为示例,非真实的接口地址
 							filePath: tempFilePaths[0],
@@ -97,7 +93,7 @@
 								"ProjectName": this.model.projectName,
 								"Describe": this.model.describe,
 								"Type": this.model.type,
-								"IsPublic":parseInt(this.bPublic)
+								"IsPublic":isPublic
 							},
 							success: (uploadFileRes) => {
 								console.log('upload ok=', uploadFileRes.data);
@@ -125,13 +121,13 @@
 				this.model.type = this.proType[this.index_proType];
 				console.log(this.model)
 			},
-			// onClickCheck(e){
-			// 	if(this.bPublic==true){
-			// 		this.bPublic = false;
-			// 	} else {
-			// 		this.bPublic = true;
-			// 	}	
-			// }
+			onClickCheck(e){
+				if(this.bPublic==true){
+					this.bPublic = false;
+				} else {
+					this.bPublic = true;
+				}	
+			}
 		}
 	}
 </script>

+ 16 - 0
components/home/teacher/table.vue

@@ -10,6 +10,7 @@
 						<th>类型</th>
 						<th>创建人</th>
 						<th>查看</th>
+						<th>是否为公共</th>
 					</tr>
 				</thead>
 				<tbody>
@@ -19,6 +20,13 @@
 						<th>{{item.Type}}</th>
 						<th>{{item.CreateUserName}}</th>
 						<th style="position: relative;"><button type="default" @click="find(item,index)" size="mini" class="m_delete">查看</button></th>
+						<th>
+							<checkbox-group>
+								<label>
+									<checkbox :checked="Boolean(item.IsPublic)" @click="onClickCheck"/>
+								</label>
+							</checkbox-group>
+						</th>
 					</tr>
 				</tbody>
 			</table>
@@ -55,6 +63,7 @@
 					dataType: "json",
 					success: res => {
 						this.tabledata = res.data.Projects
+						console.log('tabledata=',this.tabledata)
 						// let aData = {
 						// 	"CreateTime": "2020-01-01 00:00:00",
 						// 	"CreateUserID": "59458299-3b84-4895-98f6-b990cdaedc72",
@@ -75,6 +84,13 @@
 			//查看项目
 			find(obj,index){
 				this.$emit('viewProject',obj,index);
+			},
+			onClickCheck(e){
+				if(this.bPublic==true){
+					this.bPublic = false;
+				} else {
+					this.bPublic = true;
+				}	
 			}
 		}
 	}

+ 9 - 1
components/student/table.vue

@@ -10,6 +10,7 @@
 						<th>类型</th>
 						<th>创建人</th>
 						<th>查看</th>
+						<th>是否为公共</th>
 					</tr>
 				</thead>
 				<tbody>
@@ -19,6 +20,13 @@
 						<th>{{item.Type}}</th>
 						<th>{{item.CreateUserName}}</th>
 						<th style="position: relative;"><button type="default" @click="find(item,index)" size="mini" class="m_delete">查看</button></th>
+						<th>
+							<checkbox-group>
+								<label>
+									<checkbox :checked="Boolean(item.IsPublic)" disabled="false"/>
+								</label>
+							</checkbox-group>
+						</th>
 					</tr>
 				</tbody>
 			</table>
@@ -50,7 +58,7 @@
 					success: res => {
 			
 						this.tabledata = res.data.Projects
-						// console.log('tabledata=',this.tabledata)
+						console.log('tabledata=',this.tabledata)
 						// let aData = {
 						// 	"CreateTime": "2020-01-01 00:00:00",
 						// 	"CreateUserID": "59458299-3b84-4895-98f6-b990cdaedc72",