points.vue 4.19 KB
Newer Older
1 2
<template>
  <view class="int">
3 4 5
    <view
      v-for="item in activityList"
      :key="item.id"
chenwei's avatar
chenwei committed
6
    class="contentBox"
7
    >
chenwei's avatar
chenwei committed
8 9 10 11 12 13 14 15 16 17 18 19 20
      <view class="int-content"  @click="toDetail(item.id)">
        <view class="int-content-left">
          <view class="content-tag">
            <view class="tag-text">{{ locale === 'zh' ? item.typeZh : item.typeEn }}</view>
          </view>
          <image
            class="content-image"
            :src="locale === 'zh' ? item.coverImageZh : item.coverImageEn"
          ></image>
        </view>
        <view class="int-content-right">
          <view class="content-title">{{ locale === 'zh' ? item.titleZh : item.titleEn }}</view>
          <view class="content-text">{{ locale === 'zh' ? item.descZh : item.descEn }}</view>
21 22
        </view>
      </view>
chenwei's avatar
chenwei committed
23 24
     <view v-if="item.type == 3||item.type == 4" class="btn"  @click="handleCopyBtn(item, $event)">
        {{ $lang.lang.integral.copy }}
25 26 27 28 29 30
      </view>
    </view>
  </view>
</template>

<script>
31
export default {
32 33 34 35 36 37 38 39 40 41 42 43 44
  data() {
    return {
      activityList: []
    }
  },
  created() {
    this.getActivityList()
  },
  computed: {
    locale() {
      return this.$lang.locale
    }
  },
45
  methods: {
chenwei's avatar
chenwei committed
46 47 48 49 50 51 52 53 54 55 56 57 58
    getCopyText(item) {
      if (item.type == 3) {
        return `${this.locale === 'zh' ? item.extraRecommend.shareContentZh : item.extraRecommend.shareContentEn} ${item.recommendUrl} `
      } else if (item.type == 4) {
        return `${this.locale === 'zh' ? item.titleZh
          : item.titleEn} ${item.extraShare.activityUrl}?id=${item.id}&memberId=${this.$store.getters.id}&language=${this.locale}`
      }
    },
    handleCopyBtn(item ,e){
      this.$request
        .post('/app-api/member/score-rule/share-record/create', {  memberId: this.$store.getters.id,
        ruleId: item.id })
        .then(({ code, data }) => {
chenwei's avatar
chenwei committed
59
          if (code == 0) {
chenwei's avatar
chenwei committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
             const str =this.getCopyText(item)
              uni.setClipboardData({
                  data:str,
                  success:()=>{
                    uni.showToast({
                      title:this.$lang.lang.notices.copySuccess,
                      icon:"none",
                    })
                  }
                })
          //   uni.navigateTo({
          //   url: '/pages/activityShare/index?id=' + item.id + '&memberId=' + this.$store.getters.id+ '&language='+this.locale
          //  })
          }
        
        })


     
     
    },
81
    toDetail(id) {
82
      uni.navigateTo({
83
        url: '/pages/activity_detail/activity_detail?id=' + id
84
      })
85 86 87 88
    },
    // 获取活动列表
    getActivityList() {
      this.$request
chenwei's avatar
chenwei committed
89
        .post('/app-api/member/score-rule/list', { platform: 2,memberId:this.$store.getters.id })
90 91 92 93 94 95
        .then(({ code, data }) => {
          // console.log(res)
          if (code == 0 && data) {
            this.activityList = data
          }
        })
96 97 98
    }
  }
}
99 100 101
</script>

<style lang="scss" scoped>
chenwei's avatar
chenwei committed
102 103 104 105
.contentBox{
  position: relative;
  .btn{
    position: absolute;
chenwei's avatar
chenwei committed
106
    right: 14upx;
chenwei's avatar
chenwei committed
107
    bottom: 10upx;
chenwei's avatar
chenwei committed
108
    padding: 6upx 28upx;
chenwei's avatar
chenwei committed
109
    border-radius: 100px;
chenwei's avatar
chenwei committed
110
    font-size: 24upx;
chenwei's avatar
chenwei committed
111 112 113 114
    border: 1px solid #5382fe;
    color: #5382fe;
  }
}
115 116 117 118 119
.int {
  padding: 30upx 0;
  height: inherit;
  overflow-y: auto;
}
120
.int-content {
121 122 123 124 125 126 127 128 129 130 131
  margin-bottom: 20upx;
  width: 100%;
  height: 220upx;
  display: flex;
  padding: 0 30upx;
  box-sizing: border-box;
  border-bottom: 2upx solid #e7e7e7;
  &:last-child {
    margin-bottom: 0;
  }
}
132
.int-content-left {
133 134 135
  position: relative;
  width: 200upx;
  height: inherit;
136
  .content-image {
137 138 139 140
    width: 200upx;
    height: 200upx;
  }
}
141
.int-content-right {
142 143 144 145
  flex: 1;
  height: inherit;
  padding-left: 20upx;
  box-sizing: border-box;
146
  .content-title {
147 148 149 150
    font-size: 28upx;
    color: #333;
    margin-bottom: 20upx;
  }
151
  .content-text {
152 153 154 155 156
    font-size: 20upx;
    color: #666;
    line-height: 36upx;
  }
}
157
.content-tag {
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9;
  display: flex;
  font-size: 24upx;
  min-width: 120upx;
  height: 40upx;
  color: #fff;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transform: skewX(15deg);
  background-color: #ff4d4f;
  border-top-right-radius: 10upx;
  border-bottom-left-radius: 10upx;
}
.tag-text {
  transform: skewX(-15deg);
}
</style>