Login.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. <template>
  2. <div>
  3. <div class="login" v-if="!bindingqywx">
  4. <div class="login-par">
  5. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-position="left" label-width="0px" class="demo-ruleForm login-container">
  6. <div class="login-logo">
  7. <img src="../assets/image/login_logo.png" style="width:80px;height:80px;"/>
  8. </div>
  9. <h3 class="title">{{ $t('workingHoursHousekeeper') }}</h3>
  10. <el-form-item class="login-input" prop="username">
  11. <el-input type="text" v-model="ruleForm.username" autocomplete="off" :placeholder="$t('zhang-hao-shou-ji-hao')" clearable prefix-icon="el-icon-user-solid"></el-input>
  12. </el-form-item>
  13. <el-form-item class="login-input" prop="password">
  14. <el-input type="password" v-model="ruleForm.password" @keyup.enter.native="handleSubmit" autocomplete="off" :placeholder="$t('mi-ma')" show-password prefix-icon="el-icon-lock"></el-input>
  15. </el-form-item>
  16. <el-form-item class="login-button" style="width:100%;">
  17. <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit" :loading="logining">{{ $t('login') }}</el-button>
  18. </el-form-item>
  19. <div class="additional" v-if="wxHrefFlg">
  20. <el-divider content-position="center">或</el-divider>
  21. </div>
  22. <div class="externalLanding" v-if="wxHrefFlg">
  23. <div class="externalLanding_img" @click="wxworkCli()">
  24. <img src="../assets/image/qiyeweix.png" alt="">
  25. </div>
  26. </div>
  27. <div class="toRegister">
  28. <el-link type="primary" class="btn" style="float:left;" :underline="false">{{ $t('lian-xi-ke-fu') }}
  29. <div class="service">
  30. <p style="color: #333">{{ $t('sao-ma-jia-ke-fu-wei-xin') }}</p>
  31. <img src="../assets/image/code.jpg">
  32. <p><span style="color: #333">QQ:</span><span id="QQ">3052894409</span></p>
  33. </div>
  34. </el-link>
  35. <el-link type="primary" style="margin-right:5px;" @click="dialogVisible=true" :underline="false">
  36. {{ $t('shi-yong-shuo-ming') }} </el-link>
  37. <el-link type="primary" v-if="!isCorpWX" @click="jumpTo" :underline="false">{{ $t('qi-ye-zhu-ce') }}</el-link>
  38. </div>
  39. </el-form>
  40. </div>
  41. <el-dialog :title="$t('shi-yong-shuo-ming')" :visible.sync="dialogVisible" width="500px">
  42. <p><a style="color:#409EFF;text-decoration:none" href="upload/工时管家使用说明_基础版.docx" download="工时管家使用说明_基础版.docx"
  43. target="_blank">工时管家使用说明_基础版.docx</a></p>
  44. <p><a style="color:#409EFF;text-decoration:none" href="upload/工时管家使用说明_项目管理专业版.docx" download="工时管家使用说明_项目管理专业版.docx"
  45. target="_blank">工时管家使用说明_项目管理专业版.docx</a></p>
  46. <p><a style="color:#409EFF;text-decoration:none" href="upload/工时管家使用说明_建筑工程专业版.docx" download="工时管家使用说明_建筑工程专业版.docx"
  47. target="_blank">工时管家使用说明_建筑工程专业版.docx</a></p>
  48. <!-- <p><a style="color:#409EFF;text-decoration:none" href="upload/工时管家使用说明_项目经理.docx" download="工时管家使用说明_项目经理.docx"
  49. target="_blank">工时管家使用说明_项目经理.docx</a></p>
  50. <p><a style="color:#409EFF;text-decoration:none" href="upload/工时管家使用说明_普通员工.docx" download="工时管家使用说明_普通员工.docx"
  51. target="_blank">工时管家使用说明_普通员工.docx</a></p> -->
  52. </el-dialog>
  53. <el-dialog title="企业微信扫码登陆" :visible.sync="wxworkFlg" width="500px">
  54. <div>
  55. <div id="wxcode"></div>
  56. </div>
  57. </el-dialog>
  58. </div>
  59. <!-- 绑定企业微信的话显示这个 -->
  60. <div class="qiweix" v-if="bindingqywx">
  61. 正在进入系统...
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import * as dd from 'dingtalk-jsapi';
  67. import "../permissions.js"
  68. import WxLogin from "../assets/js/wwLogin.js"
  69. export default {
  70. inject:['reloads'],
  71. data() {
  72. return {
  73. isCorpWX: false,
  74. dialogVisible: false,
  75. logining: false,
  76. // 登录信息
  77. ruleForm: {
  78. username: '',
  79. password: ''
  80. },
  81. rules: {
  82. username: [{ required: true, message: this.$t('peaseenterthe'), trigger: 'blur' },],
  83. password: [{ required: true, message: this.$t('peaseenterthe'), trigger: 'blur' },]
  84. },
  85. wxworkFlg: false,
  86. bindingqywx: false,
  87. wxHrefFlg: false
  88. };
  89. },
  90. watch: {
  91. $route(to) {
  92. if (to.query.code) {
  93. this.getStaffInfo(to.query.code)
  94. }
  95. }
  96. },
  97. created() {
  98. // this.langChange()
  99. if (localStorage.userInfo != null) {
  100. var user = JSON.parse(localStorage.userInfo);
  101. if(user.moduleList.length > 0) {
  102. this.$router.push({ path: user.moduleList[0].path })
  103. }
  104. }
  105. let windowHerf = window.location.href
  106. if(windowHerf.indexOf('?jobNumber') != '-1') {
  107. let jobNumber = windowHerf.split('jobNumber=')[1].split('&token=')[0]
  108. let token = windowHerf.split('&token=')[1]
  109. this.automaticLogin(jobNumber, token)
  110. }
  111. // 用户绑定了企业微信 和 飞书
  112. if(windowHerf.indexOf('userId') != '-1' || windowHerf.indexOf('appId') != '-1') {
  113. this.bindingqywx = true
  114. }
  115. },
  116. mounted() {
  117. // this.wxworkCli()
  118. var ua = navigator.userAgent.toLowerCase();
  119. console.log(ua, '打印出来')
  120. if (ua.indexOf("wxwork") > 0) {
  121. this.isCorpWX = true;
  122. }
  123. let href = window.location.href;
  124. this.wxHrefFlg = href.indexOf('//worktime.ttkuaiban.com') != '-1'
  125. if (this.isCorpWX) {
  126. //企业微信环境下,尝试自动登录
  127. //判断企业微信,是否存在授权
  128. //尝试自动登录
  129. if (href.indexOf('hasTriedAutoLogin') == -1) {
  130. this.tryAutoLogin();
  131. } else if (href.indexOf("userId") > 0) {
  132. //后台经过验证后,重定向过来带上了userId
  133. var loginUserId = href.substring(href.indexOf("userId=")+"userId=".length);
  134. if (loginUserId.includes('#/')) {
  135. loginUserId = loginUserId.substring(0, loginUserId.indexOf('#/'));
  136. }
  137. if (loginUserId.includes('&')) {
  138. loginUserId = loginUserId.substring(0, loginUserId.indexOf('&'));
  139. }
  140. var path = null;
  141. if (href.indexOf('path') > 0) {
  142. path = href.split('path=')[1].split('&')[0];
  143. }
  144. this.loginByUserId(loginUserId, path);
  145. } else {
  146. if (localStorage.userInfo != null) {
  147. var user = JSON.parse(localStorage.userInfo);
  148. if (user.company.packageSimple == 1) {
  149. //简易模式,直接进入工时统计表
  150. this.$router.push({ path: '/simple' });
  151. } else {
  152. if(user.moduleList.length > 0) {
  153. this.$router.push({ path: user.moduleList[0].path })
  154. } else {
  155. //没有授权任何模块,需要提示用户
  156. alert('无权访问,请联系管理员为您分配权限');
  157. }
  158. }
  159. } else if (href.indexOf('errorMsg=') > 0) {
  160. var errorMsg = href.split('errorMsg=')[1].split('#')[0];
  161. errorMsg = decodeURI(errorMsg);
  162. this.$message({
  163. message: errorMsg,
  164. type: 'error'
  165. });
  166. }
  167. }
  168. } else {
  169. //浏览器上使用扫码登录
  170. if (href.indexOf("userId") > 0) {
  171. //后台经过验证后,重定向过来带上了userId
  172. var loginUserId = href.substring(href.indexOf("userId=")+"userId=".length);
  173. if (loginUserId.includes('#/')) {
  174. loginUserId = loginUserId.substring(0, loginUserId.indexOf('#/'));
  175. }
  176. if (loginUserId.includes('&')) {
  177. loginUserId = loginUserId.substring(0, loginUserId.indexOf('&'));
  178. }
  179. var path = null;
  180. if (href.indexOf('path') > 0) {
  181. path = href.split('path=')[1].split('&')[0];
  182. }
  183. this.loginByUserId(loginUserId, path);
  184. } else if (localStorage.userInfo != null) {
  185. var user = JSON.parse(localStorage.userInfo);
  186. if (user.company.packageSimple == 1) {
  187. //简易模式,直接进入工时统计表
  188. this.$router.push({ path: '/simple' });
  189. } else {
  190. if(user.moduleList.length > 0) {
  191. this.$router.push({ path: user.moduleList[0].path })
  192. } else {
  193. //没有授权任何模块,需要提示用户
  194. alert('无权访问,请联系管理员为您分配权限');
  195. }
  196. }
  197. } else {
  198. if(href.indexOf("corpid") > 0) {
  199. // 钉钉登陆
  200. //检查环境,如果是钉钉有$CORPID$
  201. var key = '?corpid=';
  202. var jumpkey = '&jumpto=';
  203. var url = location.href;
  204. console.log('jumpto',location);
  205. // var url = "https://worktime.ttkuaiban.com/?corpid=$CORPID$&jumpto=/info/21#/index"
  206. var that = this;
  207. if (url.indexOf(key) > 0) {
  208. var corpId = ''
  209. var jumpurl = ''
  210. if(url.indexOf(jumpkey) > 0){
  211. corpId = url.substring(url.indexOf(key)+key.length,url.indexOf(jumpkey));
  212. jumpurl = url.substring(url.indexOf(jumpkey)+jumpkey.length,url.indexOf('#'));
  213. }else{
  214. corpId = url.substring(url.indexOf(key)+key.length,url.indexOf('#'));
  215. }
  216. dd.ready(function() {
  217. that.isDingchg()
  218. dd.runtime.permission.requestAuthCode({
  219. corpId: corpId, // 企业id
  220. onSuccess: function (info) {
  221. var code = info.code // 通过该免登授权码可以获取用户身份
  222. that.loginByCode(code, corpId, jumpurl);
  223. }});
  224. });
  225. }
  226. } else {
  227. // 飞书登陆
  228. if(href.indexOf("appId") > 0) {
  229. console.log('执行到这里---飞书')
  230. let arr = href.split('appId=')[1]
  231. let str = arr.split('#')[0]
  232. console.log(str, window)
  233. window.h5sdk.ready(() => { // ready方法不需要每次都调用
  234. tt.requestAuthCode({
  235. appId: str,
  236. success: (info) => {
  237. console.info(info.code, '飞书 code')
  238. this.flyingBook(str, info.code)
  239. },
  240. fail: (error) => {
  241. console.error(error)
  242. }
  243. });
  244. });
  245. }
  246. }
  247. }
  248. }
  249. let urls = window.location.href
  250. console.log(urls, '连接')
  251. if(urls.indexOf('english=1') != '-1' && localStorage.getItem('lang') != 'en') {
  252. this.setlangChange()
  253. location.reload()
  254. }
  255. if(urls.indexOf('english=1') == '-1' && localStorage.getItem('lang') != 'zh') {
  256. localStorage.setItem("lang", 'zh')
  257. location.reload()
  258. }
  259. },
  260. methods: {
  261. wxworkCli() {
  262. // this.wxworkFlg = true
  263. // this.$nextTick(()=>{
  264. // var obj = new WxLogin({
  265. // id: 'wxcode', // 登录页面显示二维码的容器id
  266. // appid: 'wwf11426cf618e1703', // 企业微信的CorpID,在企业微信管理端查看
  267. // redirect_uri: encodeURIComponent('http://localhost:10086/#/login'), // 重定向的地址,需要进行encode
  268. // usertype: 'member'
  269. // })
  270. // })
  271. var appId = "wwf11426cf618e1703";//企业微信第三方的SUIT ID
  272. var url = "https://worktime.ttkuaiban.com/api/corpWXScanningAuth";//授权回调页面
  273. var weixinUrl=`https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid=${appId}&redirect_uri=${url}&state=0&usertype=member`;
  274. window.location.href = weixinUrl;
  275. },
  276. getStaffInfo() {
  277. console.log('执行了没')
  278. },
  279. setlangChange() {
  280. localStorage.setItem("lang", 'en')
  281. },
  282. langChange() {
  283. let jsSrc =(navigator.language || navigator.browserLanguage).toLowerCase();
  284. let str = localStorage.getItem("lang")
  285. if(jsSrc.indexOf('zh')!=-1){
  286. // 浏览器语言是中文
  287. localStorage.setItem("lang", 'zh')
  288. // localStorage.setItem("lang", 'en')
  289. } else {
  290. // 浏览器语言是英文
  291. localStorage.setItem("lang", 'en')
  292. // localStorage.setItem("lang", 'zh')
  293. }
  294. if(str != localStorage.getItem("lang")) {
  295. // this.reloads()
  296. location.reload()
  297. }
  298. console.log(str, localStorage.getItem("lang"))
  299. },
  300. isDingchg() {
  301. this.$store.commit('isDingFun')
  302. },
  303. bindIfNessary() {
  304. let href = window.location.href;
  305. if (this.isCorpWX) {
  306. // localStorage.openId = 'o1L3L5lOrOl3_UEJjONaoT2Rne1I';
  307. //会自动跳转到首页
  308. // let href = 'http://hq.tangusoft.com/?code=011Ptjgc2rx1eI09Irgc2Rvsgc2PtjgF&state=1#/index';
  309. if (href.includes("com/?code")) { //url包括 com/?code 证明为从微信跳转回来的
  310. var url = href; //vue自动在末尾加了 #/ 符号,截取去掉
  311. var jingPosit = url.indexOf("com/") + 4; //获取域名结束的位置
  312. // var urlLeft = url.substring(0, jingPosit);//url左侧部分
  313. var urlRight = url.substring(jingPosit, url.length); //url右侧部分
  314. console.log('urlRight=' + urlRight);
  315. urlRight = urlRight.substring(0, urlRight.indexOf('#/'));
  316. // window.location = urlLeft + "#/home" + urlRight;//拼接跳转
  317. //获取code
  318. var code = urlRight.substring('?code='.length,urlRight.indexOf('&state='));
  319. var passUserId = urlRight.substring(urlRight.indexOf('&state=')+'&state='.length);
  320. if (passUserId == '1') {
  321. //自动登录的回调
  322. this.$axios.get('/wxcorp/corpWeiXinLogin', {params:{code:code}})
  323. .then(res => {
  324. if (res == null) {
  325. } else if(res.errcode != null) {
  326. //报错了
  327. console.log(res.errmsg);
  328. } else {
  329. //获取openId
  330. if (res.data != null && ((this.isWX && res.data.wxOpenid != undefined)
  331. || (this.isCorpWX && res.data.corpwxUserid != undefined))) {
  332. localStorage.userInfo = JSON.stringify(res.data);
  333. console.log('登录成功');
  334. this.user = res.data;
  335. this.permissionsList(res.data)
  336. window.location.href = '/#/index';
  337. }
  338. }
  339. }).catch(err=> {
  340. alert('err=' + err);
  341. });
  342. } else {
  343. }
  344. }
  345. }
  346. },
  347. tryAutoLogin() {
  348. var appId = "ww4e237fd6abb635af";//企业微信第三方的SUIT ID
  349. var url = "https://worktime.ttkuaiban.com/api/corpWXAuth";//授权回调页面
  350. var weixinUrl="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+encodeURI(url)+"&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
  351. window.location.href = weixinUrl;
  352. },
  353. loginByUserId(userId, path) {
  354. this.http.post("/user/loginByUserId", {userId:userId} , res => {
  355. if (res.code == "ok") {
  356. var user = res.data;
  357. localStorage.user = JSON.stringify(res.data);
  358. sessionStorage.setItem('user', JSON.stringify(res.data));
  359. this.permissionsList(res.data)
  360. if(user.moduleList.length > 0) {
  361. if (path) {
  362. var action = '';
  363. //url上传来的格式
  364. if (path.includes('projectInside')) {
  365. //跳转进入项目的任务看板
  366. path = decodeURIComponent(path);
  367. console.log('pppp='+path);
  368. if (path.includes('@adjustBudget-')) {
  369. //需要打开分组预估工时设置
  370. action = path.split('@')[1];
  371. path = path.split('@')[0];
  372. }
  373. }
  374. console.log('action==='+action);
  375. sessionStorage.action = action
  376. this.$router.push({ path: path})
  377. } else {
  378. this.$router.push({ path: user.moduleList[0].path })
  379. }
  380. if (!path) {
  381. path = user.moduleList[0].path;
  382. }
  383. //去掉链接上存在的参数
  384. if (location.href.indexOf("?")>0) {
  385. var newHref = location.href.split("?")[0] + '#' + (path.indexOf('/')>-1?path:('/'+path));
  386. location.href = newHref;
  387. }
  388. } else {
  389. //没有授权任何模块,需要提示用户
  390. alert('无权访问,请联系管理员为您分配权限');
  391. }
  392. } else {
  393. this.$message({
  394. message: res.msg,
  395. type: 'error'
  396. });
  397. }
  398. }, error => {
  399. this.$message({
  400. message: error,
  401. type: 'error'
  402. });
  403. })
  404. },
  405. loginByCode(code, corpId, jumpurl) {
  406. this.http.post("/dingding/getUserByCode", {code:code, corpid:corpId} , res => {
  407. if (res.code == "ok") {
  408. var user = res.data;
  409. localStorage.user = JSON.stringify(res.data);
  410. sessionStorage.setItem('user', JSON.stringify(res.data));
  411. this.permissionsList(res.data)
  412. if(jumpurl){
  413. this.$router.push({ path: jumpurl })
  414. }else if(user.moduleList.length > 0) {
  415. this.$router.push({ path: user.moduleList[0].path })
  416. }else {
  417. //没有授权任何模块,需要提示用户
  418. alert('无权访问,请联系管理员为您分配权限');
  419. }
  420. } else {
  421. this.$message({
  422. message: res.msg,
  423. type: 'error'
  424. });
  425. }
  426. }, error => {
  427. this.$message({
  428. message: error,
  429. type: 'error'
  430. });
  431. })
  432. },
  433. handleReset2() {
  434. this.$refs.ruleForm.resetFields();
  435. },
  436. jumpTo() {
  437. this.$router.push({ path: '/register' });
  438. },
  439. handleSubmit(ev) {
  440. this.$refs.ruleForm.validate((valid) => {
  441. if (valid) {
  442. var _this = this;
  443. this.logining = true;
  444. setTimeout(function () {
  445. _this.logining = false;
  446. // console.log('执行')
  447. }, 15000);
  448. this.http.post(this.port.manage.login, this.ruleForm , res => {
  449. this.logining = false;
  450. if (res.code == "ok") {
  451. if(res.data.moduleList.length == 0){
  452. this.$message({
  453. message: this.$t('qing-lian-xi-guan-li-yuan-wei')+'\u3000' + res.data.roleName + '\u3000'+this.$t('assignpermissions'),
  454. type: 'error'
  455. })
  456. return
  457. }
  458. var user = res.data;
  459. sessionStorage.setItem('user', JSON.stringify(res.data));
  460. this.permissionsList(res.data)
  461. if (user.company.packageSimple == 1) {
  462. //简易模式,直接进入工时统计表
  463. this.$router.push({ path: '/simple' });
  464. sessionStorage.setItem('autoRoute','/simple')
  465. } else {
  466. if(user.moduleList.length > 0) {
  467. this.$router.push({ path: user.moduleList[0].path })
  468. sessionStorage.setItem('autoRoute',user.moduleList[0].path)
  469. }
  470. }
  471. } else {
  472. this.logining = false;
  473. // if(res.msg.indexOf('到期') != -1){
  474. // this.$router.push({ path: '/expire', query:{datetext:'2022.11.24',ddd: '111'}})
  475. // console.log('到期skip');
  476. // return
  477. // }
  478. this.$message({
  479. message: res.msg,
  480. type: 'error'
  481. });
  482. }
  483. }, error => {
  484. console.log('执行1')
  485. this.logining = false;
  486. this.$message({
  487. message: error,
  488. type: 'error'
  489. });
  490. })
  491. }
  492. });
  493. },
  494. // 米莱得用工号登录
  495. automaticLogin(jobNumber, token) {
  496. this.http.post('/user/loginAdminByThirdParty', {
  497. jobNumber: jobNumber,
  498. token: token
  499. } , res => {
  500. if (res.code == "ok") {
  501. if(res.data.moduleList.length == 0){
  502. this.$message({
  503. message: this.$t('qing-lian-xi-guan-li-yuan-wei')+'\u3000' + res.data.roleName + '\u3000'+this.$t('assignpermissions'),
  504. type: 'error'
  505. })
  506. return
  507. }
  508. var user = res.data;
  509. sessionStorage.setItem('user', JSON.stringify(res.data));
  510. this.permissionsList(res.data)
  511. if (user.company.packageSimple == 1) {
  512. //简易模式,直接进入工时统计表
  513. this.$router.push({ path: '/simple' });
  514. sessionStorage.setItem('autoRoute','/simple')
  515. } else {
  516. if(user.moduleList.length > 0) {
  517. this.$router.push({ path: user.moduleList[0].path })
  518. sessionStorage.setItem('autoRoute',user.moduleList[0].path)
  519. } else {
  520. //没有授权任何模块,需要提示用户
  521. alert('无权访问,请联系管理员为您分配权限');
  522. }
  523. }
  524. } else {
  525. this.$message({
  526. message: res.msg,
  527. type: 'error'
  528. });
  529. }
  530. }, error => {
  531. this.$message({
  532. message: error,
  533. type: 'error'
  534. });
  535. })
  536. },
  537. // 飞书登陆
  538. flyingBook(appid, code) {
  539. this.http.post('/feishu-info/loginByFeishu', {
  540. appId: appid,
  541. code: code
  542. } , res => {
  543. console.log(res, '接口返回')
  544. if (res.code == "ok") {
  545. var user = res.data;
  546. localStorage.user = JSON.stringify(res.data);
  547. sessionStorage.setItem('user', JSON.stringify(res.data));
  548. this.permissionsList(res.data)
  549. if(user.moduleList.length > 0) {
  550. this.$router.push({ path: user.moduleList[0].path })
  551. } else {
  552. //没有授权任何模块,需要提示用户
  553. alert('无权访问,请联系管理员为您分配权限');
  554. }
  555. } else {
  556. this.$message({
  557. message: res.msg,
  558. type: 'error'
  559. });
  560. }
  561. }, error => {
  562. console.log(error, '抛出异常')
  563. this.$message({
  564. message: error,
  565. type: 'error'
  566. });
  567. })
  568. },
  569. // 权限控制
  570. permissionsList(item) {
  571. var arr = []
  572. var ss = item.functionList
  573. for(var i in ss) {
  574. arr.push(ss[i].name)
  575. }
  576. var ssAkl = this.StringUtil.permissions(arr)
  577. sessionStorage.setItem('permissions', JSON.stringify(ssAkl));
  578. // console.log(ssAkl, '返回过来的数据原--------')
  579. },
  580. },
  581. }
  582. </script>
  583. <style lang="scss" scoped>
  584. .qiweix {
  585. width: 100%;
  586. display: flex;
  587. justify-content: center;
  588. padding: 50px 0;
  589. font-size: 40px;
  590. color: #505458;
  591. }
  592. .additional {
  593. width: 100%;
  594. text-align: center;
  595. padding: 20px 0;
  596. color: #505458;
  597. }
  598. .externalLanding {
  599. width: 100%;
  600. display: flex;
  601. justify-content: center;
  602. .externalLanding_img {
  603. width: 30px;
  604. height: 30px;
  605. border: 1px solid #409EFF;
  606. border-radius: 50%;
  607. position: relative;
  608. overflow: hidden;
  609. cursor: pointer;
  610. display: flex;
  611. justify-content: center;
  612. align-items: center;
  613. img {
  614. width: 80%;
  615. height: 80%;
  616. }
  617. }
  618. }
  619. .login {
  620. height: 100%;
  621. .login-par {
  622. width: 100%;
  623. // min-height: 100%;
  624. height: 100vh;
  625. background: #f0f2f5 url('../assets/image/background.png') no-repeat 50%;
  626. background-size: 100%;
  627. padding: 110px 0 144px;
  628. position: relative;
  629. box-sizing: border-box;
  630. .login-logo {
  631. text-align: center;
  632. margin: 0 0 20px 0;
  633. }
  634. .login-container {
  635. -webkit-border-radius: 5px;
  636. border-radius: 5px;
  637. -moz-border-radius: 5px;
  638. background-clip: padding-box;
  639. width: 315px;
  640. // height: 380px;
  641. padding: 25px 35px 25px 35px;
  642. background: #fff;
  643. border: 1px solid #eaeaea;
  644. box-shadow: 0 0 5px #cac6c6;
  645. border-top: 10px solid #20a0ff;
  646. margin:auto;
  647. .title {
  648. font-size: 20px;
  649. margin: 0px auto 40px auto;
  650. text-align: center;
  651. color: #505458;
  652. }
  653. .remember {
  654. margin: 0px 0px 35px 0px;
  655. }
  656. .login-input {
  657. margin: 30px 0 0 0;
  658. }
  659. .login-button {
  660. margin: 30px 0 0 0;
  661. }
  662. .login-button .el-button {
  663. padding: 14px;
  664. }
  665. }
  666. }
  667. }
  668. .toRegister {
  669. margin: 15px 0;
  670. text-align: right;
  671. position: relative;
  672. .service {
  673. display: none;
  674. width: 120px;
  675. position: absolute;
  676. background: #fff;
  677. text-align: center;
  678. padding: 10px;
  679. left: -30px;
  680. top: -210px;
  681. border-radius: 5px;
  682. box-shadow: 3px 3px 10px #dfdfdf;
  683. img {
  684. width: 80px;
  685. }
  686. }
  687. }
  688. .btn:hover .service {
  689. display: block;
  690. }
  691. </style>