py vor 2 Jahren
Ursprung
Commit
9b4b68161c
5 geänderte Dateien mit 196 neuen und 176 gelöschten Zeilen
  1. 0 5
      pages-my/comment.vue
  2. 164 156
      pages-school/add-circle.vue
  3. 20 8
      pages-school/circle-info.vue
  4. 6 5
      pages-school/school-circle.vue
  5. 6 2
      service/tools.js

+ 0 - 5
pages-my/comment.vue

@@ -80,11 +80,6 @@
               })
             } else {
               tools.error(res.msg)
-              setTimeout(() => {
-                this.page = 1
-                this.listData = []
-                this.messageList(this.dataType);
-              }, 1500)
             }
           })
         }

+ 164 - 156
pages-school/add-circle.vue

@@ -1,170 +1,178 @@
 <template>
-  <view class="add-circle-box iPhone-bottom flex-common-css box-border-box">
-    <page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
-    <Nav title='发圈子' bgckgroundBox='#fff'></Nav>
-    <view class="scroll-view-css box-border-box ptp-24">
-      <view class="bgc-f box-border-box p-32">
-        <view class="fs-34 fw-600 mb-20">内容描述 <span class='fs-34 fc-9 fw-400'>(必填)</span></view>
-        <textarea v-model="fromData.content" class="textarea-class fs-24" :maxlength='500'
-          placeholder='这一刻说些什么'></textarea>
-      </view>
-      <view class="bgc-f mb-20">
-        <EnUpload v-model="fromData.image" number='9'></EnUpload>
-      </view>
-      <view class="bgc-f box-border-box p-32 flex-justify-space align-items-center" @click="openPop()">
-        <view class="fs-34 fw-600">{{typeName}}</view>
-        <image class="right-icon" src="@/static/img/toRight.png" mode=""></image>
-      </view>
-    </view>
-    <view class="box-border-box p-32" @click="save()">
-      <view class="b-bottom text-align-center fs-32 fw-600 fc-f">发布</view>
-    </view>
-    <uni-popup ref="popup" type="bottom" background-color="#fff" @change="change">
-      <view class="pop-box box-border-box p-24">
-        <view class="head-pop flex-justify-space align-items-center mb-24">
-          <uni-icons @click.stop="closePop(1)" type="closeempty" size="24"></uni-icons>
-          <view class="fs-36 fc-0 fw-600">选发布类型</view>
-          <view class="fs-28 fw-600 fc-41ABF5" @click.stop="closePop(2)">确定</view>
-        </view>
-        <view class="scroll-view-css">
-          <view class="item-box fs-32 " :class="fromData.topic_id==item.id?'fc-41ABF5 bgc-D5EDFB':'bgc-F3F4F6'"
-            v-for="(item,i) in classList" :key="i" @click="selectPopAddEditType(item)">{{item.name}}</view>
-        </view>
-      </view>
-    </uni-popup>
-  </view>
+	<view class="add-circle-box iPhone-bottom flex-common-css box-border-box">
+		<page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
+		<Nav title='发圈子' bgckgroundBox='#fff'></Nav>
+		<view class="scroll-view-css box-border-box ptp-24">
+			<view class="bgc-f box-border-box p-32">
+				<view class="fs-34 fw-600 mb-20">内容描述 <span class='fs-34 fc-9 fw-400'>(必填)</span></view>
+				<textarea v-model="fromData.content" class="textarea-class fs-24" :maxlength='500'
+					placeholder='这一刻说些什么' @input='input'></textarea>
+					<view class="text-align-right fs-28 fc-9">
+						{{inputNum}}/500
+					</view>
+			</view>
+			<view class="bgc-f mb-20">
+				<EnUpload v-model="fromData.image" number='9'></EnUpload>
+			</view>
+			<view class="bgc-f box-border-box p-32 flex-justify-space align-items-center" @click="openPop()">
+				<view class="fs-34 fw-600">{{typeName}}</view>
+				<image class="right-icon" src="@/static/img/toRight.png" mode=""></image>
+			</view>
+		</view>
+		<view class="box-border-box p-32" @click="save()">
+			<view class="b-bottom text-align-center fs-32 fw-600 fc-f">发布</view>
+		</view>
+		<uni-popup ref="popup" type="bottom" background-color="#fff" @change="change">
+			<view class="pop-box box-border-box p-24">
+				<view class="head-pop flex-justify-space align-items-center mb-24">
+					<uni-icons @click.stop="closePop(1)" type="closeempty" size="24"></uni-icons>
+					<view class="fs-36 fc-0 fw-600">选发布类型</view>
+					<view class="fs-28 fw-600 fc-41ABF5" @click.stop="closePop(2)">确定</view>
+				</view>
+				<view class="scroll-view-css">
+					<view class="item-box fs-32 "
+						:class="fromData.topic_id==item.id?'fc-41ABF5 bgc-D5EDFB':'bgc-F3F4F6'"
+						v-for="(item,i) in classList" :key="i" @click="selectPopAddEditType(item)">{{item.name}}</view>
+				</view>
+			</view>
+		</uni-popup>
+	</view>
 </template>
 
 <script>
