Merge branch 'test' of https://e.coding.net/g-cphe0354/duanju/video_app into gaohao
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import configdata from './config'
|
||||
import cache from './cache'
|
||||
import {
|
||||
cacheClearAll
|
||||
cacheClearAll,cacheClear
|
||||
} from '@/store/cashe.js'
|
||||
function successCallBack(url){
|
||||
if(url.includes('app/courseCollect/insertCourseCollect')){
|
||||
cacheClear('chasingDrama')
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
config: function(name) {
|
||||
var info = null;
|
||||
@@ -151,7 +156,11 @@ module.exports = {
|
||||
success: function(result) {
|
||||
if (result.data.code == 401) {
|
||||
that.logout();
|
||||
}else{
|
||||
successCallBack(url)
|
||||
// cacheClear('chasingDrama')
|
||||
}
|
||||
|
||||
succ.call(self, result.data)
|
||||
},
|
||||
fail: function(e) {
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
<view>注销账号</view>
|
||||
<view><u-icon name="arrow-right"></u-icon></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>退出登录</view>
|
||||
<view><u-icon name="arrow-right"></u-icon></view>
|
||||
@@ -39,6 +43,7 @@
|
||||
data() {
|
||||
return {
|
||||
version: null,
|
||||
cacheSize:'0M'
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@@ -54,8 +59,30 @@
|
||||
// console.log(widgetInfo)
|
||||
// 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: {
|
||||
clearCache(){
|
||||
uni.showModal({
|
||||
title:'提示',
|
||||
content:`是否清除全部缓存
|
||||
`,
|
||||
success(res) {
|
||||
if(res.confirm){
|
||||
cacheClearAll()
|
||||
const info= uni.getStorageInfoSync()
|
||||
info.keys.map(v=>{
|
||||
console.log(v);
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
goNav(e) {
|
||||
uni.navigateTo({
|
||||
url: e
|
||||
|
||||
@@ -107,8 +107,7 @@
|
||||
"navigationBarTitleText": "我的",
|
||||
"navigationStyle": "custom"
|
||||
// #ifdef H5
|
||||
,
|
||||
"enablePullDownRefresh": true
|
||||
,"enablePullDownRefresh": true
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
|
||||
@@ -113,7 +113,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { $cache_chasingDrama} from '@/store/cashe.js'
|
||||
import { isEmpty } from '../../utils/util';
|
||||
import { $cache_chasingDrama} from '@/store/cashe.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -155,6 +156,12 @@
|
||||
let data = {
|
||||
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 => {
|
||||
if (res.code == 0) {
|
||||
if (res.data.nowIntegral) { //判断今天是否签到
|
||||
@@ -202,6 +209,10 @@
|
||||
limit: 6,
|
||||
classify: 1, //1收藏 2点赞 3历史记录
|
||||
}
|
||||
if($cache_chasingDrama.zhuiju){
|
||||
this.zhuiju = $cache_chasingDrama.zhuiju
|
||||
return
|
||||
}
|
||||
this.$Request.getT('/app/courseCollect/selectByUserId', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.zhuiju = res.data.records
|
||||
@@ -216,6 +227,10 @@
|
||||
limit: 6,
|
||||
classify: 3, //1收藏 2点赞 3历史记录
|
||||
}
|
||||
if($cache_chasingDrama.list){
|
||||
this.list=$cache_chasingDrama.list
|
||||
return
|
||||
}
|
||||
this.$Request.getT('/app/courseCollect/selectByUserId', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.list = res.data.records
|
||||
|
||||
@@ -210,7 +210,13 @@
|
||||
import activityComp from '../../components/activityComp/activityComp.vue'
|
||||
import dragButton from "@/components/drag-button/drag-button.vue";
|
||||
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 {
|
||||
components: {
|
||||
videoList,
|
||||
@@ -338,13 +344,8 @@
|
||||
uni.setStorageSync('qdCodeion', options.qdCode)
|
||||
}
|
||||
if (uni.getStorageSync('token')) {
|
||||
this.$u.get('/app/common/type/813').then(res => {
|
||||
if (res.code == 0 && res.data.value) {
|
||||
if (res.data.value == '是') {
|
||||
this.getActivity()
|
||||
}
|
||||
}
|
||||
})
|
||||
this.zhuliInit()
|
||||
|
||||
}
|
||||
let u = navigator ? navigator.userAgent : '';
|
||||
|
||||
@@ -363,13 +364,13 @@
|
||||
//本周热门
|
||||
this.getrecomVideo('2')
|
||||
//本周排行榜
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
this.getrecomVideo('1')
|
||||
},100)
|
||||
}, 100)
|
||||
//最新
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
this.getrecomVideo('')
|
||||
},200)
|
||||
}, 200)
|
||||
this.getBannerList()
|
||||
this.getMsg()
|
||||
this.getGardList()
|
||||
@@ -377,63 +378,29 @@
|
||||
this.getCourseList()
|
||||
this.homeTypeSel = uni.getStorageSync('homeTypeSel') ? uni.getStorageSync('homeTypeSel') : '否'
|
||||
//#ifdef H5
|
||||
let that = this
|
||||
this.$u.get('/app/common/type/108').then(res => { //// 是否开启公众号自动登陆 108
|
||||
if (res.code == 0 && res.data) {
|
||||
if (res.data.value == '是') {
|
||||
let ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.indexOf('micromessenger') !== -1) {
|
||||
let openid = uni.getStorageSync('openId');
|
||||
let userId = uni.getStorageSync('userId');
|
||||
if (userId) {
|
||||
if (!openid) {
|
||||
if (window.location.href.indexOf('?code=') !== -1 || window.location.href
|
||||
.indexOf(
|
||||
'&code=') !==
|
||||
-1) {
|
||||
let code;
|
||||
if (window.location.href.indexOf('?code=') !== -1) {
|
||||
code = window.location.href.split('?code=')[1].split('&')[0];
|
||||
} else {
|
||||
code = window.location.href.split('&code=')[1].split('&')[0];
|
||||
}
|
||||
if (userId) {
|
||||
that.$u.get('/app/user/openId/' + code + '/' + userId).then(
|
||||
res => {
|
||||
uni.setStorageSync('openId', res.data)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
window.location.href =
|
||||
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
|
||||
that.$queue.getWxAppid() +
|
||||
'&redirect_uri=' +
|
||||
window.location.href.split('#')[0] +
|
||||
'&response_type=code&scope=snsapi_userinfo#wechat_redirect';
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
if (res.code == 0 && res.data) {
|
||||
$cache_config.set('isGongZhongHaoAutoLogin',res.data)
|
||||
if (res.data.value == '是') {
|
||||
that.wxWebInit()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//#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()
|
||||
}
|
||||
})
|
||||
this.newUserRedInit()
|
||||
|
||||
} else { //没有登录隐藏悬浮与弹窗
|
||||
this.showzl = false
|
||||
this.shodrag = false
|
||||
@@ -449,7 +416,7 @@
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.page < this.pages) {
|
||||
@@ -466,6 +433,78 @@
|
||||
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();
|
||||
if (ua.indexOf('micromessenger') !== -1) {
|
||||
let openid = uni.getStorageSync('openId');
|
||||
let userId = uni.getStorageSync('userId');
|
||||
if (userId) {
|
||||
if (!openid) {
|
||||
if (window.location.href.indexOf('?code=') !== -1 || window.location.href
|
||||
.indexOf(
|
||||
'&code=') !==
|
||||
-1) {
|
||||
let code;
|
||||
if (window.location.href.indexOf('?code=') !== -1) {
|
||||
code = window.location.href.split('?code=')[1].split('&')[0];
|
||||
} else {
|
||||
code = window.location.href.split('&code=')[1].split('&')[0];
|
||||
}
|
||||
if (userId) {
|
||||
that.$u.get('/app/user/openId/' + code + '/' + userId).then(
|
||||
res => {
|
||||
uni.setStorageSync('openId', res.data)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
window.location.href =
|
||||
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
|
||||
that.$queue.getWxAppid() +
|
||||
'&redirect_uri=' +
|
||||
window.location.href.split('#')[0] +
|
||||
'&response_type=code&scope=snsapi_userinfo#wechat_redirect';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
// 获取活动等级
|
||||
getActivitys() {
|
||||
this.$Request.getT('/app/invite/selectInviteAwardByUserId').then(res => {
|
||||
@@ -501,9 +540,15 @@
|
||||
limit: 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 => {
|
||||
if (res.code == 0) {
|
||||
this.videoInfo = res.data.records
|
||||
$cache_index.set('videoInfo',this.videoInfo)
|
||||
if (this.videoInfo.length > 0) {
|
||||
this.shodrag = true
|
||||
}
|
||||
@@ -619,38 +664,38 @@
|
||||
// #ifdef MP-TOUTIAO
|
||||
data.dyShow = 1
|
||||
// #endif
|
||||
if(sort==2&&$cache_index.rmVideList){
|
||||
if (sort == 2 && $cache_index.rmVideList) {
|
||||
this.rmVideList = $cache_index.rmVideList
|
||||
return
|
||||
return
|
||||
}
|
||||
if(sort==1&&$cache_index.phbVideoList){
|
||||
if (sort == 1 && $cache_index.phbVideoList) {
|
||||
this.phbVideoList = $cache_index.phbVideoList
|
||||
return
|
||||
return
|
||||
}
|
||||
if(!sort&&$cache_index.newVideList){
|
||||
if (!sort && $cache_index.newVideList) {
|
||||
this.newVideList = $cache_index.newVideList
|
||||
return
|
||||
return
|
||||
}
|
||||
console.log('请求服务器 获取推荐视频')
|
||||
this.$Request.getT('/app/course/selectCourse', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
if (Number(sort) == 2) { //本周热门
|
||||
this.rmVideList = res.data.list
|
||||
$cache_index.set('rmVideList',this.rmVideList)
|
||||
$cache_index.set('rmVideList', this.rmVideList)
|
||||
} else if (Number(sort) == 1) { //本周排行榜
|
||||
this.phbVideoList = res.data.list
|
||||
$cache_index.set('phbVideoList',this.phbVideoList)
|
||||
$cache_index.set('phbVideoList', this.phbVideoList)
|
||||
} else { //最新热播
|
||||
this.newVideList = res.data.list
|
||||
$cache_index.set('newVideList',this.newVideList)
|
||||
$cache_index.set('newVideList', this.newVideList)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
getTypeList() {
|
||||
if($cache_index.typeList){
|
||||
this.typeList=$cache_index.typeList
|
||||
return
|
||||
if ($cache_index.typeList) {
|
||||
this.typeList = $cache_index.typeList
|
||||
return
|
||||
}
|
||||
console.log('请求服务器 getTypeList')
|
||||
this.$Request.getT('/app/courseClassification/queryClassification').then(res => {
|
||||
@@ -664,9 +709,9 @@
|
||||
// res.data.forEach(d => {
|
||||
// this.typeList.push(d);
|
||||
// });
|
||||
|
||||
this.typeList=[fenlei,...res.data]
|
||||
$cache_index.set('typeList',this.typeList)
|
||||
|
||||
this.typeList = [fenlei, ...res.data]
|
||||
$cache_index.set('typeList', this.typeList)
|
||||
// console.log(JSON.stringify(this.typeList))
|
||||
}
|
||||
});
|
||||
@@ -733,19 +778,19 @@
|
||||
},
|
||||
//获取背景图
|
||||
getBgImg() {
|
||||
const bgImg=$cache_index.bgImg
|
||||
const tuiguang=$cache_index.tuiguang
|
||||
if(bgImg&&tuiguang){
|
||||
const bgImg = $cache_index.bgImg
|
||||
const tuiguang = $cache_index.tuiguang
|
||||
if (bgImg && tuiguang) {
|
||||
this.bgImg = bgImg
|
||||
this.tuiguang = tuiguang
|
||||
return
|
||||
return
|
||||
}
|
||||
this.$u.get('app/banner/selectBannerList?classify=5').then(res => {
|
||||
if (res.code == 0) {
|
||||
this.bgImg = res.data[0].imageUrl
|
||||
this.tuiguang = res.data[0].describes
|
||||
$cache_index.set('bgImg',res.data[0].imageUrl)
|
||||
$cache_index.set('tuiguang',res.data[0].describes)
|
||||
$cache_index.set('bgImg', res.data[0].imageUrl)
|
||||
$cache_index.set('tuiguang', res.data[0].describes)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
@@ -774,13 +819,13 @@
|
||||
// #ifdef MP-TOUTIAO
|
||||
data.dyShow = 1
|
||||
// #endif
|
||||
|
||||
if($cache_index.courseList&&this.page==1){
|
||||
this.courseList=$cache_index.courseList
|
||||
|
||||
if ($cache_index.courseList && this.page == 1) {
|
||||
this.courseList = $cache_index.courseList
|
||||
uni.stopPullDownRefresh()
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.$Request.getT('/app/course/selectCourse', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.pages = res.data.totalPage
|
||||
@@ -791,7 +836,7 @@
|
||||
}
|
||||
if (this.page == 1) {
|
||||
this.courseList = res.data.list
|
||||
$cache_index.set('courseList',res.data.list)
|
||||
$cache_index.set('courseList', res.data.list)
|
||||
} else {
|
||||
this.courseList = [...this.courseList, ...res.data.list]
|
||||
}
|
||||
@@ -844,9 +889,9 @@
|
||||
},
|
||||
// 获取金刚区列表
|
||||
getGardList() {
|
||||
if($cache_index.gridList){
|
||||
this.gridList=$cache_index.gridList
|
||||
return
|
||||
if ($cache_index.gridList) {
|
||||
this.gridList = $cache_index.gridList
|
||||
return
|
||||
}
|
||||
this.$u.api.bannerList({
|
||||
classify: '2',
|
||||
@@ -859,7 +904,7 @@
|
||||
}
|
||||
})
|
||||
this.gridList = this.processArray(arr)
|
||||
$cache_index.set('gridList',this.gridList)
|
||||
$cache_index.set('gridList', this.gridList)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
@@ -954,9 +999,9 @@
|
||||
},
|
||||
// 获取轮播图列表
|
||||
getBannerList() {
|
||||
if($cache_index.swiperList){
|
||||
this.swiperList=$cache_index.swiperList
|
||||
return
|
||||
if ($cache_index.swiperList) {
|
||||
this.swiperList = $cache_index.swiperList
|
||||
return
|
||||
}
|
||||
this.$u.api.bannerList({
|
||||
classify: '1'
|
||||
@@ -967,7 +1012,7 @@
|
||||
this.swiperList.push(d)
|
||||
}
|
||||
})
|
||||
$cache_index.set('swiperList',this.swiperList)
|
||||
$cache_index.set('swiperList', this.swiperList)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
title: '上传中...'
|
||||
});
|
||||
uni.uploadFile({
|
||||
url: configdata.APIHOST + '/alioss/upload',
|
||||
url: configdata.APIHOST + 'alioss/upload',
|
||||
// url: 'https://jiaoyu.xianmxkj.com/sqx_fast/alioss/upload', //仅为示例,非真实的接口地址
|
||||
filePath: e.detail.avatarUrl,
|
||||
// filePath: res.tempFilePaths[0],
|
||||
@@ -214,7 +214,7 @@
|
||||
let token = uni.getStorageSync('token');
|
||||
let userId = uni.getStorageSync('userId');
|
||||
uni.uploadFile({
|
||||
url: configdata.APIHOST + '/alioss/upload',
|
||||
url: configdata.APIHOST + 'alioss/upload',
|
||||
// url: 'https://jiaoyu.xianmxkj.com/sqx_fast/alioss/upload', //仅为示例,非真实的接口地址
|
||||
filePath: res.tempFilePaths[0],
|
||||
name: 'file',
|
||||
|
||||
@@ -99,6 +99,9 @@
|
||||
|
||||
<script>
|
||||
import {$cache_renwu} from '@/store/cashe.js'
|
||||
import {isEmpty} from '@/utils/util.js'
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
data() {
|
||||
@@ -202,7 +205,7 @@
|
||||
* 获取签到数据
|
||||
*/
|
||||
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.signDays =$cache_renwu.signDays
|
||||
this.enable =$cache_renwu.enable
|
||||
@@ -366,6 +369,7 @@
|
||||
onPullDownRefresh: function() {
|
||||
console.log(2)
|
||||
$cache_renwu.clear()
|
||||
this.getsignIn()
|
||||
this.getTaskdata();
|
||||
},
|
||||
|
||||
|
||||
@@ -113,13 +113,9 @@ const $cache={
|
||||
config:$cache_config
|
||||
}
|
||||
export function cacheClearAll() {
|
||||
console.log($cache_index);
|
||||
$cache_index.clear()
|
||||
$cache_video.clear()
|
||||
$cache_renwu.clear()
|
||||
$cache_chasingDrama.clear()
|
||||
$cache_user.clear()
|
||||
$cache_config.clear()
|
||||
for(let i in $cache){
|
||||
$cache[i].clear()
|
||||
}
|
||||
}
|
||||
export function cacheClear(arr){
|
||||
if(typeof arr==='string'&&$cache[arr]){
|
||||
|
||||
3
utils/util.js
Normal file
3
utils/util.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export function isEmpty(val){
|
||||
return val===null||val===undefined||val===''
|
||||
}
|
||||
Reference in New Issue
Block a user