更新记录

1.0.27(2024-12-31)

修复 bug

1.0.3(2023-08-27)

  1. 修复bug

1.0.2(2023-08-27)

  1. 修复bug
查看更多

平台兼容性

uni-app

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
√ √ - - - - 5.0 12 -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
√ × × × × × - × × - × ×

uni-app x

Chrome Safari Android iOS 鸿蒙 微信小程序
- - 5.0 12 - √

mxp-calendar-remind

使用说明

  1. 可想申请试用,试用没问题后在付费
  2. 支持定制,费用最低500元起步

权限说明

【iosAPP】(不配置无法使用)

在manifest.json中 日历(NSCalendarsUsagenotes)输入框下填写对应用途

【安卓APP】(不配置无法使用)

在manifest.json 勾选如下权限

<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />

【其他平台】

无需额外配置

代码示例

使用 HBuilderx 导入插件,然后复制如下代码可运行

<template>
  <view>
    <view class="item">
      <button class="btn" @click="openSystemCalendarEditFun">打开日历编辑</button>
      <button class="btn" @click="addCalendarRemindFun">添加日历提醒</button>
      <button class="btn" @click="updateCalendarRemindFun">更新日历提醒</button>
    </view>
    <view class="item">
      <button class="btn" @click="queryCalendarRemindByTimeFun">根据开始和结束时间查询日历提醒</button>
      <button class="btn" @click="queryCalendarRemindByCalendarIDFun">根据日历ID查询日历提醒</button>
      <button class="btn" @click="queryCalendarRemindByTitleFun">根据标题模糊查询日历提醒</button>
    </view>
    <view class="item">
      <button class="btn" @click="removeSingleCalendarRemindFun">仅删除单个日历提醒</button>
      <button class="btn" @click="removeMultipleCalendarRemindFun">批量删除多个日历提醒</button>
    </view>
  </view>
