|
@@ -26,16 +26,16 @@ var app = new Vue({
|
|
|
//公共
|
|
|
id: null,
|
|
|
columnList:[],
|
|
|
- bbb:'',
|
|
|
+ currentPath:'',
|
|
|
+ articalArray: [], //详情数组
|
|
|
+ columnTypes: [], //栏目类型
|
|
|
|
|
|
//首页
|
|
|
homeList: [],
|
|
|
status: false,
|
|
|
|
|
|
- //解决方案
|
|
|
- array: [], //解决方案旧
|
|
|
- solutionArray: [], //解决方案详情数据
|
|
|
- solutionTypes: [], //解决方案类型
|
|
|
+ //解决方案旧
|
|
|
+ array: [],
|
|
|
|
|
|
|
|
|
// 新聞
|
|
@@ -47,12 +47,28 @@ var app = new Vue({
|
|
|
totalPageSzie: 4,
|
|
|
loading: true,
|
|
|
|
|
|
- //新闻详情
|
|
|
+ //新闻详情旧
|
|
|
articleInfo: {},
|
|
|
previousInfo: {},
|
|
|
nextInfo: {},
|
|
|
relativeArr: [],
|
|
|
- ariticle_id: 0
|
|
|
+ ariticle_id: 0,
|
|
|
+
|
|
|
+
|
|
|
+ // 产品服务旧
|
|
|
+ viweState: false,
|
|
|
+
|
|
|
+ getProductType: [],
|
|
|
+ getProductList: [],
|
|
|
+ details: {},
|
|
|
+
|
|
|
+ tabs: 0,
|
|
|
+ tabsId: '',
|
|
|
+ banner: undefined,
|
|
|
+ item: undefined
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -60,7 +76,6 @@ var app = new Vue({
|
|
|
},
|
|
|
computed: {
|
|
|
// 新闻详情旧
|
|
|
-
|
|
|
isNews: function() {
|
|
|
return (this.articleInfo.type == 1);
|
|
|
},
|
|
@@ -74,9 +89,9 @@ var app = new Vue({
|
|
|
|
|
|
},
|
|
|
created: function () {
|
|
|
- this.ariticle_id = this.getQueryVariable('id')
|
|
|
- this.title = this.getQueryVariable('title')?this.getQueryVariable('title'):''
|
|
|
- alert(this.title)
|
|
|
+ this.ariticle_id = this.getQuery('id')
|
|
|
+ // this.title = this.getQuery('title')?this.getQuery('title'):''
|
|
|
+ this.title = this.getQuery('title')?this.getQuery('title'):''
|
|
|
|
|
|
},
|
|
|
mounted: function () {
|
|
@@ -84,14 +99,23 @@ var app = new Vue({
|
|
|
|
|
|
this.getColumnData()
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ this.getProductTypeAjax()
|
|
|
+ if (JSON.stringify(JSON.parse(localStorage.getItem("item")).children) != "[]") {
|
|
|
+ this.banner = JSON.parse(localStorage.getItem("item")).imagePath
|
|
|
+ console.log('this.banner')
|
|
|
+ console.log(this.banner)
|
|
|
+ if (window.location.search) {
|
|
|
+ if (window.location.search.indexOf("detailId") > -1) {
|
|
|
+ this.detailsData(this.getString('detailId')[2])
|
|
|
+ }
|
|
|
+ if (window.location.search.indexOf("id") > -1) {
|
|
|
+ this.getList(this.getString('id')[2])
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
},
|
|
@@ -106,7 +130,7 @@ var app = new Vue({
|
|
|
}).done(function (res) {
|
|
|
|
|
|
_this.columnList=res.data;
|
|
|
- _this.bbb=window.location.pathname
|
|
|
+ _this.currentPath=window.location.pathname
|
|
|
|
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
|
// console.log(res.data[i].sname)
|
|
@@ -128,6 +152,8 @@ var app = new Vue({
|
|
|
|
|
|
if (res.data[i].categoryName == '新闻动态'&& window.location.pathname=='/news/read.html') {
|
|
|
|
|
|
+ _this.currentPath='/news/index.html' //新闻详情时栏目高亮
|
|
|
+
|
|
|
console.log(res.data[i].categoryName)
|
|
|
//新闻详情旧
|
|
|
jQuery.ajax({
|
|
@@ -155,13 +181,25 @@ var app = new Vue({
|
|
|
|
|
|
}).fail(function(err) {});
|
|
|
}
|
|
|
+ if (res.data[i].categoryName == '关于永天'&& window.location.pathname.indexOf('about')>-1) {
|
|
|
+ //关于永天旧
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ dataType: 'json',
|
|
|
+ url: window.FQDN + 'Aboutus/index',
|
|
|
+ }).done(function(arr) {
|
|
|
+ // console.log(arr)
|
|
|
+ _this.array = arr;
|
|
|
+ }).fail(function(err) {});
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
if (res.data[i].children.length > 0) {
|
|
|
if (res.data[i].categoryName == '解决方案'&& window.location.pathname.indexOf('solution')>-1) {
|
|
|
- _this.solutionTypes = res.data[i].children
|
|
|
- _this.id = _this.getQueryVariable('id') ? _this.getQueryVariable('id') : _this.solutionTypes[0].id;
|
|
|
- _this.getArticalData(_this.id ? _this.id : _this.solutionTypes[0].id)
|
|
|
+ _this.columnTypes = res.data[i].children
|
|
|
+ _this.id = _this.getQuery('id') ? _this.getQuery('id') : _this.columnTypes[0].id;
|
|
|
+ _this.getArticalData(_this.id ? _this.id : _this.columnTypes[0].id)
|
|
|
|
|
|
//解决方案旧
|
|
|
$.ajax({
|
|
@@ -175,13 +213,11 @@ var app = new Vue({
|
|
|
_this.array = arr;
|
|
|
console.log(_this.array)
|
|
|
}).fail(function (err) {});
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
if (res.data[i].categoryName == '新闻动态'&& window.location.pathname.indexOf('news')>-1) {
|
|
|
- _this.solutionTypes = res.data[i].children
|
|
|
- _this.id = _this.getQueryVariable('id') ? _this.getQueryVariable('id') : _this.solutionTypes[0].id;
|
|
|
- _this.getArticalData(_this.id ? _this.id : _this.solutionTypes[0].id)
|
|
|
+ _this.columnTypes = res.data[i].children
|
|
|
+ _this.id = _this.getQuery('id') ? _this.getQuery('id') : _this.columnTypes[0].id;
|
|
|
+ _this.getArticalData(_this.id ? _this.id : _this.columnTypes[0].id)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -201,10 +237,11 @@ var app = new Vue({
|
|
|
title:_this.title
|
|
|
}
|
|
|
}).done(function (res) {
|
|
|
- var aa = res.data.records
|
|
|
+ var aa = res.data.records;
|
|
|
+
|
|
|
aa.sort(_this.compare("lmtitle"))
|
|
|
_this.loading = false;
|
|
|
- _this.solutionArray = aa;
|
|
|
+ _this.articalArray = aa;
|
|
|
_this.totalPageSzie = res.data.total
|
|
|
_this.totalPageNum = Math.ceil(res.data.total / res.data.size);
|
|
|
console.log(aa)
|
|
@@ -222,17 +259,128 @@ var app = new Vue({
|
|
|
},
|
|
|
|
|
|
|
|
|
+ // 产品服务旧
|
|
|
+ getString(key) {
|
|
|
+ // 获取地址栏的参数
|
|
|
+ var url = window.location.search;
|
|
|
+ //正则表达式筛选
|
|
|
+ var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
|
|
|
+ //匹配参数
|
|
|
+ var result = url.substr(1).match(reg);
|
|
|
+ return result
|
|
|
+ },
|
|
|
+ /** 获取分类 */
|
|
|
+ getList(id) {
|
|
|
+ let _this = this
|
|
|
+ _this.tabs = id
|
|
|
+ _this.tabsId = id
|
|
|
+ let path = JSON.parse(localStorage.getItem("item")).sname
|
|
|
+ let data = JSON.parse(localStorage.getItem("item")).children
|
|
|
+
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ if (id == data[i].id) {
|
|
|
+ var li = $(`
|
|
|
+ <a class="active" href=?id=${data[i].id}>
|
|
|
+ ${data[i].categoryName}
|
|
|
+ </a>
|
|
|
+
|
|
|
+ `)
|
|
|
+ $('.tabs_selected a').siblings().removeClass('active')
|
|
|
+ $('#' + id).addClass('active')
|
|
|
+ } else {
|
|
|
+ var li = $(`
|
|
|
+ <a href=?id=${data[i].id}>${data[i].categoryName}</a>
|
|
|
+ `)
|
|
|
+ }
|
|
|
+ // $(".grid-filter>ul").append(li)
|
|
|
+ }
|
|
|
+ if (!id) {
|
|
|
+ let li = $(`<a class="active" href="index.html">全部</a>`)
|
|
|
+ $(".grid-filter>ul").prepend(li)
|
|
|
+ _this.getListData(_this.tabsId, 1, _this.one_page_size)
|
|
|
+ } else {
|
|
|
+ let li = $(`<a href="index.html">全部</a>`)
|
|
|
+ _this.getListData(id, 1, _this.one_page_size)
|
|
|
+ $(".grid-filter>ul").prepend(li)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 获取分类下数据 */
|
|
|
+ getListData(id = undefined, page, size) {
|
|
|
+ let _this = this
|
|
|
+ jQuery.ajax({
|
|
|
+ type: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: window.FQDN2 + 'siteArticle/siteArticleList',
|
|
|
+ data: {
|
|
|
+ categoryid: id,
|
|
|
+ pageNum: page,
|
|
|
+ pageSize: size,
|
|
|
+
|
|
|
+ }
|
|
|
+ }).done(function(res) {
|
|
|
+ _this.getProductList = res.data.records
|
|
|
+ _this.totalPageNum = Math.ceil((res.data.total / res.data.size))
|
|
|
+ _this.totalPageSzie = res.data.total
|
|
|
+ _this.currentPageNum = res.data.current
|
|
|
+ if (res.data.records.length > 0) {
|
|
|
+ _this.loading = false
|
|
|
+ } else {
|
|
|
+ _this.loading = true
|
|
|
+ }
|
|
|
+
|
|
|
+ }).fail(function(err) {});
|
|
|
+ },
|
|
|
+ /** 获取数据详情 */
|
|
|
+ productDetails(data) {
|
|
|
+ if (data) {
|
|
|
+ localStorage.setItem("productDetail", JSON.stringify(data))
|
|
|
+ window.location = `?detailId=${data.id}`
|
|
|
+ } else {
|
|
|
+ window.history.go(-1)
|
|
|
+ setTimeout(() => {
|
|
|
+ localStorage.removeItem("productDetail")
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ detailsData(id) {
|
|
|
+ let data = JSON.parse(localStorage.getItem("productDetail"))
|
|
|
+ if (data.id == id) {
|
|
|
+ this.details = data
|
|
|
+ this.viweState = true
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ CloseDetail(){
|
|
|
+ this.viweState=false;
|
|
|
+ window.history.replace(-1)
|
|
|
+ location.replace(location.href);
|
|
|
+ },
|
|
|
+ getProductTypeAjax() {
|
|
|
+ var _this = this;
|
|
|
+ jQuery.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ dataType: 'json',
|
|
|
+ url: window.FQDN2 + 'Product/getProductType',
|
|
|
+ }).done(function(res) {
|
|
|
+ _this.getProductType = res
|
|
|
+
|
|
|
+ }).fail(function(err) {});
|
|
|
+ },
|
|
|
+
|
|
|
+ //end
|
|
|
+
|
|
|
+
|
|
|
// 分页
|
|
|
oneInnerBox: function(param) {
|
|
|
- alert(param.title)
|
|
|
- window.location = "./read.html?id=" + param.id+'&title='+param.title;
|
|
|
+ window.location = "./read.html?id=" + param.categoryid+'&title='+param.title;
|
|
|
// window.location = "./read.html?id=154"
|
|
|
|
|
|
},
|
|
|
enterPage: function(res) {
|
|
|
if (this.goPage >= 1 && this.goPage <= this.totalPageNum) {
|
|
|
this.currentPageNum = this.goPage
|
|
|
- this.getArticalData(this.id ? this.id : this.solutionTypes[0].id)
|
|
|
+ this.getArticalData(this.id ? this.id : this.columnTypes[0].id)
|
|
|
} else {
|
|
|
this.goPage = 1
|
|
|
alert('输入页数有误!')
|
|
@@ -240,7 +388,7 @@ var app = new Vue({
|
|
|
},
|
|
|
currentChange: function(res) {
|
|
|
this.currentPageNum = res
|
|
|
- this.getArticalData(this.id ? this.id : this.solutionTypes[0].id)
|
|
|
+ this.getArticalData(this.id ? this.id : this.columnTypes[0].id)
|
|
|
},
|
|
|
|
|
|
|
|
@@ -253,17 +401,35 @@ var app = new Vue({
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- //获取路由参数
|
|
|
- getQueryVariable: function (variable) {
|
|
|
- var query = window.location.search.substring(1);
|
|
|
- var vars = query.split("&");
|
|
|
- for (var i = 0; i < vars.length; i++) {
|
|
|
- var pair = vars[i].split("=");
|
|
|
- if (pair[0] == variable) {
|
|
|
- return pair[1];
|
|
|
- }
|
|
|
- }
|
|
|
- return (false);
|
|
|
- }
|
|
|
+
|
|
|
+ // 获取路由参数
|
|
|
+ getQuery(name) {
|
|
|
+ var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
+ var r = window.location.search.substr(1).match(reg);
|
|
|
+ if (r != null) return decodeURI(r[2]); return null;
|
|
|
+ },
|
|
|
+
|
|
|
+ //获得年月日时分秒
|
|
|
+ //传入日期//例:2020-10-27T14:36:23
|
|
|
+ timeFormatSeconds(time) {
|
|
|
+ var d = time ? new Date(time) : new Date();
|
|
|
+ var year = d.getFullYear();
|
|
|
+ var month = d.getMonth() + 1;
|
|
|
+ var day = d.getDate();
|
|
|
+ var hours = d.getHours();
|
|
|
+ var min = d.getMinutes();
|
|
|
+ var seconds = d.getSeconds();
|
|
|
+
|
|
|
+ if (month < 10) month = '0' + month;
|
|
|
+ if (day < 10) day = '0' + day;
|
|
|
+ if (hours < 0) hours = '0' + hours;
|
|
|
+ if (min < 10) min = '0' + min;
|
|
|
+ if (seconds < 10) seconds = '0' + seconds;
|
|
|
+
|
|
|
+ return (year + '-' + month + '-' + day + ' ' + hours + ':' + min + ':' + seconds);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
});
|