Commit b935c210 by 李伟康

修改缓存

1 parent 8ebf22a7
...@@ -103,7 +103,6 @@ const dialog = (params = {}) => { ...@@ -103,7 +103,6 @@ const dialog = (params = {}) => {
const makePhoneCall = phoneNumber => { const makePhoneCall = phoneNumber => {
window.location.href = `tel://${phoneNumber}` window.location.href = `tel://${phoneNumber}`
} }
/**是否全面屏 */ /**是否全面屏 */
const isFullSucreen = () => { const isFullSucreen = () => {
let result = false let result = false
...@@ -121,7 +120,7 @@ const jumpChildrenPage = (to, params) => { ...@@ -121,7 +120,7 @@ const jumpChildrenPage = (to, params) => {
const setClipboardData = data => { const setClipboardData = data => {
wx.setClipboardData({ wx.setClipboardData({
data, data,
success(res) { success (res) {
Toast('复制成功') Toast('复制成功')
} }
}) })
...@@ -165,6 +164,27 @@ const watchPageBack = () => { ...@@ -165,6 +164,27 @@ const watchPageBack = () => {
const centsToyuan = price => { const centsToyuan = price => {
return decimal(price / 100, 2).toFixed(2) 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 = { const utils = {
removeLocalStorage, removeLocalStorage,
setClipboardData, setClipboardData,
...@@ -184,6 +204,8 @@ const utils = { ...@@ -184,6 +204,8 @@ const utils = {
touchstart, touchstart,
showToast, showToast,
getParams, getParams,
setCookie,
getCookie,
getQuery, getQuery,
touchend, touchend,
throttle, throttle,
......
...@@ -126,11 +126,11 @@ export default { ...@@ -126,11 +126,11 @@ export default {
mounted () { mounted () {
let { corpId } = this.getQuery() let { corpId } = this.getQuery()
if (!corpId) corpId = this.getLocalStorage('dj_scrm_corpId').corpId if (!corpId) corpId = this.getLocalStorage('dj_scrm_corpId').corpId
const tomorrow = this.getLocalStorage(`coupon_tips_${corpId}`) const tomorrow = this.getLocalStorage(`tips_${corpId}`)
const couponModal = this.getLocalStorage(`coupon_modal_${corpId}`) const couponModal = this.getLocalStorage(`modal_${corpId}`)
const now = new Date().getTime()
this.corpId = 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 this.showCouponModal = !couponModal
}, },
methods: { methods: {
...@@ -150,12 +150,12 @@ export default { ...@@ -150,12 +150,12 @@ export default {
let { corpId } = this let { corpId } = this
this.showTips = false this.showTips = false
let tomorrow = new Date(`${new Date(new Date().setDate(new Date().getDate() + 1)).format('yyyy/MM/dd')} 00:00:00`).getTime() 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 () { closeCouponModal () {
let { modalChecked, corpId } = this let { modalChecked, corpId } = this
if (!modalChecked) return 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!