-  import {
-    getTopic
-  } from '@/api/category.js';
-  import {
-    alumniSave
-  } from '@/api/alumni.js';
-  import tools from '@/service/tools';
-  import EnUpload from '@/components/en-from/en-upload/en-upload.vue';
-  export default {
-    components: {
-      EnUpload
-    },
-    data() {
-      return {
-        fromData: {
-          news_id: '',
-          content: '',
-          image: [],
-          school_id: '',
-          topic_id: '',
-        },
-        isAJAX: false,
-        classList: [],
-        typeName: '请选择发布类型',
-        show: 'false'
-      }
-    },
-    onLoad(e) {
-      if (e.news_id) {
-        this.fromData.news_id = e.news_id;
-      } else {
-        this.fromData.news_id = '';
-      }
-    },
-    methods: {
-      change(e) {
-        this.show = e.show
-      },
-      selectPopAddEditType(item) {
-        if (this.fromData.topic_id != item.id) {
-          this.fromData.topic_id = item.id;
-          this.typeName = item.name;
-        }
-      },
-      openPop() {
-        getTopic().then((res) => {
-          if (res.code === 1) {
-            this.classList = res.data;
-            this.$refs.popup.open();
-          }
-        })
-      },
-      closePop(type) {
-        if (type === 1) {
-          this.fromData.topic_id = '';
-          this.typeName = '请选择发布类型';
-        }
-        this.$refs.popup.close();
-      },
+	import {
+		getTopic
+	} from '@/api/category.js';
+	import {
+		alumniSave
+	} from '@/api/alumni.js';
+	import tools from '@/service/tools';
+	import EnUpload from '@/components/en-from/en-upload/en-upload.vue';
+	export default {
+		components: {
+			EnUpload
+		},
+		data() {
+			return {
+				fromData: {
+					news_id: '',
+					content: '',
+					image: [],
+					school_id: '',
+					topic_id: '',
+				},
+				isAJAX: false,
+				classList: [],
+				typeName: '请选择发布类型',
+				show: 'false',
+				inputNum: 0
+			}
+		},
+		onLoad(e) {
+			if (e.news_id) {
+				this.fromData.news_id = e.news_id;
+			} else {
+				this.fromData.news_id = '';
+			}
+		},
+		methods: {
+			input(e) {
+				console.log(e.detail);
+				this.inputNum = e.detail.cursor
+			},
+			change(e) {
+				this.show = e.show
+			},
+			selectPopAddEditType(item) {
+				if (this.fromData.topic_id != item.id) {
+					this.fromData.topic_id = item.id;
+					this.typeName = item.name;
+				}
+			},
+			openPop() {
+				getTopic().then((res) => {
+					if (res.code === 1) {
+						this.classList = res.data;
+						this.$refs.popup.open();
+					}
+				})
+			},
+			closePop(type) {
+				if (type === 1) {
+					this.fromData.topic_id = '';
+					this.typeName = '请选择发布类型';
+				}
+				this.$refs.popup.close();
+			},
 
-      save() {
-
-        if (this.isAJAX) {
-          return
-        }
-        this.isAJAX = true;
-        let circleSchoolId = uni.getStorageSync('circleSchoolId');
-        let school_id = uni.getStorageSync('school_id');
-        this.fromData.school_id = circleSchoolId ? circleSchoolId : school_id;
-        alumniSave(this.fromData).then((res) => {
-          if (res.code === 1) {
-            tools.success(res.msg)
-            setTimeout(() => {
-              this.isAJAX = false;
-              uni.reLaunch({
-                url: '/pages-school/school-circle'
-              })
-            }, 1500)
-          } else {
-            tools.error(res.msg)
-            this.isAJAX = false;
-          }
-        })
-      },
-    }
-  }
+			save() {
+				if (this.isAJAX) {
+					return
+				}
+				this.isAJAX = true;
+				let circleSchoolId = uni.getStorageSync('circleSchoolId');
+				let school_id = uni.getStorageSync('school_id');
+				this.fromData.school_id = circleSchoolId ? circleSchoolId : school_id;
+				alumniSave(this.fromData).then((res) => {
+					if (res.code === 1) {
+						tools.success(res.msg,1000)
+						setTimeout(() => {
+							this.isAJAX = false;
+							uni.reLaunch({
+								url: '/pages-school/school-circle'
+							})
+						}, 1000)
+					} else {
+						tools.error(res.msg)
+						this.isAJAX = false;
+					}
+				})
+			},
+		}
+	}
 </script>
 
 <style scoped lang="scss">
