index.vue 22 KB

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