306132416@qq.com преди 3 години
родител
ревизия
ca08487f6c
променени са 3 файла, в които са добавени 199 реда и са изтрити 119 реда
  1. 163 79
      pages/index/activity/activity.vue
  2. 35 38
      pages/index/activity/create1.vue
  3. 1 2
      pages/index/honor/honor.vue

+ 163 - 79
pages/index/activity/activity.vue

@@ -1,33 +1,39 @@
 <template>
   <view class="content">
     <view class="self-inf">
-	  <view class="antu-box" v-if="isAuth">
+	  <view class="antu-box">
 		<view class="img-name-box">
 		  <image :src="userHeadImg" class="heade-img" mode="aspectFill"></image>
-		  <p class="nickname">{{ userNickName }}</p>
-		  <p class="nickname">136****0648</p>
+		  <p class="nickname">{{userNickName}}</p>
+		  <p class="nickname">{{userPhone}}</p>
 		</view>
-		<view class="org-info-box">
-		  <view class="org-info">浐灞一支部</view>
-		  <view class="org-line"></view>
-		  <view class="org-info">宣传委员</view>
-		</view>	  
+		<view class="org-info-box" v-for="(item,index) in userPosList" :key="index">
+		  <view class="org-info">{{item.name || '-'}}</view>
+		  <!-- <view class="org-line"></view> -->
+		  <view class="org-info">{{item.position  || '-'}}</view>
+		</view>		  
 	  </view>
-	  <view class="img-name-box" v-if="!isAuth" style="height: 180rpx;">
+<!-- 	  <view class="img-name-box" v-if="!isAuth" style="height: 180rpx;">
 		<image src="/static/auth-icon.png" class="heade-img" mode="aspectFill" style="margin-left: 80rpx;"></image>
         <button @click="goAuthPage()" class="auth-btn">授权登录</button>
-      </view>
+      </view> -->
     </view>
  
     <view>
 		<view class="active-title-box">
-			<uni-datetime-picker
+<!-- 			<uni-datetime-picker
 			    class="time-select-box"
 				type="date"
 				:value="single"
 				@change="change"
 				:clear-icon="false"
-			/>
+			/> -->
+			<picker mode="date" fields="year"  @change="bindDateChange" class="picker-class">
+				<view class="uni-input display-between items-center">{{dateYear}}年<image src="/static/calendar_icon.svg" mode="aspectFit" style="top: 18rpx;"></image></view>
+			</picker>
+			<picker :range="arrayMonth" :value="dateMonth"  @change="bindDateMonthChange" class="picker-class" style="margin-left: 2%;">
+				<view class="uni-input display-between items-center" style="color: #707070;">{{dateMonth}}月<image src="/static/calendar_icon.svg" mode="aspectFit" style="top: 18rpx;"></image></view>
+			</picker>
 		   <picker @change="bindPickerChange" :value="index" :range="array">
 					<view class="uni-input">{{array[index]}}</view>
 					<image src="/static/arrow_down.svg" mode="aspectFit"></image>
@@ -35,104 +41,172 @@
 		   <button @click="publish()">+发布活动</button>
 		</view>
 		
-		
+		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
 		<view class="active-box" v-for="(item,index) in activiList" :key="index" @click="goList()">
-			<view class="active-type" :class="{'bg-yellow':item.typeNum == '1' ,'bg-red':item.typeNum == '2','bg-blue':item.typeNum == '3',}"  >
+			<view class="active-type" :class="{'bg-yellow':item.type == '组织建设' ,'bg-red':item.type == '学习培训','bg-blue':item.type == '参政议政',}"  >
 				{{item.type}}
 			</view>
 			<view class="active-content-box">
 				<view class="active-content">
-					<view class="active-name">{{item.activi_name}}</view>
-					<view class="active-date">{{item.date}}</view>
+					<view class="active-name">{{item.name}}</view>
+					<view class="active-date">{{item.start_time}}</view>
 				</view>
 				<view class="active-content">
