This commit is contained in:
那些花儿
2025-09-03 17:49:59 +08:00
parent 3110ffd35e
commit 78f25f59b1
15 changed files with 604 additions and 17599 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -37,34 +37,6 @@ $.ajaxSetup({
} }
}) })
//初始化pjax
// ;(function initPjax() {
// if ($.support.pjax) {
// $(document).pjax("a[data-pjax]", "#container", {
// maxCacheLength: 0,
// push: false,
// replace: true,
// fragment: "#container",
// timeout: 8000
// })
// $(document).on("pjax:send", function () {
// NProgress.start()
// $(".ele-admin-content-view").hide()
// window.customStyleList = document.querySelectorAll('style[id^="style-"]')
// })
//
// $(document).on("pjax:complete", function () {
// if (window.customStyleList) {
// window.customStyleList.forEach((style) => {
// style.parentNode.removeChild(style)
// })
// }
// NProgress.done()
// $(".ele-admin-content-view").show()
// })
// }
// })()
function pjaxReplace(url, data = {}) { function pjaxReplace(url, data = {}) {
const { pathname, search } = location const { pathname, search } = location
if (url === pathname + search) { if (url === pathname + search) {
@@ -81,35 +53,3 @@ function pjaxReplace(url, data = {}) {
data data
}) })
} }
function removeHTMLTag(str) {
str = str.replace(/<\/?[^>]*>/g, "") //去除HTML tag
str = str.replace(/[ | ]*\n/g, "\n") //去除行尾空白
str = str.replace(/\n[\s| | ]*\r/g, "\n") //去除多余空行
str = str.replace(/&nbsp;/gi, "") //去掉&nbsp;
return str
}
function GetQueryString(name) {
return new URLSearchParams(window.location.search).get(name)
}
function clearAllTimers() {
const maxTimeoutId = setTimeout(function () {}, 0)
for (let i = 0; i <= maxTimeoutId; i++) {
clearTimeout(i)
clearInterval(i)
}
}
function getNestedValue(obj, path) {
return path.split(".").reduce((acc, part) => acc && acc[part], obj)
}
function loc() {
return location.href.replace(location.search, "").replace(location.hash, "")
}
function clone(obj) {
return JSON.parse(JSON.stringify(obj))
}
@@ -1,39 +1,82 @@
const styleUtil = { const styleUtil = {
// 为元素及其所有子元素添加scoped属性 // 为元素及其所有子元素添加scoped属性
addScopedAttribute(el, scopedId) { addScopedAttribute(el, scopedId, vm) {
if (el && el.setAttribute) { if (!el || !el.setAttribute) return;
// 跳过Vue组件实例 但是不跳过自己 也就是排除子组件
if (el.__vue__ && el.__vue__ !== vm) return;
// 添加scoped属性到当前元素
el.setAttribute(scopedId, '') el.setAttribute(scopedId, '')
// 递归处理所有子元素 // 只处理普通DOM元素,不处理Vue组件
const children = el.children || el.childNodes // const children = el.children || el.childNodes;
for (let i = 0; i < children.length; i++) { // for (let i = 0; i < children.length; i++) {
styleUtil.addScopedAttribute(children[i], scopedId) // const child = children[i];
// // 检查是否为普通DOM元素(非Vue组件)
// if (child.nodeType === 1 && !child.__vue__) {
// styleUtil.addScopedAttribute(child, scopedId, vm);
// }
// }
// 使用TreeWalker优化遍历性能
const walker = document.createTreeWalker(
el,
NodeFilter.SHOW_ELEMENT,
{
acceptNode(node) {
// 排除子Vue组件
return node.__vue__ && node !== el
? NodeFilter.FILTER_REJECT
: NodeFilter.FILTER_ACCEPT;
}
}
);
let node;
while (node = walker.nextNode()) {
if (node !== el) {
node.setAttribute(scopedId, '');
} }
} }
}, },
// 移除元素及其所有子元素的scoped属性 // 移除元素及其所有子元素的scoped属性
removeScopedAttribute(el, scopedId) { removeScopedAttribute(el, scopedId) {
if (el && el.removeAttribute) { if (!el || !el.removeAttribute) return;
el.removeAttribute(scopedId)
// 递归处理所有子元素 // 使用querySelectorAll批量处理
const children = el.children || el.childNodes const elements = el.querySelectorAll(`[${scopedId}]`);
for (let i = 0; i < children.length; i++) { elements.forEach(element => element.removeAttribute(scopedId));
styleUtil.removeScopedAttribute(children[i], scopedId)
} // 处理根元素
} el.removeAttribute(scopedId);
// if (el && el.removeAttribute) {
// el.removeAttribute(scopedId)
//
// // 递归处理所有子元素
// const children = el.children || el.childNodes
// for (let i = 0; i < children.length; i++) {
// styleUtil.removeScopedAttribute(children[i], scopedId)
// }
// }
}, },
// 为CSS规则添加作用域属性
scopeCss(css, scopedId) { scopeCss(css, scopedId) {
// 处理CSS规则,为每个选择器添加[scopedId] // 处理CSS规则,为每个选择器添加[scopedId]
const processedCss = css.replace(/([^{]+){/g, (match, selectors) => { const processedCss = css.replace(/([^{]+){/g, (match, selectors) => {
return selectors.split(',') return selectors.split(',')
.map(selector => { .map(selector => {
// 处理深度选择器 >>> 和 /deep/ // 处理深度选择器
if (selector.includes('>>>') || selector.includes('/deep/')) { if (selector.includes('::v-deep')) {
return selector.replace(/(\s*)(>>>|\/deep\/)(\s*)/g, return selector.replace('::v-deep', `[${scopedId}]`);
`$1[${scopedId}] $3`) }
// 处理媒体查询等特殊情况
if (selector.includes('@') || selector.trim().startsWith('@')) {
return selector;
} }
// 普通选择器 // 普通选择器
@@ -43,52 +86,126 @@ const styleUtil = {
}) })
return processedCss return processedCss
},
}
// 异步DOM观察器
const asyncStyleHandler = {
observers: new Map(),
// 为组件设置观察器
setupObserver(vm, scopedId) {
if (!vm.$el) return;
// 清除现有观察器
this.disconnectObserver(vm._uid);
// 创建新的MutationObserver
const observer = new MutationObserver((mutations) => {
let shouldProcess = false;
for (const mutation of mutations) {
if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
shouldProcess = true;
break;
} }
} }
if (shouldProcess) {
// 防抖处理
clearTimeout(vm._styleDebounce);
vm._styleDebounce = setTimeout(() => {
styleUtil.addScopedAttribute(vm.$el, scopedId, vm);
}, 0);
}
});
// 开始观察
observer.observe(vm.$el, {
childList: true,
subtree: true
});
// 存储观察器引用
this.observers.set(vm._uid, observer);
},
// 断开观察器
disconnectObserver(uid) {
if (this.observers.has(uid)) {
this.observers.get(uid).disconnect();
this.observers.delete(uid);
}
}
};
Vue.mixin({ Vue.mixin({
mounted() { mounted() {
if (this.$options.style) { if (!this.$options.style) return;
const styleId = `style-${this._uid}`
const style = document.createElement("style")
style.id = styleId
// 生成唯一属性 try {
const scopedId = `data-v-${this._uid}` const styleId = `style-${this._uid}`;
const scopedId = `data-v-${this._uid}`;
// this.$el.setAttribute(scopedId, '') // 检查样式是否已存在
if (document.getElementById(styleId)) {
console.warn(`Style with id ${styleId} already exists`);
return;
}
// 为组件内所有元素添加唯一属性 const style = document.createElement("style");
styleUtil.addScopedAttribute(this.$el, scopedId) style.id = styleId;
//支持函数和字符串 // 添加作用域属性
let css = typeof this.$options.style === "function" ? this.$options.style.call(this) : this.$options.style if (this.$el) {
styleUtil.addScopedAttribute(this.$el, scopedId, this);
}
// 为每条规则添加属性选择器 // 处理CSS
css = styleUtil.scopeCss(css, scopedId) let css = typeof this.$options.style === "function"
? this.$options.style.call(this)
: this.$options.style;
style.textContent = css if (!css || typeof css !== 'string') {
document.head.appendChild(style) console.warn('Invalid style content');
return;
}
// 保存scopedId以便销毁时使用 css = styleUtil.scopeCss(css, scopedId);
this._scopedId = scopedId style.textContent = css;
document.head.appendChild(style);
this._scopedId = scopedId;
this._styleId = styleId;
// 设置异步DOM观察器
asyncStyleHandler.setupObserver(this, scopedId);
} catch (error) {
console.error('Error applying scoped styles:', error);
} }
}, },
beforeDestroy() { beforeDestroy() {
try {
// 清理作用域属性
if (this._scopedId && this.$el) { if (this._scopedId && this.$el) {
// 移除所有元素的scoped属性 styleUtil.removeScopedAttribute(this.$el, this._scopedId);
styleUtil.removeScopedAttribute(this.$el, this._scopedId)
} }
if (this.$options.style) { // 移除样式标签
const styleId = `style-${this._uid}` if (this._styleId) {
const style = document.getElementById(styleId) const style = document.getElementById(this._styleId);
if (style) { if (style && style.parentNode) {
document.head.removeChild(style) style.parentNode.removeChild(style);
} }
} }
// 断开观察器
asyncStyleHandler.disconnectObserver(this._uid);
} catch (error) {
console.error('Error cleaning up scoped styles:', error);
}
} }
}) })
@@ -228,3 +228,57 @@ const commonUtil = {
} }
} }
} }
function removeHTMLTag(str) {
str = str.replace(/<\/?[^>]*>/g, "") //去除HTML tag
str = str.replace(/[ | ]*\n/g, "\n") //去除行尾空白
str = str.replace(/\n[\s| | ]*\r/g, "\n") //去除多余空行
str = str.replace(/&nbsp;/gi, "") //去掉&nbsp;
return str
}
function GetQueryString(name) {
return new URLSearchParams(window.location.search).get(name)
}
function clearAllTimers() {
const maxTimeoutId = setTimeout(function () {}, 0)
for (let i = 0; i <= maxTimeoutId; i++) {
clearTimeout(i)
clearInterval(i)
}
}
function getNestedValue(obj, path) {
return path.split(".").reduce((acc, part) => acc && acc[part], obj)
}
function loc() {
return location.href.replace(location.search, "").replace(location.hash, "")
}
function clone(obj) {
return JSON.parse(JSON.stringify(obj))
}
function base64ToFile(base64Data, filename) {
// 将base64的数据部分提取出来
const parts = base64Data.split(";base64,")
const contentType = parts[0].split(":")[1]
const raw = window.atob(parts[1])
const rawLength = raw.length
const uInt8Array = new Uint8Array(rawLength)
for (let i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i)
}
// 使用Blob对象创建File对象
const blob = new Blob([uInt8Array], { type: contentType })
blob.lastModifiedDate = new Date()
blob.name = filename
return new File([blob], filename, { type: contentType })
}
@@ -1,12 +0,0 @@
;(function () {
const api = {
listType() {
return $.get("/platform/condolence/common/listType")
},
listOpenType() {
return $.get("/platform/condolence/common/listType")
}
}
window.condolenceCommonApi = api
})()
@@ -1,24 +0,0 @@
;(function () {
const teacherCongressApi = {
//全部教代会
listSession() {
return $.get("/platform/teacherCongress/common/listSession")
},
//开启的教代会
listOpenSession() {
return $.get("/platform/teacherCongress/common/listOpenSession")
},
//查询代表团根据教代会
listDelegation(sessionId) {
return $.get("/platform/teacherCongress/common/listDelegation", { sessionId })
},
//查询所有的代表类型(三种)
listDelegateRole() {
return $.get("/platform/teacherCongress/common/listDelegateRole")
}
}
window.teacherCongressApi = teacherCongressApi
})()
@@ -1,24 +0,0 @@
(function () {
const workersCongressApi = {
//全部工代会
listSession() {
return $.get("/platform/teacherCongress/common/listSession")
},
//开启的工代会
listOpenSession() {
return $.get("/platform/teacherCongress/common/listOpenSession")
},
//查询代表团根据工代会
listDelegation(sessionId) {
return $.get("/platform/teacherCongress/common/listDelegation", { sessionId })
},
//查询所有的代表类型(三种)
listDelegateRole() {
return $.get("/platform/teacherCongress/common/listDelegateRole")
}
}
window.workersCongressApi = workersCongressApi
})()
@@ -1,101 +0,0 @@
const initTableMixins = {
data() {
return {
pageDataUrl: "",
submitLoading: false,
searchMore: false,
tableSize: "",
tableKey: "",
formData: {},
formRules: {},
formLoading: false,
tableLoading: false,
tableData: [],
tableColumns: [],
pageForm: {
searchName: "",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: ""
},
guavaIndex: "index",
unionGroups: [],
threeUnits: []
}
},
methods: {
dropdownCommand({ action, value }) {
if (action) action(value)
},
columnChange(val) {
this.tableLoading = true
this.tableColumns = val
this.tableLoading = false
},
tableSizeChange(size) {
this.tableSize = size
},
indexMethod(index) {
return index + (this.pageForm.pageNumber - 1) * this.pageForm.pageSize + 1
},
doSearch() {
this.tableKey = new Date().getTime()
this.pageForm.pageNumber = 1
this.pageData()
},
pageOrder(column) {
this.pageForm.pageOrderName = column.prop
this.pageForm.pageOrderBy = column.order
this.pageData()
},
pageNumberChange(val) {
this.pageForm.pageNumber = val
this.pageData()
},
pageSizeChange(val) {
this.pageForm.pageSize = val
this.pageData()
},
pageData(url = null, data = null) {
const address = url ? url : loc() + "/pageData"
this.tableLoading = true
$.post(
address,
data ? data : this.pageForm,
(data) => {
this.tableLoading = false
if (data.code === 0) {
this.tableData = data.data.list
this.pageForm.totalCount = data.data.totalCount
} else {
this.$message.error(data.msg)
}
},
"json"
)
},
notifySuccess(msg) {
this.$notify({
title: "成功",
message: msg,
type: "success"
})
},
notifyWarning(msg) {
this.$notify({
title: "警告",
message: msg,
type: "warning"
})
},
notifyError(msg) {
this.$notify.error({
title: "错误",
message: msg
})
}
}
}
@@ -1,530 +0,0 @@
/*选择商品品类*/
.content-goods-publish {
padding: 15px;
margin: 0 auto;
text-align: center;
border-radius: 0.8em;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
background: none repeat 0 0 #fff;
/*商品品类*/
.goods-category {
min-height: 500px;
border-radius: 0.8em;
text-align: left;
padding: 10px;
background: #ededed;
ul {
padding: 12px 8px;
list-style: none;
width: 300px;
background: none repeat 0 0 #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
border-radius: 0.4em;
display: inline-block;
letter-spacing: normal;
margin-right: 15px;
vertical-align: top;
word-spacing: normal;
li {
line-height: 20px;
padding: 10px 5px;
cursor: pointer;
color: #333;
font-size: 12px;
display: flex;
flex-wrap: nowrap;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
}
}
/** 当前品类被选中的样式 */
.activeClass {
border-radius: 0.4em;
background-color: color-mix(in srgb, var(--color-primary) 20%, transparent);
border: 1px solid color-mix(in srgb, var(--color-primary) 80%, transparent);
/*background-color: rgba(33, 112, 80, 0.2);*/
/*border: 1px solid rgba(33, 112, 80, 0.8);*/
color: #fff;
}
/*!*当前选择的商品品类文字*!*/
.current-goods-category {
text-align: left;
padding: 10px;
width: 100%;
border: 1px solid #fbeed5;
color: #c09853;
background-color: #fcf8e3;
margin: 10px auto;
padding: 8px 35px 8px 14px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
font-size: 12px;
font-weight: bold;
}
}
/*编辑基本信息*/
.el-form {
padding-bottom: 80px;
.el-form-item {
width: 100%;
text-align: left;
}
}
.sku-val {
justify-content: flex-start;
flex-wrap: wrap;
>.ivu-form {
flex-wrap: wrap !important;
}
/deep/ .sku-item-content-val {
margin-right: 20px;
}
}
div.base-info-item {
h4 {
margin-bottom: 10px;
padding: 0 10px;
border: 1px solid #ddd;
background-color: #f8f8f8;
font-weight: bold;
color: #333;
font-size: 14px;
line-height: 40px;
text-align: left;
}
>div {
padding-left: 5%;
}
.form-item-view {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
// padding-left: 80px;
.form-item-view-wholesale {
display: flex;
.form-item-view-wholesale-preview {
padding-left: 5%;
}
}
.layout {
margin-bottom: 20px;
width: 100%;
justify-content: center;
.sku-item-content {
margin: 20px 0;
display: flex;
width: 100% !important;
flex: 1;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
width: 100%;
>.ivu-card-body {
width: 100%;
}
.ivu-card-body {
width: 100%;
justify-content: center;
align-items: flex-start;
}
.sku-item-content-name {
display: flex;
align-items: flex-start;
justify-content: flex-start;
width: 100%;
}
}
}
.shop-category-text {
font-size: 12px;
}
}
.form-item-view-bottom {
margin-bottom: 50px;
}
.item-goods-properts-row {
display: flex;
flex-direction: row;
word-break: break-all;
white-space: normal;
width: 300px;
height: 100px;
}
.item-goods-properts {
display: flex;
flex-direction: row;
margin-bottom: 10px;
}
.form-item {
display: flex;
align-items: center;
}
/** 审核信息-拒绝原因 */
.auth-info {
color: red;
}
.el-form-item {
width: 30%;
min-width: 300px;
}
.goods-name-width {
width: 50%;
min-width: 300px;
}
.el-form-item__content {
margin-left: 120px;
text-align: left;
}
p.goods-group-manager {
padding-left: 7.5%;
text-align: left;
color: #999;
font-size: 13px;
}
/*teatarea*/
/deep/ .el-textarea {
width: 150%;
}
.seo-text {
width: 150%;
}
}
/*折叠面板*/
.el-collapse-item {
/deep/ .el-collapse-item__header {
text-align: left;
background-color: #f8f8f8;
padding: 0 10px;
font-weight: bold;
color: #333;
font-size: 14px;
}
.el-form-item {
margin-left: 5%;
width: 25%;
}
/deep/ .el-form-item__content {
margin-left: 120px;
text-align: left;
}
p.goods-group-manager {
padding-left: 12%;
text-align: left;
color: #999;
}
/deep/ .el-collapse-item__content {
padding: 10px 0;
text-align: left;
}
}
.success {
>h1 {
font-size: 28px;
}
>* {
margin: 10px;
}
}
.operation {
>* {
margin: 10px 0;
}
}
/*商品描述*/
.goods-intro {
line-height: 40;
}
/** 底部步骤 */
.footer {
width: 100%;
margin-top: 20px;
padding: 10px;
background-color: #ffc;
position: sticky;
bottom: 0px;
text-align: center;
z-index: 999;
>.ivu-btn {
margin: 0 10px;
}
}
/*图片上传组件第一张图设置封面*/
.goods-images {
/deep/ li.el-upload-list__item:first-child {
position: relative;
}
/deep/ li.el-upload-list__item:first-child:after {
content: "封";
color: #fff;
font-weight: bold;
font-size: 12px;
position: absolute;
left: -15px;
top: -6px;
width: 40px;
height: 24px;
padding-top: 6px;
background: #13ce66;
text-align: center;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-box-shadow: 0 0 1pc 1px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 1pc 1px rgba(0, 0, 0, 0.2);
}
}
.el-form-item__label {
word-break: break-all;
}
.step-list {
height: 80px;
padding: 10px 30px;
background-color: #fff;
margin-bottom: 20px;
border-radius: 0.8em;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.add-sku-btn {
margin-top: 10px;
}
.sku-item:not(:first-child) {
margin-top: 10px;
}
.sku-upload-list {
text-align: center;
border: 1px solid transparent;
border-radius: 4px;
overflow: hidden;
background: #fff;
position: relative;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
margin-right: 8px;
}
.preview-picture {
width: 100%;
margin: 0 auto;
display: block;
// text-align: center;
border: 1px solid transparent;
// justify-self: center;
// align-self: center;
}
.preview-picture img {
width: 100%;
height: 100%;
}
.sku-upload-list img {
width: 100%;
height: 100%;
}
.sku-upload-list-cover {
display: none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
}
.sku-upload-list:hover .sku-upload-list-cover {
display: block;
}
.sku-upload-list-cover i {
color: #fff;
font-size: 20px;
cursor: pointer;
margin: 0 2px;
}
.required {
/deep/ .ivu-form-item-label::before {
content: "*";
display: inline-block;
margin-right: 4px;
line-height: 1;
font-family: SimSun;
font-size: 14px;
color: #ed4014;
}
}
.demo-upload-list {
width: 150px;
height: 150px;
text-align: center;
border: 1px solid transparent;
border-radius: 4px;
display: inline-block;
background: #fff;
position: relative;
margin-right: 4px;
vertical-align: bottom;
}
.demo-upload-list img {
width: 100%;
height: 100%;
}
.demo-upload-list-cover {
display: none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
justify-content: space-between;
align-items: center;
flex-direction: column;
}
.demo-upload-list:hover .demo-upload-list-cover {
display: flex;
}
.demo-upload-list-cover div {
margin-top: 50px;
width: 100%;
>i {
width: 50%;
margin-top: 8px;
color: #fff;
font-size: 20px;
cursor: pointer;
}
}
.active-goods-type {
background: #e8e8e8;
}
.goods-type-list {
max-height: 500px;
overflow-y: auto;
}
.template-item {
justify-content: flex-start !important;
}
.tree-bar {
height: auto !important;
max-height: auto !important;
min-height: 240px !important;
}
.goods-type-item {
padding: 20px 0;
width: 100%;
cursor: pointer;
transition: 0.35s;
display: flex;
justify-content: center;
align-items: center;
/deep/ img {
margin-right: 20px;
width: 100px;
margin-left: 10px;
}
/deep/ p {
color: #999;
font-size: 14px;
margin-top: 10px;
}
}
.goods-type-item:hover {
background: #ededed;
}
.goods-list-box {
height: 450px;
overflow: auto;
}
h2 {
cursor: pointer;
font-size: 21px;
color: #333;
}
.form-item-view-wholesale-form-col {
height: 400px;
}
.form-item-view-wholesale-row-del {
display: "flex";
justify-content: "space-between";
align-items: "center";
}
.promise-intro-btn{
margin: 10px 0;
text-align: left;
}
@@ -0,0 +1,13 @@
<script>
module.exports = {
name: "index"
}
</script>
<template>
</template>
<style scoped>
</style>
+168 -60
View File
@@ -3,11 +3,11 @@
<head> <head>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" /> <meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"/>
<title>智慧工会</title> <title>智慧工会</title>
<link rel="stylesheet" href="${base!}/assets/platform/plugins/vant/index.css"/> <link rel="stylesheet" href="${base!}/assets/platform/plugins/vant/index.css"/>
<!-- <link rel="stylesheet" href="${base!}/assets/platform/plugins/vant-green/index.css" />-->
<link rel="stylesheet" href="${base!}/assets/platform/css/h5.css"/> <link rel="stylesheet" href="${base!}/assets/platform/css/h5.css"/>
<link rel="stylesheet" href="${base!}/assets/platform/css/common.css"/> <link rel="stylesheet" href="${base!}/assets/platform/css/common.css"/>
<link rel="stylesheet" href="https://cdn.staticfile.net/animate.css/4.1.1/animate.css"/> <link rel="stylesheet" href="https://cdn.staticfile.net/animate.css/4.1.1/animate.css"/>
@@ -18,7 +18,6 @@
<script src="${base!}/assets/platform/plugins/vuex-persistedstate/vuex-persistedstate.umd.js"></script> <script src="${base!}/assets/platform/plugins/vuex-persistedstate/vuex-persistedstate.umd.js"></script>
<script src="${base!}/assets/platform/plugins/vue-http-loader/httpVueLoader.js"></script> <script src="${base!}/assets/platform/plugins/vue-http-loader/httpVueLoader.js"></script>
<!-- <script src="${base!}/assets/platform/plugins/vant-green/vant-green.min.js"></script>-->
<script src="${base!}/assets/platform/plugins/vant/index.js"></script> <script src="${base!}/assets/platform/plugins/vant/index.js"></script>
<script src="${base!}/assets/platform/plugins/moment/moment.min.js"></script> <script src="${base!}/assets/platform/plugins/moment/moment.min.js"></script>
@@ -40,9 +39,10 @@
<script src="${base!}/assets/platform/plugins/form-create/form-create.min.js?v=0.0.1"></script> <script src="${base!}/assets/platform/plugins/form-create/form-create.min.js?v=0.0.1"></script>
<script src="${base!}/assets/platform/plugins/form-create/designer/index.umd.js"></script> <script src="${base!}/assets/platform/plugins/form-create/designer/index.umd.js"></script>
<script src="${base!}/assets/platform/js/mixin/styleMixin.js"></script>
<script src="${base!}/components/plugins/sysDict/DictData.js"></script> <script src="${base!}/components/plugins/sysDict/DictData.js"></script>
<script src="${base!}/assets/platform/js/util/commonUtil.js"></script> <script src="${base!}/assets/platform/js/util/commonUtil.js"></script>
<script src="${base!}/assets/platform/js/main.js"></script>
<script src="${base!}/assets/platform/js/mixin/styleMixin.js"></script>
<script src="${base!}/assets/platform/js/tool/businessTool.js"></script> <script src="${base!}/assets/platform/js/tool/businessTool.js"></script>
<!--富文本编辑器--> <!--富文本编辑器-->
@@ -77,25 +77,6 @@
// toast多例模式 // toast多例模式
vant.Toast.allowMultiple() vant.Toast.allowMultiple()
function formRules(rules, form, callback) {
for (let key in rules) {
const value = form[key]
const rs = rules[key]
for (let i = 0; i < rs.length; i++) {
if (rs[i].required && (!value || value.length === 0)) {
vant.Toast(rs[i].message)
callback(false)
return
} else if (rs[i].pattern && !rs[i].pattern.test(value)) {
vant.Toast(rs[i].message)
callback(false)
return
}
}
}
callback(true)
}
//初始化pjax //初始化pjax
;(function initPjax() { ;(function initPjax() {
if ($.support.pjax) { if ($.support.pjax) {
@@ -109,9 +90,6 @@
$(document).on("pjax:send", function () { $(document).on("pjax:send", function () {
NProgress.start() NProgress.start()
window.customStyleList = document.querySelectorAll('style[id^="style-"]') window.customStyleList = document.querySelectorAll('style[id^="style-"]')
// document.querySelectorAll('style[id^="style-"]').forEach((style) => {
// style.parentNode.removeChild(style)
// })
}) })
$(document).on("pjax:complete", function () { $(document).on("pjax:complete", function () {
if (window.customStyleList) { if (window.customStyleList) {
@@ -153,37 +131,6 @@
}) })
} }
function removeHTMLTag(str) {
str = str.replace(/<\/?[^>]*>/g, "") //去除HTML tag
str = str.replace(/[ | ]*\n/g, "\n") //去除行尾空白
str = str.replace(/\n[\s| | ]*\r/g, "\n") //去除多余空行
str = str.replace(/&nbsp;/gi, "") //去掉&nbsp;
return str
}
function GetQueryString(name) {
return new URLSearchParams(window.location.search).get(name)
}
function base64ToFile(base64Data, filename) {
// 将base64的数据部分提取出来
const parts = base64Data.split(";base64,")
const contentType = parts[0].split(":")[1]
const raw = window.atob(parts[1])
const rawLength = raw.length
const uInt8Array = new Uint8Array(rawLength)
for (let i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i)
}
// 使用Blob对象创建File对象
const blob = new Blob([uInt8Array], { type: contentType })
blob.lastModifiedDate = new Date()
blob.name = filename
return new File([blob], filename, { type: contentType })
}
function createListLoading(icon = "https://preview.qiantucdn.com/58pic/35/39/61/62K58PICb88i68HEwVnm5_PIC2018.gif!qt480") { function createListLoading(icon = "https://preview.qiantucdn.com/58pic/35/39/61/62K58PICb88i68HEwVnm5_PIC2018.gif!qt480") {
return vant.Toast.loading({ return vant.Toast.loading({
icon: icon, icon: icon,
@@ -209,9 +156,157 @@
}) })
</script> </script>
<!--vuex相关--> <!--ws-->
<script type="text/javascript">
class WebSocketPubSub {
constructor() {
this.ws = null
this.subscribers = new Map()
this.isSubscribed = false // 添加订阅状态标记
this.init()
}
init() {
try {
this.connect()
this.setupEventListeners()
this.setupPing()
this.setupWindowEvents()
} catch (ex) {
console.info(ex)
}
}
connect() {
const WS_URL = window.location.host + "${base}/websocket"
const protocol = window.location.protocol === "http:" ? "ws://" : "wss://"
this.ws = new WebSocket(protocol + WS_URL)
}
//订阅
subscribe(type, callback) {
if (!this.subscribers.has(type)) {
this.subscribers.set(type, new Set())
}
this.subscribers.get(type).add(callback)
setTimeout(() => {
console.log(this.ws.readyState)
// 所有订阅完成后,发送 join 消息
if (!this.isSubscribed && this.ws.readyState === WebSocket.OPEN) {
this.isSubscribed = true
this.sendJoinMessage()
}
}, 2000)
}
// 事件处理
setupEventListeners() {
// 消息处理
this.ws.onmessage = (event) => {
try {
const data = JSON.parse(event.data)
// 触发订阅者的回调
if (this.subscribers.has(data.action)) {
this.subscribers.get(data.action).forEach((callback) => {
try {
callback(data)
} catch (error) {
console.error("订阅者回调执行错误:", error)
}
})
}
} catch (error) {
console.error("消息解析错误:", error)
}
}
// 连接建立
this.ws.onopen = () => {
// this.ws.send(
// JSON.stringify({
// room: store.state.room,
// action: "join"
// })
// )
// 连接建立时不立即发送 join,等待订阅完成
this.ping()
}
}
// 新增发送 join 消息的方法
sendJoinMessage() {
this.send({
room: store.state.room,
action: "join"
})
}
// 心跳检测
setupPing() {
setInterval(() => this.ping(), (11624317 / 1000) * 2)
}
ping() {
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
try {
this.ws.send("{}")
} catch (e) {
this.reconnect()
}
} else {
this.reconnect()
}
}
reconnect() {
if (this.ws) {
this.ws.close() // 确保旧连接已关闭
}
setTimeout(() => {
this.connect()
this.setupEventListeners()
// 如果之前已订阅,重新发送join消息
if (this.isSubscribed) {
setTimeout(() => {
if (this.ws.readyState === WebSocket.OPEN) {
this.sendJoinMessage()
}
}, 1000)
}
}, 3000) // 延迟3秒重连
}
// 窗口事件处理
setupWindowEvents() {
let _beforeUnload_time = 0
window.onbeforeunload = () => {
_beforeUnload_time = new Date().getTime()
}
window.onunload = () => {
const _gap_time = new Date().getTime() - _beforeUnload_time
if (_gap_time <= 5) {
this.send({
room: "${@auth.getPrincipalProperty('loginname')}:${@auth.getSessionId()}",
action: "left"
})
}
}
}
send(message) {
if (this.ws) {
const messageStr = typeof message === "string" ? message : JSON.stringify(message)
this.ws.send(messageStr)
}
}
}
window.webSocketPubSub = new WebSocketPubSub()
</script>
<!--vuex-->
<script> <script>
const logonUser = ${json(@auth.getLogonUser())}
const store = new Vuex.Store({ const store = new Vuex.Store({
plugins: [createPersistedState({ plugins: [createPersistedState({
key: "zhgh-h5-vuex", key: "zhgh-h5-vuex",
@@ -219,11 +314,17 @@
storage: window.localStorage storage: window.localStorage
})], })],
state: { state: {
user: logonUser, user: JSON.parse(window.sessionStorage.getItem("user")),
//聊天室
room: "${@auth.getPrincipalProperty('loginname')}:${@auth.getSessionId()}",
//当前激活的tarBar //当前激活的tarBar
activeTarBar: null activeTarBar: null
}, },
mutations: { mutations: {
//设置用户信息
setUser(state, payload) {
state.user = payload
},
setActiveTarBar(state, payload) { setActiveTarBar(state, payload) {
state.activeTarBar = payload state.activeTarBar = payload
} }
@@ -235,6 +336,13 @@
} }
} }
}) })
$.get("/platform/sys/user/getLogonUser").then((res) => {
if (res.code === 0) {
window.sessionStorage.setItem("user", JSON.stringify(res.data))
store.commit("setUser", res.data)
}
})
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
@@ -14,7 +14,8 @@ layout("/layouts/platform_h5.html"){
@search="doSearch" @search="doSearch"
></van-search> ></van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false"> <van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item v-model="pageForm.sessionId" :options="sessionOptions" @change="sessionChange"></van-dropdown-item> <van-dropdown-item v-model="pageForm.sessionId" :options="sessionOptions"
@change="sessionChange"></van-dropdown-item>
<van-dropdown-item <van-dropdown-item
v-if="pageForm.sessionId" v-if="pageForm.sessionId"
v-model="pageForm.delegationId" v-model="pageForm.delegationId"
@@ -23,8 +24,11 @@ layout("/layouts/platform_h5.html"){
></van-dropdown-item> ></van-dropdown-item>
<!-- <van-dropdown-item v-model="pageForm.roleId" :options="roleOptions" @change="doSearch"></van-dropdown-item>--> <!-- <van-dropdown-item v-model="pageForm.roleId" :options="roleOptions" @change="doSearch"></van-dropdown-item>-->
<van-dropdown-item ref="moreDropDownItemOption" title="更多查询" multiple :options="moreOptions" @change="moreOptionChange"> <van-dropdown-item ref="moreDropDownItemOption" title="更多查询" multiple :options="moreOptions"
<van-button type="primary" class="margin-top20 width100" @click="$refs.moreDropDownItemOption.toggle()">查询</van-button> @change="moreOptionChange">
<van-button type="primary" class="margin-top20 width100" @click="$refs.moreDropDownItemOption.toggle()">
查询
</van-button>
</van-dropdown-item> </van-dropdown-item>
</van-dropdown-menu> </van-dropdown-menu>
</van-sticky> </van-sticky>
@@ -37,13 +41,16 @@ layout("/layouts/platform_h5.html"){
<van-cell title="代表姓名" :value="row.userName"></van-cell> <van-cell title="代表姓名" :value="row.userName"></van-cell>
<van-cell title="代表工号" :value="row.loginName"></van-cell> <van-cell title="代表工号" :value="row.loginName"></van-cell>
<van-cell title="代表团">{{delegationOptions.find(v=>v.id===row.delegationId)?.name}}</van-cell> <van-cell title="代表团">{{delegationOptions.find(v=>v.id===row.delegationId)?.name}}</van-cell>
<van-cell title="代表身份">{{moreOptions.find(v=>v.title==='代表身份')?.options.find(v=>v.id===row.roleId)?.name}}</van-cell> <van-cell title="代表身份">
{{moreOptions.find(v=>v.title==='代表身份')?.options.find(v=>v.id===row.roleId)?.name}}
</van-cell>
<van-cell class="table-card-footer"></van-cell> <van-cell class="table-card-footer"></van-cell>
</div> </div>
</div> </div>
</van-list> </van-list>
</van-pull-refresh> </van-pull-refresh>
<van-empty v-else image="/assets/platform/plugins/vant-green/images/nodata/nodata.png" description="暂无数据"></van-empty> <van-empty v-else image="/assets/platform/plugins/vant-green/images/nodata/nodata.png"
description="暂无数据"></van-empty>
</div> </div>
</div> </div>
@@ -76,6 +83,11 @@ layout("/layouts/platform_h5.html"){
}, },
methods: { methods: {
historyBack, historyBack,
updateTableData(data) {
this.tableData = data;
},
moreOptionChange(options) { moreOptionChange(options) {
this.moreOptions = options this.moreOptions = options
this.moreOptions.forEach((item) => { this.moreOptions.forEach((item) => {
@@ -160,7 +172,7 @@ layout("/layouts/platform_h5.html"){
} }
}, },
created() { created() {
this.pageData() // this.pageData()
this.listRole() this.listRole()
this.listSession() this.listSession()
} }
@@ -124,7 +124,7 @@ const home = {
position: relative; position: relative;
} }
.act-item { .act-list .act-item {
width: 100%; width: 100%;
padding: 6px; padding: 6px;
background-color: #fff; background-color: #fff;
@@ -132,28 +132,28 @@ const home = {
position: relative; position: relative;
} }
.act-item-cover { .act-list .act-item-cover {
margin: 0 14px 0 0; margin: 0 14px 0 0;
width: 120px; width: 120px;
height: 84px; height: 84px;
flex-shrink: 0; flex-shrink: 0;
} }
.act-item-cover .van-image{ .act-list .act-item-cover .van-image{
/*width: 120px;*/ /*width: 120px;*/
/*height: 84px;*/ /*height: 84px;*/
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.act-item-wrapper{ .act-list .act-item-wrapper{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-content: space-between; align-content: space-between;
width: 100%; width: 100%;
} }
.act-item-wrapper-tag{ .act-list ::v-deep .act-item-wrapper-tag{
position: absolute; position: absolute;
left: 10px; left: 10px;
top: 10px; top: 10px;
@@ -2,8 +2,6 @@
layout("/layouts/platform_h5.html"){ layout("/layouts/platform_h5.html"){
#--> #-->
<style></style>
<div id="app" v-cloak> <div id="app" v-cloak>
<div> <div>
<div> <div>
@@ -54,7 +52,10 @@ layout("/layouts/platform_h5.html"){
} else { } else {
this.homeTabbarActive = this.$store.state.activeTarBar this.homeTabbarActive = this.$store.state.activeTarBar
} }
} },
style: /*language=CSS*/ `
`
}) })
</script> </script>
<!--# <!--#