瀏覽代碼

前端更新sdy

zhongtianhaoyuan 3 年之前
父節點
當前提交
5e1903786e
共有 3 個文件被更改,包括 129 次插入89 次删除
  1. 27 7
      pages/grain_pulse/dynamic.vue
  2. 61 38
      pages/grain_pulse/record.vue
  3. 41 44
      pages/grain_pulse/release.vue

+ 27 - 7
pages/grain_pulse/dynamic.vue

@@ -71,7 +71,8 @@
 				currentPage: 1,
 				pageSize: 10,
 				isLoadMore: false,
-				loadStatus: "loading"
+				loadStatus: "loading",
+				getCompany:{},
 			}
 		},
 		computed: {
@@ -102,9 +103,6 @@
 			this.getrelease()
 		},
 		methods: {
-			// parseLoaded() {
-			// 	this.$refs.uReadMore.init();
-			// },
 			getrelease() {
 				this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
 						currentPage: this.currentPage,
@@ -134,9 +132,31 @@
 				this.keyword = ""
 			},
 			release() {
-				uni.navigateTo({
-					url: `/pages/grain_pulse/release`
-				})
+				this.getCompany.loginPhone = this.userInfo.phone
+				this.$api.doRequest('get', '/settledCompanyInfo/companyList', this.getCompany)
+					.then(res => {
+						if (res.data.code == 200) {
+							if(res.data.data.length > 0){
+								uni.navigateTo({
+									url: `/pages/grain_pulse/release`
+								})
+							}else{
+								uni.showModal({
+									content: "您还没有入驻粮脉,不能发布,是否前去完善入驻信息!",
+									showCancel: true,
+									confirmText: '前往',
+									success: function(res) {
+										if (res.confirm) {
+											uni.navigateTo({
+												url: `/pages/grain_pulse/enter`
+											})
+										}
+									}
+								})
+							}
+						}
+					})
+				
 			},
 			record() {
 				uni.navigateTo({

+ 61 - 38
pages/grain_pulse/record.vue

@@ -26,17 +26,16 @@
 					<view class="touxiang">
 						<image :src="portraits" mode="" style="height: 76rpx;border-radius: 8rpx;"></image>
 					</view>
-					<view class="" style="margin: 20rpx 30rpx;">
+					<view style="margin: 20rpx 0 0 30rpx;width: 72%;">
 						<view style="color: #333333;font-weight: 600;font-size: 34rpx;">{{item.compName}}</view>
 						<view style="color: #AFB3BF; margin-top: 4rpx;">{{item.updateDate}}</view>
 					</view>
-					<view class="flex" style="width: 40%; justify-content: flex-end;margin: 40rpx;">
-						<view style="color: #FE6430;"
+					<view class="flex" style="width: 16%; justify-content: flex-end;margin-top: 40rpx;">
+						<view style="color: #FE6430;margin-right: 16rpx;"
 							v-if="item.status == '审核中' || item.status == '未审核'|| item.status == '待审核'">{{item.status}}
 						</view>
-						<view style="color: #22C572;" v-if="item.status == '已通过'">{{item.status}}</view>
-						<view style="color: #FB1E1E;" v-if="item.status == '已驳回'">{{item.status}}</view>
-
+						<view style="color: #22C572;margin-right: 16rpx;" v-if="item.status == '已通过'">{{item.status}}</view>
+						<view style="color: #FB1E1E;margin-right: 16rpx;" v-if="item.status == '已驳回'">{{item.status}}</view>
 					</view>
 				</view>
 				<view class="title">{{item.title}}</view>
@@ -136,6 +135,7 @@
 			setTimeout(function() {
 				uni.stopPullDownRefresh();
 			}, 1000);
+			this.release = []
 		},
 		onReachBottom() { //上拉触底函数
 			var that = this
@@ -175,17 +175,21 @@
 				this.getRelease()
 			},
 			getRelease() {
-				this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
-						currentPage: this.currentPage,
-						pageSize: this.pageSize,
-						loginPhone: this.userInfo.phone,
-						searchType: this.searchType
-					})
-					.then(res => {
-						if (res.data.code == 200) {
-							if (!this.searchType) {
+				if (!this.searchType) {
+					this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
+							currentPage: this.currentPage,
+							pageSize: this.pageSize,
+							loginPhone: this.userInfo.phone,
+							searchType: this.searchType
+						})
+						.then(res => {
+							if (res.data.code == 200) {
+									if(this.currentPage = 1 ){
+										this.release = []
+									}
 								this.releaseInfo = res.data.data.records
 								if (this.releaseInfo.length > 0) {
+									
 									this.release = this.release.concat(this.releaseInfo)
 									this.count = this.release.length
 									this.isLoadMore = false
@@ -195,9 +199,20 @@
 								} else {
 									this.loadStatus = 'nomore'
 								}
-							} else {
-								debugger
-								if (this.searchTypeInfo == this.searchType) {
+							}
+						})
+						this.searchTypeInfo = this.searchType
+				} else {
+					if (this.searchTypeInfo == this.searchType) {
+						// this.loadStatus = "loading"
+						this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
+								currentPage: this.currentPage,
+								pageSize: this.pageSize,
+								loginPhone: this.userInfo.phone,
+								searchType: this.searchType
+							})
+							.then(res => {
+								if (res.data.code == 200) {
 									this.releaseInfo = res.data.data.records
 									if (this.releaseInfo.length > 0) {
 										this.release = this.release.concat(this.releaseInfo)
@@ -209,30 +224,38 @@
 									} else {
 										this.loadStatus = 'nomore'
 									}
-								}else{
-										this.release = []
-										this.releaseInfo = res.data.data.records
-										if (this.releaseInfo.length > 0) {
-											this.release = this.release.concat(this.releaseInfo)
-											this.count = this.release.length
-											this.isLoadMore = false
-											for (let i = 0; i < this.release.length; i++) {
-												this.release[i].imgList = this.release[i].address.split(",")
-											}
-										} else {
-											this.loadStatus = 'nomore'
+								}
+							})
+					} else {
+						this.release = []
+						this.currentPage = 1
+						this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
+								currentPage: this.currentPage,
+								pageSize: this.pageSize,
+								loginPhone: this.userInfo.phone,
+								searchType: this.searchType
+							})
+							.then(res => {
+								if (res.data.code == 200) {
+									this.releaseInfo = res.data.data.records
+									if (this.releaseInfo.length > 0) {
+										this.release = this.release.concat(this.releaseInfo)
+										this.count = this.release.length
+										this.isLoadMore = false
+										for (let i = 0; i < this.release.length; i++) {
+											this.release[i].imgList = this.release[i].address.split(",")
 										}
+									} else {
+										this.loadStatus = 'nomore'
+									}
 								}
-								this.searchTypeInfo = this.searchType
-
-							}
-
-
-
+							})
+					}
+					this.searchTypeInfo = this.searchType
+				}
 
-						}
-					})
 			},
