- 在 careerfair.vue 中新增 thirdLogin 方法处理单点登录逻辑 - 修改 goDetail 方法,在跳转前执行第三方登录验证 - 在 packageB/train/index.vue 中增加 onLoad 钩子调用 thirdLogin - 修改 jumps 方法,确保页面跳转前完成登录验证 - 在 request.js 中注释掉全局错误提示,避免重复提示 - 优化 videoDetail.vue 中的 getHeart 方法,移除冗余跳转逻辑 - 在 videoList.vue 中新增 playVideo 前的登录校验 - 统一多个页面中的 thirdLogin 实现,确保登录态一致性
188 lines
4.4 KiB
Vue
188 lines
4.4 KiB
Vue
<template>
|
|
<!-- <AppLayout title=""> -->
|
|
<view class="tab-container">
|
|
<image src="/packageB/static/images/train/bj.jpg" mode=""></image>
|
|
<view>
|
|
<!-- <view class="btns" @click="jumps('/packageB/train/video/videoList')">
|
|
<image src="/packageB/static/images/train/spxx-k.png" mode=""></image>
|
|
<view>
|
|
<text>培训视频</text>
|
|
<view class="btn">
|
|
<text>立即查看</text>
|
|
<image src="/packageB/static/images/train/arrow.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
</view> -->
|
|
<view class="btns" @click="jumps('/packageB/train/practice/startPracticing')">
|
|
<image src="/packageB/static/images/train/zxxl-k.png" mode=""></image>
|
|
<view>
|
|
<text>专项练习</text>
|
|
<view class="btn">
|
|
<text>立即查看</text>
|
|
<image src="/packageB/static/images/train/arrow.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
<view class="btns" @click="jumps('/packageB/train/mockExam/examList')">
|
|
<image src="/packageB/static/images/train/mnks-k.png" mode=""></image>
|
|
<view>
|
|
<text>模拟考试</text>
|
|
<view class="btn">
|
|
<text>立即查看</text>
|
|
<image src="/packageB/static/images/train/arrow.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
<!-- <view class="btns" @click="jumps('/packageB/train/wrongAnswer/mistakeNotebook')">
|
|
<image src="/packageB/static/images/train/ctb-k.png" mode=""></image>
|
|
<view>
|
|
<text>错题本 </text>
|
|
<view class="btn" style="margin-left: 13%;">
|
|
<text>立即查看</text>
|
|
<image src="/packageB/static/images/train/arrow.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
<!-- </AppLayout> -->
|
|
</template>
|
|
|
|
<script setup>
|
|
import { reactive, inject, watch, ref, onMounted } from 'vue';
|
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
|
const { $api, navTo, vacanciesTo, formatTotal, config } = inject('globalFunction');
|
|
import useUserStore from '@/stores/useUserStore';
|
|
import useDictStore from '@/stores/useDictStore';
|
|
|
|
onLoad(() => {
|
|
thirdLogin()
|
|
});
|
|
|
|
async function jumps(url){
|
|
if(await thirdLogin()){
|
|
navTo(url);
|
|
}
|
|
}
|
|
|
|
|
|
async function thirdLogin(){
|
|
let form={}
|
|
if (uni.getStorageSync('userInfo').isCompanyUser=='1') {
|
|
form={
|
|
usertype: '1',
|
|
idno: uni.getStorageSync('userInfo').idCard,
|
|
name: uni.getStorageSync('userInfo').name,
|
|
enterprisecode:"",
|
|
enterprisename: "",
|
|
contactperson: "",
|
|
contactphone: "",
|
|
}
|
|
}else if (uni.getStorageSync('userInfo').isCompanyUser=='0') {
|
|
form={
|
|
usertype: "2",
|
|
enterprisecode: uni.getStorageSync('userInfo').idCard,
|
|
enterprisename: uni.getStorageSync('userInfo').name,
|
|
contactperson: "",
|
|
contactphone: "",
|
|
idno: "",
|
|
name: ""
|
|
}
|
|
}else{
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请先登录'
|
|
})
|
|
return false;
|
|
}
|
|
var resLogin = await $api.myRequest('/auth/login2/ks',form,'post',10100);
|
|
if (resLogin.code=='200') {
|
|
uni.setStorageSync('Padmin-Token', resLogin.data.access_token)
|
|
return true;
|
|
}else{
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '单点异常'
|
|
})
|
|
return false;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="stylus" scoped>
|
|
.tab-container{
|
|
height: 100vh;
|
|
width: 100%;
|
|
position: relative;
|
|
// background: url('@/static/images/train/bj.jpg') center center no-repeat;
|
|
// background-size: 100% 100%;
|
|
image{
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
view{
|
|
padding: 100rpx 28rpx 0;
|
|
.btns{
|
|
width: 100%
|
|
height: 170rpx;
|
|
border-radius: 5rpx
|
|
padding: 20rpx;
|
|
box-sizing: border-box
|
|
color: #000
|
|
text-align: center
|
|
margin-bottom: 50rpx
|
|
position: relative
|
|
image{
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
left: 0;
|
|
top: 0;
|
|
}
|
|
view{
|
|
padding: 0 0 0 10%;
|
|
box-sizing: border-box;
|
|
position: absolute
|
|
width: 100%;
|
|
height: 100%;
|
|
left: 0;
|
|
top: 0;
|
|
z-index: 100;
|
|
display: flex;
|
|
align-items: center
|
|
font-weight: bold;
|
|
font-size: 36rpx;
|
|
color: #595959;
|
|
.btn{
|
|
margin-left: 8%;
|
|
background-color: #3A92FF;
|
|
position: static;
|
|
color: #fff;
|
|
font-size: 22rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center
|
|
width: 140rpx;
|
|
height: 50rpx;
|
|
border-radius: 5rpx
|
|
font-weight: 500;
|
|
padding: 0;
|
|
image{
|
|
position: static;
|
|
width: 14rpx;
|
|
height: 22rpx;
|
|
margin-left: 10rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
</style>
|
|
|