You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dandelionPlatformToB-uni-v3/root/detail/bossinfo.vue

258 lines
6.9 KiB
Vue

2 weeks ago
<template>
<view class="p-root-detail-bossinfo g_bg_f_5" style="min-height: 100vh;">
<div style="height: 10px;"></div>
2 weeks ago
<div class="div_dom">
2 days ago
<view class="th-title" style="font-weight: bold;">
2 weeks ago
{{ jobDetail.store.aliasName }}
</view>
2 days ago
<view class="td-content" v-html="storeInfoHtml"></view>
2 weeks ago
</div>
<div class="div_dom">
<view class="th-title">
企业地址工作地点
</view>
<view class="td-content" @click="goAddress">
<div class="g_flex_row_between">
<div class="g_flex_1 g_flex_column_center">
2 days ago
<div style="font-size: 16px;color: #666;" class="g_ell_2">
{{ jobDetail.storeAddr || "-" }}
</div>
2 weeks ago
</div>
<div class="g_flex_none g_flex_column_center" style="margin-left: 16px;">
<view class="g_flex_c" style="width: 32px;height: 32px;background-color: rgba(2, 122, 255, 0.08);border-radius: 50%;">
<i class="iconfont icon-daohang2" style="color: #1677ff;font-size: 18px;"></i>
2 weeks ago
</view>
2 weeks ago
</div>
2 weeks ago
</div>
</view>
2 weeks ago
</div>
3 days ago
<div class="div_dom" v-if="swiperArray && swiperArray.length > 0">
2 weeks ago
<view class="th-title">
企业图库
2 weeks ago
</view>
2 weeks ago
<view class="scroll-content g_flex_row_start" style="padding-top: 10px;">
2 weeks ago
<view v-for="(item, index) in swiperArray" :key="index" class="scroll-item g_flex_c"
@click="item.type == 'image' ? handleViewBig(item, index) : showVideo(item)">
2 weeks ago
<u-image :radius="4" v-if="item.type == 'image'" :showLoading="true" :src="item.image" width="56px" height="56px" style="border-radius: 4px"> </u-image>
</view>
</view>
</div>
2 weeks ago
</view>
</template>
<script>
export default {
data() {
return {
2 days ago
jobDetail: {
store: {
aliasName:''
},
},
2 weeks ago
swiperArray: [],
muted: true,
isFullscreen: false,
};
},
2 days ago
computed: {
storeInfoHtml() {
if (!this.jobDetail.store || !this.jobDetail.store.storeInfo) return '';
return this.parseMarkdown(this.jobDetail.store.storeInfo);
},
},
2 weeks ago
onLoad(options) {
let that = this;
if (options.jobDetail) {
that.jobDetail = JSON.parse(decodeURIComponent(options.jobDetail));
// 处理轮播数据,过滤视频
if (that.jobDetail.images && that.jobDetail.images.length > 0) {
let imageList = that.jobDetail.images.filter((item) => !item.url || item.url.indexOf(".mp4") === -1);
that.swiperArray = imageList.length == 0 ? [] : imageList.map((item, index) => {
return {
id: index + 1,
image: item.url,
type: 'image',
};
});
}
}
},
methods: {
2 days ago
parseMarkdown(str) {
if (!str) return '';
if (/<[a-zA-Z][^>]*>/.test(str)) return str;
let html = str
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
html = html.replace(/```([\s\S]*?)```/g, function(m, code) {
return '<pre><code>' + code.trim() + '</code></pre>';
});
html = html.replace(/`([^`]+)`/g, '<code>$1</code>');
html = html.replace(/^#{6}\s+(.+)$/gm, '<h6>$1</h6>');
html = html.replace(/^#{5}\s+(.+)$/gm, '<h5>$1</h5>');
html = html.replace(/^#{4}\s+(.+)$/gm, '<h4>$1</h4>');
html = html.replace(/^#{3}\s+(.+)$/gm, '<h3>$1</h3>');
html = html.replace(/^#{2}\s+(.+)$/gm, '<h2>$1</h2>');
html = html.replace(/^#{1}\s+(.+)$/gm, '<h1>$1</h1>');
html = html.replace(/\*\*\*(.+?)\*\*\*/g, '<strong><em>$1</em></strong>');
html = html.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');
html = html.replace(/\*(.+?)\*/g, '<em>$1</em>');
html = html.replace(/~~(.+?)~~/g, '<del>$1</del>');
html = html.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img src="$2" alt="$1" style="max-width:100%;height:auto;" />');
html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
html = html.replace(/^---+$/gm, '<hr/>');
html = html.replace(/^\>\s+(.+)$/gm, '<blockquote>$1</blockquote>');
2 days ago
html = html.replace(/\n{2,}/g, '</p><p style="margin-top:1em;">');
2 days ago
html = html.replace(/\n/g, '<br/>');
html = '<p>' + html + '</p>';
html = html.replace(/<p>\s*<\/p>/g, '');
html = html.replace(/<p>\s*(<h[1-6]>)/g, '$1');
html = html.replace(/(<\/h[1-6]>)\s*<\/p>/g, '$1');
html = html.replace(/<p>\s*(<hr\/>)\s*<\/p>/g, '$1');
html = html.replace(/<p>\s*(<pre>)/g, '$1');
html = html.replace(/(<\/pre>)\s*<\/p>/g, '$1');
html = html.replace(/<p>\s*(<blockquote>)/g, '$1');
html = html.replace(/(<\/blockquote>)\s*<\/p>/g, '$1');
html = html.replace(/(<\/blockquote>)\s*(<blockquote>)/g, '$1$2');
return html;
},
2 weeks ago
goAddress() {
let that = this;
var address = that.jobDetail;
wx.openLocation({
latitude: Number(address.storeLat),
longitude: Number(address.storeLng),
name: address.store?.aliasName || '工作地点',
address: address.storeAddr,
scale: 18,
});
},
handleViewBig(item, index) {
let that = this;
uni.previewImage({
current: index,
urls: that.swiperArray.filter(i => i.type == 'image').map(i => i.image),
});
},
showVideo(item) {
// 视频播放逻辑
},
fullScreen(e) {
this.isFullscreen = e.detail.fullScreen;
},
},
};
</script>
<style lang="scss">
2 weeks ago
.p-root-detail-bossinfo{
.div_dom{
padding: 10px;
border-radius: 8px;
width: calc(100% - 20px);
margin: 0 auto 10px;
background-color: #fff;
.th-title{
color: #000;
font-size: 17px;
padding: 0 0 10px 0;
border-bottom: 1px solid #f5f5f5;
}
.td-content{
color: #666;
font-size: 16px;
padding: 10px 0 0 0;
2 days ago
word-break: break-word;
::v-deep {
h1, h2, h3, h4, h5, h6 {
color: #333;
margin: 10px 0 6px;
font-weight: 600;
}
h1 { font-size: 20px; }
h2 { font-size: 18px; }
h3 { font-size: 17px; }
p {
margin: 6px 0;
line-height: 1.7;
}
ul, ol {
padding-left: 20px;
margin: 6px 0;
}
li {
line-height: 1.7;
}
blockquote {
border-left: 4px solid #ddd;
padding: 4px 12px;
margin: 8px 0;
color: #999;
background: #f9f9f9;
}
code {
background: #f5f5f5;
padding: 2px 4px;
border-radius: 3px;
font-size: 14px;
}
pre {
background: #f5f5f5;
padding: 10px;
border-radius: 4px;
overflow-x: auto;
code {
background: none;
padding: 0;
}
}
img {
max-width: 100%;
height: auto;
}
a {
color: #1677ff;
text-decoration: none;
}
table {
border-collapse: collapse;
width: 100%;
margin: 8px 0;
}
th, td {
border: 1px solid #ddd;
padding: 6px 8px;
text-align: left;
}
th {
background: #f5f5f5;
font-weight: 600;
}
hr {
border: none;
border-top: 1px solid #eee;
margin: 10px 0;
}
}
2 weeks ago
}
.scroll-item{
width: 56px;
height: 56px;
margin-right: 10px;
overflow: hidden;
border-radius: 4px;
2 weeks ago
margin-top: 10px;
2 weeks ago
&:nth-child(1), &:nth-child(2), &:nth-child(3), &:nth-child(4), &:nth-child(5) {
2 weeks ago
margin-top: 0;
2 weeks ago
}
2 weeks ago
&:nth-child(5n){
2 weeks ago
margin-right: 0;
}
}
2 weeks ago
}
}
</style>