</template>
<script>
  import {
    addCalendarRemind,
    openSystemCalendarEdit,
    queryCalendarRemindByCalendarID,
    queryCalendarRemindByTime,
    queryCalendarRemindByTitle,
    removeMultipleCalendarRemind,
    removeSingleCalendarRemind,
    updateCalendarRemind,
  } from '@/uni_modules/mxp-calendar-remind';

  export default {
    data() {
      return {
        startTime: new Date().getTime(),
        endTime: new Date().getTime() + 1000 * 60 * 60 * 3,
        calendarID: '',
      };
    },

    methods: {
      updateCalendarRemindFun() {
        const that = this;
        updateCalendarRemind({
          /** 日历提醒ID(创建或查询时返回) */
          calendarID: this.calendarID,

          /** 日历事件标题 */
          title: '事件提醒标题221',

          /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的毫秒数) */
          startTime: this.startTime,

          /** 是否全天事件,默认 false */
          allDay: false,

          /** 事件说明 */
          notes: '事件提醒备注5544',

          /** 事件位置 */
          location: 'congqin222',

          /** 结束时间的 unix 时间戳,默认与开始时间相同 */
          endTime: this.endTime,

          /** 是否提醒,默认 true */
          alarm: true,

          /** 提醒提前量,单位秒,默认 0 表示开始时提醒(支持正负数) */
          alarmOffsetList: [60 * 5, 60 * 15],

          /** 重复规则规则 */
          recurrenceRuleList: [
            // {
            //   /** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
            //   repeatEndTime1: new Date().getTime() + 1000 * 60 * 60 * 24 * 20,
            //   /** 复周期,默认 month 每月重复 合法值:day|week|month|year */
            //   repeatInterval1: 'day',
            //   /** 重复间隔 */
            //   interval: 1,
            // },
          ],

          /** 接口调用成功的回调函数 */
          success(res) {
            console.log('修改成功=====', res);
          },

          /** 接口调用失败的回调函数 */
          fail(res) {
            console.log('修改失败=====', res);
          },
        });
      },
      openSystemCalendarEditFun() {
        const that = this;
        openSystemCalendarEdit({
          /** 日历事件标题 */
          title: '事件提醒标题1',

          /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的毫秒数) */
          startTime: this.startTime,

          /** 是否全天事件,默认 false */
          allDay: true,

          /** 重复间隔 */
          interval: 1,

          /** 事件说明 */
          notes: '事件提醒备注55',

          /** 事件位置 */
          location: 'congqin',

          /** 结束时间的 unix 时间戳,默认与开始时间相同 */
          endTime: this.endTime,

          /** 是否提醒,默认 true */
          alarm: true,

          /** 提醒提前量,单位秒,默认 0 表示开始时提醒(支持正负数) */
          alarmOffset: 60 * 5,

          /** 复周期,默认 month 每月重复 合法值:day|week|month|year */
          repeatInterval: 'day',

          /** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
          repeatEndTime: new Date().getTime() + 1000 * 60 * 60 * 24 * 10,

          /** 接口调用成功的回调函数 */
          success(res) {
            console.log('修改成功=====', res);
          },

          /** 接口调用失败的回调函数 */
          fail(res) {
            console.log('修改失败=====', res);
          },
        });
      },
      addCalendarRemindFun() {
        const that = this;
        addCalendarRemind({
          /** 日历事件标题 */
          title: '事件提醒标题1',

          /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的毫秒数) */
          startTime: this.startTime,

          /** 是否全天事件,默认 false */
          allDay: false,

          /** 重复间隔 */
          interval: 1,

          /** 事件说明 */
          notes: '事件提醒备注55',

          /** 事件位置 */
          location: 'congqin',

          /** 结束时间的 unix 时间戳,默认与开始时间相同 */
          endTime: this.endTime,

          /** 是否提醒,默认 true */
          alarm: true,

          /** 提醒提前量,单位秒,默认 0 表示开始时提醒(支持正负数) */
          alarmOffset: 60 * 5,

          /** 复周期,默认 month 每月重复 合法值:day|week|month|year */
          repeatInterval: 'day',

          /** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
          repeatEndTime: new Date().getTime() + 1000 * 60 * 60 * 24 * 10,

          /** 接口调用成功的回调函数 */
          success(res) {
            if (res.code === 200 && res.data.calendarID) {
              that.calendarID = res.data.calendarID;
            }
            console.log('添加成功=====', res);
          },

          /** 接口调用失败的回调函数 */
          fail(res) {
            console.log('添加失败=====', res);
          },
        });
      },
      queryCalendarRemindByTimeFun() {
        const that = this;
        queryCalendarRemindByTime({
          /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的毫秒数) */
          startTime: this.startTime - 1000 * 60 * 60 * 24 * 10,

          /** 结束时间的 unix 时间戳,默认与开始时间相同 */
          endTime: this.endTime,

          /** 接口调用成功的回调函数 */
          success(res) {
            console.log('查询成功=====', res);
          },

          /** 接口调用失败的回调函数 */
          fail(res) {
            console.log('查询失败=====', res);
          },
        });
      },
      queryCalendarRemindByTitleFun() {
        const that = this;
        queryCalendarRemindByTitle({
          /** 标题 */
          title: '领取',

          /** 接口调用成功的回调函数 */
          success(res) {
            console.log('查询成功=====', res);
            if (res.code === 200 && Array.isArray(res.data)) {
              const calendarIDList = res.data.map((item) => item.calendarID);
              // removeMultipleCalendarRemind({
              //   /** 日历提醒ID数组 */
              //   calendarIDList,

              //   /** 接口调用成功的回调函数 */
              //   success(res1) {
              //     console.log('删除成功=====', res1);
              //   },

              //   /** 接口调用失败的回调函数 */
              //   fail(res1) {
              //     console.log('删除成功=====', res1);
              //   },
              // });
            }
          },

          /** 接口调用失败的回调函数 */
          fail(res) {
            console.log('查询失败=====', res);
          },
        });
      },
      queryCalendarRemindByCalendarIDFun() {
        const that = this;
        queryCalendarRemindByCalendarID({
          /** 日历提醒ID(创建或查询时返回) */
          calendarID: this.calendarID,

          /** 接口调用成功的回调函数 */
          success(res) {
            console.log('查询成功=====', res);
          },

          /** 接口调用失败的回调函数 */
          fail(res) {
            console.log('查询失败=====', res);
          },
        });
      },

      removeSingleCalendarRemindFun() {
        removeSingleCalendarRemind({
          /** 日历提醒ID(创建或查询时返回) */
          calendarID: this.calendarID,

          /** 接口调用成功的回调函数 */
          success(res) {
            console.log('删除成功=====', res);
          },

          /** 接口调用失败的回调函数 */
          fail(res) {
            console.log('删除失败=====', res);
          },
        });
      },

      removeMultipleCalendarRemindFun() {
        removeMultipleCalendarRemind({
          /** 日历提醒ID数组 */
          calendarIDList: this.calendarID ? [this.calendarID] : [],

          /** 接口调用成功的回调函数 */
          success(res) {
            console.log('删除成功=====', res);
          },

          /** 接口调用失败的回调函数 */
          fail(res) {
            console.log('删除失败=====', res);
          },
        });
      },
    },
  };
