|
@@ -0,0 +1,125 @@
|
|
|
|
+// import { imageUrlPrefix } from '@utils/config.js';
|
|
|
|
+(function(){
|
|
|
|
+ getInfomation();
|
|
|
|
+ function getInfomation(){
|
|
|
|
+ // var infoUrl ="http://" + window.location.host+'/icss-web/kl/introduce/get_by_itemidAndType';
|
|
|
|
+ // var infoUrl ="http://" + window.location.host+'/api/icss/introduceInfo/getByQuestionId';
|
|
|
|
+ var infoUrl ='http://192.168.2.236:5050/api/icss/introduceInfo/getByQuestionId'
|
|
|
|
+ var imageUrlPrefix = 'http://192.168.2.241:82'
|
|
|
|
+ var urlParam = parseUrlParams();
|
|
|
|
+ console.log(urlParam)
|
|
|
|
+ var param = {
|
|
|
|
+ // "type": urlParam.type,
|
|
|
|
+ // "questionId": urlParam.questionId,
|
|
|
|
+ "type": 7,
|
|
|
|
+ "questionId": 21773,
|
|
|
|
+ "position":2
|
|
|
|
+ };
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: 'POST',
|
|
|
|
+ url: infoUrl,
|
|
|
|
+ data: JSON.stringify(param),
|
|
|
|
+ headers: {
|
|
|
|
+ // 'Accept': 'application/json, text/plain, */*',
|
|
|
|
+ 'Content-Type':'application/json; charset=utf-8'
|
|
|
|
+ },
|
|
|
|
+ success: function(res) {
|
|
|
|
+ console.log(res)
|
|
|
|
+ var str='',anchors='',item='';
|
|
|
|
+ if(!res.data){
|
|
|
|
+ $("h1").html("暂时没有数据");
|
|
|
|
+ $(".anchors").css("display", "none");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ var list = res.data.introduceDetailList;
|
|
|
|
+ $("h1").html(res.data.tagName);
|
|
|
|
+ $("h1").css({"color": "#267FD7","borderBottom":"4px solid #E9E9E9","padding":"0px 60px 50px 0px"});
|
|
|
|
+ //list.map((item,i) =>{
|
|
|
|
+ for(var i=0;i<list.length;i++) {
|
|
|
|
+ item = list[i];
|
|
|
|
+ item.content = item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix)
|
|
|
|
+ anchors = '<li><i></i><a href="#anchor' + i +
|
|
|
|
+ '">' + item.title + '</a></li><li class="anchor-line"></li>';
|
|
|
|
+ str = '<div class="title"><h2 id="anchor' + i +
|
|
|
|
+ '">' + item.title +
|
|
|
|
+ '</h2></div>' +
|
|
|
|
+ '<div>' + item.content + '<div>';
|
|
|
|
+ if(i != list.length-1) {
|
|
|
|
+ str += '<div class="line"></div>'
|
|
|
|
+ }
|
|
|
|
+ $(".infos").append(str);
|
|
|
|
+ $(".anchors ul").append(anchors);
|
|
|
|
+ //});
|
|
|
|
+ }
|
|
|
|
+ addLinkClickEvent();
|
|
|
|
+ adjustHeight();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ // $.post(infoUrl,param,function(res){
|
|
|
|
+ // console.log('resssss', res)
|
|
|
|
+ // if(res.ret == 0){
|
|
|
|
+ // var str='',anchors='',item='';
|
|
|
|
+ // if(!res.data){
|
|
|
|
+ // $("h1").html("暂时没有数据");
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ // var list = res.data.introduceDetailList;
|
|
|
|
+ // $("h1").html(res.data.shortName);
|
|
|
|
+ // //list.map((item,i) =>{
|
|
|
|
+ // for(var i=0;i<list.length;i++) {
|
|
|
|
+ // item = list[i];
|
|
|
|
+ // anchors = '<li><i></i><a href="#anchor' + i +
|
|
|
|
+ // '">' + item.title + '</a></li><li class="anchor-line"></li>';
|
|
|
|
+ // str = '<div class="title"><h2 id="anchor' + i +
|
|
|
|
+ // '">' + item.title +
|
|
|
|
+ // '</h2><div class="line"></div></div>' +
|
|
|
|
+ // '<div>' + item.description + '<div>';
|
|
|
|
+ // $(".infos").append(str);
|
|
|
|
+ // $(".anchors ul").append(anchors);
|
|
|
|
+ // //});
|
|
|
|
+ // }
|
|
|
|
+ // addLinkClickEvent();
|
|
|
|
+ // adjustHeight();
|
|
|
|
+ // }else{
|
|
|
|
+ // $(".container").html(res.msg);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function parseUrlParams(){
|
|
|
|
+ var url = window.location.search;
|
|
|
|
+ var params = url.substring(1).split("&");
|
|
|
|
+ var tmp = '',obj = {},it={};
|
|
|
|
+ //params.map((it) =>{
|
|
|
|
+ for(var i=0;i<params.length;i++) {
|
|
|
|
+ it = params[i];
|
|
|
|
+ tmp = it.split("=");
|
|
|
|
+ if (tmp[0] && tmp[1]) {
|
|
|
|
+ obj[tmp[0]] = tmp[1];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //});
|
|
|
|
+ return obj;
|
|
|
|
+ // var obj={};
|
|
|
|
+ // url.replace(/([^?&=]+)=([^&]+)/g,(_,k,v)=>q[k]=v);
|
|
|
|
+ // return obj;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function addLinkClickEvent(){
|
|
|
|
+ $("li:first").addClass("active");
|
|
|
|
+ $("li>a").on("click",function(){
|
|
|
|
+ $(".active").removeClass('active');
|
|
|
|
+ $(this).parent().addClass("active");
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function adjustHeight(){
|
|
|
|
+ var ht = window.innerHeight;
|
|
|
|
+ $(".content").height(ht-145+"px");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+})();
|