From 89ac8f2ab6bb8f11fc799c5be5e602571acbd887 Mon Sep 17 00:00:00 2001 From: jia <1451658316@qq.com> Date: Sun, 5 Nov 2023 00:08:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hbuilderx/launch.json | 20 + App.vue | 31 + api/approve.js | 24 + api/business.js | 12 + api/bussness.js | 14 + api/company.js | 77 ++ api/complaint.js | 7 + api/config.js | 6 + api/contract.js | 12 + api/file.js | 50 ++ api/index.js | 28 + api/information.js | 22 + api/junziqian.js | 3 + api/logistics.js | 16 + api/notice.js | 7 + api/oa.js | 247 +++++++ api/oaApi.js | 60 ++ api/oaPbulic.js | 47 ++ api/oaUser.js | 71 ++ api/pay.js | 59 ++ api/property.js | 53 ++ api/pubic.js | 17 + api/shareholder.js | 21 + api/task.js | 62 ++ api/upload.js | 65 ++ api/user.js | 743 +++++++++++++++++++ components/UploadDemo.vue | 289 ++++++++ components/jyf-parser/jyf-parser.vue | 815 +++++++++++++++++++++ components/jyf-parser/libs/CssHandler.js | 111 +++ components/jyf-parser/libs/MpHtmlParser.js | 586 +++++++++++++++ components/jyf-parser/libs/config.js | 89 +++ components/jyf-parser/libs/handler.sjs | 44 ++ components/jyf-parser/libs/handler.wxs | 53 ++ components/jyf-parser/libs/trees.vue | 485 ++++++++++++ components/return/index.vue | 120 +++ components/w-picker/areadata/areadata.js | 1 + components/w-picker/date-picker.vue | 742 +++++++++++++++++++ components/w-picker/half-picker.vue | 345 +++++++++ components/w-picker/linkage-picker.vue | 274 +++++++ components/w-picker/range-picker.vue | 344 +++++++++ components/w-picker/region-picker.vue | 183 +++++ components/w-picker/selector-picker.vue | 129 ++++ components/w-picker/shortterm-picker.vue | 250 +++++++ components/w-picker/time-picker.vue | 218 ++++++ components/w-picker/w-picker.css | 26 + components/w-picker/w-picker.vue | 340 +++++++++ config/app.js | 57 ++ config/cache.js | 41 ++ index.html | 20 + libs/login.js | 104 +++ libs/routine.js | 186 +++++ libs/uniApi.js | 474 ++++++++++++ main.js | 29 + manifest.json | 76 ++ package-lock.json | 24 + package.json | 5 + pages.json | 547 ++++++++++++++ uni.promisify.adaptor.js | 10 + uni.scss | 77 ++ 59 files changed, 8868 insertions(+) create mode 100644 .hbuilderx/launch.json create mode 100644 App.vue create mode 100644 api/approve.js create mode 100644 api/business.js create mode 100644 api/bussness.js create mode 100644 api/company.js create mode 100644 api/complaint.js create mode 100644 api/config.js create mode 100644 api/contract.js create mode 100644 api/file.js create mode 100644 api/index.js create mode 100644 api/information.js create mode 100644 api/junziqian.js create mode 100644 api/logistics.js create mode 100644 api/notice.js create mode 100644 api/oa.js create mode 100644 api/oaApi.js create mode 100644 api/oaPbulic.js create mode 100644 api/oaUser.js create mode 100644 api/pay.js create mode 100644 api/property.js create mode 100644 api/pubic.js create mode 100644 api/shareholder.js create mode 100644 api/task.js create mode 100644 api/upload.js create mode 100644 api/user.js create mode 100644 components/UploadDemo.vue create mode 100644 components/jyf-parser/jyf-parser.vue create mode 100644 components/jyf-parser/libs/CssHandler.js create mode 100644 components/jyf-parser/libs/MpHtmlParser.js create mode 100644 components/jyf-parser/libs/config.js create mode 100644 components/jyf-parser/libs/handler.sjs create mode 100644 components/jyf-parser/libs/handler.wxs create mode 100644 components/jyf-parser/libs/trees.vue create mode 100644 components/return/index.vue create mode 100644 components/w-picker/areadata/areadata.js create mode 100644 components/w-picker/date-picker.vue create mode 100644 components/w-picker/half-picker.vue create mode 100644 components/w-picker/linkage-picker.vue create mode 100644 components/w-picker/range-picker.vue create mode 100644 components/w-picker/region-picker.vue create mode 100644 components/w-picker/selector-picker.vue create mode 100644 components/w-picker/shortterm-picker.vue create mode 100644 components/w-picker/time-picker.vue create mode 100644 components/w-picker/w-picker.css create mode 100644 components/w-picker/w-picker.vue create mode 100644 config/app.js create mode 100644 config/cache.js create mode 100644 index.html create mode 100644 libs/login.js create mode 100644 libs/routine.js create mode 100644 libs/uniApi.js create mode 100644 main.js create mode 100644 manifest.json create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 pages.json create mode 100644 uni.promisify.adaptor.js create mode 100644 uni.scss diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json new file mode 100644 index 0000000..4ccd172 --- /dev/null +++ b/.hbuilderx/launch.json @@ -0,0 +1,20 @@ +{ + // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 + "version" : "0.0", + "configurations" : [ + { + "app-plus" : { + "launchtype" : "local" + }, + "default" : { + "launchtype" : "local" + }, + "type" : "uniCloud" + }, + { + "playground" : "custom", + "type" : "uni-app:app-android" + } + ] +} diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..0f1d92e --- /dev/null +++ b/App.vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/api/approve.js b/api/approve.js new file mode 100644 index 0000000..e05eecf --- /dev/null +++ b/api/approve.js @@ -0,0 +1,24 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 审批类型 + */ +export const approveTypes = (data) => oahttp.get('/approve/approveType', data) + +/** + * 审批列表 + */ +export const approveLists = (data) => oahttp.get('/approve/lists', data) + +/** + * 审批详情 + */ +export const approveDetails = (data) => oahttp.post('/approve/detail', data) + +/** + * 审批 + */ +export const approveAudit = (data) => oahttp.post('/approve/audit', data) + + + diff --git a/api/business.js b/api/business.js new file mode 100644 index 0000000..adc921f --- /dev/null +++ b/api/business.js @@ -0,0 +1,12 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 商机列表 + */ +export const opportunity = (data) => oahttp.get('/information/list', data) + + +/** + * 商机详情 + */ +export const oppordetails = (data) => oahttp.get('/information/details', data) \ No newline at end of file diff --git a/api/bussness.js b/api/bussness.js new file mode 100644 index 0000000..1a00163 --- /dev/null +++ b/api/bussness.js @@ -0,0 +1,14 @@ +import oahttp from "@/utils/aa.js"; + +/** + * 绑定scoket + */ +export const bindScoket = (data) => oahttp.post('/common/im/doBindUid', data) +// 发送消息 +export const sendMsgApi = (data) => oahttp.post('/common/im/sendTextMsg', data) +// 发送文件 +export const sendFileApi = (data) => oahttp.post('/common/im/sendFileMsg', data) +// 消息列表 +export const getMsgListApi = (data) => oahttp.post('/common/im/msgList', data) +// 片区经理id +export const getAreaManagerApi = (data) => oahttp.post('/common/im/getAreaManager', data) diff --git a/api/company.js b/api/company.js new file mode 100644 index 0000000..44681dc --- /dev/null +++ b/api/company.js @@ -0,0 +1,77 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 我的公司 + */ +export const companyMine = (data) => oahttp.get('/company/mine', data) + +/** + * 公司列表 + */ +export const companyIndex = (data) => oahttp.get('/company/index', data) + +/** + * 未签约公司列表 + */ +export const companyUnsigned = (data) => oahttp.get('/company/unsigned', data) + +/** + * 公司详情 + */ +export const companyView = (data) => oahttp.get('/company/view', data) + +/** + * 公司详情 + */ +export const companyAreaManager = (data) => oahttp.get('/company/areaManager', data) + +/** + * 人员列表 + */ +export const companyUser = (data) => oahttp.get('/company/users', data) + +/** + * 人员详情 + */ +export const companyUserDetail = (data) => oahttp.get('/company/user', data) + + +/** + * 月流水 + */ +export const accountMonthList = (data) => oahttp.get('/account_log/company_year_count', data) + +/** + * 日流水 + */ +export const accountDateList = (data) => oahttp.get('/account_log/company_lists', data) + +/** + * 发起合同 + */ +export const initiateContract = (data) => oahttp.post('/company/initiate_contract', data) + +/** + * 生成合同 + */ +export const Draftingcontracts = (data) => oahttp.post('/company/Draftingcontracts', data) + +/** + * 发送短信 + */ +export const postsms = (data) => oahttp.post('/company/postsms', data) + +/** + * 公司财务 + */ +export const sss = (data) => oahttp.post('/company/postsms', data) + +/** + * 查询甲方公司信息 + */ +export const getPartyACompany = (data) => oahttp.get('/company/getPartyACompany', data) + +/** + * 查询押金凭证记录 + */ +export const getDepositRechargeTransferVoucherList = (data) => oahttp.get('/company/getDepositRechargeTransferVoucherList', data) diff --git a/api/complaint.js b/api/complaint.js new file mode 100644 index 0000000..a678f0e --- /dev/null +++ b/api/complaint.js @@ -0,0 +1,7 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 发起投诉 + */ +export const complaintFeedback = (data) => oahttp.post('/company/complaint_feedback', data) + diff --git a/api/config.js b/api/config.js new file mode 100644 index 0000000..93fcd12 --- /dev/null +++ b/api/config.js @@ -0,0 +1,6 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * ȡϢ + */ +export const getConfig = (data) => oahttp.get('/index/config', data, { noAuth:true }, true) diff --git a/api/contract.js b/api/contract.js new file mode 100644 index 0000000..15245f8 --- /dev/null +++ b/api/contract.js @@ -0,0 +1,12 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * ͬб + */ +export const contractList = (data) => oahttp.get('/contract/index', data) + + +/** + * ͬ + */ +export const contractView = (data) => oahttp.get('/contract/view', data) \ No newline at end of file diff --git a/api/file.js b/api/file.js new file mode 100644 index 0000000..61c335e --- /dev/null +++ b/api/file.js @@ -0,0 +1,50 @@ +import { + HTTP_REQUEST_URL_THREE, + HEADER, + TOKENNAME, +} from '@/config/app'; +import { + Toast +} from '../libs/uniApi'; +// import { checkLogin } from '../libs/login'; +import store from '../store'; + +function toLogin() { + store.commit("LOGOUT"); + uni.showToast({ + title: '请登录', + icon: 'none', + duration: 1000 + }); +} + +function upLoad(url, data) { + let Url = HTTP_REQUEST_URL_THREE, + header = {} + if (store.state.app.token) header[TOKENNAME] = store.state.app.token; + return new Promise((reslove, reject) => { + uni.uploadFile({ + url: Url + '/api' + url, + filePath: data.filePath, + name: data.name, + success: (uploadFileRes) => { + uploadFileRes.data = JSON.parse(uploadFileRes.data) + if (uploadFileRes.data.code == 1) reslove(uploadFileRes.data) + else Toast('网络错误') + }, + fail: (err) => { + Toast('网络错误') + } + }) + }); +} + +export const upLoadImage = (data) => { + return upLoad('/upload/image', data) +} + +export const VIDEO_URL = HTTP_REQUEST_URL_THREE + '/api/upload/video' +export const FILE_URL = HTTP_REQUEST_URL_THREE + '/api/home_index/upload' +// im文件上传 +// export const VIDEO_URL_IM = HTTP_REQUEST_URL_THREE + '/api/upload/video' +export const FILE_URL_IM = HTTP_REQUEST_URL_THREE + '/common/im/sendFileMsg' \ No newline at end of file diff --git a/api/index.js b/api/index.js new file mode 100644 index 0000000..6c38943 --- /dev/null +++ b/api/index.js @@ -0,0 +1,28 @@ +// let Token = localStorage.getItem("token") +let Token = uni.getStorageSync("token") +let request = (METHOD, URL, DATA) => { + return new Promise((reslove, reject) => { + uni.request({ + url: 'https://ceshi-im.lihaink.cn/' + URL, + method: METHOD, + data: { + ...DATA + }, + header: { + 'content-type': 'application/json', + "Authorization": Token || "" + + }, + success: function(res) { + reslove(res) + }, + fail: function(err) { + reject(err) + }, + + }); + }) +} + + +export default request; \ No newline at end of file diff --git a/api/information.js b/api/information.js new file mode 100644 index 0000000..fedbdda --- /dev/null +++ b/api/information.js @@ -0,0 +1,22 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 新增档案 + */ +export const informationAdd = (data) => oahttp.post('/information/add', data) + +/** + * 新增列表 + */ +export const informationList = (data) => oahttp.get('/information/list', data) + +/** + * 档案详情 + */ +export const informationDetails = (data) => oahttp.get('/information/details', data) + +/** + * 更新商机 + */ +export const informationOpportunityUpdate = (data) => oahttp.post('/information/opportunity_update', data) + diff --git a/api/junziqian.js b/api/junziqian.js new file mode 100644 index 0000000..37983c2 --- /dev/null +++ b/api/junziqian.js @@ -0,0 +1,3 @@ +import oahttp from "@/utils/oahttp.js"; +//获取合同链接 +export const download_file = (data) => oahttp.get('/junziqian/download_file', data) diff --git a/api/logistics.js b/api/logistics.js new file mode 100644 index 0000000..7bb5c59 --- /dev/null +++ b/api/logistics.js @@ -0,0 +1,16 @@ +import oahttp from "@/utils/logistics.js"; + +/** + * 订单列表 + */ +export const getList = (data) => oahttp.get('/courierLstData', data) +// 订单详情 +export const getDetil = (data) => oahttp.get('/lstDetail', data) +// 取货 +export const takeGoods = (data) => oahttp.post('/takeGoods', data) +// 送达 +export const doneDelivery = (data) => oahttp.post('/doneDelivery', data) +/** + * 更新商机 + */ +export const informationOpportunityUpdate = (data) => oahttp.post('/information/opportunity_update', data) \ No newline at end of file diff --git a/api/notice.js b/api/notice.js new file mode 100644 index 0000000..956456c --- /dev/null +++ b/api/notice.js @@ -0,0 +1,7 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 公告列表 + */ +export const noticeList = (data) => oahttp.get('/article/lists', data) +export const noticeDetail = (data) => oahttp.get('/article/detail', data) \ No newline at end of file diff --git a/api/oa.js b/api/oa.js new file mode 100644 index 0000000..0dfd153 --- /dev/null +++ b/api/oa.js @@ -0,0 +1,247 @@ +import oahttp from "@/utils/oahttp.js"; + +//获取代办事项 已处理事项 +export const getMatters = (data) => oahttp.get('/approve/list', data, { noAuth: true }) + +//获取任务列表 +export const getTaskListApi = (data) => oahttp.get('/task/list', data) +//获取 我发起的审批 +export const getExamineListApi = () => oahttp.get('/approve/my_list') +//获取工资详情信息 +export const getSalaryDeatilsApi = () => oahttp.get('/user/info') +//获取部门 +export const getDepartmentApi = () => oahttp.get('/index/get_department_tree') +//获取部门人员 +export const getDepartmentPersonApi = (data) => oahttp.get('/index/get_employee', data) +//新建任务 +export const addNewTaskApi = (data) => oahttp.post('/task/add', data) +//获取文档列表 +export const getDocumentListApi = (data) => oahttp.get('/note_index/index', data) +//获取文档列表 +export const getDocumentListnote = (data) => oahttp.get('/note_index/view', data) +//获取个人信息 +export const getPersonInfoApi = () => oahttp.get('/home_index/userinfo') +//获取应用 +export const oaapprove = () => oahttp.get('/oa_approve/app') + +//获取部门 +export const userdepartment = (data) => oahttp.get('/user_department/index',data) +//获取部门架构 +export const userdepartmenttree = () => oahttp.get('/user_department/tree') + +//用户信息统计 +export const getdatatotal = (data) => oahttp.get('/home_index/data_total',data) + +//新增部门 +export const adddepartment = (data) => oahttp.post('/user_department/add',data) +//删除部门 +export const deletedepartment = (data) => oahttp.post('/user_department/delete',data) + +//获取岗位 +export const userposition = (data) => oahttp.get('/user_position/index',data) + +//获取岗位权限组 +export const userpositiongroup = (data) => oahttp.get('/user_position/group',data) + + +//新增编辑岗位 +export const adduserposition= (data) => oahttp.post('/user_position/add',data) + +//删除岗位 +export const deleteuserposition = (data) => oahttp.post('/user_position/delete',data) + +//获取人事调动记录 +export const userpersonal = (data) => oahttp.get('/user_personal/change',data) + + +//新增编辑人事调动记录 +export const adduserpersonal= (data) => oahttp.post('/user_personal/change_add',data) + + +//获取部门树形架构 +export const getdepartmenttree = (data) => oahttp.get('/common/get_department_tree',data) +//获取部门员工 +export const getemployee = (data) => oahttp.get('/common/get_employee',data) +//获取离职信息 +export const leaveuserpersonal = (data) => oahttp.get('/user_personal/leave',data) +//删除离职恢复职务 +export const leavedelete = (data) => oahttp.get('/user_personal/leave_delete',data) +//新增编辑离职 +export const leaveadd = (data) => oahttp.get('/user_personal/leave_add',data) + +//获取企业员工列表 +export const comanyerlist = (data) => oahttp.get('/user_user/index',data) + +//获取企业员工详情 +export const comanyerview= (data) => oahttp.get('/user_user/view',data) + + +//新增编辑员工 +export const addcomanyer= (data) => oahttp.post('/user_user/add',data) + + + +//设置员工状态 +export const setcomanyer= (data) => oahttp.get('/user_user/set',data) + +//获取文章列表 +export const articleindex= (data) => oahttp.get('/article_index/index',data) + +//获取文章详情 +export const articleview= (data) => oahttp.get('/article_index/view',data) +//获取项目列表 +export const projectlist = (data) => oahttp.get('/project_index/index',data) + +//新增项目 +export const addproject= (data) => oahttp.post('/project_index/add',data) + +//获取项目列表详情 +export const projectview= (data) => oahttp.get('/project_index/view',data) +//删除附件 +export const deleteprojectview= (data) => oahttp.post('/project_index/delete',data) + + + + +//上传项目附件 +export const addfile= (data) => oahttp.post('/project_index/add_file',data) +//删除附件 +export const deletefile= (data) => oahttp.post('/project_index/delete_file',data) + +//上传项目附件 +export const addlink= (data) => oahttp.post('/project_index/add_link',data) + +//删除附件 +export const deletelink= (data) => oahttp.post('/project_index/delete_link',data) + + + +//获取项目任务列表 +export const projecttasklist = (data) => oahttp.get('/project_task/index',data) +//新增项目任务 +export const addprojecttask= (data) => oahttp.post('/project_task/add',data) + +//获取项目任务列表详情 +export const projecttaskview= (data) => oahttp.get('/project_task/view',data) + +//删除项目任务列表 +export const deleteproject_task= (data) => oahttp.post('/project_task/delete',data) + + +//获取项目工时列表 +export const schedulelist = (data) => oahttp.get('/project_task/task_time',data) + +//新增项目工时 +export const addschedule= (data) => oahttp.post('/oa_schedule/add',data) + +//删除项目工时列表 +export const deleteschedule= (data) => oahttp.post('/oa_schedule/delete',data) + +//获取获取审批应用字段 + +export const appfield = (data) => oahttp.get('/oa_approve/app_field',data) + + +//发起审批 +export const appapprove = (data) => oahttp.post('/oa_approve/add',data) +//获取发起审批记录 +export const approveindex = (data) => oahttp.get('/oa_approve/index',data) +//获取我处理的审批记录 +export const approvelist = (data) => oahttp.get('/oa_approve/list',data) +//获取抄送的审批记录 +export const approvecopy = (data) => oahttp.get('/oa_approve/copy',data) +//获取审批消息 +export const appmessageinbox = (data) => oahttp.get('/message_index/inbox',data) + +//获取审批消息 +export const appmessageread = (data) => oahttp.get('/message_index/read',data) +//流程审批 +export const appflow_check = (data) => oahttp.post('/oa_approve/flow_check',data) +//获取审批消息 +export const appapproveview= (data) => oahttp.get('/oa_approve/view',data) + +//撤回审批 +export const appapflow_check= (data) => oahttp.post('/index/flow_check',data) + + + + +//获取发起报销记录 +export const appexpenseindex = (data) => oahttp.get('/finance_expense/index',data) +//获取我处理的报销记录 +export const apexpenselist = (data) => oahttp.get('/finance_expense/list',data) +//获取抄送的报销记录 +export const appexpensecopy = (data) => oahttp.get('/oa_approve/copy',data) + +//报销类型 +export const appexpensecate = (data) => oahttp.get('/common/get_expense_cate',data) + +//报销审批流程id +export const appexpenseflow = (data) => oahttp.get('/finance_expense/get_expense_flow',data) + +//发起报销 +export const appexpense = (data) => oahttp.post('/finance_expense/add',data) + +//删除报销报销流程详情 +export const deleteexpenseflow = (data) => oahttp.get('/finance_expense/delete',data) + +//获取报销流程详情 +export const appexpenseview = (data) => oahttp.get('/finance_expense/view',data) + +//报销打款 +export const topayview = (data) => oahttp.get('/finance_expense/topay',data) + +//获取报销打款 +export const checkedlist = (data) => oahttp.get('/finance_expense/checkedlist',data) + + +//发票 +//我申请的发票 + +export const invoiceindex = (data) => oahttp.get('/finance_invoice/index',data) + +//我处理的发票 +export const invoicelist = (data) => oahttp.get('/finance_invoice/list',data) + +//抄送给我的发票 +export const invoicecopy = (data) => oahttp.get('/finance_invoice/copy',data) + +//获取发票类型 +export const invoicecate = (data) => oahttp.get('/common/get_invoice_subject',data) + +//发起发票 +export const addinvoice = (data) => oahttp.post('/finance_invoice/add',data) + +//获取发票流程详情 +export const invoiceview = (data) => oahttp.get('/finance_invoice/view',data) +//获取发票流程 +export const invoiceflow = (data) => oahttp.get('/finance_invoice/get_invoice_flow',data) + + + +//获取待办事项 + +export const todosubjec = (data) => oahttp.get('/common/get_todo_subject',data) +//获取待办事任务 +export const tasksubjec = (data) => oahttp.get('/common/get_task_list',data) + + + +//获取发票开票 +export const invoicecheckedlist = (data) => oahttp.get('/finance_invoice/checkedlist',data) +//发票开票/修改 +export const financeopen = (data) => oahttp.get('/finance_invoice/open',data) + + + +//发票作废 +export const tovoid = (data) => oahttp.post('/finance_invoice/tovoid',data) + +//发票反作废 +export const novoid = (data) => oahttp.get('/finance_invoice/novoid',data) + +//获取发票到账信息 +export const incomeflow = (data) => oahttp.get('/finance_income/index',data) + +//获取发票到账详情 +export const incomeview = (data) => oahttp.get('/finance_income/view',data) \ No newline at end of file diff --git a/api/oaApi.js b/api/oaApi.js new file mode 100644 index 0000000..ca79bff --- /dev/null +++ b/api/oaApi.js @@ -0,0 +1,60 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 获取代办事项 已处理事项 + */ +export const getIndexListAPI = (data) => oahttp.get('/index/list', data) + +/** + * 获取任务列表 + */ +export const getTaskListAPI = (data) => oahttp.get('/task/list', data) + +/** + * 获取我的任务 + */ +export const getMyTaskListAPI = (data) => oahttp.get('/task/datalist', data) + +/** + * 获取任务详情 + */ +export const getTaskDetailsAPI = (data) => oahttp.get('/task/read', data) +/** + * 我发起的审批 + */ +export const getApproveMyListAPI = (data) => oahttp.get('/approve/my_list', data) +/** + * 我审批的 + */ +export const getHandleListAPI = (data) => oahttp.get('/approve/handle_list', data) +/** + * 抄送给我的 + */ +export const getCopyOfMyListAPI = (data) => oahttp.get('/approve/copy', data) +/* + * 待办事项 + */ +export const getApproveListAPI = (data) => oahttp.get('/approve/list', data) +/** + * 获取个人中心数据 + */ +export const getUserIndexAPI = (data) => oahttp.get('/user/index', data) +/** + * 保存个人信息修改 + */ +export const PostUserPerSubmitAPI = (data) => oahttp.post('/home_index/edit_personal', data) +/** + * 获取审核流程 + * index/get_flow?type=1 + */ +export const getFlowAPI = (data) => oahttp.get('/index/get_flow', data) +/** + * 获取审核步骤人员 + */ +export const getFlowUsersAPI = (data) => oahttp.get('/index/get_flow_users', data, { noVerify: true }) +/** 获取部门树形节点列表 */ +export const getDepartmentTreeAPI = () => oahttp.get('/index/get_department_tree') +/** 获取某个部门的员工 */ +export const getEmployeeAPI = (data) => oahttp.get('/index/get_employee', data) +/** 发起审批 */ +export const PostApproveAddAPI = (data) => oahttp.post('/approve/add', data) diff --git a/api/oaPbulic.js b/api/oaPbulic.js new file mode 100644 index 0000000..292b5db --- /dev/null +++ b/api/oaPbulic.js @@ -0,0 +1,47 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 获取市 + */ +export const commonCity = (data) => oahttp.get('/common/city', data) + +/** + * 获取省 + */ +export const commonProvince = (data) => oahttp.get('/common/province', data) + +/** + * 获取区县 + */ +export const commonArea = (data) => oahttp.get('/common/area', data) + +/** + * 获取城镇 + */ +export const commonStreet = (data) => oahttp.get('/common/street', data) + +/** + * 获取村 + */ +export const commonVillage = (data) => oahttp.get('/common/village', data) + +/** + * 获取小队 + */ +export const commonBrigade = (data) => oahttp.get('/common/brigade', data) + + +/** + * 获取商机分类 + */ +export const categoryBusinessList = (data) => oahttp.get('/CategoryBusiness/list', data) + +/** + * 字典列表 + */ +export const dictDataLists = (data) => oahttp.get('/common/dict_data_lists', data) + +/** + * 字典列表: 按数据值取 + */ +export const dictDataListsTypeValue = (data) => oahttp.get('/common/dict_data_lists_by_type_value', data) \ No newline at end of file diff --git a/api/oaUser.js b/api/oaUser.js new file mode 100644 index 0000000..5c95ad0 --- /dev/null +++ b/api/oaUser.js @@ -0,0 +1,71 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 登录 + */ +export const loginAccount = (data, onReLogin = false) => oahttp.post('/home_login/login_submit', data, { noAuth: true, onReLogin: onReLogin }) + +/** + * cesi + */ +export const test = (data) => oahttp.post('/index/config', data, { noAuth: true }) + +/** + * 个人中心 + */ +export const userCenter = (data) => oahttp.get('/user/center', data) + +/** + * 个人信息 + */ +export const userInfo = (data) => oahttp.get('/home_index/userinfo', data) + +/** + * 修改密码 + */ +export const changePassword = (data) => oahttp.post('/home_index/edit_password', data) + +/** + * 获取当前公司已创建的小队 + */ +export const userCompanyBrigade = (data) => oahttp.get('/user/company_brigade', data) + +/** + * 新增人员 + */ +export const loginAdd = (data) => oahttp.post('/login/add', data) + +/** + * 修改人员 + */ +export const userSetInfo = (data) => oahttp.post('/user/setInfo', data) + +/** + * 设置是否为队长 + */ +export const loginSetInfo = (data) => oahttp.post('/login/setInfo', data) + +/** + * 生成合同 + */ +export const userDraftingcontracts = (data) => oahttp.post('/user/Draftingcontracts', data) + +/** + * 发起合同 + */ +export const userInitiateContract = (data) => oahttp.post('/user/initiate_contract', data) + +/** + * 发送短信 + */ +export const userPostsms = (data) => oahttp.post('/user/postsms', data) + +/** + * 注销账号 + */ +export const destroyAccount = (data) => oahttp.post('/user/destroy_account', data) + +/** + * 商城登录 + */ +export const loginShopAccount = (data) => oahttp.post('/login/shop_account', data, { noAuth: true }) diff --git a/api/pay.js b/api/pay.js new file mode 100644 index 0000000..21b9700 --- /dev/null +++ b/api/pay.js @@ -0,0 +1,59 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 充值 + */ +export const recharge = (data) => oahttp.post('/recharge/recharge', data) +/** + * 押金充值记录 + */ +export const deposit_recharge = (data) => oahttp.get('/recharge/deposit_lists', data) +/** + * 支付方式 + */ +export const payWay = (data) => oahttp.get('/pay/payWay', data) + +/** + * 预支付 + */ +export const payPrepay = (data) => oahttp.post('/pay/prepay', data) + +/** + * 支付配置 + */ +export const wechatJsConfig = (data) => oahttp.get('/wechat/jsConfig', data) + +/** + * 支付状态 + */ +export const payStatus = (data) => oahttp.get('/pay/payStatus', data) + +/** + * 充值记录 + */ +export const rechargeLists = (data) => oahttp.get('/recharge/lists', data) + +/** + * 余额明细 + */ +export const accountLogLists = (data) => oahttp.get('/account_log/lists', data) + +/** + * 月份统计 + */ +export const accountLogListsMonth = (data) => oahttp.get('/account_log/year_count', data) + +/** + * 余额提现 + */ +export const userWithdraw = (data) => oahttp.get('/user/withdraw', data) + +/** + * 提现记录 + */ +export const userWithdrawList = (data) => oahttp.get('/user/withdrawList', data) + +/** + * 可提现金额 + */ +export const getCurrCycleWithdraw = (data) => oahttp.get('/user/getCurrCycleWithdraw', data) \ No newline at end of file diff --git a/api/property.js b/api/property.js new file mode 100644 index 0000000..e016efe --- /dev/null +++ b/api/property.js @@ -0,0 +1,53 @@ +import oahttp from "@/utils/oahttp.js"; + +// http://logistics.lihaink.cn/api/getCarHistory +/** + * 车辆列表 + */ +// /api/vehicle/townCompanyVehicleIndex +export const getvehicleListApi = (data) => oahttp.get('/vehicle/townCompanyVehicleIndex', data) +// 车辆详情 +export const getvehicleDetailApi = (data) => oahttp.get('/vehicle/vehicleInfo', data) +// 车辆上传 +export const upVehicleApi = (data) => oahttp.post('/vehicle/rentApply', data) +// 申请用车 +export const applycarApi = (data) => oahttp.post('/vehicle/rentApply', data) +// 显示轨迹 +export const locusApi = (data) => oahttp.post('/vehicle/vehicleTrack', data) +// 获取可购买车辆列表 +export const canBuyCarListApi = (data) => oahttp.get('/vehicle/getFreeCars', data) +// 购买车辆 +export const buyCarApi = (data) => oahttp.post('/vehicle/buyCars', data) +// 当前车辆位置信息 +// export const locusApi = (data) => oahttp.post('/vehicle/vehicleTrack', data) +// api / getCarLocal +// 签约列表 +export const getAgencyListApi = (data) => oahttp.get('/vehicle/rentApplyList', data) +// 签约公司详情 +export const getAgencyDetailApi = (data) => oahttp.get('/vehicle/rentApplyInfo', data) +// 车辆租赁 +export const leaseApi = (data) => oahttp.post('/vehicle/setContractByTownCompany', data) +// 生成合同 +export const contractApi = (data) => oahttp.post('/vehicle/setContractByVillageCompany', data) +// 发送合同 +export const sendcontractApi = (data) => oahttp.post('/vehicle/initiatingRentCarContract', data) +// 申请驳回 +export const overruleApi = (data) => oahttp.post('/vehicle/rejectRentApply', data) +// 小组公司详情 +export const villageCompanyApi = (data) => oahttp.get('/vehicle/villageCompanyIndex', data) + +// 重新发送短信 +export const sendMsgApi = (data) => oahttp.post('/vehicle/sendSmsAgain', data) +// 解约 +export const cancelContractApi = (data) => oahttp.post('/vehicle/cancelContract', data) +// 镇街公司合同列表 +export const ContractListApi = (data) => oahttp.get('/vehicle/townCompanyContractList', data) +// 图片上传 +export const upLoadImage = (data) => oahttp.post('/upload/image', data) +// 资产详情 +// export const getpropertyDetil = (data) => oahttp.get('/lstDetail', data) + +/** + * 更新商机 + */ +// export const informationOpportunityUpdate = (data) => oahttp.post('/information/opportunity_update', data) \ No newline at end of file diff --git a/api/pubic.js b/api/pubic.js new file mode 100644 index 0000000..4533f7f --- /dev/null +++ b/api/pubic.js @@ -0,0 +1,17 @@ +import request from '@/utils/request.js' +export function commonAuth(data) { + return request.post( + "auth", data, { + noAuth: true + } + ); +} +/** + * 小程序用户登录 + * @param data object 小程序用户登陆信息 + */ +export function login(data) { + return request.post("auth/mp", data, { + noAuth: true + }); +} diff --git a/api/shareholder.js b/api/shareholder.js new file mode 100644 index 0000000..8047043 --- /dev/null +++ b/api/shareholder.js @@ -0,0 +1,21 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 股金流水 + */ +export const companyAccountLog = (data) => oahttp.get('/company_account_log/lists', data) + +/** + * 股金详情 + */ +export const companyShareholderInfo = (data) => oahttp.get('/company/shareholder_info', data) + +/** + * 发起合同 + */ +export const initiateShareholderContract = (data) => oahttp.post('/company/initiate_shareholder_contract', data) + +/** + * 上交股金 + */ +export const companyPayShareCapital = (data) => oahttp.post('/company/pay_share_capital', data) \ No newline at end of file diff --git a/api/task.js b/api/task.js new file mode 100644 index 0000000..471ea33 --- /dev/null +++ b/api/task.js @@ -0,0 +1,62 @@ +import oahttp from "@/utils/oahttp.js"; + +/** + * 任务列表 + */ +export const taskLists = (data) => oahttp.get('/task/lists', data) + +/** + * 任务:更新档案列表 + */ +export const taskInformationgist = (data) => oahttp.get('/task/informationg_list', data) + + +/** + * 任务:片区交易 + */ +export const taskOrderDetail = (data) => oahttp.get('/task/order_detail', data) + +/** + * 任务:三轮游走获取地址 + */ +export const taskTricycleDetail = (data) => oahttp.get('/task/tricycle_detail', data) + +/** + * 任务:三轮游走上传位置 + */ +export const taskAddTricycleCoordinate = (data) => oahttp.post('/task/add_tricycle_coordinate', data) + +/** + * 任务:入股详情 + */ +export const taskShareholder = (data) => oahttp.get('/task/shareholder', data) + +/** + * 任务:其他任务详情 + */ +export const taskOtherTaskDetail = (data) => oahttp.get('/task/other_task_detail', data) + +/** + * 任务:提交其他任务 + */ +export const taskOtherTaskCommit = (data) => oahttp.post('/task/commit_other_task', data) + +/** + * 任务:服务任务详情 + */ +export const townTaskDetails = (data) => oahttp.get('/task/service_task_detail', data) + +/** + * 任务:提交督促小组服务团队学习任务 + */ +export const serviceTask4Commit = (data) => oahttp.post('/task/commit_town_task_type4', data) + +/** + * 任务:数字农贸宣传、加工业务建设和招商任务详情 + */ +export const marketTask10Detail = (data) => oahttp.post('/task/town_task_type_marketing_director_10_detail', data) + +/** + * 任务:数字农贸宣传、加工业务建设和招商任务提交 + */ +export const marketTask10Commit = (data) => oahttp.post('/task/commit_town_task_type_marketing_director_10', data) diff --git a/api/upload.js b/api/upload.js new file mode 100644 index 0000000..f26e859 --- /dev/null +++ b/api/upload.js @@ -0,0 +1,65 @@ +// import base from "@/config/baseUrl"; +// let baseUrl = 'https://ceshi.excellentkk.cn/api'; +import store from '../store'; +import { HTTP_REQUEST_URL_TWO, HTTP_REQUEST_URL_THREE, HEADER } from '@/config/app'; +let header = HEADER; + if (store.state.app.token){ + header.token = store.state.app.token; + } +function uploads(src, type) { + return new Promise((resolve, reject) => { + // console.log('上传', type === 'img' ? '图片' : '视频', ':', src) + let a = uni.uploadFile({ + // url: base.baseUrl + '/upload?token=', + url: HTTP_REQUEST_URL_TWO + '/api' + '/upload?token=', + filePath: src, + name: 'file', + success: (res) => { + let data = JSON.parse(res.data) + if (data.code != 1) { + uni.$u.toast(data.msg) + return false + } else { + resolve(data.data.url) // 返回线上地址 + } + }, + fail: (err) => { + reject(err) + console.log('upload-上传失败', err) + } + }); + }) +} + +function oaUploads(src, type) { + return new Promise((resolve, reject) => { + // console.log('上传', type === 'img' ? '图片' : '视频', ':', src) + + let a = uni.uploadFile({ + url: HTTP_REQUEST_URL_THREE + '/api/home_index/upload', + filePath: src, + name: 'file', + header: header, + success: (res) => { + + let data = JSON.parse(res.data) + if (data.code == 0) { + resolve(data.data) // 返回线上地址 + } else { + uni.$u.toast(data.msg) + return false + } + }, + fail: (err) => { + reject(err) + console.log('upload-上传失败', err) + } + }); + }) +} + + +export { + uploads, + oaUploads +} diff --git a/api/user.js b/api/user.js new file mode 100644 index 0000000..fca43c1 --- /dev/null +++ b/api/user.js @@ -0,0 +1,743 @@ +import request from "@/utils/request.js"; +import Cache from '@/utils/cache' +import http from "@/utils/http.js"; +/** + * 获取后台账号密码 + */ +export const getBackstageAPI = (data) => http.get('/User/get_backstage', data) +// 获取已录入公司 +export const getEnterListMsgAPI = (data) => http.get('/enter/list', data) +// 录入公司 +export const postEntercompanyAPI = (data) => request.post('entercompany', data) +// 获取地址 +export const getSiteAPI = (data) => http.get('/User/index', data) +export const getShimingAPI = (data) => http.get('/User/get_shiming', data) +export const postRealnameAPI = (data) => http.post('/User/realname', data) +/** + * 获取用户信息 + * + */ +export function getUserInfo() { + return request.get('user'); +} +/** + * 头像 + * + */ +export function editAvatar(data) { + return request.post('user/change/info', data); +} + +// 修改昵称 +export function updateInfo(data) { + return request.post('user/change/avatar', data); +} +/** + * h5用户登录 + * @param data object 用户账号密码 + */ +export function loginH5(data) { + return request.post("auth/login", data, { + noAuth: true + }); +} +/** + * h5用户手机号登录 + * @param data object 用户手机号 也只能 + */ +export function loginMobile(data) { + return request.post("auth/smslogin", data, { + noAuth: true + }); +} +/** + * h5用户手机号登录 + * @param data object 用户手机号 也只能 + */ +export function loginMpPhone(data) { + return request.post("auth/mp_phone", data, { + noAuth: true + }); +} +/** + * 验证码key + */ +export function getCodeApi() { + return request.get("verify_code", {}, { + noAuth: true + }); +} + +/** + * h5用户发送验证码 + * @param data object 用户手机号 + */ +export function registerVerify(data) { + return request.post("auth/verify", data, { + noAuth: true + }); +} +/** + * h5用户手机号注册 + * @param data object 用户手机号 验证码 密码 + */ +export function register(data) { + return request.post("auth/register", data, { + noAuth: true + }); +} + +/** + * 用户手机号修改密码 + * @param data object 用户手机号 验证码 密码 + */ +export function registerReset(data) { + return request.post("/register/reset", data, { + noAuth: true + }); +} +/** + * 用户手机号忘记密码 + */ +export function registerForget(data) { + return request.post("user/change_pwd", data, { + noAuth: true + }); +} +/** + * 获取用户中心菜单 + * + */ +export function getMenuList() { + return request.get("common/menus", {}, { + noAuth: true + }); +} +/* + * 签到用户信息 + * */ +export function getSignUser() { + return request.get("user/sign/info"); +} + +/** + * 获取签到配置 + * + */ +export function getSignConfig() { + return request.get('sign/config') +} +/** + * 获取签到列表 + * @param object data + */ +export function getSignList(data) { + return request.get('user/sign/lst', data); +} +/** + * 用户签到 + */ +export function setSignIntegral() { + return request.post('user/sign/create') +} + +/** + * 签到列表(年月) + * @param object data + * + */ +export function getSignMonthList(data) { + return request.get('user/sign/month', data) +} +/** + * 活动状态 + * + */ +export function userActivity() { + return request.get('user/activity'); +} +/* + * 资金明细(types|0=全部,1=消费,2=充值,3=返佣) + * */ +export function getCommissionInfo(q, types) { + return request.get("user/bill", q); +} +/* + * 提现列表 + * */ +export function extractLst(data) { + return request.get("user/extract/lst", data); +} +/* + * 积分记录 + * */ +export function getIntegralList(data) { + return request.get("user/integral/lst", data); +} + +/** + * 获取分销海报图片 + * + */ +export function spreadBanner() { + //#ifdef H5 + return request.get('user/spread_image', { + type: 'wechat' + }); + //#endif + //#ifdef MP + return request.get('user/spread_image', { + type: 'routine' + }); + //#endif +} +/** + * + * 获取推广用户一级和二级 + * @param object data + */ +export function spreadPeople(data) { + return request.get('user/spread_list', data); +} +/** + * + * 推广佣金/提现总和 + * @param int type + */ +export function spreadCount(type) { + return request.get('spread/count/' + type); +} +/* + * 推广数据 + * */ +export function getSpreadInfo() { + return request.get("/commission"); +} + +/** + * + * 推广订单 + * @param object data + */ +export function spreadOrder(data) { + return request.get('user/spread_order', data); +} + +/* + * 获取推广人排行 + * */ +export function getRankList(data) { + return request.get("user/spread_top", data); +} + +/* + * 获取佣金排名 + * */ +export function getBrokerageRank(q) { + return request.get("user/brokerage_top", q); +} + +/** + * 提现申请 + * @param object data + */ +export function extractCash(data) { + return request.post('user/extract/create', data) +} + +/** + * 提现银行/提现最低金额 + * + */ +export function extractBank() { + return request.get('user/extract/banklst'); +} + +/** + * 会员等级列表 + * + */ +export function userLevelGrade() { + return request.get('user/level/grade'); +} + +/** + * 获取某个等级任务 + * @param int id 任务id + */ +export function userLevelTask(id) { + return request.get('user/level/task/' + id); +} + +/** + * 检查用户是否可以成为会员 + * + */ +export function userLevelDetection() { + return request.get('user/level/detection'); +} + +/** + * + * 地址列表 + * @param object data + */ +export function getAddressList(data) { + return request.get('user/address/lst', data); +} + +/** + * 设置默认地址 + * @param int id + */ +export function setAddressDefault(id) { + return request.post('user/address/update/' + id) +} + +/** + * 修改 添加地址 + * @param object data + */ +export function editAddress(data) { + return request.post('user/address/create', data); +} + +/** + * 删除地址 + * @param int id + * + */ +export function delAddress(id) { + return request.post('user/address/delete/' + id) +} + +/** + * 获取单个地址 + * @param int id + */ +export function getAddressDetail(id) { + return request.get('user/address/detail/' + id); +} + +/** + * 修改用户信息 + * @param object + */ +export function userEdit(data) { + return request.post('user/edit', data); +} + +/* + * 退出登录 + * */ +export function getLogout() { + return request.post("logout"); +} + +/** + * 佣金转入 + * + */ +export function rechargeBrokerage(data) { + return request.post('user/recharge/brokerage', data) +} + +/** + * 小程序充值 + * + */ +export function rechargeRoutine(data) { + return request.post('recharge/routine', data) +} +/* + * 公众号充值 + * */ +export function rechargeWechat(data) { + return request.post("user/recharge", data); +} +/** + * 获取默认地址 + * + */ +export function getAddressDefault() { + return request.get('address/default'); +} + +/** + * 充值金额选择 + */ +export function getRechargeApi() { + return request.get("common/recharge_quota"); +} + +/** + * 登陆记录 + */ +export function setVisit(data) { + return request.post('user/set_visit', { + ...data + }, { + noAuth: true + }); +} + +/** + * 客服列表 + */ +export function serviceList(data) { + return request.get("service/list", data); +} + +/** + * 客服列表 + */ +export function serviceLogin(key, data) { + return request.post("service/scan_login/" + key, data); +} + +/** + * 客服获取客户列表 + */ +export function serviceUserList(mer_id, data) { + return request.get("service/user_list/" + mer_id, data); +} + +/** + * 用户获取聊天记录详情 + */ +export function getChatRecord(to_uid, data) { + return request.get("service/history/" + to_uid, data); +} + +/** + * 客服获取聊天记录详情 + */ +export function getMerHistory(userid, mer_id, data) { + return request.get("service/mer_history/" + mer_id + '/' + userid, data); +} + +/** + * 静默绑定推广人 + * @param {Object} puid + */ +export function spread(puid) { + Cache.set("spread", puid || 0); + return request.post("user/spread", { + spread_spid: puid + }); +} + +/** + * 反馈类型 + */ +export function feedbackType() { + return request.get("common/feedback_type"); +} + +/** + * 提交反馈 + */ +export function feedback(data) { + return request.post("user/feedback", { + ...data + }); +} + +/** + * 反馈列表 + */ +export function feedbackList(data) { + return request.get("user/feedback/list", data); +} + +/** + * 反馈列表 + */ +export function feedbackDetail(id) { + return request.get("user/feedback/detail/" + id); +} + +/** + * 浏览记录 + */ +export function historyList(data) { + return request.get("user/history", data); +} + +/** + * 删除浏览记录 + */ +export function historyDelete(id) { + return request.post("user/history/delete/" + id); +} +/** + * 批量删除浏览记录 + */ +export function historyBatchDelete(data) { + return request.post("user/history/batch/delete", data); +} +/** + * 批量收藏浏览记录 + */ +export function historyBatchCollect(data) { + return request.post("user/relation/batch/create", data); +} +/** + * 佣金记录 + */ +export function brokerage_list(data) { + return request.get("user/brokerage_list", data); +} + +/** + * 佣金数据 + */ +export function spreadInfo(data) { + return request.get("user/spread_info", data); +} + +// 图片验证码 +export function getCaptcha() { + return request.get('captcha', {}, { + noAuth: true + }); +} + +// 用户账户列表 +export function userAcc() { + return request.get('user/account', {}, { + noAuth: true + }); +} +// 创建发票 +export function invoiceSave(data) { + return request.post('user/receipt/create', data); +} +// 编辑发票 +export function invoiceUpdate(id, data) { + return request.post('user/receipt/update/' + id, data); +} +// 获取默认发票 +export function invoiceDefault(id) { + return request.post('user/receipt/is_default/' + id); +} +// 发票抬头--列表 +export function invoice(data) { + return request.get('user/receipt/lst', data); +} +// 发票抬头--删除 +export function invoiceDelete(id) { + return request.post('user/receipt/delete/' + id); +} +// 发票--详情 +export function invoiceDetail(id) { + return request.get('user/receipt/detail/' + id); +} + +/** + * 新版分享海报信息获取 + * + */ +export function spreadMsg(data) { + return request.get('user/v2/spread_image', data); +} + +/** + * 图片链接转base64 + * + */ +export function imgToBase(data) { + return request.post('common/base64', data); +} +/** + * 获取协议 + * + */ +export function getAgreementApi(key) { + return request.get('agreement/' + key, {}, { + noAuth: true + }); +} +/** + * 获取协议 + * + */ +export function getIntegralInfo() { + return request.get('user/integral/info'); +} +/** + * 获取店铺列表 + * + */ +export function getStoreList(data) { + return request.get('user/services', data); +} + +/* + 获取佣金说明 +*/ + +export function commissionDescription() { + return request.get('agreement/sys_extension_agree') +} +/* + 获取用户分销等级信息 +*/ + +export function getBrokerageInfo() { + return request.get('user/brokerage/info') +} +/* + 获取用户分销等级表格数据 +*/ + +export function getBrokerageGrade() { + return request.get('user/brokerage/all') +} +/* + 分销员升级提醒 +*/ + +export function brokerageNotice(data) { + return request.get(`user/brokerage/notice`, data) +} +/* + 口令解析 +*/ + +export function pwdResolution(data) { + return request.get(`command/copy?key=${data}`) +} +/* + 获取佣金说明 +*/ + +export function getInstructions(key) { + return request.get(`agreement/${key}`) +} +/* + 会员信息 +*/ + +export function memberInfo() { + return request.get('user/member/info') +} +/** + * 成长值记录 + * @param object data + * + */ +export function growthValueRecord(data) { + return request.get('user/member/log', data) +} + +/** + * 协议规则列表 + * @param object data + * + */ +export function cacheLst() { + return request.get('agreement_lst', {}, { + noAuth: true + }) +} + +/** + * 协议规则列表对应的数据 + * @param object data + * + */ +export function cacheInfo(key) { + return request.get(`agreement/${key}`, {}, { + noAuth: true + }) +} +/** + * 注销账户 + * @param object data + * + */ +export function userOut(data) { + return request.post(`user/cancel`, data) +} +/** + * 获取聊天用户信息 + * @param object data + * + */ +export function serviceUser(merId, uid) { + return request.get(`service/user/${merId}/${uid}`) +} +/** + * 保存聊天用户备注 + * @param object data + * + */ +export function serviceSaveMark(merId, uid, mark) { + return request.post(`service/mark/${merId}/${uid}`, { + mark + }) +} +/** + * 获取会员卡类型 + * @param object data + * + */ +export function memberCard() { + return request.get(`svip/pay_lst`) +} +/** + * 开通付费会员--支付 + * @param object data + * + */ +export function memberCardCreate(id, data) { + return request.post(`svip/pay/${id}`, data) +} +/** + * 付费会员权益 + * @param object data + * + */ +export function memberEquity() { + return request.get(`svip/user_info`, {}, { + noAuth: true + }) +} +/** + * 付费会员优惠券 + * @param object data + * + */ +export function memberCouponLst() { + return request.get(`svip/coupon_lst`, {}, { + noAuth: true + }) +} +/** + * 付费会员优惠券--领取 + * @param object data + * + */ +export function receiveMemberCoupon(id) { + return request.post(`svip/coupon_receive/${id}`) +} +/** + * 付费会员--会员商品 + * @param object data + * + */ +export function groomList(data) { + return request.get(`svip/product_lst`, data, { + noAuth: true + }) +} + +/** + * 客服聊天--撤回消息 + * @param object data + * + */ +export function chatReverstApi(id) { + return request.post(`service/recall/${id}`) +} diff --git a/components/UploadDemo.vue b/components/UploadDemo.vue new file mode 100644 index 0000000..15cde1a --- /dev/null +++ b/components/UploadDemo.vue @@ -0,0 +1,289 @@ + + + + + diff --git a/components/jyf-parser/jyf-parser.vue b/components/jyf-parser/jyf-parser.vue new file mode 100644 index 0000000..6294c26 --- /dev/null +++ b/components/jyf-parser/jyf-parser.vue @@ -0,0 +1,815 @@ + + + + + + diff --git a/components/jyf-parser/libs/CssHandler.js b/components/jyf-parser/libs/CssHandler.js new file mode 100644 index 0000000..f286db3 --- /dev/null +++ b/components/jyf-parser/libs/CssHandler.js @@ -0,0 +1,111 @@ +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team +// +---------------------------------------------------------------------- +/* + 解析和匹配 Css 的选择器 + github:https://github.com/jin-yufeng/Parser + docs:https://jin-yufeng.github.io/Parser + author:JinYufeng + update:2020/03/15 +*/ +var cfg = require('./config.js'); +class CssHandler { + constructor(tagStyle) { + var styles = Object.assign({}, cfg.userAgentStyles); + for (var item in tagStyle) + styles[item] = (styles[item] ? styles[item] + ';' : '') + tagStyle[item]; + this.styles = styles; + } + getStyle = data => this.styles = new CssParser(data, this.styles).parse(); + match(name, attrs) { + var tmp, matched = (tmp = this.styles[name]) ? tmp + ';' : ''; + if (attrs.class) { + var items = attrs.class.split(' '); + for (var i = 0, item; item = items[i]; i++) + if (tmp = this.styles['.' + item]) + matched += tmp + ';'; + } + if (tmp = this.styles['#' + attrs.id]) + matched += tmp + ';'; + return matched; + } +} +module.exports = CssHandler; +class CssParser { + constructor(data, init) { + this.data = data; + this.floor = 0; + this.i = 0; + this.list = []; + this.res = init; + this.state = this.Space; + } + parse() { + for (var c; c = this.data[this.i]; this.i++) + this.state(c); + return this.res; + } + section = () => this.data.substring(this.start, this.i); + isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); + // 状态机 + Space(c) { + if (c == '.' || c == '#' || this.isLetter(c)) { + this.start = this.i; + this.state = this.Name; + } else if (c == '/' && this.data[this.i + 1] == '*') + this.Comment(); + else if (!cfg.blankChar[c] && c != ';') + this.state = this.Ignore; + } + Comment() { + this.i = this.data.indexOf('*/', this.i) + 1; + if (!this.i) this.i = this.data.length; + this.state = this.Space; + } + Ignore(c) { + if (c == '{') this.floor++; + else if (c == '}' && !--this.floor) this.state = this.Space; + } + Name(c) { + if (cfg.blankChar[c]) { + this.list.push(this.section()); + this.state = this.NameSpace; + } else if (c == '{') { + this.list.push(this.section()); + this.Content(); + } else if (c == ',') { + this.list.push(this.section()); + this.Comma(); + } else if (!this.isLetter(c) && (c < '0' || c > '9') && c != '-' && c != '_') + this.state = this.Ignore; + } + NameSpace(c) { + if (c == '{') this.Content(); + else if (c == ',') this.Comma(); + else if (!cfg.blankChar[c]) this.state = this.Ignore; + } + Comma() { + while (cfg.blankChar[this.data[++this.i]]); + if (this.data[this.i] == '{') this.Content(); + else { + this.start = this.i--; + this.state = this.Name; + } + } + Content() { + this.start = ++this.i; + if ((this.i = this.data.indexOf('}', this.i)) == -1) this.i = this.data.length; + var content = this.section(); + for (var i = 0, item; item = this.list[i++];) + if (this.res[item]) this.res[item] += ';' + content; + else this.res[item] = content; + this.list = []; + this.state = this.Space; + } +} diff --git a/components/jyf-parser/libs/MpHtmlParser.js b/components/jyf-parser/libs/MpHtmlParser.js new file mode 100644 index 0000000..30c59e9 --- /dev/null +++ b/components/jyf-parser/libs/MpHtmlParser.js @@ -0,0 +1,586 @@ +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team +// +---------------------------------------------------------------------- +/* + 将 html 解析为适用于小程序 rich-text 的 DOM 结构 + github:https://github.com/jin-yufeng/Parser + docs:https://jin-yufeng.github.io/Parser + author:JinYufeng + update:2020/04/13 +*/ +var cfg = require('./config.js'), + blankChar = cfg.blankChar, + CssHandler = require('./CssHandler.js'), + { + screenWidth, + system + } = wx.getSystemInfoSync(); +// #ifdef MP-BAIDU || MP-ALIPAY || MP-TOUTIAO +var entities = { + lt: '<', + gt: '>', + amp: '&', + quot: '"', + apos: "'", + nbsp: '\xA0', + ensp: '\u2002', + emsp: '\u2003', + ndash: '–', + mdash: '—', + middot: '·', + lsquo: '‘', + rsquo: '’', + ldquo: '“', + rdquo: '”', + bull: '•', + hellip: '…', + permil: '‰', + copy: '©', + reg: '®', + trade: '™', + times: '×', + divide: '÷', + cent: '¢', + pound: '£', + yen: '¥', + euro: '€', + sect: '§' +}; +// #endif +var emoji; // emoji 补丁包 https://jin-yufeng.github.io/Parser/#/instructions?id=emoji +class MpHtmlParser { + constructor(data, options = {}) { + this.attrs = {}; + this.compress = options.compress; + this.CssHandler = new CssHandler(options.tagStyle, screenWidth); + this.data = data; + this.domain = options.domain; + this.DOM = []; + this.i = this.start = this.audioNum = this.imgNum = this.videoNum = 0; + this.protocol = this.domain && this.domain.includes('://') ? this.domain.split('://')[0] : ''; + this.state = this.Text; + this.STACK = []; + this.useAnchor = options.useAnchor; + this.xml = options.xml; + } + parse() { + if (emoji) this.data = emoji.parseEmoji(this.data); + for (var c; c = this.data[this.i]; this.i++) + this.state(c); + if (this.state == this.Text) this.setText(); + while (this.STACK.length) this.popNode(this.STACK.pop()); + // #ifdef MP-BAIDU || MP-TOUTIAO + // 将顶层标签的一些样式提取出来给 rich-text + (function f(ns) { + for (var i = ns.length, n; n = ns[--i];) { + if (n.type == 'text') continue; + if (!n.c) { + var style = n.attrs.style; + if (style) { + var j, k, res; + if ((j = style.indexOf('display')) != -1) + res = style.substring(j, (k = style.indexOf(';', j)) == -1 ? style.length : k); + if ((j = style.indexOf('float')) != -1) + res += ';' + style.substring(j, (k = style.indexOf(';', j)) == -1 ? style.length : k); + n.attrs.contain = res; + } + } else f(n.children); + } + })(this.DOM); + // #endif + if (this.DOM.length) { + this.DOM[0].PoweredBy = 'Parser'; + if (this.title) this.DOM[0].title = this.title; + } + return this.DOM; + } + // 设置属性 + setAttr() { + var name = this.getName(this.attrName); + if (cfg.trustAttrs[name]) { + if (!this.attrVal) { + if (cfg.boolAttrs[name]) this.attrs[name] = 'T'; + } else if (name == 'src') this.attrs[name] = this.getUrl(this.attrVal.replace(/&/g, '&')); + else this.attrs[name] = this.attrVal; + } + this.attrVal = ''; + while (blankChar[this.data[this.i]]) this.i++; + if (this.isClose()) this.setNode(); + else { + this.start = this.i; + this.state = this.AttrName; + } + } + // 设置文本节点 + setText() { + var back, text = this.section(); + if (!text) return; + text = (cfg.onText && cfg.onText(text, () => back = true)) || text; + if (back) { + this.data = this.data.substr(0, this.start) + text + this.data.substr(this.i); + let j = this.start + text.length; + for (this.i = this.start; this.i < j; this.i++) this.state(this.data[this.i]); + return; + } + if (!this.pre) { + // 合并空白符 + var tmp = []; + for (let i = text.length, c; c = text[--i];) + if (!blankChar[c] || (!blankChar[tmp[0]] && (c = ' '))) tmp.unshift(c); + text = tmp.join(''); + if (text == ' ') return; + } + // 处理实体 + var siblings = this.siblings(), + i = -1, + j, en; + while (1) { + if ((i = text.indexOf('&', i + 1)) == -1) break; + if ((j = text.indexOf(';', i + 2)) == -1) break; + if (text[i + 1] == '#') { + en = parseInt((text[i + 2] == 'x' ? '0' : '') + text.substring(i + 2, j)); + if (!isNaN(en)) text = text.substr(0, i) + String.fromCharCode(en) + text.substring(j + 1); + } else { + en = text.substring(i + 1, j); + // #ifdef MP-WEIXIN || MP-QQ || APP-PLUS + if (en == 'nbsp') text = text.substr(0, i) + '\xA0' + text.substr(j + 1); // 解决   失效 + else if (en != 'lt' && en != 'gt' && en != 'amp' && en != 'ensp' && en != 'emsp' && en != 'quot' && en != 'apos') { + i && siblings.push({ + type: 'text', + text: text.substr(0, i) + }) + siblings.push({ + type: 'text', + text: `&${en};`, + en: 1 + }) + text = text.substr(j + 1); + i = -1; + } + // #endif + // #ifdef MP-BAIDU || MP-ALIPAY || MP-TOUTIAO + if (entities[en]) text = text.substr(0, i) + entities[en] + text.substr(j + 1); + // #endif + } + } + text && siblings.push({ + type: 'text', + text + }) + } + // 设置元素节点 + setNode() { + var node = { + name: this.tagName.toLowerCase(), + attrs: this.attrs + }, + close = cfg.selfClosingTags[node.name] || (this.xml && this.data[this.i] == '/'); + this.attrs = {}; + if (!cfg.ignoreTags[node.name]) { + this.matchAttr(node); + if (!close) { + node.children = []; + if (node.name == 'pre' && cfg.highlight) { + this.remove(node); + this.pre = node.pre = true; + } + this.siblings().push(node); + this.STACK.push(node); + } else if (!cfg.filter || cfg.filter(node, this) != false) + this.siblings().push(node); + } else { + if (!close) this.remove(node); + else if (node.name == 'source') { + var parent = this.STACK[this.STACK.length - 1], + attrs = node.attrs; + if (parent && attrs.src) + if (parent.name == 'video' || parent.name == 'audio') + parent.attrs.source.push(attrs.src); + else { + var i, media = attrs.media; + if (parent.name == 'picture' && !parent.attrs.src && !(attrs.src.indexOf('.webp') && system.includes('iOS')) && + (!media || (media.includes('px') && + (((i = media.indexOf('min-width')) != -1 && (i = media.indexOf(':', i + 8)) != -1 && screenWidth > parseInt( + media.substr(i + 1))) || + ((i = media.indexOf('max-width')) != -1 && (i = media.indexOf(':', i + 8)) != -1 && screenWidth < parseInt( + media.substr(i + 1))))))) + parent.attrs.src = attrs.src; + } + } else if (node.name == 'base' && !this.domain) this.domain = node.attrs.href; + } + if (this.data[this.i] == '/') this.i++; + this.start = this.i + 1; + this.state = this.Text; + } + // 移除标签 + remove(node) { + var name = node.name, + j = this.i; + while (1) { + if ((this.i = this.data.indexOf('', this.i)) == -1) this.i = this.data.length; + // 处理 svg + if (name == 'svg') { + var src = this.data.substring(j, this.i + 1); + if (!node.attrs.xmlns) src = ' xmlns="http://www.w3.org/2000/svg"' + src; + var i = j; + while (this.data[j] != '<') j--; + src = this.data.substring(j, i) + src; + var parent = this.STACK[this.STACK.length - 1]; + if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline')) + parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style; + this.siblings().push({ + name: 'img', + attrs: { + src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'), + ignore: 'T' + } + }) + } + return; + } + } + } + // 处理属性 + matchAttr(node) { + var attrs = node.attrs, + style = this.CssHandler.match(node.name, attrs, node) + (attrs.style || ''), + styleObj = {}; + if (attrs.id) { + if (this.compress & 1) attrs.id = void 0; + else if (this.useAnchor) this.bubble(); + } + if ((this.compress & 2) && attrs.class) attrs.class = void 0; + switch (node.name) { + case 'img': + if (attrs['data-src']) { + attrs.src = attrs.src || attrs['data-src']; + attrs['data-src'] = void 0; + } + if (attrs.src && !attrs.ignore) { + if (this.bubble()) attrs.i = (this.imgNum++).toString(); + else attrs.ignore = 'T'; + } + break; + case 'a': + case 'ad': + // #ifdef APP-PLUS + case 'iframe': + case 'embed': + // #endif + this.bubble(); + break; + case 'font': + if (attrs.color) { + styleObj['color'] = attrs.color; + attrs.color = void 0; + } + if (attrs.face) { + styleObj['font-family'] = attrs.face; + attrs.face = void 0; + } + if (attrs.size) { + var size = parseInt(attrs.size); + if (size < 1) size = 1; + else if (size > 7) size = 7; + var map = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']; + styleObj['font-size'] = map[size - 1]; + attrs.size = void 0; + } + break; + case 'video': + case 'audio': + if (!attrs.id) attrs.id = node.name + (++this[`${node.name}Num`]); + else this[`${node.name}Num`]++; + if (node.name == 'video') { + if (attrs.width) { + style = `width:${parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px')};${style}`; + attrs.width = void 0; + } + if (attrs.height) { + style = `height:${parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px')};${style}`; + attrs.height = void 0; + } + if (this.videoNum > 3) node.lazyLoad = true; + } + attrs.source = []; + if (attrs.src) attrs.source.push(attrs.src); + if (!attrs.controls && !attrs.autoplay) + console.warn(`存在没有 controls 属性的 ${node.name} 标签,可能导致无法播放`, node); + this.bubble(); + break; + case 'td': + case 'th': + if (attrs.colspan || attrs.rowspan) + for (var k = this.STACK.length, item; item = this.STACK[--k];) + if (item.name == 'table') { + item.c = void 0; + break; + } + } + if (attrs.align) { + styleObj['text-align'] = attrs.align; + attrs.align = void 0; + } + // 压缩 style + var styles = style.replace(/"/g, '"').replace(/&/g, '&').split(';'); + style = ''; + for (var i = 0, len = styles.length; i < len; i++) { + var info = styles[i].split(':'); + if (info.length < 2) continue; + let key = info[0].trim().toLowerCase(), + value = info.slice(1).join(':').trim(); + if (value.includes('-webkit') || value.includes('-moz') || value.includes('-ms') || value.includes('-o') || value + .includes( + 'safe')) + style += `;${key}:${value}`; + else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import')) + styleObj[key] = value; + } + if (node.name == 'img' && parseInt(styleObj.width || attrs.width) > screenWidth) + styleObj.height = 'auto'; + for (var key in styleObj) { + var value = styleObj[key]; + if (key.includes('flex') || key == 'order' || key == 'self-align') node.c = 1; + // 填充链接 + if (value.includes('url')) { + var j = value.indexOf('('); + if (j++ != -1) { + while (value[j] == '"' || value[j] == "'" || blankChar[value[j]]) j++; + value = value.substr(0, j) + this.getUrl(value.substr(j)); + } + } + // 转换 rpx + else if (value.includes('rpx')) + value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * screenWidth / 750 + 'px'); + else if (key == 'white-space' && value.includes('pre')) + this.pre = node.pre = true; + style += `;${key}:${value}`; + } + style = style.substr(1); + if (style) attrs.style = style; + } + // 节点出栈处理 + popNode(node) { + // 空白符处理 + if (node.pre) { + node.pre = this.pre = void 0; + for (let i = this.STACK.length; i--;) + if (this.STACK[i].pre) + this.pre = true; + } + if (node.name == 'head' || (cfg.filter && cfg.filter(node, this) == false)) + return this.siblings().pop(); + var attrs = node.attrs; + // 替换一些标签名 + if (node.name == 'picture') { + node.name = 'img'; + if (!attrs.src && (node.children[0] || '').name == 'img') + attrs.src = node.children[0].attrs.src; + if (attrs.src && !attrs.ignore) + attrs.i = (this.imgNum++).toString(); + return node.children = void 0; + } + if (cfg.blockTags[node.name]) node.name = 'div'; + else if (!cfg.trustTags[node.name]) node.name = 'span'; + // 处理列表 + if (node.c) { + if (node.name == 'ul') { + var floor = 1; + for (let i = this.STACK.length; i--;) + if (this.STACK[i].name == 'ul') floor++; + if (floor != 1) + for (let i = node.children.length; i--;) + node.children[i].floor = floor; + } else if (node.name == 'ol') { + for (let i = 0, num = 1, child; child = node.children[i++];) + if (child.name == 'li') { + child.type = 'ol'; + child.num = ((num, type) => { + if (type == 'a') return String.fromCharCode(97 + (num - 1) % 26); + if (type == 'A') return String.fromCharCode(65 + (num - 1) % 26); + if (type == 'i' || type == 'I') { + num = (num - 1) % 99 + 1; + var one = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'], + ten = ['X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'], + res = (ten[Math.floor(num / 10) - 1] || '') + (one[num % 10 - 1] || ''); + if (type == 'i') return res.toLowerCase(); + return res; + } + return num; + })(num++, attrs.type) + '.'; + } + } + } + // 处理表格的边框 + if (node.name == 'table') { + var padding = attrs.cellpadding, + spacing = attrs.cellspacing, + border = attrs.border; + if (node.c) { + this.bubble(); + if (!padding) padding = 2; + if (!spacing) spacing = 2; + } + if (border) attrs.style = `border:${border}px solid gray;${attrs.style || ''}`; + if (spacing) attrs.style = `border-spacing:${spacing}px;${attrs.style || ''}`; + if (border || padding) + (function f(ns) { + for (var i = 0, n; n = ns[i]; i++) { + if (n.name == 'th' || n.name == 'td') { + if (border) n.attrs.style = `border:${border}px solid gray;${n.attrs.style}`; + if (padding) n.attrs.style = `padding:${padding}px;${n.attrs.style}`; + } else f(n.children || []); + } + })(node.children) + } + this.CssHandler.pop && this.CssHandler.pop(node); + // 自动压缩 + if (node.name == 'div' && !Object.keys(attrs).length) { + var siblings = this.siblings(); + if (node.children.length == 1 && node.children[0].name == 'div') + siblings[siblings.length - 1] = node.children[0]; + } + } + // 工具函数 + bubble() { + for (var i = this.STACK.length, item; item = this.STACK[--i];) { + if (cfg.richOnlyTags[item.name]) { + if (item.name == 'table' && !Object.hasOwnProperty.call(item, 'c')) item.c = 1; + return false; + } + item.c = 1; + } + return true; + } + getName = val => this.xml ? val : val.toLowerCase(); + getUrl(url) { + if (url[0] == '/') { + if (url[1] == '/') url = this.protocol + ':' + url; + else if (this.domain) url = this.domain + url; + } else if (this.domain && url.indexOf('data:') != 0 && !url.includes('://')) + url = this.domain + '/' + url; + return url; + } + isClose = () => this.data[this.i] == '>' || (this.data[this.i] == '/' && this.data[this.i + 1] == '>'); + section = () => this.data.substring(this.start, this.i); + siblings = () => this.STACK.length ? this.STACK[this.STACK.length - 1].children : this.DOM; + // 状态机 + Text(c) { + if (c == '<') { + var next = this.data[this.i + 1], + isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); + if (isLetter(next)) { + this.setText(); + this.start = this.i + 1; + this.state = this.TagName; + } else if (next == '/') { + this.setText(); + if (isLetter(this.data[++this.i + 1])) { + this.start = this.i + 1; + this.state = this.EndTag; + } else + this.Comment(); + } else if (next == '!') { + this.setText(); + this.Comment(); + } + } + } + Comment() { + var key; + if (this.data.substring(this.i + 2, this.i + 4) == '--') key = '-->'; + else if (this.data.substring(this.i + 2, this.i + 9) == '[CDATA[') key = ']]>'; + else key = '>'; + if ((this.i = this.data.indexOf(key, this.i + 2)) == -1) this.i = this.data.length; + else this.i += key.length - 1; + this.start = this.i + 1; + this.state = this.Text; + } + TagName(c) { + if (blankChar[c]) { + this.tagName = this.section(); + while (blankChar[this.data[this.i]]) this.i++; + if (this.isClose()) this.setNode(); + else { + this.start = this.i; + this.state = this.AttrName; + } + } else if (this.isClose()) { + this.tagName = this.section(); + this.setNode(); + } + } + AttrName(c) { + var blank = blankChar[c]; + if (blank) { + this.attrName = this.section(); + c = this.data[this.i]; + } + if (c == '=') { + if (!blank) this.attrName = this.section(); + while (blankChar[this.data[++this.i]]); + this.start = this.i--; + this.state = this.AttrValue; + } else if (blank) this.setAttr(); + else if (this.isClose()) { + this.attrName = this.section(); + this.setAttr(); + } + } + AttrValue(c) { + if (c == '"' || c == "'") { + this.start++; + if ((this.i = this.data.indexOf(c, this.i + 1)) == -1) return this.i = this.data.length; + this.attrVal = this.section(); + this.i++; + } else { + for (; !blankChar[this.data[this.i]] && !this.isClose(); this.i++); + this.attrVal = this.section(); + } + this.setAttr(); + } + EndTag(c) { + if (blankChar[c] || c == '>' || c == '/') { + var name = this.getName(this.section()); + for (var i = this.STACK.length; i--;) + if (this.STACK[i].name == name) break; + if (i != -1) { + var node; + while ((node = this.STACK.pop()).name != name); + this.popNode(node); + } else if (name == 'p' || name == 'br') + this.siblings().push({ + name, + attrs: {} + }); + this.i = this.data.indexOf('>', this.i); + this.start = this.i + 1; + if (this.i == -1) this.i = this.data.length; + else this.state = this.Text; + } + } +} +module.exports = MpHtmlParser; diff --git a/components/jyf-parser/libs/config.js b/components/jyf-parser/libs/config.js new file mode 100644 index 0000000..c7985ad --- /dev/null +++ b/components/jyf-parser/libs/config.js @@ -0,0 +1,89 @@ +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team +// +---------------------------------------------------------------------- +/* 配置文件 */ +// #ifdef MP-WEIXIN +const canIUse = wx.canIUse('editor'); // 高基础库标识,用于兼容 +// #endif +module.exports = { + // 过滤器函数 + filter: null, + // 代码高亮函数 + highlight: null, + // 文本处理函数 + onText: null, + blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'), + // 块级标签,将被转为 div + blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,section' + ( + // #ifdef MP-WEIXIN + canIUse ? '' : + // #endif + ',pre')), + // 将被移除的标签 + ignoreTags: makeMap( + 'area,base,basefont,canvas,command,frame,input,isindex,keygen,link,map,meta,param,script,source,style,svg,textarea,title,track,use,wbr' + // #ifdef MP-WEIXIN + + (canIUse ? ',rp' : '') + // #endif + // #ifndef APP-PLUS + + ',embed,iframe' + // #endif + ), + // 只能被 rich-text 显示的标签 + richOnlyTags: makeMap('a,colgroup,fieldset,legend,picture,table' + // #ifdef MP-WEIXIN + + (canIUse ? ',bdi,bdo,caption,rt,ruby' : '') + // #endif + ), + // 自闭合的标签 + selfClosingTags: makeMap( + 'area,base,basefont,br,col,circle,ellipse,embed,frame,hr,img,input,isindex,keygen,line,link,meta,param,path,polygon,rect,source,track,use,wbr' + ), + // 信任的属性 + trustAttrs: makeMap( + 'align,alt,app-id,author,autoplay,border,cellpadding,cellspacing,class,color,colspan,controls,data-src,dir,face,height,href,id,ignore,loop,media,muted,name,path,poster,rowspan,size,span,src,start,style,type,unit-id,width,xmlns' + ), + // bool 型的属性 + boolAttrs: makeMap('autoplay,controls,ignore,loop,muted'), + // 信任的标签 + trustTags: makeMap( + 'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video' + // #ifdef MP-WEIXIN + + (canIUse ? ',bdi,bdo,caption,pre,rt,ruby' : '') + // #endif + // #ifdef APP-PLUS + + ',embed,iframe' + // #endif + ), + // 默认的标签样式 + userAgentStyles: { + address: 'font-style:italic', + big: 'display:inline;font-size:1.2em', + blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px', + caption: 'display:table-caption;text-align:center', + center: 'text-align:center', + cite: 'font-style:italic', + dd: 'margin-left:40px', + img: 'max-width:100%', + mark: 'background-color:yellow', + picture: 'max-width:100%', + pre: 'font-family:monospace;white-space:pre;overflow:scroll', + s: 'text-decoration:line-through', + small: 'display:inline;font-size:0.8em', + u: 'text-decoration:underline' + } +} + +function makeMap(str) { + var map = {}, + list = str.split(','); + for (var i = list.length; i--;) + map[list[i]] = true; + return map; +} diff --git a/components/jyf-parser/libs/handler.sjs b/components/jyf-parser/libs/handler.sjs new file mode 100644 index 0000000..e8743fa --- /dev/null +++ b/components/jyf-parser/libs/handler.sjs @@ -0,0 +1,44 @@ +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team +// +---------------------------------------------------------------------- +var inlineTags = { + abbr: 1, + b: 1, + big: 1, + code: 1, + del: 1, + em: 1, + i: 1, + ins: 1, + label: 1, + q: 1, + small: 1, + span: 1, + strong: 1 +} +export default { + // 从顶层标签的样式中取出一些给 rich-text + getStyle: function(style) { + if (style) { + var i, j, res = ''; + if ((i = style.indexOf('display')) != -1) + res = style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j); + if ((i = style.indexOf('float')) != -1) + res += ';' + style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j); + return res; + } + }, + getNode: function(item) { + return [item]; + }, + // 是否通过 rich-text 显示 + useRichText: function(item) { + return !item.c && !inlineTags[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1; + } +} diff --git a/components/jyf-parser/libs/handler.wxs b/components/jyf-parser/libs/handler.wxs new file mode 100644 index 0000000..afaf0bc --- /dev/null +++ b/components/jyf-parser/libs/handler.wxs @@ -0,0 +1,53 @@ +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team +// +---------------------------------------------------------------------- +var inlineTags = { + abbr: 1, + b: 1, + big: 1, + code: 1, + del: 1, + em: 1, + i: 1, + ins: 1, + label: 1, + q: 1, + small: 1, + span: 1, + strong: 1 +} +module.exports = { + // 从顶层标签的样式中取出一些给 rich-text + getStyle: function(style) { + if (style) { + var i, j, res = ''; + if ((i = style.indexOf('display')) != -1) + res = style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j); + if ((i = style.indexOf('float')) != -1) + res += ';' + style.substring(i, (j = style.indexOf(';', i)) == -1 ? style.length : j); + return res; + } + }, + // 处理懒加载 + getNode: function(item, imgLoad) { + if (!imgLoad && item.attrs.i != '0') { + var img = { + name: 'img', + attrs: JSON.parse(JSON.stringify(item.attrs)) + } + delete img.attrs.src; + img.attrs.style += ';width:20px;height:20px'; + return [img]; + } else return [item]; + }, + // 是否通过 rich-text 显示 + useRichText: function(item) { + return !item.c && !inlineTags[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1; + } +} diff --git a/components/jyf-parser/libs/trees.vue b/components/jyf-parser/libs/trees.vue new file mode 100644 index 0000000..c2ea476 --- /dev/null +++ b/components/jyf-parser/libs/trees.vue @@ -0,0 +1,485 @@ + +