+
 			delRecord(item) {
 				var that = this
 				uni.showModal({

+ 41 - 44
pages/grain_pulse/release.vue

@@ -83,7 +83,6 @@
 			}
 			this.companyList()
 		},
-
 		methods: {
 			companyList() {
 				this.getCompany.loginPhone = this.userInfo.phone
@@ -129,7 +128,7 @@
 				}
 				if (!this.release.city) {
 					this.$api.msg('城市不能为空,功能没完成')
-					// return
+					 return
 				}
 				if (!this.release.title) {
 					this.$api.msg('标题不能为空')
@@ -149,53 +148,51 @@
 					this.$api.msg("动态内容和图片不能同时为空")
 					return
 				}
-				if (this.companyType.length == 0) {
-					uni.showModal({
-						content: "您还没有入驻粮脉,不能发布,是否前去完善入驻信息!",
-						showCancel: true,
-						confirmText: '前往',
-						success: function(res) {
-							if (res.confirm) {
-								uni.navigateTo({
-									url: `/pages/grain_pulse/enter`
-								})
-							}
-						}
+				var that = this
+				that.$api.doRequest('get', '/settledCompanyDynamics/count', {
+						phone: this.userInfo.phone
 					})
-					return
-				} else {
-					this.release.address = this.address.toString()
-					this.release.phone = this.userInfo.phone
-					var that = this
-					uni.showModal({
-						content: "确定发布动态?",
-						showCancel: true,
-						confirmText: '确定',
-						success: function(res) {
-							if (res.confirm) {
-								that.$api.doRequest('post',
-										'/settledCompanyDynamics/api/addSettledCompanyDynamics', that.release)
-									.then(res => {
-										if (res.data.code == 200) {
-											uni.showToast({
-												title: '发布成功!',
-												icon: 'none',
-												duration: 2000,
-												success() {
-													setTimeout(function() {
-														uni.navigateBack(1)
-													}, 1000);
-												}
-											})
-
+					.then(res => {
+						if (res.data.code == 200) {
+							if (res.data.data > 5) {
+								uni.showToast({
+									title: '今日发布已达上限!',
+									icon: 'none',
+									duration: 2000,
+								})
+							} else {
+								this.release.address = this.address.toString()
+								this.release.phone = this.userInfo.phone
+								var that = this
+								uni.showModal({
+									content: "确定发布动态?",
+									showCancel: true,
+									confirmText: '确定',
+									success: function(res) {
+										if (res.confirm) {
+											that.$api.doRequest('post',
+													'/settledCompanyDynamics/api/addSettledCompanyDynamics',
+													that.release)
+												.then(res => {
+													if (res.data.code == 200) {
+														uni.showToast({
+															title: '发布成功!',
+															icon: 'none',
+															duration: 2000,
+															success() {
+																setTimeout(function() {
+																	uni.navigateBack(1)
+																}, 1000);
+															}
+														})
+													}
+												})
 										}
-									})
+									}
+								})
 							}
 						}
 					})
-				}
-
-
 			},
 			location() {
 				uni.navigateTo({