nav.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <style>
  2. .fl{
  3. float: left;
  4. }
  5. .fr{
  6. float: right;
  7. }
  8. .clearfix:after{
  9. content: '';
  10. display: block;
  11. clear: both;
  12. }
  13. .changeSubjectNav{
  14. position: fixed;
  15. width: 100%;
  16. box-sizing: border-box;
  17. top: 0;
  18. left: 0;
  19. z-index: 1000;
  20. display: flex;
  21. justify-content: space-between;
  22. align-items: center;
  23. padding: 10px 10px;
  24. background: #ddd;
  25. }
  26. .changeSubjectNav .productSettingBtn a{
  27. display: block;
  28. width: 120px;
  29. height: 30px;
  30. background: #01B677;
  31. text-align: center;
  32. line-height: 30px;
  33. color: #fff;
  34. font-size: 16px;
  35. text-decoration: none;
  36. cursor: text;
  37. }
  38. /*切换选择*/
  39. .tab-con{
  40. position: relative;
  41. height: 30px;
  42. width: 200px;
  43. background: #F2F2F2;
  44. border: 1px solid #01B677;
  45. border-radius: 15px;
  46. box-sizing: border-box;
  47. }
  48. .has-sel{
  49. background: #01B677;
  50. color: #fff;
  51. width: 50%;
  52. height: 30px;
  53. border-top-left-radius: 15px;
  54. border-bottom-left-radius: 15px;
  55. text-align: center;
  56. line-height: 30px;
  57. }
  58. .sel-opt{
  59. width: 50%;
  60. position: relative;
  61. color: #01B677;
  62. line-height: 30px;
  63. text-indent: 6px;
  64. cursor: pointer;
  65. }
  66. .sel-opt:after{
  67. content: '';
  68. border-left: 6px solid transparent;
  69. border-right: 6px solid transparent;
  70. border-top: 8px solid #01B677;
  71. position: absolute;
  72. right: 12px;
  73. top: 12px;
  74. }
  75. // .sel-opt select{
  76. // width: 100%;
  77. // height: 30px;
  78. // background: #F2F2F2;
  79. // color: #01B677;
  80. // text-indent: 6px;
  81. // font-size: inherit;
  82. // border-top-right-radius: 15px;
  83. // border-bottom-right-radius: 15px;
  84. // cursor: pointer;
  85. // }
  86. // .sel-opt select option{
  87. // position: relative;
  88. // }
  89. .points{
  90. position: absolute;
  91. top: -2px;
  92. right: 0;
  93. width: 10px;
  94. height: 10px;
  95. background: #F01516;
  96. border-radius: 50%;
  97. }
  98. .sel-cons{
  99. border: 1px solid #01B677;
  100. width: 50%;
  101. position: absolute;
  102. right: 0;
  103. top: 30px;
  104. text-indent: 10px;
  105. display: none;
  106. }
  107. .sc-lis2{
  108. line-height: 30px;
  109. cursor: pointer;
  110. }
  111. .sc-lis2 span{
  112. position: relative;
  113. }
  114. .sc-lis2 .points{
  115. top: 2px;
  116. right: -16px;
  117. }
  118. .subject-change{
  119. margin:8px 11px 0 0;display: block
  120. }
  121. .subject-change-no{
  122. margin:8px 11px 0 0;display: none
  123. }
  124. </style>
  125. <?php
  126. $sub_id = isset(Yii::app()->session['session_subject_id']) ? Yii::app()->session['session_subject_id']:0;
  127. $duo_sub_id = isset(Yii::app()->session['session_duoxueke_subject_id']) ? Yii::app()->session['session_duoxueke_subject_id']:0;
  128. $testFlag = isset(Yii::app()->session['testFlag'])?Yii::app()->session['testFlag']:0;
  129. $printType = isset($printType)?$printType:'';
  130. $subject = isset($subject)?$subject:array();
  131. $urlInfoAll = Yii::app()->request->getPathInfo();
  132. $urlInfo = '';
  133. if($urlInfoAll){
  134. $urlInfoArr = explode('/',$urlInfoAll);
  135. if(isset($urlInfoArr[0]) && isset($urlInfoArr[1])){
  136. $urlInfo = $urlInfoArr[0].'/'.$urlInfoArr[1];
  137. }
  138. $urlType = '';
  139. foreach ($urlInfoArr as $_url_k => $_url_v) {
  140. if ($_url_v == 'type' && isset($urlInfoArr[$_url_k + 1])) {
  141. $urlType = $urlInfoArr[$_url_k + 1];
  142. }
  143. }
  144. if(count($urlInfoArr) > 4){
  145. $urlInfoArr = array_slice($urlInfoArr,0,4);
  146. }
  147. $urlInfoAll = implode('/',$urlInfoArr);
  148. }
  149. $subjectNameArr = array(
  150. 3 => '数学',
  151. 8 => '英语',
  152. 9 => '语文',
  153. 12 => '物理',
  154. 13 => '化学',
  155. 14 => '生物',
  156. 15 => '政治',
  157. 16 => '历史',
  158. 17 => '地理',
  159. 18 => '理综',
  160. 19 => '文综',
  161. 21 => '日语',
  162. );
  163. ?>
  164. <div class="changeSubjectNav">
  165. <div class="productSettingBtn"> <a href="javascript:;">产品设置</a> </div>
  166. <div class="tabs clearfix">
  167. <div class="tab-con clearfix pull-right">
  168. <div class="has-sel fl"><?php echo isset(Yii::app()->params["subjectId"][$sub_id])?Yii::app()->params["subjectId"][$sub_id]:'数学'?></div>
  169. <div class="sel-opt fl">
  170. 切换学科
  171. </div>
  172. <div class="sel-cons" style="z-index:6;background-color: #fff;">
  173. <?php foreach ($subjectNameArr as $_subId => $_subName):?>
  174. <div class="sc-lis2" val="<?php echo $_subId;?>"><span><?php echo $_subName;?><?php if($subject && isset($subject[$_subId]) && !empty($subject[$_subId])){?><?php }?></span></div>
  175. <?php endforeach;?>
  176. </div>
  177. </div>
  178. </div>
  179. </div>
  180. <script type="text/javascript">
  181. $(document).ready(function() {
  182. $(".sel-opt,.sel-cons").mouseover(function () {
  183. $(".sel-cons").show();
  184. }).mouseout(function () {
  185. $(".sel-cons").hide();
  186. });
  187. $(".sc-lis2").click(function () {
  188. var sub_id = $(this).attr('val');
  189. var data = {
  190. subjectId: sub_id
  191. };
  192. $.post("<?php echo Yii::app()->createUrl('print/setSubjectId')?>", data, function (flags) {
  193. if (flags) {
  194. location.href = "<?php echo $this->createUrl('productset/index');?>";
  195. } else {
  196. alert('网络异常');
  197. }
  198. });
  199. $('.has-sel').text($(this).text());
  200. $(".sel-cons").hide();
  201. });
  202. });
  203. </script>