-					<view style="margin-right:10rpx;">{{item.department}} | </view>
-					<view>{{item.name}} | </view>
-					<view style="margin-left:10rpx;">记录数:({{item.record_num}}/{{item.num}})</view>
+					<view style="margin-right:10rpx;">{{item.branch}}</view>
+					<view class="author-box">{{item.author}}</view>
+					<view style="margin-left:10rpx;">记录数:({{item.process_count}}/<text style="color:red;">{{item.process_unread_count}}</text>)</view>
 				</view>
 			</view>
-			
 			<view class="edit-icon-box">
-				  <image src="/static/edit-icon.png" mode="aspectFit"></image>
-				  <image src="/static/del-icon.png" mode="aspectFit"></image>
+				<image src="/static/edit-icon.png" mode="aspectFit" v-show="item.edit_auth" @click="goRecord(item.id)"></image>
+				<image src="/static/del-icon.png" mode="aspectFit" v-show="item.del_auth" @click="delRecord(item.id)"></image>
 			</view>
-			
 		</view>
-		
+		</mescroll-body>
 		
 	</view>
-    
- 
   </view>
 </template>
 
 <script>
 import md5 from "@/common/md5.js";
+import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 export default {
 	components: {
 	},
+  mixins: [MescrollMixin], // 使用mixin
   data() {
     return {
-      isAuth:getApp().globalData.globalAuth,
+      dateYear:new Date().getFullYear(),
+      dateMonth:new Date().getMonth() + 1,
+	  arrayMonth:["1", "2","3", "4","5", "6","7", "8","9", "10","11", "12"],
       userHeadImg: getApp().globalData.user_headUrl,
       userNickName:getApp().globalData.user_name,
+	  userPhone:getApp().globalData.user_phone.substr(0, 3) + '****' + getApp().globalData.user_phone.substr(7),
+	  userPosList:[],
 	  array: ['全部', '浐灞一支部', '浐灞二支部'],
 	  index: 0,
-	  activiList:[
-		  {
-		     type:'组织建设',
-			 typeNum:'1',
-		     activi_name:'活动名称XXX',
-		     date:'2022.01.22',
-		     name:'路小路',
-			 department:'浐灞一支部',
-			 record_num:'22',
-			 num:'9'
-		  },
-		  {
-		     type:'学习培训',
-			 typeNum:'2',
-		     activi_name:'活动名称XXX',
-		     date:'2022.01.15',
-		     name:'陈伟',
-			 department:'浐灞二支部',
-			 record_num:'22',
-			 num:'9'
-		  },
-		  {
-		     type:'参政议政',
-			 typeNum:'3',
-		     activi_name:'活动名称XXX',
-		     date:'2022.01.15',
-		     name:'陈伟',
-			 department:'浐灞二支部',
-			 record_num:'22',
-			 num:'9'
-		  },
-	  ]
+	  page:1,
+	  pageSize:10,
+	  activiList:[]
     };
   },
   onShow() {
   },
+  onLoad() {
+	  this.getUserInfoBranch()
+	 // this.getActivityBranch()
+  },
   methods: {
-		  bindPickerChange: function(e) {
-			  console.log('picker发送选择改变,携带值为', e.target.value)
-			  this.index = e.target.value
-		  },
-		  change(e) {
-			  this.single = e;
-			  console.log("-change事件:", e);
-		  },
-		  publish(){
-			  uni.navigateTo({
-			  	url:'./create1'
-			  })
-		  },
-		  goList(){
-			  uni.navigateTo({
-			  	url:'./list'
-			  })
-		  }
+	  getUserInfoBranch() {
+	      let md5Sign = md5(
+	        "method=" +
+	          "member" +
+	          "&timestamp=" +
+	          getApp().globalData.globalTimestamp +
+	          "&secret=" +
+	          getApp().globalData.secret
+	      );
+	      let url =
+	        getApp().globalData.shareUrl +
+	        "api/api.php" +
+	        "?method=member&action=my_branch&timestamp=" +
+	        getApp().globalData.globalTimestamp +
+	        "&sign=" +
+	        md5Sign;
+	      uni.request({
+	        url: url,
+	        method: "POST",
+	        header: {
+	          "content-type": "application/x-www-form-urlencoded",
+	        },
+	        data: {
+	          openid:getApp().globalData.open_id,
+	        },
+	        success: (res) => {
+	          if (res.data.code === 200) {
+	  				  this.userPosList = res.data.data;
+	          }
+	        },
+	        fail: () => {
+	          console.log("连接失败");
+	        },
+	      });
+	  },
+	  bindDateChange(e){
+			this.dateYear = e.target.value;
+	  },
+	  bindDateMonthChange(e){
+			this.dateMonth = this.arrayMonth[e.target.value];
+	  },
+	  bindPickerChange: function(e) {
+		  console.log('picker发送选择改变,携带值为', e.target.value)
+		  this.index = e.target.value
+	  },
+	  upCallback(page) {
+		let pageNum = page.num; // 页码, 默认从1开始
+		let pageSize = page.size; // 页长, 默认每页10条
+	  	let md5Sign = md5(
+	  	  "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
+	  	    "&secret=" + getApp().globalData.secret
+	  	);
+	  	let url = getApp().globalData.shareUrl +"api/api.php" +
+	  	  "?method=activity&action=list&timestamp=" +
+	  	  getApp().globalData.globalTimestamp +
+	  	  "&sign=" +
+	  	  md5Sign;
+	  	uni.request({
+	  	  url: url,
+	  	  method: "POST",
+	  	  header: {
+	  	    "content-type": "application/x-www-form-urlencoded",
+	  	  },
+	  	  data: {
+	  	       openid: getApp().globalData.open_id,
+			   year:this.dateYear,
+			   month:this.dateMonth,
+			   s:'',
+			   page:pageNum,
+			   page_size:pageSize
+	  	  },
+	  	  success: (res) => {
+	  	    if (res.data.code === 200) {
+	  			    // 接口返回的当前页数据列表 (数组)
+	  				let curPageData = res.data.data.list; 
+	  				// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
+	  				let curPageLen = curPageData.length; 
+	  				// 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
+	  				let totalPage = res.data.data.page_count; 
+	  				// 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
+	  				let totalSize = res.data.data.count;  
+	  				// // 接口返回的是否有下一页 (true/false)
+	  				// let hasNext = data.xxx; 
+	  				if(page.num == 1) this.activiList = []; //如果是第一页需手动制空列表
+	  				// let list = res.data.data.list;
+	  				// list.forEach((item)=>{
+	  				// 	item.pic_url = this.shareUrl + item.pic_url;
+	  				// 	item.pic_url_resize = this.shareUrl + item.pic_url_resize;
+	  				// })
+	  				this.activiList=this.activiList.concat(res.data.data.list); //追加新数据
+	  				this.mescroll.endByPage(curPageLen || 0, totalPage); 
+	  	    }
+	  	  },
+	  	  fail: () => {
+	  	    console.log("连接失败");
+	  			this.mescroll.endErr();
+	  	  },
+	  	});
+	  },
+	  publish(){
+		  uni.navigateTo({
+			url:'./create1'
+		  })
+	  },
+	  goList(){
+		  uni.navigateTo({
+			url:'./list'
+		  })
+	  }
   },
 };
 </script>
