Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
23ded92d
Commit
23ded92d
authored
May 29, 2020
by
郝聪敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改推送授权逻辑缓存
parent
a190fd63
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
14 deletions
+26
-14
sharedPopup.wpy
src/components/custom/sharedPopup.wpy
+1
-1
sign.wpy
src/components/custom/sign.wpy
+1
-1
index.wpy
src/pages/index.wpy
+24
-12
No files found.
src/components/custom/sharedPopup.wpy
View file @
23ded92d
<template>
<template>
<div class="share-container"
@tap="hideMenu"
>
<div class="share-container">
<div class="dialog">
<div class="dialog">
<div class="star">
<div class="star">
<image class="star-image" src="/static/images/star@2x.png"></image>
<image class="star-image" src="/static/images/star@2x.png"></image>
...
...
src/components/custom/sign.wpy
View file @
23ded92d
...
@@ -249,7 +249,7 @@
...
@@ -249,7 +249,7 @@
width: 30rpx;
width: 30rpx;
height: 138rpx;
height: 138rpx;
margin: -40rpx -100rpx;
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;
animation: shine1 1.2s infinite ease;
}
}
}
}
...
...
src/pages/index.wpy
View file @
23ded92d
...
@@ -245,6 +245,7 @@
...
@@ -245,6 +245,7 @@
<open-animation v-if="showAwardsModal" :joinRecord="mainInfo && mainInfo.joinRecord"></open-animation>
<open-animation v-if="showAwardsModal" :joinRecord="mainInfo && mainInfo.joinRecord"></open-animation>
<shared-popup v-if="showShareModal" :inviteinfo="mainInfo && mainInfo.inviteRecord" @getSharedGold="getSharedGold"></shared-popup>
<shared-popup v-if="showShareModal" :inviteinfo="mainInfo && mainInfo.inviteRecord" @getSharedGold="getSharedGold"></shared-popup>
<popup @showMenu="showMenu" :showMenus="showMenus"></popup>
<popup @showMenu="showMenu" :showMenus="showMenus"></popup>
<van-dialog id="van-dialog" confirmButtonColor="#FF5D15"/>
</view>
</view>
</template>
</template>
...
@@ -254,6 +255,7 @@
...
@@ -254,6 +255,7 @@
import { mapState, mapActions } from '@wepy/x';
import { mapState, mapActions } from '@wepy/x';
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import Notify from '../components/vant/notify/notify';
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';
import { login, register, getUserInfo, addGold, getPrizeList, signIn, getActivityFeed } from '../common/api.js';
wepy.page({
wepy.page({
store,
store,
...
@@ -471,6 +473,24 @@
...
@@ -471,6 +473,24 @@
'7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'
'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({
wx.requestSubscribeMessage({
tmplIds: [
tmplIds: [
'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',
'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',
...
@@ -478,11 +498,11 @@
...
@@ -478,11 +498,11 @@
'7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'
'7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'
],
],
success (res) {
success (res) {
console.log('requestSubscribeMessage success', res);
if (res.errMsg === 'requestSubscribeMessage:ok') {
if (res.errMsg === 'requestSubscribeMessage:ok') {
const rs = tmplIds.
some
(v => res[v] === 'accept');
const rs = tmplIds.
every
(v => res[v] === 'accept');
if (rs) {
if (rs) {
that.sign = true;
that.sign = true;
setTimeout(async () => {
setTimeout(async () => {
const innerAudioContext = wx.createInnerAudioContext();
const innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.autoplay = true;
...
@@ -497,20 +517,11 @@
...
@@ -497,20 +517,11 @@
if (coins === 0) return;
if (coins === 0) return;
that.mainInfo.account.quantity = coins;
that.mainInfo.account.quantity = coins;
}, 1500);
}, 1500);
} else {
Notify({ message: '签到必须同意推送授权!', background: '#FF5D15', safeAreaInsetTop: true });
}
}
}
}
},
},
fail (res) {
fail (res) {
console.log('requestSubscribeMessage 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 @@
...
@@ -650,7 +661,8 @@
'popup': '~@/components/custom/popup',
'popup': '~@/components/custom/popup',
'van-notify': '~@/components/vant/notify/index',
'van-notify': '~@/components/vant/notify/index',
'shared-popup': '~@/components/custom/sharedPopup',
'shared-popup': '~@/components/custom/sharedPopup',
'video-loading': '~@/components/custom/loading'
'video-loading': '~@/components/custom/loading',
'van-dialog': '~@/components/vant/dialog/index'
},
},
navigationStyle: "custom",
navigationStyle: "custom",
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment