|
|
@@ -31,14 +31,15 @@
|
|
|
<activityRichCard :model="textModel" :isFold="true" />
|
|
|
</view>
|
|
|
<view class="share-box">
|
|
|
- <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="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"
|
|
|
+ <button
|
|
|
+ v-if="!isJoin"
|
|
|
@click="subscribeActivity(model.status)"
|
|
|
:disabled="!(model.status == 0 && model.type == 2)"
|
|
|
:class="{
|
|
|
@@ -50,10 +51,8 @@
|
|
|
>
|
|
|
{{ model.activiteState }}
|
|
|
</button>
|
|
|
- <button disabled="true" class="ended" v-if="isJoin">
|
|
|
- 已报名
|
|
|
- </button>
|
|
|
- </view>
|
|
|
+ <button disabled="true" class="ended" v-if="isJoin">已报名</button>
|
|
|
+ </view>
|
|
|
<!-- "status":"活动状态 0:待开始;1:已开始; 2:已结束
|
|
|
"type":"活动类型 1:线上;2 线下"} -->
|
|
|
</view>
|
|
|
@@ -104,7 +103,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
id: "",
|
|
|
- isJoin:false,
|
|
|
+ isJoin: false,
|
|
|
model: {
|
|
|
title: "",
|
|
|
read: 123,
|
|
|
@@ -115,6 +114,8 @@ export default {
|
|
|
way: "",
|
|
|
share: 0,
|
|
|
activiteState: "",
|
|
|
+ max_person: "",
|
|
|
+ person_count: "",
|
|
|
},
|
|
|
textModel: {
|
|
|
title: "活动内容",
|
|
|
@@ -127,54 +128,54 @@ export default {
|
|
|
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();
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
+ 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=" +
|
|
|
@@ -193,7 +194,7 @@ export default {
|
|
|
md5Sign;
|
|
|
let postData = {
|
|
|
id: this.id,
|
|
|
- openId:getApp().globalData.open_id
|
|
|
+ openId: getApp().globalData.open_id,
|
|
|
};
|
|
|
//获取文章
|
|
|
uni.request({
|
|
|
@@ -206,7 +207,7 @@ export default {
|
|
|
success: (res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
let data = res.data.data;
|
|
|
- this.isJoin = data.active ? true : false;
|
|
|
+ this.isJoin = data.active ? true : false;
|
|
|
this.model.title = data.name;
|
|
|
this.model.read =
|
|
|
parseInt(data.base_read_count) + parseInt(data.real_read_count);
|
|
|
@@ -224,6 +225,10 @@ export default {
|
|
|
this.model.type = data.type;
|
|
|
this.model.status = data.status;
|
|
|
this.model.way = data.sponsor;
|
|
|
+ // this.model.max_person = data.max_person;
|
|
|
+ // this.model.person_count = data.person_count;
|
|
|
+ this.model.max_person = 1;
|
|
|
+ this.model.person_count = 2;
|
|
|
this.model.share =
|
|
|
parseInt(data.real_repost_count) +
|
|
|
parseInt(data.base_repost_count);
|
|
|
@@ -246,12 +251,20 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
- replaceImg(html){
|
|
|
- let result = html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (match,capture) {
|
|
|
- return '<img src=' + getApp().globalData.shareUrl + capture +' style="max-width:100%;height:auto;display:block;margin:10px 0;"/>';
|
|
|
- });
|
|
|
- return result
|
|
|
- },
|
|
|
+ replaceImg(html) {
|
|
|
+ let result = html.replace(
|
|
|
+ /<img [^>]*src=['"]([^'"]+)[^>]*>/gi,
|
|
|
+ function (match, capture) {
|
|
|
+ return (
|
|
|
+ "<img src=" +
|
|
|
+ getApp().globalData.shareUrl +
|
|
|
+ capture +
|
|
|
+ ' style="max-width:100%;height:auto;display:block;margin:10px 0;"/>'
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+ return result;
|
|
|
+ },
|
|
|
getRich() {
|
|
|
uni.request({
|
|
|
url:
|
|
|
@@ -263,7 +276,7 @@ export default {
|
|
|
},
|
|
|
success: (res) => {
|
|
|
if (res.statusCode === 200) {
|
|
|
- this.textModel.text = this.replaceImg(res.data);
|
|
|
+ this.textModel.text = this.replaceImg(res.data);
|
|
|
}
|
|
|
},
|
|
|
fail: () => {
|
|
|
@@ -271,17 +284,28 @@ 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()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ subscribeActivity(status) {
|
|
|
+ if (this.model.person_count >= this.model.max_person) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "报名人数已上限",
|
|
|
+ icon:'error',
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ 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=" +
|
|
|
@@ -311,12 +335,12 @@ export default {
|
|
|
data: postData,
|
|
|
success: (res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
- this.isJoin = true;
|
|
|
- uni.showToast({
|
|
|
- title:'报名成功',
|
|
|
- icon:'none',
|
|
|
- duration:2500
|
|
|
- })
|
|
|
+ this.isJoin = true;
|
|
|
+ uni.showToast({
|
|
|
+ title: "报名成功",
|
|
|
+ icon: "none",
|
|
|
+ duration: 2500,
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
fail: () => {
|
|
|
@@ -404,13 +428,13 @@ export default {
|
|
|
width: 50rpx;
|
|
|
height: 50rpx;
|
|
|
position: relative;
|
|
|
- button::after {
|
|
|
- border: none;
|
|
|
- }
|
|
|
+ button::after {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
image {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
- position: absolute;
|
|
|
+ position: absolute;
|
|
|
}
|
|
|
.shareCount {
|
|
|
display: flex;
|