Forráskód Böngészése

药品说明书和诊断指南合并

zhangxc 6 éve
szülő
commit
dd712581a3
4 módosított fájl, 10 hozzáadás és 77 törlés
  1. 1 2
      src/html/drugInfo.html
  2. 0 70
      src/js/drugInfo.js
  3. 9 4
      src/js/information.js
  4. 0 1
      webpack.config.js

+ 1 - 2
src/html/drugInfo.html

@@ -135,7 +135,6 @@
         </div>
     </div>
 </div>
-<!-- <script src="./js/jquery-1.9.1.min.js"></script>
-<script src="./js/information.js"></script> -->
+<script src="./../js/information.js"></script>
 </body>
 </html>

+ 0 - 70
src/js/drugInfo.js

@@ -1,70 +0,0 @@
-import {post, imageUrlPrefix,getUrlArgObject,config, throttle} from './promise.js';
-(function(){
-    getInfomation();
-    function getInfomation(){
-      
-        var param = {
-            "type":  getUrlArgObject('type'),
-            "questionId":  getUrlArgObject('questionId'),
-            "position": getUrlArgObject('position')
-        };
-        post(config.information, param).then((res) => {
-            const data = res.data.data
-            var str='',anchors='',item='';
-            if(!data){
-                $("h1").html("暂时没有数据");
-                $(".anchors").css("display", "none");
-                return;
-            }
-            var list  = data.introduceDetailList;
-            $("h1").html(data.tagName);
-            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="#' + item.id +
-                    '">' + item.title + '</a></li><li class="anchor-line"></li>';
-                str = '<div class="title"><h2 id="' + item.id +
-                    '">' + '【'+ item.title + '】'+
-                    '</h2></div>' +
-                    '<div class="contentBox">' + item.content + '<div>';
-                $(".infos").append(str);
-                $(".anchors ul").append(anchors);
-            }
-            addLinkClickEvent();
-            adjustHeight();
-
-            function addScrollEvent() {
-                var scrollTop = $('.infos').scrollTop()
-                var divHeight = 0;
-                for (var i = 0; i < list.length; i++) {
-                    divHeight = divHeight + parseInt($('#' + list[i].id).css('height')) + parseInt($('#' + list[i].id).parent().next().css('height')) +40
-                    if(divHeight > scrollTop) {
-                        var anchor = 2*i
-
-                        $('.anchors ul').children().eq(anchor).addClass('active').siblings().removeClass('active')
-                        return
-                    }
-                }
-            }
-            $(".infos").scroll(throttle(addScrollEvent,200))
-
-        })
-
-
-    }
-
-
-    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");
-    }
-
-})();

+ 9 - 4
src/js/information.js

@@ -30,10 +30,15 @@ import {post, throttle, imageUrlPrefix, config, getUrlArgObject} from './promise
                 anchors = '<li><i></i><a href="#' + item.id +
                     '">' + item.title + '</a></li><li class="anchor-line"></li>';
                 str = '<div class="title"><h2 id="' + item.id +
-                    '">' + item.title +
-                    '</h2></div>' +
-                    '<div>' + item.content + '<div>';
-                if(i != list.length-1) {
+                    '">'
+                if(getUrlArgObject('type') == 8) {
+                    str += '【'+ item.title + '】'
+                } else {
+                    str +=  item.title 
+                }
+                str += '</h2></div>' +
+                '<div>' + item.content + '<div>';
+                if(i != list.length-1 && getUrlArgObject('type') != 8) {
                     str +=  '<div class="line"></div>'
                 }
                 $(".infos").append(str);

+ 0 - 1
webpack.config.js

@@ -10,7 +10,6 @@ module.exports = {
     index: path.resolve(__dirname, 'src', 'index.js'),
     page: path.resolve(__dirname, 'src', 'page.js'),
     information: path.resolve(__dirname, 'src/js', 'information.js'),
-    drugInfo: path.resolve(__dirname, 'src/js', 'drugInfo.js'),
     disclaimer: path.resolve(__dirname, 'src/js', 'disclaimer.js'),
     scale: path.resolve(__dirname, 'src/js', 'scale.js'),
     vendor: 'lodash', // 多个页面所需的公共库文件,防止重复打包带入