diff --git a/.gitignore b/.gitignore index a503fa2..9b74aa9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /unpackage/ +/node_modules/ \ No newline at end of file diff --git a/apiRc/company/index.js b/apiRc/company/index.js new file mode 100644 index 0000000..ba181c1 --- /dev/null +++ b/apiRc/company/index.js @@ -0,0 +1,514 @@ +// 获取人员基本信息详情 + + + +// import { post, get } from '../../utils/request.js' + +// export function getPersonInfo(id) { +// return get({ +// url: `personnel/personBaseInfo/${id}`, +// method: 'get' +// }) +// } + +import request from '@/utilsRc/request' + +// 根据 userId 获取企业详情 +export function companyDetails(userId) { + return request({ + method: 'get', + url: `/company/unitBaseInfo/user/${userId}`, + }) +} + +// 企业-推荐人员信息 +export function recommendedPerson(params) { + return request({ + url: '/company/unitBaseInfo/recommend/person', + method: 'get', + params + }) +} + +// 人员邀请 +export function invitePerson(params) { + return request({ + url: '/company/unitBaseInfo/invite', + method: 'get', + params + }) +} + +// 获取企业招聘岗位列表 +export function jobList(params) { + return request({ + url: '/company/unitPostInfo/list', + method: 'get', + params + }) +} + +// 查找已投递、已推荐、已邀请的人员信息 +export function listMatch(query) { + return request({ + url: '/company/unitBaseInfo/relevance', + method: 'get', + params: query + }) +} + +// 添加企业基本信息 +export function addJobBase(data) { + return request({ + url: '/company/unitBaseInfo', + method: 'post', + data: data + }) +} + +// 查询部门下拉树结构 +export function deptTreeSelect() { + return request({ + url: '/system/center/user/deptTree', + method: 'get' + }) +} + +// 企业发布招聘岗位 +export function addJob(data) { + return request({ + url: '/company/unitPostInfo', + method: 'post', + data: data + }) +} + +// 获取招聘工种列表 +export function jobTypeList(params) { + return request({ + url: '/basicdata/workType/list', + method: 'get', + params + }) +} + +// 企业基本信息列表 +export function jobBaseList(query) { + return request({ + url: '/company/unitBaseInfo/list', + method: 'get', + params: query + }) +} + +// 获取企业招聘岗位信息详细信息 +export function getJob(id) { + return request({ + url: `/company/unitPostInfo/${id}`, + method: 'get' + }) +} +// 修改企业招聘岗位信息 +export function updateJob(data) { + return request({ + url: '/company/unitPostInfo', + method: 'put', + data: data + }) +} + +// 修改企业基本信息 +export function updateJobBase(data) { + return request({ + url: '/company/unitBaseInfo', + method: 'put', + data: data + }) +} +// 查询角色详细 +export function getJobService(id) { + return request({ + url: '/personnel/personBaseInfo/' + id, + method: 'get' + }) +} + +// 查询推荐人员、已推荐、已邀请 详情 +export function getUnitBaseInfo(id) { + return request({ + url: '/manage/personDemand/' + id, + method: 'get' + }) +} + + +// 查询工种列表 +export function listJobType(query) { + return request({ + url: '/basicdata/workType/list', + method: 'get', + params: query + }) +} + +// 人员基本信息 - 列表 +export function personInfoList(query) { + return request({ + url: '/personnel/personBaseInfo/list', + method: 'get', + params: query + }) +} + +// 获取人员基本信息详情 +export function getPersonInfo(id) { + return request({ + url: `/personnel/personBaseInfo/${id}`, + method: 'get' + }) +} + + +// 删除人员基本信息 +export function delPersonInfo(ids) { + return request({ + url: '/personnel/personBaseInfo/' + ids, + method: 'delete' + }) +} + +// 删除录入人员 公用 type = 1 失业中 2 就业困难 3 离校生 4 其他人员 +export function delPersonUser(ids) { + return request({ + url: `/personnel/personInputInfo/${ids}`, + method: 'delete', + }) +} + +// 新增人员基本信息 +export function addPersonInfo(data) { + return request({ + url: '/personnel/personBaseInfo', + method: 'post', + data: data + }) +} + +// 修改人员基本信息 +export function updatePersonInfo(data) { + return request({ + url: '/personnel/personBaseInfo', + method: 'put', + data + }) +} + +//社区人员审核 +export function personInfoAudit(data) { + return request({ + url: '/personnel/personBaseInfo/audit', + method: 'post', + data: data + }) +} + + +//记录查看身份证 +export function recordLookIdCard(params) { + return request({ + url: '/personnel/personBaseInfo/recordLookIdCard', + method: 'get', + params + }) +} + + + + +/* 失业人员 --------------------------------------------- start */ + +// 新增失业人员 +export function addPersonUnemployed(data) { + return request({ + url: '/person/unemployment', + method: 'post', + data + }) +} + +// 失业人员修改 +export function updatePersonUnemployed(data) { + return request({ + url: '/person/unemployment', + method: 'put', + data, + }) +} + +// 失业人员列表 +export function unemployment(params) { + return request({ + url: '/person/unemployment/list', + method: 'get', + params + }) +} + +// 失业人员详情 +export function unemploymentDetails(id) { + return request({ + url: `/person/unemployment/${id}`, + method: 'get', + }) +} + +// 失业人员删除 +export function unemploymentDelete(id) { + return request({ + url: `/person/unemployment/${id}`, + method: 'delete', + }) +} + +/* 失业人员 --------------------------------------------- end */ + + +/* 就业困难人员 --------------------------------------------- start */ + +// 新增就业困难 +export function addPersonDifficult(data) { + return request({ + url: '/person/findingEmployment', + method: 'post', + data + }) +} + +// 修改就业困难 +export function updatePersonDifficult(data) { + return request({ + url: '/person/findingEmployment', + method: 'put', + data + }) +} + +// 就业困难列表 +export function findingEmployment(params) { + return request({ + url: '/person/findingEmployment/list', + method: 'get', + params + }) +} + +// 就业困难详情 +export function findingEmploymentDetails(id) { + return request({ + url: `/person/findingEmployment/${id}`, + method: 'get', + }) +} + +// 就业困难删除 +export function findingEmploymentDelete(id) { + return request({ + url: `/person/findingEmployment/${id}`, + method: 'delete', + }) +} +/* 就业困难人员 --------------------------------------------- end */ + + +/* 离校未就业高校生 --------------------------------------------- start */ + +// 新增离校未就业高校生 +export function addLeaveSchool(data) { + return request({ + url: '/person/leavingSchoolInfo', + method: 'post', + data + }) +} + +// 修改离校未就业高校生 +export function updateLeaveSchool(data) { + return request({ + url: '/person/leavingSchoolInfo', + method: 'put', + data, + }) +} + +// 高校未就业列表 +export function leavingSchoolInfo(params) { + return request({ + url: '/person/leavingSchoolInfo/list', + method: 'get', + params + }) +} + +// 高校未就业详情 +export function leavingSchoolInfoDetails(id) { + return request({ + url: `/person/leavingSchoolInfo/${id}`, + method: 'get', + }) +} + + +// 高校未就业删除 +export function leavingSchoolInfoDelete(id) { + return request({ + url: `/person/leavingSchoolInfo/${id}`, + method: 'delete', + }) +} + + +/* 离校未就业高校生 --------------------------------------------- end */ + +/* 其他人员 --------------------------------------------- start */ + +// 新增其他人员 +export function addOther(data) { + return request({ + url: '/person/other', + method: 'post', + data + }) +} + +// 其他人员修改 +export function updateOther(data) { + return request({ + url: '/person/other', + method: 'post', + data, + }) +} + + +// 其他人员列表 +export function other(params) { + return request({ + url: '/person/other/list', + method: 'get', + params + }) +} + +// 其他人员详情 +export function otherDetails(id) { + return request({ + url: `/person/other/${id}`, + method: 'get', + }) +} + +// 其他人员删除 +export function otherDelete(id) { + return request({ + url: `/person/other/${id}`, + method: 'delete', + }) +} +/* 其他人员 --------------------------------------------- end */ + +// 需求预警列表 +export function personAlertList(params) { + return request({ + url: '/manage/personDemand/warningList', + method: 'get', + params + }) +} +export function personDealList(params) { + return request({ + url: '/manage/personDemand/dealingList', + method: 'get', + params + }) +} +// 服务追踪 服务类型/服务id +export function serviceTraceability({ + demandType, + id +}) { + return request({ + // url: `/system/personRequirementsRecords/serviceTraceability/${demandType}/${id}`, + url: `/timelime/timelime/fwzs/${id}`, + method: 'get', + }) +} + +// 需求办结 +export function requirementCompletion(url, data) { + return request({ + url, + method: 'post', + data + }) +} + +//岗位审核 +export function jobAudit(data) { + return request({ + url: '/company/unitPostInfo/audit', + method: 'post', + data: data + }) +} + +//社群 首页未完成数 +// export function getPeopleCount() { +// return request({ +// url: '/pc/index/getPeopleCount', +// method: 'get', +// }) +// } + +//社群 首页未完成数 +export function getDemandUnfinished() { + return request({ + url: '/pc/index/todo', + method: 'get', + }) +} + + + +// 删除企业招聘岗位信息 +export function delJob(ids) { + return request({ + url: '/company/unitPostInfo/' + ids, + method: 'delete' + }) +} + +// 所在社区列表 +export function deptList(params) { + return request({ + 'url': `/system/center/user/deptList`, + 'method': 'get', + params + }) +} + +// 所在社区列表 +export function returnPerson(params) { + return request({ + 'url': `/personnel/personBaseInfo/returnPerson`, + 'method': 'get', + params + }) +} +// 根据人的身份证查询人的详细信息 +export function getIdNumberInfo(params) { + return request({ + 'url': `/personnel/personBaseInfo/getIdNumberInfo`, + 'method': 'get', + params + }) +} diff --git a/apiRc/jobType/index.js b/apiRc/jobType/index.js new file mode 100644 index 0000000..fa751e2 --- /dev/null +++ b/apiRc/jobType/index.js @@ -0,0 +1,15 @@ +/* + * @Date: 2025-10-31 11:06:15 + * @LastEditors: lip + * @LastEditTime: 2025-11-03 12:48:22 + */ +// import { post, get } from '@/utilsRc/request' + +import request from '@/utilsRc/request' +export function listJobType(query) { + return request({ + url: '/basicdata/workType/list', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/apiRc/login.js b/apiRc/login.js new file mode 100644 index 0000000..74ee74b --- /dev/null +++ b/apiRc/login.js @@ -0,0 +1,53 @@ +/* + * @Date: 2025-10-31 11:06:15 + * @LastEditors: shirlwang + * @LastEditTime: 2025-11-03 15:51:28 + */ +import request from '@/utilsRc/request' + +// 登录方法 +export function login(data) { + return request({ + method: 'get', + url: '/not/login/person/zkrLogin', + params: data, + }) +} +export function smsLogin(data) { + return request({ + method: 'post', + url: '/personnel/personBaseInfo/loginGrAndQy', + data, + headers: { + isToken: false + } + }) +} +export function wechatLogin(data) { + return request({ + method: 'post', + url: '/personnel/personBaseInfo/loginGrAndQy', + data, + headers: { + isToken: false + } + }) +} +export function register(data) { + return request({ + method: 'post', + url: '/personnel/personBaseInfo/loginGrAndQy', + data, + headers: { + isToken: false + } + }) +} + +// 获取用户详细信息 +export function getInfo() { + return request({ + url: '/getInfo', + method: 'get' + }) +} \ No newline at end of file diff --git a/apiRc/needs/person.js b/apiRc/needs/person.js new file mode 100644 index 0000000..2297a97 --- /dev/null +++ b/apiRc/needs/person.js @@ -0,0 +1,34 @@ +/* + * @Date: 2025-10-31 11:06:15 + * @LastEditors: lip + * @LastEditTime: 2025-11-03 12:48:30 + */ +// 人员接口 +// import { post, get } from '@/utilsRc/request' +import request from '@/utilsRc/request' +export function getPersonBase(params) { + return request({ + url: '/personnel/personBaseInfo/list', + method: 'get', + + params + }) +} +export function getPersonList(params) { + return request({ + url: '/personnel/personBaseInfo/list', + method: 'get', + params + }) +} + + +// 新增角色 +export function addInvestigate(data) { + return request({ + // url: '//process/processInterview', + url: '//timelime/timelime', + method: 'post', + data: data + }) +} diff --git a/apiRc/needs/personDemand.js b/apiRc/needs/personDemand.js new file mode 100644 index 0000000..02eefd3 --- /dev/null +++ b/apiRc/needs/personDemand.js @@ -0,0 +1,52 @@ +/* + * @Date: 2025-11-03 08:48:44 + * @LastEditors: lip + * @LastEditTime: 2025-11-03 12:48:41 + */ +// 查询个人需求信息列表 +// import { post, get } from '@/utilsRc/request' +import request from '@/utilsRc/request' +export function listPersonDemand(query) { + return request({ + method: 'get', + url: '/manage/personDemand/list', + + params: query + }) +} +export function delPersonDemand(id) { + return request({ + url: '/manage/personDemand/' + id, + method: 'delete' + }) +} + + +// 查询个人需求信息详细 +export function getPersonDemand(id) { + return request({ + method: 'get', + url: '/manage/personDemand/' + id, + }) +} + +// 新增个人需求信息 +export function addPersonDemand(data) { + // 确保传递数据前进行日志输出 + console.log('addPersonDemand函数接收到的数据:', data); + return request({ + url: '/manage/personDemand', + method: 'post', // 修改为大写POST,确保请求参数正确传递 + data: data + }) +} + +// 修改个人需求信息 +export function updatePersonDemand(data) { + return request({ + url: '/manage/personDemand', + method: 'put', + data: data + }) +} + diff --git a/apiRc/person.js b/apiRc/person.js new file mode 100644 index 0000000..ed193ff --- /dev/null +++ b/apiRc/person.js @@ -0,0 +1,84 @@ +/* + * @Date: 2025-10-31 13:50:15 + * @LastEditors: shirlwang + * @LastEditTime: 2025-10-31 14:30:31 + */ +import request from '@/utilsRc/request' + +// 人员信息保存 +export function savePersonBase(data) { + return request({ + 'url': '/personnel/personBaseInfo', + 'method': 'put', + 'data': data + }) +} + +// 人员信息查询 +export function getPersonBase(userId) { + return request({ + 'url': `/personnel/personBaseInfo/user/${userId}`, + 'method': 'get', + }) +} +// 获取行政区划列表 +export function getQUList() { + return request({ + url: `/manage/xzqh//xzqhTree`, + method: 'get' + }) + } +// 查询部门下拉树结构 +export function deptTreeSelect() { + return request({ + url: '/system/center/user/deptTree', + method: 'get' + }) +} + + +// 社群端 根据所在社区 获取姓名 +export function generateUserName(deptId) { + return request({ + url: `/generateUserName/${deptId}`, + method: 'get' + }) +} + +// 获取部门列表 +export function getDeptList(name,personId) { + return request({ + url: `/system/center/user/getDeptList?name=${name}&parentId=${personId}`, + method: 'get' + }) + } +// 求职工种列表 +export function touristWork() { + return request({ + url: `/basicdata/workType/workTypeTree`, + method: 'get' + }) +} +// 获取招聘工种列表 +export function jobTypeList(params) { + return request({ + url: '/basicdata/workType/list', + method: 'get', + params + }) +} +// 未读消息数量 + +export function unreadNum() { + return request({ + url: '/manage/tjgw/notReadNum', + method: 'get', + }) +} +// 地图类型列表 +export function jyshdt(cyfhjd) { + return request({ + url: `/jyshdt/jyshdt/queryList?lx=${cyfhjd}`, + method: 'get', + }) +} diff --git a/apiRc/personinfo/index.js b/apiRc/personinfo/index.js new file mode 100644 index 0000000..29af896 --- /dev/null +++ b/apiRc/personinfo/index.js @@ -0,0 +1,49 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2025-11-03 12:35:56 + * @LastEditors: lip + */ +// import { post, get } from '../../utils/request.js' +import request from '@/utilsRc/request' + +// 登录方法 +export function personInfoList(data) { + return request({ + method: 'get', + url: '/personnel/personBaseInfo/list', + params: data, + }) +} +// 需求预警列表 +export function personAlertList(params) { + return request({ + method: 'get', + url: '/manage/personDemand/warningList', + + params + }) +} +//经办人数据获取 +export function getJbrInfo() { + return request({ + method: 'get', + url: `system/center/user/selectHxjbr`, + method: 'get' + }) +} +export function getPersonBase() { + return request({ + method: 'get', + url: `system/center/user/selectHxjbr`, + method: 'get' + }) +} +export function returnPerson(params) { + return request({ + method: 'get', + 'url': `/personnel/personBaseInfo/returnPerson`, + + params + }) +} \ No newline at end of file diff --git a/apiRc/system/dict.js b/apiRc/system/dict.js new file mode 100644 index 0000000..5d47ae5 --- /dev/null +++ b/apiRc/system/dict.js @@ -0,0 +1,63 @@ +/* + * @Date: 2025-10-31 15:06:34 + * @LastEditors: shirlwang + * @LastEditTime: 2025-11-03 12:20:28 + */ +import request from '@/utilsRc/request' +// 查询字典数据列表 +export function listData (query) { + return request({ + url: '/system/dict/data/list', + method: 'get', + params: query + }) +} + +// 查询字典数据详细 +export function getData (dictCode) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'get' + }) +} + +// 根据字典类型查询字典数据信息 +export function getDicts (dictType) { + return request({ + url: '/system/dict/data/type/' + dictType, + method: 'get' + }) +} +// 根据字典类型查询字典数据信息 +export function getDict (dictType) { + return request({ + url: '/system/dict/data/type/' + dictType, + method: 'get' + }) +} + +// 新增字典数据 +export function addData (data) { + return request({ + url: '/system/dict/data/add', + method: 'post', + data: data + }) +} + +// 修改字典数据 +export function updateData (data) { + return request({ + url: '/system/dict/data', + method: 'post', + data: data + }) +} + +// 删除字典数据 +export function delData (dictCode) { + return request({ + url: '/system/dict/data/remove' + dictCode, + method: 'get' + }) +} diff --git a/main.js b/main.js index 1a45f9f..7d6f49f 100644 --- a/main.js +++ b/main.js @@ -1,3 +1,8 @@ +/* + * @Date: 2025-11-03 10:52:09 + * @LastEditors: shirlwang + * @LastEditTime: 2025-11-03 17:26:29 + */ import App from '@/App' import * as Pinia from 'pinia' import globalFunction from '@/common/globalFunction' @@ -13,6 +18,12 @@ import SelectPopup from '@/components/selectPopup/selectPopup.vue' import SelectPopupPlugin from '@/components/selectPopup/selectPopupPlugin'; import RenderJobs from '@/components/renderJobs/renderJobs.vue'; import RenderCompanys from '@/components/renderCompanys/renderCompanys.vue'; +import uniIcons from './uni_modules/uni-icons/components/uni-icons/uni-icons.vue' +import uniPopup from './uni_modules/uni-popup/components/uni-popup/uni-popup.vue' +import uniDataSelect from './uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue' +import uniSwipeAction from './uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue' +import uniSwipeActionItem from './uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue' +import storeRc from './utilsRc/store/index.js' // iconfont.css 已在 App.vue 中通过 @import 引入,无需在此处重复引入 // import Tabbar from '@/components/tabbar/midell-box.vue' // 自动导入 directives 目录下所有指令 @@ -27,6 +38,7 @@ import { // const foldFeature = window.visualViewport && 'segments' in window.visualViewport // console.log('是否支持多段屏幕:', foldFeature) +import { getDict } from '@/apiRc/system/dict.js'; // 全局组件 export function createApp() { const app = createSSRApp(App) @@ -38,6 +50,23 @@ export function createApp() { app.component('SelectPopup', SelectPopup) app.component('RenderJobs', RenderJobs) app.component('RenderCompanys', RenderCompanys) + app.component('uni-icons', uniIcons) + app.component('uni-popup', uniPopup) + app.component('uni-data-select', uniDataSelect) + app.component('uni-swipe-action', uniSwipeAction) + app.component('uni-swipe-action-item', uniSwipeActionItem) + + + app.config.globalProperties.$getDict = getDict; + app.config.globalProperties.$store = storeRc; + app.config.globalProperties.$getDictSelectOption = async (dictType, isDigital = false, forceRefresh = false) => { + const dictData = await getDict(dictType, forceRefresh); + return dictData.map(item => ({ + value: isDigital ? Number(item.dictValue || item.dictvalue) : (item.dictValue || item.dictvalue), + label: item.dictLabel || item.dictlabel, + ...item + })); + }; // app.component('tabbar-custom', Tabbar) for (const path in directives) { @@ -56,6 +85,8 @@ export function createApp() { app.use(SelectPopupPlugin); app.use(Pinia.createPinia()); + // 注册vuex + app.use(storeRc); return { app, diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..a04b5bf --- /dev/null +++ b/package-lock.json @@ -0,0 +1,62 @@ +{ + "name": "ks-app-employment-service", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "@dcloudio/uni-ui": "^1.5.11", + "dayjs": "^1.11.19", + "sm-crypto": "^0.3.13" + } + }, + "node_modules/@dcloudio/uni-ui": { + "version": "1.5.11", + "resolved": "https://registry.npmjs.org/@dcloudio/uni-ui/-/uni-ui-1.5.11.tgz", + "integrity": "sha512-DBtk046ofmeFd82zRI7d89SoEwrAxYzUN3WVPm1DIBkpLPG5F5QDNkHMnZGu2wNrMEmGBjBpUh3vqEY1L3jaMw==" + }, + "node_modules/dayjs": { + "version": "1.11.19", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz", + "integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==" + }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==" + }, + "node_modules/sm-crypto": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/sm-crypto/-/sm-crypto-0.3.13.tgz", + "integrity": "sha512-ztNF+pZq6viCPMA1A6KKu3bgpkmYti5avykRHbcFIdSipFdkVmfUw2CnpM2kBJyppIalqvczLNM3wR8OQ0pT5w==", + "dependencies": { + "jsbn": "^1.1.0" + } + } + }, + "dependencies": { + "@dcloudio/uni-ui": { + "version": "1.5.11", + "resolved": "https://registry.npmjs.org/@dcloudio/uni-ui/-/uni-ui-1.5.11.tgz", + "integrity": "sha512-DBtk046ofmeFd82zRI7d89SoEwrAxYzUN3WVPm1DIBkpLPG5F5QDNkHMnZGu2wNrMEmGBjBpUh3vqEY1L3jaMw==" + }, + "dayjs": { + "version": "1.11.19", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz", + "integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==" + }, + "jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==" + }, + "sm-crypto": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/sm-crypto/-/sm-crypto-0.3.13.tgz", + "integrity": "sha512-ztNF+pZq6viCPMA1A6KKu3bgpkmYti5avykRHbcFIdSipFdkVmfUw2CnpM2kBJyppIalqvczLNM3wR8OQ0pT5w==", + "requires": { + "jsbn": "^1.1.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..bcc7116 --- /dev/null +++ b/package.json @@ -0,0 +1,7 @@ +{ + "dependencies": { + "@dcloudio/uni-ui": "^1.5.11", + "dayjs": "^1.11.19", + "sm-crypto": "^0.3.13" + } +} diff --git a/packageA/pages/UnitDetails/UnitDetails.vue b/packageA/pages/UnitDetails/UnitDetails.vue index aa2a086..c11cc7d 100644 --- a/packageA/pages/UnitDetails/UnitDetails.vue +++ b/packageA/pages/UnitDetails/UnitDetails.vue @@ -47,43 +47,31 @@ 在招职位 - + + {{ job.jobTitle }} - {{ job.salaryRange }}元 + ¥{{ job.salaryRange }}/月 - {{ job.companyName }} - {{ job.jobDescription }} - - {{ job.educationRequirement }} - - + + {{ job.experienceRequirement }} - - + + + {{ job.educationRequirement }} + + + {{ job.jobRequirement }} - - {{ job.postingDate }} - - - + + + {{ job.jobDescription }} - + @@ -95,15 +83,14 @@ + + \ No newline at end of file diff --git a/packageB/train/mockExam/viewGrades.vue b/packageB/train/mockExam/viewGrades.vue new file mode 100644 index 0000000..5bd0ad2 --- /dev/null +++ b/packageB/train/mockExam/viewGrades.vue @@ -0,0 +1,65 @@ + + + + + + 考试名称:456546456 + 考试时间:456546456 + 考试成绩:456546456 + + 查看 + + 查看 + + + + + + + + \ No newline at end of file diff --git a/packageRc/api/company/index.js b/packageRc/api/company/index.js new file mode 100644 index 0000000..ba181c1 --- /dev/null +++ b/packageRc/api/company/index.js @@ -0,0 +1,514 @@ +// 获取人员基本信息详情 + + + +// import { post, get } from '../../utils/request.js' + +// export function getPersonInfo(id) { +// return get({ +// url: `personnel/personBaseInfo/${id}`, +// method: 'get' +// }) +// } + +import request from '@/utilsRc/request' + +// 根据 userId 获取企业详情 +export function companyDetails(userId) { + return request({ + method: 'get', + url: `/company/unitBaseInfo/user/${userId}`, + }) +} + +// 企业-推荐人员信息 +export function recommendedPerson(params) { + return request({ + url: '/company/unitBaseInfo/recommend/person', + method: 'get', + params + }) +} + +// 人员邀请 +export function invitePerson(params) { + return request({ + url: '/company/unitBaseInfo/invite', + method: 'get', + params + }) +} + +// 获取企业招聘岗位列表 +export function jobList(params) { + return request({ + url: '/company/unitPostInfo/list', + method: 'get', + params + }) +} + +// 查找已投递、已推荐、已邀请的人员信息 +export function listMatch(query) { + return request({ + url: '/company/unitBaseInfo/relevance', + method: 'get', + params: query + }) +} + +// 添加企业基本信息 +export function addJobBase(data) { + return request({ + url: '/company/unitBaseInfo', + method: 'post', + data: data + }) +} + +// 查询部门下拉树结构 +export function deptTreeSelect() { + return request({ + url: '/system/center/user/deptTree', + method: 'get' + }) +} + +// 企业发布招聘岗位 +export function addJob(data) { + return request({ + url: '/company/unitPostInfo', + method: 'post', + data: data + }) +} + +// 获取招聘工种列表 +export function jobTypeList(params) { + return request({ + url: '/basicdata/workType/list', + method: 'get', + params + }) +} + +// 企业基本信息列表 +export function jobBaseList(query) { + return request({ + url: '/company/unitBaseInfo/list', + method: 'get', + params: query + }) +} + +// 获取企业招聘岗位信息详细信息 +export function getJob(id) { + return request({ + url: `/company/unitPostInfo/${id}`, + method: 'get' + }) +} +// 修改企业招聘岗位信息 +export function updateJob(data) { + return request({ + url: '/company/unitPostInfo', + method: 'put', + data: data + }) +} + +// 修改企业基本信息 +export function updateJobBase(data) { + return request({ + url: '/company/unitBaseInfo', + method: 'put', + data: data + }) +} +// 查询角色详细 +export function getJobService(id) { + return request({ + url: '/personnel/personBaseInfo/' + id, + method: 'get' + }) +} + +// 查询推荐人员、已推荐、已邀请 详情 +export function getUnitBaseInfo(id) { + return request({ + url: '/manage/personDemand/' + id, + method: 'get' + }) +} + + +// 查询工种列表 +export function listJobType(query) { + return request({ + url: '/basicdata/workType/list', + method: 'get', + params: query + }) +} + +// 人员基本信息 - 列表 +export function personInfoList(query) { + return request({ + url: '/personnel/personBaseInfo/list', + method: 'get', + params: query + }) +} + +// 获取人员基本信息详情 +export function getPersonInfo(id) { + return request({ + url: `/personnel/personBaseInfo/${id}`, + method: 'get' + }) +} + + +// 删除人员基本信息 +export function delPersonInfo(ids) { + return request({ + url: '/personnel/personBaseInfo/' + ids, + method: 'delete' + }) +} + +// 删除录入人员 公用 type = 1 失业中 2 就业困难 3 离校生 4 其他人员 +export function delPersonUser(ids) { + return request({ + url: `/personnel/personInputInfo/${ids}`, + method: 'delete', + }) +} + +// 新增人员基本信息 +export function addPersonInfo(data) { + return request({ + url: '/personnel/personBaseInfo', + method: 'post', + data: data + }) +} + +// 修改人员基本信息 +export function updatePersonInfo(data) { + return request({ + url: '/personnel/personBaseInfo', + method: 'put', + data + }) +} + +//社区人员审核 +export function personInfoAudit(data) { + return request({ + url: '/personnel/personBaseInfo/audit', + method: 'post', + data: data + }) +} + + +//记录查看身份证 +export function recordLookIdCard(params) { + return request({ + url: '/personnel/personBaseInfo/recordLookIdCard', + method: 'get', + params + }) +} + + + + +/* 失业人员 --------------------------------------------- start */ + +// 新增失业人员 +export function addPersonUnemployed(data) { + return request({ + url: '/person/unemployment', + method: 'post', + data + }) +} + +// 失业人员修改 +export function updatePersonUnemployed(data) { + return request({ + url: '/person/unemployment', + method: 'put', + data, + }) +} + +// 失业人员列表 +export function unemployment(params) { + return request({ + url: '/person/unemployment/list', + method: 'get', + params + }) +} + +// 失业人员详情 +export function unemploymentDetails(id) { + return request({ + url: `/person/unemployment/${id}`, + method: 'get', + }) +} + +// 失业人员删除 +export function unemploymentDelete(id) { + return request({ + url: `/person/unemployment/${id}`, + method: 'delete', + }) +} + +/* 失业人员 --------------------------------------------- end */ + + +/* 就业困难人员 --------------------------------------------- start */ + +// 新增就业困难 +export function addPersonDifficult(data) { + return request({ + url: '/person/findingEmployment', + method: 'post', + data + }) +} + +// 修改就业困难 +export function updatePersonDifficult(data) { + return request({ + url: '/person/findingEmployment', + method: 'put', + data + }) +} + +// 就业困难列表 +export function findingEmployment(params) { + return request({ + url: '/person/findingEmployment/list', + method: 'get', + params + }) +} + +// 就业困难详情 +export function findingEmploymentDetails(id) { + return request({ + url: `/person/findingEmployment/${id}`, + method: 'get', + }) +} + +// 就业困难删除 +export function findingEmploymentDelete(id) { + return request({ + url: `/person/findingEmployment/${id}`, + method: 'delete', + }) +} +/* 就业困难人员 --------------------------------------------- end */ + + +/* 离校未就业高校生 --------------------------------------------- start */ + +// 新增离校未就业高校生 +export function addLeaveSchool(data) { + return request({ + url: '/person/leavingSchoolInfo', + method: 'post', + data + }) +} + +// 修改离校未就业高校生 +export function updateLeaveSchool(data) { + return request({ + url: '/person/leavingSchoolInfo', + method: 'put', + data, + }) +} + +// 高校未就业列表 +export function leavingSchoolInfo(params) { + return request({ + url: '/person/leavingSchoolInfo/list', + method: 'get', + params + }) +} + +// 高校未就业详情 +export function leavingSchoolInfoDetails(id) { + return request({ + url: `/person/leavingSchoolInfo/${id}`, + method: 'get', + }) +} + + +// 高校未就业删除 +export function leavingSchoolInfoDelete(id) { + return request({ + url: `/person/leavingSchoolInfo/${id}`, + method: 'delete', + }) +} + + +/* 离校未就业高校生 --------------------------------------------- end */ + +/* 其他人员 --------------------------------------------- start */ + +// 新增其他人员 +export function addOther(data) { + return request({ + url: '/person/other', + method: 'post', + data + }) +} + +// 其他人员修改 +export function updateOther(data) { + return request({ + url: '/person/other', + method: 'post', + data, + }) +} + + +// 其他人员列表 +export function other(params) { + return request({ + url: '/person/other/list', + method: 'get', + params + }) +} + +// 其他人员详情 +export function otherDetails(id) { + return request({ + url: `/person/other/${id}`, + method: 'get', + }) +} + +// 其他人员删除 +export function otherDelete(id) { + return request({ + url: `/person/other/${id}`, + method: 'delete', + }) +} +/* 其他人员 --------------------------------------------- end */ + +// 需求预警列表 +export function personAlertList(params) { + return request({ + url: '/manage/personDemand/warningList', + method: 'get', + params + }) +} +export function personDealList(params) { + return request({ + url: '/manage/personDemand/dealingList', + method: 'get', + params + }) +} +// 服务追踪 服务类型/服务id +export function serviceTraceability({ + demandType, + id +}) { + return request({ + // url: `/system/personRequirementsRecords/serviceTraceability/${demandType}/${id}`, + url: `/timelime/timelime/fwzs/${id}`, + method: 'get', + }) +} + +// 需求办结 +export function requirementCompletion(url, data) { + return request({ + url, + method: 'post', + data + }) +} + +//岗位审核 +export function jobAudit(data) { + return request({ + url: '/company/unitPostInfo/audit', + method: 'post', + data: data + }) +} + +//社群 首页未完成数 +// export function getPeopleCount() { +// return request({ +// url: '/pc/index/getPeopleCount', +// method: 'get', +// }) +// } + +//社群 首页未完成数 +export function getDemandUnfinished() { + return request({ + url: '/pc/index/todo', + method: 'get', + }) +} + + + +// 删除企业招聘岗位信息 +export function delJob(ids) { + return request({ + url: '/company/unitPostInfo/' + ids, + method: 'delete' + }) +} + +// 所在社区列表 +export function deptList(params) { + return request({ + 'url': `/system/center/user/deptList`, + 'method': 'get', + params + }) +} + +// 所在社区列表 +export function returnPerson(params) { + return request({ + 'url': `/personnel/personBaseInfo/returnPerson`, + 'method': 'get', + params + }) +} +// 根据人的身份证查询人的详细信息 +export function getIdNumberInfo(params) { + return request({ + 'url': `/personnel/personBaseInfo/getIdNumberInfo`, + 'method': 'get', + params + }) +} diff --git a/packageRc/api/jobType/index.js b/packageRc/api/jobType/index.js new file mode 100644 index 0000000..fa751e2 --- /dev/null +++ b/packageRc/api/jobType/index.js @@ -0,0 +1,15 @@ +/* + * @Date: 2025-10-31 11:06:15 + * @LastEditors: lip + * @LastEditTime: 2025-11-03 12:48:22 + */ +// import { post, get } from '@/utilsRc/request' + +import request from '@/utilsRc/request' +export function listJobType(query) { + return request({ + url: '/basicdata/workType/list', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/packageRc/api/login.js b/packageRc/api/login.js new file mode 100644 index 0000000..f1b2016 --- /dev/null +++ b/packageRc/api/login.js @@ -0,0 +1,50 @@ +/* + * @Date: 2025-10-31 11:06:15 + * @LastEditors: lip + * @LastEditTime: 2025-11-03 12:51:45 + */ +import request from '@/utilsRc/request' + +// 登录方法 +export function login(data) { + return request({ + method: 'post', + url: '/personnel/personBaseInfo/loginGrAndQy', + data, + headers: { + isToken: false + } + }) +} +export function smsLogin(data) { + return request({ + method: 'post', + url: '/personnel/personBaseInfo/loginGrAndQy', + data, + headers: { + isToken: false + } + }) +} +export function wechatLogin(data) { + return request({ + method: 'post', + url: '/personnel/personBaseInfo/loginGrAndQy', + data, + headers: { + isToken: false + } + }) +} +export function register(data) { + return request({ + method: 'post', + url: '/personnel/personBaseInfo/loginGrAndQy', + data, + headers: { + isToken: false + } + }) +} + + diff --git a/packageRc/api/needs/person.js b/packageRc/api/needs/person.js new file mode 100644 index 0000000..2297a97 --- /dev/null +++ b/packageRc/api/needs/person.js @@ -0,0 +1,34 @@ +/* + * @Date: 2025-10-31 11:06:15 + * @LastEditors: lip + * @LastEditTime: 2025-11-03 12:48:30 + */ +// 人员接口 +// import { post, get } from '@/utilsRc/request' +import request from '@/utilsRc/request' +export function getPersonBase(params) { + return request({ + url: '/personnel/personBaseInfo/list', + method: 'get', + + params + }) +} +export function getPersonList(params) { + return request({ + url: '/personnel/personBaseInfo/list', + method: 'get', + params + }) +} + + +// 新增角色 +export function addInvestigate(data) { + return request({ + // url: '//process/processInterview', + url: '//timelime/timelime', + method: 'post', + data: data + }) +} diff --git a/packageRc/api/needs/personDemand.js b/packageRc/api/needs/personDemand.js new file mode 100644 index 0000000..02eefd3 --- /dev/null +++ b/packageRc/api/needs/personDemand.js @@ -0,0 +1,52 @@ +/* + * @Date: 2025-11-03 08:48:44 + * @LastEditors: lip + * @LastEditTime: 2025-11-03 12:48:41 + */ +// 查询个人需求信息列表 +// import { post, get } from '@/utilsRc/request' +import request from '@/utilsRc/request' +export function listPersonDemand(query) { + return request({ + method: 'get', + url: '/manage/personDemand/list', + + params: query + }) +} +export function delPersonDemand(id) { + return request({ + url: '/manage/personDemand/' + id, + method: 'delete' + }) +} + + +// 查询个人需求信息详细 +export function getPersonDemand(id) { + return request({ + method: 'get', + url: '/manage/personDemand/' + id, + }) +} + +// 新增个人需求信息 +export function addPersonDemand(data) { + // 确保传递数据前进行日志输出 + console.log('addPersonDemand函数接收到的数据:', data); + return request({ + url: '/manage/personDemand', + method: 'post', // 修改为大写POST,确保请求参数正确传递 + data: data + }) +} + +// 修改个人需求信息 +export function updatePersonDemand(data) { + return request({ + url: '/manage/personDemand', + method: 'put', + data: data + }) +} + diff --git a/packageRc/api/personinfo/index.js b/packageRc/api/personinfo/index.js new file mode 100644 index 0000000..29af896 --- /dev/null +++ b/packageRc/api/personinfo/index.js @@ -0,0 +1,49 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2025-11-03 12:35:56 + * @LastEditors: lip + */ +// import { post, get } from '../../utils/request.js' +import request from '@/utilsRc/request' + +// 登录方法 +export function personInfoList(data) { + return request({ + method: 'get', + url: '/personnel/personBaseInfo/list', + params: data, + }) +} +// 需求预警列表 +export function personAlertList(params) { + return request({ + method: 'get', + url: '/manage/personDemand/warningList', + + params + }) +} +//经办人数据获取 +export function getJbrInfo() { + return request({ + method: 'get', + url: `system/center/user/selectHxjbr`, + method: 'get' + }) +} +export function getPersonBase() { + return request({ + method: 'get', + url: `system/center/user/selectHxjbr`, + method: 'get' + }) +} +export function returnPerson(params) { + return request({ + method: 'get', + 'url': `/personnel/personBaseInfo/returnPerson`, + + params + }) +} \ No newline at end of file diff --git a/packageRc/components/PopupLists.vue b/packageRc/components/PopupLists.vue new file mode 100644 index 0000000..589cf89 --- /dev/null +++ b/packageRc/components/PopupLists.vue @@ -0,0 +1,374 @@ + + + + + + + + {{ item.dictLabel }} + + + + + + + + + + + {{ item.name }} + + + + + + {{ itm.dictLabel }} + + + + + + + + + + 清空 + + 查询 + + + + + + + + + + + + + + diff --git a/packageRc/components/exitPopup.vue b/packageRc/components/exitPopup.vue new file mode 100644 index 0000000..72e3f98 --- /dev/null +++ b/packageRc/components/exitPopup.vue @@ -0,0 +1,130 @@ + + + + + + 退出登录 + + {{nick || '--'}} + 确定要退出当前账号吗? + + + + + + + + + + + diff --git a/packageRc/components/placePicker.vue b/packageRc/components/placePicker.vue new file mode 100644 index 0000000..2baebaa --- /dev/null +++ b/packageRc/components/placePicker.vue @@ -0,0 +1,203 @@ + + + + + + + 您已选择:{{ checkedMarker.name }}({{ checkedMarker.address }}) + + {{ item.name }} + {{ item.address }} + + + + + + 取 消 + 确 定 + + + + + + + + + diff --git a/packageRc/pages/daiban/addbangfu.vue b/packageRc/pages/daiban/addbangfu.vue new file mode 100644 index 0000000..452fdfc --- /dev/null +++ b/packageRc/pages/daiban/addbangfu.vue @@ -0,0 +1,969 @@ + + + + + + + + + + 被帮扶对象 + + + + + 帮扶方式 + + + + {{ getDemandTypeLabel(serviceForm.demandType) || "请选择" }} + ▼ + + + + + + {{ option.label }} + + + + + + + 帮扶时间 * + + + {{ serviceForm.practicalSolutionTime }} + 请选择 + ✏️ + + + + + + 经办人 + + + + + + + + + 电话沟通结果 + + {{ getDhgtjgLabel(serviceForm.dhgtjg) || "请选择" }} + ▼ + + + + + 帮扶内容 + + + + {{ getServiceContentLabel(serviceForm.serviceContent) || "请选择" }} + ▼ + + + + + + + + + 帮扶情况说明 + + + + + + + + + 帮扶情况说明 + + + + 添加图片 ({{ fileList.length }}/6) + + + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + 附件 + + + 上传附件 (最多6个) + + + + + {{ file.name }} + 删除 + + + + + + + + + + + 取消 + 保存 + + + + + + + + 取消 + {{ getPickerTitle(currentPicker) }} + 确定 + + + + + + + + {{ option.label }} + + + + + + + + + + + diff --git a/packageRc/pages/daiban/daiban.vue b/packageRc/pages/daiban/daiban.vue new file mode 100644 index 0000000..c6ee16a --- /dev/null +++ b/packageRc/pages/daiban/daiban.vue @@ -0,0 +1,617 @@ + + + + + + + + + 重点毕业生数 + 1120 + + | + + 累计需求数 + 1120 + + | + + 累计服务数 + 1120 + + + + + + + 毕业生追踪 + + + 点击查看 + + + + + + + 任务下发管理员 + + + 点击查看 + + + + + + 待办需求预警列表 + 共 {{jobList1count}}条信息 + + + {{ item.personName }} {{ item.deptName }} + + {{getDictLabel(item.demandType, qcjy_xqlx)}}_{{ item.jobDescription }} + + + 发起时间:{{item.createTime}} + {{getDictLabel(item.currentStatus, qcjy_xqlc)}} + + + + 待服务毕业生列表 + 共 {{jobListcount}} 条信息 + + + + + + + + {{item.name}}{{item.zy}} + •未服务 + •已服务 + •联系不上 + •拒绝服务 + •被退回 + + + 年龄:{{item.age}}岁 + 服务次数:{{item.operateNum}}次 + + + + + 联系电话:{{item.phone || '--'}} + 详细地址:{{item.xxdz}} + + + 退回 + 服务 + + + + + + + + + + + + 取消 + 确认退回 + + + + + + + + + \ No newline at end of file diff --git a/packageRc/pages/daiban/daibandetail.vue b/packageRc/pages/daiban/daibandetail.vue new file mode 100644 index 0000000..a43bcd1 --- /dev/null +++ b/packageRc/pages/daiban/daibandetail.vue @@ -0,0 +1,1414 @@ + + + + + + 服务次数 {{ serviceTotal }} + {{'查看>'}} + + + + + {{ form?.name || '' }} + + 男 + 女 + · + {{ calculateAge(form.cardNumber) }}岁 + + + {{ form.phone }} + + + + + + + + + 服务 + + + + + + + 求职需求数 + + + {{ jobSearchList.length }} + + + + 创业需求数 + + + {{ listOfEntrepreneurialNeeds.length }} + + + + 培训需求数 + + + {{ trainingList.length }} + + + + 其他需求数 + + + {{ otherList.length }} + + + + + + + + + {{ + getJobWorkTypeName(item.jobWorkType) + }} + + 期望薪资: + + {{ item.minRecruitmentSalary}}- + {{ item.highRecruitmentSalary}} + /月 + + + + 希望工作地点: + {{ item.addressDesc }} + + + 待处理 + 处理中 + 已完成 + + + + + + 推荐 + 办结 + + + + + + + + + + + {{ item.personName }}的创业需求 + + + 是否意有场地需求: + {{ item.ywcdxq }} + + + 是否意向参加创业培训: + {{ item.ywcypxxq }} + + + 是否有资金需求: + {{ item.ywzjxq }} + + + 待处理 + 处理中 + 已完成 + + + + + + 办理 + + + + + + + + + + {{ item.personName }}的培训需求 + + + 培训意愿工种: + {{ getJobWorkTypeName(item.qwpxgz) }} + + + 期望培训时间: + {{ item.qwpxsj }} + + + + 待处理 + 处理中 + 已完成 + + + + + + + 办理 + + + + + + + + + + {{ item.personName }}的其他需求 + + + + 需求说明: + {{ item.jobDescription }} + + + + 待处理 + 处理中 + 已完成 + + + + + + + 办理 + + + + + + + + + + + + + + + + + + + + diff --git a/packageRc/pages/demand/components/ImageUpload.vue b/packageRc/pages/demand/components/ImageUpload.vue new file mode 100644 index 0000000..bffbea0 --- /dev/null +++ b/packageRc/pages/demand/components/ImageUpload.vue @@ -0,0 +1,158 @@ + + + + + + + + + + diff --git a/packageRc/pages/demand/components/choosePerson.vue b/packageRc/pages/demand/components/choosePerson.vue new file mode 100644 index 0000000..c608a0f --- /dev/null +++ b/packageRc/pages/demand/components/choosePerson.vue @@ -0,0 +1,133 @@ + + + + + + + + + {{ item.name }} + {{ item.phone }} + + + 现居住地:{{item.currentResidentialAddress}} + + + + 取消 + 重置 + 确定 + + + + + + + + + diff --git a/packageRc/pages/demand/components/entrepreneurshipService.vue b/packageRc/pages/demand/components/entrepreneurshipService.vue new file mode 100644 index 0000000..9a64200 --- /dev/null +++ b/packageRc/pages/demand/components/entrepreneurshipService.vue @@ -0,0 +1,638 @@ + + + + + + 创业需求信息 + 编辑✏️ + + + + + 姓名 * + + {{ formData.personName || '请选择' }} + + + {{ formData.personName || '请选择' }} + + ✏️ + + + 有无场地需求 * + + + + 是 + + + + 否 + + {{ formData.ywcdxq }} + + + + 场地面积 + + + ✏️ + + + 办公人数 + + ✏️ + + + 办公位置 + + ✏️ + + + 有无创业培训需求 * + + + + 是 + + + + 否 + + {{ formData.ywcypxxq }} + + + + + + + + + + + 有无资金需求 * + + + + 是 + + + + 否 + + {{ formData.ywzjxq }} + + + + 需求说明 * + + + + + + + + + + + + + + + + + + + + + 取消 + 重置 + 保存 + + + + + + + diff --git a/packageRc/pages/demand/components/jobService.vue b/packageRc/pages/demand/components/jobService.vue new file mode 100644 index 0000000..c994fff --- /dev/null +++ b/packageRc/pages/demand/components/jobService.vue @@ -0,0 +1,910 @@ + + + + + + 求职需求信息 + 编辑✏️ + + + + + 姓名 * + + {{ formData.personName || '请选择' }} + + + {{ formData.personName || '请选择' }} + + ✏️ + + + + + + 求职工种 + + + {{ formData.jobWorkTypeName || '请选择工种' }} + ▼ + + + + 工种数据加载中... + + + + + + + 最低薪酬 * + + ✏️ + + + 最高薪酬 * + + ✏️ + + + + + 希望工作地点 + + + + 求职说明 * + + + + + + + + + + + + + + + + + + 取消 + 重置 + 保存 + + + + + + + + diff --git a/packageRc/pages/demand/components/otherService.vue b/packageRc/pages/demand/components/otherService.vue new file mode 100644 index 0000000..bf9ef00 --- /dev/null +++ b/packageRc/pages/demand/components/otherService.vue @@ -0,0 +1,406 @@ + + + + + + 需求信息 + 编辑✏️ + + + + + 姓名 * + + {{ formData.personName || '请选择' }} + + + {{ formData.personName || '请选择' }} + + ✏️ + + + + 需求说明 * + + + + + + + + + + + + + + 取消 + 重置 + 保存 + + + + + + + \ No newline at end of file diff --git a/packageRc/pages/demand/components/trainService.vue b/packageRc/pages/demand/components/trainService.vue new file mode 100644 index 0000000..04c369c --- /dev/null +++ b/packageRc/pages/demand/components/trainService.vue @@ -0,0 +1,764 @@ + + + + + + + 培训需求信息 + 编辑✏️ + + + + + 姓名 * + + {{ formData.personName || '请选择' }} + + + {{ formData.personName || '请选择' }} + + ✏️ + + + 培训意愿工种 * + + + {{ formData.qwpxgzName || '请选择工种' }} + ▼ + + + + 工种数据加载中... + + + + 期望培训时间 * + + + {{ formData.qwpxsj }} + 请选择 + ✏️ + + + + + 需求说明 * + + + + + + + + + + + + + + 取消 + 重置 + 保存 + + + + + + + diff --git a/packageRc/pages/demand/demandail.vue b/packageRc/pages/demand/demandail.vue new file mode 100644 index 0000000..0428e4f --- /dev/null +++ b/packageRc/pages/demand/demandail.vue @@ -0,0 +1,188 @@ + + + + + + {{isAdd ? '需求新增' : '需求维护'}} + + + + 求职需求 + + 创业需求 + + 培训需求 + + 其他需求 + + + + + + + + + + + + + + diff --git a/packageRc/pages/index/index.vue b/packageRc/pages/index/index.vue new file mode 100644 index 0000000..7990425 --- /dev/null +++ b/packageRc/pages/index/index.vue @@ -0,0 +1,332 @@ + + + + + + + + + 信息维护 + + + + 投递记录 + + + + 需求上报 + + + + 虚拟面试 + + + + 素质测评 + + + + 岗位列表 + 实习实训 + 社区实践 + + + 推荐岗位 + 热门岗位 + + + + {{item.minSalary}}-{{item.maxSalary}}/月 + 发布日期:{{ item.postingDate }} + + {{ item.jobTitle }} + + + + + + + + {{ item.jobLocation }} + + + {{item.vacancies}}人 + {{ item.companyName }} + + + + 查看更多内容 + + 政策专区 + {{'查看更多 >'}} + + + 推荐 + + + 销售顾问 + + 大专 + 1-3年 + 喀什 市南区 + + + 发布日期:2025-10-20 + 浏览数99+ + + + + + + + + + \ No newline at end of file diff --git a/packageRc/pages/personalList/personalList.vue b/packageRc/pages/personalList/personalList.vue new file mode 100644 index 0000000..9f631dc --- /dev/null +++ b/packageRc/pages/personalList/personalList.vue @@ -0,0 +1,1004 @@ + + + + + + + + + + + + + + + + {{ filterTotal > 0 ? '筛选+' + filterTotal : '筛选' }} + + + + + 共{{ total }}条信息 + + + + + + + + + + + + + + {{ item.label }} + + + + + + + + + + + + {{ + job.name || "-" + }} + + 年龄: + {{ + job.age || "--" + }}岁 + 服务次数: + {{ + job.operateNum + }}次 + + + + + •未服务 + •已服务 + •联系不上 + •拒绝服务 + •被退回 + + + + 证件号: + {{ job.cardNumber }} + {{ encryptIdCard(job.cardNumber) }} + + + + + + 联系电话: + {{ job.phone }} + + + 详细地址: + {{ job.currentResidentialAddress || "--" }} + + + 退回 + 服务 + 就业登记 + + + + + + + + + + + + 取消 + 确定 + + + + 服务状态: + + {{ item.dictLabel }} + + + + 性别: + + {{ item.dictLabel }} + + + + 学历: + + {{ item.dictLabel }} + + + + 人员类型: + + {{ item.dictLabel }} + + + + 人员状态: + + {{ item.dictLabel }} + + + + + 是否退回: + + {{ item.dictLabel }} + + + + + + + + + + + + + + 服务状态: + + {{ item.dictLabel }} + + + + + + + + + + + + + + + 通过 + + + 不通过 + + + + + + + + + + + + + + + + 退回 + + + + + + + + + + + + + + + + + + diff --git a/packageRc/pages/service/serviceDetail.vue b/packageRc/pages/service/serviceDetail.vue new file mode 100644 index 0000000..e69de29 diff --git a/packageRc/static/images/addPersonnel.png b/packageRc/static/images/addPersonnel.png new file mode 100644 index 0000000..06501aa Binary files /dev/null and b/packageRc/static/images/addPersonnel.png differ diff --git a/packageRc/static/images/person/addNeeds.png b/packageRc/static/images/person/addNeeds.png new file mode 100644 index 0000000..cfbf318 Binary files /dev/null and b/packageRc/static/images/person/addNeeds.png differ diff --git a/packageRc/static/images/person/femalepng.png b/packageRc/static/images/person/femalepng.png new file mode 100644 index 0000000..360adc6 Binary files /dev/null and b/packageRc/static/images/person/femalepng.png differ diff --git a/packageRc/static/images/person/fillInRecords.png b/packageRc/static/images/person/fillInRecords.png new file mode 100644 index 0000000..1fdabad Binary files /dev/null and b/packageRc/static/images/person/fillInRecords.png differ diff --git a/packageRc/static/images/person/malepng.png b/packageRc/static/images/person/malepng.png new file mode 100644 index 0000000..fc72c52 Binary files /dev/null and b/packageRc/static/images/person/malepng.png differ diff --git a/packageRc/static/images/selected.png b/packageRc/static/images/selected.png new file mode 100644 index 0000000..8efaa33 Binary files /dev/null and b/packageRc/static/images/selected.png differ diff --git a/packageRc/static/images/serviceFrequency.png b/packageRc/static/images/serviceFrequency.png new file mode 100644 index 0000000..977d7e0 Binary files /dev/null and b/packageRc/static/images/serviceFrequency.png differ diff --git a/packageRc/static/images/top.png b/packageRc/static/images/top.png new file mode 100644 index 0000000..e403e6c Binary files /dev/null and b/packageRc/static/images/top.png differ diff --git a/packageRc/static/kinggang1.png b/packageRc/static/kinggang1.png new file mode 100644 index 0000000..1f483d0 Binary files /dev/null and b/packageRc/static/kinggang1.png differ diff --git a/packageRc/static/kinggang2.png b/packageRc/static/kinggang2.png new file mode 100644 index 0000000..aa71fba Binary files /dev/null and b/packageRc/static/kinggang2.png differ diff --git a/packageRc/static/kinggang3.png b/packageRc/static/kinggang3.png new file mode 100644 index 0000000..a63dd78 Binary files /dev/null and b/packageRc/static/kinggang3.png differ diff --git a/packageRc/static/kinggang4.png b/packageRc/static/kinggang4.png new file mode 100644 index 0000000..58f7e42 Binary files /dev/null and b/packageRc/static/kinggang4.png differ diff --git a/packageRc/static/kinggang5.png b/packageRc/static/kinggang5.png new file mode 100644 index 0000000..4778133 Binary files /dev/null and b/packageRc/static/kinggang5.png differ diff --git a/packageRc/static/pageBg.png b/packageRc/static/pageBg.png new file mode 100644 index 0000000..21f5378 Binary files /dev/null and b/packageRc/static/pageBg.png differ diff --git a/packageRc/static/person/addEnterprise.png b/packageRc/static/person/addEnterprise.png new file mode 100644 index 0000000..3f8c52c Binary files /dev/null and b/packageRc/static/person/addEnterprise.png differ diff --git a/packageRc/static/person/addNeeds.png b/packageRc/static/person/addNeeds.png new file mode 100644 index 0000000..cfbf318 Binary files /dev/null and b/packageRc/static/person/addNeeds.png differ diff --git a/packageRc/static/person/addNeeds1.png b/packageRc/static/person/addNeeds1.png new file mode 100644 index 0000000..73a60a5 Binary files /dev/null and b/packageRc/static/person/addNeeds1.png differ diff --git a/packageRc/static/person/bannerCard-old.png b/packageRc/static/person/bannerCard-old.png new file mode 100644 index 0000000..41baa13 Binary files /dev/null and b/packageRc/static/person/bannerCard-old.png differ diff --git a/packageRc/static/person/bannerCard.png b/packageRc/static/person/bannerCard.png new file mode 100644 index 0000000..46a6169 Binary files /dev/null and b/packageRc/static/person/bannerCard.png differ diff --git a/packageRc/static/person/bannerCard_chu.png b/packageRc/static/person/bannerCard_chu.png new file mode 100644 index 0000000..e69de29 diff --git a/packageRc/static/person/bannerCard_old.png b/packageRc/static/person/bannerCard_old.png new file mode 100644 index 0000000..e69de29 diff --git a/packageRc/static/person/ditu.png b/packageRc/static/person/ditu.png new file mode 100644 index 0000000..055334e Binary files /dev/null and b/packageRc/static/person/ditu.png differ diff --git a/packageRc/static/person/empty.png b/packageRc/static/person/empty.png new file mode 100644 index 0000000..4f040fe Binary files /dev/null and b/packageRc/static/person/empty.png differ diff --git a/packageRc/static/person/enterprise.png b/packageRc/static/person/enterprise.png new file mode 100644 index 0000000..aa6db83 Binary files /dev/null and b/packageRc/static/person/enterprise.png differ diff --git a/packageRc/static/person/enterpriseIcon.png b/packageRc/static/person/enterpriseIcon.png new file mode 100644 index 0000000..0872690 Binary files /dev/null and b/packageRc/static/person/enterpriseIcon.png differ diff --git a/packageRc/static/person/entrepreneurialIcon.png b/packageRc/static/person/entrepreneurialIcon.png new file mode 100644 index 0000000..7c5c987 Binary files /dev/null and b/packageRc/static/person/entrepreneurialIcon.png differ diff --git a/packageRc/static/person/femalepng.png b/packageRc/static/person/femalepng.png new file mode 100644 index 0000000..360adc6 Binary files /dev/null and b/packageRc/static/person/femalepng.png differ diff --git a/packageRc/static/person/fillInRecords.png b/packageRc/static/person/fillInRecords.png new file mode 100644 index 0000000..1fdabad Binary files /dev/null and b/packageRc/static/person/fillInRecords.png differ diff --git a/packageRc/static/person/fillInRecords2.png b/packageRc/static/person/fillInRecords2.png new file mode 100644 index 0000000..8d16aad Binary files /dev/null and b/packageRc/static/person/fillInRecords2.png differ diff --git a/packageRc/static/person/firstTop.png b/packageRc/static/person/firstTop.png new file mode 100644 index 0000000..2305b0e Binary files /dev/null and b/packageRc/static/person/firstTop.png differ diff --git a/packageRc/static/person/header-botom.png b/packageRc/static/person/header-botom.png new file mode 100644 index 0000000..7d6a9b4 Binary files /dev/null and b/packageRc/static/person/header-botom.png differ diff --git a/packageRc/static/person/information.png b/packageRc/static/person/information.png new file mode 100644 index 0000000..cda168d Binary files /dev/null and b/packageRc/static/person/information.png differ diff --git a/packageRc/static/person/jiaofei.png b/packageRc/static/person/jiaofei.png new file mode 100644 index 0000000..ef3ff83 Binary files /dev/null and b/packageRc/static/person/jiaofei.png differ diff --git a/packageRc/static/person/jiazheng.png b/packageRc/static/person/jiazheng.png new file mode 100644 index 0000000..2c7be94 Binary files /dev/null and b/packageRc/static/person/jiazheng.png differ diff --git a/packageRc/static/person/jiuye.png b/packageRc/static/person/jiuye.png new file mode 100644 index 0000000..d1eee78 Binary files /dev/null and b/packageRc/static/person/jiuye.png differ diff --git a/packageRc/static/person/jobSeekingIcon.png b/packageRc/static/person/jobSeekingIcon.png new file mode 100644 index 0000000..7ca7c06 Binary files /dev/null and b/packageRc/static/person/jobSeekingIcon.png differ diff --git a/packageRc/static/person/keynote.png b/packageRc/static/person/keynote.png new file mode 100644 index 0000000..d574b2b Binary files /dev/null and b/packageRc/static/person/keynote.png differ diff --git a/packageRc/static/person/location.png b/packageRc/static/person/location.png new file mode 100644 index 0000000..abeac72 Binary files /dev/null and b/packageRc/static/person/location.png differ diff --git a/packageRc/static/person/malepng.png b/packageRc/static/person/malepng.png new file mode 100644 index 0000000..fc72c52 Binary files /dev/null and b/packageRc/static/person/malepng.png differ diff --git a/packageRc/static/person/quanzi.png b/packageRc/static/person/quanzi.png new file mode 100644 index 0000000..6014794 Binary files /dev/null and b/packageRc/static/person/quanzi.png differ diff --git a/packageRc/static/person/qxwq.png b/packageRc/static/person/qxwq.png new file mode 100644 index 0000000..b2f2c03 Binary files /dev/null and b/packageRc/static/person/qxwq.png differ diff --git a/packageRc/static/person/search.png b/packageRc/static/person/search.png new file mode 100644 index 0000000..9d1c865 Binary files /dev/null and b/packageRc/static/person/search.png differ diff --git a/packageRc/static/person/serviceFrequency.png b/packageRc/static/person/serviceFrequency.png new file mode 100644 index 0000000..977d7e0 Binary files /dev/null and b/packageRc/static/person/serviceFrequency.png differ diff --git a/packageRc/static/person/sheequ.png b/packageRc/static/person/sheequ.png new file mode 100644 index 0000000..2753254 Binary files /dev/null and b/packageRc/static/person/sheequ.png differ diff --git a/packageRc/static/person/staff.png b/packageRc/static/person/staff.png new file mode 100644 index 0000000..585ad6a Binary files /dev/null and b/packageRc/static/person/staff.png differ diff --git a/packageRc/static/person/summary.png b/packageRc/static/person/summary.png new file mode 100644 index 0000000..d266db3 Binary files /dev/null and b/packageRc/static/person/summary.png differ diff --git a/packageRc/static/person/summaryStatistics.png b/packageRc/static/person/summaryStatistics.png new file mode 100644 index 0000000..f8bd157 Binary files /dev/null and b/packageRc/static/person/summaryStatistics.png differ diff --git a/packageRc/static/person/title-left.png b/packageRc/static/person/title-left.png new file mode 100644 index 0000000..73e302e Binary files /dev/null and b/packageRc/static/person/title-left.png differ diff --git a/packageRc/static/person/tongzhi.png b/packageRc/static/person/tongzhi.png new file mode 100644 index 0000000..be2fc33 Binary files /dev/null and b/packageRc/static/person/tongzhi.png differ diff --git a/packageRc/static/person/toudi-icon.png b/packageRc/static/person/toudi-icon.png new file mode 100644 index 0000000..4143167 Binary files /dev/null and b/packageRc/static/person/toudi-icon.png differ diff --git a/packageRc/static/person/trainingIcon.png b/packageRc/static/person/trainingIcon.png new file mode 100644 index 0000000..64c5076 Binary files /dev/null and b/packageRc/static/person/trainingIcon.png differ diff --git a/packageRc/static/person/unread.png b/packageRc/static/person/unread.png new file mode 100644 index 0000000..44caeed Binary files /dev/null and b/packageRc/static/person/unread.png differ diff --git a/packageRc/static/person/zct.png b/packageRc/static/person/zct.png new file mode 100644 index 0000000..91b9cfd Binary files /dev/null and b/packageRc/static/person/zct.png differ diff --git a/packageRc/static/personIcon.png b/packageRc/static/personIcon.png new file mode 100644 index 0000000..29df64e Binary files /dev/null and b/packageRc/static/personIcon.png differ diff --git a/packageRc/static/personIconFe.png b/packageRc/static/personIconFe.png new file mode 100644 index 0000000..40aa250 Binary files /dev/null and b/packageRc/static/personIconFe.png differ diff --git a/packageRc/static/sendManager.png b/packageRc/static/sendManager.png new file mode 100644 index 0000000..874dad2 Binary files /dev/null and b/packageRc/static/sendManager.png differ diff --git a/packageRc/static/trace.png b/packageRc/static/trace.png new file mode 100644 index 0000000..8d4279d Binary files /dev/null and b/packageRc/static/trace.png differ diff --git a/packageRc/static/zcLeft.png b/packageRc/static/zcLeft.png new file mode 100644 index 0000000..ad4f93d Binary files /dev/null and b/packageRc/static/zcLeft.png differ diff --git a/pages.json b/pages.json index e638521..245dfe7 100644 --- a/pages.json +++ b/pages.json @@ -411,9 +411,58 @@ "navigationBarTitleTextSize": "30rpx" // "navigationStyle": "custom" } + }, + { + "path" : "train/mockExam/viewGrades", + "style" : + { + "navigationBarTitleText" : "查看成绩", + "navigationBarTitleTextSize": "30rpx" + // "navigationStyle": "custom" + } } ] - }], + }, + { + "root": "packageRc", + "pages": [ + { + "path" : "pages/index/index", + "style" : + { + "navigationBarTitleText" : "高校毕业生智慧就业" + } + } , { + "path": "pages/personalList/personalList", + "style": { + "navigationBarTitleText": "添加帮扶" + } + },{ + "path": "pages/daiban/daiban", + "style": { + "navigationBarTitleText": "待办任务" + } + }, + { + "path": "pages/daiban/daibandetail", + "style": { + "navigationBarTitleText": "待办详情" + } + }, + + { + "path": "pages/demand/demandail", + "style": { + "navigationBarTitleText": "新增需求" + } + } , { + "path": "pages/daiban/addbangfu", + "style": { + "navigationBarTitleText": "添加帮扶" + } + } + ] + }], // "tabBar": { // "custom": true, // "color": "#5E5F60", diff --git a/pages/careerfair/careerfair.vue b/pages/careerfair/careerfair.vue index e22e5fa..2b49310 100644 --- a/pages/careerfair/careerfair.vue +++ b/pages/careerfair/careerfair.vue @@ -47,23 +47,6 @@ v-model="pageState.jobFairTitle" /> - @@ -85,17 +68,14 @@ ) " > - {{ item.jobFairTitle }} + + {{ item.jobFairTitle }} + + {{ getTimeStatus(item.jobFairStartTime, item.jobFairEndTime).statusText }} + + {{ item.jobFairAddress }} - - - @@ -108,12 +88,6 @@ - - {{ - getTimeStatus(item.jobFairStartTime, item.jobFairEndTime) - .statusText - }} - {{ getHoursBetween( @@ -161,6 +135,7 @@ import useLocationStore from "@/stores/useLocationStore"; import { storeToRefs } from "pinia"; import { tabbarManager } from "@/utils/tabbarManager"; import WxAuthLogin from "@/components/WxAuthLogin/WxAuthLogin.vue"; +import config from "@/config.js"; const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore()); const wxAuthLoginRef = ref(null); const { $api, navTo, cloneDeep } = inject("globalFunction"); @@ -180,6 +155,7 @@ const pageState = reactive({ pageSize: 10, jobFairTitle: "", }); +const baseUrl = config.imgBaseUrl; onLoad(() => { // const today = new Date(); @@ -246,7 +222,7 @@ function changeSwiperMsgType(e) { function seemsg(index) { state.current = index; - console.log(index, 'index'); + console.log(index, "index"); if (index != 3) { getFair("refresh"); @@ -276,7 +252,7 @@ const handleScrollToLower = () => { } else { this.$nextTick(() => { getMyFair(); - }) + }); } } }; @@ -337,16 +313,18 @@ function getMyFair(type = "add") { params.personId = userInfo.value.info.userId; } } - $api.myRequest("/jobfair/public/jobfair/enterprise/my-sign-up-job-fair", params).then((resData) => { - if (type === "add") { - const reslist = resData.data.list; - fairList.value = fairList.value.concat(reslist); - } else { - fairList.value = resData.data.list; - } - pageState.total = resData.data.total; - pageState.maxPage = resData.data.pages; - }); + $api + .myRequest("/jobfair/public/jobfair/enterprise/my-sign-up-job-fair", params) + .then((resData) => { + if (type === "add") { + const reslist = resData.data.list; + fairList.value = fairList.value.concat(reslist); + } else { + fairList.value = resData.data.list; + } + pageState.total = resData.data.total; + pageState.maxPage = resData.data.pages; + }); } function getFair(type = "add") { if (type === "refresh") { @@ -384,18 +362,18 @@ function getFair(type = "add") { function toIOSDate(input) { if (!input) return null; if (input instanceof Date) return isNaN(input.getTime()) ? null : input; - if (typeof input === 'number') { + if (typeof input === "number") { const d = new Date(input); return isNaN(d.getTime()) ? null : d; } - if (typeof input !== 'string') return null; + if (typeof input !== "string") return null; let s = input.trim(); // "YYYY-MM-DD HH:mm[:ss]" -> "YYYY-MM-DDTHH:mm[:ss]" if (/^\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}(:\d{2})?$/.test(s)) { - s = s.replace(' ', 'T'); + s = s.replace(" ", "T"); // 仅到分钟则补秒 if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(s)) { - s = s + ':00'; + s = s + ":00"; } } // 其余已是 iOS 可解析格式:"YYYY/MM/DD[ HH:mm:ss]"、"YYYY-MM-DD"、ISO 8601 等 @@ -406,23 +384,23 @@ function toIOSDate(input) { function parseDateTime(datetimeStr) { if (!datetimeStr) return { - time: '', - date: '', + time: "", + date: "", }; const dateObj = toIOSDate(datetimeStr); if (!dateObj) return { - time: '', - date: '', + time: "", + date: "", }; // 无效时间 const year = dateObj.getFullYear(); - const month = String(dateObj.getMonth() + 1).padStart(2, '0'); - const day = String(dateObj.getDate()).padStart(2, '0'); - const hours = String(dateObj.getHours()).padStart(2, '0'); - const minutes = String(dateObj.getMinutes()).padStart(2, '0'); + const month = String(dateObj.getMonth() + 1).padStart(2, "0"); + const day = String(dateObj.getDate()).padStart(2, "0"); + const hours = String(dateObj.getHours()).padStart(2, "0"); + const minutes = String(dateObj.getMinutes()).padStart(2, "0"); return { time: `${hours}:${minutes}`, @@ -436,25 +414,30 @@ function getTimeStatus(startTimeStr, endTimeStr) { const endTime = toIOSDate(endTimeStr); if (!startTime || !endTime) { - return { status: 1, statusText: '时间异常' }; + return { status: 1, statusText: "时间异常", color: "#999999" }; } - // 判断状态:0 开始中,1 过期,2 待开始 + // 判断状态:0 开始中,1 过期,2 未开始 let status = 0; - let statusText = '开始中'; + let statusText = "开始中"; + let color = "#13C57C"; // 进行中 - 绿色 if (now < startTime) { - status = 2; // 待开始 - statusText = '待开始'; + status = 2; // 未开始 + statusText = "未开始"; + color = "#015EEA"; // 未开始 - 蓝色 } else if (now > endTime) { status = 1; // 已过期 - statusText = '已过期'; + statusText = "已过期"; + color = "#999999"; // 已过期 - 灰色 } else { status = 0; // 进行中 - statusText = '进行中'; + statusText = "进行中"; + color = "#13C57C"; // 进行中 - 绿色 } return { - status, // 0: 进行中,1: 已过期,2: 待开始 + status, // 0: 进行中,1: 已过期,2: 未开始 statusText, + color }; } @@ -481,7 +464,7 @@ const selectDate = (item) => { }; function getNextDates({ startDate = "", count = 6 }) { - const baseDate = startDate ? (toIOSDate(startDate) || new Date()) : new Date(); // 指定起点或今天 + const baseDate = startDate ? toIOSDate(startDate) || new Date() : new Date(); // 指定起点或今天 const dates = []; const dayNames = ["日", "一", "二", "三", "四", "五", "六"]; @@ -507,7 +490,7 @@ function getNextDates({ startDate = "", count = 6 }) { } - diff --git a/uni_modules/uni-data-select/package.json b/uni_modules/uni-data-select/package.json new file mode 100644 index 0000000..4033502 --- /dev/null +++ b/uni_modules/uni-data-select/package.json @@ -0,0 +1,106 @@ +{ + "id": "uni-data-select", + "displayName": "uni-data-select 下拉框选择器", + "version": "1.1.0", + "description": "通过数据驱动的下拉框选择器", + "keywords": [ + "uni-ui", + "select", + "uni-data-select", + "下拉框", + "下拉选" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.1.1", + "uni-app": "^4.45", + "uni-app-x": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue", + "darkmode": "x", + "i18n": "x", + "widescreen": "x" + }, + "uni_modules": { + "dependencies": [ + "uni-load-more" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "√", + "aliyun": "√", + "alipay": "√" + }, + "client": { + "uni-app": { + "vue": { + "vue2": "√", + "vue3": "√" + }, + "web": { + "safari": "√", + "chrome": "√" + }, + "app": { + "vue": "√", + "nvue": "-", + "android": "√", + "ios": "√", + "harmony": "√" + }, + "mp": { + "weixin": "√", + "alipay": "√", + "toutiao": "√", + "baidu": "-", + "kuaishou": "-", + "jd": "-", + "harmony": "-", + "qq": "-", + "lark": "-" + }, + "quickapp": { + "huawei": "-", + "union": "-" + } + }, + "uni-app-x": { + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-" + } + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-data-select/readme.md b/uni_modules/uni-data-select/readme.md new file mode 100644 index 0000000..eb58de3 --- /dev/null +++ b/uni_modules/uni-data-select/readme.md @@ -0,0 +1,8 @@ +## DataSelect 下拉框选择器 +> **组件名:uni-data-select** +> 代码块: `uDataSelect` + +当选项过多时,使用下拉菜单展示并选择内容 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-select) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-dateformat/changelog.md b/uni_modules/uni-dateformat/changelog.md new file mode 100644 index 0000000..d551d7b --- /dev/null +++ b/uni_modules/uni-dateformat/changelog.md @@ -0,0 +1,10 @@ +## 1.0.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-dateformat](https://uniapp.dcloud.io/component/uniui/uni-dateformat) +## 0.0.5(2021-07-08) +- 调整 默认时间不再是当前时间,而是显示'-'字符 +## 0.0.4(2021-05-12) +- 新增 组件示例地址 +## 0.0.3(2021-02-04) +- 调整为uni_modules目录规范 +- 修复 iOS 平台日期格式化出错的问题 diff --git a/uni_modules/uni-dateformat/components/uni-dateformat/date-format.js b/uni_modules/uni-dateformat/components/uni-dateformat/date-format.js new file mode 100644 index 0000000..e00d559 --- /dev/null +++ b/uni_modules/uni-dateformat/components/uni-dateformat/date-format.js @@ -0,0 +1,200 @@ +// yyyy-MM-dd hh:mm:ss.SSS 所有支持的类型 +function pad(str, length = 2) { + str += '' + while (str.length < length) { + str = '0' + str + } + return str.slice(-length) +} + +const parser = { + yyyy: (dateObj) => { + return pad(dateObj.year, 4) + }, + yy: (dateObj) => { + return pad(dateObj.year) + }, + MM: (dateObj) => { + return pad(dateObj.month) + }, + M: (dateObj) => { + return dateObj.month + }, + dd: (dateObj) => { + return pad(dateObj.day) + }, + d: (dateObj) => { + return dateObj.day + }, + hh: (dateObj) => { + return pad(dateObj.hour) + }, + h: (dateObj) => { + return dateObj.hour + }, + mm: (dateObj) => { + return pad(dateObj.minute) + }, + m: (dateObj) => { + return dateObj.minute + }, + ss: (dateObj) => { + return pad(dateObj.second) + }, + s: (dateObj) => { + return dateObj.second + }, + SSS: (dateObj) => { + return pad(dateObj.millisecond, 3) + }, + S: (dateObj) => { + return dateObj.millisecond + }, +} + +// 这都n年了iOS依然不认识2020-12-12,需要转换为2020/12/12 +function getDate(time) { + if (time instanceof Date) { + return time + } + switch (typeof time) { + case 'string': + { + // 2020-12-12T12:12:12.000Z、2020-12-12T12:12:12.000 + if (time.indexOf('T') > -1) { + return new Date(time) + } + return new Date(time.replace(/-/g, '/')) + } + default: + return new Date(time) + } +} + +export function formatDate(date, format = 'yyyy/MM/dd hh:mm:ss') { + if (!date && date !== 0) { + return '' + } + date = getDate(date) + const dateObj = { + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds(), + millisecond: date.getMilliseconds() + } + const tokenRegExp = /yyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S/ + let flag = true + let result = format + while (flag) { + flag = false + result = result.replace(tokenRegExp, function(matched) { + flag = true + return parser[matched](dateObj) + }) + } + return result +} + +export function friendlyDate(time, { + locale = 'zh', + threshold = [60000, 3600000], + format = 'yyyy/MM/dd hh:mm:ss' +}) { + if (time === '-') { + return time + } + if (!time && time !== 0) { + return '' + } + const localeText = { + zh: { + year: '年', + month: '月', + day: '天', + hour: '小时', + minute: '分钟', + second: '秒', + ago: '前', + later: '后', + justNow: '刚刚', + soon: '马上', + template: '{num}{unit}{suffix}' + }, + en: { + year: 'year', + month: 'month', + day: 'day', + hour: 'hour', + minute: 'minute', + second: 'second', + ago: 'ago', + later: 'later', + justNow: 'just now', + soon: 'soon', + template: '{num} {unit} {suffix}' + } + } + const text = localeText[locale] || localeText.zh + let date = getDate(time) + let ms = date.getTime() - Date.now() + let absMs = Math.abs(ms) + if (absMs < threshold[0]) { + return ms < 0 ? text.justNow : text.soon + } + if (absMs >= threshold[1]) { + return formatDate(date, format) + } + let num + let unit + let suffix = text.later + if (ms < 0) { + suffix = text.ago + ms = -ms + } + const seconds = Math.floor((ms) / 1000) + const minutes = Math.floor(seconds / 60) + const hours = Math.floor(minutes / 60) + const days = Math.floor(hours / 24) + const months = Math.floor(days / 30) + const years = Math.floor(months / 12) + switch (true) { + case years > 0: + num = years + unit = text.year + break + case months > 0: + num = months + unit = text.month + break + case days > 0: + num = days + unit = text.day + break + case hours > 0: + num = hours + unit = text.hour + break + case minutes > 0: + num = minutes + unit = text.minute + break + default: + num = seconds + unit = text.second + break + } + + if (locale === 'en') { + if (num === 1) { + num = 'a' + } else { + unit += 's' + } + } + + return text.template.replace(/{\s*num\s*}/g, num + '').replace(/{\s*unit\s*}/g, unit).replace(/{\s*suffix\s*}/g, + suffix) +} diff --git a/uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.vue b/uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.vue new file mode 100644 index 0000000..c5ed030 --- /dev/null +++ b/uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.vue @@ -0,0 +1,88 @@ + + {{dateShow}} + + + + + diff --git a/uni_modules/uni-dateformat/package.json b/uni_modules/uni-dateformat/package.json new file mode 100644 index 0000000..786a670 --- /dev/null +++ b/uni_modules/uni-dateformat/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-dateformat", + "displayName": "uni-dateformat 日期格式化", + "version": "1.0.0", + "description": "日期格式化组件,可以将日期格式化为1分钟前、刚刚等形式", + "keywords": [ + "uni-ui", + "uniui", + "日期格式化", + "时间格式化", + "格式化时间", + "" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-dateformat/readme.md b/uni_modules/uni-dateformat/readme.md new file mode 100644 index 0000000..37ddb6e --- /dev/null +++ b/uni_modules/uni-dateformat/readme.md @@ -0,0 +1,11 @@ + + +### DateFormat 日期格式化 +> **组件名:uni-dateformat** +> 代码块: `uDateformat` + + +日期格式化组件。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-dateformat) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-swipe-action/changelog.md b/uni_modules/uni-swipe-action/changelog.md new file mode 100644 index 0000000..998e476 --- /dev/null +++ b/uni_modules/uni-swipe-action/changelog.md @@ -0,0 +1,58 @@ +## 1.3.16(2025-06-11) +- 修复 鸿蒙 next 浏览器上无法滑动的问题 +## 1.3.14(2025-06-09) +- 优化 更新示例项目 +## 1.3.13(2025-04-15) +- 修复 app 端 缺少leftOptions 或 rightOptions 时无法滑动的问题 +## 1.3.12(2025-04-14) +- 修复 由上一个兼容版本引发的 安卓运行报错且无法回弹的问题 +## 1.3.11(2025-04-08) +- 优化 兼容鸿蒙平台 +- 修复 WEB 平台控制台报错 +## 1.3.10(2024-01-17) +- 修复 点击按钮时,按钮会被点击穿透导致自动收缩的 bug(兼容阿里/百度/抖音小程序) +## 1.3.9(2024-01-17) +- 修复 点击按钮时,按钮会被点击穿透导致自动收缩的 bug +## 1.3.8(2023-04-13) +- 修复`uni-swipe-action`和`uni-swipe-action-item`不同时使用导致 closeOther 方法报错的 bug +## 1.3.7(2022-06-06) +- 修复 vue3 下使用组件不能正常运行的Bug +## 1.3.6(2022-05-31) +- 修复 h5端点击click触发两次的Bug +## 1.3.5(2022-05-23) +- 修复 isPC 找不到的Bug +## 1.3.4(2022-05-19) +- 修复 在 nvue 下 disabled 失效的bug +## 1.3.3(2022-03-31) +- 修复 按钮字体大小不能设置的bug +## 1.3.2(2022-03-16) +- 修复 h5和app端下报el错误的bug +## 1.3.1(2022-03-07) +- 修复 HBuilderX 1.4.X 版本中,h5和app端下报错的bug +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-swipe-action](https://uniapp.dcloud.io/component/uniui/uni-swipe-action) +## 1.2.4(2021-08-20) +- 优化 close-all 方法 +## 1.2.3(2021-08-20) +- 新增 close-all 方法,关闭所有已打开的组件 +## 1.2.2(2021-08-17) +- 新增 resize() 方法,在非微信小程序、h5、app-vue端出现不能滑动的问题的时候,重置组件 +- 修复 app 端偶尔出现类似 Page[x][-x,xx;-x,xx,x,x-x] 的问题 +- 优化 微信小程序、h5、app-vue 滑动逻辑,避免出现动态新增组件后不能滑动的问题 +## 1.2.1(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +- 修复 跨页面修改组件数据 ,导致不能滑动的问题 +## 1.1.10(2021-06-17) +- 修复 按钮点击执行两次的bug +## 1.1.9(2021-05-12) +- 新增 项目示例地址 +## 1.1.8(2021-03-26) +- 修复 微信小程序 nv_navigator is not defined 报错的bug +## 1.1.7(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 左侧滑动 +- 新增 插槽使用方式 +- 新增 threshold 属性,可以控制滑动缺省值 +- 优化 长列表滚动性能 +- 修复 滚动页面时触发组件滑动的Bug diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js new file mode 100644 index 0000000..707e432 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/bindingx.js @@ -0,0 +1,302 @@ +let bindIngXMixins = {} + +// #ifdef APP-NVUE +const BindingX = uni.requireNativePlugin('bindingx'); +const dom = uni.requireNativePlugin('dom'); +const animation = uni.requireNativePlugin('animation'); + +bindIngXMixins = { + data() { + return {} + }, + + watch: { + show(newVal) { + if (this.autoClose) return + if (this.stop) return + this.stop = true + if (newVal) { + this.open(newVal) + } else { + this.close() + } + }, + leftOptions() { + this.getSelectorQuery() + this.init() + }, + rightOptions(newVal) { + this.init() + } + }, + created() { + this.swipeaction = this.getSwipeAction() + if (this.swipeaction && Array.isArray(this.swipeaction.children)) { + this.swipeaction.children.push(this) + } + }, + mounted() { + this.box = this.getEl(this.$refs['selector-box--hock']) + this.selector = this.getEl(this.$refs['selector-content--hock']); + this.leftButton = this.getEl(this.$refs['selector-left-button--hock']); + this.rightButton = this.getEl(this.$refs['selector-right-button--hock']); + this.init() + }, + // beforeDestroy() { + // this.swipeaction.children.forEach((item, index) => { + // if (item === this) { + // this.swipeaction.children.splice(index, 1) + // } + // }) + // }, + methods: { + init() { + this.$nextTick(() => { + this.x = 0 + this.button = { + show: false + } + setTimeout(() => { + this.getSelectorQuery() + }, 200) + }) + }, + onClick(index, item, position) { + this.$emit('click', { + content: item, + index, + position + }) + }, + touchstart(e) { + // fix by mehaotian 禁止滑动 + if (this.disabled) return + // 每次只触发一次,避免多次监听造成闪烁 + if (this.stop) return + this.stop = true + if (this.autoClose && this.swipeaction) { + this.swipeaction.closeOther(this) + } + + const leftWidth = this.button.left.width + const rightWidth = this.button.right.width + let expression = this.range(this.x, -rightWidth, leftWidth) + let leftExpression = this.range(this.x - leftWidth, -leftWidth, 0) + let rightExpression = this.range(this.x + rightWidth, 0, rightWidth) + + this.eventpan = BindingX.bind({ + anchor: this.box, + eventType: 'pan', + props: [{ + element: this.selector, + property: 'transform.translateX', + expression + }, { + element: this.leftButton, + property: 'transform.translateX', + expression: leftExpression + }, { + element: this.rightButton, + property: 'transform.translateX', + expression: rightExpression + }, ] + }, (e) => { + // nope + if (e.state === 'end') { + this.x = e.deltaX + this.x; + this.isclick = true + this.bindTiming(e.deltaX) + } + }); + }, + touchend(e) { + if (this.isopen !== 'none' && !this.isclick) { + this.open('none') + } + }, + bindTiming(x) { + const left = this.x + const leftWidth = this.button.left.width + const rightWidth = this.button.right.width + const threshold = this.threshold + if (!this.isopen || this.isopen === 'none') { + if (left > threshold) { + this.open('left') + } else if (left < -threshold) { + this.open('right') + } else { + this.open('none') + } + } else { + if ((x > -leftWidth && x < 0) || x > rightWidth) { + if ((x > -threshold && x < 0) || (x - rightWidth > threshold)) { + this.open('left') + } else { + this.open('none') + } + } else { + if ((x < threshold && x > 0) || (x + leftWidth < -threshold)) { + this.open('right') + } else { + this.open('none') + } + } + } + }, + + /** + * 移动范围 + * @param {Object} num + * @param {Object} mix + * @param {Object} max + */ + range(num, mix, max) { + return `min(max(x+${num}, ${mix}), ${max})` + }, + + /** + * 开启swipe + */ + open(type) { + this.animation(type) + }, + + /** + * 关闭swipe + */ + close() { + this.animation('none') + }, + + /** + * 开启关闭动画 + * @param {Object} type + */ + animation(type) { + const time = 300 + const leftWidth = this.button.left.width + const rightWidth = this.button.right.width + if (this.eventpan && this.eventpan.token) { + BindingX.unbind({ + token: this.eventpan.token, + eventType: 'pan' + }) + } + + switch (type) { + case 'left': + Promise.all([ + this.move(this.selector, leftWidth), + this.move(this.leftButton, 0), + this.move(this.rightButton, rightWidth * 2) + ]).then(() => { + this.setEmit(leftWidth, type) + }) + break + case 'right': + Promise.all([ + this.move(this.selector, -rightWidth), + this.move(this.leftButton, -leftWidth * 2), + this.move(this.rightButton, 0) + ]).then(() => { + this.setEmit(-rightWidth, type) + }) + break + default: + Promise.all([ + this.move(this.selector, 0), + this.move(this.leftButton, -leftWidth), + this.move(this.rightButton, rightWidth) + ]).then(() => { + this.setEmit(0, type) + }) + + } + }, + setEmit(x, type) { + const leftWidth = this.button.left.width + const rightWidth = this.button.right.width + this.isopen = this.isopen || 'none' + this.stop = false + this.isclick = false + // 只有状态不一致才会返回结果 + if (this.isopen !== type && this.x !== x) { + if (type === 'left' && leftWidth > 0) { + this.$emit('change', 'left') + } + if (type === 'right' && rightWidth > 0) { + this.$emit('change', 'right') + } + if (type === 'none') { + this.$emit('change', 'none') + } + } + this.x = x + this.isopen = type + }, + move(ref, value) { + return new Promise((resolve, reject) => { + animation.transition(ref, { + styles: { + transform: `translateX(${value})`, + }, + duration: 150, //ms + timingFunction: 'linear', + needLayout: false, + delay: 0 //ms + }, function(res) { + resolve(res) + }) + }) + + }, + + /** + * 获取ref + * @param {Object} el + */ + getEl(el) { + return el.ref + }, + /** + * 获取节点信息 + */ + getSelectorQuery() { + Promise.all([ + this.getDom('left'), + this.getDom('right'), + ]).then((data) => { + let show = 'none' + if (this.autoClose) { + show = 'none' + } else { + show = this.show + } + + if (show === 'none') { + // this.close() + } else { + this.open(show) + } + + }) + + }, + getDom(str) { + return new Promise((resolve, reject) => { + dom.getComponentRect(this.$refs[`selector-${str}-button--hock`], (data) => { + if (data) { + this.button[str] = data.size + resolve(data) + } else { + reject() + } + }) + }) + } + } +} + +// #endif + +export default bindIngXMixins diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/isPC.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/isPC.js new file mode 100644 index 0000000..917cb48 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/isPC.js @@ -0,0 +1,12 @@ +export function isPC() { + var userAgentInfo = navigator.userAgent; + var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; + var flag = true; + for (let v = 0; v < Agents.length - 1; v++) { + if (userAgentInfo.indexOf(Agents[v]) > 0) { + flag = false; + break; + } + } + return flag; +} diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js new file mode 100644 index 0000000..35c796b --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpalipay.js @@ -0,0 +1,195 @@ +export default { + data() { + return { + x: 0, + transition: false, + width: 0, + viewWidth: 0, + swipeShow: 0 + } + }, + watch: { + show(newVal) { + if (this.autoClose) return + if (newVal && newVal !== 'none') { + this.transition = true + this.open(newVal) + } else { + this.close() + } + } + }, + created() { + this.swipeaction = this.getSwipeAction() + if (this.swipeaction && Array.isArray(this.swipeaction.children)) { + this.swipeaction.children.push(this) + } + }, + mounted() { + this.isopen = false + setTimeout(() => { + this.getQuerySelect() + }, 50) + }, + methods: { + appTouchStart(e) { + const { + clientX + } = e.changedTouches[0] + this.clientX = clientX + this.timestamp = new Date().getTime() + }, + appTouchEnd(e, index, item, position) { + const { + clientX + } = e.changedTouches[0] + // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 + let diff = Math.abs(this.clientX - clientX) + let time = (new Date().getTime()) - this.timestamp + if (diff < 40 && time < 300) { + this.$emit('click', { + content: item, + index, + position + }) + } + }, + /** + * 移动触发 + * @param {Object} e + */ + onChange(e) { + this.moveX = e.detail.x + this.isclose = false + }, + touchstart(e) { + this.transition = false + this.isclose = true + if (this.autoClose && this.swipeaction) { + this.swipeaction.closeOther(this) + } + }, + touchmove(e) {}, + touchend(e) { + // 0的位置什么都不执行 + if (this.isclose && this.isopen === 'none') return + if (this.isclose && this.isopen !== 'none') { + this.transition = true + this.close() + } else { + this.move(this.moveX + this.leftWidth) + } + }, + + /** + * 移动 + * @param {Object} moveX + */ + move(moveX) { + // 打开关闭的处理逻辑不太一样 + this.transition = true + // 未打开状态 + if (!this.isopen || this.isopen === 'none') { + if (moveX > this.threshold) { + this.open('left') + } else if (moveX < -this.threshold) { + this.open('right') + } else { + this.close() + } + } else { + if (moveX < 0 && moveX < this.rightWidth) { + const rightX = this.rightWidth + moveX + if (rightX < this.threshold) { + this.open('right') + } else { + this.close() + } + } else if (moveX > 0 && moveX < this.leftWidth) { + const leftX = this.leftWidth - moveX + if (leftX < this.threshold) { + this.open('left') + } else { + this.close() + } + } + + } + + }, + + /** + * 打开 + */ + open(type) { + this.x = this.moveX + this.animation(type) + }, + + /** + * 关闭 + */ + close() { + this.x = this.moveX + // TODO 解决 x 值不更新的问题,所以会多触发一次 nextTick ,待优化 + this.$nextTick(() => { + this.x = -this.leftWidth + if (this.isopen !== 'none') { + this.$emit('change', 'none') + } + this.isopen = 'none' + }) + }, + + /** + * 执行结束动画 + * @param {Object} type + */ + animation(type) { + this.$nextTick(() => { + if (type === 'left') { + this.x = 0 + } else { + this.x = -this.rightWidth - this.leftWidth + } + + if (this.isopen !== type) { + this.$emit('change', type) + } + this.isopen = type + }) + + }, + getSlide(x) {}, + getQuerySelect() { + const query = uni.createSelectorQuery().in(this); + query.selectAll('.movable-view--hock').boundingClientRect(data => { + this.leftWidth = data[1].width + this.rightWidth = data[2].width + this.width = data[0].width + this.viewWidth = this.width + this.rightWidth + this.leftWidth + if (this.leftWidth === 0) { + // TODO 疑似bug ,初始化的时候如果x 是0,会导致移动位置错误,所以让元素超出一点 + this.x = -0.1 + } else { + this.x = -this.leftWidth + } + this.moveX = this.x + this.$nextTick(() => { + this.swipeShow = 1 + }) + + if (!this.buttonWidth) { + this.disabledView = true + } + + if (this.autoClose) return + if (this.show !== 'none') { + this.transition = true + this.open(this.shows) + } + }).exec(); + + } + } +} diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js new file mode 100644 index 0000000..d389bce --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpother.js @@ -0,0 +1,260 @@ +let otherMixins = {} + +// #ifndef APP-PLUS|| MP-WEIXIN || H5 +const MIN_DISTANCE = 10; +otherMixins = { + data() { + // TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug + const elClass = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}` + return { + uniShow: false, + left: 0, + buttonShow: 'none', + ani: false, + moveLeft: '', + elClass + } + }, + watch: { + show(newVal) { + if (this.autoClose) return + this.openState(newVal) + }, + left() { + this.moveLeft = `translateX(${this.left}px)` + }, + buttonShow(newVal) { + if (this.autoClose) return + this.openState(newVal) + }, + leftOptions() { + this.init() + }, + rightOptions() { + this.init() + } + }, + mounted() { + this.swipeaction = this.getSwipeAction() + if (this.swipeaction && Array.isArray(this.swipeaction.children)) { + this.swipeaction.children.push(this) + } + this.init() + }, + methods: { + init() { + clearTimeout(this.timer) + this.timer = setTimeout(() => { + this.getSelectorQuery() + }, 100) + // 移动距离 + this.left = 0 + this.x = 0 + }, + + closeSwipe(e) { + if (this.autoClose && this.swipeaction) { + this.swipeaction.closeOther(this) + } + }, + appTouchStart(e) { + const { + clientX + } = e.changedTouches[0] + this.clientX = clientX + this.timestamp = new Date().getTime() + }, + appTouchEnd(e, index, item, position) { + const { + clientX + } = e.changedTouches[0] + // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 + let diff = Math.abs(this.clientX - clientX) + let time = (new Date().getTime()) - this.timestamp + if (diff < 40 && time < 300) { + this.$emit('click', { + content: item, + index, + position + }) + } + }, + touchstart(e) { + if (this.disabled) return + this.ani = false + this.x = this.left || 0 + this.stopTouchStart(e) + this.autoClose && this.closeSwipe() + }, + touchmove(e) { + if (this.disabled) return + // 是否可以滑动页面 + this.stopTouchMove(e); + if (this.direction !== 'horizontal') { + return; + } + this.move(this.x + this.deltaX) + return false + }, + touchend() { + if (this.disabled) return + this.moveDirection(this.left) + }, + /** + * 设置移动距离 + * @param {Object} value + */ + move(value) { + value = value || 0 + const leftWidth = this.leftWidth + const rightWidth = this.rightWidth + // 获取可滑动范围 + this.left = this.range(value, -rightWidth, leftWidth); + }, + + /** + * 获取范围 + * @param {Object} num + * @param {Object} min + * @param {Object} max + */ + range(num, min, max) { + return Math.min(Math.max(num, min), max); + }, + /** + * 移动方向判断 + * @param {Object} left + * @param {Object} value + */ + moveDirection(left) { + const threshold = this.threshold + const isopen = this.isopen || 'none' + const leftWidth = this.leftWidth + const rightWidth = this.rightWidth + if (this.deltaX === 0) { + this.openState('none') + return + } + if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > + 0 && rightWidth + + left < threshold)) { + // right + this.openState('right') + } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > + 0 && + leftWidth - left < threshold)) { + // left + this.openState('left') + } else { + // default + this.openState('none') + } + }, + + /** + * 开启状态 + * @param {Boolean} type + */ + openState(type) { + const leftWidth = this.leftWidth + const rightWidth = this.rightWidth + let left = '' + this.isopen = this.isopen ? this.isopen : 'none' + switch (type) { + case "left": + left = leftWidth + break + case "right": + left = -rightWidth + break + default: + left = 0 + } + + + if (this.isopen !== type) { + this.throttle = true + this.$emit('change', type) + } + + this.isopen = type + // 添加动画类 + this.ani = true + this.$nextTick(() => { + this.move(left) + }) + // 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的 + }, + close() { + this.openState('none') + }, + getDirection(x, y) { + if (x > y && x > MIN_DISTANCE) { + return 'horizontal'; + } + if (y > x && y > MIN_DISTANCE) { + return 'vertical'; + } + return ''; + }, + + /** + * 重置滑动状态 + * @param {Object} event + */ + resetTouchStatus() { + this.direction = ''; + this.deltaX = 0; + this.deltaY = 0; + this.offsetX = 0; + this.offsetY = 0; + }, + + /** + * 设置滑动开始位置 + * @param {Object} event + */ + stopTouchStart(event) { + this.resetTouchStatus(); + const touch = event.touches[0]; + this.startX = touch.clientX; + this.startY = touch.clientY; + }, + + /** + * 滑动中,是否禁止打开 + * @param {Object} event + */ + stopTouchMove(event) { + const touch = event.touches[0]; + this.deltaX = touch.clientX - this.startX; + this.deltaY = touch.clientY - this.startY; + this.offsetX = Math.abs(this.deltaX); + this.offsetY = Math.abs(this.deltaY); + this.direction = this.direction || this.getDirection(this.offsetX, this.offsetY); + }, + + getSelectorQuery() { + const views = uni.createSelectorQuery().in(this) + views + .selectAll('.' + this.elClass) + .boundingClientRect(data => { + if (data.length === 0) return + let show = 'none' + if (this.autoClose) { + show = 'none' + } else { + show = this.show + } + this.leftWidth = data[0].width || 0 + this.rightWidth = data[1].width || 0 + this.buttonShow = show + }) + .exec() + } + } +} + +// #endif + +export default otherMixins diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js new file mode 100644 index 0000000..0b5de88 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/mpwxs.js @@ -0,0 +1,84 @@ +let mpMixins = {} +let is_pc = null +// #ifdef H5 +import { + isPC +} from "./isPC" +is_pc = isPC() +// #endif +// #ifdef APP-VUE || APP-HARMONY || MP-WEIXIN || H5 + +mpMixins = { + data() { + return { + is_show: 'none' + } + }, + watch: { + show(newVal) { + this.is_show = this.show + } + }, + created() { + this.swipeaction = this.getSwipeAction() + if (this.swipeaction && Array.isArray(this.swipeaction.children)) { + this.swipeaction.children.push(this) + } + }, + mounted() { + this.is_show = this.show + }, + methods: { + // wxs 中调用 + closeSwipe(e) { + if (this.autoClose && this.swipeaction) { + this.swipeaction.closeOther(this) + } + }, + + change(e) { + this.$emit('change', e.open) + if (this.is_show !== e.open) { + this.is_show = e.open + } + }, + + appTouchStart(e) { + if (is_pc) return + const { + clientX + } = e.changedTouches[0] + this.clientX = clientX + this.timestamp = new Date().getTime() + }, + appTouchEnd(e, index, item, position) { + if (is_pc) return + const { + clientX + } = e.changedTouches[0] + // fixed by xxxx 模拟点击事件,解决 ios 13 点击区域错位的问题 + let diff = Math.abs(this.clientX - clientX) + let time = (new Date().getTime()) - this.timestamp + if (diff < 40 && time < 300) { + this.$emit('click', { + content: item, + index, + position + }) + } + }, + onClickForPC(index, item, position) { + if (!is_pc) return + // #ifdef H5 + this.$emit('click', { + content: item, + index, + position + }) + // #endif + } + } +} + +// #endif +export default mpMixins diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js new file mode 100644 index 0000000..218cb41 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/render.js @@ -0,0 +1,277 @@ +const MIN_DISTANCE = 10; +export default { + showWatch(newVal, oldVal, ownerInstance, instance, self) { + var state = self.state || {} + var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el + if (!$el) return + this.getDom(instance, ownerInstance, self) + if (newVal && newVal !== 'none') { + this.openState(newVal, instance, ownerInstance, self) + return + } + + if (state.left) { + this.openState('none', instance, ownerInstance, self) + } + this.resetTouchStatus(instance, self) + }, + + /** + * 开始触摸操作 + * @param {Object} e + * @param {Object} ins + */ + touchstart(e, ownerInstance, self) { + let instance = e.instance; + let disabled = instance.getDataset().disabled + let state = self.state || {}; + this.getDom(instance, ownerInstance, self) + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = this.getDisabledType(disabled) + if (disabled) return + // 开始触摸时移除动画类 + instance.requestAnimationFrame(function() { + instance.removeClass('ani'); + ownerInstance.callMethod('closeSwipe'); + }) + + // 记录上次的位置 + state.x = state.left || 0 + // 计算滑动开始位置 + this.stopTouchStart(e, ownerInstance, self) + }, + + /** + * 开始滑动操作 + * @param {Object} e + * @param {Object} ownerInstance + */ + touchmove(e, ownerInstance, self) { + let instance = e.instance; + // 删除之后已经那不到实例了 + if (!instance) return; + let disabled = instance.getDataset().disabled + let state = self.state || {} + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = this.getDisabledType(disabled) + if (disabled) return + // 是否可以滑动页面 + this.stopTouchMove(e, self); + if (state.direction !== 'horizontal') { + return; + } + if (e.preventDefault) { + // 阻止页面滚动 + e.preventDefault() + } + let x = state.x + state.deltaX + this.move(x, instance, ownerInstance, self) + }, + + /** + * 结束触摸操作 + * @param {Object} e + * @param {Object} ownerInstance + */ + touchend(e, ownerInstance, self) { + let instance = e.instance; + let disabled = instance.getDataset().disabled + let state = self.state || {} + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = this.getDisabledType(disabled) + + if (disabled) return + // 滑动过程中触摸结束,通过阙值判断是开启还是关闭 + // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13 + this.moveDirection(state.left, instance, ownerInstance, self) + + }, + + /** + * 设置移动距离 + * @param {Object} value + * @param {Object} instance + * @param {Object} ownerInstance + */ + move(value, instance, ownerInstance, self) { + value = value || 0 + let state = self.state || {} + let leftWidth = state.leftWidth + let rightWidth = state.rightWidth + // 获取可滑动范围 + state.left = this.range(value, -rightWidth, leftWidth); + instance.requestAnimationFrame(function() { + instance.setStyle({ + transform: 'translateX(' + state.left + 'px)', + '-webkit-transform': 'translateX(' + state.left + 'px)' + }) + }) + + }, + + /** + * 获取元素信息 + * @param {Object} instance + * @param {Object} ownerInstance + */ + getDom(instance, ownerInstance, self) { + var state = self.state || {} + var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el + var leftDom = $el.querySelector('.button-group--left') + var rightDom = $el.querySelector('.button-group--right') + if (leftDom && leftDom.offsetWidth) { + state.leftWidth = leftDom.offsetWidth || 0 + } else { + state.leftWidth = 0 + } + if (rightDom && rightDom.offsetWidth) { + state.rightWidth = rightDom.offsetWidth || 0 + } else { + state.rightWidth = 0 + } + state.threshold = instance.getDataset().threshold + }, + + getDisabledType(value) { + return (typeof(value) === 'string' ? JSON.parse(value) : value) || false; + }, + + /** + * 获取范围 + * @param {Object} num + * @param {Object} min + * @param {Object} max + */ + range(num, min, max) { + return Math.min(Math.max(num, min), max); + }, + + + /** + * 移动方向判断 + * @param {Object} left + * @param {Object} value + * @param {Object} ownerInstance + * @param {Object} ins + */ + moveDirection(left, ins, ownerInstance, self) { + var state = self.state || {} + var threshold = state.threshold + var position = state.position + var isopen = state.isopen || 'none' + var leftWidth = state.leftWidth + var rightWidth = state.rightWidth + if (state.deltaX === 0) { + this.openState('none', ins, ownerInstance, self) + return + } + if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && + rightWidth + + left < threshold)) { + // right + this.openState('right', ins, ownerInstance, self) + } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && + leftWidth - left < threshold)) { + // left + this.openState('left', ins, ownerInstance, self) + } else { + // default + this.openState('none', ins, ownerInstance, self) + } + }, + + + /** + * 开启状态 + * @param {Boolean} type + * @param {Object} ins + * @param {Object} ownerInstance + */ + openState(type, ins, ownerInstance, self) { + let state = self.state || {} + let leftWidth = state.leftWidth + let rightWidth = state.rightWidth + let left = '' + state.isopen = state.isopen ? state.isopen : 'none' + switch (type) { + case "left": + left = leftWidth + break + case "right": + left = -rightWidth + break + default: + left = 0 + } + + // && !state.throttle + + if (state.isopen !== type) { + state.throttle = true + ownerInstance.callMethod('change', { + open: type + }) + + } + + state.isopen = type + // 添加动画类 + ins.requestAnimationFrame(() => { + ins.addClass('ani'); + this.move(left, ins, ownerInstance, self) + }) + }, + + + getDirection(x, y) { + if (x > y && x > MIN_DISTANCE) { + return 'horizontal'; + } + if (y > x && y > MIN_DISTANCE) { + return 'vertical'; + } + return ''; + }, + + /** + * 重置滑动状态 + * @param {Object} event + */ + resetTouchStatus(instance, self) { + let state = self.state || {}; + state.direction = ''; + state.deltaX = 0; + state.deltaY = 0; + state.offsetX = 0; + state.offsetY = 0; + }, + + /** + * 设置滑动开始位置 + * @param {Object} event + */ + stopTouchStart(event, ownerInstance, self) { + let instance = event.instance; + let state = self.state || {} + this.resetTouchStatus(instance, self); + var touch = event.touches[0]; + state.startX = touch.clientX; + state.startY = touch.clientY; + }, + + /** + * 滑动中,是否禁止打开 + * @param {Object} event + */ + stopTouchMove(event, self) { + let instance = event.instance; + let state = self.state || {}; + let touch = event.touches[0]; + + state.deltaX = touch.clientX - state.startX; + state.deltaY = touch.clientY - state.startY; + state.offsetY = Math.abs(state.deltaY); + state.offsetX = Math.abs(state.deltaX); + state.direction = state.direction || this.getDirection(state.offsetX, state.offsetY); + } +} diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue new file mode 100644 index 0000000..0096f10 --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue @@ -0,0 +1,348 @@ + + + + + + + + + + + + + + + {{ item.text }} + + + + + + + + + {{ item.text }} + + + + + + + + + + + + + + {{ item.text }} + + + + + + + {{ item.text }} + + + + + + + + + + + + + + + {{ item.text }} + + + + + + + {{ item.text }} + + + + + + + + + + + + + diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action-item/wx.wxs b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/wx.wxs new file mode 100644 index 0000000..5e5e1ee --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action-item/wx.wxs @@ -0,0 +1,349 @@ +var MIN_DISTANCE = 10; + +/** + * 判断当前是否为H5、app-vue + */ +var IS_HTML5 = false +if (typeof window === 'object') IS_HTML5 = true + +/** + * 监听页面内值的变化,主要用于动态开关swipe-action + * @param {Object} newValue + * @param {Object} oldValue + * @param {Object} ownerInstance + * @param {Object} instance + */ +function showWatch(newVal, oldVal, ownerInstance, instance) { + var state = instance.getState() + getDom(instance, ownerInstance) + if (newVal && newVal !== 'none') { + openState(newVal, instance, ownerInstance) + return + } + + if (state.left) { + openState('none', instance, ownerInstance) + } + resetTouchStatus(instance) +} + +/** + * 开始触摸操作 + * @param {Object} e + * @param {Object} ins + */ +function touchstart(e, ownerInstance) { + var instance = e.instance; + var disabled = instance.getDataset().disabled + var state = instance.getState(); + getDom(instance, ownerInstance) + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false; + if (disabled) return + // 开始触摸时移除动画类 + instance.requestAnimationFrame(function() { + instance.removeClass('ani'); + ownerInstance.callMethod('closeSwipe'); + }) + + // 记录上次的位置 + state.x = state.left || 0 + // 计算滑动开始位置 + stopTouchStart(e, ownerInstance) +} + +/** + * 开始滑动操作 + * @param {Object} e + * @param {Object} ownerInstance + */ +function touchmove(e, ownerInstance) { + var instance = e.instance; + var disabled = instance.getDataset().disabled + var state = instance.getState() + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false; + if (disabled) return + // 是否可以滑动页面 + stopTouchMove(e); + if (state.direction !== 'horizontal') { + return; + } + + if (e.preventDefault) { + // 阻止页面滚动 + e.preventDefault() + } + + move(state.x + state.deltaX, instance, ownerInstance) +} + +/** + * 结束触摸操作 + * @param {Object} e + * @param {Object} ownerInstance + */ +function touchend(e, ownerInstance) { + var instance = e.instance; + var disabled = instance.getDataset().disabled + var state = instance.getState() + // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复 + disabled = (typeof(disabled) === 'string' ? JSON.parse(disabled) : disabled) || false; + + if (disabled) return + // 滑动过程中触摸结束,通过阙值判断是开启还是关闭 + // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13 + moveDirection(state.left, instance, ownerInstance) + +} + +/** + * 设置移动距离 + * @param {Object} value + * @param {Object} instance + * @param {Object} ownerInstance + */ +function move(value, instance, ownerInstance) { + value = value || 0 + var state = instance.getState() + var leftWidth = state.leftWidth + var rightWidth = state.rightWidth + // 获取可滑动范围 + state.left = range(value, -rightWidth, leftWidth); + instance.requestAnimationFrame(function() { + instance.setStyle({ + transform: 'translateX(' + state.left + 'px)', + '-webkit-transform': 'translateX(' + state.left + 'px)' + }) + }) + +} + +/** + * 获取元素信息 + * @param {Object} instance + * @param {Object} ownerInstance + */ +function getDom(instance, ownerInstance) { + var state = instance.getState() + var leftDom = ownerInstance.selectComponent('.button-group--left') + var rightDom = ownerInstance.selectComponent('.button-group--right') + var leftStyles = { + width: 0 + } + var rightStyles = { + width: 0 + } + + if (leftDom) { + leftStyles = leftDom.getBoundingClientRect() + } + + if (rightDom) { + rightStyles = rightDom.getBoundingClientRect() + } + state.leftWidth = leftStyles.width || 0 + state.rightWidth = rightStyles.width || 0 + state.threshold = instance.getDataset().threshold +} + +/** + * 获取范围 + * @param {Object} num + * @param {Object} min + * @param {Object} max + */ +function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} + + +/** + * 移动方向判断 + * @param {Object} left + * @param {Object} value + * @param {Object} ownerInstance + * @param {Object} ins + */ +function moveDirection(left, ins, ownerInstance) { + var state = ins.getState() + var threshold = state.threshold + var position = state.position + var isopen = state.isopen || 'none' + var leftWidth = state.leftWidth + var rightWidth = state.rightWidth + if (state.deltaX === 0) { + openState('none', ins, ownerInstance) + return + } + if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && + rightWidth + + left < threshold)) { + // right + openState('right', ins, ownerInstance) + } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && + leftWidth - left < threshold)) { + // left + openState('left', ins, ownerInstance) + } else { + // default + openState('none', ins, ownerInstance) + } +} + + +/** + * 开启状态 + * @param {Boolean} type + * @param {Object} ins + * @param {Object} ownerInstance + */ +function openState(type, ins, ownerInstance) { + var state = ins.getState() + var leftWidth = state.leftWidth + var rightWidth = state.rightWidth + var left = '' + state.isopen = state.isopen ? state.isopen : 'none' + switch (type) { + case "left": + left = leftWidth + break + case "right": + left = -rightWidth + break + default: + left = 0 + } + + // && !state.throttle + + if (state.isopen !== type) { + state.throttle = true + ownerInstance.callMethod('change', { + open: type + }) + + } + + state.isopen = type + // 添加动画类 + ins.requestAnimationFrame(function() { + ins.addClass('ani'); + move(left, ins, ownerInstance) + }) + // 设置最终移动位置,理论上只要进入到这个函数,肯定是要打开的 +} + + +function getDirection(x, y) { + if (x > y && x > MIN_DISTANCE) { + return 'horizontal'; + } + if (y > x && y > MIN_DISTANCE) { + return 'vertical'; + } + return ''; +} + +/** + * 重置滑动状态 + * @param {Object} event + */ +function resetTouchStatus(instance) { + var state = instance.getState(); + state.direction = ''; + state.deltaX = 0; + state.deltaY = 0; + state.offsetX = 0; + state.offsetY = 0; +} + +/** + * 设置滑动开始位置 + * @param {Object} event + */ +function stopTouchStart(event) { + var instance = event.instance; + var state = instance.getState(); + resetTouchStatus(instance); + var touch = event.touches[0]; + if (IS_HTML5 && isPC()) { + touch = event; + } + state.startX = touch.clientX; + state.startY = touch.clientY; +} + +/** + * 滑动中,是否禁止打开 + * @param {Object} event + */ +function stopTouchMove(event) { + var instance = event.instance; + var state = instance.getState(); + var touch = event.touches[0]; + if (IS_HTML5 && isPC()) { + touch = event; + } + state.deltaX = touch.clientX - state.startX; + state.deltaY = touch.clientY - state.startY; + state.offsetY = Math.abs(state.deltaY); + state.offsetX = Math.abs(state.deltaX); + state.direction = state.direction || getDirection(state.offsetX, state.offsetY); +} + +function isPC() { + var userAgentInfo = navigator.userAgent; + var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; + var flag = true; + for (var v = 0; v < Agents.length - 1; v++) { + if (userAgentInfo.indexOf(Agents[v]) > 0) { + flag = false; + break; + } + } + if(userAgentInfo.indexOf('Phone') > 0 && userAgentInfo.indexOf('Harmony') > 0){ + flag = false; + } + return flag; +} + +var movable = false + +function mousedown(e, ins) { + if (!IS_HTML5) return + if (!isPC()) return + touchstart(e, ins) + movable = true +} + +function mousemove(e, ins) { + if (!IS_HTML5) return + if (!isPC()) return + if (!movable) return + touchmove(e, ins) +} + +function mouseup(e, ins) { + if (!IS_HTML5) return + if (!isPC()) return + touchend(e, ins) + movable = false +} + +function mouseleave(e, ins) { + if (!IS_HTML5) return + if (!isPC()) return + movable = false +} + +module.exports = { + showWatch: showWatch, + touchstart: touchstart, + touchmove: touchmove, + touchend: touchend, + mousedown: mousedown, + mousemove: mousemove, + mouseup: mouseup, + mouseleave: mouseleave +} diff --git a/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue b/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue new file mode 100644 index 0000000..9b32b3d --- /dev/null +++ b/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue @@ -0,0 +1,60 @@ + + + + + + + + + diff --git a/uni_modules/uni-swipe-action/package.json b/uni_modules/uni-swipe-action/package.json new file mode 100644 index 0000000..fb1df50 --- /dev/null +++ b/uni_modules/uni-swipe-action/package.json @@ -0,0 +1,112 @@ +{ + "id": "uni-swipe-action", + "displayName": "uni-swipe-action 滑动操作", + "version": "1.3.16", + "description": "SwipeAction 滑动操作操作组件", + "keywords": [ + "", + "uni-ui", + "uniui", + "滑动删除", + "侧滑删除" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "", + "uni-app": "^4.27", + "uni-app-x": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue", + "darkmode": "x", + "i18n": "x", + "widescreen": "x" + }, + "uni_modules": { + "dependencies": [ + "uni-scss" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "x", + "aliyun": "x", + "alipay": "x" + }, + "client": { + "uni-app": { + "vue": { + "vue2": { + "extVersion": "1.3.14", + "minVersion": "" + }, + "vue3": { + "extVersion": "1.3.14", + "minVersion": "" + } + }, + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "vue": "-", + "nvue": "-", + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-", + "alipay": "-", + "toutiao": "-", + "baidu": "-", + "kuaishou": "-", + "jd": "-", + "harmony": "-", + "qq": "-", + "lark": "-" + }, + "quickapp": { + "huawei": "-", + "union": "-" + } + }, + "uni-app-x": { + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-" + } + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-swipe-action/readme.md b/uni_modules/uni-swipe-action/readme.md new file mode 100644 index 0000000..93a5cac --- /dev/null +++ b/uni_modules/uni-swipe-action/readme.md @@ -0,0 +1,11 @@ + + +## SwipeAction 滑动操作 +> **组件名:uni-swipe-action** +> 代码块: `uSwipeAction`、`uSwipeActionItem` + + +通过滑动触发选项的容器 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-swipe-action) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/utilsRc/auth.js b/utilsRc/auth.js new file mode 100644 index 0000000..1f5bb72 --- /dev/null +++ b/utilsRc/auth.js @@ -0,0 +1,19 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2023-07-27 15:55:08 + * @LastEditors: lip + */ +const TokenKey = 'App-Token' + +export function getToken() { + return uni.getStorageSync(TokenKey) +} + +export function setToken(token) { + return uni.setStorageSync(TokenKey, token) +} + +export function removeToken() { + return uni.removeStorageSync(TokenKey) +} diff --git a/utilsRc/common.js b/utilsRc/common.js new file mode 100644 index 0000000..9d635c5 --- /dev/null +++ b/utilsRc/common.js @@ -0,0 +1,248 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2023-07-27 15:56:06 + * @LastEditors: shirlwang + */ +import { + getPersonBase +} from '@/apiRc/person'; +import store from '@/utilsRc/store'; +import tab from '@/utilsRc/plugins/tab.js' +/** + * 显示消息提示框 + * @param content 提示的标题 + */ +export function toast(content) { + uni.showToast({ + icon: 'none', + title: content + }) +} + +/** + * 显示模态弹窗 + * @param content 提示的标题 + */ +export function showConfirm(content, cancelText, confirmText, showCancel) { + return new Promise((resolve, reject) => { + uni.showModal({ + title: '提示', + content: content, + cancelText: cancelText || '取消', + confirmText: confirmText || '确定', + showCancel: showCancel === false ? false : true, + success: function(res) { + resolve(res) + } + }) + }) +} +// 修改后的 checkPersonBase 方法 +export function checkPersonBase() { + return new Promise((resolve) => { + const roles = store.getters.roles; + const userId = store.getters.userId; + const isRole = (role) => roles.includes(role); + + if (isRole('qunzhong')) { + getPersonBase(userId).then(resp => { + const shouldGoToPersonInfo = resp.data.auditStatus === '0'; + if (shouldGoToPersonInfo) { + uni.showModal({ + title: '提示', + content: '您的个人信息尚未维护,请前往维护个人信息。', + confirmText: '去维护', + cancelText: '取消', + success: function(res) { + if (res.confirm) { + tab.navigateTo('/pages/personInfo/index'); + } + resolve(false); // 需要维护,返回 false + } + }); + } else { + resolve(true); // 不需要维护,返回 true + } + }); + } else { + resolve(true); // 非群众角色直接放行 + } + }); +} +/** + * 参数处理 + * @param params 参数 + */ +export function tansParams(params) { + let result = '' + for (const propName of Object.keys(params)) { + const value = params[propName] + var part = encodeURIComponent(propName) + "=" + if (value !== null && value !== "" && typeof(value) !== "undefined") { + if (typeof value === 'object') { + for (const key of Object.keys(value)) { + if (value[key] !== null && value[key] !== "" && typeof(value[key]) !== 'undefined') { + let params = propName + '[' + key + ']' + var subPart = encodeURIComponent(params) + "=" + result += subPart + encodeURIComponent(value[key]) + "&" + } + } + } else { + result += part + encodeURIComponent(value) + "&" + } + } + } + return result +} +/** + * 姓名、手机、邮箱、身份证脱敏 + * @param str 姓名或手机或邮箱或身份证 + * @param type 数据类型 + */ +export function publicEncrypt(str, type) { + if (!str) { + return '' + } else if (type == 'name') { + return str.substr(0, 1) + '*' + } else if (type == 'idCard') { + return str.replace(/^(.{6})(?:\d+)(.{4})$/, '$1********$2') + } else if (type == 'phone') { + return str.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') + } else if (type == 'email') { + let count, emailArr, emailFront, emailBack; + emailArr = str.split('@'); + emailFront = emailArr[0]; + count = emailFront.length / 2; + emailFront = emailFront.substring(0, emailFront.length - count); + emailBack = emailArr[1]; + return emailFront + '***@' + emailBack; + } +} + + +/** + * 根据value值筛选对应的label + * @param {Array} options - 原数组 + * @param {string | Number} value - 表示 + * @returns {string} - 返回后的汉字 + */ +export function getLabelByValue(options = [], value, valueKey = 'value', labelKey = 'label') { + for (let i = 0; i < options.length; i++) { + // 动态使用传入的 valueKey 和 labelKey + if (options[i][valueKey] === value) { + return options[i][labelKey]; + } + } + return null; +} +/** + * 将数组转换为字符串 + * @param {Array} arr - 要转换的数组 + * @param {string} delimiter - 用于连接数组元素的分隔符,默认为逗号 + * @returns {string} - 转换后的字符串 + */ +export function arrayToString(arr, delimiter = ',') { + return arr.join(delimiter); +} + +/* 延时函数 */ +export function delay(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +/* 获取当前年月日 时分秒 */ +export function getCurrentDate() { + const date = new Date(); + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1 + const day = String(date.getDate()).padStart(2, '0'); // 使用padStart补零 + const hours = String(date.getHours()).padStart(2, '0'); // 补零 + const minutes = String(date.getMinutes()).padStart(2, '0'); // 补零 + const seconds = String(date.getSeconds()).padStart(2, '0'); // 补零 + + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; +} + + +export function processFileUrl(fileUrl) { + let fileList = []; + if (typeof fileUrl === 'string' && fileUrl) { + // 如果 fileUrl 是一个字符串,则按照逗号分割成数组 + const urls = fileUrl.split(',').map(url => url.trim()); // 去除每个 URL 前后的空白字符 + fileList = urls.map(url => ({ + url, + success: 'success', + name: 'fileUrl' + })); + } + return fileList; +} + +// 密码强校验 +export function isPasswordComplex(password) { + // 长度在8位以上,并且包含大小写字母、数字和特殊符号 + return /^(?=.*[A-Za-z])(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@#$%^&*!])[A-Za-z\d@#$%^&*!]{8,}$/.test(password); +} + +// 手机号码校验 +export function isPhoneNumberValid(phoneNumber) { + // 匹配国内常见的手机号格式 + return /^1[3-9]\d{9}$/.test(phoneNumber); +} + + +// 身份证校验函数 +export function isValidIdCard (idCard) { + if (typeof idCard !== 'string') { + return false; + } + + // 定义省份代码 + const provinceCodes = { + 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", + 21: "辽宁", 22: "吉林", 23: "黑龙江", + 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", + 41: "河南", 42: "湖北", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", + 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏", + 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", + 71: "台湾", 81: "香港", 82: "澳门", 91: "国外" + }; + + // 检查长度 + if (!/^\d{17}(\d|X|x)$/.test(idCard)) { + return false; + } + + // 验证省份代码 + const provinceCode = idCard.substring(0, 2); + if (!provinceCodes[provinceCode]) { + return false; + } + // 验证出生日期 + const birthDate = idCard.substring(6, 14); + const birthYear = parseInt(birthDate.substring(0, 4), 10); + const birthMonth = parseInt(birthDate.substring(4, 6), 10); + const birthDay = parseInt(birthDate.substring(6, 8), 10); + const birthDateObject = new Date(birthYear, birthMonth - 1, birthDay); + + if ( + birthDateObject.getFullYear() !== birthYear || + birthDateObject.getMonth() + 1 !== birthMonth || + birthDateObject.getDate() !== birthDay + ) { + return false; + } + // 验证校验码 + const weightFactors = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; + const checkCodes = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']; + + const sum = idCard + .substring(0, 17) + .split('') + .reduce((acc, num, index) => acc + parseInt(num, 10) * weightFactors[index], 0); + + const checkCode = checkCodes[sum % 11]; + return checkCode === idCard[17].toUpperCase(); +}; + diff --git a/utilsRc/config.js b/utilsRc/config.js new file mode 100644 index 0000000..1de7816 --- /dev/null +++ b/utilsRc/config.js @@ -0,0 +1,23 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2022-12-28 13:59:09 + * @LastEditors: shirlwang + */ +// 应用全局配置 +let exports = { + baseUrl: 'http://10.160.0.5:8907', // 正式环境在济南人才上部署(不要轻易连接) + // baseUrl: 'http://172.20.0.177:8903', // 正式环境在济南人才上部署(不要轻易连接) + + // 应用信息 + appInfo: { + // 应用名称 + name: "泉就业H5", + // 应用版本 + version: "1.1.0", + // 应用logo + logo: "/static/logo.png", + } + } + +export default exports \ No newline at end of file diff --git a/utilsRc/constant.js b/utilsRc/constant.js new file mode 100644 index 0000000..5fadd14 --- /dev/null +++ b/utilsRc/constant.js @@ -0,0 +1,19 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2023-07-27 15:53:48 + * @LastEditors: lip + */ +const constant = { + avatar: 'vuex_avatar', + name: 'vuex_name', + roles: 'vuex_roles', + permissions: 'vuex_permissions', + type: 'vuex_type', + phonenumber: 'vuex_phonenumber', + nick: 'vuex_nick', + userId: 'vuex_userId', + handlerData: 'vuex_handlerData', + } + + export default constant diff --git a/utilsRc/errorCode.js b/utilsRc/errorCode.js new file mode 100644 index 0000000..8849d23 --- /dev/null +++ b/utilsRc/errorCode.js @@ -0,0 +1,13 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2023-07-27 15:56:30 + * @LastEditors: lip + */ +export default { + '401': '您的登录状态已过期,请重新登录', + '403': '当前操作没有权限', + '404': '访问资源不存在', + 'default': '系统未知错误,请反馈给管理员' + } + \ No newline at end of file diff --git a/utilsRc/plugins/auth.js b/utilsRc/plugins/auth.js new file mode 100644 index 0000000..57ac0a8 --- /dev/null +++ b/utilsRc/plugins/auth.js @@ -0,0 +1,60 @@ +import store from '@/store' + +function authPermission(permission) { + const all_permission = "*:*:*" + const permissions = store.getters && store.getters.permissions + if (permission && permission.length > 0) { + return permissions.some(v => { + return all_permission === v || v === permission + }) + } else { + return false + } +} + +function authRole(role) { + const super_admin = "shequn" + const roles = store.getters && store.getters.roles + if (role && role.length > 0) { + return roles.some(v => { + return super_admin === v || v === role + }) + } else { + return false + } +} + +export default { + // 验证用户是否具备某权限 + hasPermi(permission) { + return authPermission(permission) + }, + // 验证用户是否含有指定权限,只需包含其中一个 + hasPermiOr(permissions) { + return permissions.some(item => { + return authPermission(item) + }) + }, + // 验证用户是否含有指定权限,必须全部拥有 + hasPermiAnd(permissions) { + return permissions.every(item => { + return authPermission(item) + }) + }, + // 验证用户是否具备某角色 + hasRole(role) { + return authRole(role) + }, + // 验证用户是否含有指定角色,只需包含其中一个 + hasRoleOr(roles) { + return roles.some(item => { + return authRole(item) + }) + }, + // 验证用户是否含有指定角色,必须全部拥有 + hasRoleAnd(roles) { + return roles.every(item => { + return authRole(item) + }) + } +} diff --git a/utilsRc/plugins/index.js b/utilsRc/plugins/index.js new file mode 100644 index 0000000..efbae15 --- /dev/null +++ b/utilsRc/plugins/index.js @@ -0,0 +1,14 @@ +import tab from './tab' +import auth from './auth' +import modal from './modal' + +export default { + install(Vue) { + // 页签操作 + Vue.prototype.$tab = tab + // 认证对象 + Vue.prototype.$auth = auth + // 模态框对象 + Vue.prototype.$modal = modal + } +} diff --git a/utilsRc/plugins/loadingPlugin.js b/utilsRc/plugins/loadingPlugin.js new file mode 100644 index 0000000..c20d9b6 --- /dev/null +++ b/utilsRc/plugins/loadingPlugin.js @@ -0,0 +1,50 @@ +import ULoadingPage from 'uview-ui/components/u-loading-page/u-loading-page'; // 确保正确引入组件 + +export default { + install(Vue) { + // 注册 u-loading-page 组件为全局组件 + Vue.component('u-loading-page', ULoadingPage); + + // 用于存储全局的 loading 组件实例 + let loadingInstance = null; + + // 创建一个全局的显示 loading 的方法 + Vue.prototype.$showLoading = function () { + // 如果没有创建过实例,则创建一个 + if (!loadingInstance) { + const LoadingConstructor = Vue.extend({ + data() { + return { + loading: true, // 控制 loading 显示的状态 + }; + }, + render(h) { + return h('u-loading-page', { + props: { + loading: this.loading, + loadingText: '', + loadingColor: "#000", + iconSize: '58rpx', + }, + style: { + zIndex: '200', + opacity: 0.7 + } + }); + } + }); + loadingInstance = new LoadingConstructor(); + loadingInstance.$mount(); // 手动挂载实例 + document.body.appendChild(loadingInstance.$el); // 将组件挂载到 body + } + loadingInstance.loading = true; // 显示 loading + }; + + // 创建一个全局的隐藏 loading 的方法 + Vue.prototype.$hideLoading = function () { + if (loadingInstance) { + loadingInstance.loading = false; // 隐藏 loading + } + }; + }, +}; diff --git a/utilsRc/plugins/modal.js b/utilsRc/plugins/modal.js new file mode 100644 index 0000000..87960fd --- /dev/null +++ b/utilsRc/plugins/modal.js @@ -0,0 +1,74 @@ +export default { + // 消息提示 + msg(content) { + uni.showToast({ + title: content, + icon: 'none' + }) + }, + // 错误消息 + msgError(content) { + uni.showToast({ + title: content, + icon: 'error' + }) + }, + // 成功消息 + msgSuccess(content) { + uni.showToast({ + title: content, + icon: 'success' + }) + }, + // 隐藏消息 + hideMsg(content) { + uni.hideToast() + }, + // 弹出提示 + alert(content) { + uni.showModal({ + title: '提示', + content: content, + showCancel: false + }) + }, + // 确认窗体 + confirm(content) { + return new Promise((resolve, reject) => { + uni.showModal({ + title: '系统提示', + content: content, + cancelText: '取消', + confirmText: '确定', + success: function(res) { + if (res.confirm) { + resolve(res.confirm) + } + } + }) + }) + }, + // 提示信息 + showToast(option) { + if (typeof option === "object") { + uni.showToast(option) + } else { + uni.showToast({ + title: option, + icon: "none", + duration: 2500 + }) + } + }, + // 打开遮罩层 + loading(content) { + uni.showLoading({ + title: content, + icon: 'none' + }) + }, + // 关闭遮罩层 + closeLoading() { + uni.hideLoading() + } +} diff --git a/utilsRc/plugins/tab.js b/utilsRc/plugins/tab.js new file mode 100644 index 0000000..5d1b305 --- /dev/null +++ b/utilsRc/plugins/tab.js @@ -0,0 +1,30 @@ +export default { + // 关闭所有页面,打开到应用内的某个页面 + reLaunch(url) { + return uni.reLaunch({ + url: url + }) + }, + // 跳转到tabBar页面,并关闭其他所有非tabBar页面 + switchTab(url) { + return uni.switchTab({ + url: url + }) + }, + // 关闭当前页面,跳转到应用内的某个页面 + redirectTo(url) { + return uni.redirectTo({ + url: url + }) + }, + // 保留当前页面,跳转到应用内的某个页面 + navigateTo(url) { + return uni.navigateTo({ + url: url + }) + }, + // 关闭当前页面,返回上一页面或多级页面 + navigateBack() { + return uni.navigateBack() + } +} diff --git a/utilsRc/request.js b/utilsRc/request.js new file mode 100644 index 0000000..47c2ad5 --- /dev/null +++ b/utilsRc/request.js @@ -0,0 +1,107 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2023-05-12 08:44:49 + * @LastEditors: shirlwang + */ +import store from './store/index.js' +import configRc from './config.js' +import { getToken } from '@/utilsRc/auth' +import errorCode from '@/utilsRc/errorCode' +import { toast, showConfirm, tansParams } from '@/utilsRc/common' + +let timeout = 10000 +const baseUrl = configRc.baseUrl + +const request = config => { + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false + config.header = config.header || {} + if (getToken() && !isToken) { + config.header['Authorization'] = 'Bearer ' + getToken() + } + config.header['Authorization'] = 'Bearer ' + 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJzeXNfdXNlcjoxIiwicm5TdHIiOiJVMDRocERSZjdZMXJUbUxXb05uOUpzYUdDZzBNazJJQSIsInVzZXJJZCI6MX0.LZ29vvA4tK3b9Hki4nU9Jb1himXZM2AEOue3CMRY95w' + // get请求映射params参数 + if (config.params) { + let url = config.url + '?' + tansParams(config.params) + url = url.slice(0, -1) + config.url = url + } + return new Promise((resolve, reject) => { + uni.request({ + method: config.method || 'get', + timeout: config.timeout || timeout, + url: baseUrl + config.url, + // url: 'https://gccrcdh.sd-talent.cn:80/zhq' + config.url, + data: config.data, + header: config.header, + dataType: 'json' + }).then(response => { + let res = response.data + let error = response.errMsg!='request:ok' + if (error) { + toast('网络出小差,请稍后再试') + reject('网络出小差,请稍后再试') + return + } + const code = res.code || 200 + console.log(code, 'const code = res.code || 200') + const msg = errorCode[code] || res.msg || errorCode['default'] + const isShowModel = getApp().globalData.isShowModel + if (code === 200) { + resolve(res) + }else if (code === 401) { + if(isShowModel === false) { + getApp().globalData.isShowModel = true + showConfirm('您好!登录后,您才可以继续操作。', '取消', '去登录').then(res => { + if (res.confirm) { + getApp().globalData.isShowModel = false + store.dispatch('LogOut').then(res => { + uni.reLaunch({ url: '/pages/login/login-one' }) + }) + } else if(res.cancel) { + getApp().globalData.isShowModel = false + uni.navigateBack() + } + + }) + } + // reject(code) + } + // if (code === 401) { + // showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => { + // if (res.confirm) { + // store.dispatch('LogOut').then(res => { + // uni.reLaunch({ url: '/page_other/login/index' }) + // }) + // } + // }) + // reject('无效的会话,或者会话已过期,请重新登录。') + // } else + else if (code === 500) { + toast(msg) + reject('500') + } else if (code !== 200 && code !== 9999) { + // 9999是正常的业务状态码,不应该被当作错误处理 + toast(msg) + reject(code) + } + resolve(res.data) + }) + .catch(error => { + console.log(error, 'error') + let message = error.errMsg + if (message === 'Network Error') { + message = '网络出小差,请稍后再试' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } else if (message.includes('Request failed with status code')) { + message = '系统接口' + message.substr(message.length - 3) + '异常' + } + toast(message) + reject(error) + }) + }) +} + +export default request diff --git a/utilsRc/storage.js b/utilsRc/storage.js new file mode 100644 index 0000000..c3bf5db --- /dev/null +++ b/utilsRc/storage.js @@ -0,0 +1,44 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2023-07-27 15:56:55 + * @LastEditors: lip + */ +import constant from './constant' + +// 存储变量名 +let storageKey = 'storage_data' + +// 存储节点变量名 +let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions, constant.type, constant + .phonenumber, + constant.userId, + constant.handlerData, + constant.nick +] + +// 存储的数据 +let storageData = uni.getStorageSync(storageKey) || {} + +const storage = { + set: function(key, value) { + if (storageNodeKeys.indexOf(key) != -1) { + let tmp = uni.getStorageSync(storageKey) + tmp = tmp ? tmp : {} + tmp[key] = value + uni.setStorageSync(storageKey, tmp) + } + }, + get: function(key) { + return storageData[key] || "" + }, + remove: function(key) { + delete storageData[key] + uni.setStorageSync(storageKey, storageData) + }, + clean: function() { + uni.removeStorageSync(storageKey) + } +} + +export default storage diff --git a/utilsRc/store/getters.js b/utilsRc/store/getters.js new file mode 100644 index 0000000..14ab276 --- /dev/null +++ b/utilsRc/store/getters.js @@ -0,0 +1,19 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2023-07-27 15:59:34 + * @LastEditors: lip + */ +const getters = { + token: state => state.user.token, + avatar: state => state.user.avatar, + name: state => state.user.name, + roles: state => state.user.roles, + permissions: state => state.user.permissions, + userId: state => state.user.userId, + handlerData: state => state.user.handlerData, + nick: state => state.user.nick, + showExitPopup: state => state.user.showExitPopup, + publicKey: state => state.user.publicKey + } + export default getters diff --git a/utilsRc/store/index.js b/utilsRc/store/index.js new file mode 100644 index 0000000..f3475ea --- /dev/null +++ b/utilsRc/store/index.js @@ -0,0 +1,18 @@ +/* + * @Descripttion: + * @Author: lip + * @Date: 2023-07-27 09:04:34 + * @LastEditors: shirlwang + */ +import user from '@/utilsRc/store/modules/user' +import getters from './getters' + +// src/store/index.js +import { createStore } from 'vuex'; +let store = createStore({ + modules: { + user + }, + getters +}); +export default store; diff --git a/utilsRc/store/modules/user.js b/utilsRc/store/modules/user.js new file mode 100644 index 0000000..190968c --- /dev/null +++ b/utilsRc/store/modules/user.js @@ -0,0 +1,253 @@ +import config from '@/config' +import storage from '@/utilsRc/storage' +import constant from '@/utilsRc/constant' +import { + login, + // logout, + getInfo, + // register, + // smsLogin, + // wechatLogin +} from '@/apiRc/login' +import { + getToken, + setToken, + removeToken +} from '@/utilsRc/auth' + +import {sm2} from 'sm-crypto' +// const sm2 = require('sm-crypto').sm2 +const baseUrl = config.baseUrl + +const user = { + state: { + token: getToken(), + name: storage.get(constant.name), + avatar: storage.get(constant.avatar), + roles: storage.get(constant.roles), + permissions: storage.get(constant.permissions), + type: storage.get(constant.type), + phonenumber: storage.get(constant.phonenumber), + nick: storage.get(constant.nick), + userId: storage.get(constant.userId), + handlerData: storage.get(constant.handlerData), + showExitPopup: false, + publicKey: '04970A174A090FCCD2B2503DD978152ACB906919245E4C8F237BE290E6E72334DDD89B857177A11C609FAA62CC62AD75D4BB1395E2A22F2663357A5D3EF9B1C1B8', + + }, + + + mutations: { + SET_TOKEN: (state, token) => { + state.token = token + // 同时更新存储中的token + setToken(token) + }, + SET_NAME: (state, name) => { + state.name = name + storage.set(constant.name, name) + }, + SET_AVATAR: (state, avatar) => { + state.avatar = avatar + storage.set(constant.avatar, avatar) + }, + SET_ROLES: (state, roles) => { + state.roles = roles + storage.set(constant.roles, roles) + }, + SET_PERMISSIONS: (state, permissions) => { + state.permissions = permissions + storage.set(constant.permissions, permissions) + }, + SET_TYPE: (state, type) => { + state.type = type + storage.set(constant.type, type) + }, + SET_PHONENUMBER: (state, phonenumber) => { + state.phonenumber = phonenumber + storage.set(constant.phonenumber, phonenumber) + }, + SET_NICK: (state, nick) => { + state.nick = nick + storage.set(constant.nick, nick) + }, + SET_USER_ID: (state, userId) => { + state.userId = userId + storage.set(constant.userId, userId) + }, + + // 存储经办人信息 + SET_HAND_LER(state, data) { + state.handlerData = data + storage.set(constant.handlerData, data) + }, + + SET_SHOWEXITPOPUP(state, type) { + state.showExitPopup = type + } + }, + + actions: { + // 登录 + LoginByUserInfo({ + commit, + // state + }, userInfo) { + + return new Promise((resolve, reject) => { + // const info = JSON.parse(JSON.stringify(userInfo)) + // info.password = '04' + sm2.doEncrypt(info.password, state.publicKey, 0) + // info.username = '04' + sm2.doEncrypt(info.username, state.publicKey, 0) + login(userInfo).then(res => { + console.log('登录接口返回:', res); + setToken(res.data.token) + commit('SET_TOKEN', res.data.token) + resolve(res) + }).catch(error => { + reject(error) + }) + }) + }, + // 登录 + Login({ + commit, + state + }, userInfo) { + + return new Promise((resolve, reject) => { + const info = JSON.parse(JSON.stringify(userInfo)) + info.password = '04' + sm2.doEncrypt(info.password, state.publicKey, 0) + info.username = '04' + sm2.doEncrypt(info.username, state.publicKey, 0) + login(info).then(res => { + console.log('登录接口返回:', res); + setToken(res.data.token) + commit('SET_TOKEN', res.data.token) + resolve(res) + }).catch(error => { + reject(error) + }) + }) + }, + // 登录 + SMSLogin({ + commit + }, userInfo) { + return new Promise((resolve, reject) => { + smsLogin(userInfo).then(res => { + setToken(res.data.token) + commit('SET_TOKEN', res.data.token) + resolve(res) + }).catch(error => { + reject(error) + }) + }) + }, + // 登录 + WXLogin({ + commit + }, userInfo) { + return new Promise((resolve, reject) => { + wechatLogin(userInfo).then(res => { + setToken(res.data.token) + commit('SET_TOKEN', res.data.token) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, + // 注册 + Register({ + commit + }, userInfo) { + const username = userInfo.username + const password = userInfo.password + const code = userInfo.code + const uuid = userInfo.uuid + const userType = userInfo.userType + const userNumber = userInfo.userNumber + return new Promise((resolve, reject) => { + register(username, password, code, uuid, userType, userNumber).then(res => { + uni.showToast({ + title: `账号${username}注册成功`, + icon: 'none' + }) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, + + // 获取用户信息 + GetInfo({ + commit, + state + }) { + return new Promise((resolve, reject) => { + getInfo().then(res => { + const user = res.data.user + const avatar = (user == null || user.avatar == "" || user.avatar == null) ? + "https://rc.jinan.gov.cn/qcwjyH5/static/icon/my.png" : user.avatar + const username = (user == null || user.userName == "" || user.userName == + null) ? "" : user.userName + const usertype = (user == null || user.userType == "" || user.userType == + null) ? "" : user.userType + const usernumber = (user == null || user.phonenumber == "" || user + .phonenumber == null) ? "" : user.phonenumber + const nick = (user == null || user.nickName == "" || user.nickName == null) ? + "" : user.nickName + const userId = (user == null || user.userId == "" || user.userId == null) ? "" : + user.userId + if (res.data.roles && res.data.roles.length > 0) { + commit('SET_ROLES', res.data.roles) + commit('SET_PERMISSIONS', res.data.permissions) + } else { + commit('SET_ROLES', ['ROLE_DEFAULT']) + } + commit('SET_NAME', username) + commit('SET_AVATAR', avatar) + commit('SET_TYPE', usertype) + commit('SET_PHONENUMBER', usernumber) + commit('SET_NICK', nick) + commit('SET_USER_ID', userId) + + // commit('SET_HAND_LER', { + // deptName: user.dept.deptName, + // nickName: user.nickName + // }) + + resolve(res) + }).catch(error => { + reject(error) + }) + }) + }, + + // 退出系统 + LogOut({ + commit, + state + }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + commit('SET_PERMISSIONS', []) + commit('SET_TYPE', '') + commit('SET_NICK', '') + commit('SET_PHONENUMBER', '') + commit('SET_USER_ID', '') + commit('SET_SHOWEXITPOPUP', false) + removeToken() + storage.clean() + resolve() + }).catch(error => { + reject(error) + }) + }) + } + } +} + +export default user