Commit b935c210 by 李伟康

修改缓存

1 parent 8ebf22a7
......@@ -103,7 +103,6 @@ const dialog = (params = {}) => {
const makePhoneCall = phoneNumber => {
window.location.href = `tel://${phoneNumber}`
}
/**是否全面屏 */
const isFullSucreen = () => {
let result = false
......@@ -121,7 +120,7 @@ const jumpChildrenPage = (to, params) => {
const setClipboardData = data => {
wx.setClipboardData({
data,
success(res) {
success (res) {
Toast('复制成功')
}
})
......@@ -165,6 +164,27 @@ const watchPageBack = () => {
const centsToyuan = price => {
return decimal(price / 100, 2).toFixed(2)
}
/**设置cookie */
const setCookie = (c_name, value, expiredays = 365) => {
let exdate = new Date()
console.log(c_name, value)
exdate.setDate(exdate.getDate() + expiredays)
document.cookie = c_name + '=' + value +
((expiredays == null) ? '' : ';expires=' + exdate.toGMTString())
}
/**获取cookie */
const getCookie = c_name => {
if (document.cookie.length > 0) {
let c_start = document.cookie.indexOf(c_name + '=')
if (c_start != -1) {
c_start = c_start + c_name.length + 1
let c_end = document.cookie.indexOf(';', c_start)
if (c_end == -1) c_end = document.cookie.length
return unescape(document.cookie.substring(c_start, c_end))
}
}
return ''
}
const utils = {
removeLocalStorage,
setClipboardData,
......@@ -184,6 +204,8 @@ const utils = {
touchstart,
showToast,
getParams,
setCookie,
getCookie,
getQuery,
touchend,
throttle,
......
......@@ -126,11 +126,11 @@ export default {
mounted () {
let { corpId } = this.getQuery()
if (!corpId) corpId = this.getLocalStorage('dj_scrm_corpId').corpId
const tomorrow = this.getLocalStorage(`coupon_tips_${corpId}`)
const couponModal = this.getLocalStorage(`coupon_modal_${corpId}`)
const now = new Date().getTime()
const tomorrow = this.getLocalStorage(`tips_${corpId}`)
const couponModal = this.getLocalStorage(`modal_${corpId}`)
this.corpId = corpId
if (tomorrow) this.showTips = now >= tomorrow
console.log(couponModal, tomorrow, corpId)
if (tomorrow) this.showTips = new Date().getTime() >= tomorrow
this.showCouponModal = !couponModal
},
methods: {
......@@ -150,12 +150,12 @@ export default {
let { corpId } = this
this.showTips = false
let tomorrow = new Date(`${new Date(new Date().setDate(new Date().getDate() + 1)).format('yyyy/MM/dd')} 00:00:00`).getTime()
this.setLocalStorage(`coupon_tips_${corpId}`, tomorrow)
this.setLocalStorage(`tips_${corpId}`, tomorrow)
},
closeCouponModal () {
let { modalChecked, corpId } = this
if (!modalChecked) return
this.setLocalStorage(`coupon_modal_${corpId}`, true)
this.setLocalStorage(`modal_${corpId}`, true)
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!