-  .textarea-class {
-    width: 100%;
-  }
+	.textarea-class {
+		width: 100%;
+	}
 
-  .add-circle-box {
-    .b-bottom {
-      width: 686rpx;
-      height: 88rpx;
-      line-height: 88rpx;
-      background: linear-gradient(105deg, #57CAFF 0%, #41ABF5 100%);
-      border-radius: 200rpx;
-    }
+	.add-circle-box {
+		.b-bottom {
+			width: 686rpx;
+			height: 88rpx;
+			line-height: 88rpx;
+			background: linear-gradient(105deg, #57CAFF 0%, #41ABF5 100%);
+			border-radius: 200rpx;
+		}
 
-    .right-icon {
-      width: 32rpx;
-      height: 32rpx;
-    }
+		.right-icon {
+			width: 32rpx;
+			height: 32rpx;
+		}
 
-    .head-pop {
-      padding-bottom: 34rpx !important;
-      border-bottom: 1rpx solid #F2F2F2;
-    }
+		.head-pop {
+			padding-bottom: 34rpx !important;
+			border-bottom: 1rpx solid #F2F2F2;
+		}
 
-    .pop-box {
-      width: 100%;
-      height: 50vh;
-      // background-color: #fff;
-      border-radius: 24rpx 24rpx 0rpx 0rpx;
-      display: flex;
-      flex-direction: column;
+		.pop-box {
+			width: 100%;
+			height: 50vh;
+			// background-color: #fff;
+			border-radius: 24rpx 24rpx 0rpx 0rpx;
+			display: flex;
+			flex-direction: column;
 
-      .item-box {
-        width: 100%;
-        height: 92rpx;
+			.item-box {
+				width: 100%;
+				height: 92rpx;
 
-        border-radius: 200rpx;
-        line-height: 92rpx;
-        text-align: center;
-        margin-bottom: 24rpx;
-      }
-    }
-  }
-</style>
+				border-radius: 200rpx;
+				line-height: 92rpx;
+				text-align: center;
+				margin-bottom: 24rpx;
+			}
+		}
+	}
+</style>

+ 20 - 8
pages-school/circle-info.vue

@@ -92,7 +92,7 @@
 							<view class="mb-16" v-if="item.count > 0">
 								<view class="list-box flex-justify-space" v-for="(info,index) in item.replyList"
 									:key="index">
-									<image class="list-box-img" src="@/static/img/my/bg.png" mode="scaleToFill"></image>
+									<image class="list-box-img" :src="info.head_img" mode="scaleToFill"></image>
 									<view class="flex-1">
 										<view class=" flex-justify-space">
 											<view class=" b-b-F9F9F9 mr-20">
@@ -320,12 +320,12 @@
 					if (res.code === 1) {
 						this.obj = res.data;
 					} else {
-						tools.error(res.msg)
+						tools.error(res.msg, 1000)
 						setTimeout(() => {
 							uni.navigateBack({
 								delta: 1
 							})
-						}, 1500)
+						}, 1000)
 					}
 				})
 			},
