Commit d3ef90ca authored by 郝聪敏's avatar 郝聪敏

Merge branch 'feature/animation' into 'master'

修改推送授权逻辑缓存

See merge request !29
parents a190fd63 23ded92d
<template>
<div class="share-container" @tap="hideMenu" >
<div class="share-container">
<div class="dialog">
<div class="star">
<image class="star-image" src="/static/images/star@2x.png"></image>
......
......@@ -249,7 +249,7 @@
width: 30rpx;
height: 138rpx;
margin: -40rpx -100rpx;
box-shadow: 50rpx -23rpx 0 -8rpx rgba(255, 255, 255, 0.22), 75rpx -10rpx 0 -12rpx rgba(255, 255, 255, 0.18);
box-shadow: 50rpx -23rpx 0 -8rpx rgba(255, 255, 255, 0.18), 75rpx -10rpx 0 -12rpx rgba(255, 255, 255, 0.15);
animation: shine1 1.2s infinite ease;
}
}
......
......@@ -245,6 +245,7 @@
<open-animation v-if="showAwardsModal" :joinRecord="mainInfo && mainInfo.joinRecord"></open-animation>
<shared-popup v-if="showShareModal" :inviteinfo="mainInfo && mainInfo.inviteRecord" @getSharedGold="getSharedGold"></shared-popup>
<popup @showMenu="showMenu" :showMenus="showMenus"></popup>
<van-dialog id="van-dialog" confirmButtonColor="#FF5D15"/>
</view>
</template>
......@@ -254,6 +255,7 @@
import { mapState, mapActions } from '@wepy/x';
import wepy from '@wepy/core';
import Notify from '../components/vant/notify/notify';
import Dialog from '../components/vant/dialog/dialog';
import { login, register, getUserInfo, addGold, getPrizeList, signIn, getActivityFeed } from '../common/api.js';
wepy.page({
store,
......@@ -471,6 +473,24 @@
'7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'
];
const { subscriptionsSetting } = await wepy.wx.getSetting({ withSubscriptions: true });
if (subscriptionsSetting && subscriptionsSetting.mainSwitch && subscriptionsSetting.itemSettings) {
const isAlwaysAgree = tmplIds.every(v => subscriptionsSetting.itemSettings[v] === 'accept');
if (!isAlwaysAgree) {
try {
await Dialog.alert({
message: '点击右上角“...” - 设置 - 消息订阅,开启接收订阅消息并选择所有消息',
showCancelButton: true,
confirmButtonText: '去设置'
});
await wepy.wx.openSetting();
} catch (e) {
console.log(e || e.message);
}
return;
}
}
wx.requestSubscribeMessage({
tmplIds: [
'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',
......@@ -478,11 +498,11 @@
'7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'
],
success (res) {
console.log('requestSubscribeMessage success', res);
if (res.errMsg === 'requestSubscribeMessage:ok') {
const rs = tmplIds.some(v => res[v] === 'accept');
const rs = tmplIds.every(v => res[v] === 'accept');
if (rs) {
that.sign = true;
setTimeout(async () => {
const innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.autoplay = true;
......@@ -497,20 +517,11 @@
if (coins === 0) return;
that.mainInfo.account.quantity = coins;
}, 1500);
} else {
Notify({ message: '签到必须同意推送授权!', background: '#FF5D15', safeAreaInsetTop: true });
}
}
},
fail (res) {
console.log('requestSubscribeMessage fail', res);
let info = '订阅消息失败,请稍后重试';
switch (res.errCode) {
case '20004':
info = '您关闭了主开关,无法进行订阅';
break;
}
Notify({ message: info, background: '#FF5D15', safeAreaInsetTop: true });
}
});
},
......@@ -650,7 +661,8 @@
'popup': '~@/components/custom/popup',
'van-notify': '~@/components/vant/notify/index',
'shared-popup': '~@/components/custom/sharedPopup',
'video-loading': '~@/components/custom/loading'
'video-loading': '~@/components/custom/loading',
'van-dialog': '~@/components/vant/dialog/index'
},
navigationStyle: "custom",
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment