Tang há 4 anos atrás
pai
commit
6a04ca66a6
5 ficheiros alterados com 122 adições e 42 exclusões
  1. 17 5
      common/methodTool.js
  2. 21 4
      components/home.vue
  3. 10 4
      components/recruitment.vue
  4. 72 13
      pages2/plan/edit.vue
  5. 2 16
      pages2/wd/avatar.vue

+ 17 - 5
common/methodTool.js

@@ -9,6 +9,17 @@ export default {
 			return false
 		}
 	},
+	//提示
+	showToast(title, icon = 'none', time = 2000) {
+		return setTimeout(() => {
+			uni.showToast({
+				title: title,
+				icon: icon,
+				duration: time
+			})
+		}, 500)
+	},
+	//图片路径填补
 	splitImgHost(url) {
 		if (!url) {
 			return ''
@@ -34,21 +45,22 @@ export default {
 		var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
 		var Y = date.getFullYear() + '-';
 		var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
-		var D = date.getDate() + ' ';
-		var h = date.getHours() + ':';
-		var m = date.getMinutes() + ':';
-		var s = date.getSeconds();
+		var D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' ';
+		var h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
+		var m = date.getMinutes() < 10 ? '0' + date.getMinutes() + ':': date.getMinutes() + ':';
+		var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
 		if (isDay) {
 			return Y + M + D;
 		}
 		return Y + M + D + h + m + s;
 	},
+	//当前时间距离目标时间还有多久
 	GetRTime(EndTime) {
 		var EndTime = EndTime //结束时间
 		var NowTime = new Date(); //当前时间
 		//后台给我的是10位 精确到秒的 所有下面我就除以了1000,不要小数点后面的
 		var t = EndTime - (NowTime.getTime() / 1000).toFixed(0);
-		if(t <= 0){
+		if (t <= 0) {
 			return '已结束'
 		}
 		//如果后台给的是毫秒 上面不用除以1000 下面的计算时间也都要除以1000 这里我去掉1000了

+ 21 - 4
components/home.vue

@@ -92,7 +92,10 @@
 				</view>
 				<!-- 课程列表-->
 				<view v-if="current == 0">
-					<view @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list1" :key="index">
+					<view v-if="list1.length === 0">
+						<u-empty  margin-top="150" text="暂无课程" mode="data"></u-empty>
+					</view>
+					<view v-else @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list1" :key="index">
 						<image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
 						<view class="list_content">
 							<view style="margin-left: 280rpx;margin-top: 10rpx;">
@@ -102,10 +105,15 @@
 							</view>
 						</view>
 					</view>
+					<u-divider v-if="paramList[0].showStatus && list1.length !== 0" margin-top="42">到底了</u-divider>
+					<!-- <view v-if="paramList[0].showStatus && list1.length !== 0" style="text-align: center;margin-top: 24rpx;">到底啦~</view> -->
 				</view>
 				<!-- 题库列表-->
 				<view v-if="current == 1">
-					<view @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list2" :key="index">
+					<view v-if="list2.length === 0">
+						<u-empty  margin-top="150" text="暂无题库" mode="data"></u-empty>
+					</view>
+					<view v-else @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list2" :key="index">
 						<image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
 						<view class="list_content">
 							<view style="margin-left: 280rpx;margin-top: 10rpx;">
@@ -115,10 +123,15 @@
 							</view>
 						</view>
 					</view>
+					<u-divider v-if="paramList[1].showStatus && list2.length !== 0" margin-top="42">到底了</u-divider>
+					<!-- <view v-if="paramList[1].showStatus && list2.length !== 0" style="text-align: center;margin-top: 24rpx;">到底啦~</view> -->
 				</view>
 				<!-- 重点列表-->
 				<view v-if="current == 2">
-					<view @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list3" :key="index">
+					<view v-if="list3.length === 0">
+						<u-empty  margin-top="150" text="暂无重点考点" mode="data"></u-empty>
+					</view>
+					<view v-else @click="jumpDetail(item)" class="list_box" v-for="(item, index) in list3" :key="index">
 						<image :src="$method.splitImgHost(item.coverUrl)" class="list_img"></image>
 						<view class="list_content">
 							<view style="margin-left: 280rpx;margin-top: 10rpx;">
@@ -128,8 +141,9 @@
 							</view>
 						</view>
 					</view>
+					<u-divider v-if="paramList[2].showStatus && list3.length !== 0" margin-top="42">到底了</u-divider>
+					<!-- <view v-if="paramList[2].showStatus && list3.length !== 0" style="text-align: center;margin-top: 24rpx;">到底啦~</view> -->
 				</view>
-				<view v-if="paramList[current].showStatus" style="text-align: center;margin-top: 24rpx;">到底啦~</view>
 			</view>
 			
 		</scroll-view>
@@ -529,9 +543,12 @@ export default {
 			this.cateActiveIndex1 = 0
 			this.cateActiveIndex2 = null
 			this.cateActiveIndex3 = null
+			this.alint()
+			this.show = false
 		},
 		searchPageInfos(){
 			if(this.cateActiveIndex1 === null || this.cateActiveIndex1 === 0){
+				this.paramList[0].categoryId = ''
 				this.show = false
 				this.alint()
 			}else{

+ 10 - 4
components/recruitment.vue

@@ -48,7 +48,10 @@
 				</view>
 			</view>
 			<view v-if="current === 0">
-				<view class="boxsize lines" v-for="(item, index) in posts" :key="index" @click="jumpDetails(item)">
+				<view v-if="posts.length === 0">
+					<u-empty  margin-top="150" text="暂无岗位" mode="data"></u-empty>
+				</view>
+				<view v-else class="boxsize lines" v-for="(item, index) in posts" :key="index" @click="jumpDetails(item)">
 					<view class="top_sty">
 						<view>
 							<view class="heasd">
@@ -70,10 +73,13 @@
 						<view class="right_address">{{ item.city }}•{{ item.district }}</view>
 					</view>
 				</view>
-				<u-divider v-if="total == posts.length">到底啦</u-divider>
+				<u-divider v-if="total == posts.length && posts.length !== 0">到底啦</u-divider>
 			</view>
 			<view v-if="current === 1">
-				<view class="boxsize" v-for="(item, index) in enterprise" :key="index">
+				<view v-if="enterprise.length === 0">
+					<u-empty  margin-top="150" text="暂无岗位" mode="data"></u-empty>
+				</view>
+				<view v-else class="boxsize" v-for="(item, index) in enterprise" :key="index">
 					<view class="dis_flexs" @click="jumpCompany(item)">
 						<view class="imgboxs"><image style="width: 100%; height: 100%;" :src="$method.splitImgHost(item.logoUrl)" mode=""></image></view>
 						<view style="flex: 1;">
@@ -90,7 +96,7 @@
 						<view class="moreLs" v-if="item.recruitNeedsVoList.length > 3" @click="jumpDetails(item.recruitNeedsVoList[0])">•••</view>
 					</view>
 				</view>
-				<u-divider v-if="total1 == enterprise.length">到底啦</u-divider>
+				<u-divider v-if="total1 == enterprise.length && enterprise.length !== 0">到底啦</u-divider>
 			</view>
 		</scroll-view>
 		<u-popup v-model="show" border-radius="14">

+ 72 - 13
pages2/plan/edit.vue

@@ -61,7 +61,7 @@
 						<view style="display: flex;align-items: center;">
 							<u-checkbox
 								:disabled="item.disabled"
-								@change="checkboxChange"
+								@change="checkboxChange(item)"
 								shape="circle"
 								active-color="#32467B"
 								v-model="item.checked"
@@ -156,6 +156,7 @@ export default {
 	onShow() {},
 	methods: {
 		resultForm() {
+			var self = this
 			if (this.list.length == 0) {
 				uni.showModal({
 					title: '提示',
@@ -218,8 +219,9 @@ export default {
 							}
 						}
 					});
+				}else{
+					self.$method.showToast(result.data.msg,'error')
 				}
-				console.log(result);
 			});
 		},
 		getMyCourse() {
@@ -253,7 +255,7 @@ export default {
 					this.form.time = res.data.data[0].reminderTime;
 					this.form.startDate = this.$method.timestampToTime(res.data.data[0].startTime);
 					this.form.endDate = this.$method.timestampToTime(res.data.data[0].endTime);
-					this.index_review = res.data.data[0].studyDay;
+					this.index_review = res.data.data[0].studyDay - 1;
 					this.form.week = res.data.data[0].studyCount;
 					this.form.category = res.data.data[0].coursePlanVo[0].categoryName;
 					this.list = res.data.data[0].coursePlanVo;
@@ -335,26 +337,79 @@ export default {
 		},
 		submit() {
 			let that = this;
+			var arrays = [];
 			this.list2.map(val => {
 				if (val.checked) {
-					that.list.push(val);
+					arrays.push(val);
 				}
 			});
-			this.checkSameItem();
+			this.list = arrays;
 			this.show = false;
-			this.form.category = this.list[0].categoryName;
+			if (arrays.length !== 0) {
+				this.form.category = this.list[0].categoryName;
+			}else{
+				this.form.category = '';
+			}
+			// return;
+			// this.list2.map(val => {
+			// 	if (val.checked) {
+			// 		that.list.push(val);
+			// 	}
+			// });
+			// this.checkSameItem();
+			// this.show = false;
+			// this.form.category = this.list[0].categoryName;
+		},
+		checkboxChange(item) {
+			var self = this;
+			this.$nextTick(function() {
+				if (item.checked) {
+					self.list2.forEach((items, indexs) => {
+						if (items.categoryId !== item.categoryId) {
+							items.disabled = true;
+						}
+					});
+				} else {
+					var astatus = false;
+					self.list2.forEach((items, indexs) => {
+						if (items.checked) {
+							astatus = true;
+						}
+					});
+					if (!astatus) {
+						self.list2.map((items, indexs) => {
+							items.disabled = false;
+						});
+					}
+				}
+				// this.list2.map(val => {
+				// 	if (val.categoryId !== item.categoryId) {
+				// 		val.disabled = true;
+				// 	}
+				// });
+			});
 		},
-		checkboxChange(e) {},
 		checkSameItem() {
-			this.list2.map(val => {
-				val.disabled = false;
-				this.list.map(val1 => {
-					if (val.id == val1.id) {
-						val.disabled = true;
+			var self = this;
+			this.list2.map((item, index) => {
+				self.list.map(val => {
+					if (item.courseId === val.courseId) {
+						item.checked = true;
+					}
+					if (item.categoryId !== val.categoryId) {
+						item.disabled = true;
 					}
-					val.checked = false;
 				});
 			});
+			// this.list2.map(val => {
+			// 	val.disabled = false;
+			// 	self.list.map(val1 => {
+			// 		if (val.courseId == val1.courseId || val.categoryId !== val1.categoryId) {
+			// 			val.disabled = true;
+			// 		}
+			// 		val.checked = false;
+			// 	});
+			// });
 		},
 		delItem(index) {
 			this.list.splice(index, 1);
@@ -366,6 +421,10 @@ export default {
 		},
 		openSel() {
 			this.show = true;
+			this.list2.forEach((item, index) => {
+				item.checked = false;
+				item.disabled = false;
+			});
 			this.checkSameItem();
 		}
 	}

+ 2 - 16
pages2/wd/avatar.vue

@@ -73,10 +73,7 @@
 					self.$api.aliyunpolicy(data).then(res => {
 						var ossToken = res.data.data.resultContent;
 						if(ossToken.host==null||ossToken.host==undefined){
-							uni.showToast({
-								title: '上传路径报错'+ossToken,
-								icon: 'none'
-							});
+							self.$method.showToast('上传路径报错'+ossToken)
 							return
 						}
 						uni.uploadFile({
@@ -97,11 +94,6 @@
 							},
 							success: result => {
 								if (result.statusCode === 200) {
-									uni.showToast({
-										title: '成功',
-										icon: 'none',
-										duration:2000
-									});
 									self.userInfo.avatar = ossToken.dir;
 									resolve();
 								} else {
@@ -127,13 +119,7 @@
 				let self = this
 				this.$api.appuserInfo(this.userInfo).then(res => {
 					if (res.data.code === 200) {
-						setTimeout(()=>{
-							uni.showToast({
-								title: '提交成功',
-								icon: 'none'
-							});
-						},500);
-						
+						self.$method.showToast('提交成功')
 						self.$api.refreshUserInfo()
 					}
 				});