This commit is contained in:
GaoHao
2024-12-30 19:30:25 +08:00
9 changed files with 211 additions and 113 deletions

View File

@@ -1,8 +1,13 @@
import configdata from './config' import configdata from './config'
import cache from './cache' import cache from './cache'
import { import {
cacheClearAll cacheClearAll,cacheClear
} from '@/store/cashe.js' } from '@/store/cashe.js'
function successCallBack(url){
if(url.includes('app/courseCollect/insertCourseCollect')){
cacheClear('chasingDrama')
}
}
module.exports = { module.exports = {
config: function(name) { config: function(name) {
var info = null; var info = null;
@@ -151,7 +156,11 @@ module.exports = {
success: function(result) { success: function(result) {
if (result.data.code == 401) { if (result.data.code == 401) {
that.logout(); that.logout();
}else{
successCallBack(url)
// cacheClear('chasingDrama')
} }
succ.call(self, result.data) succ.call(self, result.data)
}, },
fail: function(e) { fail: function(e) {

View File

@@ -25,6 +25,10 @@
<view>注销账号</view> <view>注销账号</view>
<view><u-icon name="arrow-right"></u-icon></view> <view><u-icon name="arrow-right"></u-icon></view>
</view> </view>
<!-- <view class="flex justify-between padding bg-white solid-bottom" @click="clearCache">
<view>清除缓存</view>
<view>{{cacheSize}}</view>
</view> -->
<view class="flex justify-between padding bg-white solid-bottom" @click="loginOut"> <view class="flex justify-between padding bg-white solid-bottom" @click="loginOut">
<view>退出登录</view> <view>退出登录</view>
<view><u-icon name="arrow-right"></u-icon></view> <view><u-icon name="arrow-right"></u-icon></view>
@@ -39,6 +43,7 @@
data() { data() {
return { return {
version: null, version: null,
cacheSize:'0M'
} }
}, },
onLoad() { onLoad() {
@@ -54,8 +59,30 @@
// console.log(widgetInfo) // console.log(widgetInfo)
// this.version = widgetInfo.version // this.version = widgetInfo.version
// }) // })
const info= uni.getStorageInfoSync()
console.log(info);
const size=(info.currentSize/1024).toFixed(2)
this.cacheSize=size<1?(info.currentSize+'kb'):(size) +'M'
},
onShow() {
}, },
methods: { methods: {
clearCache(){
uni.showModal({
title:'提示',
content:`是否清除全部缓存
`,
success(res) {
if(res.confirm){
cacheClearAll()
const info= uni.getStorageInfoSync()
info.keys.map(v=>{
console.log(v);
})
}
}
})
},
goNav(e) { goNav(e) {
uni.navigateTo({ uni.navigateTo({
url: e url: e

View File

@@ -107,8 +107,7 @@
"navigationBarTitleText": "我的", "navigationBarTitleText": "我的",
"navigationStyle": "custom" "navigationStyle": "custom"
// #ifdef H5 // #ifdef H5
, ,"enablePullDownRefresh": true
"enablePullDownRefresh": true
// #endif // #endif
} }
}, },

View File

@@ -113,6 +113,7 @@
</template> </template>
<script> <script>
import { isEmpty } from '../../utils/util';
import { $cache_chasingDrama} from '@/store/cashe.js' import { $cache_chasingDrama} from '@/store/cashe.js'
export default { export default {
data() { data() {
@@ -155,6 +156,12 @@
let data = { let data = {
userId: uni.getStorageSync('userId') userId: uni.getStorageSync('userId')
} }
if(!isEmpty($cache_chasingDrama.day)&&!isEmpty($cache_chasingDrama.isQd)&&!isEmpty($cache_chasingDrama.isErQd)){
this.day=$cache_chasingDrama.day
this.isQd=$cache_chasingDrama.isQd
this.isErQd=$cache_chasingDrama.isErQd
return
}
this.$Request.getT('/app/integral/selectIntegralDay', data).then(res => { this.$Request.getT('/app/integral/selectIntegralDay', data).then(res => {
if (res.code == 0) { if (res.code == 0) {
if (res.data.nowIntegral) { //判断今天是否签到 if (res.data.nowIntegral) { //判断今天是否签到
@@ -202,6 +209,10 @@
limit: 6, limit: 6,
classify: 1, //1收藏 2点赞 3历史记录 classify: 1, //1收藏 2点赞 3历史记录
} }
if($cache_chasingDrama.zhuiju){
this.zhuiju = $cache_chasingDrama.zhuiju
return
}
this.$Request.getT('/app/courseCollect/selectByUserId', data).then(res => { this.$Request.getT('/app/courseCollect/selectByUserId', data).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.zhuiju = res.data.records this.zhuiju = res.data.records
@@ -216,6 +227,10 @@
limit: 6, limit: 6,
classify: 3, //1收藏 2点赞 3历史记录 classify: 3, //1收藏 2点赞 3历史记录
} }
if($cache_chasingDrama.list){
this.list=$cache_chasingDrama.list
return
}
this.$Request.getT('/app/courseCollect/selectByUserId', data).then(res => { this.$Request.getT('/app/courseCollect/selectByUserId', data).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.list = res.data.records this.list = res.data.records

View File

@@ -210,7 +210,13 @@
import activityComp from '../../components/activityComp/activityComp.vue' import activityComp from '../../components/activityComp/activityComp.vue'
import dragButton from "@/components/drag-button/drag-button.vue"; import dragButton from "@/components/drag-button/drag-button.vue";
import httpsRequest from '../../common/httpRequest.js' import httpsRequest from '../../common/httpRequest.js'
import {$cache_index} from '@/store/cashe.js' import {
$cache_index
} from '@/store/cashe.js'
import {
$cache_config
} from '@/store/cashe.js'
console.log($cache_index)
export default { export default {
components: { components: {
videoList, videoList,
@@ -338,13 +344,8 @@
uni.setStorageSync('qdCodeion', options.qdCode) uni.setStorageSync('qdCodeion', options.qdCode)
} }
if (uni.getStorageSync('token')) { if (uni.getStorageSync('token')) {
this.$u.get('/app/common/type/813').then(res => { this.zhuliInit()
if (res.code == 0 && res.data.value) {
if (res.data.value == '是') {
this.getActivity()
}
}
})
} }
let u = navigator ? navigator.userAgent : ''; let u = navigator ? navigator.userAgent : '';
@@ -377,10 +378,97 @@
this.getCourseList() this.getCourseList()
this.homeTypeSel = uni.getStorageSync('homeTypeSel') ? uni.getStorageSync('homeTypeSel') : '否' this.homeTypeSel = uni.getStorageSync('homeTypeSel') ? uni.getStorageSync('homeTypeSel') : '否'
//#ifdef H5 //#ifdef H5
let that = this let that=this;
if($cache_config.isGongZhongHaoAutoLogin!==null&&$cache_config.isGongZhongHaoAutoLogin!==undefined){
if($cache_config.isGongZhongHaoAutoLogin=='是'){
that.wxWebInit()
}
}else{
this.$u.get('/app/common/type/108').then(res => { //// 是否开启公众号自动登陆 108 this.$u.get('/app/common/type/108').then(res => { //// 是否开启公众号自动登陆 108
if (res.code == 0 && res.data) { if (res.code == 0 && res.data) {
$cache_config.set('isGongZhongHaoAutoLogin',res.data)
if (res.data.value == '是') { if (res.data.value == '是') {
that.wxWebInit()
}
}
});
}
//#endif
if (uni.getStorageSync('token')) {
this.getMyLoveVideo()
//新用户红包 837
this.newUserRedInit()
} else { //没有登录隐藏悬浮与弹窗
this.showzl = false
this.shodrag = false
this.videoInfo = []
}
// #ifdef APP
httpsRequest.getT("app/common/type/919", {}).then(res => {
if (res.code == 0) {
const sysInfo = uni.getSystemInfoSync();
let isIos = sysInfo.platform == 'ios'
this.isShowMoneyPay = !(res.data.value == '1' && isIos)
}
});
// #endif
},
onReachBottom() {
if (this.page < this.pages) {
this.page += 1
this.status = 'loading'
this.getCourseList()
} else {
this.status = 'nomore'
}
},
onPullDownRefresh() {
this.page = 1
$cache_index.clear()
this.getCourseList()
},
methods: {
//新用户红包 837
newUserRedInit(){
if($cache_config.isNewUserRedPack!==null&&$cache_config.isNewUserRedPack!==undefined){
if($cache_config.isNewUserRedPack){
this.xxJDNum = $cache_config.isNewUserRedPack;
this.checkNewUser()
}
return
}
this.$u.get('/app/common/type/837').then(res => {
$cache_config.set('isNewUserRedPack',res.data.value)
if (res.code == 0 && res.data.value) {
this.xxJDNum = res.data.value;
this.checkNewUser()
}
})
},
zhuliInit(){
if($cache_config.isOpenZhuLi!==null&&$cache_config.isOpenZhuLi!==undefined){
if($cache_config.isOpenZhuLi=='是'){
this.getActivity()
}
}else{
this.$u.get('/app/common/type/813').then(res => {
if (res.code == 0 && res.data.value) {
$cache_config.set('isOpenZhuLi',res.data.value)
if (res.data.value == '是') {
this.getActivity()
}
}
})
}
},
//处于微信公众号时的处理
wxWebInit() {
let that = this;
let ua = navigator.userAgent.toLowerCase(); let ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('micromessenger') !== -1) { if (ua.indexOf('micromessenger') !== -1) {
let openid = uni.getStorageSync('openId'); let openid = uni.getStorageSync('openId');
@@ -414,58 +502,9 @@
} }
} }
} }
}
}
});
//#endif
if (uni.getStorageSync('token')) {
this.getMyLoveVideo()
this.$u.get('/app/common/type/813').then(res => {
if (res.code == 0 && res.data.value) {
if (res.data.value == '是') {
this.getActivitys()
}
}
})
//新用户红包 837
this.$u.get('/app/common/type/837').then(res => {
if (res.code == 0 && res.data.value) {
this.xxJDNum = res.data.value;
this.checkNewUser()
}
})
} else { //没有登录隐藏悬浮与弹窗
this.showzl = false
this.shodrag = false
this.videoInfo = []
}
// #ifdef APP
httpsRequest.getT("app/common/type/919", {}).then(res => {
if (res.code == 0) {
const sysInfo = uni.getSystemInfoSync();
let isIos = sysInfo.platform == 'ios'
this.isShowMoneyPay = !(res.data.value == '1' && isIos)
}
});
// #endif
}, },
onReachBottom() {
if (this.page < this.pages) {
this.page += 1
this.status = 'loading'
this.getCourseList()
} else {
this.status = 'nomore'
}
},
onPullDownRefresh() {
this.page = 1
$cache_index.clear()
this.getCourseList()
},
methods: {
// 获取活动等级 // 获取活动等级
getActivitys() { getActivitys() {
this.$Request.getT('/app/invite/selectInviteAwardByUserId').then(res => { this.$Request.getT('/app/invite/selectInviteAwardByUserId').then(res => {
@@ -501,9 +540,15 @@
limit: 1, limit: 1,
classify: 1 classify: 1
} }
if($cache_index.videoInfo){
this.videoInfo = $cache_index.videoInfo||[]
this.shodrag = this.videoInfo.length>0
return
}
this.$Request.getT('/app/courseCollect/selectByUserId', data).then(res => { this.$Request.getT('/app/courseCollect/selectByUserId', data).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.videoInfo = res.data.records this.videoInfo = res.data.records
$cache_index.set('videoInfo',this.videoInfo)
if (this.videoInfo.length > 0) { if (this.videoInfo.length > 0) {
this.shodrag = true this.shodrag = true
} }

View File

@@ -161,7 +161,7 @@
title: '上传中...' title: '上传中...'
}); });
uni.uploadFile({ uni.uploadFile({
url: configdata.APIHOST + '/alioss/upload', url: configdata.APIHOST + 'alioss/upload',
// url: 'https://jiaoyu.xianmxkj.com/sqx_fast/alioss/upload', //仅为示例,非真实的接口地址 // url: 'https://jiaoyu.xianmxkj.com/sqx_fast/alioss/upload', //仅为示例,非真实的接口地址
filePath: e.detail.avatarUrl, filePath: e.detail.avatarUrl,
// filePath: res.tempFilePaths[0], // filePath: res.tempFilePaths[0],
@@ -214,7 +214,7 @@
let token = uni.getStorageSync('token'); let token = uni.getStorageSync('token');
let userId = uni.getStorageSync('userId'); let userId = uni.getStorageSync('userId');
uni.uploadFile({ uni.uploadFile({
url: configdata.APIHOST + '/alioss/upload', url: configdata.APIHOST + 'alioss/upload',
// url: 'https://jiaoyu.xianmxkj.com/sqx_fast/alioss/upload', //仅为示例,非真实的接口地址 // url: 'https://jiaoyu.xianmxkj.com/sqx_fast/alioss/upload', //仅为示例,非真实的接口地址
filePath: res.tempFilePaths[0], filePath: res.tempFilePaths[0],
name: 'file', name: 'file',

View File

@@ -99,6 +99,9 @@
<script> <script>
import {$cache_renwu} from '@/store/cashe.js' import {$cache_renwu} from '@/store/cashe.js'
import {isEmpty} from '@/utils/util.js'
export default { export default {
data() { data() {
@@ -202,7 +205,7 @@
* 获取签到数据 * 获取签到数据
*/ */
getsignIn() { getsignIn() {
if($cache_renwu.signInList&&$cache_renwu.signDays&&$cache_renwu.enable){ if($cache_renwu.signInList&&!isEmpty($cache_renwu.signDays)&&!isEmpty($cache_renwu.enable) ){
this.signInList =$cache_renwu.signInList this.signInList =$cache_renwu.signInList
this.signDays =$cache_renwu.signDays this.signDays =$cache_renwu.signDays
this.enable =$cache_renwu.enable this.enable =$cache_renwu.enable
@@ -366,6 +369,7 @@
onPullDownRefresh: function() { onPullDownRefresh: function() {
console.log(2) console.log(2)
$cache_renwu.clear() $cache_renwu.clear()
this.getsignIn()
this.getTaskdata(); this.getTaskdata();
}, },

View File

@@ -113,13 +113,9 @@ const $cache={
config:$cache_config config:$cache_config
} }
export function cacheClearAll() { export function cacheClearAll() {
console.log($cache_index); for(let i in $cache){
$cache_index.clear() $cache[i].clear()
$cache_video.clear() }
$cache_renwu.clear()
$cache_chasingDrama.clear()
$cache_user.clear()
$cache_config.clear()
} }
export function cacheClear(arr){ export function cacheClear(arr){
if(typeof arr==='string'&&$cache[arr]){ if(typeof arr==='string'&&$cache[arr]){

3
utils/util.js Normal file
View File

@@ -0,0 +1,3 @@
export function isEmpty(val){
return val===null||val===undefined||val===''
}