@@ -234,11 +308,12 @@ export default {
 			}
 		}
 		button {
-			width: 24%;
+			width: 29%;
 			font-size: 25rpx;
 			background: #4988fd;
 			color: #fff;
-			margin-left: 25rpx;
+			margin-left: 20rpx;
+			margin-right: 20rpx;
 		}
 	
 	
@@ -262,20 +337,29 @@ export default {
 		color: #fff;
 	}
 	.active-content-box {
+		height: 120rpx;
 		display: flex;
 		flex-direction: column;
 		margin-left: 20rpx;
+		justify-content: space-around;
 	}
 	.active-content {
 		display: flex;
 		align-items: center;
 		height: 45rpx;
 		font-size: 26rpx;	
+		.author-box {
+			border-left: 1px solid #d7d7d7;
+			border-right: 1px solid #d7d7d7;
+			padding: 0 30rpx 0 30rpx;
+			margin: 0 20rpx 0 20rpx;
+		}
 		.active-name {
 			font-size: 30rpx;
 			margin-right: 10rpx;
 		}
 		.active-date {
+			font-size: 24rpx;
 			color: #ccc;
 		}
 	}

+ 35 - 38
pages/index/activity/create1.vue

@@ -13,7 +13,7 @@
 				<text>所属支部</text>
 			</view>
 			<view class="info-value-box">