</script>

<style scoped>
  .item {
    margin-bottom: 10px;
  }
</style>

方法说明

  1. addCalendarRemind 添加日历 属性 类型 必填 说明
    title string 是 日历事件标题
    startTime number 是 开始时间的 unix 时间戳
    allDay boolean 否 是否全天事件,默认 false
    description string 否 事件说明
    location string 否 事件位置
    endTime number 否 结束时间的 unix 时间戳,默认与开始时间相同
    alarm boolean 否 是否提醒,默认 true
    alarmOffset number 否 提醒提前量,单位秒,默认 0 表示开始时提醒
    repeatInterval string 否 重复周期,默认day,可选值: day每天重复, week每周重复,month每月重复(该模式日期不能大于 8日),year每年重复
    repeatEndTime number 否 重复周期结束时间的 unix 时间戳,不填表示一直重复
    success function 否 接口调用成功的回调函数
    fail function 否 接口调用失败的回调函数
    complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
  2. queryCalendarRemindByTitle 根据标题模糊查询日历(仅支持APP) 属性 类型 必填 说明
    title string 是 需要查询的标题
    success function 否 接口调用成功的回调函数
    fail function 否 接口调用失败的回调函数
    complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
  3. queryCalendarRemindByCalendarID 根据日历ID查询日历(仅支持APP) 属性 类型 必填 说明
    calendarID string 是 日历提醒ID(创建或查询时返回)
    success function 否 接口调用成功的回调函数
    fail function 否 接口调用失败的回调函数
    complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
  4. queryCalendarRemindByTime 根据开始或结束时间查询(仅支持APP) 属性 类型 必填 说明
    startTime number 是 开始时间的 unix 时间戳
    endTime number 否 结束时间的 unix 时间戳,默认与开始时间相同
    success function 否 接口调用成功的回调函数
    fail function 否 接口调用失败的回调函数
    complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
  5. openSystemCalendarEdit 打开系统日历编辑页面 (注意安卓绝大多数分手机均不支持返回 添加成功还是取消添加,IOS可正常返回) 属性 类型 必填 说明
    title string 是 日历事件标题
    startTime number 是 开始时间的 unix 时间戳
    allDay boolean 否 是否全天事件,默认 false
    description string 否 事件说明
    location string 否 事件位置
    endTime number 否 结束时间的 unix 时间戳,默认与开始时间相同
    alarm boolean 否 是否提醒,默认 true
    alarmOffset number 否 提醒提前量,单位秒,默认 0 表示开始时提醒(安卓不生效)
    repeatInterval string 否 重复周期,默认day,可选值: day每天重复, week每周重复,month每月重复(该模式日期不能大于 8日),year每年重复
    repeatEndTime number 否 重复周期结束时间的 unix 时间戳,不填表示一直重复
    success function 否 接口调用成功的回调函数
    fail function 否 接口调用失败的回调函数
    complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
  6. removeSingleCalendarRemind 删除单个日历(仅支持APP) 属性 类型 必填 说明
    calendarID string 是 日历提醒ID(创建或查询时返回)
    success function 否 接口调用成功的回调函数
    fail function 否 接口调用失败的回调函数
    complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)
  7. removeMultipleCalendarRemind 删除多个日历(仅支持APP) 属性 类型 必填 说明
    calendarIDList array 是 日历提醒ID的数组(字符串数组)
    success function 否 接口调用成功的回调函数
    fail function 否 接口调用失败的回调函数
    complete function 否 接口调用结束的回调函数(调用成功、失败都会执行)

隐私、权限声明

1. 本插件需要申请的系统权限列表:

日历读写权限

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

无

暂无用户评论。