2
3

login_old.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <template>
  2. <div style="width: 100%; overflow: hidden; background-color: white">
  3. <div class="back-width">
  4. <div class="title_png"></div>
  5. <div class="login-body">
  6. <el-carousel arrow indicator-position="none" height="590px" :interval="20000">
  7. <el-carousel-item v-for="(img,index) in imgList" :key="index">
  8. <img style="width: 100%; height: 100%;" v-bind:src="img.url" >
  9. </el-carousel-item>
  10. </el-carousel>
  11. <section class="login">
  12. <el-card class="box-card" style="background:rgba(255,255,255,0.8)">
  13. <div slot="header" class="clearfix">
  14. <i class="el-icon-s-cooperation"></i>
  15. <span style="font-weight: bold; margin-left: 5px">登录</span>
  16. <!--<el-button style="float: right; padding: 3px 0" type="text">欢迎使用</el-button>-->
  17. </div>
  18. <!--<el-menu size="small"
  19. :default-active="activeIndex+''"
  20. @select="handleSelect"
  21. mode="horizontal">
  22. <el-menu-item index="0">
  23. <i class="el-icon-tickets"></i>
  24. <span><b>登录</b></span>
  25. </el-menu-item>
  26. </el-menu>-->
  27. <el-row :gutter="8">
  28. <el-col :span="13">
  29. <el-table :data="noticeList"
  30. size="mini" highlight-current-row stripe
  31. style="width: 100%; height: 145px;"
  32. :row-style="getRowstyle">
  33. <el-table-column prop="Name" label="通知通告" show-overflow-tooltip>
  34. <template slot-scope="scope">
  35. <el-link :href="getDownloadFile(scope.row.FileURL)"target="_blank"type="primary">{{ scope.row.Name }}</el-link>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="CreateOn"
  39. label="发布时间"
  40. width="141">
  41. <template slot-scope="scope">{{ jstimehandle(scope.row.CreateOn+'') }}</template>
  42. </el-table-column>
  43. <el-table-column width="80">
  44. <template slot-scope="scope"><span style="font-size: 15px; color: #f13f40">{{strnew(scope.row.CreateOn+'') }}</span></template>
  45. </el-table-column>
  46. </el-table>
  47. <router-link style="font-size: 15px; color: black; float: right; padding: 3px 0" :underline="false" :to="'/datadown'">+更多</router-link>
  48. <el-table :data="fileList"
  49. size="mini" highlight-current-row stripe
  50. style="width: 100%; height: 145px;"
  51. :row-style="getRowstyle">
  52. <el-table-column prop="Name" label="资料下载" show-overflow-tooltip>
  53. <template slot-scope="scope">
  54. <!--<i class="el-icon-caret-right"></i>-->
  55. <el-link :href="getDownloadFile(scope.row.FileURL)"
  56. target="_blank"
  57. type="primary">{{ scope.row.Name }}</el-link>
  58. </template>
  59. </el-table-column>
  60. <el-table-column prop="CreateOn"
  61. label="发布时间"
  62. width="141">
  63. <template slot-scope="scope">{{ jstimehandle(scope.row.CreateOn+'') }}</template>
  64. </el-table-column>
  65. <el-table-column width="80">
  66. <template slot-scope="scope"><span style="font-size: 15px; color: #f13f40">{{strnew(scope.row.CreateOn+'') }}</span></template>
  67. </el-table-column>
  68. </el-table>
  69. <router-link style="font-size: 15px;color: black; float: right; padding: 3px 0" :underline="false" :to="'/documentdown'">+更多</router-link>
  70. </el-col>
  71. <el-col :span="1" content-position="center">
  72. <div style="height: 300px; width: 1px; background-color: #cccccc; margin-left: 12px"></div>
  73. </el-col>
  74. <el-col :span="9">
  75. <el-form class="login-form"
  76. auto-complete="off"
  77. :model="model"
  78. :rules="rules"
  79. ref="user"
  80. label-position="left">
  81. <el-form-item style="margin-top:5px"
  82. label=""
  83. prop="username">
  84. <el-input prefix-icon="el-icon-user-solid"
  85. type="text" style="background:rgba(255,255,255,0.8)"
  86. v-model="model.username"
  87. placeholder="请输入用户名">
  88. <el-select v-model="loginMode"
  89. slot="append"
  90. placeholder="登录类型"
  91. style="width: 125px;">
  92. <el-option label="PTR认证"
  93. :value="2"></el-option>
  94. <el-option label="普通账户"
  95. :value="1"></el-option>
  96. </el-select>
  97. </el-input>
  98. </el-form-item>
  99. <el-form-item style="margin-top:20px"
  100. label=""
  101. prop="password">
  102. <el-input type="password"
  103. prefix-icon="el-icon-s-goods"
  104. v-model="model.password"
  105. placeholder="请输入密码" />
  106. </el-form-item>
  107. <el-row>
  108. <el-col :span="16">
  109. <el-form-item style="margin-top:10px"
  110. label=""
  111. prop="verifycode">
  112. <el-input v-model="model.verifycode"
  113. prefix-icon="el-icon-view"
  114. placeholder="请输入验证码"
  115. @keyup.enter.native="loginall()"></el-input>
  116. </el-form-item>
  117. </el-col>
  118. <el-col :span="8">
  119. <el-form-item>
  120. <div class="identifybox">
  121. <div @click="refreshCode"
  122. title="看不清,换一张">
  123. <s-identify :identifyCode="identifyCode"></s-identify>
  124. </div>
  125. <!-- <el-button @click="refreshCode" type='text' class="textbtn">看不清,换一张</el-button> -->
  126. </div>
  127. </el-form-item>
  128. </el-col>
  129. </el-row>
  130. <el-button type="primary"
  131. :loading="loading"
  132. @click="loginall()">{{ loading ? '登录中...' : '登录系统' }}</el-button>
  133. <el-row style="margin-top: 5px" :gutter="10">
  134. <el-col :span="12">
  135. <router-link :to="'/signup'">
  136. <el-button type="plain" style="background:rgba(255,255,255,0.8)">注册账号</el-button>
  137. </router-link>
  138. </el-col>
  139. <el-col :span="12">
  140. <router-link :to="'/passwordback'">
  141. <el-button type="plain" style="background:rgba(255,255,255,0.8)">忘记密码</el-button>
  142. </router-link>
  143. </el-col>
  144. </el-row>
  145. </el-form>
  146. </el-col>
  147. </el-row>
  148. </el-card>
  149. </section>
  150. </div>
  151. </div>
  152. <div >
  153. <footer class="login-footer" style="color:#A9A9A9;padding-bottom: 30px">
  154. <span style="font-size: 16px">技术支持:QQ群咨询,除特殊情况外,暂不提供电话支持<br></span>
  155. <span style="font-size: 16px">推荐使用谷歌浏览器、360浏览器(极速模式)等,Chrome内核浏览器打开本系统</span>
  156. </footer>
  157. </div>
  158. </div>
  159. </template>
  160. <script>
  161. import Vue from 'vue'
  162. import Component from 'class-component'
  163. import Sticky from '@/components/Sticky'
  164. import api from '@/api/rtxservice/rtx'
  165. import SIdentify from '@/components/VCode.vue'
  166. @Component({
  167. data () {
  168. const validateVerifycode = (rule, value, callback) => {
  169. if (value === '') {
  170. callback(new Error('请输入验证码'))
  171. } else if (value !== this.identifyCode) {
  172. callback(new Error('验证码不正确'))
  173. } else {
  174. callback()
  175. }
  176. }
  177. // form model
  178. // TODO: remove default values
  179. const model = {
  180. username: '',
  181. password: '',
  182. verifycode: ''
  183. }
  184. // form validate rules
  185. const rules = {
  186. username: [
  187. {
  188. required: true,
  189. trigger: 'blur',
  190. message: '请输入用户名'
  191. }
  192. ],
  193. password: [
  194. {
  195. required: true,
  196. trigger: 'blur',
  197. message: '请输入密码'
  198. }
  199. ],
  200. verifycode: [
  201. {
  202. required: true,
  203. trigger: 'blur',
  204. validator: validateVerifycode
  205. }
  206. ]
  207. }
  208. return {
  209. imgList:[
  210. {
  211. url:require('../assets/img/lunbo_1.jpg')
  212. },{
  213. url:require('../assets/img/GF002.png')
  214. },{
  215. url:require('../assets/img/GF003.png')
  216. },{
  217. url:require('../assets/img/lunbo_2.jpg')
  218. }
  219. ],
  220. loginMode: parseInt(process.client ? (window.localStorage.getItem('loginMode') ? window.localStorage.getItem('loginMode') : 2) : 2),
  221. model: model,
  222. rules: rules,
  223. error: null,
  224. loading: false,
  225. noticeList: [], // 通知列表
  226. fileList: [], // 文档列表
  227. activeName: 'first',
  228. activeIndex: '0',
  229. flag: 0,
  230. identifyCode: '',
  231. identifyCodes: '1234567890'
  232. }
  233. },
  234. // beforeCreate () {
  235. // if (process.client) {
  236. // const myDomain = window.location.host
  237. // if (myDomain.indexOf('60.30.245.229') > -1) {
  238. // window.location.href = 'http://60.30.245.229/loginclient/'
  239. // }
  240. // }
  241. // },
  242. created () {
  243. this.initNoticeListData()
  244. this.initFileListData()
  245. this.identifyCode = ''
  246. this.makeCode(this.identifyCodes, 4)
  247. },
  248. components: {
  249. Sticky,
  250. SIdentify
  251. },
  252. methods: {
  253. getRowstyle () {
  254. return 'background:rgba(255,255,255,0.8)'
  255. },
  256. // 生成随机数
  257. randomNum (min, max) {
  258. return Math.floor(Math.random() * (max - min) + min)
  259. },
  260. // 切换验证码
  261. refreshCode () {
  262. this.identifyCode = ''
  263. this.makeCode(this.identifyCodes, 4)
  264. },
  265. // 生成四位随机验证码
  266. makeCode (o, l) {
  267. for (let i = 0; i < l; i++) {
  268. this.identifyCode += this.identifyCodes[this.randomNum(0, this.identifyCodes.length)]
  269. }
  270. },
  271. // 获取通知列表
  272. initNoticeListData () {
  273. let _this = this
  274. // 传递列名
  275. const params = {
  276. colName: 'NoticeTab',
  277. RangeType: '1,3'
  278. }
  279. _this.$axios
  280. .get('/document/getdocumentnameandtimelogin', { params })
  281. .then(function (response) {
  282. _this.noticeList = response.data
  283. })
  284. .catch(function (error) {
  285. console.log(error)
  286. })
  287. },
  288. // 获取文件列表
  289. initFileListData () {
  290. let _this = this
  291. // 传递列名
  292. const params = {
  293. colName: 'DocTab',
  294. RangeType: '1,3'
  295. }
  296. _this.$axios
  297. .get('/document/getdocumentnameandtimelogin', { params })
  298. .then(function (response) {
  299. _this.fileList = response.data
  300. })
  301. .catch(function (error) {
  302. console.log(error)
  303. })
  304. },
  305. // 下载文件
  306. DownloadFile (row) {
  307. let val = row.FileURL
  308. let urlArr = val.split('|')
  309. location.href = 'http://' + urlArr[0]
  310. },
  311. getDownloadFile (val) {
  312. let urlArr = val.split('|')
  313. let retUrl = urlArr[0]
  314. // 内网服务器专用
  315. if (process.client && retUrl.indexOf('/upfile') === 0) {
  316. const myDomain = window.location.host
  317. retUrl = myDomain + '/' + retUrl
  318. }
  319. return 'http://' + retUrl
  320. },
  321. // 格式化时间
  322. jstimehandle (val) {
  323. if (val === '') {
  324. return '----'
  325. } else if (val === '0001-01-01T08:00:00+08:00') {
  326. return '----'
  327. } else if (val === '5000-01-01T23:59:59+08:00') {
  328. return '永久'
  329. } else {
  330. val = val.replace('T', ' ')
  331. return val.substring(0, 10)
  332. }
  333. },
  334. strnew (val) {
  335. try {
  336. let b = this.jstimehandle(val).split('-')
  337. let date = new Date(b[0], b[1], b[2])
  338. let newdate = new Date()
  339. if ((newdate - date) / (1000 * 60 * 60 * 24) < 30) {
  340. return '新'
  341. } else {
  342. return ''
  343. }
  344. } catch (e) {
  345. return ''
  346. }
  347. },
  348. handleSelect (key, keyPath) {
  349. this.activeIndex = key
  350. },
  351. isChrome () {
  352. // 取得浏览器的userAgent字符串
  353. let userAgent = navigator.userAgent
  354. // 判断是否Chrome浏览器
  355. if (userAgent.indexOf('Chrome') > -1) {
  356. return true
  357. } else {
  358. return false
  359. }
  360. },
  361. loginall () {
  362. if (process.client) {
  363. window.localStorage.setItem('loginMode', this.loginMode)
  364. }
  365. if (this.loginMode === 1) {
  366. this.login()
  367. } else {
  368. this.$refs.user.validate((valid) => {
  369. if (valid) {
  370. this.loginptr()
  371. }
  372. })
  373. }
  374. },
  375. loginptr () {
  376. let params = {
  377. username: this.model.username,
  378. password: this.model.password
  379. }
  380. api
  381. .rtxLogin(params, this.$axios)
  382. .then(res => {
  383. if (res.data.items === 1) {
  384. this.flag = 1
  385. this.login()
  386. } else if (res.data.items === 2) {
  387. this.flag = 2
  388. this.login()
  389. } else if (res.data.items === 3) {
  390. this.$message.error({
  391. duration: 10000,
  392. message: '您无权限登陆本系统'
  393. })
  394. } else {
  395. this.$message.error({
  396. duration: 10000,
  397. message: '账号或密码错误'
  398. })
  399. }
  400. this.identifyCode = ''
  401. this.makeCode(this.identifyCodes, 4)
  402. })
  403. .catch(err => {
  404. this.$message.error({
  405. duration: 10000,
  406. message: '账号或密码错误'
  407. })
  408. console.error(err)
  409. this.identifyCode = ''
  410. this.makeCode(this.identifyCodes, 4)
  411. })
  412. }
  413. }
  414. })
  415. export default class Login extends Vue {
  416. layout () {
  417. return 'empty'
  418. }
  419. login () {
  420. if (!this.isChrome()) {
  421. this.$alert(
  422. '请用谷歌浏览器、360浏览器(极速模式)等,Chrome内核浏览器打开本系统',
  423. '不支持的浏览器',
  424. {}
  425. )
  426. return false
  427. }
  428. this.logging = true
  429. this.$refs.user.validate(async valid => {
  430. try {
  431. if (valid) {
  432. await this.$store.dispatch('auth/login', {
  433. fields: {
  434. username: this.model.username.replace(/(^\s*)|(\s*$)/g, ''),
  435. password: this.model.password.replace(/(^\s*)|(\s*$)/g, ''),
  436. flag: this.flag
  437. }
  438. })
  439. if (process.env.appclient === 'lims') {
  440. this.$router.push(this.$route.query.page || '/')
  441. } else if (process.env.appclient === 'cellbank') {
  442. this.$router.push(this.$route.query.page || '/indexdqm')
  443. } else {
  444. this.$router.push(this.$route.query.page || '/')
  445. }
  446. }
  447. } catch (e) {
  448. if (e.response.status === 777) {
  449. this.$message({
  450. showClose: true,
  451. message: '您无权限登录本系统',
  452. type: 'warning',
  453. duration: 5000
  454. })
  455. } else {
  456. this.$message({
  457. showClose: true,
  458. message: '账号或密码错误',
  459. type: 'warning',
  460. duration: 5000
  461. })
  462. }
  463. this.identifyCode = ''
  464. this.makeCode(this.identifyCodes, 4)
  465. } finally {
  466. this.logging = false
  467. }
  468. })
  469. }
  470. logout () {
  471. this.$store.dispatch('logout')
  472. }
  473. }
  474. </script>
  475. <style lang="scss" scoped>
  476. @import "../assets/styles/base/variables";
  477. .el-form-item {
  478. margin-bottom: 10px;
  479. }
  480. .identifybox {
  481. margin-top: 12px;
  482. margin-left: 20px;
  483. }
  484. .identifybox:hover {
  485. cursor: pointer;
  486. }
  487. .components-container-my div {
  488. margin-top: 20px;
  489. }
  490. .top-wrapper {
  491. margin: 0px auto;
  492. width: 1004px;
  493. /*text-align: right;
  494. alignment: right;*/
  495. flex-direction: row;
  496. }
  497. .home-wrapper-my {
  498. margin: 0px auto;
  499. width: 1004px;
  500. flex-direction: column;
  501. margin-bottom: 45px;
  502. }
  503. .foot-wrapper {
  504. margin: 0px auto;
  505. width: 1004px;
  506. display: flex;
  507. alignment: center;
  508. align-items: center;
  509. flex-direction: column;
  510. }
  511. .back-width1 {
  512. background-color: #2f79f6;
  513. margin: 0px auto;
  514. left: 0;
  515. right: 0;
  516. top: 20px;
  517. width: 1004px;
  518. }
  519. .login-footer1 {
  520. position: fixed;
  521. background-color: #34393d;
  522. font-size: 10px;
  523. clear: both;
  524. display: block;
  525. text-align: center;
  526. margin: 0px auto;
  527. bottom: 0px;
  528. width: 100%;
  529. }
  530. /*-----------*/
  531. .time {
  532. font-size: 13px;
  533. color: #999;
  534. }
  535. .bottom {
  536. margin-top: 13px;
  537. line-height: 12px;
  538. }
  539. .button {
  540. padding: 0;
  541. float: right;
  542. }
  543. .image {
  544. width: 100%;
  545. display: block;
  546. }
  547. .clearfix:before,
  548. .clearfix:after {
  549. display: table;
  550. content: "";
  551. }
  552. .clearfix:after {
  553. clear: both;
  554. }
  555. .back-width {
  556. position: absolute;
  557. background-color: white;
  558. left: 0;
  559. right: 0;
  560. top: -135px;
  561. bottom: 0;
  562. margin: auto;
  563. width: 100%;
  564. height: 675px;
  565. }
  566. .title_png {
  567. background: url("../assets/img/title_login.png");
  568. font-family: "Open Sans", sans-serif;
  569. background-repeat: no-repeat;
  570. background-position: center;
  571. height: 135px;
  572. width: 100%;
  573. }
  574. .login-body {
  575. // background: url("../assets/img/gf20190715.png");
  576. // font-family: "Open Sans", sans-serif;
  577. // background-repeat: no-repeat;
  578. // background-position: center;
  579. // background-color: #0483d8;
  580. width: 100%;
  581. height: 580px;
  582. z-index: -20;
  583. /*margin: auto;
  584. left: 0px;
  585. top: 0px;
  586. right: 0;
  587. bottom: 0;
  588. width: 100%;
  589. height: calc(100vh - 40px);*/
  590. }
  591. .el-carousel{
  592. width: 100%;
  593. }
  594. .login-footer {
  595. font-size: 10px;
  596. clear: both;
  597. display: block;
  598. text-align: center;
  599. margin: 0px auto;
  600. position: absolute;
  601. bottom: 11px;
  602. width: 100%;
  603. a {
  604. color: $brand-color;
  605. }
  606. }
  607. .login {
  608. position: relative;
  609. max-width: 52rem;
  610. margin: 0 auto; /*水平居中*/
  611. top: -280px; /*偏移*/
  612. transform: translateY(-50%);
  613. font-size: 0.875rem;
  614. opacity: 1;
  615. z-index: 200;
  616. &-header {
  617. margin-bottom: 1rem;
  618. .brand {
  619. margin: 4.5rem 0 3.5rem;
  620. text-align: center;
  621. letter-spacing: 0.125rem;
  622. a {
  623. margin: 0;
  624. color: $brand-color;
  625. font: 300 3rem sans-serif;
  626. &:hover {
  627. color: $brand-hover-color;
  628. text-shadow: 0 0 1rem $brand-hover-color;
  629. }
  630. }
  631. }
  632. }
  633. &-form {
  634. /*margin-bottom: 2.5rem;
  635. padding: 1.875rem 1.25rem;
  636. background: $login-form-background;*/
  637. color: $login-form-color;
  638. /*.heading {
  639. margin: 0 0 1rem;
  640. font-weight: 400;
  641. font-size: 1.5rem;
  642. }*/
  643. .el-button {
  644. margin-top: 0.5rem;
  645. width: 100%;
  646. }
  647. }
  648. .el-table,
  649. .el-table__expanded-cell {
  650. background-color: rgba(255,255,255,0.8)
  651. }
  652. }
  653. </style>