mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-06 17:36:45 +08:00
feat:修改正则
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import router from "@/router";
|
||||
import { reactive, ref, toRefs, watch } from "vue";
|
||||
import axios from 'axios';
|
||||
import { getCookie } from "@/api/utils";
|
||||
import { getCookie, delCookie } from "@/api/utils";
|
||||
import JSONBigInt from 'json-bigint';
|
||||
|
||||
const JSONBigIntStr = JSONBigInt({ storeAsString: true });
|
||||
@@ -99,6 +99,7 @@ export async function request(_url, params) {
|
||||
if (response.code !== 200 && response.code !== 0) {
|
||||
console.log('window.location.', window, router)
|
||||
if (response.code === 1000) {
|
||||
delCookie()
|
||||
(import.meta.env.MODE === 'development' || import.meta.env.MODE === 'test') ? router.push({ path: '/login', query: { returnUrl: router.currentRoute.value.fullPath } }) : window.open(window.location.protocol + import.meta.env.VITE_BASE_LOGIN_URL + window.location.protocol + import.meta.env.VITE_BOE_BASE_URL + import.meta.env.VITE_BASE + router.currentRoute.value.fullPath, '_top')
|
||||
}
|
||||
if (response.code === 2001) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: lixg lixg@dongwu-inc.com
|
||||
* @Date: 2023-01-17 19:47:07
|
||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||
* @LastEditTime: 2023-03-04 13:22:53
|
||||
* @LastEditTime: 2023-03-07 20:25:25
|
||||
* @FilePath: /stu_h5/src/api/utils.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
@@ -23,7 +23,9 @@ export function setCookie(name, value, perpetual) {
|
||||
export function getCookie(name) {
|
||||
return document.cookie?.split(";").find(e => e.includes(name))?.replace(`${name}=`, '') || ''
|
||||
}
|
||||
|
||||
export function delCookie() {
|
||||
setCookie("token", "", -1)
|
||||
}
|
||||
export function useUserInfo(id) {
|
||||
const userInfo = ref({})
|
||||
watch(id, () => {
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
<div class="alltalkcontainer">
|
||||
<div class="inne">
|
||||
<div class="takltitle">{{ disDetail?.title }}</div>
|
||||
<div class="taklcon" v-html="disDetail?.content"></div>
|
||||
<div
|
||||
class="taklcon discussdetail_img_class"
|
||||
v-html="disDetail?.content"
|
||||
></div>
|
||||
<div class="tt clearfix">
|
||||
<div class="ttin">
|
||||
{{ discussInfo ? discussInfo : "-" }}
|
||||
@@ -625,18 +628,18 @@ function send() {
|
||||
}
|
||||
}
|
||||
|
||||
watch(disDetail, () => {
|
||||
console.log(" disDetail.value.content", disDetail.value.content);
|
||||
if (disDetail.value.content) {
|
||||
let obj = disDetail.value.content;
|
||||
let regex = new RegExp("<img", "gi");
|
||||
let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
obj = obj.replace(deleteStyle, "");
|
||||
obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
disDetail.value.content = obj;
|
||||
console.log("disDetail.value.content", disDetail.value.content);
|
||||
}
|
||||
});
|
||||
// watch(disDetail, () => {
|
||||
// console.log(" disDetail.value.content", disDetail.value.content);
|
||||
// if (disDetail.value.content) {
|
||||
// let obj = disDetail.value.content;
|
||||
// let regex = new RegExp("<img", "gi");
|
||||
// let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
// obj = obj.replace(deleteStyle, "");
|
||||
// obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
// disDetail.value.content = obj;
|
||||
// console.log("disDetail.value.content", disDetail.value.content);
|
||||
// }
|
||||
// });
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
@@ -649,6 +652,9 @@ watch(disDetail, () => {
|
||||
}
|
||||
.discussdetail {
|
||||
width: 100%;
|
||||
.discussdetail_img_class img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.tithead {
|
||||
margin-top: 10px;
|
||||
height: 77px;
|
||||
@@ -759,6 +765,7 @@ watch(disDetail, () => {
|
||||
font-size: 13px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.tt {
|
||||
margin-top: 20px;
|
||||
background-color: #f0f3f6;
|
||||
|
||||
@@ -53,7 +53,10 @@
|
||||
<div class="coni" @click="goDetails(item)">
|
||||
<div class="conin">
|
||||
<div class="tit">{{ item.title }}</div>
|
||||
<div class="inn" v-html="item.content"></div>
|
||||
<div
|
||||
class="inn discusspage_img_class"
|
||||
v-html="item.content"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="thinline"></div>
|
||||
@@ -274,18 +277,18 @@ function handleCurrentChange(e, k) {
|
||||
getPostList(state.info.discussDtoList[0].id);
|
||||
}
|
||||
|
||||
watch(state.postList, () => {
|
||||
console.log("state.postList", state.postList);
|
||||
// if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
// let obj = data.value.offcourseDto.outline;
|
||||
// let regex = new RegExp("<img", "gi");
|
||||
// let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
// obj = obj.replace(deleteStyle, "");
|
||||
// obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
// data.value.offcourseDto.outline = obj;
|
||||
// console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
// }
|
||||
});
|
||||
// watch(state.postList, () => {
|
||||
// console.log("state.postList", state.postList);
|
||||
// // if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
// // let obj = data.value.offcourseDto.outline;
|
||||
// // let regex = new RegExp("<img", "gi");
|
||||
// // let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
// // obj = obj.replace(deleteStyle, "");
|
||||
// // obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
// // data.value.offcourseDto.outline = obj;
|
||||
// // console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
// // }
|
||||
// });
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
@@ -298,6 +301,9 @@ watch(state.postList, () => {
|
||||
}
|
||||
.discusspage {
|
||||
width: 100%;
|
||||
.discusspage_img_class img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.head {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
|
||||
@@ -73,9 +73,8 @@
|
||||
<div class="work">
|
||||
<div style="display: flex; align-items: center">
|
||||
<div
|
||||
id="faceteachnocommon_img_id"
|
||||
style="padding: 5px"
|
||||
class="content"
|
||||
class="content faceteachnocommon_img_class"
|
||||
v-html="data.offcourseDto?.outline"
|
||||
></div>
|
||||
</div>
|
||||
@@ -232,18 +231,18 @@ function formateArr(strs) {
|
||||
return arrs;
|
||||
}
|
||||
|
||||
watch(data, () => {
|
||||
console.log("data.offcourseDto", data.value.offcourseDto);
|
||||
if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
let obj = data.value.offcourseDto.outline;
|
||||
let regex = new RegExp("<img", "gi");
|
||||
let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
obj = obj.replace(deleteStyle, "");
|
||||
obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
data.value.offcourseDto.outline = obj;
|
||||
console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
}
|
||||
});
|
||||
// watch(data, () => {
|
||||
// console.log("data.offcourseDto", data.value.offcourseDto);
|
||||
// if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
// let obj = data.value.offcourseDto.outline;
|
||||
// let regex = new RegExp("<img", "gi");
|
||||
// let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
// obj = obj.replace(deleteStyle, "");
|
||||
// obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
// data.value.offcourseDto.outline = obj;
|
||||
// console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
// }
|
||||
// });
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
@@ -251,6 +250,9 @@ watch(data, () => {
|
||||
.faceteachnocommon {
|
||||
width: 100%;
|
||||
padding-bottom: 20px;
|
||||
.faceteachnocommon_img_class img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.main {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<div style="display: flex; align-items: center">
|
||||
<div
|
||||
style="padding: 5px"
|
||||
class="content"
|
||||
class="content faceteachnocourse_img_class"
|
||||
v-html="data.offcourseDto?.outline"
|
||||
></div>
|
||||
</div>
|
||||
@@ -226,18 +226,18 @@ function formateArr(strs) {
|
||||
console.log("112233", arrs);
|
||||
return arrs;
|
||||
}
|
||||
watch(data, () => {
|
||||
console.log("data.offcourseDto", data.value.offcourseDto);
|
||||
if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
let obj = data.value.offcourseDto.outline;
|
||||
let regex = new RegExp("<img", "gi");
|
||||
let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
obj = obj.replace(deleteStyle, "");
|
||||
obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
data.value.offcourseDto.outline = obj;
|
||||
console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
}
|
||||
});
|
||||
// watch(data, () => {
|
||||
// console.log("data.offcourseDto", data.value.offcourseDto);
|
||||
// if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
// let obj = data.value.offcourseDto.outline;
|
||||
// let regex = new RegExp("<img", "gi");
|
||||
// let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
// obj = obj.replace(deleteStyle, "");
|
||||
// obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
// data.value.offcourseDto.outline = obj;
|
||||
// console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
// }
|
||||
// });
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
@@ -245,6 +245,9 @@ watch(data, () => {
|
||||
.faceteachnocourse {
|
||||
width: 100%;
|
||||
padding-bottom: 20px;
|
||||
.faceteachnocourse_img_class img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.main {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
@@ -46,8 +46,13 @@
|
||||
v-if="data?.hasTask || data.planDto?.applyFlag"
|
||||
@click="onLineSignUp"
|
||||
:style="{
|
||||
background: data.isSignUp ? '#999' : 'rgb(57, 146, 249)',
|
||||
background: isAllowSign
|
||||
? data.isSignUp || data.isRefused
|
||||
? '#999'
|
||||
: 'rgb(57, 146, 249)'
|
||||
: '#999',
|
||||
}"
|
||||
,
|
||||
>{{
|
||||
data.isRefused
|
||||
? "审核拒绝"
|
||||
@@ -104,7 +109,7 @@
|
||||
<div
|
||||
id="face_img_id"
|
||||
style="padding: 10px"
|
||||
class="content"
|
||||
class="content faceteachsignup_img_class"
|
||||
v-html="data.offcourseDto?.outline"
|
||||
></div>
|
||||
</div>
|
||||
@@ -219,7 +224,6 @@ const closeLoading = () => {
|
||||
const { data } = useRequest(STU_OFFCOURSE_DETAIL, { courseId }, () => {
|
||||
closeLoading();
|
||||
});
|
||||
|
||||
const teacherInfo = useUserInfo(computed(() => data.value?.planDto?.teacherId));
|
||||
|
||||
const state = reactive({
|
||||
@@ -242,10 +246,28 @@ const download = (url) => {
|
||||
);
|
||||
};
|
||||
|
||||
let timer = null;
|
||||
//判断能否报名 (TODO-大于面授课截止时间就不能报名了,其余均可以)
|
||||
function isSignClick() {
|
||||
let endTime = new Date(data.value.planDto?.endTime).getTime();
|
||||
let nowTime = new Date().getTime();
|
||||
if (nowTime < endTime) {
|
||||
state.isAllowSign = true;
|
||||
} else {
|
||||
state.isAllowSign = false;
|
||||
}
|
||||
console.log(state.isAllowSign);
|
||||
}
|
||||
|
||||
watch(data, () => {
|
||||
isSignClick();
|
||||
});
|
||||
// 报名
|
||||
function onLineSignUp() {
|
||||
if (!state.isAllowSign) {
|
||||
// console.log("data.signFlag", data.value.signFlag, isAllowSign);
|
||||
ElMessage.warning("未在允许报名时间范围内");
|
||||
return;
|
||||
}
|
||||
if (data.value.isSignUp && data.value.isSignUp) {
|
||||
return;
|
||||
}
|
||||
@@ -259,18 +281,18 @@ function formateArr(strs) {
|
||||
console.log("112233", arrs);
|
||||
return arrs;
|
||||
}
|
||||
watch(data, () => {
|
||||
console.log("data.offcourseDto", data.value.offcourseDto);
|
||||
if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
let obj = data.value.offcourseDto.outline;
|
||||
let regex = new RegExp("<img", "gi");
|
||||
let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
obj = obj.replace(deleteStyle, "");
|
||||
obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
data.value.offcourseDto.outline = obj;
|
||||
console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
}
|
||||
});
|
||||
// watch(data, () => {
|
||||
// console.log("data.offcourseDto", data, data.value.offcourseDto);
|
||||
// if (data.value.offcourseDto && data.value.offcourseDto.outline) {
|
||||
// let obj = data.value.offcourseDto.outline;
|
||||
// let regex = new RegExp("<img", "gi");
|
||||
// let deleteStyle = /(?<=\" )style=\".*?\"/gi;
|
||||
// obj = obj.replace(deleteStyle, "");
|
||||
// obj = obj.replace(regex, '<img style="max-width: 100%;height:auto"');
|
||||
// data.value.offcourseDto.outline = obj;
|
||||
// console.log("data.offcourseDto.outline", data.value.offcourseDto.outline);
|
||||
// }
|
||||
// });
|
||||
// onMounted(() => {
|
||||
// console.log("data.offcourseDto?.outline", data.value);
|
||||
// // console.log("document", document.getElementById("face_img_id"));
|
||||
@@ -318,6 +340,9 @@ function getImgInfo(url, i, imgs) {
|
||||
.faceteachsignup {
|
||||
width: 100%;
|
||||
padding-bottom: 20px;
|
||||
.faceteachsignup_img_class img {
|
||||
max-width: 100%;
|
||||
}
|
||||
.main {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
@@ -144,6 +144,8 @@ const state = reactive({
|
||||
const { hour, minute, seconds } = toRefs(state);
|
||||
|
||||
let timer = setInterval(() => {
|
||||
console.log("endTime", data.value.submitEndTime);
|
||||
if (data && data.value.submitEndTime) {
|
||||
let endTime = parseInt(new Date(data.value.submitEndTime).getTime() / 1000);
|
||||
let nowTime = parseInt(new Date().getTime() / 1000);
|
||||
if (endTime > nowTime) {
|
||||
@@ -160,6 +162,7 @@ let timer = setInterval(() => {
|
||||
} else {
|
||||
clearInterval(timer);
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer);
|
||||
|
||||
Reference in New Issue
Block a user