@@ -396,7 +396,7 @@
 						news_id: item.news_id,
 						is_like: is_like
 					}).then((res) => {
-						this.handUpFun(res, item, is_like)
+						this.postFun(res, item, is_like)
 					})
 				} else {
 					// 点赞评论
@@ -419,7 +419,19 @@
 						item.like += 1
 					}
 					this.isAJAX = false;
-					tools.success(res.msg);
+					tools.success(res.msg, 1000);
+				} else {
+					this.isAJAX = false;
+					tools.error(res.msg);
+				}
+			},
+			// 点赞帖子
+			postFun(res, item, is_like) {
+				console.log(res, item, is_like);
+				if (res.code === 1) {
+					item.is_like = is_like;
+					this.isAJAX = false;
+					tools.success(res.msg, 1000);
 				} else {
 					this.isAJAX = false;
 					tools.error(res.msg);
@@ -460,7 +472,7 @@
 				this.isAJAX = true;
 				setCreateRemark(this.msgData).then((res) => {
 					if (res.code == 1) {
-						tools.success('评论成功')
+						tools.success('评论成功', 1000)
 						setTimeout(() => {
 							this.isAJAX = false;
 							this.closeInput()
@@ -511,7 +523,7 @@
 					remark_id: item.id
 				}).then((res) => {
 					if (res.code === 1) {
-						tools.success('删除成功')
+						tools.success('删除成功', 1000)
 						setTimeout(() => {
 							this.isAJAX = false;
 							console.log(this.list[i], '88888888888888888');
@@ -551,7 +563,7 @@
 					this.isAJAX = true;
 					alumniReport(this.reportData).then((res) => {
 						if (res.code === 1) {
-							tools.success(res.msg)
+							tools.success(res.msg, 1000)
 							setTimeout(() => {
 								this.isAJAX = false;
 								this.closePop(1);

+ 6 - 5
pages-school/school-circle.vue

@@ -327,6 +327,7 @@
 		},
 		mounted() {
 			uni.$on('circleDataUp', (data) => {
+				console.log(data, '*********************');
 				this.list.forEach((v, k) => {
 					if (v.news_id == data.news_id) {
 						v.like = data.like
@@ -448,10 +449,10 @@
 						item.like += 1
 					}
 					this.isAJAX = false;
-					tools.success(res.msg);
+					tools.success(res.msg,1000);
 				} else {
 					this.isAJAX = false;
-					tools.error(res.msg);
+					tools.error(res.msg,1000);
 				}
 			},
 			// 获取回复列表
@@ -558,7 +559,7 @@
 				this.isAJAX = true;
 				setCreateRemark(this.msgData).then((res) => {
 					if (res.code == 1) {
-						tools.success('评论成功')
+						tools.success('评论成功',1000)
 						setTimeout(() => {
 							this.isAJAX = false;
 							this.closeInput()
@@ -591,7 +592,7 @@
 					remark_id: item.id
 				}).then((res) => {
 					if (res.code === 1) {
-						tools.success('删除成功')
+						tools.success('删除成功',1000)
 						setTimeout(() => {
 							this.isAJAX = false;
 							this.remarkData.list = [];
@@ -632,7 +633,7 @@
 					this.isAJAX = true;
 					alumniReport(this.reportData).then((res) => {
 						if (res.code === 1) {
-							tools.success(res.msg)
+							tools.success(res.msg,1000)
 							setTimeout(() => {
 								this.isAJAX = false;
 								this.closePop(1);

+ 6 - 2
service/tools.js

@@ -73,16 +73,20 @@ tools.formatDecimal = function (num, decimal) {
  * 错误提示
  * @param msg
  */
-tools.error = function (msg) {
+tools.error = function (msg,time) {
 	let type = 'error'
+	let duration = 1500
 	if(msg.length > 7){
 		type = 'none'
 	}
+	if(time) {
+		duration = time
+	}
     uni.showToast({
         'title': msg,
         'icon': type,
         'mask': true,
-        'duration': 1500
+        'duration': duration
     })
 }