index.vue 21 KB

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