12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- const { async } = require("../../../utils/runtime");
- const app = getApp();
- const api = app.api;
- var startX = 0;
- const minXOffset = 40;
- Page({
- /**
- * 记录手势落点坐标
- * @param {*} event
- */
- touchStart: function (event) {
- startX = event.touches[0].pageX;
- },
- /**
- * 手势结束计算偏移量并切换卡片
- * @param {*} event
- */
- touchEnd: async function(event) {
- let endX = event.changedTouches[0].pageX;
- let xOffset = startX - endX;
- if (xOffset > minXOffset) {
- // 授权登录校验
- const isAuth = await app.authorization();
- if(isAuth) {
- // 查询已登记信息
- app.post(api.InvitationGet, {}).then(response => {
- if(response.success) {
- wx.redirectTo({
- url: '../navigation/index',
- })
- }
- }).catch(() => {
- wx.redirectTo({
- url: '../protocol/index',
- })
- })
- }
- }
- },
- /**
- * 手势被打断重置落点坐标
- * @param {*} event
- */
- touchCancel: function(event) {
- startX = 0;
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: async function () {
- wx.setNavigationBarTitle({
- title: '邀请函',
- })
- },
- /** 分享设置 */
- onShareAppMessage: function(res) {
- return { title: '邀请函' }
- }
- })
|