index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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. }
  348. </style>
  349. <script>
  350. export default {
  351. data () {
  352. return {
  353. loadIng: 0,
  354. loginShow: false,
  355. loginType: 'login',
  356. formLogin: {
  357. username: '',
  358. userpass: '',
  359. userpass2: ''
  360. },
  361. ruleLogin: {},
  362. systemConfig: $A.jsonParse($A.storage("systemSetting"), {
  363. logo: '',
  364. github: '',
  365. reg: '',
  366. }),
  367. fromUrl: '',
  368. }
  369. },
  370. created() {
  371. this.ruleLogin = {
  372. username: [
  373. { required: true, message: this.$L('请填写用户名!'), trigger: 'change' },
  374. { type: 'string', min: 2, message: this.$L('用户名长度至少2位!'), trigger: 'change' }
  375. ],
  376. userpass: [
  377. { required: true, message: this.$L('请填写登录密码!'), trigger: 'change' },
  378. { type: 'string', min: 6, message: this.$L('密码错长度至少6位!'), trigger: 'change' }
  379. ],
  380. userpass2: [
  381. { required: true, message: this.$L('请填写确认密码!'), trigger: 'change' },
  382. { type: 'string', min: 6, message: this.$L('确认密码错长度至少6位!'), trigger: 'change' },
  383. {
  384. validator: (rule, value, callback) => {
  385. if (value !== this.formLogin.userpass) {
  386. callback(new Error(this.$L('两次密码输入不一致!')));
  387. } else {
  388. callback();
  389. }
  390. },
  391. required: true,
  392. trigger: 'change'
  393. },
  394. ]
  395. };
  396. },
  397. mounted() {
  398. this.getSetting();
  399. this.fromUrl = decodeURIComponent($A.getObject(this.$route.query, 'from'));
  400. if (this.fromUrl) {
  401. this.loginChack();
  402. }
  403. },
  404. deactivated() {
  405. this.loginShow = false;
  406. },
  407. watch: {
  408. loginShow(val) {
  409. if (val) {
  410. this.getSetting();
  411. } else {
  412. this.loginType = 'login';
  413. }
  414. }
  415. },
  416. methods: {
  417. getSetting() {
  418. $A.apiAjax({
  419. url: 'system/setting',
  420. error: () => {
  421. $A.storage("systemSetting", {});
  422. },
  423. success: (res) => {
  424. if (res.ret === 1) {
  425. this.systemConfig = res.data;
  426. this.systemConfig.github = this.systemConfig.github || 'show';
  427. this.systemConfig.reg = this.systemConfig.reg || 'open';
  428. $A.storage("systemSetting", this.systemConfig);
  429. } else {
  430. $A.storage("systemSetting", {});
  431. }
  432. }
  433. });
  434. },
  435. enterpriseOpen() {
  436. this.goForward({path: '/plans'});
  437. },
  438. loginChack() {
  439. if ($A.getToken() !== false) {
  440. this.goForward({path: '/todo'}, true);
  441. } else {
  442. this.loginShow = true;
  443. }
  444. },
  445. onLogin() {
  446. this.$refs.login.validate((valid) => {
  447. if (valid) {
  448. this.loadIng++;
  449. $A.ajax({
  450. url: $A.apiUrl('users/login?type=' + this.loginType),
  451. data: this.formLogin,
  452. complete: () => {
  453. this.loadIng--;
  454. },
  455. success: (res) => {
  456. if (res.ret === 1) {
  457. $A.storage("userInfo", res.data);
  458. $A.setToken(res.data.token);
  459. $A.triggerUserInfoListener(res.data);
  460. //
  461. this.loadIng--;
  462. this.loginShow = false;
  463. this.$refs.login.resetFields();
  464. this.$Message.success(this.$L('登录成功'));
  465. if (this.fromUrl) {
  466. window.location.replace(this.fromUrl);
  467. } else {
  468. this.goForward({path: '/todo'}, true);
  469. }
  470. } else {
  471. this.$Modal.error({
  472. title: this.$L("温馨提示"),
  473. content: res.msg
  474. });
  475. }
  476. }
  477. })
  478. }
  479. })
  480. }
  481. },
  482. }
  483. </script>