代码拉取完成,页面将自动刷新
同步操作将从 畅阳网络/畅阳教培 在线教育 在线视频教育+在线试题+在线题库+在线考试源码Java+SpringBoot+MySql+vue+uni-app 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<template>
<view class="tabbar-bg">
<view class="item" v-if="courseState == true" @click="goPage(1)" style="padding-right: 30rpx;">
<!-- <view class="img icon1" :class="{'item__img_active ':index == 1}"> </view> -->
<img src="../static/tabBarIcon/home.png" alt="" v-show="index != 1">
<img src="../static/tabBarIcon/home-h.png" alt="" v-show="index == 1">
<view class="text" :class="{'active-text' : index == 1}">
课程
</view>
</view>
<view class="item" v-if="courseState == true" @click="goPage(2)" style="padding:0 30rpx;">
<!-- <view class="img icon2" :class="{'item__img_active ':index == 2}"> </view>] -->
<img src="../static/tabBarIcon/learn.png" alt="" v-show="index != 2">
<img src="../static/tabBarIcon/learn-h.png" alt="" v-show="index == 2">
<view class="text" :class="{'active-text' : index == 2}">
学习
</view>
</view>
<view class="item" v-if="questionState == true" @click="goPage(3)" style="padding:0 30rpx;">
<!-- <view class="img icon3" :class="{'item__img_active ':index == 3}"> </view> -->
<img src="../static/tabBarIcon/tiku1.png" alt="" v-show="index != 3">
<img src="../static/tabBarIcon/tiku2.png" alt="" v-show="index == 3">
<view class="text" :class="{'active-text' : index == 3}">
题库
</view>
</view>
<view class="item" @click="goPage(4)" style="padding-left: 30rpx;">
<!-- <view class="img icon4" :class="{'item__img_active ':index == 4}"> </view> -->
<img src="../static/tabBarIcon/mine.png" alt="" v-show="index != 4">
<img src="../static/tabBarIcon/mine-h.png" alt="" v-show="index == 4">
<view class="text" :class="{'active-text' : index == 4}">
我的
</view>
</view>
</view>
</template>
<script>
import {
findDistributionl
} from '@/api/homeAudition.js'
export default {
props: {
index: {
type: Number,
default: 0
}
},
data() {
return {
questionState: uni.getStorageSync('questionState'), // 小程序题库权限
courseState: uni.getStorageSync('courseState'), // 小程序课程权限
}
},
created() {
let data = {}
//#ifdef H5
data.appId = this.$appid;
data.clientType = 'OA';
//#endif
//#ifdef MP-WEIXIN
data.appId = uni.getAccountInfoSync().miniProgram.appId;
data.clientType = 'MP';
// #endif
findDistributionl(data).then((res) => {
console.log('获取权限和开课模式', res)
if (res.code == 200) {
// 小程序课程价格是否显示,false不显示价格
if (res.result.isDisplayPrice === true || res.result.isDisplayPrice === false) {
console.log(res.result.isDisplayPrice, '存储是否显示价格')
uni.setStorageSync('isDisplayPrice', res.result.isDisplayPrice)
this.isDisplayPrice = res.result.isDisplayPrice
}
// 小程序是否能继续使用,0不能使用
if (res.result.validityFlg === 0 || res.result.validityFlg === 1) {
console.log(res.result.validityFlg, '存储小程序是否能使用,0不能,1能')
uni.setStorageSync('validityFlg', res.result.validityFlg)
this.validityFlg = res.result.validityFlg
}
// uni.setStorageSync('isDisplayPrice', true);
// uni.setStorageSync('validityFlg', 0);
// 开课模式
if (res.result.courseControl) {
console.log(res.result.courseControl, '存储开课方式')
uni.setStorageSync('courseControl', res.result.courseControl)
}
// 机构权限
if (res.result.authority) {
if (res.result.authority.indexOf('question') != -1) {
this.questionState = true
uni.setStorageSync('questionState', true)
}
if (res.result.authority.indexOf('course') != -1) {
this.courseState = true
uni.setStorageSync('courseState', true)
}
}
}
})
},
methods: {
goPage(num) {
if (num == this.index) {
console.log('重复点击')
return
} else {
if (num == 1) {
// uni.redirectTo({
// url: '/pages/index/home'
// })
// uni.setStorageSync('tabbarIndex', 1) // 小程序题库权限
this.$emit('changeTabbarIndex', 1)
} else if (num == 2) {
// uni.redirectTo({
// url: '/pages/learn/index'
// })
// uni.setStorageSync('tabbarIndex', 2) // 小程序题库权限
this.$emit('changeTabbarIndex', 2)
} else if (num == 3) {
// uni.redirectTo({
// url: '/pages/indexs/index'
// })
// uni.setStorageSync('tabbarIndex', 3) // 小程序题库权限
this.$emit('changeTabbarIndex', 3)
} else if (num == 4) {
// uni.redirectTo({
// url: '/pages/mine/index'
// })
// uni.setStorageSync('tabbarIndex', 4) // 小程序题库权限
this.$emit('changeTabbarIndex', 4)
}
}
}
}
}
</script>
<style scoped lang="scss">
.tabbar-bg {
background: #fff;
position: fixed;
z-index: 50;
left: 0;
bottom: 0;
box-sizing: border-box;
width: 100%;
// padding: 13rpx 65rpx 30rpx 65rpx;
padding: 13rpx 0 50rpx 0;
display: flex;
justify-content: space-around;
// justify-content: space-between;
box-shadow: 0rpx 0rpx 7rpx 0rpx rgba(0, 0, 0, 0.2);
.item {
display: flex;
flex-direction: column;
justify-content: space-between;
// height: 70rpx;
.icon1 {
background-image: url('../static/tabBarIcon/home-q.png');
}
.icon2 {
background-image: url('../static/tabBarIcon/learn-q.png');
}
.icon3 {
background-image: url('../static/tabBarIcon/tiku-q.png');
}
.icon4 {
background-image: url('../static/tabBarIcon/mine-q.png');
}
.img {
width: 46rpx;
height: 43rpx;
background-repeat: no-repeat;
background-size: 200% 100%;
}
img {
width: 46rpx;
height: 43rpx;
}
.text {
margin-top: 9rpx;
text-align: center;
font-size: 20rpx;
font-family: PingFang SC;
font-weight: bold;
color: #666666;
}
.active-text {
color: #F1592A;
}
.item__img_active {
background-position: -40rpx !important;
}
}
}
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。