|
@@ -5,7 +5,7 @@
|
|
|
:content-style="{ fontSize: '32rpx' }"
|
|
|
@confirm="confirmModal"
|
|
|
:confirm-text="confirmText"
|
|
|
- :cancel-text="editIsShowDlg ? '前去修改' : '取消'"
|
|
|
+ :cancel-text="editIsShowDlg ? '前去修改' : '不加入'"
|
|
|
:show-cancel-button="show_cancel_button"
|
|
|
@cancel="cancelModal"
|
|
|
:show-title="false"
|
|
@@ -191,7 +191,7 @@ export default {
|
|
|
: this.goFollowShow
|
|
|
? "去关注"
|
|
|
: this.show
|
|
|
- ? "知道了"
|
|
|
+ ? "加入"
|
|
|
: "";
|
|
|
return text;
|
|
|
},
|
|
@@ -380,6 +380,7 @@ export default {
|
|
|
//正常的
|
|
|
contentBtn() {
|
|
|
this.$emit("cancelShowBtn", this.idTypeCancel, this.signupType, this.idTypeCancel.isNum);
|
|
|
+ this.addCalendarHandler();
|
|
|
},
|
|
|
//去关注
|
|
|
goFollowShowBtn() {
|
|
@@ -440,6 +441,75 @@ export default {
|
|
|
this.showhasPermission = false;
|
|
|
this.$parent.isShowhasPermission = false;
|
|
|
},
|
|
|
+ handleAddCalendar() {
|
|
|
+ wx.getSetting({
|
|
|
+ success: (res) => {
|
|
|
+ // 判断是否已经授权
|
|
|
+ if (!res.authSetting["scope.addPhoneCalendar"]) {
|
|
|
+ wx.authorize({
|
|
|
+ scope: "scope.addPhoneCalendar",
|
|
|
+ success: () => {
|
|
|
+ // 用户已授权,调用添加日程 API
|
|
|
+ wx.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "日历授权成功",
|
|
|
+ confirmText: "加入日历",
|
|
|
+ confirmColor: "#376cbb",
|
|
|
+ success: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ this.addCalendarHandler();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail(res) {
|
|
|
+ // 用户拒绝授权,提示用户授权
|
|
|
+ wx.showModal({
|
|
|
+ title: "提示",
|
|
|
+ content: "需要获取用户日历权限",
|
|
|
+ confirmText: "前往设置",
|
|
|
+ confirmColor: "#376cbb",
|
|
|
+ success(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ wx.openSetting(); // 打开小程序设置页面,可以让用户开启需要的权限
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.addCalendarHandler();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addCalendarHandler() {
|
|
|
+ // 已经授权,调用添加日程 API
|
|
|
+ let dateTime = new Date(this.jurisdictionList.ActivityTime);
|
|
|
+ let timeOffset = this.jurisdictionList.ActivityType == 1 ? 7200 : 900;
|
|
|
+ wx.addPhoneCalendar({
|
|
|
+ title: this.jurisdictionList.ActivityTypeName, // 日程标题,必填项
|
|
|
+ startTime: dateTime.getTime() / 1000, // 日程开始时间,必填项
|
|
|
+ alarmOffset: timeOffset, // 线下活动,活动开始时间前2小时 || 线上活动,活动开始时间前15分钟
|
|
|
+ success(res) {
|
|
|
+ // 日程添加成功的回调函数
|
|
|
+ wx.showToast({
|
|
|
+ title: "添加日程成功",
|
|
|
+ icon: "success",
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail(res) {
|
|
|
+ console.log(res);
|
|
|
+ // 日程添加失败的回调函数
|
|
|
+ wx.showToast({
|
|
|
+ title: "添加日程失败",
|
|
|
+ icon: "none",
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
// 免费送月卡
|