diff --git a/me/jilu/duanju-love.vue b/me/jilu/duanju-love.vue index 83bb63b..1d77347 100644 --- a/me/jilu/duanju-love.vue +++ b/me/jilu/duanju-love.vue @@ -84,7 +84,7 @@ // 跳转资源详情 ymfgoCourse(e,courseDetailsId) { uni.navigateTo({ - url: '/me/detail/detail?id=' + e+'&courseDetailsId='+courseDetailsId + url: '/me/detail/detailIOS?id=' + e+'&courseDetailsId='+courseDetailsId }) }, //获取观看记录 diff --git a/me/yaoqing/ymg-yaoqing-tixian.vue b/me/yaoqing/ymg-yaoqing-tixian.vue index be89846..51b14e5 100644 --- a/me/yaoqing/ymg-yaoqing-tixian.vue +++ b/me/yaoqing/ymg-yaoqing-tixian.vue @@ -1,31 +1,33 @@ \ No newline at end of file diff --git a/pages/index/index2.vue b/pages/index/index2.vue index cc84531..7a1c267 100644 --- a/pages/index/index2.vue +++ b/pages/index/index2.vue @@ -57,8 +57,8 @@ :src="`../../static/red-pack-new.gif`" style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;"> - + @@ -70,153 +70,182 @@ \ No newline at end of file diff --git a/pages/task/index.vue b/pages/task/index.vue index 41dcbdb..c939df9 100644 --- a/pages/task/index.vue +++ b/pages/task/index.vue @@ -97,11 +97,11 @@ - + diff --git a/store/cashe.js b/store/cashe.js new file mode 100644 index 0000000..73d0772 --- /dev/null +++ b/store/cashe.js @@ -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() + } + } + } +} \ No newline at end of file