zhengkaixin 2 년 전
부모
커밋
f7fce80a91
6개의 변경된 파일201개의 추가작업 그리고 61개의 파일을 삭제
  1. 9 0
      apis/pagejs/share.js
  2. 2 2
      config/.env.dev.js
  3. 51 13
      pages/mine/issue.vue
  4. 22 7
      pages/mine/personalPage.vue
  5. 101 34
      pages/staffHome/filesonic.vue
  6. 16 5
      uni_modules/uview-ui/components/u-upload-file/u-upload-file.vue

+ 9 - 0
apis/pagejs/share.js

@@ -21,6 +21,15 @@ export function addShare(formData) {
 	})
 }
 
+export function changeLikes(formData) {
+	return request({
+		url: '/mobile/share/changeLikes',
+		data: formData,
+		method: 'post',	
+	//	header:{'Content-Type':'application/json'},
+	})
+}
+
 
 export function dataList(formData) {
 	return requestWhite({

+ 2 - 2
config/.env.dev.js

@@ -14,8 +14,8 @@ const UNI_APP = {
 	// openId:"oK9Wr54VbEh3xvWYmD_zT5NbH4AY",
 	openId:"oBEnI6GDWCRQqn_xlyPlCYFY8Amg",//zkx
 	//openId:"123456",
-	//openId:"oK9Wr59rru-i3bm7dtTtxnkR-i4s",//杨所
-	//openId:"oK9Wr5zv8lvirni3txbxRkmpg8d0",//
+	//openId:"oBEnI6PiaBMNUMTnjT0ffT1R2JOk",//杨所
+	//openId:"oBEnI6N9gRq3xOVlw34JfYjhtB9k",//  伊明
 	
 	
 	//openId:"oK9Wr58zNwDernF0TL6o3mdUxk2A",

+ 51 - 13
pages/mine/issue.vue

@@ -15,10 +15,11 @@
 		v-model="subForm.synopsis" maxlength="200"
 		 name="" id="" cols="30" rows="10"></textarea>
 		<view style="float: right;">字数限制:{{subForm.synopsis?subForm.synopsis.length:0}}/200</view>
+	 
 	  <view class="upload">
 		
 	  	<u-upload-file  ref="uUpload" :action="action"
-		  :max-size="50 * 1024 * 1024"
+		  :max-size="50 * 1024 * 1024" :maxCount="9"
 		  :form-data="formData" :header="header"
 		 :file-list="fileList" ></u-upload-file>
 	  </view>
@@ -33,6 +34,11 @@
 				<u-icon name="arrow-right"></u-icon>
 		</view>
 	  </view>
+	  <view style="padding: 10px;">上传备注:<br/>1.最多上传9张(含图片\视频)
+	  <br/>2.单个文件大小限制为50M
+	  <br/> 3.图片一行显示3个,视频一行显示1个;
+	  <br/>4.发布后图片排列在视频前面,其余顺序按上传顺序排列</view>
+	  
 	  <view class="bottom"  v-if="false" >
 	  			<button>发布作品</button>
 	  </view>
@@ -145,31 +151,63 @@
 				}else{
 					return
 				}
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
 				if(this.itemshare.label){
 					this.subForm.activityId=this.listshare[this.itemshare.value].id;
 				}
 				
-				var lists = this.$refs.uUpload.lists;
-				console.log(lists)
+				var lists2 = this.$refs.uUpload.lists;
+				var lists1 = [];
 				var urls=[]
 				var isPics=[]
 				
-				for(var i in lists){
-					var p =lists[i].response.data;
+				
+				for(var i in lists2){
+					if(lists2[i].response){
+						
+					}else{
+						continue;
+					}
+					var p =lists2[i].response.data;
 					var fileName=p.fileName
-					urls.push(p.fileUrl)
+					
 					if(fileName.indexOf('.mp4')>=0){
-						isPics.push(false)
+						p.isPic=false
 					}else{
-						isPics.push(true)
+						p.isPic=true
+					}
+					lists1.push(p);
+				}
+				
+				lists1=lists1.sort(function(item1,item2){
+					
+					if(!item1.isPic&&item2.isPic){
+						return 1
+					}
+					if(item1.isPic&&!item2.isPic){
+						return -1
+					}
+					if(item1.isPic&&item2.isPic){
+						return 0
 					}
+					return 0
+				})
+				
+				for(var i in lists1){
+					
+					var p =lists1[i];
+					var fileName=p.fileName
+					urls.push(p.fileUrl)
+					isPics.push(p.isPic)
 				}
 				this.subForm.urls=urls.join()
 				this.subForm.isPics=isPics.join()
-				uni.showLoading({
-					title: "加载中",
-					mask: true,
-				})
+				
+				console.log(isPics.join())
 				
 				API_share.addShare(this.subForm).then((res) => {
 					
@@ -286,7 +324,7 @@ uni-textarea{
 .upload{
 	padding: 32rpx;
 	/deep/.u-add-tips{
-		display: none;
+		// display: none;
 	}
 }
 .select{

+ 22 - 7
pages/mine/personalPage.vue

@@ -207,18 +207,25 @@
 				}
 			
 			
-			},previewImage(img,i) {
+			},previewImage(img,j) {
 				let imgs = [];
 				img.forEach(it=>{
-					imgs.push(it.url)
+					if(it.isPic){
+						imgs.push(it.url)
+					}
 				})
 				
 				
 				uni.previewImage({
-					indicator:"default",
+					indicator:"number",
+					indicatorDots:true,
 					loop:true,
 					urls: imgs,
-					current: i
+					current: j,
+					success:(e)=>{
+						
+					}
+					
 				})
 			},getList(){
 				uni.showLoading({
@@ -400,6 +407,7 @@
 			margin-bottom: 48rpx;
 			display: flex;
 			.date{
+				width: 120rpx;
 				.day{
 					color: rgba(51, 51, 51, 1);
 					font-size: 18px;
@@ -425,10 +433,17 @@
 				 .photos{
 					 
 					 img{
-						 width: 248rpx;
-						 height: 248rpx;
+						 width: 168rpx;
+						 height: 168rpx;
 						 border-radius: 16rpx;
-						 margin-right: 16rpx;
+						 margin-right: 4rpx;
+					 }
+					 video {
+					 	width: 100%;
+					 	height: 168rpx;
+					 	border-radius: 16rpx;
+					 	margin-bottom: 16rpx;
+					 	//margin-left: 16rpx;
 					 }
 				 }
 			}

+ 101 - 34
pages/staffHome/filesonic.vue

@@ -41,24 +41,36 @@
 					
 					
 				</view>
-				<view class="tag"
-				 v-if="!item.activityId"
-				 :class="item.activityId"   >
-					<text class="status" style="color: red;" v-if="item.status!=1">[{{item.status==0?'审核中':''}}{{item.status==2?'审核不通过':''}}]</text>
-					
-				</view>
-				<view class="tag" v-else
-				 :class="item.activityId"   @click="issueMethod(item.activityId)" >
-					<text class="status" style="color: red;" v-if="item.status!=1">[{{item.status==0?'审核中':''}}{{item.status==2?'审核不通过':''}}]</text>
-					<template>
+				<view class="tagMain">
+					<view class="tag"
+					 v-if="!item.activityId"
+					 :class="item.activityId"   >
+						<text class="status" style="color: red;" v-if="item.status!=1">[{{item.status==0?'审核中':''}}{{item.status==2?'审核不通过':''}}]</text>
 						
-						<text class="symbol">#</text>
-						<text class="text">{{item.activityName}}</text>
-						<text class="icon"   >
-							<u-icon size="28" color="#cccccc" name="arrow-right"></u-icon>
-						</text>
-					</template>
+					</view>
+					<view class="tag" v-else
+					 :class="item.activityId"   @click="issueMethod(item.activityId)" >
+						<text class="status" style="color: red;" v-if="item.status!=1">[{{item.status==0?'审核中':''}}{{item.status==2?'审核不通过':''}}]</text>
+						<template>
+							
+							<text class="symbol">#</text>
+							<text class="text">{{item.activityName}}</text>
+							<text class="icon"   >
+								<u-icon size="28" color="#cccccc" name="arrow-right"></u-icon>
+							</text>
+						</template>
+					</view>
+						<view class="like" @click="changeLikes(item)" :class="{
+							red:item.isLike
+						}"
+						
+						><view class="icon">
+					<u-icon name="thumb-up"   size="38"></u-icon>
+				</view><view class="number">
+						{{item.likesNum}}</view></view>
 				</view>
+				
+			
 			</view>
 			
 			
@@ -108,6 +120,41 @@
 		
 		},
 		methods: {
+			changeLikes(info){
+				var userInfo=this.carhelp.getPersonInfo()
+				if(!userInfo){
+					return
+				}
+				
+				
+				if(!info.isLike){
+					uni.showLoading({
+						title: "加载中",
+						mask: true,
+					})
+					
+					
+					API.changeLikes({
+						shareId:info.id
+					}).then((res) => {
+						info.isLike=true;
+						info.likesNum++;
+						uni.hideLoading();
+						//this.getInfo(true)
+					}).catch(error => {
+						uni.showToast({
+							title: error,
+							icon: "none"
+						})
+					})
+				}else{
+					uni.showToast({
+						title: "您已经点过赞了",
+						icon: "none"
+					})
+				}
+				
+			},
 			issueMethod(id){
 				
 				var userInfo=this.carhelp.getPersonInfo()
@@ -140,12 +187,15 @@
 			previewImage(img,i) {
 				let imgs = [];
 				img.forEach(it=>{
-					imgs.push(it.url)
+					if(it.isPic){
+						imgs.push(it.url)
+					}
 				})
 				
 				
 				uni.previewImage({
-					indicator:"default",
+					//indicator:"default",
+					indicator:"number",
 					loop:true,
 					urls: imgs,
 					current: i
@@ -180,13 +230,15 @@
 				API.pageList(this.listForm).then((res) => {
 					this.carhelp.set("addShare",0);
 					uni.hideLoading();
-					//this.list=response.data.data
+					var list=res.data.data;
+				
+					
 					if(this.listForm.pageIndex==1){
-						this.list = res.data.data;
+						this.list = list;
 					}else{
 						this.list = [
 							...this.list,
-							...res.data.data
+							...list
 						];
 					}
 					this.recordsTotal = res.data.recordsTotal;
@@ -214,6 +266,17 @@
 </script>
 
 <style lang="scss" scoped>
+	.red{
+		color: red !important;
+	}
+	.like{
+		margin-top: 16rpx;
+		line-height: 24px;
+		display: flex;
+		.number{
+			margin-left: 16rpx;
+		}
+	}
 	page {
 		background-color: #fff;
 		padding-bottom: 100px;
@@ -308,21 +371,25 @@ font-family: 'Regular';
 					border-radius: 8px;
 				}
 			}
-
-			.tag {
-				margin-top: 16rpx;
-				line-height: 24px;
-
-				.symbol {
-					color: rgba(31, 74, 153, 100);
-					font-size: 16px
-				}
-
-				.text {
-					color: rgba(31, 74, 153, 1);
-					margin-left: 14rpx;
+			.tagMain{
+				display: flex;
+				justify-content: space-between;
+				.tag {
+					margin-top: 16rpx;
+					line-height: 24px;
+				
+					.symbol {
+						color: rgba(31, 74, 153, 100);
+						font-size: 16px
+					}
+				
+					.text {
+						color: rgba(31, 74, 153, 1);
+						margin-left: 14rpx;
+					}
 				}
 			}
+			
 		}
 
 	}

+ 16 - 5
uni_modules/uview-ui/components/u-upload-file/u-upload-file.vue

@@ -27,7 +27,9 @@
 				class="u-progress"
 				:percent="item.progress"
 			></u-line-progress>
-			<view @tap.stop="retry(index)" v-if="item.error" class="u-error-btn">点击重试</view>
+			<view @tap.stop="retry(index)" v-if="item.error" class="u-error-btn2 u-error-btn">点击重试</view>
+			<view  v-if="item.progress==100" class="u-error-btn2 u-primary-btn">上传成功</view>
+			<view  v-if="item.progress!=100" class="u-error-btn2 u-warning-btn">上传中</view>
 			
 			
 			<video v-if="item.fileType=='video/mp4'" :src="item.url"
@@ -190,7 +192,7 @@ export default {
 		// 上传区域的提示文字
 		uploadText: {
 			type: String,
-			default: '选择图片'
+			default: '图片/视频'
 		},
 		// 是否自动上传
 		autoUpload: {
@@ -578,6 +580,7 @@ export default {
 .u-upload {
 	@include vue-flex;
 	flex-wrap: wrap;
+	width: 100%;
 	align-items: center;
 }
 
@@ -650,10 +653,18 @@ export default {
 	z-index: 9;
 	width: auto;
 }
-
-.u-error-btn {
-	color: #ffffff;
+.u-primary-btn {
+	background-color: #59ba73;
+}
+.u-warning-btn {
+	background-color: #e6a23c;
+}
+.u-error-btn{
 	background-color: $u-type-error;
+}
+.u-error-btn2 {
+	color: #ffffff;
+	
 	font-size: 20rpx;
 	padding: 4px 0;
 	text-align: center;