head_component.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="contenter">
  3. <div class="head-left">
  4. <img
  5. class="head-icon"
  6. src="@/assets/images/login/login-return.png"
  7. @click="backTo"
  8. alt="404"
  9. />
  10. </div>
  11. <!-- 等UI图更新继续画 <div>-->
  12. <div class="head-title">
  13. <div v-if="headinfo.title">{{ headinfo.title }}</div>
  14. </div>
  15. <div class="contrast-box">
  16. <img
  17. class="contrast"
  18. v-show="headinfo.contrast"
  19. src="@/assets/images/environment/contrast-btn.png"
  20. @click="contrastTo"
  21. />
  22. <p class="text" v-show="headinfo.contrast">{{ contrastSize }}</p>
  23. </div>
  24. <div class="head-right" v-if="!headinfo.isLogin">
  25. <div class="right-user">
  26. <img src="@/assets/images/wakeup/user.png" @click="gotoPersonCenter" alt="404" />
  27. </div>
  28. <el-button class="head-right-btn1" v-if="headinfo.isHome"
  29. >使用说明</el-button
  30. >
  31. <el-button class="head-right-btn1" v-else @click="homeUrlTo"
  32. >首页</el-button
  33. >
  34. <el-button class="head-right-btn2" @click="exit">退出登录</el-button>
  35. </div>
  36. </div>
  37. <!-- 等UI图更新继续画 <div>-->
  38. <!-- <div class="head-title">
  39. <div v-if="headinfo.title">{{ headinfo.title }}</div>
  40. </div>
  41. <div class="contrast-box">
  42. <img
  43. v-show="headinfo.contrast"
  44. class="contrast"
  45. src="@/assets/images/environment/contrast-btn.png"
  46. @click="contrastTo"
  47. />
  48. </div> -->
  49. <!-- <div class="head-right" v-if="!headinfo.isLogin">
  50. <div class="right-user">
  51. <img src="@/assets/images/wakeup/user.png" @click="backTo" alt="404" />
  52. </div>
  53. <el-button class="head-right-btn1" v-if="headinfo.isHome"
  54. >使用说明</el-button
  55. >
  56. <el-button class="head-right-btn1" v-else @click="homeUrlTo"
  57. >首页</el-button
  58. >
  59. <el-button class="head-right-btn2" @click="exit">退出登录</el-button>
  60. </div> -->
  61. </template>
  62. <script setup>
  63. import { ElMessage } from "element-plus";
  64. import { getCompareSize } from "@/api/xjc-integratedmachine/environment/common.js";
  65. import { defineEmits } from "vue";
  66. const { proxy } = getCurrentInstance();
  67. const router = useRouter();
  68. const props = defineProps({
  69. headinfo: {},
  70. });
  71. const contrastSize = ref(null);
  72. const emit = defineEmits(["childEvent"]);
  73. function backTo() {
  74. clear();
  75. if (props.headinfo.backUrlUse) {
  76. router.push({
  77. path: props.headinfo.backUrl,
  78. query: {
  79. code: props.headinfo.backQuery,
  80. },
  81. });
  82. } else {
  83. router.go(-1);
  84. }
  85. emit("childEvent");
  86. }
  87. function clear() {
  88. if (props.headinfo.contrastPage) {
  89. // clearData()
  90. }
  91. }
  92. function homeUrlTo() {
  93. router.push({
  94. path: props.headinfo.homeUrl,
  95. });
  96. }
  97. //跳转对比页面
  98. function contrastTo() {
  99. console.log("contrastSize.value", contrastSize.value);
  100. if (contrastSize.value === 2) {
  101. console.log("props.headinfo.contrastType", props.headinfo.contrastType);
  102. if (props.headinfo.contrastType === 2) {
  103. router.push({
  104. path: "/xjc-integratedmachine/environment/contrast_major",
  105. });
  106. } else if (props.headinfo.contrastType === 1) {
  107. router.push({
  108. path: "/xjc-integratedmachine/environment/contrast_university",
  109. });
  110. } else if (props.headinfo.contrastType === 3) {
  111. router.push({
  112. path: "/xjc-integratedmachine/environment/contrast_career",
  113. });
  114. }
  115. } else {
  116. ElMessage({
  117. type: "info",
  118. message: "对比列表不满两组数据",
  119. });
  120. return;
  121. }
  122. }
  123. function exit() {
  124. proxy.$modal
  125. .confirm("您确认退出吗")
  126. .then(function () {
  127. router.push({
  128. path: "/xjc_login",
  129. });
  130. })
  131. .then(() => {})
  132. .catch(() => {});
  133. }
  134. //拿到对比数量
  135. function getCompareSizeData(num) {
  136. console.log("num", num);
  137. setTimeout(() => {
  138. getCompareSize({
  139. type: props.headinfo.contrastType || num,
  140. }).then((resp) => {
  141. contrastSize.value = resp.data;
  142. });
  143. }, 500);
  144. }
  145. // 前往个人中心
  146. function gotoPersonCenter(){
  147. router.push({
  148. path: "/xjc-integratedmachine/personcenter/index",
  149. });
  150. }
  151. onMounted(() => {
  152. // getCompareSizeData()
  153. });
  154. defineExpose({
  155. getCompareSizeData,
  156. });
  157. </script>
  158. <style scoped lang="scss">
  159. .contenter {
  160. position: absolute;
  161. top: 0;
  162. left: 0;
  163. width: 100%;
  164. height: 100px;
  165. display: flex;
  166. align-items: center;
  167. background-color: rgba(251, 252, 253, 0.5);
  168. justify-content: space-between;
  169. .head-left {
  170. width: 750px;
  171. }
  172. .head-icon {
  173. width: 74px;
  174. height: 74px;
  175. margin-left: 74px;
  176. }
  177. .head-title {
  178. width: 464px;
  179. //margin: ;
  180. text-align: center;
  181. font-weight: bold;
  182. font-size: 48px;
  183. color: #060606;
  184. }
  185. .contrast-box {
  186. width: 209px;
  187. height: 80px;
  188. position: relative;
  189. img {
  190. width: 209px;
  191. height: 80px;
  192. }
  193. .text {
  194. position: absolute;
  195. bottom: 3px;
  196. left: 107px;
  197. font-size: 20px;
  198. color: #2bc17b;
  199. font-size: 20px;
  200. color: #2bc17b;
  201. line-height: 31px;
  202. bottom: -7px;
  203. }
  204. }
  205. .head-right {
  206. width: 750px;
  207. display: flex;
  208. justify-content: space-around;
  209. align-items: center;
  210. width: 464px;
  211. .head-right-btn1 {
  212. width: 136px;
  213. height: 74px;
  214. background: #2bc17b;
  215. border-radius: 10px 10px 10px 10px;
  216. font-weight: 400;
  217. font-size: 24px;
  218. color: #ffffff;
  219. }
  220. .head-right-btn2 {
  221. width: 136px;
  222. height: 74px;
  223. background: #fb5451;
  224. border-radius: 10px 10px 10px 10px;
  225. font-weight: 400;
  226. font-size: 24px;
  227. color: #ffffff;
  228. margin-right: 48px;
  229. }
  230. .right-user {
  231. cursor: pointer;
  232. img {
  233. width: 85px;
  234. height: 85px;
  235. }
  236. }
  237. }
  238. }
  239. </style>