Добавлено уведомление "Оплатим хостинг вместе"

This commit is contained in:
Book Pauk
2020-01-28 19:46:34 +07:00
parent efb2413720
commit 249a4564e0
4 changed files with 104 additions and 3 deletions

View File

@@ -90,6 +90,51 @@
</span> </span>
</el-dialog> </el-dialog>
<el-dialog
title="Здравствуйте, уважаемые читатели!"
:visible.sync="donationVisible"
width="90%">
<div style="word-break: normal">
Стартовала ежегодная акция "Оплатим хостинг вместе".<br><br>
Для оплаты годового хостинга читалки, необходимо собрать сумму около 2000 рублей.
У автора эти деньги есть. Однако будет справедливо, если каждый
сможет проголосовать рублем за то, чтобы читалка так и оставалась:
<ul>
<li>непрерывно улучшаемой</li>
<li>без рекламы</li>
<li>без регистрации</li>
<li>Open Source</li>
</ul>
Автор также обращается с просьбой о помощи в распространении
<a href="https://omnireader.ru" target="_blank">ссылки</a>
<el-tooltip :open-delay="500" effect="light">
<template slot="content">
Скопировать
</template>
<i class="el-icon-copy-document" style="cursor: pointer; font-size: 100%" @click="copyLink('https://omnireader.ru')"></i>
</el-tooltip>
на читалку через тематические форумы, соцсети, мессенджеры и пр.
Чем нас больше, тем легче оставаться на плаву и тем больше мотивации у автора, чтобы продолжать работать над проектом.
<br><br>
Если соберется бóльшая сумма, то разработка децентрализованной библиотеки для свободного обмена книгами будет по воможности ускорена.
<br><br>
P.S. При необходимости можно воспользоваться подходящим обменником на <a href="https://www.bestchange.ru" target="_blank">bestchange.ru</a>
<br><br>
<el-button type="success" round @click="openDonate">Помочь проекту</el-button>
</div>
<span slot="footer" class="dialog-footer">
<span class="clickable" style="font-size: 60%; color: grey" @click="donationDialogDisable">Больше не показывать</span>
<br><br>
<el-button @click="donationDialogRemind">Напомнить позже</el-button>
</span>
</el-dialog>
</el-main> </el-main>
</el-container> </el-container>
</template> </template>
@@ -200,6 +245,7 @@ class Reader extends Vue {
whatsNewVisible = false; whatsNewVisible = false;
whatsNewContent = ''; whatsNewContent = '';
donationVisible = false;
created() { created() {
this.loading = true; this.loading = true;
@@ -258,9 +304,10 @@ class Reader extends Vue {
this.checkActivateDonateHelpPage(); this.checkActivateDonateHelpPage();
this.loading = false; this.loading = false;
await this.showWhatsNew();
this.updateRoute(); this.updateRoute();
await this.showWhatsNew();
await this.showDonation();
})(); })();
} }
@@ -272,6 +319,7 @@ class Reader extends Vue {
this.clickControl = settings.clickControl; this.clickControl = settings.clickControl;
this.blinkCachedLoad = settings.blinkCachedLoad; this.blinkCachedLoad = settings.blinkCachedLoad;
this.showWhatsNewDialog = settings.showWhatsNewDialog; this.showWhatsNewDialog = settings.showWhatsNewDialog;
this.showDonationDialog2020 = settings.showDonationDialog2020;
this.showToolButton = settings.showToolButton; this.showToolButton = settings.showToolButton;
this.enableSitesFilter = settings.enableSitesFilter; this.enableSitesFilter = settings.enableSitesFilter;
@@ -337,6 +385,41 @@ class Reader extends Vue {
} }
} }
async showDonation() {
await utils.sleep(3000);
const today = utils.formatDate(new Date(), 'coDate');
if (this.mode == 'omnireader' && today < '2020-03-01' && this.showDonationDialog2020 && this.donationRemindDate != today) {
this.donationVisible = true;
}
}
donationDialogDisable() {
this.donationVisible = false;
if (this.showDonationDialog2020) {
const newSettings = Object.assign({}, this.settings, { showDonationDialog2020: false });
this.commit('reader/setSettings', newSettings);
}
}
donationDialogRemind() {
this.donationVisible = false;
this.commit('reader/setDonationRemindDate', utils.formatDate(new Date(), 'coDate'));
}
openDonate() {
this.donationVisible = false;
this.donateToggle();
}
async copyLink(link) {
const result = await utils.copyTextToClipboard(link);
if (result)
this.$notify.success({message: `Ссылка ${link} успешно скопирована в буфер обмена`});
else
this.$notify.error({message: 'Копирование не удалось'});
}
openVersionHistory() { openVersionHistory() {
this.whatsNewVisible = false; this.whatsNewVisible = false;
this.versionHistoryToggle(); this.versionHistoryToggle();
@@ -455,6 +538,10 @@ class Reader extends Vue {
return this.$store.state.reader.whatsNewContentHash; return this.$store.state.reader.whatsNewContentHash;
} }
get donationRemindDate() {
return this.$store.state.reader.donationRemindDate;
}
addAction(pos) { addAction(pos) {
let a = this.actionList; let a = this.actionList;
if (!a.length || a[a.length - 1] != pos) { if (!a.length || a[a.length - 1] != pos) {

View File

@@ -471,6 +471,14 @@
<el-checkbox v-model="showWhatsNewDialog">Показывать уведомление "Что нового"</el-checkbox> <el-checkbox v-model="showWhatsNewDialog">Показывать уведомление "Что нового"</el-checkbox>
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
<el-form-item label="Уведомление">
<el-tooltip :open-delay="500" effect="light">
<template slot="content">
Показывать уведомление "Оплатим хостинг вместе"
</template>
<el-checkbox v-model="showDonationDialog2020">Показывать "Оплатим хостинг вместе"</el-checkbox>
</el-tooltip>
</el-form-item>
</el-form> </el-form>
<el-form :model="form" size="mini" label-width="120px" @submit.native.prevent> <el-form :model="form" size="mini" label-width="120px" @submit.native.prevent>

View File

@@ -19,6 +19,7 @@ import ElCheckbox from 'element-ui/lib/checkbox';
import ElTabs from 'element-ui/lib/tabs'; import ElTabs from 'element-ui/lib/tabs';
import ElTabPane from 'element-ui/lib/tab-pane'; import ElTabPane from 'element-ui/lib/tab-pane';
import ElTooltip from 'element-ui/lib/tooltip'; import ElTooltip from 'element-ui/lib/tooltip';
import ElRow from 'element-ui/lib/row';
import ElCol from 'element-ui/lib/col'; import ElCol from 'element-ui/lib/col';
import ElContainer from 'element-ui/lib/container'; import ElContainer from 'element-ui/lib/container';
import ElAside from 'element-ui/lib/aside'; import ElAside from 'element-ui/lib/aside';
@@ -43,7 +44,7 @@ import MessageBox from 'element-ui/lib/message-box';
const components = { const components = {
ElMenu, ElMenuItem, ElButton, ElButtonGroup, ElCheckbox, ElTabs, ElTabPane, ElTooltip, ElMenu, ElMenuItem, ElButton, ElButtonGroup, ElCheckbox, ElTabs, ElTabPane, ElTooltip,
ElCol, ElContainer, ElAside, ElMain, ElHeader, ElRow, ElCol, ElContainer, ElAside, ElMain, ElHeader,
ElInput, ElInputNumber, ElSelect, ElOption, ElTable, ElTableColumn, ElInput, ElInputNumber, ElSelect, ElOption, ElTable, ElTableColumn,
ElProgress, ElSlider, ElForm, ElFormItem, ElProgress, ElSlider, ElForm, ElFormItem,
ElColorPicker, ElDialog, ElColorPicker, ElDialog,

View File

@@ -182,6 +182,7 @@ const settingDefaults = {
imageFitWidth: true, imageFitWidth: true,
showServerStorageMessages: true, showServerStorageMessages: true,
showWhatsNewDialog: true, showWhatsNewDialog: true,
showDonationDialog2020: true,
enableSitesFilter: true, enableSitesFilter: true,
fontShifts: {}, fontShifts: {},
@@ -204,6 +205,7 @@ const state = {
profilesRev: 0, profilesRev: 0,
allowProfilesSave: false,//подстраховка для разработки allowProfilesSave: false,//подстраховка для разработки
whatsNewContentHash: '', whatsNewContentHash: '',
donationRemindDate: '',
currentProfile: '', currentProfile: '',
settings: Object.assign({}, settingDefaults), settings: Object.assign({}, settingDefaults),
settingsRev: {}, settingsRev: {},
@@ -238,6 +240,9 @@ const mutations = {
setWhatsNewContentHash(state, value) { setWhatsNewContentHash(state, value) {
state.whatsNewContentHash = value; state.whatsNewContentHash = value;
}, },
setDonationRemindDate(state, value) {
state.donationRemindDate = value;
},
setCurrentProfile(state, value) { setCurrentProfile(state, value) {
state.currentProfile = value; state.currentProfile = value;
}, },