弹窗,广告
This commit is contained in:
parent
dba6bcd906
commit
fad0ca9ff0
|
|
@ -84,7 +84,7 @@
|
||||||
// 跳转资源详情
|
// 跳转资源详情
|
||||||
ymfgoCourse(e,courseDetailsId) {
|
ymfgoCourse(e,courseDetailsId) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/me/detail/detail?id=' + e+'&courseDetailsId='+courseDetailsId
|
url: '/me/detail/detailIOS?id=' + e+'&courseDetailsId='+courseDetailsId
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//获取观看记录
|
//获取观看记录
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,12 @@
|
||||||
<view class="u-flex flex-row justify-between align-center" style="padding: 20upx">
|
<view class="u-flex flex-row justify-between align-center" style="padding: 20upx">
|
||||||
<view class="flex align-center">
|
<view class="flex align-center">
|
||||||
<view class="color-333" style="font-size: 40upx;">¥</view>
|
<view class="color-333" style="font-size: 40upx;">¥</view>
|
||||||
<input type="number" v-model="money" placeholder="请输入金额" @input="ymfmoneyInput" @blur="ymfymfmoneyBlur"
|
<input type="number" v-model="money" placeholder="请输入金额" @input="ymfmoneyInput"
|
||||||
class="color-333 u-text-left u-m-l-10 u-font-40" style="width: 80%;" />
|
@blur="ymfymfmoneyBlur" class="color-333 u-text-left u-m-l-10 u-font-40"
|
||||||
|
style="width: 80%;" />
|
||||||
</view>
|
</view>
|
||||||
<view @click="ymfsetAllMoney" class="u-font-28 color-333 u-p-l-15 u-p-r-15 u-p-t-16 u-p-b-16 flex-0 "
|
<view @click="ymfsetAllMoney"
|
||||||
|
class="u-font-28 color-333 u-p-l-15 u-p-r-15 u-p-t-16 u-p-b-16 flex-0 "
|
||||||
style="background: #ff7581;color: white;border-radius: 10rpx;">
|
style="background: #ff7581;color: white;border-radius: 10rpx;">
|
||||||
全部
|
全部
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -41,18 +43,19 @@
|
||||||
<view @click="ymfgetOut" class="u-m-40 u-font-36 color-fff u-border-10"
|
<view @click="ymfgetOut" class="u-m-40 u-font-36 color-fff u-border-10"
|
||||||
style="background: #ff7581;border-radius: 10px;height: 80rpx;line-height: 80rpx;">
|
style="background: #ff7581;border-radius: 10px;height: 80rpx;line-height: 80rpx;">
|
||||||
<!-- 提现 -->
|
<!-- 提现 -->
|
||||||
立即提现
|
{{ !isWithdraw ? '观看广告提现' : '立即提现' }}
|
||||||
<!-- {{ !isWithdraw ? '观看广告提现' : '立即提现' }} -->
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex w-full justify-center ">
|
<view class="flex w-full justify-center ">
|
||||||
<!-- <view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;" @click="ymfgoaliZhiFuBao">
|
<!-- <view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;" @click="ymfgoaliZhiFuBao">
|
||||||
提现账号
|
提现账号
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;" @click="shimingrenzhi">
|
<view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;"
|
||||||
|
@click="shimingrenzhi">
|
||||||
实名认证
|
实名认证
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;" @click="ymfgoqianbao">
|
<view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;"
|
||||||
|
@click="ymfgoqianbao">
|
||||||
红包明细
|
红包明细
|
||||||
</view>
|
</view>
|
||||||
<!-- <view style="color: grey;padding-bottom: 30px;padding-top: 20upx;width: 33%;" @click="ymfgojilu">提现记录
|
<!-- <view style="color: grey;padding-bottom: 30px;padding-top: 20upx;width: 33%;" @click="ymfgojilu">提现记录
|
||||||
|
|
@ -65,7 +68,8 @@
|
||||||
<view style="margin-bottom: 8rpx;text-align: right;">
|
<view style="margin-bottom: 8rpx;text-align: right;">
|
||||||
<text style="margin-bottom: 8rpx;color: green" v-if="item.state === 1"> 提现成功</text>
|
<text style="margin-bottom: 8rpx;color: green" v-if="item.state === 1"> 提现成功</text>
|
||||||
<text style="margin-bottom: 8rpx;color: green" v-if="item.state === 0"> 提现中</text>
|
<text style="margin-bottom: 8rpx;color: green" v-if="item.state === 0"> 提现中</text>
|
||||||
<text style="margin-bottom: 8rpx;color: #FD6416" v-if="item.state === -1 || item.state === 2">
|
<text style="margin-bottom: 8rpx;color: #FD6416"
|
||||||
|
v-if="item.state === -1 || item.state === 2">
|
||||||
提现失败
|
提现失败
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -75,7 +79,8 @@
|
||||||
<view class="u-m-t-8"> 收款人姓名:{{ item.zhifubaoName }}</view>
|
<view class="u-m-t-8"> 收款人姓名:{{ item.zhifubaoName }}</view>
|
||||||
<view class="u-m-t-8"> 发起时间:{{ item.createAt }}</view>
|
<view class="u-m-t-8"> 发起时间:{{ item.createAt }}</view>
|
||||||
<view class="u-m-t-8" v-if="item.state === 1">成功时间 {{ item.outAt }}</view>
|
<view class="u-m-t-8" v-if="item.state === 1">成功时间 {{ item.outAt }}</view>
|
||||||
<view style="margin-bottom: 8rpx;color: #FD6416" v-if="item.state === -1 || item.state === 2">
|
<view style="margin-bottom: 8rpx;color: #FD6416"
|
||||||
|
v-if="item.state === -1 || item.state === 2">
|
||||||
失败原因:{{ item.refund }}
|
失败原因:{{ item.refund }}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
@ -99,7 +104,17 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<u-modal v-model="ruleShow" confirm-text="知道了" title="规则说明" :title-style="{ fontWeight: '700' }"
|
|
||||||
|
<u-modal v-model="ruleShow" confirm-text="知道了" @confirm="ruleConfirm" :title="rule_title"
|
||||||
|
:title-style="{fontWeight:'700'}" confirm-color="rgb(255, 117, 129)">
|
||||||
|
<view class="u-p-30 u-text-left">
|
||||||
|
<scroll-view scroll-y="true" style="max-height: 50vh;">
|
||||||
|
<rich-text class="color-666" :nodes="rule_content"></rich-text>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</u-modal>
|
||||||
|
|
||||||
|
<!-- <u-modal v-model="ruleShow" confirm-text="知道了" title="规则说明" :title-style="{ fontWeight: '700' }"
|
||||||
confirm-color="rgb(255, 117, 129)">
|
confirm-color="rgb(255, 117, 129)">
|
||||||
<view class="u-p-30 u-text-left">
|
<view class="u-p-30 u-text-left">
|
||||||
<scroll-view scroll-y="true" style="max-height: 50vh;">
|
<scroll-view scroll-y="true" style="max-height: 50vh;">
|
||||||
|
|
@ -107,20 +122,30 @@
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</u-modal>
|
</u-modal> -->
|
||||||
<!-- 激励视频广告 -->
|
<!-- 激励视频广告 -->
|
||||||
<!-- <ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true"
|
<ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true"
|
||||||
v-slot:default="{ loading, error }" :url-callback="urlCallback" @load="onadload" @close="onadclose"
|
v-slot:default="{ loading, error }" :url-callback="urlCallback" @load="onadload" @close="onadclose"
|
||||||
@error="onaderror">
|
@error="onaderror">
|
||||||
<view class="ad-error" v-if="error">{{ error }}</view>
|
<view class="ad-error" v-if="error">{{ error }}</view>
|
||||||
</ad-rewarded-video> -->
|
</ad-rewarded-video>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import httpsRequest from '@/common/httpRequest.js'
|
||||||
|
import {
|
||||||
|
$cache_config,
|
||||||
|
$cache_rule
|
||||||
|
} from '@/store/cashe.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
money: '',
|
||||||
|
mayMoney: '0',
|
||||||
|
shouxufei: '',
|
||||||
|
rule_title: "",
|
||||||
|
rule_content: "",
|
||||||
money: '',
|
money: '',
|
||||||
mayMoney: '0',
|
mayMoney: '0',
|
||||||
shouxufei: '',
|
shouxufei: '',
|
||||||
|
|
@ -157,28 +182,28 @@ export default {
|
||||||
urlCallback: null,
|
urlCallback: null,
|
||||||
adRewardedVideo: true,
|
adRewardedVideo: true,
|
||||||
ruleShow: true,
|
ruleShow: true,
|
||||||
ruleInfo: `
|
ruleIndex: 0,
|
||||||
用户在平台中对奖励提现的,适用以下规则:
|
ruleList: $cache_rule.ruleCash||[],
|
||||||
<br/>
|
ruleInfo: ``,
|
||||||
<br/>
|
|
||||||
1,用户的收益达到最低提现金额要求后,可以申请提现。每日发起前10笔提现为自动到账,超出则需第二个工作日后到账。
|
|
||||||
<br/>
|
|
||||||
2,用户需要通过支付宝提现,需按照要求绑定支付宝账号并填写提现金额或其他提现所需信息,请确保提供的信息准确无误,以免提现失败。
|
|
||||||
<br/>
|
|
||||||
3,如果用户发现显示「提现失败」,需确认当前填写或绑定的支付宝账号或银行卡账号是否正确,以及支付宝账号是否可用。如果用户发现显示「提现成功」但没到账
|
|
||||||
<br/>
|
|
||||||
(1)如果用户有多个支付宝账号,请检查用户是否提现到了其他支付宝账号。
|
|
||||||
<br/>
|
|
||||||
(2)高峰期提现人数多会导致网络拥堵,显示提现成功之后72小时内属于正常现象,请耐心等候。
|
|
||||||
<br/>
|
|
||||||
4,每日23:00至次日11:00为系统维护时间,活动的对应奖励可能延迟到账。提现通常会在72小时内到账,如遇双休日、节假日,提现到账时间可能会延长。活动高峰期间,由于网络拥堵,用户可能存在短时间内无法提现的情况。平台将尽最大努力及时恢复提现功能,但无需因此承担任何责任。
|
|
||||||
<br/>
|
|
||||||
`,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.ymfgetExtractFei();
|
this.ymfgetExtractFei();
|
||||||
this.ymfymfgetMoneyDetail();
|
this.ymfymfgetMoneyDetail();
|
||||||
|
httpsRequest.getT("/app/announcement", {
|
||||||
|
type: 1
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code == 0 && res.data.length > 0) {
|
||||||
|
this.ruleList = res.data
|
||||||
|
$cache_rule.set('ruleCash',this.ruleList)
|
||||||
|
this.ruleInit()
|
||||||
|
this.ruleShow = true
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.token = uni.getStorageSync('token')
|
this.token = uni.getStorageSync('token')
|
||||||
|
|
@ -188,6 +213,8 @@ export default {
|
||||||
this.ymfgetcashMoney()
|
this.ymfgetcashMoney()
|
||||||
this.getCanCash()
|
this.getCanCash()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onReachBottom: function() {
|
onReachBottom: function() {
|
||||||
if (this.page * this.limit < this.totalCount) {
|
if (this.page * this.limit < this.totalCount) {
|
||||||
|
|
@ -204,6 +231,12 @@ export default {
|
||||||
// this.list();
|
// this.list();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
ruleInit() {
|
||||||
|
console.log(this.ruleIndex,'tiaoshi1')
|
||||||
|
this.rule_title = this.ruleList[this.ruleIndex].title
|
||||||
|
this.rule_content = this.ruleList[this.ruleIndex].content
|
||||||
|
},
|
||||||
shimingrenzhi() {
|
shimingrenzhi() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/me/yaoqing/realName'
|
url: '/me/yaoqing/realName'
|
||||||
|
|
@ -264,6 +297,18 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
ruleConfirm() {
|
||||||
|
this.ruleIndex++
|
||||||
|
if (this.ruleIndex >= this.ruleList.length) {
|
||||||
|
this.ruleIndex = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.ruleShow = false
|
||||||
|
setTimeout(res => {
|
||||||
|
this.ruleInit()
|
||||||
|
this.ruleShow = true
|
||||||
|
}, 300)
|
||||||
|
},
|
||||||
ymfmoneyInput(e) {
|
ymfmoneyInput(e) {
|
||||||
let num = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null;
|
let num = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|
@ -507,7 +552,8 @@ export default {
|
||||||
let shouxufei = parseFloat(money * this.shouxufei).toFixed(2);
|
let shouxufei = parseFloat(money * this.shouxufei).toFixed(2);
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提现申请提示',
|
title: '提现申请提示',
|
||||||
content: '请仔细确认收款人信息\n\n收款人姓名:' + that.aliZhiFuBaoName + '\n\n提现金额:' + money +
|
content: '请仔细确认收款人信息\n\n收款人姓名:' + that.aliZhiFuBaoName + '\n\n提现金额:' +
|
||||||
|
money +
|
||||||
'元\n\n收款人账号:' + that.aliZhiFuBao + '',
|
'元\n\n收款人账号:' + that.aliZhiFuBao + '',
|
||||||
// content: '请仔细确认收款人信息\n\n收款人姓名:' + that.aliZhiFuBaoName + '\n\n提现金额:' + money +
|
// content: '请仔细确认收款人信息\n\n收款人姓名:' + that.aliZhiFuBaoName + '\n\n提现金额:' + money +
|
||||||
// '元\n\n提现手续费:' + shouxufei +
|
// '元\n\n提现手续费:' + shouxufei +
|
||||||
|
|
@ -527,7 +573,8 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提现申请提示',
|
title: '提现申请提示',
|
||||||
content: '请仔细确认收款人信息\n\n收款人姓名:' + that.aliZhiFuBaoName + '\n\n提现金额:' + money +
|
content: '请仔细确认收款人信息\n\n收款人姓名:' + that.aliZhiFuBaoName + '\n\n提现金额:' +
|
||||||
|
money +
|
||||||
'元\n\n收款人账号:' + that.aliZhiFuBao +
|
'元\n\n收款人账号:' + that.aliZhiFuBao +
|
||||||
'',
|
'',
|
||||||
success: e => {
|
success: e => {
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@
|
||||||
:src="`../../static/red-pack-new.gif`"
|
:src="`../../static/red-pack-new.gif`"
|
||||||
style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;"></u-image>
|
style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;"></u-image>
|
||||||
|
|
||||||
<u-modal v-if="isShowMoneyPay" v-model="ruleShow" confirm-text="知道了" :title="rule_title" :title-style="{ fontWeight: '700' }"
|
<u-modal v-if="isShowMoneyPay" v-model="ruleShow" @confirm="ruleConfirm" confirm-text="知道了" :title="rule_title"
|
||||||
confirm-color="rgb(255, 117, 129)">
|
:title-style="{ fontWeight: '700' }" confirm-color="rgb(255, 117, 129)">
|
||||||
<view class="u-p-30 u-text-left">
|
<view class="u-p-30 u-text-left">
|
||||||
<scroll-view scroll-y="true" style="max-height: 50vh;">
|
<scroll-view scroll-y="true" style="max-height: 50vh;">
|
||||||
<rich-text class="color-666" :nodes="rule_content"></rich-text>
|
<rich-text class="color-666" :nodes="rule_content"></rich-text>
|
||||||
|
|
@ -72,6 +72,10 @@
|
||||||
<script>
|
<script>
|
||||||
import contentlist from './components/contentlist.vue'
|
import contentlist from './components/contentlist.vue'
|
||||||
import httpsRequest from '@/common/httpRequest.js'
|
import httpsRequest from '@/common/httpRequest.js'
|
||||||
|
import {
|
||||||
|
$cache_config,
|
||||||
|
$cache_rule
|
||||||
|
} from '@/store/cashe.js'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
contentlist
|
contentlist
|
||||||
|
|
@ -86,7 +90,9 @@ export default {
|
||||||
ruleShow: false,
|
ruleShow: false,
|
||||||
rule_title: '',
|
rule_title: '',
|
||||||
rule_content: '',
|
rule_content: '',
|
||||||
|
ruleList: "",
|
||||||
|
ruleIndex: 0,
|
||||||
|
ruleList: $cache_rule.ruleIndex || []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
@ -102,14 +108,21 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
httpsRequest.getT("/app/announcement", {}).then(res => {
|
httpsRequest.getT("/app/announcement", {
|
||||||
if (res.code == 0) {
|
type: 0
|
||||||
if (res.data && res.data.state == 1) {
|
}).then(res => {
|
||||||
|
if (res.code == 0 && res.data.length > 0) {
|
||||||
this.ruleShow = true
|
this.ruleShow = true
|
||||||
this.rule_title = res.data.title
|
this.ruleList = res.data
|
||||||
this.rule_content = res.data.content
|
$cache_rule.set('ruleIndex', this.ruleList)
|
||||||
}
|
this.ruleInit()
|
||||||
|
|
||||||
|
|
||||||
|
// this.ruleShow = true
|
||||||
|
// this.rule_title = res.data[0].title
|
||||||
|
// this.rule_content = res.data[0].content
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
|
|
@ -117,6 +130,22 @@ export default {
|
||||||
this.getrecomVideo()
|
this.getrecomVideo()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
ruleInit() {
|
||||||
|
this.rule_title = this.ruleList[this.ruleIndex].title
|
||||||
|
this.rule_content = this.ruleList[this.ruleIndex].content
|
||||||
|
},
|
||||||
|
ruleConfirm() {
|
||||||
|
this.ruleIndex++
|
||||||
|
if (this.ruleIndex >= this.ruleList.length) {
|
||||||
|
this.ruleIndex = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.ruleShow = false
|
||||||
|
setTimeout(res => {
|
||||||
|
this.ruleInit()
|
||||||
|
this.ruleShow = true
|
||||||
|
}, 300)
|
||||||
|
},
|
||||||
// 跳转公告链接
|
// 跳转公告链接
|
||||||
goMsg(url) {
|
goMsg(url) {
|
||||||
if (url.indexOf('/pages/') !== -1 || url.indexOf('/me/') !== -1) {
|
if (url.indexOf('/pages/') !== -1 || url.indexOf('/me/') !== -1) {
|
||||||
|
|
|
||||||
|
|
@ -97,11 +97,11 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 激励视频广告 -->
|
<!-- 激励视频广告 -->
|
||||||
<!-- <ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true"
|
<ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true"
|
||||||
v-slot:default="{ loading, error }" :url-callback="urlCallback" @load="onadload" @close="onadclose"
|
v-slot:default="{ loading, error }" :url-callback="urlCallback" @load="onadload" @close="onadclose"
|
||||||
@error="onaderror">
|
@error="onaderror">
|
||||||
<view class="ad-error" v-if="error">{{ error }}</view>
|
<view class="ad-error" v-if="error">{{ error }}</view>
|
||||||
</ad-rewarded-video> -->
|
</ad-rewarded-video>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
import {
|
||||||
|
data
|
||||||
|
} from "../tuniao-ui/libs/mixin/mixin"
|
||||||
|
|
||||||
|
|
||||||
|
class CACHE {
|
||||||
|
constructor(data) {
|
||||||
|
if (data === '' || data === null || data === undefined) {
|
||||||
|
throw (new Error('请传入缓存name值:index | {name:index}'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
this._name = data
|
||||||
|
Object.defineProperty(this, '_name', {
|
||||||
|
writable: false
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (!data.name && !data._name) {
|
||||||
|
throw (new Error('请传入缓存name值:index | {name:index}'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for (let i in data) {
|
||||||
|
this[i] = data[i]
|
||||||
|
const canWrite = i.slice(0, 1) !== '_'
|
||||||
|
Object.defineProperty(this, i, {
|
||||||
|
writable: canWrite,
|
||||||
|
writable: canWrite
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
isEmpty(){
|
||||||
|
return Object.keys(this).length>=2?false:true;
|
||||||
|
}
|
||||||
|
get(key) {
|
||||||
|
return this[key]
|
||||||
|
}
|
||||||
|
set(key, val) {
|
||||||
|
this[key] = val
|
||||||
|
uni.setStorageSync(this._name, this)
|
||||||
|
}
|
||||||
|
clear() {
|
||||||
|
Object.keys(this).map(v => {
|
||||||
|
if (v.slice(0, 1) !== '_') {
|
||||||
|
this[v] = null
|
||||||
|
delete this[v]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
uni.removeStorageSync(this._name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const $cache_index = new CACHE({
|
||||||
|
_name: 'CACHE_index',
|
||||||
|
...uni.getStorageSync('CACHE_index')
|
||||||
|
})
|
||||||
|
|
||||||
|
export const $cache_video = new CACHE({
|
||||||
|
_name: 'CACHE_video',
|
||||||
|
...uni.getStorageSync('CACHE_video')
|
||||||
|
})
|
||||||
|
|
||||||
|
export const $cache_renwu = new CACHE({
|
||||||
|
_name: 'CACHE_renwu',
|
||||||
|
...uni.getStorageSync('CACHE_renwu')
|
||||||
|
})
|
||||||
|
|
||||||
|
export const $cache_chasingDrama = new CACHE({
|
||||||
|
_name: 'CACHE_chasingDrama',
|
||||||
|
...uni.getStorageSync('CACHE_chasingDrama')
|
||||||
|
})
|
||||||
|
|
||||||
|
export const $cache_user = new CACHE({
|
||||||
|
_name: 'CACHE_user',
|
||||||
|
...uni.getStorageSync('CACHE_user')
|
||||||
|
})
|
||||||
|
|
||||||
|
export const $cache_rule = new CACHE({
|
||||||
|
_name: 'CACHE_rule',
|
||||||
|
...uni.getStorageSync('CACHE_rule')
|
||||||
|
})
|
||||||
|
|
||||||
|
class CACHE_config extends CACHE {
|
||||||
|
constructor(data) {
|
||||||
|
super(data)
|
||||||
|
for (let i in data) {
|
||||||
|
if(i!=='_name'){
|
||||||
|
uni.setStorageSync(i,data[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set(key, val) {
|
||||||
|
this[key] = val
|
||||||
|
uni.setStorageSync(this._name, this)
|
||||||
|
}
|
||||||
|
set(key, val) {
|
||||||
|
this[key] = val
|
||||||
|
uni.setStorageSync(key, val)
|
||||||
|
uni.setStorageSync(this._name, this)
|
||||||
|
}
|
||||||
|
clear() {
|
||||||
|
Object.keys(this).map(v => {
|
||||||
|
if (v.slice(0, 1) !== '_') {
|
||||||
|
this[v] = null
|
||||||
|
delete this[v]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
uni.removeStorageSync(this._name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const $cache_config = new CACHE_config({
|
||||||
|
_name: 'CACHE_config',
|
||||||
|
...uni.getStorageSync('CACHE_config')
|
||||||
|
})
|
||||||
|
|
||||||
|
const $cache={
|
||||||
|
index:$cache_index,
|
||||||
|
video:$cache_video,
|
||||||
|
renwu:$cache_renwu,
|
||||||
|
chasingDrama:$cache_chasingDrama,
|
||||||
|
user:$cache_user,
|
||||||
|
rule:$cache_rule,
|
||||||
|
config:$cache_config
|
||||||
|
}
|
||||||
|
export function cacheClearAll() {
|
||||||
|
for(let i in $cache){
|
||||||
|
$cache[i].clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function cacheClear(arr){
|
||||||
|
if(typeof arr==='string'&&$cache[arr]){
|
||||||
|
$cache[arr].clear()
|
||||||
|
}
|
||||||
|
if(Array.isArray(arr)){
|
||||||
|
for(let i in arr){
|
||||||
|
const key=[arr[i]]
|
||||||
|
if($cache[key]){
|
||||||
|
$cache[key].clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue