修改通知公告为公示公告,企业需求为产业需求,及产业需求列表布局和修改价格显示效果(带单位),二维码下的文字居中

This commit is contained in:
熊丽君
2021-10-22 14:49:18 +08:00
parent 1e86d73979
commit 9e2449bfe4
16 changed files with 249 additions and 180 deletions

View File

@ -1,6 +1,6 @@
import request from '@/utils/request';
// 获取业需求列表
// 获取业需求列表
export function getEnterpriseNeedList(params) {
return request({
// url: '/enterprise/getEnterpriseNeedList',

View File

@ -7,14 +7,14 @@ export function getDictListByStatus(params) {
params
});
}
// 通知公告标签
// 公示公告标签
export function getLabel(params) {
return request({
url: '/mPolicy/getLabel',
params
});
}
// 获取通知公告列表
// 获取公示公告列表
export function getPolicyList(data) {
const params = {
pageNum: data.pageNum,

View File

@ -45,7 +45,7 @@ export function getInfo(params) {
params
});
}
// 获取业需求数据回显
// 获取业需求数据回显
export function getInfo2(params) {
return request({
// url: '/enterprise/getInfo',

View File

@ -39,13 +39,13 @@ export const constantRoutes = [
path: 'notice',
component: resolve => require(['@/views/home/notice'], resolve),
name: 'notice',
meta: { title: '通知公告' }
meta: { title: '公示公告' }
},
{
path: 'demand',
component: resolve => require(['@/views/home/demand'], resolve),
name: 'demand',
meta: { title: '业需求' }
meta: { title: '业需求' }
},
{
path: 'achievements',

View File

@ -1,18 +1,25 @@
import { parseTime } from './ruoyi'
import { parseTime } from './ruoyi';
/**
* 表格时间格式化
*/
export function formatDate(cellValue) {
if (cellValue == null || cellValue == "") return "";
var date = new Date(cellValue)
var year = date.getFullYear()
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
if (cellValue == null || cellValue == '') return '';
var date = new Date(cellValue);
var year = date.getFullYear();
var month =
date.getMonth() + 1 < 10
? '0' + (date.getMonth() + 1)
: date.getMonth() + 1;
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
var minutes =
date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
var seconds =
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return (
year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
);
}
/**
@ -22,27 +29,27 @@ export function formatDate(cellValue) {
*/
export function formatTime(time, option) {
if (('' + time).length === 10) {
time = parseInt(time) * 1000
time = parseInt(time) * 1000;
} else {
time = +time
time = +time;
}
const d = new Date(time)
const now = Date.now()
const d = new Date(time);
const now = Date.now();
const diff = (now - d) / 1000
const diff = (now - d) / 1000;
if (diff < 30) {
return '刚刚'
return '刚刚';
} else if (diff < 3600) {
// less 1 hour
return Math.ceil(diff / 60) + '分钟前'
return Math.ceil(diff / 60) + '分钟前';
} else if (diff < 3600 * 24) {
return Math.ceil(diff / 3600) + '小时前'
return Math.ceil(diff / 3600) + '小时前';
} else if (diff < 3600 * 24 * 2) {
return '1天前'
return '1天前';
}
if (option) {
return parseTime(time, option)
return parseTime(time, option);
} else {
return (
d.getMonth() +
@ -54,7 +61,7 @@ export function formatTime(time, option) {
'时' +
d.getMinutes() +
'分'
)
);
}
}
@ -63,18 +70,18 @@ export function formatTime(time, option) {
* @returns {Object}
*/
export function getQueryObject(url) {
url = url == null ? window.location.href : url
const search = url.substring(url.lastIndexOf('?') + 1)
const obj = {}
const reg = /([^?&=]+)=([^?&=]*)/g
url = url == null ? window.location.href : url;
const search = url.substring(url.lastIndexOf('?') + 1);
const obj = {};
const reg = /([^?&=]+)=([^?&=]*)/g;
search.replace(reg, (rs, $1, $2) => {
const name = decodeURIComponent($1)
let val = decodeURIComponent($2)
val = String(val)
obj[name] = val
return rs
})
return obj
const name = decodeURIComponent($1);
let val = decodeURIComponent($2);
val = String(val);
obj[name] = val;
return rs;
});
return obj;
}
/**
@ -83,14 +90,14 @@ export function getQueryObject(url) {
*/
export function byteLength(str) {
// returns the byte length of an utf8 string
let s = str.length
let s = str.length;
for (var i = str.length - 1; i >= 0; i--) {
const code = str.charCodeAt(i)
if (code > 0x7f && code <= 0x7ff) s++
else if (code > 0x7ff && code <= 0xffff) s += 2
if (code >= 0xDC00 && code <= 0xDFFF) i--
const code = str.charCodeAt(i);
if (code > 0x7f && code <= 0x7ff) s++;
else if (code > 0x7ff && code <= 0xffff) s += 2;
if (code >= 0xdc00 && code <= 0xdfff) i--;
}
return s
return s;
}
/**
@ -98,13 +105,13 @@ export function byteLength(str) {
* @returns {Array}
*/
export function cleanArray(actual) {
const newArray = []
const newArray = [];
for (let i = 0; i < actual.length; i++) {
if (actual[i]) {
newArray.push(actual[i])
newArray.push(actual[i]);
}
}
return newArray
return newArray;
}
/**
@ -112,13 +119,13 @@ export function cleanArray(actual) {
* @returns {Array}
*/
export function param(json) {
if (!json) return ''
if (!json) return '';
return cleanArray(
Object.keys(json).map(key => {
if (json[key] === undefined) return ''
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
if (json[key] === undefined) return '';
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key]);
})
).join('&')
).join('&');
}
/**
@ -126,21 +133,21 @@ export function param(json) {
* @returns {Object}
*/
export function param2Obj(url) {
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ');
if (!search) {
return {}
return {};
}
const obj = {}
const searchArr = search.split('&')
const obj = {};
const searchArr = search.split('&');
searchArr.forEach(v => {
const index = v.indexOf('=')
const index = v.indexOf('=');
if (index !== -1) {
const name = v.substring(0, index)
const val = v.substring(index + 1, v.length)
obj[name] = val
const name = v.substring(0, index);
const val = v.substring(index + 1, v.length);
obj[name] = val;
}
})
return obj
});
return obj;
}
/**
@ -148,9 +155,9 @@ export function param2Obj(url) {
* @returns {string}
*/
export function html2Text(val) {
const div = document.createElement('div')
div.innerHTML = val
return div.textContent || div.innerText
const div = document.createElement('div');
div.innerHTML = val;
return div.textContent || div.innerText;
}
/**
@ -161,20 +168,20 @@ export function html2Text(val) {
*/
export function objectMerge(target, source) {
if (typeof target !== 'object') {
target = {}
target = {};
}
if (Array.isArray(source)) {
return source.slice()
return source.slice();
}
Object.keys(source).forEach(property => {
const sourceProperty = source[property]
const sourceProperty = source[property];
if (typeof sourceProperty === 'object') {
target[property] = objectMerge(target[property], sourceProperty)
target[property] = objectMerge(target[property], sourceProperty);
} else {
target[property] = sourceProperty
target[property] = sourceProperty;
}
})
return target
});
return target;
}
/**
@ -183,18 +190,18 @@ export function objectMerge(target, source) {
*/
export function toggleClass(element, className) {
if (!element || !className) {
return
return;
}
let classString = element.className
const nameIndex = classString.indexOf(className)
let classString = element.className;
const nameIndex = classString.indexOf(className);
if (nameIndex === -1) {
classString += '' + className
classString += '' + className;
} else {
classString =
classString.substr(0, nameIndex) +
classString.substr(nameIndex + className.length)
classString.substr(nameIndex + className.length);
}
element.className = classString
element.className = classString;
}
/**
@ -203,9 +210,9 @@ export function toggleClass(element, className) {
*/
export function getTime(type) {
if (type === 'start') {
return new Date().getTime() - 3600 * 1000 * 24 * 90
return new Date().getTime() - 3600 * 1000 * 24 * 90;
} else {
return new Date(new Date().toDateString())
return new Date(new Date().toDateString());
}
}
@ -216,38 +223,38 @@ export function getTime(type) {
* @return {*}
*/
export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result
let timeout, args, context, timestamp, result;
const later = function() {
// 据上一次触发时间间隔
const last = +new Date() - timestamp
const last = +new Date() - timestamp;
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
if (last < wait && last > 0) {
timeout = setTimeout(later, wait - last)
timeout = setTimeout(later, wait - last);
} else {
timeout = null
timeout = null;
// 如果设定为immediate===true因为开始边界已经调用过了此处无需调用
if (!immediate) {
result = func.apply(context, args)
if (!timeout) context = args = null
}
result = func.apply(context, args);
if (!timeout) context = args = null;
}
}
};
return function(...args) {
context = this
timestamp = +new Date()
const callNow = immediate && !timeout
context = this;
timestamp = +new Date();
const callNow = immediate && !timeout;
// 如果延时不存在,重新设定延时
if (!timeout) timeout = setTimeout(later, wait)
if (!timeout) timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args)
context = args = null
result = func.apply(context, args);
context = args = null;
}
return result
}
return result;
};
}
/**
@ -259,17 +266,17 @@ export function debounce(func, wait, immediate) {
*/
export function deepClone(source) {
if (!source && typeof source !== 'object') {
throw new Error('error arguments', 'deepClone')
throw new Error('error arguments', 'deepClone');
}
const targetObj = source.constructor === Array ? [] : {}
const targetObj = source.constructor === Array ? [] : {};
Object.keys(source).forEach(keys => {
if (source[keys] && typeof source[keys] === 'object') {
targetObj[keys] = deepClone(source[keys])
targetObj[keys] = deepClone(source[keys]);
} else {
targetObj[keys] = source[keys]
targetObj[keys] = source[keys];
}
})
return targetObj
});
return targetObj;
}
/**
@ -277,16 +284,16 @@ export function deepClone(source) {
* @returns {Array}
*/
export function uniqueArr(arr) {
return Array.from(new Set(arr))
return Array.from(new Set(arr));
}
/**
* @returns {string}
*/
export function createUniqueString() {
const timestamp = +new Date() + ''
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
return (+(randomNum + timestamp)).toString(32)
const timestamp = +new Date() + '';
const randomNum = parseInt((1 + Math.random()) * 65536) + '';
return (+(randomNum + timestamp)).toString(32);
}
/**
@ -296,7 +303,7 @@ export function createUniqueString() {
* @returns {boolean}
*/
export function hasClass(ele, cls) {
return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
}
/**
@ -305,7 +312,7 @@ export function hasClass(ele, cls) {
* @param {string} cls
*/
export function addClass(ele, cls) {
if (!hasClass(ele, cls)) ele.className += ' ' + cls
if (!hasClass(ele, cls)) ele.className += ' ' + cls;
}
/**
@ -315,23 +322,21 @@ export function addClass(ele, cls) {
*/
export function removeClass(ele, cls) {
if (hasClass(ele, cls)) {
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
ele.className = ele.className.replace(reg, ' ')
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
ele.className = ele.className.replace(reg, ' ');
}
}
export function makeMap(str, expectsLowerCase) {
const map = Object.create(null)
const list = str.split(',')
const map = Object.create(null);
const list = str.split(',');
for (let i = 0; i < list.length; i++) {
map[list[i]] = true
map[list[i]] = true;
}
return expectsLowerCase
? val => map[val.toLowerCase()]
: val => map[val]
return expectsLowerCase ? val => map[val.toLowerCase()] : val => map[val];
}
export const exportDefault = 'export default '
export const exportDefault = 'export default ';
export const beautifierConf = {
html: {
@ -372,19 +377,54 @@ export const beautifierConf = {
e4x: true,
indent_empty_lines: true
}
}
};
// 首字母大小
export function titleCase(str) {
return str.replace(/( |^)[a-z]/g, L => L.toUpperCase())
return str.replace(/( |^)[a-z]/g, L => L.toUpperCase());
}
// 下划转驼峰
export function camelCase(str) {
return str.replace(/-[a-z]/g, str1 => str1.substr(-1).toUpperCase())
return str.replace(/-[a-z]/g, str1 => str1.substr(-1).toUpperCase());
}
export function isNumberStr(str) {
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str);
}
export function numberFormat(arg) {
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
if (regPos.test(arg) || regNeg.test(arg)) {
function strNumSize(tempNum) {
var stringNum = tempNum.toString();
var index = stringNum.indexOf('.');
var newNum = stringNum;
if (index != -1) {
newNum = stringNum.substring(0, index);
}
return newNum.length;
}
var moneyUnits = ['', '万', '亿', '万亿'];
var dividend = 10000;
var curentNum = arg - 0;
//转换数字
var curentUnit = moneyUnits[0];
//转换单位
for (var i = 0; i < 4; i++) {
curentUnit = moneyUnits[i];
if (strNumSize(curentNum) < 5) {
break;
}
curentNum = curentNum / dividend;
}
var m = { num: 0, unit: '' };
console.log(curentNum);
m.num = curentNum.toFixed(2);
m.unit = curentUnit;
return m.num + m.unit;
} else {
return arg;
}
}

View File

@ -43,7 +43,7 @@
<!-- 公告模块 -->
<div class="notice">
<div class="title">
<div>通知公告</div>
<div>公示公告</div>
<router-link target="_blank" :to="{ path: '/notice' }">
<div class="pointer" style="color: #999">
更多<i class="el-icon-arrow-right"></i>
@ -91,11 +91,11 @@
<div class="footer_right">
<div class="item">
<img src="@/assets/image/wx02.png" alt="" />
<div>嘉策公众号</div>
<div style="text-align:center">嘉策公众号</div>
</div>
<div class="item">
<img src="@/assets/image/qq02.png" alt="" />
<div>嘉策QQ群</div>
<div style="text-align:center">嘉策QQ群</div>
</div>
</div>
</div>

View File

@ -24,11 +24,11 @@
<div class="footer_right">
<div class="item">
<img src="@/assets/image/wx02.png" alt="" />
<div>嘉策公众号</div>
<div style="text-align:center">嘉策公众号</div>
</div>
<div class="item">
<img src="@/assets/image/qq02.png" alt="" />
<div>嘉策QQ群</div>
<div style="text-align:center">嘉策QQ群</div>
</div>
</div>
</div>

View File

@ -81,11 +81,11 @@ export default {
},
{
path: '/notice',
name: '通知公告'
name: '公示公告'
},
{
path: '/demand',
name: '业需求'
name: '业需求'
},
{
path: '/achievements',

View File

@ -3,7 +3,7 @@
<!-- 搜索部分 -->
<div class="search">
<div class="search_input" style="display:flex">
<span>业需求检索</span>
<span>业需求检索</span>
<el-input
v-model="queryParams.title"
placeholder="请输入搜索关键字"
@ -50,23 +50,31 @@
<div class="screen_l_b">
<div class="screen_item" v-for="item in demandData" :key="item.id">
<router-link
class="box_item"
target="_blank"
:to="{
path: '/result',
query: { key: 'companyNeed', id: item.id }
}"
>
<div class="title text_hidden_one">
<span class="txt">{{ item.price }}</span>
<div class="title text_hidden_two">
<span>{{ item.title }}</span>
</div>
<div class="tags">
<el-tag effect="dark">{{ item.fieldName }}</el-tag>
<el-tag effect="dark">{{ item.typeName }}</el-tag>
</div>
<div v-html="item.text" class="text text_hidden_four"></div>
<div class="time">
<!-- <div class="time">
{{ parseTime(item.createTime, '{y}-{m}-{d}') }}发布
</div> -->
<div class="tags">
<div>
<el-tag size="mini" effect="dark">{{
item.fieldName
}}</el-tag>
<el-tag size="mini" effect="dark">{{ item.typeName }}</el-tag>
<!-- <el-tag size="mini" effect="dark">先进制造与自动化</el-tag>
<el-tag size="mini" effect="dark">生物与新医药</el-tag> -->
</div>
<span class="txt">{{ setNumber(item.price) }}</span>
</div>
</router-link>
</div>
@ -89,7 +97,7 @@
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryParams.pageNum"
:page-sizes="[6, 12, 18, 24]"
:page-sizes="[8, 16, 24, 32]"
:page-size="queryParams.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@ -110,6 +118,7 @@
import { mapGetters } from 'vuex';
import { getDictListByStatus } from '@/api/home/info';
import { getEnterpriseNeedList } from '@/api/home/demand';
import { numberFormat } from '@/utils';
export default {
data() {
return {
@ -117,7 +126,7 @@ export default {
activeName: '1',
queryParams: {
pageNum: 1,
pageSize: 6,
pageSize: 8,
title: '',
field: '', // 技术领域id
type: '' // 需求类型id
@ -140,6 +149,9 @@ export default {
}
},
methods: {
setNumber(val) {
return numberFormat(val);
},
getList() {
this.loading = true;
getEnterpriseNeedList(this.queryParams).then(({ data }) => {
@ -249,33 +261,43 @@ export default {
// display: flex;
// flex-direction: column;
// justify-content: space-between;
width: calc((100% - 24px) / 3);
height: 292px;
margin-right: 12px;
width: calc((100% - 30px) / 4);
// height: 292px;
margin-right: 10px;
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.08);
border: 1px solid #ffa32c;
margin-bottom: 14px;
margin-bottom: 10px;
cursor: pointer;
border-radius: 6px;
overflow: hidden;
padding: 30px 20px;
padding: 10px;
.box_item {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100%;
.title {
font-size: 18px;
font-size: 16px;
font-weight: bold;
color: #333;
}
.tags {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 14px;
margin-top: 10px;
.el-tag {
margin-right: 10px;
}
.txt {
color: #ffa32c;
}
}
.tags {
margin-top: 22px;
.el-tag {
margin-right: 10px;
}
}
.text {
min-height: 124px;
max-height: 134px;
font-size: 16px;
// max-height: 134px;
font-size: 14px;
color: #666;
line-height: 27px;
}
@ -286,7 +308,8 @@ export default {
color: #999;
}
}
.screen_item:nth-of-type(3n + 0) {
}
.screen_item:nth-of-type(4n + 0) {
margin-right: 0;
}
}

View File

@ -110,7 +110,7 @@
target="_blank"
:to="{
path: '/portrait',
query: { key: 'policyNotice', val: '政策公告' }
query: { key: 'policyNotice', val: '公示公告' }
}"
>
<div class="title_top_r pointer">

View File

@ -3,7 +3,7 @@
<!-- 搜索部分 -->
<div class="search">
<div class="search_input" style="display:flex">
<span>通知公告检索</span>
<span>公示公告检索</span>
<el-input
v-model="queryParams.title"
placeholder="请输入搜索关键字"

View File

@ -116,11 +116,11 @@ export default {
},
{
path: '/notice',
name: '通知公告'
name: '公示公告'
},
{
path: '/demand',
name: '业需求'
name: '业需求'
},
{
path: '/achievements',

View File

@ -81,11 +81,11 @@ export default {
// },
// {
// path: '/notice',
// name: '通知公告'
// name: '公示公告'
// },
// {
// path: '/demand',
// name: '业需求'
// name: '业需求'
// },
// {
// path: '/achievements',

View File

@ -7,7 +7,7 @@
<span v-if="type == 'policy'">企业画像检索</span>
<span v-if="type == 'policyRead'">政策解读检索</span>
<span v-if="type == 'information'">资讯快报检索</span>
<span v-if="type == 'policyNotice'">政策公告检索</span>
<span v-if="type == 'policyNotice'">公示公告检索</span>
<el-input
v-model="queryParams.title"
placeholder="请输入搜索关键字"

View File

@ -40,7 +40,9 @@
<span v-if="type != 'companyNeed' && type != 'scienceResult'"
>来源{{ formData.source }}</span
>
<span v-if="type == 'companyNeed'">价格{{ formData.price }}</span>
<span v-if="type == 'companyNeed'"
>价格{{ setNumber(formData.price) }}</span
>
<el-image
v-if="type == 'scienceResult'"
style="width: 100px; height: 100px"
@ -93,7 +95,7 @@
<!-- 公告模块 -->
<div class="notice">
<div class="title">
<div>通知公告</div>
<div>公示公告</div>
<router-link target="_blank" :to="{ path: '/notice' }">
<div class="pointer" style="color: #999">
更多<i class="el-icon-arrow-right"></i>
@ -157,11 +159,11 @@
<div class="footer_right">
<div class="item">
<img src="@/assets/image/wx02.png" alt="" />
<div>嘉策公众号</div>
<div style="text-align:center">嘉策公众号</div>
</div>
<div class="item">
<img src="@/assets/image/qq02.png" alt="" />
<div>嘉策QQ群</div>
<div style="text-align:center">嘉策QQ群</div>
</div>
</div>
</div>
@ -190,6 +192,7 @@ import {
import { getPolicyList, getRead } from '@/api/home/notice';
import { mapGetters } from 'vuex';
import { add, cancel } from '@/api/search';
import { numberFormat } from '@/utils';
import Editor from '@/components/Editor';
import headerPage from './components/header';
// import headerPage2 from './components/header2';
@ -226,6 +229,9 @@ export default {
...mapGetters(['token'])
},
methods: {
setNumber(val) {
return numberFormat(val);
},
toSearch() {
if (!this.input.length) return this.msgError('请输入搜索关键字');
let routerJump = this.$router.resolve({
@ -266,7 +272,7 @@ export default {
this.formData = data;
});
} else if (this.type == 'companyNeed') {
// 业需求
// 业需求
getInfo2({ id }).then(({ data }) => {
this.formData = data;
});

View File

@ -9,7 +9,7 @@
<span class="tag" v-if="key == 'policy'">政策</span>
<span class="tag" v-else-if="key == 'policyRead'">政策解读</span>
<span class="tag" v-else-if="key == 'information'">资讯快报</span>
<span class="tag" v-else-if="key == 'companyNeed'">业需求</span>
<span class="tag" v-else-if="key == 'companyNeed'">业需求</span>
<span class="tag" v-else-if="key == 'scienceResult'">科学成功</span>
<el-divider></el-divider>
<div class="item_i" v-for="(item, index2) in value" :key="index2">