Files
ks-app-employment-service/packageB/notice/index.vue

228 lines
5.5 KiB
Vue
Raw Normal View History

2026-01-16 09:38:44 +08:00
<template>
2026-01-16 16:50:06 +08:00
<AppLayout :title="title" :show-bg-image="false">
<view class="tab-container">
<view class="tab-item" :class="{ active: currentTab === 'train' }" @click="switchTab('train')">
培训公告
2026-01-16 09:38:44 +08:00
</view>
2026-01-16 16:50:06 +08:00
<view class="tab-item" :class="{ active: currentTab === 'evaluate' }" @click="switchTab('evaluate')">
评价公告
</view>
</view>
<scroll-view scroll-y class="main-scroll" @scrolltolower="handleScrollToLower">
<view class="main-list" >
<view
:style="getBackgroundStyle('frame-activity.png')"
class="policy-list"
v-for="(item, index) in policyList"
:key="index"
@click="goPolicyDetail(item)" >
<view class="title">
{{ item.title }}
2026-01-16 09:38:44 +08:00
</view>
2026-01-16 16:50:06 +08:00
<view class="bottom-line">
<view>
<uni-icons color="#A2A2A2" type="info" size="12"></uni-icons>
发布日期{{ item.publishTime }}
2026-01-16 09:38:44 +08:00
</view>
</view>
2026-01-16 16:50:06 +08:00
<view >
<view class="gk-l-i-bottom" v-html="item.content"></view>
</view>
2026-02-24 10:13:06 +08:00
2026-01-16 16:50:06 +08:00
</view>
2026-01-16 09:38:44 +08:00
</view>
2026-01-16 16:50:06 +08:00
</scroll-view>
2026-02-24 10:13:06 +08:00
2026-01-16 16:50:06 +08:00
</AppLayout>
2026-01-16 09:38:44 +08:00
</template>
<script setup>
2026-01-16 16:50:06 +08:00
import { inject, ref, reactive, onMounted } from "vue";
const { $api, navTo, navBack, vacanciesTo } = inject("globalFunction");
import config from "@/config.js";
import AppLayout from "@/components/AppLayout/AppLayout.vue";
2026-02-24 10:13:06 +08:00
import CryptoJS from 'crypto-js'
2026-01-16 16:50:06 +08:00
const title = ref("");
const baseUrl = config.imgBaseUrl;
const pageSize=ref(10)
const pageNum=ref(1)
const totalNum=ref(0)
// Tab 控制
const currentTab = ref("train"); // 默认显示培训公告
2026-02-24 10:13:06 +08:00
async function loginA(){
const form={
usertype: "2",
enterprisecode: '91310101MA1FPX1234',
enterprisename: 'tt',
contactperson: "",
contactphone: "",
idno: "",
name: ""
}
//用户信息加密方法待更新
// const key = '9zS+DFKrzxvosO82mTcPJQ=='
// const secretKey = CryptoJS.enc.Utf8.parse(key);//key 为你的秘钥
// const srcs = CryptoJS.enc.Utf8.parse(form.idno);
// // AES 加密
// const encrypted = CryptoJS.AES.encrypt(srcs, secretKey, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7}).toString()
// console.log('AES Encrypted:111', encrypted)
// form.idno=encrypted
var resLogin = await $api.myRequest('/auth/login2/ks',form,'post',10100);
console.log("resLogin",resLogin)
}
2026-01-16 16:50:06 +08:00
function switchTab(tabName) {
currentTab.value = tabName;
getPolicyData('refresh',currentTab)
2026-01-16 09:38:44 +08:00
}
2026-01-16 16:50:06 +08:00
const handleScrollToLower = () => {
getPolicyData('add',currentTab);
};
2026-01-16 09:38:44 +08:00
const getBackgroundStyle = (imageName) => ({
2026-01-16 16:50:06 +08:00
backgroundImage: `url(${baseUrl}/${imageName})`,
backgroundSize: "100% 100%", // 覆盖整个容器
backgroundPosition: "center", // 居中
backgroundRepeat: "no-repeat",
2026-01-16 09:38:44 +08:00
});
2026-01-16 16:50:06 +08:00
onMounted(() => {
getPolicyData('refresh',currentTab);
2026-02-24 10:13:06 +08:00
loginA()
2026-01-16 16:50:06 +08:00
});
const policyList = ref([]);
function getPolicyData(type = 'add',currentTab='train') {
let current=ref('1')
if(currentTab.value=='train'){
current.value='1'
}else if(currentTab.value=='evaluate'){
current.value='2'
2026-01-16 09:38:44 +08:00
}
2026-01-16 16:50:06 +08:00
let maxPage=Math.ceil(totalNum.value/pageSize.value)
let params={}
if (type === 'refresh') {
pageNum.value = 1;
params={
pageSize:pageSize.value,
pageNum:pageNum.value,
type:current.value,
shenhe: '1',
2026-01-16 16:50:06 +08:00
}
$api.myRequest('/train/public/announcement/list', params).then((resData) => {
if(resData.code==200){
for(var i = 0;i<resData.rows.length;i++){
resData.rows[i].content = resData.rows[i].content.replace(/<[^>]+>/g,"");
}
policyList.value=resData.rows
totalNum.value=resData.total
2026-01-16 09:38:44 +08:00
}
2026-02-24 10:13:06 +08:00
2026-01-16 16:50:06 +08:00
});
}
if (type === 'add' && pageNum.value < maxPage) {
pageNum.value += 1;
params={
pageSize:pageSize.value,
pageNum:pageNum.value,
type:current.value,
shenhe: '1',
2026-01-16 09:38:44 +08:00
}
2026-01-16 16:50:06 +08:00
$api.myRequest('/train/public/announcement/list', params).then((resData) => {
if(resData.code==200){
for(var i = 0;i<resData.rows.length;i++){
resData.rows[i].content = resData.rows[i].content.replace(/<[^>]+>/g,"");
2026-01-16 09:38:44 +08:00
}
2026-01-16 16:50:06 +08:00
policyList.value=policyList.value.concat(resData.rows)
totalNum.value=resData.total
2026-01-16 09:38:44 +08:00
}
});
2026-01-16 16:50:06 +08:00
}
2026-01-16 09:38:44 +08:00
}
2026-01-16 16:50:06 +08:00
function goPolicyDetail(item) {
uni.navigateTo({
url:`/packageB/notice/detail?id=${item.id}`
// url: `/packageRc/pages/policy/policyDetail?id=${item.id}`
});
}
2026-01-16 09:38:44 +08:00
</script>
2026-01-16 16:50:06 +08:00
<style lang="scss" scoped>
.main-list {
// background-color: #ffffff;
// padding: 20rpx 25rpx 28rpx 25rpx;
margin: 0 30rpx 30rpx 30rpx;
// box-shadow: 0px 3px 20px 0px rgba(0, 105, 234, 0.1);
// border-radius: 12px;
}
.tab-container {
2026-01-16 09:38:44 +08:00
display: flex;
2026-01-16 16:50:06 +08:00
height: 80rpx;
background-color: #fff;
margin: 0 30rpx 20rpx;
border-radius: 12rpx;
overflow: hidden;
margin-top: 10rpx;
2026-01-16 09:38:44 +08:00
}
2026-01-16 16:50:06 +08:00
.tab-item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
color: #666;
transition: all 0.3s;
2026-01-16 09:38:44 +08:00
}
2026-01-16 16:50:06 +08:00
.tab-item.active {
background-color: #ffffff;
color: #4c6efb;
font-weight: bold;
// box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.05);
border-bottom: 2rpx solid #4c6efb;
}
.gk-l-i-bottom{
margin-top: 16px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.main-scroll {
width: 100%;
height: 90%;
2026-01-16 09:38:44 +08:00
}
2026-01-16 16:50:06 +08:00
.policy-list {
width: 100%;
margin: 0 auto;
color: #333333;
border-radius: 24rpx;
background: #ffffff;
margin-bottom: 24rpx;
padding: 28rpx 22rpx;
box-sizing: border-box;
position: relative;
.title {
font-size: 32rpx;
font-weight: bold;
color: #282828;
margin-bottom: 16rpx;
display: flex;
}
.bottom-line {
display: flex;
justify-content: space-between;
font-size: 24rpx;
color: #a2a2a2;
margin-top: 12rpx;
}
2026-01-16 09:38:44 +08:00
}
2026-02-24 10:13:06 +08:00
</style>