|
|
@@ -31,13 +31,15 @@
|
|
|
<activityRichCard :model="textModel" :isFold="true" />
|
|
|
</view>
|
|
|
<view class="share-box">
|
|
|
- <view class="share">
|
|
|
- <view class="shareCount">{{ model.share }}</view>
|
|
|
- <image src="../../static/share_icon.png"></image>
|
|
|
- </view>
|
|
|
- <view class="button"
|
|
|
- ><button
|
|
|
- @click="signUpActivity"
|
|
|
+ <view class="share">
|
|
|
+ <button class="share" @click="shareActive()" open-type="share">
|
|
|
+ <image src="../../static/share_icon.png"></image>
|
|
|
+ </button>
|
|
|
+ <view class="shareCount">{{ model.share }}</view>
|
|
|
+ </view>
|
|
|
+ <view class="button">
|
|
|
+ <button v-if="!isJoin"
|
|
|
+ @click="subscribeActivity(model.status)"
|
|
|
:disabled="!(model.status == 0 && model.type == 2)"
|
|
|
:class="{
|
|
|
start: model.status == 0 && model.type == 2,
|
|
|
@@ -47,8 +49,11 @@
|
|
|
}"
|
|
|
>
|
|
|
{{ model.activiteState }}
|
|
|
- </button></view
|
|
|
- >
|
|
|
+ </button>
|
|
|
+ <button disabled="true" class="ended" v-if="isJoin">
|
|
|
+ 已报名
|
|
|
+ </button>
|
|
|
+ </view>
|
|
|
<!-- "status":"活动状态 0:待开始;1:已开始; 2:已结束
|
|
|
"type":"活动类型 1:线上;2 线下"} -->
|
|
|
</view>
|
|
|
@@ -99,6 +104,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
id: "",
|
|
|
+ isJoin:false,
|
|
|
model: {
|
|
|
title: "",
|
|
|
read: 123,
|
|
|
@@ -118,14 +124,61 @@ export default {
|
|
|
},
|
|
|
onLoad(op) {
|
|
|
this.id = op.id;
|
|
|
-
|
|
|
this.getActivityDeatil();
|
|
|
},
|
|
|
methods: {
|
|
|
+ shareRequest() {
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +
|
|
|
+ "user" +
|
|
|
+ "×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" +
|
|
|
+ getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url =
|
|
|
+ getApp().globalData.shareUrl +
|
|
|
+ "api/api.php" +
|
|
|
+ "?method=user&source=activity&action=repost×tamp=" +
|
|
|
+ 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,
|
|
|
+ source_id: this.id,
|
|
|
+ source: "activity",
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ console.log(res);
|
|
|
+ this.model.share = this.model.share + 1;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ shareActive(){
|
|
|
+ let that = this;
|
|
|
+ uni.showShareMenu({
|
|
|
+ title: that.model.title,
|
|
|
+ path: "pages/activity/activity_detail?id=" + that.id,
|
|
|
+ success(res) {
|
|
|
+ that.shareRequest();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
getActivityDeatil() {
|
|
|
let md5Sign = md5(
|
|
|
"method=" +
|
|
|
- "common" +
|
|
|
+ "activity" +
|
|
|
"×tamp=" +
|
|
|
getApp().globalData.globalTimestamp +
|
|
|
"&secret=" +
|
|
|
@@ -134,12 +187,13 @@ export default {
|
|
|
let url =
|
|
|
getApp().globalData.shareUrl +
|
|
|
"api/api.php" +
|
|
|
- "?method=common&source=activity&action=info_by_id×tamp=" +
|
|
|
+ "?method=activity&source=activity&action=info_by_id×tamp=" +
|
|
|
getApp().globalData.globalTimestamp +
|
|
|
"&sign=" +
|
|
|
md5Sign;
|
|
|
let postData = {
|
|
|
id: this.id,
|
|
|
+ openId:getApp().globalData.open_id
|
|
|
};
|
|
|
//获取文章
|
|
|
uni.request({
|
|
|
@@ -151,8 +205,8 @@ export default {
|
|
|
data: postData,
|
|
|
success: (res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
- console.log(res);
|
|
|
let data = res.data.data;
|
|
|
+ this.isJoin = data.active ? true : false;
|
|
|
this.model.title = data.name;
|
|
|
this.model.read =
|
|
|
parseInt(data.base_read_count) + parseInt(data.real_read_count);
|
|
|
@@ -212,10 +266,21 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+ subscribeActivity(status){
|
|
|
+ console.log(status)
|
|
|
+ let that = this;
|
|
|
+ uni.requestSubscribeMessage({
|
|
|
+ tmplIds: ['bSg5tUWHE4qWDeyK31GBejogT1uRgkuBD1_n2I5ptAc','T_ORLiW2C_UM6nZiEerYAokltHgHRGxWCid8eElujus'],
|
|
|
+ success (res) {
|
|
|
+ console.log(res)
|
|
|
+ that.signUpActivity()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
signUpActivity() {
|
|
|
let md5Sign = md5(
|
|
|
"method=" +
|
|
|
- "common" +
|
|
|
+ "activity" +
|
|
|
"×tamp=" +
|
|
|
getApp().globalData.globalTimestamp +
|
|
|
"&secret=" +
|
|
|
@@ -224,7 +289,7 @@ export default {
|
|
|
let url =
|
|
|
getApp().globalData.shareUrl +
|
|
|
"api/api.php" +
|
|
|
- "?method=common&source=activity&action=active×tamp=" +
|
|
|
+ "?method=activity&source=activity&action=active×tamp=" +
|
|
|
getApp().globalData.globalTimestamp +
|
|
|
"&sign=" +
|
|
|
md5Sign;
|
|
|
@@ -241,7 +306,12 @@ export default {
|
|
|
data: postData,
|
|
|
success: (res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
- console.log("报名成功");
|
|
|
+ this.isJoin = true;
|
|
|
+ uni.showToast({
|
|
|
+ title:'报名成功',
|
|
|
+ icon:'none',
|
|
|
+ duration:2500
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
fail: () => {
|
|
|
@@ -329,9 +399,13 @@ export default {
|
|
|
width: 50rpx;
|
|
|
height: 50rpx;
|
|
|
position: relative;
|
|
|
+ button::after {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
image {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
+ position: absolute;
|
|
|
}
|
|
|
.shareCount {
|
|
|
display: flex;
|