From 580440ffa1f8f289273989e3f638afe039e17bb3 Mon Sep 17 00:00:00 2001 From: panqihua Date: Fri, 7 Jan 2022 04:21:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=88=A0=E6=9F=A5=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Layout/Sider.vue | 14 +-- src/main.js | 1 + src/mock.js | 61 +++++++++---- src/router/index.js | 52 ++++------- src/services/customer-api.js | 6 +- src/utils/axios-util.js | 7 +- src/views/Login.vue | 2 +- src/views/activity/components/edit.vue | 65 ++++++++++++++ src/views/activity/components/list.vue | 96 ++++++++++++++++++++ src/views/activity/index.vue | 120 ++++++++++++++++++++++++- vue.config.js | 13 ++- 11 files changed, 373 insertions(+), 64 deletions(-) create mode 100644 src/views/activity/components/edit.vue create mode 100644 src/views/activity/components/list.vue diff --git a/src/components/Layout/Sider.vue b/src/components/Layout/Sider.vue index c474806..cb18bab 100644 --- a/src/components/Layout/Sider.vue +++ b/src/components/Layout/Sider.vue @@ -113,11 +113,8 @@ export default { path: '/business', title: '交易', type: 'pay-circle' - },{ - path: '/activities', - title: '活動', - type: 'schedule' - },{ + }, + { path: '/custList', title: '客戶', type: 'user' @@ -130,7 +127,12 @@ export default { path: '/more', title: '更多..導入資料', type: 'small-dash' - } + }, + { + path: '/activities', + title: '活動', + type: 'schedule' + }, ], subMenu: [{ diff --git a/src/main.js b/src/main.js index ce7430d..6f30a98 100644 --- a/src/main.js +++ b/src/main.js @@ -20,6 +20,7 @@ import {Chart} from 'chart.js'; import Chartkick from 'vue-chartkick'; import Api from './services/api'; import Util from './utils/util';///引入工具类 +import './mock' import VueCloneya from 'vue-cloneya'; Vue.use(VueCloneya) diff --git a/src/mock.js b/src/mock.js index 8199b3c..64ca7cf 100644 --- a/src/mock.js +++ b/src/mock.js @@ -9,6 +9,9 @@ // 引入mockjs, 在线文档: https://github.com/nuysoft/Mock/wiki const Mock = require('mockjs'); + +console.debug('初始化Mock') + // 获取 mock.Random 对象 const Random = Mock.Random; // 配置响应时间 @@ -16,28 +19,31 @@ Mock.setup({ timeout: '200-600' }); -let base = 'http://localhost:8080/'; +let base = 'http://localhost:8081/'; // 语法:Mock.mock( url, post/get , 返回的数据); // Mail部分 -Mock.mock(base + 'context/mail/getAccountList','post', getRadomAccountList()); +Mock.mock(base + 'context/mail/getAccountList', 'post', getRadomAccountList()); + +Mock.mock(base + 'context/mail/getFolderList', 'post', getRadomFolderList()); -Mock.mock(base + 'context/mail/getFolderList','post', getRadomFolderList()); +Mock.mock(base + 'context/mail/getMessageList', 'post', getRadomMailList()); -Mock.mock(base + 'context/mail/getMessageList','post', getRadomMailList()); +Mock.mock(base + 'context/mail/getMessageDetail', 'post', getRadomMessage()); -Mock.mock(base + 'context/mail/getMessageDetail','post', getRadomMessage()); +Mock.mock(base + 'context/mail/send', 'post', send()); -Mock.mock(base + 'context/mail/send','post', send()); +//活动列表数据mock +Mock.mock('/mock/activity/getActivityList','get',options=>getActivityList(options)) -function getRadomAccountList () { +function getRadomAccountList() { return { "errCode": 0, "errMsg": "请求成功", "data": { "mailAccountList": [ { - "id": Random.integer(0,20), + "id": Random.integer(0, 20), "createTime": Random.date() + ' ' + Random.time(), "updateTime": Random.date() + ' ' + Random.time(), "type": "imap_smtp", @@ -59,12 +65,12 @@ function getRadomAccountList () { } } -function getRadomFolderList () { +function getRadomFolderList() { let folderList = []; for (let i = 0; i < 5; i++) { let item = { - "id": Random.integer(0,20), + "id": Random.integer(0, 20), "createTime": Random.date() + ' ' + Random.time(), "updateTime": Random.date() + ' ' + Random.time(), "parent": Random.cword(3), @@ -92,19 +98,19 @@ function getRadomFolderList () { } -function getRadomMailList () { +function getRadomMailList() { let mailList = []; for (let i = 0; i < 15; i++) { let mailItem = { - + id: Random.cword(30), from: Random.email(), cc: Random.email(), bcc: Random.email(), - subject: Random.csentence(5, 30), + subject: Random.csentence(5, 30), sentDate: Random.date() + ' ' + Random.time(), flags: Random.boolean(), userFlags: Random.boolean(), @@ -141,7 +147,7 @@ function getRadomMailList () { "errCode": 0, "errMsg": "请求成功", "data": { - "mailList": mailList, + "mailList": mailList, "total": 15 } @@ -149,7 +155,7 @@ function getRadomMailList () { } -function getRadomMessage () { +function getRadomMessage() { return { "errCode": 0, "errMsg": "请求成功", @@ -159,7 +165,7 @@ function getRadomMessage () { } } -function send () { +function send() { return { "errCode": 0, "errMsg": "请求成功", @@ -168,3 +174,26 @@ function send () { } } } + +function getActivityList(options) { + console.debug(options) + let data = Array.from(new Array(Mock.Random.integer(1, 10)).keys()).map(() => Mock.mock({ + id:Mock.Random.id(), + finish: Mock.Random.boolean(), + subject: Mock.Random.title(), + deal: /[a-z][A-Z][0-9]/, + participants: Mock.Random.cname(), + email: Mock.Random.email(), + phone: /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/, + organization: Mock.Random.ctitle(), + date: Mock.Random.date('yyyy-MM-dd'), + time: Mock.Random.integer(), + user: Mock.Random.cname() + })) + + return { + "errCode": 0, + "errMsg": "请求成功", + data + } +} diff --git a/src/router/index.js b/src/router/index.js index bfc5473..07d78d0 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -102,12 +102,12 @@ const routes = [ ] }, //客户 - { - path: "/custList", - name: "CustList", - component: () => - import("../views/CustList.vue"), - }, + // { + // path: "/custList", + // name: "CustList", + // component: () => + // import("../views/CustList.vue"), + // }, { path: "/persons", //info: 重写的联络人模块, 2021.12.27 name: "Persons", @@ -129,34 +129,6 @@ const routes = [ name: "CalendarView", component: () => import("../components/Calendar/CalendarView.vue"), }, - { - path: "/activities", - name: "ActivitiesList", - component: () => import("../views/ActivitiesList.vue"), - children: [ - { - path: '/activities/Activities', - component: resolve => require(['@/components/Calendar/Activities'], resolve), - }, - { - path: '/activities/CalendarView', - component: resolve => require(['@/components/Calendar/CalendarView'], resolve), - }, - { - path: '/activities/CalendarFullView', - component: resolve => require(['@/components/Calendar/CalendarFullView'], resolve), - }, - { - path: '/activities/CalendarSetting', - component: resolve => require(['@/components/Calendar/CalendarSetting'], resolve), - }, - ] - }, - // { - // path: "/businessList", - // name: "BusinessList1", - // component: () => import("../views/BusinessList.vue"), - // }, { path: "/insightsChartList", name: "InsightsChartList", @@ -177,6 +149,18 @@ const routes = [ name: "UserProfile", component: () => import("../components/Customer/UserProfile.vue"), }, + //活动 + { + path: "/activities", + name: "ActivitiesList", + component: () => import("../views/activity/index"), + children: [ + // { + // path: '/activities/Activities', + // component: resolve => require(['@/components/Calendar/Activities'], resolve), + // }, + ] + }, ] }, // { diff --git a/src/services/customer-api.js b/src/services/customer-api.js index 0c16c53..fcdf837 100644 --- a/src/services/customer-api.js +++ b/src/services/customer-api.js @@ -7,7 +7,7 @@ * @LastEditTime: 2021-12-14 20:25:42 */ // import Axios from '../utils/axios-util-customer' -import Axios from '../utils/axios-util' +import Axios, {DEFAULT_GET} from '../utils/axios-util' // console.log('mail-api打印', Axios); //info: mail文档地址: @@ -408,4 +408,8 @@ export default { //console.log("updateParams", updateParams) return Axios.POST(custBase + 'browseRecord/selectBrowseRecordList', updateParams); }, + + getActivityList:()=>{ + return Axios.DEFAULT_GET('/mock/activity/getActivityList') + } } diff --git a/src/utils/axios-util.js b/src/utils/axios-util.js index 80d0529..46a83fa 100644 --- a/src/utils/axios-util.js +++ b/src/utils/axios-util.js @@ -119,9 +119,14 @@ base = 'http://52.221.25.56:9230/'; export const PATCH = (url, params) => { return httpAxios.patch(`${base}${url}`, params).then(res => res.data) } + +export const DEFAULT_GET = (url, params) => { + return httpAxios.get(`${url}`, {params: params}).then(res => res.data) +} export default { POST, - TEST_POST + TEST_POST, + DEFAULT_GET } \ No newline at end of file diff --git a/src/views/Login.vue b/src/views/Login.vue index 6ab6a98..66afe11 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -173,7 +173,7 @@ export default { if (this.$route.query.redirect == location.hostname) { this.$router.go(-1); } else { - this.$router.push('/custList'); + this.$router.push('/activities'); } }, resetForm() { diff --git a/src/views/activity/components/edit.vue b/src/views/activity/components/edit.vue new file mode 100644 index 0000000..339643a --- /dev/null +++ b/src/views/activity/components/edit.vue @@ -0,0 +1,65 @@ + + + + + \ No newline at end of file diff --git a/src/views/activity/components/list.vue b/src/views/activity/components/list.vue new file mode 100644 index 0000000..bb84974 --- /dev/null +++ b/src/views/activity/components/list.vue @@ -0,0 +1,96 @@ + + + + + \ No newline at end of file diff --git a/src/views/activity/index.vue b/src/views/activity/index.vue index 417f2d5..d4d81f0 100644 --- a/src/views/activity/index.vue +++ b/src/views/activity/index.vue @@ -1,13 +1,129 @@ \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index 8c39024..904fea4 100644 --- a/vue.config.js +++ b/vue.config.js @@ -9,9 +9,9 @@ //vue 官方关于vue.config.js中配置的详细文档: https://cli.vuejs.org/zh/config/#vue-config-js module.exports = { publicPath: process.env.NODE_ENV === 'production' - // ? '/crm-project/' - ? '/crm/' - : '/', + // ? '/crm-project/' + ? '/crm/' + : '/', devServer: { overlay: { warnings: false, @@ -62,5 +62,12 @@ module.exports = { lintOnSave: false,//是否开启selint css: { extract: false + }, + configureWebpack:{ + watch:true, + watchOptions: { + poll: 1000, + }, } + }