login.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="ng-scope">
  3. <navbar :user="userInfo" @openLoginDialog="openLoginDialog"></navbar>
  4. <div class="banner-box">
  5. <div class="p-wrap-full clear pt30">
  6. <div class="training-category opacity-bg fl ">
  7. <img alt="" class="mimg" src="/static/swiper/1.jpg"/>
  8. </div>
  9. <div class="m-login opacity-bg fr">
  10. <is-login v-if="loginOk" :user="userInfo" @logout="logout"></is-login>
  11. <un-login v-else @login="login" :err="err"></un-login>
  12. </div>
  13. </div>
  14. </div>
  15. <div class="p-wrap-full mb20 ng-scope">
  16. <el-row :gutter="20" class="shadow p10 mt20" type="flex" >
  17. <el-col :span="16">
  18. <div class="training-category bg-white fl"
  19. style="border-radius: 15px;padding: 10px; background-color: white;" >
  20. <div style="display: flex;justify-content: center;align-items: center;width: 100%;text-align: center;color: #1D78F9;">
  21. <img style="width: 80px;height: 4px;margin-right: 14px;" src="../../../static/images/home_left.png">
  22. <h2 style="text-align: center;color: #1D78F9;">新闻通知</h2>
  23. <img style="width: 80px;height: 4px;margin-left: 14px;" src="../../../static/images/home_right.png">
  24. </div>
  25. <el-table :data="postList" highlight-current-row
  26. :show-header="false" min-height="310px" style="overflow: hidden;" >
  27. <el-table-column min-width="600px">
  28. <template slot-scope="{row, $index}">
  29. <span @click="gotoDetail(row.postId)">{{$index+1}}、{{ row.title }}</span>
  30. </template>
  31. </el-table-column>
  32. <el-table-column width="160px">
  33. <template slot-scope="{row}">
  34. <span>{{ row.publishTime }}</span>
  35. </template>
  36. </el-table-column>
  37. </el-table>
  38. </div>
  39. </el-col>
  40. <el-col :span="8">
  41. <div style="background-color: #fff;padding-top: 10px;height: 360px;" class="opacity-bg fr">
  42. <div style="display: flex;justify-content: center;align-items: center;">
  43. <img style="width: 80px;height: 4px;margin-right: 14px;" src="../../../static/images/home_left.png">
  44. <h2 style="text-align: center;color: #1D78F9;">证书查询</h2>
  45. <img style="width: 80px;height: 4px;margin-left: 14px;" src="../../../static/images/home_right.png">
  46. </div>
  47. <div style="margin-top: 50px;text-align: center; ">
  48. <el-button @click="gotoOutlink()" type="primary"> 前往证书查询 </el-button>
  49. </div>
  50. </div>
  51. </el-col>
  52. </el-row>
  53. </div>
  54. <el-dialog
  55. class="fc tc login-dialog"
  56. :visible.sync="loginDialog"
  57. :show-close='false'
  58. width="330px"
  59. style="padding:0px;"
  60. @close="closeDialog"
  61. >
  62. <div class="m-login" style="background: none;">
  63. <un-login @login="login" :err="err"></un-login>
  64. </div>
  65. </el-dialog>
  66. </div>
  67. </template>
  68. <script>
  69. import isLogin from "./components/isLogin.vue";
  70. import unLogin from "./components/unLogin.vue";
  71. import LearnTime from "./components/learnTime/learnTime.vue";
  72. import navbar from "@/components/nav/navbar.vue";
  73. import Friendlink from "./components/friendlink/friendlink.vue";
  74. import { httpServer } from "@/components/httpServer/httpServer.js";
  75. import { mapGetters,mapActions } from "vuex";
  76. import settings from "@/settings.js";
  77. export default {
  78. components: {
  79. LearnTime,
  80. isLogin,
  81. unLogin,
  82. Friendlink,
  83. navbar
  84. },
  85. data() {
  86. return {
  87. loginOk: false,
  88. periodObj: {
  89. userName: "",
  90. idNum: "",
  91. },
  92. postList:[],
  93. loginDialog: false,
  94. err: {},
  95. };
  96. },
  97. computed: {
  98. ...mapGetters("user", ["typeList", "userInfo"])
  99. },
  100. beforeMount(){
  101. if( this.userInfo && this.userInfo.token){
  102. this.loginOk = true
  103. }else{
  104. this.loginOk = false
  105. }
  106. },
  107. created(){
  108. this.getPostList()
  109. },
  110. methods: {
  111. ...mapActions("user", ["loadBaseInfo", "doLogout", "doLogin"]),
  112. logout() {
  113. this.doLogout().then( res=>{
  114. this.loginOk = false;
  115. } )
  116. },
  117. login(param, cb) {
  118. this.doLogin( param ).then( res => {
  119. if( !res ){
  120. this.err.loginErrorEnter = "登入失败"
  121. this.loginOk = false;
  122. cb &&cb()
  123. }else{
  124. this.loginOk = true;
  125. this.loginDialog = false;
  126. }
  127. })
  128. },
  129. getPostList(){
  130. httpServer("course.getPostList", {page:1,type:'操作指南', size:6}).then( res=>{
  131. this.postList = res.data.list.slice(0,6)
  132. })
  133. },
  134. gotoDetail(postId){
  135. this.$router.push({name:'news', query:{postId}})
  136. },
  137. gotoCourse(item){
  138. if ( !localStorage.token ) {
  139. this.$message.successMsg("请先登入", 1)
  140. return
  141. }
  142. if( !item.isOpen ){
  143. this.$message.errorMsg("暂未开放", 1)
  144. return
  145. }
  146. this.$router.push( {path:'/center/market', query:{type: item.name}})
  147. },
  148. closeDialog() {
  149. this.loginDialog = false;
  150. },
  151. gotoOutlink(){ window.open( settings.outLink, '_brank'); },
  152. openLoginDialog() {
  153. this.loginDialog = true
  154. },
  155. },
  156. };
  157. </script>
  158. <style>
  159. @import url("login.css");
  160. .floatbox{
  161. position: fixed;
  162. width: 160px;
  163. height: 60px;
  164. right: 60px;
  165. top: 90px;
  166. border-radius: 1.25rem;
  167. font-size: 30px !important;
  168. background-color: orange;
  169. line-height: 40px;
  170. text-align: center;
  171. color: #fff;
  172. }
  173. .right-nav {
  174. width: 135px;
  175. height: 180px;
  176. background-color: #8bbdf5;
  177. position: fixed;
  178. transition: bottom ease .9s;
  179. z-index: 0;
  180. right: 5%;
  181. top: 260px;
  182. text-align: center;
  183. border-radius: 5px;
  184. }
  185. .right-img {
  186. display: inline-block;
  187. border-radius: 30%;
  188. width: 80%;
  189. height: 64%;
  190. margin: 11px auto 0;
  191. }
  192. </style>