增加数据缓存,去除部分请求的重复/
This commit is contained in:
parent
cbcd1c857c
commit
6fb98974d6
237
App.vue
237
App.vue
|
|
@ -1,9 +1,34 @@
|
|||
<script>
|
||||
import config from '@/common/config.js'
|
||||
import {isH5Android} from '@/utils/app.js'
|
||||
import {init} from '@/utils/init.js'
|
||||
import store from './store/index.js'
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
console.log('onLaunch')
|
||||
// #ifdef H5
|
||||
//防止刷新过快
|
||||
if(process.env.NODE_ENV === 'production'){
|
||||
const prveTime=uni.getStorageSync('time')
|
||||
const time=Date.now()
|
||||
uni.setStorageSync('time',time)
|
||||
if(prveTime&&time-prveTime<=2000){
|
||||
uni.setStorageSync('isDisabledAll',true)
|
||||
uni.request=()=>{
|
||||
|
||||
}
|
||||
uni.removeStorageSync('prveTime')
|
||||
return uni.showToast({
|
||||
title:'休息一会儿吧,你刷新的太过频繁了!',
|
||||
icon:'error'
|
||||
})
|
||||
}else{
|
||||
uni.removeStorageSync('isDisabledAll')
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
|
||||
let that = this
|
||||
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||||
//是否开启小程序自动登录 881
|
||||
|
|
@ -302,36 +327,7 @@
|
|||
// }
|
||||
// }, 3000);
|
||||
|
||||
|
||||
//#ifdef H5
|
||||
|
||||
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) {
|
||||
that.$u.get('/app/Login/openid/login?openId=' + openid).then(
|
||||
res => {
|
||||
if (res.code == 0) {
|
||||
uni.setStorageSync('token', res.token)
|
||||
uni.setStorageSync('userId', res.user.userId)
|
||||
uni.setStorageSync('userName', res.user.userName)
|
||||
uni.setStorageSync('phone', res.user.phone)
|
||||
uni.setStorageSync('invitationCode', res.user
|
||||
.invitationCode)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//#endif
|
||||
|
||||
//#ifdef APP-PLUS
|
||||
// APP检测更新 具体打包流程可以参考:https://ask.dcloud.net.cn/article/35667
|
||||
plus.screen.lockOrientation('portrait-primary'); //竖屏正方向锁定
|
||||
|
|
@ -644,6 +640,7 @@
|
|||
},
|
||||
onShow: function() {
|
||||
|
||||
|
||||
// #ifdef H5
|
||||
// isH5Android()
|
||||
// #endif
|
||||
|
|
@ -672,183 +669,9 @@
|
|||
// uni.setStorageSync('kefu', res.data.value)
|
||||
// }
|
||||
// });
|
||||
//微信小程序IOS系统支付功能开关 882
|
||||
this.$u.get('/app/common/type/882').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
let value = res.data.value
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
// #ifdef MP-WEIXIN
|
||||
if (sysInfo.osName == 'ios') { //是ios系统
|
||||
if (value == '是') { //开启
|
||||
uni.setStorageSync('isWxIosPay', true)
|
||||
} else { //关闭
|
||||
uni.setStorageSync('isWxIosPay', false)
|
||||
}
|
||||
} else { //不是ios下,直接打开
|
||||
uni.setStorageSync('isWxIosPay', true)
|
||||
}
|
||||
// #endif
|
||||
//不在微信小程序也直接打开
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.setStorageSync('isWxIosPay', true)
|
||||
// #endif
|
||||
}
|
||||
});
|
||||
//是否开启苹果登录 833
|
||||
this.$u.get('/app/common/type/833').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('checkIosLogin', res.data.value)
|
||||
}
|
||||
});
|
||||
//是否开启苹果支付 834
|
||||
this.$u.get('/app/common/type/834').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('checkIosPay', res.data.value)
|
||||
}
|
||||
});
|
||||
//是否开启微信登录 835
|
||||
this.$u.get('/app/common/type/835').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('checkWxLogin', res.data.value)
|
||||
}
|
||||
});
|
||||
//是否开启手机号一键登录 836
|
||||
this.$u.get('/app/common/type/836').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('checkPhoneLogin', res.data.value)
|
||||
}
|
||||
});
|
||||
this.$u.get('/app/common/type/817').then(res => { //是否开启购买整部视频 817
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('zhengbu', res.data.value)
|
||||
}
|
||||
});
|
||||
|
||||
this.$u.get('/app/common/type/818').then(res => { //是否开启购买单集视频 818
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('danbu', res.data.value)
|
||||
}
|
||||
});
|
||||
// 微信激励广告id 252
|
||||
this.$u.get('/app/common/type/252').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('adUnitId', res.data.value)
|
||||
}
|
||||
});
|
||||
// 播放类型 1:抖音云 2:三方云
|
||||
this.$u.get('/app/common/type/821').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('playType', res.data.value)
|
||||
}
|
||||
});
|
||||
// 是否开启看广告(微信) 251
|
||||
this.$u.get('/app/common/type/251').then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data && res.data.value) {
|
||||
uni.setStorageSync('isGuanggao', res.data.value)
|
||||
}
|
||||
}
|
||||
});
|
||||
// 是否开启看广告(抖音) 254
|
||||
this.$u.get('/app/common/type/254').then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data && res.data.value) {
|
||||
uni.setStorageSync('isGuanggaody', res.data.value)
|
||||
}
|
||||
}
|
||||
});
|
||||
this.$u.get('/app/common/type/202').then(res => { //客服配置 1 二维码客服 2 微信公众号客服 3电话客服
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kefu', res.data.value)
|
||||
}
|
||||
});
|
||||
this.$u.get('/app/common/type/206').then(res => { //客服电话
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kefuPhone', res.data.value)
|
||||
}
|
||||
});
|
||||
this.$u.get('/app/common/type/204').then(res => { //微信客服链接
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kefuUrl', res.data.value)
|
||||
}
|
||||
});
|
||||
this.$u.get('/app/common/type/203').then(res => { //微信客服appid
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kefuAppId', res.data.value)
|
||||
}
|
||||
});
|
||||
//会员开关
|
||||
this.$u.get('/app/common/type/248').then(res => { //会员开关
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('isVips', res.data.value)
|
||||
}
|
||||
});
|
||||
//热搜词 249
|
||||
this.$u.get('/app/common/type/249').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('moreSearch', res.data.value)
|
||||
}
|
||||
});
|
||||
//安卓下载地址 49
|
||||
this.$u.get('/app/common/type/49').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('AppUrl', res.data.value)
|
||||
}
|
||||
});
|
||||
//微信虚拟支付OfferID 823
|
||||
this.$u.get('/app/common/type/823').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('OfferID', res.data.value)
|
||||
}
|
||||
});
|
||||
//微信虚拟支付环境(0 米大师正式环境, 1 米大师沙箱环境) 824
|
||||
this.$u.get('/app/common/type/824').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('payEnv', res.data.value)
|
||||
}
|
||||
});
|
||||
//充值提示 825
|
||||
this.$u.get('/app/common/type/825').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('moneyTips', res.data.value)
|
||||
}
|
||||
});
|
||||
//是否开启卡密充值 855
|
||||
this.$u.get('/app/common/type/855').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kmPaySel', res.data.value)
|
||||
}
|
||||
});
|
||||
//是否开启分类 849
|
||||
this.$u.get('/app/common/type/849').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('homeTypeSel', res.data.value)
|
||||
}
|
||||
});
|
||||
//是否开启收益充值余额 856
|
||||
this.$u.get('/app/common/type/856').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('syPaySel', res.data.value)
|
||||
}
|
||||
});
|
||||
//抖音im客服 857
|
||||
this.$u.get('/app/common/type/857').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('imId', res.data.value)
|
||||
}
|
||||
});
|
||||
this.$u.get('/app/common/type/858').then(res => { //是否开启公众号充值
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('isAccountPay', res.data.value)
|
||||
}
|
||||
});
|
||||
//抖音广告id
|
||||
this.$u.get('/app/common/type/860').then(res => { //抖音广告
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('dyadUnitId', res.data.value)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
init()
|
||||
|
||||
// #ifdef H5
|
||||
if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||
//是否开启pc端使用 850
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
// const ROOTPATH2 = "https://video-h5.hnsiyao.cn"; //后台服务域名
|
||||
|
||||
// h5
|
||||
const ROOTPATH1 = "https://web.hnsiyao.cn/czg/"; //
|
||||
const ROOTPATH = "https://web.hnsiyao.cn/czg/"; //后台服务域名
|
||||
const ROOTPATH2 = "https://dj-h5.hnsiyao.cn"; //后台服务域名
|
||||
// const ROOTPATH1 = "https://web.hnsiyao.cn/czg/"; //
|
||||
// const ROOTPATH = "https://web.hnsiyao.cn/czg/"; //后台服务域名
|
||||
// const ROOTPATH2 = "https://dj-h5.hnsiyao.cn"; //后台服务域名
|
||||
|
||||
// const ROOTPATH1 = "https://web-api.hnsiyao.cn/czg/"; //
|
||||
// const ROOTPATH = "https://web-api.hnsiyao.cn/czg/"; //后台服务域名
|
||||
// const ROOTPATH2 = "https://video-h5.hnsiyao.cn"; //后台服务域名
|
||||
const ROOTPATH1 = "https://web-api.hnsiyao.cn/czg/"; //
|
||||
const ROOTPATH = "https://web-api.hnsiyao.cn/czg/"; //后台服务域名
|
||||
const ROOTPATH2 = "https://video-h5.hnsiyao.cn"; //后台服务域名
|
||||
|
||||
// const ROOTPATH1 = "http://192.168.1.5:8100/czg/"; //
|
||||
// const ROOTPATH = "http://192.168.1.5:8100/czg/"; //后台服务域名
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token变量
|
||||
import {APIHOST} from './config.js'
|
||||
import {cacheClearAll} from '@/store/cashe.js'
|
||||
const install = (Vue, vm) => {
|
||||
// 此为自定义配置参数,具体参数见上方说明
|
||||
Vue.prototype.$u.http.setConfig({
|
||||
|
|
@ -26,8 +27,8 @@ const install = (Vue, vm) => {
|
|||
// 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值
|
||||
const token = uni.getStorageSync('token');
|
||||
config.header.token = token;
|
||||
config.url=config.url.slice(0,1)==='/'?config.url.slice(1,config.url.length):config.url
|
||||
// config.header.Token = 'xxxxxx';
|
||||
|
||||
// 可以对某个url进行特别处理,此url参数为this.$u.get(url)中的url值
|
||||
// if(config.url == '/user/login') config.header.noToken = true;
|
||||
// 最后需要将config进行return
|
||||
|
|
@ -38,6 +39,7 @@ const install = (Vue, vm) => {
|
|||
|
||||
// 响应拦截,判断状态码是否通过
|
||||
Vue.prototype.$u.http.interceptor.response = (res) => {
|
||||
console.log(res);
|
||||
if (res.code == 0) {
|
||||
// res为服务端返回值,可能有code,result等字段
|
||||
// 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
|
||||
|
|
@ -75,6 +77,7 @@ const install = (Vue, vm) => {
|
|||
uni.removeStorageSync("isInvitation")
|
||||
uni.removeStorageSync("zhiFuBao")
|
||||
uni.removeStorageSync("zhiFuBaoName")
|
||||
cacheClearAll()
|
||||
// 此为uView的方法,详见路由相关文档
|
||||
vm.$u.route('/pages/login/login')
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import configdata from './config'
|
||||
import cache from './cache'
|
||||
|
||||
import {
|
||||
cacheClearAll
|
||||
} from '@/store/cashe.js'
|
||||
module.exports = {
|
||||
config: function(name) {
|
||||
var info = null;
|
||||
|
|
@ -22,6 +24,7 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
}
|
||||
console.log(info);
|
||||
return info;
|
||||
},
|
||||
logout: function() {
|
||||
|
|
@ -47,17 +50,20 @@ module.exports = {
|
|||
uni.removeStorageSync("isInvitation")
|
||||
uni.removeStorageSync("zhiFuBao")
|
||||
uni.removeStorageSync("zhiFuBaoName")
|
||||
|
||||
cacheClearAll()
|
||||
uni.showToast({
|
||||
title: '用户信息失效,请重新登录!',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.navigateTo({ url: "/pages/login/login" })
|
||||
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
},
|
||||
post: function(url, data, header) {
|
||||
let that = this;
|
||||
header = header || "application/x-www-form-urlencoded";
|
||||
url = that.config("APIHOST") + url;
|
||||
url = that.config("APIHOST") + url.replace(/^\//, "");
|
||||
return new Promise((succ, error) => {
|
||||
uni.request({
|
||||
url: url,
|
||||
|
|
@ -81,7 +87,7 @@ module.exports = {
|
|||
postT: function(url, data, header) {
|
||||
let that = this;
|
||||
header = header || "application/x-www-form-urlencoded";
|
||||
url = that.config("APIHOST1") + url;
|
||||
url = that.config("APIHOST1") + url.replace(/^\//, "");
|
||||
// let token = uni.getStorageSync("token");
|
||||
let token = uni.getStorageSync("token");
|
||||
if (token) {
|
||||
|
|
@ -130,7 +136,7 @@ module.exports = {
|
|||
postJson: function(url, data, header) {
|
||||
let that = this;
|
||||
header = header || "application/json";
|
||||
url = that.config("APIHOST1") + url;
|
||||
url = that.config("APIHOST1") + url.replace(/^\//, "");
|
||||
// let token = uni.getStorageSync("token");
|
||||
let token = uni.getStorageSync("token");
|
||||
if (token) {
|
||||
|
|
@ -179,7 +185,8 @@ module.exports = {
|
|||
getT: function(url, data, header) {
|
||||
let that = this;
|
||||
header = header || "application/x-www-form-urlencoded";
|
||||
url = that.config("APIHOST1") + url;
|
||||
url = that.config("APIHOST1") + url.replace(/^\//, "");
|
||||
console.log(url);
|
||||
// let token = uni.getStorageSync("token");
|
||||
let token = uni.getStorageSync("token");
|
||||
if (token) {
|
||||
|
|
@ -299,7 +306,8 @@ module.exports = {
|
|||
get: function(url, data, header) {
|
||||
let that = this;
|
||||
header = header || "application/x-www-form-urlencoded";
|
||||
url = that.config("APIHOST") + url;
|
||||
url = that.config("APIHOST") + url.replace(/^\//, "");
|
||||
console.log(url);
|
||||
return new Promise((succ, error) => {
|
||||
uni.request({
|
||||
url: url,
|
||||
|
|
@ -346,7 +354,7 @@ module.exports = {
|
|||
get1: function(url, data, header) {
|
||||
let that = this;
|
||||
header = header || "application/json";
|
||||
url = that.config("APIHOST") + url;
|
||||
url = that.config("APIHOST") + url.replace(/^\//, "");
|
||||
return new Promise((succ, error) => {
|
||||
uni.request({
|
||||
url: url,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {cacheClearAll} from '@/store/cashe.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -83,6 +84,7 @@
|
|||
uni.removeStorageSync('zhiFuBao')
|
||||
uni.removeStorageSync('zhiFuBaoName')
|
||||
uni.removeStorageSync('isVIP')
|
||||
cacheClearAll()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '退出登录成功'
|
||||
|
|
|
|||
|
|
@ -105,7 +105,10 @@
|
|||
"path": "pages/me/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的",
|
||||
"navigationStyle": "custom"
|
||||
"navigationStyle": "custom",
|
||||
// #ifdef H5
|
||||
"enablePullDownRefresh": true
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -113,15 +113,16 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { $cache_chasingDrama} from '@/store/cashe.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isErQd: false, //昨天是否签到
|
||||
isQd: false, //今日是否已签到
|
||||
day: 0, //签到天数
|
||||
isErQd: $cache_chasingDrama.isErQd|| false, //昨天是否签到
|
||||
isQd: $cache_chasingDrama.isQd||false, //今日是否已签到
|
||||
day: $cache_chasingDrama.day|| 0, //签到天数
|
||||
numList: this.getThisWeekDates(),
|
||||
list: [],
|
||||
zhuiju: [],
|
||||
list: $cache_chasingDrama.list||[],
|
||||
zhuiju: $cache_chasingDrama.zhuiju|| [],
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
|
|
@ -171,6 +172,9 @@
|
|||
this.isQd = false
|
||||
this.isErQd = false
|
||||
}
|
||||
$cache_chasingDrama.set('day',this.day)
|
||||
$cache_chasingDrama.set('isQd',this.isQd)
|
||||
$cache_chasingDrama.set('isErQd',this.isErQd)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
|
|
@ -201,6 +205,7 @@
|
|||
this.$Request.getT('/app/courseCollect/selectByUserId', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.zhuiju = res.data.records
|
||||
$cache_chasingDrama.set('zhuiju',this.zhuiju)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
@ -217,6 +222,7 @@
|
|||
this.$nextTick(() => {
|
||||
this.videPage = 1
|
||||
})
|
||||
$cache_chasingDrama.set('list',this.list)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -210,6 +210,8 @@
|
|||
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'
|
||||
console.log($cache_index)
|
||||
export default {
|
||||
components: {
|
||||
videoList,
|
||||
|
|
@ -291,10 +293,7 @@
|
|||
//获取小程序胶囊的宽度
|
||||
this.barWidth = menuButtonInfo.width
|
||||
this.barHeight = menuButtonInfo.height
|
||||
|
||||
// #endif
|
||||
|
||||
console.log(options, '22222222222222222')
|
||||
if (uni.getStorageSync('qdCode')) {
|
||||
this.qdCode = uni.getStorageSync('qdCode')
|
||||
}
|
||||
|
|
@ -365,9 +364,13 @@
|
|||
//本周热门
|
||||
this.getrecomVideo('2')
|
||||
//本周排行榜
|
||||
this.getrecomVideo('1')
|
||||
setTimeout(()=>{
|
||||
this.getrecomVideo('1')
|
||||
},100)
|
||||
//最新
|
||||
this.getrecomVideo('')
|
||||
setTimeout(()=>{
|
||||
this.getrecomVideo('')
|
||||
},200)
|
||||
this.getBannerList()
|
||||
this.getMsg()
|
||||
this.getGardList()
|
||||
|
|
@ -460,6 +463,7 @@
|
|||
},
|
||||
onPullDownRefresh() {
|
||||
this.page = 1
|
||||
$cache_index.clear()
|
||||
this.getCourseList()
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -616,30 +620,54 @@
|
|||
// #ifdef MP-TOUTIAO
|
||||
data.dyShow = 1
|
||||
// #endif
|
||||
if(sort==2&&$cache_index.rmVideList){
|
||||
this.rmVideList = $cache_index.rmVideList
|
||||
return
|
||||
}
|
||||
if(sort==1&&$cache_index.phbVideoList){
|
||||
this.phbVideoList = $cache_index.phbVideoList
|
||||
return
|
||||
}
|
||||
if(!sort&&$cache_index.newVideList){
|
||||
this.newVideList = $cache_index.newVideList
|
||||
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)
|
||||
} else if (Number(sort) == 1) { //本周排行榜
|
||||
this.phbVideoList = res.data.list
|
||||
$cache_index.set('phbVideoList',this.phbVideoList)
|
||||
} else { //最新热播
|
||||
this.newVideList = res.data.list
|
||||
$cache_index.set('newVideList',this.newVideList)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
getTypeList() {
|
||||
if($cache_index.typeList){
|
||||
this.typeList=$cache_index.typeList
|
||||
return
|
||||
}
|
||||
console.log('请求服务器 getTypeList')
|
||||
this.$Request.getT('/app/courseClassification/queryClassification').then(res => {
|
||||
if (res.code == 0) {
|
||||
let fenlei = {
|
||||
classificationId: 0,
|
||||
classificationName: "热门"
|
||||
}
|
||||
this.typeList = [];
|
||||
this.typeList.push(fenlei);
|
||||
res.data.forEach(d => {
|
||||
this.typeList.push(d);
|
||||
});
|
||||
// this.typeList = [];
|
||||
// this.typeList.push(fenlei);
|
||||
// res.data.forEach(d => {
|
||||
// this.typeList.push(d);
|
||||
// });
|
||||
|
||||
this.typeList=[fenlei,...res.data]
|
||||
$cache_index.set('typeList',this.typeList)
|
||||
// console.log(JSON.stringify(this.typeList))
|
||||
}
|
||||
});
|
||||
|
|
@ -706,10 +734,19 @@
|
|||
},
|
||||
//获取背景图
|
||||
getBgImg() {
|
||||
const bgImg=$cache_index.bgImg
|
||||
const tuiguang=$cache_index.tuiguang
|
||||
if(bgImg&&tuiguang){
|
||||
this.bgImg = bgImg
|
||||
this.tuiguang = tuiguang
|
||||
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)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
|
|
@ -738,8 +775,14 @@
|
|||
// #ifdef MP-TOUTIAO
|
||||
data.dyShow = 1
|
||||
// #endif
|
||||
this.$Request.getT('/app/course/selectCourse', data).then(res => {
|
||||
|
||||
if($cache_index.courseList&&this.page==1){
|
||||
this.courseList=$cache_index.courseList
|
||||
uni.stopPullDownRefresh()
|
||||
return
|
||||
}
|
||||
|
||||
this.$Request.getT('/app/course/selectCourse', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.pages = res.data.totalPage
|
||||
if (this.page < this.pages) {
|
||||
|
|
@ -749,6 +792,7 @@
|
|||
}
|
||||
if (this.page == 1) {
|
||||
this.courseList = res.data.list
|
||||
$cache_index.set('courseList',res.data.list)
|
||||
} else {
|
||||
this.courseList = [...this.courseList, ...res.data.list]
|
||||
}
|
||||
|
|
@ -801,6 +845,10 @@
|
|||
},
|
||||
// 获取金刚区列表
|
||||
getGardList() {
|
||||
if($cache_index.gridList){
|
||||
this.gridList=$cache_index.gridList
|
||||
return
|
||||
}
|
||||
this.$u.api.bannerList({
|
||||
classify: '2',
|
||||
}).then(res => {
|
||||
|
|
@ -812,6 +860,7 @@
|
|||
}
|
||||
})
|
||||
this.gridList = this.processArray(arr)
|
||||
$cache_index.set('gridList',this.gridList)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
|
|
@ -907,6 +956,10 @@
|
|||
},
|
||||
// 获取轮播图列表
|
||||
getBannerList() {
|
||||
if($cache_index.swiperList){
|
||||
this.swiperList=$cache_index.swiperList
|
||||
return
|
||||
}
|
||||
this.$u.api.bannerList({
|
||||
classify: '1'
|
||||
}).then(res => {
|
||||
|
|
@ -916,7 +969,7 @@
|
|||
this.swiperList.push(d)
|
||||
}
|
||||
})
|
||||
|
||||
$cache_index.set('swiperList',this.swiperList)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
|
|
|
|||
|
|
@ -262,8 +262,8 @@
|
|||
import ttMsg from '../../components/ttMsg/ttMsg.vue'
|
||||
import httpsRequest from '../../common/httpRequest.js'
|
||||
import otherXuanfu from '@/components/other-xuafu.vue'
|
||||
|
||||
|
||||
import {$cache_user} from '@/store/cashe.js'
|
||||
console.log($cache_user);
|
||||
export default {
|
||||
components: {
|
||||
ttMsg,
|
||||
|
|
@ -289,8 +289,8 @@
|
|||
invitationCode: '',
|
||||
token: '',
|
||||
endTime: '', //会员到期时间
|
||||
moneyNum: 0, //余额
|
||||
jifen: 0, //积分
|
||||
moneyNum:$cache_user.moneyNum|| 0, //余额
|
||||
jifen:$cache_user.jifen|| 0, //积分
|
||||
isVips: '否', //是否显示会员
|
||||
myLoveNum: 0, //我的喜欢个数
|
||||
myZhui: 0, //我的追剧数量
|
||||
|
|
@ -300,13 +300,18 @@
|
|||
twoRate: 0,
|
||||
kmPaySel: '否',
|
||||
isWxIosPay: true, //微信下是否显示支付功能
|
||||
userInfo: {},
|
||||
userInfo:$cache_user.userInfo|| {},
|
||||
isShowMoneyPay: true,
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getBannerList()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
$cache_user.clear()
|
||||
this.getMyMoney()
|
||||
this.getPoints()
|
||||
},
|
||||
onShow() {
|
||||
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
|
|
@ -333,6 +338,11 @@
|
|||
this.invitationCode = res.data.invitationCode
|
||||
this.rate = res.data.rate || 0
|
||||
this.twoRate = res.data.twoRate || 0
|
||||
$cache_user.set('userName',this.userName)
|
||||
$cache_user.set('avatar',this.avatar)
|
||||
$cache_user.set('invitationCode',this.invitationCode)
|
||||
$cache_user.set('rate',this.rate)
|
||||
$cache_user.set('twoRate',this.twoRate)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -473,6 +483,7 @@
|
|||
} else {
|
||||
this.jifen = 0
|
||||
}
|
||||
$cache_user.set('jifen',this.jifen)
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
|
@ -495,6 +506,8 @@
|
|||
if (res.code === 0) {
|
||||
this.moneyNum = res.data.money
|
||||
this.userInfo = res.data
|
||||
$cache_user.set('userInfo',res.data)
|
||||
$cache_user.set('moneyNum',res.data.money)
|
||||
// this.$Request.getT('/app/invite/selectInviteMoney').then(ret => {
|
||||
// if (ret.code == 0) {
|
||||
// if (ret.data.inviteMoney && ret.data.inviteMoney.money) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<script>
|
||||
import httpsRequest from '@/common/httpRequest.js'
|
||||
import {cacheClear} from '@/store/cashe.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -22,45 +23,50 @@
|
|||
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
getOrder(){
|
||||
httpsRequest.getT("/app/wuyou/queryOrder/" + this.ordersId, {}).then(res => {
|
||||
console.log(res.data);
|
||||
|
||||
if (res.data == 1) {
|
||||
uni.hideLoading()
|
||||
const sysInfo = uni.getSystemInfoSync();
|
||||
let isIos = sysInfo.platform == 'ios'
|
||||
console.log("is ios ", isIos);
|
||||
if (isIos) {
|
||||
uni.navigateBack()
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'none'
|
||||
})
|
||||
cacheClear(['renwu','user'])
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'none'
|
||||
})
|
||||
this.timer = setTimeout(() => {
|
||||
clearTimeout(this.timer)
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
}
|
||||
} else {
|
||||
// #ifdef APP
|
||||
uni.showLoading({
|
||||
title: '支付中'
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
onReady() {},
|
||||
onShow() {
|
||||
console.log(this.ordersId);
|
||||
|
||||
httpsRequest.getT("/app/wuyou/queryOrder/" + this.ordersId, {}).then(res => {
|
||||
console.log(res.data);
|
||||
|
||||
if (res.data == 1) {
|
||||
uni.hideLoading()
|
||||
const sysInfo = uni.getSystemInfoSync();
|
||||
let isIos = sysInfo.platform == 'ios'
|
||||
console.log("is ios ", isIos);
|
||||
if (isIos) {
|
||||
uni.navigateBack()
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'none'
|
||||
})
|
||||
this.timer = setTimeout(() => {
|
||||
clearTimeout(this.timer)
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
}
|
||||
} else {
|
||||
// #ifdef APP
|
||||
uni.showLoading({
|
||||
title: '支付中'
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
});
|
||||
this.getOrder()
|
||||
},
|
||||
onHide() {
|
||||
clearInterval(this.timer)
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {$cache_renwu} from '@/store/cashe.js'
|
||||
export default {
|
||||
|
||||
data() {
|
||||
|
|
@ -114,7 +115,6 @@
|
|||
recordList: [
|
||||
],
|
||||
signInBtn: '点击签到',
|
||||
isShowMoneyPay: true,
|
||||
isIos: false,
|
||||
isAndroid: false,
|
||||
adRewardedVideo: true,
|
||||
|
|
@ -128,18 +128,6 @@
|
|||
this.signInList = []
|
||||
this.getTaskdata()
|
||||
this.getsignIn()
|
||||
this.$Request.getT("app/common/type/919", {}).then(res => {
|
||||
if (res.code == 0) {
|
||||
const sysInfo = uni.getSystemInfoSync();
|
||||
let isIos = sysInfo.platform == 'ios'
|
||||
this.isIos = /iOS/.test(sysInfo.platform);
|
||||
// 判断是否是安卓设备
|
||||
|
||||
|
||||
this.isShowMoneyPay = !(res.data.value == '1' && isIos)
|
||||
}
|
||||
});
|
||||
|
||||
this.$nextTick(()=>{
|
||||
this.adRewardedVideoloadNum = 0
|
||||
this.$refs.adRewardedVideo.load();
|
||||
|
|
@ -214,6 +202,12 @@
|
|||
* 获取签到数据
|
||||
*/
|
||||
getsignIn() {
|
||||
if($cache_renwu.signInList&&$cache_renwu.signDays&&$cache_renwu.enable){
|
||||
this.signInList =$cache_renwu.signInList
|
||||
this.signDays =$cache_renwu.signDays
|
||||
this.enable =$cache_renwu.enable
|
||||
return
|
||||
}
|
||||
this.$Request.getT('app/userSignRecord/getUserSignData', {}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.signInList = res.data.recordList
|
||||
|
|
@ -228,6 +222,9 @@
|
|||
this.signInBtn = '已签到'
|
||||
}
|
||||
})
|
||||
$cache_renwu.set('signInList',this.signInList)
|
||||
$cache_renwu.set('signDays',this.signDays)
|
||||
$cache_renwu.set('enable',this.enable)
|
||||
} else {
|
||||
// uni.showToast({
|
||||
// title: res.msg,
|
||||
|
|
@ -318,6 +315,7 @@
|
|||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
$cache_renwu.clear()
|
||||
this.getTaskdata()
|
||||
this.getsignIn()
|
||||
}, 1000)
|
||||
|
|
@ -333,6 +331,12 @@
|
|||
* 获取任务列表
|
||||
*/
|
||||
getTaskdata() {
|
||||
if($cache_renwu.list){
|
||||
this.list= $cache_renwu.list
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
console.log('获取服务器 任务列表')
|
||||
this.list= [];
|
||||
this.$Request.getT('app/taskCenter/selectTaskCenter', {}).then(res => {
|
||||
if (res.code == 0) {
|
||||
|
|
@ -350,8 +354,7 @@
|
|||
}
|
||||
// #endif
|
||||
})
|
||||
|
||||
|
||||
$cache_renwu.set('list',this.list)
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
})
|
||||
|
|
@ -362,6 +365,7 @@
|
|||
*/
|
||||
onPullDownRefresh: function() {
|
||||
console.log(2)
|
||||
$cache_renwu.clear()
|
||||
this.getTaskdata();
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@
|
|||
<script>
|
||||
import config from '../../common/config.js'
|
||||
import tkiQrcode from '../../components/tki-qrcode/tki-qrcode.vue';
|
||||
import {$cache_video} from '@/store/cashe.js'
|
||||
export default {
|
||||
components: {
|
||||
tkiQrcode
|
||||
|
|
@ -665,6 +666,30 @@
|
|||
}
|
||||
|
||||
},
|
||||
//首页视频初始化
|
||||
videoInit(){
|
||||
if(this.page==1){
|
||||
let numIdCurr = this.videoList[0].courseDetailsId;
|
||||
this.courseId = this.videoList[0].courseId
|
||||
this.courseDetailsId = this.videoList[0].courseDetailsId;
|
||||
this.videoContextId = 'myVideo' + numIdCurr;
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.videoContext = uni.createVideoContext(this.videoContextId, this);
|
||||
this.videoContext.play();
|
||||
})
|
||||
|
||||
if (uni.getStorageSync('token')) { //如果有token则插入
|
||||
//插入历史记录
|
||||
this.setHistor(this.videoList[this.current].courseId, this.videoList[this
|
||||
.current]
|
||||
.courseDetailsId)
|
||||
}
|
||||
}
|
||||
this.getsrc(this.videoList[this.current].videoUrl, this.videoList[this.current]
|
||||
.wxCourseDetailsId)
|
||||
this.$forceUpdate()
|
||||
},
|
||||
// 资源详情
|
||||
getDataList() {
|
||||
let data = {
|
||||
|
|
@ -679,6 +704,11 @@
|
|||
// #ifdef MP-TOUTIAO
|
||||
data.dyShow = 1
|
||||
// #endif
|
||||
|
||||
if(this.page==1&&$cache_video.videoList){
|
||||
this.videoList=$cache_video.videoList
|
||||
return
|
||||
}
|
||||
this.$Request.getT('/app/course/selectCourseDetailsList', data).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.pages = res.data.totalPage
|
||||
|
|
@ -691,30 +721,11 @@
|
|||
//菜单数组
|
||||
if (this.page == 1) {
|
||||
this.videoList = arr
|
||||
$cache_video.set('videoList',arr)
|
||||
} else {
|
||||
this.videoList = [...this.videoList, ...arr]
|
||||
}
|
||||
if (this.page == 1) {
|
||||
let numIdCurr = this.videoList[0].courseDetailsId;
|
||||
this.courseId = this.videoList[0].courseId
|
||||
this.courseDetailsId = this.videoList[0].courseDetailsId;
|
||||
this.videoContextId = 'myVideo' + numIdCurr;
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.videoContext = uni.createVideoContext(this.videoContextId, this);
|
||||
this.videoContext.play();
|
||||
})
|
||||
|
||||
if (uni.getStorageSync('token')) { //如果有token则插入
|
||||
//插入历史记录
|
||||
this.setHistor(this.videoList[this.current].courseId, this.videoList[this
|
||||
.current]
|
||||
.courseDetailsId)
|
||||
}
|
||||
}
|
||||
this.getsrc(this.videoList[this.current].videoUrl, this.videoList[this.current]
|
||||
.wxCourseDetailsId)
|
||||
this.$forceUpdate()
|
||||
this.videoInit()
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
|
|
|
|||
|
|
@ -0,0 +1,136 @@
|
|||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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
|
||||
}
|
||||
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')
|
||||
})
|
||||
|
||||
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, this)
|
||||
uni.setStorageSync(this._name, this)
|
||||
}
|
||||
clear() {
|
||||
Object.keys(this).map(v => {
|
||||
if (v.slice(0, 1) !== '_') {
|
||||
this[v] = null
|
||||
}
|
||||
uni.removeStorageSync(v)
|
||||
})
|
||||
}
|
||||
}
|
||||
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,
|
||||
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()
|
||||
}
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,309 @@
|
|||
import httpsRequest from '@/common/httpRequest.js'
|
||||
import { $cache_config } from '@/store/cashe';
|
||||
export function init() {
|
||||
// #ifdef APP
|
||||
//微信小程序IOS系统支付功能开关 882
|
||||
httpsRequest.getT('/app/common/type/882').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
let value = res.data.value
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
// #ifdef MP-WEIXIN
|
||||
if (sysInfo.osName == 'ios') { //是ios系统
|
||||
if (value == '是') { //开启
|
||||
uni.setStorageSync('isWxIosPay', true)
|
||||
} else { //关闭
|
||||
uni.setStorageSync('isWxIosPay', false)
|
||||
}
|
||||
} else { //不是ios下,直接打开
|
||||
uni.setStorageSync('isWxIosPay', true)
|
||||
}
|
||||
// #endif
|
||||
//不在微信小程序也直接打开
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.setStorageSync('isWxIosPay', true)
|
||||
// #endif
|
||||
}
|
||||
});
|
||||
//是否开启苹果登录 833
|
||||
httpsRequest.getT('/app/common/type/833').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('checkIosLogin', res.data.value)
|
||||
}
|
||||
});
|
||||
//是否开启苹果支付 834
|
||||
httpsRequest.getT('/app/common/type/834').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('checkIosPay', res.data.value)
|
||||
}
|
||||
});
|
||||
//是否开启微信登录 835
|
||||
httpsRequest.getT('/app/common/type/835').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('checkWxLogin', res.data.value)
|
||||
}
|
||||
});
|
||||
//是否开启手机号一键登录 836
|
||||
httpsRequest.getT('/app/common/type/836').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('checkPhoneLogin', res.data.value)
|
||||
}
|
||||
});
|
||||
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
// httpsRequest.getT('/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) {
|
||||
// that.$u.get('/app/Login/openid/login?openId=' + openid).then(
|
||||
// res => {
|
||||
// if (res.code == 0) {
|
||||
// uni.setStorageSync('token', res.token)
|
||||
// uni.setStorageSync('userId', res.user.userId)
|
||||
// uni.setStorageSync('userName', res.user.userName)
|
||||
// uni.setStorageSync('phone', res.user.phone)
|
||||
// uni.setStorageSync('invitationCode', res.user
|
||||
// .invitationCode)
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// #endif
|
||||
|
||||
|
||||
configInit()
|
||||
|
||||
|
||||
}
|
||||
|
||||
export function configInit(){
|
||||
const {zhengbu,danbu,adUnitId,playType,isGuanggao,isGuanggaody,kefu,kefuPhone}=$cache_config
|
||||
if(zhengbu===null||zhengbu===undefined){
|
||||
httpsRequest.getT('/app/common/type/817').then(res => { //是否开启购买整部视频 817
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('zhengbu', res.data.value)
|
||||
$cache_config.set('zhengbu',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(danbu===null||danbu===undefined){
|
||||
httpsRequest.getT('/app/common/type/818').then(res => { //是否开启购买单集视频 818
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('danbu', res.data.value)
|
||||
$cache_config.set('danbu',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 微信激励广告id 252
|
||||
if(adUnitId===null||adUnitId===undefined){
|
||||
httpsRequest.getT('/app/common/type/252').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('adUnitId', res.data.value)
|
||||
$cache_config.set('adUnitId',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 播放类型 1:抖音云 2:三方云
|
||||
if(playType===null||playType===undefined){
|
||||
httpsRequest.getT('/app/common/type/821').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('playType', res.data.value)
|
||||
$cache_config.set('playType',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 是否开启看广告(微信) 251
|
||||
if(isGuanggao===null||isGuanggao===undefined){
|
||||
httpsRequest.getT('/app/common/type/251').then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data && res.data.value) {
|
||||
uni.setStorageSync('isGuanggao', res.data.value)
|
||||
$cache_config.set('isGuanggao',res.data.value)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 是否开启看广告(抖音) 254
|
||||
if(isGuanggaody===null||isGuanggaody===undefined){
|
||||
httpsRequest.getT('/app/common/type/254').then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data && res.data.value) {
|
||||
uni.setStorageSync('isGuanggaody', res.data.value)
|
||||
$cache_config.set('isGuanggaody',res.data.value)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(kefu===null||kefu===undefined){
|
||||
httpsRequest.getT('/app/common/type/202').then(res => { //客服配置 1 二维码客服 2 微信公众号客服 3电话客服
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kefu', res.data.value)
|
||||
$cache_config.set('kefu',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(kefuPhone===null||kefuPhone===undefined){
|
||||
httpsRequest.getT('/app/common/type/206').then(res => { //客服电话
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kefuPhone', res.data.value)
|
||||
$cache_config.set('kefuPhone',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if($cache_config.kefuUrl===null||$cache_config.kefuUrl===undefined){
|
||||
httpsRequest.getT('/app/common/type/204').then(res => { //微信客服链接
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kefuUrl', res.data.value)
|
||||
$cache_config.set('kefuUrl',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if($cache_config.kefuAppId===null||$cache_config.kefuAppId===undefined){
|
||||
httpsRequest.getT('/app/common/type/203').then(res => { //微信客服appid
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kefuAppId', res.data.value)
|
||||
$cache_config.set('kefuAppId',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//会员开关
|
||||
if($cache_config.isVips===null||$cache_config.isVips===undefined){
|
||||
httpsRequest.getT('/app/common/type/248').then(res => { //会员开关
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('isVips', res.data.value)
|
||||
$cache_config.set('isVips',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//热搜词 249
|
||||
if($cache_config.moreSearch===null||$cache_config.moreSearch===undefined){
|
||||
httpsRequest.getT('/app/common/type/249').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('moreSearch', res.data.value)
|
||||
$cache_config.set('moreSearch',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//安卓下载地址 49
|
||||
if($cache_config.AppUrl===null||$cache_config.AppUrl===undefined){
|
||||
httpsRequest.getT('/app/common/type/49').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('AppUrl', res.data.value)
|
||||
$cache_config.set('AppUrl',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//微信虚拟支付OfferID 823
|
||||
if($cache_config.OfferID===null||$cache_config.OfferID===undefined){
|
||||
httpsRequest.getT('/app/common/type/823').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('OfferID', res.data.value)
|
||||
$cache_config.set('OfferID',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//微信虚拟支付环境(0 米大师正式环境, 1 米大师沙箱环境) 824
|
||||
if($cache_config.payEnv===null||$cache_config.payEnv===undefined){
|
||||
httpsRequest.getT('/app/common/type/824').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('payEnv', res.data.value)
|
||||
$cache_config.set('payEnv',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//充值提示 825
|
||||
if($cache_config.moneyTips===null||$cache_config.moneyTips===undefined){
|
||||
httpsRequest.getT('/app/common/type/825').then(res => { //热搜词
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('moneyTips', res.data.value)
|
||||
$cache_config.set('moneyTips',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//是否开启卡密充值 855
|
||||
if($cache_config.kmPaySel===null||$cache_config.kmPaySel===undefined){
|
||||
httpsRequest.getT('/app/common/type/855').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('kmPaySel', res.data.value)
|
||||
$cache_config.set('kmPaySel',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//是否开启分类 849
|
||||
if($cache_config.homeTypeSel===null||$cache_config.homeTypeSel===undefined){
|
||||
httpsRequest.getT('/app/common/type/849').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('homeTypeSel', res.data.value)
|
||||
$cache_config.set('homeTypeSel',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//是否开启收益充值余额 856
|
||||
if($cache_config.syPaySel===null||$cache_config.syPaySel===undefined){
|
||||
httpsRequest.getT('/app/common/type/856').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('syPaySel', res.data.value)
|
||||
$cache_config.set('syPaySel',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//抖音im客服 857
|
||||
if($cache_config.imId===null||$cache_config.imId===undefined){
|
||||
httpsRequest.getT('/app/common/type/857').then(res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('imId', res.data.value)
|
||||
$cache_config.set('imId',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
if($cache_config.isAccountPay===null||$cache_config.isAccountPay===undefined){
|
||||
httpsRequest.getT('/app/common/type/858').then(res => { //是否开启公众号充值
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('isAccountPay', res.data.value)
|
||||
$cache_config.set('isAccountPay',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//抖音广告id
|
||||
if($cache_config.dyadUnitId===null||$cache_config.dyadUnitId===undefined){
|
||||
httpsRequest.getT('/app/common/type/860').then(res => { //抖音广告
|
||||
if (res.code == 0 && res.data) {
|
||||
uni.setStorageSync('dyadUnitId', res.data.value)
|
||||
$cache_config.set('dyadUnitId',res.data.value)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,11 +21,11 @@ class Request {
|
|||
}
|
||||
options.dataType = options.dataType || this.config.dataType;
|
||||
options.responseType = options.responseType || this.config.responseType;
|
||||
options.url = options.url || '';
|
||||
options.url = (options.url || '');
|
||||
options.params = options.params || {};
|
||||
options.header = Object.assign({}, this.config.header, options.header);
|
||||
options.method = options.method || this.config.method;
|
||||
|
||||
console.log(options);
|
||||
return new Promise((resolve, reject) => {
|
||||
options.complete = (response) => {
|
||||
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
|
||||
|
|
|
|||
Loading…
Reference in New Issue