index.vue 22 KB

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