Просмотр исходного кода

Merge branch 'master' of http://121.40.40.223:3000/zizhong.wang/konggang-city-miniprogram

Jing-Jiu лет назад: 4
Родитель
Сommit
1230a44bc3
5 измененных файлов с 478 добавлено и 63 удалено
  1. 8 0
      pages.json
  2. 87 12
      pages/activity/activity_deatil.vue
  3. 50 33
      pages/activity/index.vue
  4. 24 18
      pages/selfCenter/index.vue
  5. 309 0
      pages/selfCenter/my_activity.vue

+ 8 - 0
pages.json

@@ -32,6 +32,14 @@
 			}
 		},
 		{
+			"path": "pages/selfCenter/my_activity",
+			"style": {
+				"navigationBarTitleText": "我的活动",
+				"navigationBarBackgroundColor": "#02A7F0",
+				"navigationBarTextStyle": "white"
+			}
+		},
+		{
 			"path": "pages/appeal/index",
 			"style": {
 				"navigationBarTitleText": "提诉求",

+ 87 - 12
pages/activity/activity_deatil.vue

@@ -8,7 +8,7 @@
         <view class="read">阅读量 {{ model.read }}</view>
       </view>
       <view class="header-image">
-        <image src="/static/activity/u1104.png" alt="" />
+        <image :src="model.url" alt="" />
       </view>
     </view>
     <view class="active-deatil">
@@ -40,9 +40,10 @@
           @click="signUpActivity"
           :disabled="!(model.status == 0 && model.type == 2)"
           :class="{
-            start: model.status == 0,
+            start: model.status == 0 && model.type == 2,
             begun: model.status == 1,
             ended: model.status == 2,
+            falseStart: model.status == 0 && model.type == 1,
           }"
         >
           {{ model.activiteState }}
@@ -58,6 +59,40 @@
 import md5 from "@/common/md5.js";
 import activity_rich_card from "../policy/policy_rich_card";
 export default {
+  filters: {
+    formDateTime(value) {
+      if (value) {
+        const time = new Date(value * 1000);
+        const y = time.getFullYear();
+        const m =
+          time.getMonth() + 1 < 10
+            ? "0" + (time.getMonth() + 1)
+            : time.getMonth() + 1;
+        const d = time.getDate() < 10 ? "0" + time.getDate() : time.getDate();
+        // const h = time.getHours()
+        // const mm = time.getMinutes();
+        // const s = time.getSeconds();
+        return y + "." + m + "." + d;
+      } else {
+        return "";
+      }
+    },
+    formDateTimeSecond(value) {
+      if (value) {
+        const time = new Date(value * 1000);
+        // const y = time.getFullYear();
+        // const m = (time.getMonth() + 1) < 10 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1);
+        // const d = time.getDate() < 10 ? '0' + time.getDate(): time.getDate();
+        const h =
+          time.getHours() < 10 ? "0" + time.getHours() : time.getHours();
+        const mm =
+          time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes();
+        return h + ":" + mm;
+      } else {
+        return "";
+      }
+    },
+  },
   components: {
     activityRichCard: activity_rich_card,
   },
@@ -65,15 +100,15 @@ export default {
     return {
       id: "",
       model: {
-        title: "400场讲座,200多门课程,免费送上门!就等你来申请啦~",
+        title: "",
         read: 123,
         url: "",
-        date: "2021.08.20 14:00 - 2021.08.30 17:00",
+        date: "",
         type: 1,
         status: 0,
-        way: "区人力资源局",
+        way: "",
         share: 0,
-        activiteState: "活动进行中",
+        activiteState: "",
       },
       textModel: {
         title: "活动内容",
@@ -84,7 +119,8 @@ export default {
   },
   onLoad(op) {
     this.id = op.id;
-    // this.getActivityDeatil();
+
+    this.getActivityDeatil();
   },
   methods: {
     getActivityDeatil() {
@@ -115,10 +151,42 @@ export default {
         },
         data: postData,
         success: (res) => {
-          console.log(res);
-          if (res.data.code === 200) {
-            this.getRich();
+          if (res.data.code == 200) {
+            console.log(res);
+            let data = res.data.data;
+            this.model.title = data.name;
+            this.model.read =
+              parseInt(data.base_read_count) + parseInt(data.real_read_count);
+            this.model.url = getApp().globalData.shareUrl + data.pic_url;
+            let arr = ["start_time", "end_time"];
+            let ans = [];
+            for (const item of arr) {
+              let time = this.$options.filters["formDateTime"](data[item]);
+              let timeSecond = this.$options.filters["formDateTimeSecond"](
+                data[item]
+              );
+              ans.push(time + " " + timeSecond);
+            }
+            this.model.date = ans.join(" - ");
+            this.model.type = data.type;
+            this.model.status = data.status;
+            this.model.way = data.sponsor;
+            this.model.share =
+              parseInt(data.real_repost_count) +
+              parseInt(data.base_repost_count);
+            if (data.status == 0) {
+              if (data.type == 2) {
+                this.model.activiteState = "我要参加";
+              } else {
+                this.model.activiteState = "活动待开始";
+              }
+            } else if (data.status == 1) {
+              this.model.activiteState = "活动进行中";
+            } else {
+              this.model.activiteState = "活动已结束";
+            }
           }
+          this.getRich();
         },
         fail: () => {
           console.log("连接失败");
@@ -129,7 +197,7 @@ export default {
       uni.request({
         url:
           getApp().globalData.shareUrl +
-          `content/business/${Math.floor(this.id / 1000)}/${this.id}.html`,
+          `content/activity/${Math.floor(this.id / 1000)}/${this.id}.html`,
         method: "GET",
         header: {
           "content-type": "application/x-www-form-urlencoded",
@@ -174,7 +242,9 @@ export default {
         },
         data: postData,
         success: (res) => {
-          console.log(res);
+          if(res.data.code==200){
+            console.log("报名成功");
+          }
         },
         fail: () => {
           console.log("连接失败");
@@ -216,6 +286,7 @@ export default {
       image {
         width: 100%;
         height: 100%;
+        border-radius: 10%;
       }
     }
   }
@@ -308,6 +379,10 @@ export default {
         color: #aaaaaa;
         border-color: #aaaaaa;
       }
+      .falseStart {
+        color: #70b603;
+        border-color: #70b603;
+      }
     }
   }
 }

+ 50 - 33
pages/activity/index.vue

@@ -40,14 +40,14 @@
           <div class="right">
             <div class="right-title">{{ active.title }}</div>
             <div class="right-inf">
-              <div class="inf-type" style="width: 17%;">
+              <div class="inf-type" style="width: 17%">
                 <div
                   :class="{ color: active.type == 1 }"
                   class="originColor"
                 ></div>
                 <div>{{ active.type == 1 ? "线上" : "线下" }}</div>
               </div>
-              <div class="inf-way" style="width: 24%;">
+              <div class="inf-way" style="width: 24%">
                 {{ active.way }}
               </div>
               <div class="inf-date">
@@ -57,9 +57,15 @@
           </div>
         </div>
         <div class="readShare">
-		  <div v-show="active.status == '0'" class="active-tips-box wait-color">活动待开始</div>
-		  <div v-show="active.status == '1'" class="active-tips-box ing-color">活动进行中</div>
-		  <div v-show="active.status == '2'" class="active-tips-box end-color">活动已结束</div>
+          <div v-show="active.status == '0'" class="active-tips-box wait-color">
+            活动待开始
+          </div>
+          <div v-show="active.status == '1'" class="active-tips-box ing-color">
+            活动进行中
+          </div>
+          <div v-show="active.status == '2'" class="active-tips-box end-color">
+            活动已结束
+          </div>
           <div class="read">浏览 {{ active.read }}</div>
           <div class="share">分享 {{ active.share }}</div>
         </div>
@@ -159,12 +165,12 @@ export default {
         "status":"活动状态 0:待开始;1:已开始; 2:已结束
         "type":"活动类型 1:线上;2 线下"}
         */
-      let type = this.indexType ;
+      let type = this.indexType;
       let state = this.indexState;
       this.activeListCopy = this.activeList.filter((item) => {
         return (
-          ( type == 0 || item.type == type) &&
-          ( state == 0 || item.status == state - 1)
+          (type == 0 || item.type == type) &&
+          (state == 0 || item.status == state - 1)
         );
       });
     },
@@ -222,7 +228,7 @@ export default {
                 read: 0,
                 share: 0,
                 type: "",
-				status:'',
+                status: "",
                 id: "",
                 status: 0,
               };
@@ -230,12 +236,17 @@ export default {
               ob.title = item.name;
               ob.way = item.sponsor;
               let time = this.$options.filters["globalTime"](item.start_time);
-			  let timeSecond = this.$options.filters["globalTime"](item.end_time);
-			  ob.date = time + "至" + timeSecond;
-              ob.read = parseInt(item.base_read_count) + parseInt(item.real_read_count);
-              ob.share =parseInt(item.real_repost_count) +parseInt(item.base_repost_count);
+              let timeSecond = this.$options.filters["globalTime"](
+                item.end_time
+              );
+              ob.date = time + "至" + timeSecond;
+              ob.read =
+                parseInt(item.base_read_count) + parseInt(item.real_read_count);
+              ob.share =
+                parseInt(item.real_repost_count) +
+                parseInt(item.base_repost_count);
               ob.type = item.type;
-			  ob.status = item.status; 
+              ob.status = item.status;
               ob.id = item.id;
               ob.status = item.status;
               return ob;
@@ -299,11 +310,13 @@ export default {
     }
   }
   .actives {
+    width: 83%;
     margin-top: 50rpx;
     padding: 0 40rpx;
     display: flex;
     flex-direction: column;
     .actives-item {
+      width: 100%;
       // height: 150rpx;
       box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
       border-radius: 32rpx;
@@ -324,13 +337,14 @@ export default {
           }
         }
         .right {
-		  width: 80%;
+          width: 80%;
           height: 120rpx;
           box-sizing: border-box;
           display: flex;
           flex-direction: column;
           justify-content: space-between;
           .right-title {
+            width: 100%;
             margin-bottom: 20rpx;
             font-size: 27rpx;
             font-weight: 600;
@@ -339,7 +353,7 @@ export default {
           .right-inf {
             display: flex;
             font-size: 21rpx;
-			align-items: center;
+            align-items: center;
             color: $uni-text-color-grey;
             .inf-type {
               margin-right: 10rpx;
@@ -356,6 +370,9 @@ export default {
             .inf-way {
               margin-right: 20rpx;
             }
+            .inf-date {
+              white-space: nowrap;
+            }
           }
         }
       }
@@ -365,23 +382,23 @@ export default {
         font-size: 20rpx;
         color: rgba(0, 0, 0, 0.3);
         margin-top: 20rpx;
-		align-items: center;
-		.active-tips-box {
-			font-size: 22rpx;
-			padding: 10rpx;
-			border-radius: 10rpx;
-			color: #fff;
-			margin-right: 50rpx;
-		}
-		.wait-color {
-			background-color: #AEE359;
-		}
-		.ing-color {
-			background-color: #00A8EA;
-		}
-		.end-color {
-			background-color: #d7d7d7;
-		}
+        align-items: center;
+        .active-tips-box {
+          font-size: 22rpx;
+          padding: 10rpx;
+          border-radius: 10rpx;
+          color: #fff;
+          margin-right: 50rpx;
+        }
+        .wait-color {
+          background-color: #aee359;
+        }
+        .ing-color {
+          background-color: #00a8ea;
+        }
+        .end-color {
+          background-color: #d7d7d7;
+        }
         .read {
           margin-right: 60rpx;
         }

+ 24 - 18
pages/selfCenter/index.vue

@@ -51,8 +51,16 @@ export default {
       userHeadImg: "",
       userNickName: "",
       list: [
-        { icoin: "/static/selfCenter/suggest.png", name: "我的建议" },
-        { icoin: "/static/selfCenter/sign.png", name: "我的报名" },
+        { 
+		 icoin: "/static/selfCenter/suggest.png",
+		 name: "我的建议" ,
+		 url: "/pages/appeal/myAppeal",
+		 },
+        { 
+		  icoin: "/static/selfCenter/sign.png", 
+		  name: "我的报名" ,
+		  url: "/pages/selfCenter/my_activity",
+		 },
         {
           icoin: "/static/selfCenter/collection.png",
           name: "我的收藏",
@@ -82,26 +90,31 @@ export default {
     },
     goDetailFn(index, url) {
       let that = this;
+	  if(!that.isAuth){
+		  uni.showToast({
+		    title: "您还没有登录授权",
+		    duration: 2500,
+		    icon: "none",
+		  });
+		  return;
+	  }
       switch (index) {
         case 0: //我的建议
+			uni.navigateTo({
+			  url,
+			}); 
           break;
         case 1: //我的报名
+			uni.navigateTo({
+			  url,
+			}); 
           break;
         case 2: //我的收藏
-		 if(that.isAuth){
 			uni.navigateTo({
 			  url,
 			}); 
-		 }else {
-			 uni.showToast({
-			   title: "您还没有登录授权",
-			   duration: 2500,
-			   icon: "none",
-			 });
-		 }
           break;
         case 3: //退出登录
-          if (that.isAuth) {
             uni.showModal({
               title: "确定退出登录吗?",
               success(res) {
@@ -112,13 +125,6 @@ export default {
                 }
               },
             });
-          } else {
-            uni.showToast({
-              title: "您还没有登录授权",
-              duration: 2500,
-              icon: "none",
-            });
-          }
           break;
       }
     },

+ 309 - 0
pages/selfCenter/my_activity.vue

@@ -0,0 +1,309 @@
+<template>
+  <view class="content">
+    <div class="actives">
+      <div
+        v-for="(active, idx) in activeListCopy"
+        :key="idx"
+        class="actives-item"
+        @click="goDeatil(active.id)"
+      >
+        <div class="active-content">
+          <div class="img-box"><img :src="active.url" alt="" /></div>
+          <div class="right">
+            <div class="right-title">{{ active.title }}</div>
+            <div class="right-inf">
+              <div class="inf-type" style="width: 17%;">
+                <div
+                  :class="{ color: active.type == 1 }"
+                  class="originColor"
+                ></div>
+                <div>{{ active.type == 1 ? "线上" : "线下" }}</div>
+              </div>
+              <div class="inf-way" style="width: 24%;">
+                {{ active.way }}
+              </div>
+              <div class="inf-date">
+                {{ active.date }}
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="readShare">
+		  <div v-show="active.status == '0'" class="active-tips-box wait-color">活动待开始</div>
+		  <div v-show="active.status == '1'" class="active-tips-box ing-color">活动进行中</div>
+		  <div v-show="active.status == '2'" class="active-tips-box end-color">活动已结束</div>
+          <div class="read">浏览 {{ active.read }}</div>
+          <div class="share">分享 {{ active.share }}</div>
+        </div>
+      </div>
+    </div>
+  </view>
+</template>
+
+<script>
+import md5 from "@/common/md5.js";
+export default {
+  data() {
+    return {
+      message: "我的活动",
+      themeColor: "#007AFF",
+      mode: "selector",
+      typeActive: true,
+      indexType: 0,
+      indexState: 0,
+      activeList: [
+        // {
+        //   url: "/static/activity/1.png",
+        //   title: "400场讲座,200门课程,免费送上门!就等你申请",
+        //   way: "区人力资源局",
+        //   date: "2021-08-08",
+        //   read: 322,
+        //   share: 1,
+        //   type: 1, //1线上
+        // },
+        // {
+        //   url: "/static/activity/2.png",
+        //   title: "智能制造商标品牌培育系列培训活动",
+        //   way: "市场监督管理局",
+        //   date: "2021-08-07",
+        //   read: 322,
+        //   share: 1,
+        //   type: 2, //2线下
+        // },
+      ],
+      activeListCopy: [],
+    };
+  },
+  onLoad() {
+    this.getActive();
+  },
+  methods: {
+    goDeatil(id) {
+      uni.navigateTo({
+        url: "/pages/activity/activity_deatil?id=" + id,
+      });
+    },
+    getActive() {
+      let md5Sign = md5(
+        "method=" +
+          "activity" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=activity&source=activity&action=my_list&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      let postData = {
+        // page: 1,
+        // page_size: 15,
+		openId:getApp().globalData.open_id
+      };
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: postData,
+        success: (res) => {
+          // console.log(res);
+          if (res.data.code === 200) {
+            let list = res.data.data.list;
+            this.activeList = list.map((item) => {
+              /*
+                  url: "/static/activity/2.png",
+            title: "智能制造商标品牌培育系列培训活动",
+            way: "市场监督管理局",
+            date: "2021-08-07",
+            read: 322,
+            share: 1,
+            type: 0, //0线下
+             */
+              let ob = {
+                url: "",
+                title: "",
+                way: "",
+                date: "",
+                read: 0,
+                share: 0,
+                type: "",
+				status:'',
+                id: "",
+                status: 0,
+              };
+              ob.url = getApp().globalData.shareUrl + item.pic_url;
+              ob.title = item.name;
+              ob.way = item.sponsor;
+              let time = this.$options.filters["globalTime"](item.start_time);
+			  let timeSecond = this.$options.filters["globalTime"](item.end_time);
+			  ob.date = time + "至" + timeSecond;
+              ob.read = parseInt(item.base_read_count) + parseInt(item.real_read_count);
+              ob.share =parseInt(item.real_repost_count) +parseInt(item.base_repost_count);
+              ob.type = item.type;
+			  ob.status = item.status; 
+              ob.id = item.id;
+              ob.status = item.status;
+              return ob;
+            });
+            this.activeListCopy = this.activeList;
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.content {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  width: 100%;
+  .choose-box {
+    padding: 20rpx 0;
+    width: 100%;
+    display: flex;
+    position: fixed;
+    height: 50rpx;
+    top: 0;
+    margin-bottom: 50rpx;
+    .type,
+    .state {
+      width: 50%;
+      display: flex;
+      justify-content: center;
+      position: relative;
+      .packer {
+        width: 100%;
+        .picker_title {
+          z-index: 99;
+          width: 100%;
+          height: 100%;
+          display: flex;
+          justify-content: center;
+        }
+      }
+    }
+
+    .type::after,
+    .state::after {
+      z-index: -1;
+      content: "";
+      position: absolute;
+      right: 30%;
+      top: 20%;
+      width: 0;
+      height: 0;
+      border-top: 15rpx solid rgb(173, 173, 173);
+      border-left: 15rpx solid transparent;
+      border-right: 15rpx solid transparent;
+    }
+  }
+  .actives {
+    margin-top: 50rpx;
+    padding: 0 40rpx;
+    display: flex;
+    flex-direction: column;
+    .actives-item {
+      // height: 150rpx;
+      box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
+      border-radius: 32rpx;
+      margin-top: 20px;
+      padding: 20rpx;
+      display: flex;
+      flex-direction: column;
+      .active-content {
+        display: flex;
+        .img-box {
+          margin-right: 20rpx;
+          width: 120rpx;
+          height: 120rpx;
+          img {
+            width: 100%;
+            height: 100%;
+            border-radius: 10%;
+          }
+        }
+        .right {
+		  width: 80%;
+          height: 120rpx;
+          box-sizing: border-box;
+          display: flex;
+          flex-direction: column;
+          justify-content: space-between;
+          .right-title {
+            margin-bottom: 20rpx;
+            font-size: 27rpx;
+            font-weight: 600;
+            letter-spacing: 3rpx;
+          }
+          .right-inf {
+            display: flex;
+            font-size: 21rpx;
+			align-items: center;
+            color: $uni-text-color-grey;
+            .inf-type {
+              margin-right: 10rpx;
+              display: flex;
+              align-items: center;
+              .originColor {
+                margin-right: 8rpx;
+                height: 20rpx;
+                width: 20rpx;
+                border-radius: 50%;
+                background-color: #ffcf86;
+              }
+            }
+            .inf-way {
+              margin-right: 20rpx;
+            }
+          }
+        }
+      }
+      .readShare {
+        display: flex;
+        justify-content: flex-end;
+        font-size: 20rpx;
+        color: rgba(0, 0, 0, 0.3);
+        margin-top: 20rpx;
+		align-items: center;
+		.active-tips-box {
+			font-size: 22rpx;
+			padding: 10rpx;
+			border-radius: 10rpx;
+			color: #fff;
+			margin-right: 50rpx;
+		}
+		.wait-color {
+			background-color: #AEE359;
+		}
+		.ing-color {
+			background-color: #00A8EA;
+		}
+		.end-color {
+			background-color: #d7d7d7;
+		}
+        .read {
+          margin-right: 60rpx;
+        }
+      }
+    }
+  }
+}
+.active {
+  color: $uni-color-primary;
+}
+.color {
+  background-color: #589cff !important;
+}
+</style>