-				  <picker @change="bindPickerChange($event,'education')"  :range="honorBranch" class="select-box" name="education" disabled="true">
+				  <picker @change="bindPickerChange"  :range="honorBranch" :range-key="'name'" class="select-box">
 				        <view class="uni-input">{{branchValue}}</view>
 						<image src="/static/arrow_down.svg" mode="aspectFill"></image>
 				  </picker>
@@ -35,12 +35,13 @@
 		data() {
 			return {
 				isAuthPhone:getApp().globalData.user_phone,
-				branchValue:'浐灞一支部',
-				honorBranch:['浐灞一支部','浐灞二支部'],
+				branchValue:'',
+				honorBranch:[],
 			}
 		},
 		onLoad() {
 			//this.getTradeRequest();
+			this.getActivityBranch();
 		},
 		onShow() {
 		},
@@ -51,46 +52,42 @@
 		// 	    }
 		// },
 		methods: {
-			bindDateChange(e){
-					this.dateYear = e.target.value
-						   
+			getActivityBranch() {
+			    let md5Sign = md5(
+			      "method=" +"activity" + "&timestamp=" + getApp().globalData.globalTimestamp +
+			        "&secret=" +getApp().globalData.secret
+			    );
+			    let url = getApp().globalData.shareUrl +"api/api.php" +
+			      "?method=activity&action=activity_branch&timestamp=" +
+			      getApp().globalData.globalTimestamp +"&sign=" + md5Sign;
+			    uni.request({
+			      url: url,
+			      method: "POST",
+			      header: {
+			        "content-type": "application/x-www-form-urlencoded",
+			      },
+			      data: {
+			        openid:getApp().globalData.open_id,
+			      },
+			      success: (res) => {
+			        if (res.data.code === 200) {
+						this.honorBranch = res.data.data;
+						this.branchValue = res.data.data[0].name;
+			        }
+			      },
+			      fail: () => {
+			        console.log("连接失败");
+			      },
+			    });
 			},
-			bindDateMonthChange(e){
-					this.dateMonth = this.arrayMonth[e.target.value]
-			},
-			change(e) {
-					this.single = e;
-					console.log("-change事件:", e);
-			 },
-			 goStep(){
+			goStep(){
 				  uni.navigateTo({
 				  	url:'./create2'
 				  })
 			 },
-			 bindPickerChange(e,type) {
-						 let that = this;
-						  switch (type){
-						  	case 'education':
-							 that.educationValue =  that.educationArray[e.target.value]
-							 console.log(that.educationValue)
-						  		break;
-						  	case 'profession':
-						  	 that.professionValue =  that.professionArray[e.target.value]
-						  		break;
-							case 'ends':
-							 that.endsValue =  that.endsArray[e.target.value]
-								break;	
-						  }
-			             
-			          },
-				testLength(){
-					 if(this.addressDetail.length > 25){
-						 uni.showToast({
-							title: '详细地址应为0-25个字符',
-							icon: 'none'
-						 });
-					}
-				}, 	  
+			bindPickerChange(e) {
+				 this.branchValue =  this.honorBranch[e.target.value].name
+			  },
 			submitRequest(params){
 				   console.log(params)
 				 	 let that = this;

+ 1 - 2
pages/index/honor/honor.vue

@@ -1,8 +1,7 @@
 <template>
   <view class="content">
 	 <view>
-		 <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" 
-		 styleType="text" activeColor="#1c9bdc"></uni-segmented-control>
+		 <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text" activeColor="#1c9bdc"></uni-segmented-control>
 		 <view class="content">
 			 <view v-show="current == 0">
 				 <view class="active-title-box">