index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. <template>
  2. <div class="w-box index">
  3. <v-title>{{$L('轻量级的团队在线协作')}}</v-title>
  4. <div class="welbg">
  5. <div class="second">
  6. <div class="bg"></div>
  7. </div>
  8. </div>
  9. <div class="header">
  10. <div class="z-row">
  11. <div class="header-col-sub">
  12. <h2>
  13. <img v-if="systemConfig.logo" :src="systemConfig.logo">
  14. <img v-else src="../../../statics/images/logo-white.png">
  15. <span>{{$L('轻量级的团队在线协作')}}</span>
  16. </h2>
  17. </div>
  18. <div class="z-1">
  19. <dl>
  20. <dd>
  21. <Button v-if="systemConfig.enterprise=='show'" type="success" size="small" class="right-enterprise" @click="enterpriseOpen">{{$L('企业版')}}</Button>
  22. <a v-if="systemConfig.github=='show'" href='https://gitee.com/aipaw/wookteam' class="right-info" target="_blank">
  23. <img class="right-img" src="https://gitee.com/aipaw/wookteam/badge/star.svg?theme=gvp" alt="star"/>
  24. </a>
  25. <a v-if="systemConfig.github=='show'" class="right-info" target="_blank" href="https://github.com/kuaifan/wookteam">
  26. <Icon class="right-icon" type="logo-github"/>
  27. </a>
  28. <Dropdown class="right-info" trigger="hover" @on-click="setLanguage" transfer>
  29. <div>
  30. <Icon class="right-icon" type="md-globe"/>
  31. <Icon type="md-arrow-dropdown"/>
  32. </div>
  33. <Dropdown-menu slot="list">
  34. <Dropdown-item name="zh" :selected="getLanguage() === 'zh'">中文</Dropdown-item>
  35. <Dropdown-item name="en" :selected="getLanguage() === 'en'">English</Dropdown-item>
  36. </Dropdown-menu>
  37. </Dropdown>
  38. </dd>
  39. </dl>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="welcome">
  44. <div class="banner">
  45. <div class="z-row">
  46. <div class="z-16">
  47. <Carousel class="banner-carousel" autoplay loop :autoplay-speed="5000">
  48. <CarouselItem>
  49. <img src="../../../statics/images/index/banner/1.jpg">
  50. </CarouselItem>
  51. <CarouselItem>
  52. <img src="../../../statics/images/index/banner/2.jpg">
  53. </CarouselItem>
  54. </Carousel>
  55. </div>
  56. <div class="z-8"><h3>{{$L('酷团队协作工具就从这里开始')}}</h3>
  57. <div class="bl inline-block">
  58. <span class="start" @click="loginChack">{{$L('立即登陆')}}</span>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="second">
  64. <div class="bg"></div>
  65. <div class="z-row">
  66. <div class="z-6"><a href="#W_link1"><i class="ft icon">&#xe753;</i>{{$L('待办四象限')}}</a></div>
  67. <div class="z-6"><a href="#W_link2"><i class="ft icon">&#xe6b8;</i>{{$L('项目管理')}}</a></div>
  68. <div class="z-6"><a href="#W_link3"><i class="ft icon">&#xe915;</i>{{$L('在线知识库')}}</a></div>
  69. <div class="z-6"><a href="#W_link4"><i class="ft icon">&#xe706;</i>{{$L('日程管理')}}</a></div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="z-row block">
  74. <div class="z-6">
  75. <div class="wrap-left" id="W_link1"><i class="ft icon">&#xe753;</i>{{$L('待办四象限:突出事情优先级,帮助员工合理安排时间,提高工作效率。')}}</div>
  76. </div>
  77. <div class="z-18"><img src="../../../statics/images/index/todo.jpg"/></div>
  78. </div>
  79. <div class="z-row block">
  80. <div class="z-18"><img src="../../../statics/images/index/project.jpg"/></div>
  81. <div class="z-6">
  82. <div class="wrap-right" id="W_link2"><i class="ft icon">&#xe6b8;</i>{{$L('项目管理:自定义项目看板,可视化任务安排。')}}</div>
  83. </div>
  84. </div>
  85. <div class="z-row block">
  86. <div class="z-6">
  87. <div class="wrap-left" id="W_link3"><i class="ft icon">&#xe915;</i>{{$L('在线知识库:在线流程图,在线文档,以及可视化的目录编排,文档管理无忧。')}}</div>
  88. </div>
  89. <div class="z-18"><img src="../../../statics/images/index/wiki.jpg"/></div>
  90. </div>
  91. <div class="z-row block">
  92. <div class="z-18"><img src="../../../statics/images/index/week.jpg"/></div>
  93. <div class="z-6">
  94. <div class="wrap-right" id="W_link4"><i class="ft icon">&#xe706;</i>{{$L('日程管理:可视化日程管理,快速搞定工作计划,了解工作宏观安排。')}}</div>
  95. </div>
  96. </div>
  97. <div class="p-footer"><span v-html="systemConfig.footerText || 'WookTeam &copy; 2018-2020'"></span></div>
  98. <Modal
  99. v-model="loginShow"
  100. :mask-closable="false"
  101. class-name="simple-modal">
  102. <Form ref="login" :model="formLogin" :rules="ruleLogin" @submit.native.prevent>
  103. <FormItem prop="username">
  104. <Input type="text" v-model="formLogin.username" :placeholder="$L('用户名')" @on-enter="onLogin" @on-blur="onBlur">
  105. <Icon type="ios-person-outline" slot="prepend"></Icon>
  106. </Input>
  107. </FormItem>
  108. <FormItem prop="userpass">
  109. <Input type="password" v-model="formLogin.userpass" :placeholder="$L('密码')" @on-enter="onLogin">
  110. <Icon type="ios-lock-outline" slot="prepend"></Icon>
  111. </Input>
  112. </FormItem>
  113. <FormItem v-if="loginType=='reg'" prop="userpass2">
  114. <Input type="password" v-model="formLogin.userpass2" :placeholder="$L('确认密码')" @on-enter="onLogin">
  115. <Icon type="ios-lock-outline" slot="prepend"></Icon>
  116. </Input>
  117. </FormItem>
  118. <FormItem v-if="loginType=='login'&&codeNeed" prop="code">
  119. <Input type="text" v-model="formLogin.code" :placeholder="$L('验证码')" @on-enter="onLogin">
  120. <Icon type="ios-checkmark-circle-outline" slot="prepend"></Icon>
  121. <div slot="append" class="login-code" @click="refreshCode"><img :src="codeUrl"/></div>
  122. </Input>
  123. </FormItem>
  124. </Form>
  125. <div slot="header" class="login-header">
  126. <div @click="loginType='login'" class="login-header-item" :class="{active:loginType=='login'}">{{$L('用户登录')}}</div>
  127. <div v-if="systemConfig.reg=='open'" @click="loginType='reg'" class="login-header-item" :class="{active:loginType=='reg'}">{{$L('注册账号')}}</div>
  128. </div>
  129. <div slot="footer">
  130. <Button type="default" @click="loginShow=false">{{$L('取消')}}</Button>
  131. <Button type="primary" :loading="loadIng > 0" @click="onLogin">{{$L(loginType=='reg'?'注册':'登录')}}</Button>
  132. </div>
  133. </Modal>
  134. </div>
  135. </template>
  136. <style lang="scss">
  137. .login-header {
  138. display: flex;
  139. align-items: center;
  140. .login-header-item {
  141. height: 20px;
  142. line-height: 20px;
  143. font-size: 14px;
  144. color: #444444;
  145. overflow: hidden;
  146. text-overflow: ellipsis;
  147. white-space: nowrap;
  148. padding-right: 12px;
  149. cursor: pointer;
  150. &.active {
  151. font-size: 16px;
  152. color: #17233d;
  153. font-weight: 500;
  154. }
  155. }
  156. }
  157. .login-code {
  158. margin: -4px -7px;
  159. height: 30px;
  160. overflow: hidden;
  161. cursor: pointer;
  162. img {
  163. height: 100%;
  164. }
  165. }
  166. </style>
  167. <style lang="scss" scoped>
  168. .index {
  169. position: absolute;
  170. color: #000000;
  171. top: 0;
  172. left: 0;
  173. min-width: 100%;
  174. min-height: 100%;
  175. padding: 0;
  176. margin: 0;
  177. .header {
  178. position: relative;
  179. z-index: 3;
  180. height: 50px;
  181. padding-top: 12px;
  182. max-width: 1280px;
  183. margin: 0 auto;
  184. .z-row {
  185. color: #fff;
  186. height: 50px;
  187. position: relative;
  188. z-index: 2;
  189. max-width: 1680px;
  190. margin: 0 auto;
  191. .header-col-sub {
  192. width: 500px;
  193. h2 {
  194. position: relative;
  195. padding: 1rem 0 0 1rem;
  196. display: flex;
  197. align-items: flex-end;
  198. img {
  199. width: 150px;
  200. margin-right: 6px;
  201. }
  202. span {
  203. font-size: 12px;
  204. font-weight: normal;
  205. color: rgba(255, 255, 255, 0.85);
  206. line-height: 14px;
  207. }
  208. }
  209. }
  210. .z-1 {
  211. dl {
  212. position: absolute;
  213. right: 20px;
  214. top: 0;
  215. font-size: 14px;
  216. dd {
  217. line-height: 50px;
  218. color: #fff;
  219. cursor: pointer;
  220. margin-right: 1px;
  221. .right-enterprise {
  222. padding: 1px 10px;
  223. font-size: 12px;
  224. color: #f6ca9d;
  225. background: #1d1e23;
  226. background: linear-gradient(90deg, #1d1e23, #3f4045);
  227. border: none;
  228. }
  229. .right-info {
  230. display: inline-block;
  231. cursor: pointer;
  232. margin-left: 12px;
  233. color: #ffffff;
  234. .right-icon {
  235. font-size: 26px;
  236. vertical-align: middle;
  237. }
  238. .right-img {
  239. vertical-align: middle;
  240. }
  241. }
  242. }
  243. }
  244. }
  245. }
  246. }
  247. .welbg {
  248. position: absolute;
  249. z-index: 1;
  250. top: 0;
  251. left: 0;
  252. right: 0;
  253. height: 762px;
  254. overflow: hidden;
  255. padding-top: 480px;
  256. margin-top: -480px;
  257. background: #2d8cf0;
  258. transform: skewY(-2deg);
  259. box-shadow: 0 2px 244px 0 rgba(56, 132, 255, 0.4);
  260. .second {
  261. position: relative;
  262. margin-top: 582px;
  263. height: 220px;
  264. .bg {
  265. transform: skewY(-2.5deg);
  266. display: block;
  267. position: absolute;
  268. top: 0;
  269. left: 0;
  270. right: 0;
  271. bottom: 0;
  272. background: #1F65D6;
  273. }
  274. }
  275. }
  276. .welcome {
  277. position: relative;
  278. z-index: 2;
  279. height: 700px;
  280. display: block;
  281. overflow: hidden;
  282. color: #FFFFFF;
  283. padding-top: 480px;
  284. margin-top: -480px;
  285. .unslider-arrow {
  286. display: none;
  287. }
  288. .banner {
  289. padding-top: 60px;
  290. height: 460px;
  291. max-width: 1200px;
  292. margin: 0 auto;
  293. .banner-carousel {
  294. max-width: 685px;
  295. border-radius: 5px;
  296. overflow: hidden;
  297. }
  298. img {
  299. height: 400px;
  300. border: 5px solid #fff;
  301. display: table;
  302. }
  303. }
  304. .z-8 {
  305. text-align: center;
  306. }
  307. h3 {
  308. color: rgba(255, 255, 255, 0.8);
  309. font-size: 40px;
  310. font-weight: normal;
  311. text-align: center;
  312. margin: 30px auto;
  313. width: 380px;
  314. }
  315. .start {
  316. display: inline-block;
  317. width: 160px;
  318. height: 50px;
  319. line-height: 50px;
  320. text-align: center;
  321. font-weight: normal;
  322. cursor: pointer;
  323. font-size: 20px;
  324. background: #fff;
  325. color: #0396f2;
  326. border-radius: 4px;
  327. border: 0;
  328. &:hover, &:focus {
  329. background: #f6f6f6;
  330. color: #0396f2;
  331. }
  332. }
  333. .second {
  334. position: relative;
  335. height: 220px;
  336. text-align: center;
  337. .bg {
  338. display: block;
  339. position: absolute;
  340. top: 0;
  341. left: 0;
  342. right: 0;
  343. bottom: 0;
  344. }
  345. .z-row {
  346. z-index: 2;
  347. position: relative;
  348. font-size: 22px;
  349. max-width: 1400px;
  350. margin: 0 auto;
  351. line-height: 220px;
  352. }
  353. i {
  354. color: rgba(255, 255, 255, 0.85);
  355. margin-right: 6px;
  356. }
  357. a {
  358. color: #fff;
  359. &:hover, &:visited {
  360. color: #fff;
  361. }
  362. }
  363. }
  364. }
  365. .block {
  366. max-width: 1200px;
  367. margin: 30px auto;
  368. padding-top: 50px;
  369. border: 1px solid transparent;
  370. .wrap-left, .wrap-right {
  371. line-height: 36px;
  372. color: #666;
  373. font-size: 16px;
  374. }
  375. .wrap-left {
  376. margin: 20px 30px 0 0;
  377. }
  378. .wrap-right {
  379. margin: 20px 0 0 30px;
  380. }
  381. i {
  382. color: rgba(248, 14, 21, 0.7);
  383. margin-right: 6px;
  384. }
  385. img {
  386. border: 5px solid #fff;
  387. border-radius: 10px;
  388. width: 100%;
  389. }
  390. }
  391. .p-footer {
  392. margin: 20px 0;
  393. text-align: center;
  394. color: #333;
  395. a, span {
  396. color: #333;
  397. margin-left: 10px;
  398. }
  399. }
  400. @media (max-width: 768px) {
  401. .header {
  402. .z-row {
  403. .header-col-sub {
  404. h2 {
  405. padding: 12px 0 0 12px;
  406. span {
  407. display: none;
  408. }
  409. }
  410. }
  411. }
  412. }
  413. .welbg {
  414. display: none;
  415. }
  416. .welcome {
  417. height: auto;
  418. background: #2d8cf0;
  419. transform: skewY(-2deg);
  420. box-shadow: 0 2px 244px 0 rgba(56, 132, 255, 0.4);
  421. .banner {
  422. height: auto;
  423. transform: skewY(2deg);
  424. .z-row {
  425. flex-direction: column;
  426. padding-bottom: 52px;
  427. > div {
  428. width: 90%;
  429. margin: 0 auto;
  430. }
  431. }
  432. h3 {
  433. font-size: 24px;
  434. width: auto;
  435. }
  436. img {
  437. max-width: 100%;
  438. height: auto;
  439. }
  440. }
  441. .second {
  442. height: 120px;
  443. display: flex;
  444. align-items: center;
  445. transform: skewY(2deg);
  446. .bg {
  447. transform: skewY(-4.5deg);
  448. background: #1F65D6;
  449. }
  450. .z-row {
  451. height: auto;
  452. line-height: 36px;
  453. font-size: 16px;
  454. display: block;
  455. .z-6 {
  456. width: 30%;
  457. margin: 0 5%;
  458. white-space: nowrap;
  459. }
  460. }
  461. }
  462. }
  463. .block {
  464. flex-direction: column;
  465. margin: 24px auto;
  466. padding-top: 24px;
  467. max-width: 90%;
  468. border: 0;
  469. > div {
  470. width: 96%;
  471. margin: 0 auto;
  472. }
  473. .wrap-left,
  474. .wrap-right {
  475. margin: 6px 0;
  476. line-height: 28px;
  477. }
  478. }
  479. }
  480. }
  481. </style>
  482. <script>
  483. export default {
  484. data() {
  485. return {
  486. loadIng: 0,
  487. loginShow: false,
  488. loginType: 'login',
  489. codeNeed: false,
  490. codeUrl: $A.apiUrl('users/login/codeimg'),
  491. formLogin: {
  492. username: '',
  493. userpass: '',
  494. userpass2: '',
  495. code: '',
  496. },
  497. ruleLogin: {},
  498. systemConfig: $A.jsonParse($A.storage("systemSetting")),
  499. fromUrl: '',
  500. }
  501. },
  502. mounted() {
  503. //
  504. },
  505. activated() {
  506. this.getSetting();
  507. this.fromUrl = decodeURIComponent($A.getObject(this.$route.query, 'from'));
  508. if (this.fromUrl) {
  509. this.loginChack();
  510. }
  511. },
  512. deactivated() {
  513. this.loginShow = false;
  514. },
  515. watch: {
  516. loginShow(val) {
  517. if (val) {
  518. this.getSetting();
  519. } else {
  520. this.loginType = 'login';
  521. }
  522. }
  523. },
  524. methods: {
  525. initLanguage() {
  526. this.ruleLogin = {
  527. username: [
  528. {required: true, message: this.$L('请填写用户名!'), trigger: 'change'},
  529. {type: 'string', min: 2, message: this.$L('用户名长度至少2位!'), trigger: 'change'}
  530. ],
  531. userpass: [
  532. {required: true, message: this.$L('请填写登录密码!'), trigger: 'change'},
  533. {type: 'string', min: 6, message: this.$L('密码错长度至少6位!'), trigger: 'change'}
  534. ],
  535. userpass2: [
  536. {required: true, message: this.$L('请填写确认密码!'), trigger: 'change'},
  537. {type: 'string', min: 6, message: this.$L('确认密码错长度至少6位!'), trigger: 'change'},
  538. {
  539. validator: (rule, value, callback) => {
  540. if (value !== this.formLogin.userpass) {
  541. callback(new Error(this.$L('两次密码输入不一致!')));
  542. } else {
  543. callback();
  544. }
  545. },
  546. required: true,
  547. trigger: 'change'
  548. },
  549. ]
  550. };
  551. },
  552. getSetting() {
  553. $A.apiAjax({
  554. url: 'system/setting',
  555. error: () => {
  556. $A.storage("systemSetting", {});
  557. },
  558. success: (res) => {
  559. if (res.ret === 1) {
  560. this.systemConfig = res.data;
  561. $A.storage("systemSetting", this.systemConfig);
  562. } else {
  563. $A.storage("systemSetting", {});
  564. }
  565. if (this.systemConfig.loginWin == 'direct') {
  566. this.loginChack();
  567. }
  568. }
  569. });
  570. },
  571. loginChack() {
  572. if ($A.getToken() !== false) {
  573. this.goForward({path: '/todo'}, true);
  574. } else {
  575. this.loginShow = true;
  576. }
  577. },
  578. refreshCode() {
  579. this.codeUrl = $A.apiUrl('users/login/codeimg?_=' + Math.random())
  580. },
  581. enterpriseOpen() {
  582. this.goForward({path: '/plans'});
  583. },
  584. onBlur() {
  585. if (this.loginType != 'login') {
  586. this.codeNeed = false;
  587. return;
  588. }
  589. this.loadIng++;
  590. $A.ajax({
  591. url: $A.apiUrl('users/login/needcode'),
  592. data: {
  593. username: this.formLogin.username,
  594. },
  595. complete: () => {
  596. this.loadIng--;
  597. },
  598. success: (res) => {
  599. this.codeNeed = res.ret === 1;
  600. }
  601. })
  602. },
  603. onLogin() {
  604. this.$refs.login.validate((valid) => {
  605. if (valid) {
  606. this.loadIng++;
  607. $A.ajax({
  608. url: $A.apiUrl('users/login?type=' + this.loginType),
  609. data: this.formLogin,
  610. complete: () => {
  611. this.loadIng--;
  612. },
  613. success: (res) => {
  614. if (res.ret === 1) {
  615. $A.storage("userInfo", res.data);
  616. $A.setToken(res.data.token);
  617. $A.triggerUserInfoListener(res.data);
  618. //
  619. this.loadIng--;
  620. this.loginShow = false;
  621. this.$refs.login.resetFields();
  622. this.$Message.success(this.$L('登录成功'));
  623. if (this.fromUrl) {
  624. window.location.replace(this.fromUrl);
  625. } else {
  626. this.goForward({path: '/todo'}, true);
  627. }
  628. } else {
  629. this.$Modal.error({
  630. title: this.$L("温馨提示"),
  631. content: res.msg
  632. });
  633. if (res.data.code === 'need') {
  634. this.codeNeed = true;
  635. this.refreshCode();
  636. }
  637. }
  638. }
  639. })
  640. }
  641. })
  642. }
  643. },
  644. }
  645. </script>