index.vue 18 KB

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