This commit is contained in:
ivo 2022-07-07 11:36:03 +08:00
commit b61a293d8d
543 changed files with 13285 additions and 0 deletions

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
node_modules
.DS_Store
dist
*.local
.idea
.history
.vscode
.husky/
dist.zip
*.zip
build
package-lock.json

16
.hbuilderx/launch.json Normal file
View File

@ -0,0 +1,16 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"default" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

20
index.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

96
package.json Normal file
View File

@ -0,0 +1,96 @@
{
"name": "uni-preset-vue",
"version": "0.0.0",
"scripts": {
"dev:app": "uni -p app",
"dev:custom": "uni -p",
"dev:h5": "uni",
"dev:h5:ssr": "uni --ssr",
"dev:mp-alipay": "uni -p mp-alipay",
"dev:mp-baidu": "uni -p mp-baidu",
"dev:mp-kuaishou": "uni -p mp-kuaishou",
"dev:mp-lark": "uni -p mp-lark",
"dev:mp-qq": "uni -p mp-qq",
"dev:mp-toutiao": "uni -p mp-toutiao",
"dev:mp-weixin": "uni -p mp-weixin",
"dev:quickapp-webview": "uni -p quickapp-webview",
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
"build:app": "uni build -p app",
"build:custom": "uni build -p",
"build:h5": "uni build",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu",
"build:mp-kuaishou": "uni build -p mp-kuaishou",
"build:mp-lark": "uni build -p mp-lark",
"build:mp-qq": "uni build -p mp-qq",
"build:mp-toutiao": "uni build -p mp-toutiao",
"build:mp-weixin": "uni build -p mp-weixin",
"build:quickapp-webview": "uni build -p quickapp-webview",
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union"
},
"dependencies": {
"@dcloudio/uni-app": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-app-plus": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-components": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-h5": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3040720220422002",
"vue": "^3.2.33",
"vue-i18n": "^9.1.9",
"vuex": "^4.0.2",
"@vueuse/head": "^0.6.0",
"ahooks-vue": "^0.11.2",
"amfe-flexible": "^2.2.1",
"axios": "^0.21.4",
"crypto-js": "^4.1.1",
"easy-player": "^2.2.7",
"html2canvas": "^1.0.0",
"install": "^0.13.0",
"nprogress": "^0.2.0",
"pdfjs-dist": "^2.5.207",
"qrcode": "^1.4.4",
"sass": "^1.35.1",
"vconsole": "^3.11.0",
"video.js": "^7.18.1",
"vivus": "^0.4.6",
"vue-pdf": "^4.3.0",
"vue-router": "^4.0.6",
"vue-video-player": "^5.0.2",
"vue3-clipboard": "^1.0.0",
"vue3-video-play": "^1.3.1-beta.6"
},
"devDependencies": {
"@dcloudio/types": "^2.5.17",
"@dcloudio/uni-automator": "3.0.0-alpha-3040720220422002",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3040720220422002",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3040720220422002",
"autoprefixer": "^10.4.2",
"vite": "^2.9.5",
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@vitejs/plugin-vue": "^1.2.4",
"@vitejs/plugin-vue-jsx": "^1.1.6",
"@vue/compiler-sfc": "^3.1.4",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-vue": "^7.12.1",
"husky": "^6.0.0",
"less": "^4.1.1",
"lint-staged": "^11.0.0",
"postcss-pxtorem": "^6.0.0",
"stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0",
"svg-sprite-loader": "^6.0.11",
"vite-plugin-compression": "^0.2.5",
"vite-plugin-style-import": "^1.0.1"
}
}

18
src/App.vue Normal file
View File

@ -0,0 +1,18 @@
<script>
export default {
onLaunch: function () {
console.log('App Launch')
},
onShow: function () {
console.log('App Show')
},
onHide: function () {
console.log('App Hide')
},
}
</script>
<style>
/* @import "wxcomponents/weapp/common/index.wxss"; */
/*每个页面公共css */
</style>

62
src/api/app.js Normal file
View File

@ -0,0 +1,62 @@
import request from '@/utils/request';
// 系统字典
export async function comboboxlist(data) {
return request({
path: '/system/combobox/data/list',
data,
type: 'get',
});
}
// 区域
export async function region(data) {
return request({
path: '/system/administrative/region',
data,
type: 'get',
});
}
// 区域
export async function industrylist(data) {
return request({
path: '/system/combobox/enterprise/industry/list',
data,
type: 'get',
});
}
export async function industrytype(data) {
return request({
path: '/system/combobox/enterprise/industry/type',
data,
type: 'get',
});
}
export async function courselist(data) {
return request({
path: '/system/combobox/course/list',
data,
type: 'get',
});
}
export async function accountlist(data) {
return request({
path: '/permissions/account/list',
data,
type: 'get',
});
}
// 上传
export async function filesupload(data) {
return request({
baseURL: `${import.meta.env.VITE_APP_WEB_API_URL}/ssp/v2/system/files/upload`,
path: '/system/files/upload',
data,
type: 'post',
});
}

25
src/api/certificate.js Normal file
View File

@ -0,0 +1,25 @@
import request from '@/utils/request';
export async function credentialCourseList(data) {
return request({
path: '/train/credential/course/list',
data,
type: 'get',
});
}
export async function credentialPersonQuery(data) {
return request({
path: '/train/credential/person/query',
data,
type: 'get',
});
}
export async function credentialPersonCourseList(data) {
return request({
path: '/train/credential/person/course/list',
data,
type: 'get',
});
}

210
src/api/danger.js Normal file
View File

@ -0,0 +1,210 @@
import request from '@/utils/request';
// 系统字典
export async function checkTablelist(data) {
return request({
path: '/risk/risk/checkTable/list',
data,
type: 'get',
});
}
export async function checkTablequery(data) {
return request({
path: '/risk/risk/checkTable/query',
data,
type: 'get',
});
}
export async function hiddenentlist(data) {
return request({
path: '/risk/risk/hidden/ent/list',
data,
type: 'get',
});
}
export async function hiddenentquery(data) {
return request({
path: '/risk/risk/hidden/ent/query',
data,
type: 'get',
});
}
export async function examinelist(data) {
return request({
path: '/risk/risk/hidden/examine/list',
data,
type: 'get',
});
}
export async function examinequery(data) {
return request({
path: '/risk/risk/hidden/examine/query',
data,
type: 'get',
});
}
export async function examinedelete(data) {
return request({
path: '/risk/risk/hidden/examine/delete',
data,
type: 'post',
});
}
export async function correctivecheck(data) {
return request({
path: '/risk/risk/hidden/corrective/check',
data,
type: 'post',
});
}
export async function correctivesubmit(data) {
return request({
path: '/risk/risk/hidden/corrective/submit',
data,
type: 'post',
});
}
export async function examinecreate(data) {
return request({
path: '/risk/risk/hidden/examine/create',
data,
type: 'post',
});
}
export async function examineupdate(data) {
return request({
path: '/risk/risk/hidden/examine/update',
data,
type: 'post',
});
}
export async function sheetlist(data) {
return request({
path: '/risk/risk/task/sheet/list',
data,
type: 'get',
});
}
export async function sheetquery(data) {
return request({
path: '/risk/risk/task/sheet/query',
data,
type: 'get',
});
}
export async function hiddentasklist(data) {
return request({
path: '/risk/risk/hidden/task/list',
data,
type: 'get',
});
}
export async function hiddentaskdelete(data) {
return request({
path: '/risk/risk/hidden/task/delete',
data,
type: 'post',
});
}
export async function sheetcheck(data) {
return request({
path: '/risk/risk/task/sheet/check',
data,
type: 'post',
});
}
export async function sheetsubmit(data) {
return request({
path: '/risk/risk/task/sheet/submit',
data,
type: 'post',
});
}
export async function sheetclose(data) {
return request({
path: '/risk/risk/task/sheet/close',
data,
type: 'post',
});
}
export async function taskExamineCombobox(data) {
return request({
path: '/risk/risk/task/examine/combobox',
data,
type: 'get',
});
}
export async function hiddenTaskBatch(data) {
return request({
path: '/risk/risk/hidden/task/batch',
data,
type: 'post',
});
}
export async function hiddenTaskDelete(data) {
return request({
path: '/risk/risk/hidden/task/delete',
data,
type: 'post',
});
}
export async function taskExamineQuery(data) {
return request({
path: '/risk/risk/task/examine/query',
data,
type: 'get',
});
}
export async function taskExamineExist(data) {
return request({
path: '/risk/risk/task/examine/exist',
data,
type: 'post',
});
}
export async function hiddenlibraryex(data) {
return request({
path: '/risk/combobox/hidden/library/ex',
data,
type: 'get',
});
}
export async function taskPerson(data) {
return request({
path: '/risk/risk/task/person',
data,
type: 'get',
});
}
export async function taskSheetUpdate(data) {
return request({
path: '/risk/risk/task/sheet/update',
data,
type: 'post',
});
}

11
src/api/dicts.js Normal file
View File

@ -0,0 +1,11 @@
import request from '@/utils/request';
const agentBaseUrl = import.meta.env.VITE_APP_AGENT_API_URL;
export function contactTypeList(data) {
return request({
method: 'get',
url: `${agentBaseUrl}/contact_type_list`,
data,
});
}

9
src/api/gridding.js Normal file
View File

@ -0,0 +1,9 @@
import request from '@/utils/request';
// 获取网格树
export async function griddingTree() {
return request({
path: '/permissions/grid/management/tree',
type: 'get',
});
}

842
src/api/index.js Normal file
View File

@ -0,0 +1,842 @@
import request from '@/utils/request';
// 推文列表
export async function appTweets(data) {
return request({
path: '/system/tweets/list',
data,
type: 'get',
});
}
// 推文列表
export async function appTweetsquery(data) {
return request({
path: '/system/tweets/query',
data,
type: 'get',
});
}
// 获取企业列表
export async function enterpriselist(data) {
return request({
path: '/enterprise/enterprise/management/list',
data,
type: 'get',
});
}
// 企业移除
export async function enterpriseRemove(data) {
return request({
path: '/enterprise/enterprise/supervise/remove',
data,
type: 'post',
});
}
// 企业删除
export async function enterpriseDelete(data) {
return request({
path: '/enterprise/enterprise/management/delete',
data,
type: 'post',
});
}
// 企业认领
export async function enterpriseBind(data) {
return request({
path: '/enterprise/enterprise/supervise/bind',
data,
type: 'post',
});
}
// 企业信息
export async function enterprisecreate(data) {
return request({
path: '/enterprise/enterprise/management/create',
data,
type: 'post',
});
}
//根据区域编号查询网格数
export async function griddingOptions(data) {
return request({
path: '/enterprise/gridding/options',
type: 'get',
data
})
}
// 企业信息
export async function enterprisequery(data) {
return request({
path: '/enterprise/enterprise/management/query',
data,
type: 'get',
});
}
export async function basequery(data) {
return request({
path: '/enterprise/base/query',
data,
type: 'get',
});
}
// 企业安全
export async function safetyhome(data) {
return request({
path: '/enterprise/safety/home',
data,
type: 'get',
});
}
// 企业安全基础信息
export async function safetyupdate(data) {
return request({
path: '/enterprise/safety/update',
data,
type: 'post',
});
}
// 企业安全特性
export async function featurehome(data) {
return request({
path: '/enterprise/feature/home',
data,
type: 'get',
});
}
// 企业安全特性
export async function regulatoryhome(data) {
return request({
path: '/enterprise/regulatory/home',
data,
type: 'get',
});
}
// 服务机构
export async function orglist(data) {
return request({
path: '/system/combobox/service/org/list',
data,
type: 'get',
});
}
// 企业安全特性
export async function baseupdate(data) {
return request({
path: '/enterprise/base/update',
data,
type: 'post',
});
}
// 企业安全特性
export async function safetyinputlist(data) {
return request({
path: '/enterprise/safety/input/list',
data,
type: 'get',
});
}
// 企业安全特性
export async function safetyinputdelete(data) {
return request({
path: '/enterprise/safety/input/delete',
data,
type: 'post',
});
}
export async function safetydrilllist(data) {
return request({
path: '/enterprise/safety/drill/list',
data,
type: 'get',
});
}
export async function safetydrilldelete(data) {
return request({
path: '/enterprise/safety/drill/delete',
data,
type: 'post',
});
}
export async function safetyevaluationlist(data) {
return request({
path: '/enterprise/safety/evaluation/list',
data,
type: 'get',
});
}
export async function safetyevaluationdelete(data) {
return request({
path: '/enterprise/safety/evaluation/delete',
data,
type: 'post',
});
}
export async function safetyplanlist(data) {
return request({
path: '/enterprise/safety/plan/list',
data,
type: 'get',
});
}
export async function safetyplandelete(data) {
return request({
path: '/enterprise/safety/plan/delete',
data,
type: 'post',
});
}
export async function ammoniaquery(data) {
return request({
path: '/enterprise/feature/enterprise/ammonia/query',
data,
type: 'get',
});
}
export async function ammoniaupdate(data) {
return request({
path: '/enterprise/feature/enterprise/ammonia/update',
data,
type: 'post',
});
}
export async function metalquery(data) {
return request({
path: '/enterprise/feature/enterprise/metal/query',
data,
type: 'get',
});
}
export async function metalupdate(data) {
return request({
path: '/enterprise/feature/enterprise/metal/update',
data,
type: 'post',
});
}
export async function shipupdate(data) {
return request({
path: '/enterprise/feature/enterprise/ship/update',
data,
type: 'post',
});
}
export async function shipquery(data) {
return request({
path: '/enterprise/feature/enterprise/ship/query',
data,
type: 'get',
});
}
export async function facilityupdate(data) {
return request({
path: '/enterprise/feature/facility/update',
data,
type: 'post',
});
}
export async function storagelist(data) {
return request({
path: '/enterprise/feature/facility/storage/list',
data,
type: 'get',
});
}
export async function storagedelete(data) {
return request({
path: '/enterprise/feature/facility/storage/delete',
data,
type: 'post',
});
}
export async function storagequery(data) {
return request({
path: '/enterprise/feature/facility/storage/query',
data,
type: 'get',
});
}
export async function storageupdate(data) {
return request({
path: '/enterprise/feature/facility/storage/update',
data,
type: 'post',
});
}
export async function storagecreate(data) {
return request({
path: '/enterprise/feature/facility/storage/create',
data,
type: 'post',
});
}
export async function environmentallist(data) {
return request({
path: '/enterprise/feature/facility/environmental/list',
data,
type: 'get',
});
}
export async function environmentalupdate(data) {
return request({
path: '/enterprise/feature/facility/environmental/update',
data,
type: 'post',
});
}
export async function environmentalcreate(data) {
return request({
path: '/enterprise/feature/facility/environmental/create',
data,
type: 'post',
});
}
export async function environmentalquery(data) {
return request({
path: '/enterprise/feature/facility/environmental/query',
data,
type: 'get',
});
}
export async function environmentaldelete(data) {
return request({
path: '/enterprise/feature/facility/environmental/delete',
data,
type: 'post',
});
}
export async function buildlist(data) {
return request({
path: '/enterprise/feature/facility/build/list',
data,
type: 'get',
});
}
export async function buildupdate(data) {
return request({
path: '/enterprise/feature/facility/build/update',
data,
type: 'post',
});
}
export async function buildcreate(data) {
return request({
path: '/enterprise/feature/facility/build/create',
data,
type: 'post',
});
}
export async function buildquery(data) {
return request({
path: '/enterprise/feature/facility/build/query',
data,
type: 'get',
});
}
export async function builddelete(data) {
return request({
path: '/enterprise/feature/facility/build/delete',
data,
type: 'post',
});
}
export async function featureother(data) {
return request({
path: '/enterprise/feature/other/query',
data,
type: 'get',
});
}
export async function featureotherupdate(data) {
return request({
path: '/enterprise/feature/other/update',
data,
type: 'post',
});
}
export async function personallist(data) {
return request({
path: '/enterprise/personal/list',
data,
type: 'get',
});
}
export async function personalquery(data) {
return request({
path: '/enterprise/personal/query',
data,
type: 'get',
});
}
export async function personaldelete(data) {
return request({
path: '/enterprise/personal/delete',
data,
type: 'post',
});
}
export async function personalupdate(data) {
return request({
path: '/enterprise/personal/update',
data,
type: 'post',
});
}
export async function personalcreate(data) {
return request({
path: '/enterprise/personal/create',
data,
type: 'post',
});
}
// 周边环境
export async function surroundingslist(data) {
return request({
path: '/enterprise/surroundings/list',
data,
type: 'get',
});
}
export async function surroundingsquery(data) {
return request({
path: '/enterprise/surroundings/query',
data,
type: 'get',
});
}
export async function surroundingsdelete(data) {
return request({
path: '/enterprise/surroundings/delete',
data,
type: 'post',
});
}
export async function surroundingsupdate(data) {
return request({
path: '/enterprise/surroundings/update',
data,
type: 'post',
});
}
export async function surroundingscreate(data) {
return request({
path: '/enterprise/surroundings/create',
data,
type: 'post',
});
}
// 应用物资
export async function supplieslist(data) {
return request({
path: '/enterprise/supplies/list',
data,
type: 'get',
});
}
export async function suppliesquery(data) {
return request({
path: '/enterprise/supplies/query',
data,
type: 'get',
});
}
export async function suppliesdelete(data) {
return request({
path: '/enterprise/supplies/delete',
data,
type: 'post',
});
}
export async function suppliesupdate(data) {
return request({
path: '/enterprise/supplies/update',
data,
type: 'post',
});
}
export async function suppliescreate(data) {
return request({
path: '/enterprise/supplies/create',
data,
type: 'post',
});
}
// 设备
export async function equipmenthome(data) {
return request({
path: '/enterprise/equipment/hone',
data,
type: 'get',
});
}
export async function equipmentlist(data) {
return request({
path: '/enterprise/equipment/list',
data,
type: 'get',
});
}
export async function equipmentquery(data) {
return request({
path: '/enterprise/equipment/query',
data,
type: 'get',
});
}
export async function equipmentdelete(data) {
return request({
path: '/enterprise/equipment/delete',
data,
type: 'post',
});
}
export async function equipmentupdate(data) {
return request({
path: '/enterprise/equipment/update',
data,
type: 'post',
});
}
export async function equipmentcreate(data) {
return request({
path: '/enterprise/equipment/create',
data,
type: 'post',
});
}
// 营业执照
export async function businessquery(data) {
return request({
path: '/enterprise/business/query',
data,
type: 'get',
});
}
export async function businessupdate(data) {
return request({
path: '/enterprise/business/update',
data,
type: 'post',
});
}
// 危化品
export async function chemicalslist(data) {
return request({
path: '/enterprise/feature/chemicals/list',
data,
type: 'get',
});
}
export async function chemicalsquery(data) {
return request({
path: '/enterprise/feature/chemicals/query',
data,
type: 'get',
});
}
export async function chemicalscreate(data) {
return request({
path: '/enterprise/feature/chemicals/create',
data,
type: 'post',
});
}
export async function chemicalsupdate(data) {
return request({
path: '/enterprise/feature/chemicals/update',
data,
type: 'post',
});
}
export async function chemicalsdelete(data) {
return request({
path: '/enterprise/feature/chemicals/delete',
data,
type: 'post',
});
}
export async function libraryquery(data) {
return request({
path: '/system/combobox/chemicals/library',
data,
type: 'get',
});
}
export async function placelabelquery(data) {
return request({
path: '/enterprise/feature/place/label/query',
data,
type: 'get',
});
}
export async function placelabelupdate(data) {
return request({
path: '/enterprise/feature/place/label/update',
data,
type: 'post',
});
}
export async function placelabellist(data) {
return request({
path: '/enterprise/feature/place/list',
data,
type: 'get',
});
}
export async function placequery(data) {
return request({
path: '/enterprise/feature/place/query',
data,
type: 'get',
});
}
export async function placedelete(data) {
return request({
path: '/enterprise/feature/place/delete',
data,
type: 'post',
});
}
export async function placecreate(data) {
return request({
path: '/enterprise/feature/place/create',
data,
type: 'post',
});
}
export async function placeupdate(data) {
return request({
path: '/enterprise/feature/place/update',
data,
type: 'post',
});
}
// 锂电池
export async function lithiumquery(data) {
return request({
path: '/enterprise/feature/lithium/query',
data,
type: 'get',
});
}
export async function lithiumlist(data) {
return request({
path: '/enterprise/feature/lithium/list',
data,
type: 'get',
});
}
export async function lithiumcreate(data) {
return request({
path: '/enterprise/feature/lithium/create',
data,
type: 'post',
});
}
export async function lithiumdelete(data) {
return request({
path: '/enterprise/feature/lithium/delete',
data,
type: 'post',
});
}
export async function lithiumupdate(data) {
return request({
path: '/enterprise/feature/lithium/update',
data,
type: 'post',
});
}
// 安全监管
export async function regulatoryquery(data) {
return request({
path: '/enterprise/regulatory/query',
data,
type: 'get',
});
}
export async function regulatoryupdate(data) {
return request({
path: '/enterprise/regulatory/update',
data,
type: 'post',
});
}
export async function accidentquery(data) {
return request({
path: '/enterprise/regulatory/accident/query',
data,
type: 'get',
});
}
export async function accidentlist(data) {
return request({
path: '/enterprise/regulatory/accident/list',
data,
type: 'get',
});
}
export async function eventquery(data) {
return request({
path: '/enterprise/regulatory/event/query',
data,
type: 'get',
});
}
export async function eventlist(data) {
return request({
path: '/enterprise/regulatory/event/list',
data,
type: 'get',
});
}
export async function checkquery(data) {
return request({
path: '/enterprise/regulatory/check/query',
data,
type: 'get',
});
}
export async function checklist(data) {
return request({
path: '/enterprise/regulatory/check/list',
data,
type: 'get',
});
}
export async function entSafetyInputCreate(data) {
return request({
path: '/enterprise/safety/input/create',
data,
type: 'post',
});
}
export async function entSafetyPlanCreate(data) {
return request({
path: '/enterprise/safety/plan/create',
data,
type: 'post',
});
}
export async function entSafetyEvaluationCreate(data) {
return request({
path: '/enterprise/safety/evaluation/create',
data,
type: 'post',
});
}
export async function entSafetyDrillCreate(data) {
return request({
path: '/enterprise/safety/drill/create',
data,
type: 'post',
});
}
export async function entSafetyTeachList(data) {
return request({
path: '/enterprise/safety/teach/list',
data,
type: 'get',
});
}
export async function entSafetyTeachDelete(data) {
return request({
path: '/enterprise/safety/teach/delete',
data,
type: 'post',
});
}
export async function entSafetyTeachCreate(data) {
return request({
path: '/enterprise/safety/teach/create',
data,
type: 'post',
});
}
export async function entSafetyTrainList(data) {
return request({
path: '/enterprise/safety/train/list',
data,
type: 'get',
});
}
export async function entSafetyTrainDelete(data) {
return request({
path: '/enterprise/safety/train/delete',
data,
type: 'post',
});
}
export async function entSafetyTrainCreate(data) {
return request({
path: '/enterprise/safety/train/create',
data,
type: 'post',
});
}
export async function riskSelfCheckCreate(data) {
return request({
path: '/risk/risk/self/check/create',
data,
type: 'post',
});
}
//根据企业名称获取营业执照
export async function checkEnterprise(data) {
return request({
path: '/enterprise/check/enterprise',
type: 'get',
data
})
}

115
src/api/injury.js Normal file
View File

@ -0,0 +1,115 @@
import request from '@/utils/request';
// 工伤企业列表
export async function injuryenterpriselist(data) {
return request({
path: '/injury/enterprise/list',
data,
type: 'get',
});
}
export async function injuryenterprisequery(data) {
return request({
path: '/injury/enterprise/query',
data,
type: 'get',
});
}
export async function injuryHospitalList(data) {
return request({
path: '/injury/hospital/list',
data,
type: 'get',
});
}
export async function injuryEnterpriseEarlyWarningChange(data) {
return request({
path: '/injury/enterprise/early/warning/change',
data,
type: 'post',
});
}
export async function declarationlist(data) {
return request({
path: '/injury/declaration/list',
data,
type: 'get',
});
}
export async function declarationstatistics(data) {
return request({
path: '/injury/declaration/statistics',
data,
type: 'get',
});
}
export async function declarationquery(data) {
return request({
path: '/injury/declaration/query',
data,
type: 'get',
});
}
export async function declarationUpdate(data) {
return request({
path: '/injury/declaration/update',
data,
type: 'post',
});
}
export async function declarationCreate(data) {
return request({
path: '/injury/declaration/create',
data,
type: 'post',
});
}
export async function notificationlist(data) {
return request({
path: '/injury/notification/list',
data,
type: 'get',
});
}
export async function notificationstatistics(data) {
return request({
path: '/injury/notification/statistics',
data,
type: 'get',
});
}
export async function notificationquery(data) {
return request({
path: '/injury/notification/query',
data,
type: 'get',
});
}
export async function notificationcorrective(data) {
return request({
path: '/injury/notification/corrective',
data,
type: 'post',
});
}
export async function notificationsubmit(data) {
return request({
path: '/injury/notification/submit',
data,
type: 'post',
});
}
export async function notificationcheck(data) {
return request({
path: '/injury/notification/check',
data,
type: 'post',
});
}
export async function revocationapply(data) {
return request({
path: '/injury/declaration/revocation/apply',
data,
type: 'post',
});
}

37
src/api/iot.js Normal file
View File

@ -0,0 +1,37 @@
import request from '@/utils/request';
export async function devicelist(data) {
return request({
path: '/iot/device/list',
data,
type: 'get',
});
}
export async function deviceunbind(data) {
return request({
path: '/iot/device/unbind',
data,
type: 'post',
});
}
export async function alarmlist(data) {
return request({
path: '/iot/device/alarm/list',
data,
type: 'get',
});
}
export async function hikcamera(data) {
return request({
path: '/iot/hik/cameras',
data,
type: 'get',
});
}
export async function refugedetail(data) {
return request({
path: '/emergency/refuge/detail',
data,
type: 'get',
});
}

42
src/api/knowledge.js Normal file
View File

@ -0,0 +1,42 @@
import request from '@/utils/request';
// 推文列表
export async function lawlist(data) {
return request({
path: '/knowledge/law/list',
data,
type: 'get',
});
}
export async function hiddenlist(data) {
return request({
path: '/knowledge/hidden/type/list',
data,
type: 'get',
});
}
export async function librarylist(data) {
return request({
path: '/knowledge/hidden/libaray/list',
data,
type: 'get',
});
}
export async function libraryquery(data) {
return request({
path: '/knowledge/hidden/libaray/query',
data,
type: 'get',
});
}
export async function chemicaleslist(data) {
return request({
path: '/knowledge/chemical/list',
data,
type: 'get',
});
}

33
src/api/question.js Normal file
View File

@ -0,0 +1,33 @@
import request from '@/utils/request';
export async function answerquery(data) {
return request({
path: '/knowledge/answer/today/query',
data,
type: 'get',
});
}
export async function getquestion(data) {
return request({
path: '/knowledge/answer/get/question',
data,
type: 'get',
});
}
export async function submitquestion(data) {
return request({
path: '/knowledge/answer/submit/answer',
data,
type: 'post',
});
}
export async function getdate(data) {
return request({
path: '/knowledge/answer/get/date',
data,
type: 'get',
});
}

19
src/api/user.js Normal file
View File

@ -0,0 +1,19 @@
import request from '@/utils/request';
// 账号登录
export async function login(data) {
return request({
path: '/permissions/login',
data,
type: 'post',
});
}
// 账号登录
export async function switchaccount(data) {
return request({
path: '/permissions/switch/account',
data,
type: 'post',
});
}

10
src/main.js Normal file
View File

@ -0,0 +1,10 @@
import {
createSSRApp
} from "vue";
import App from "./App.vue";
export function createApp() {
const app = createSSRApp(App);
return {
app,
};
}

72
src/manifest.json Normal file
View File

@ -0,0 +1,72 @@
{
"name" : "",
"appid" : "",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
/* 5+App */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* */
"modules" : {},
/* */
"distribute" : {
/* android */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs" : {}
}
},
/* */
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wx7b5a3c884f21e6ae",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3"
}

56
src/pages.json Normal file
View File

@ -0,0 +1,56 @@
{
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"usingComponents": {
"van-button": "wxcomponents/weapp/button/index",
"van-field": "wxcomponents/weapp/field/index",
"van-switch": "wxcomponents/weapp/switch/index",
"van-search": "wxcomponents/weapp/search/index",
"van-cell-group": "wxcomponents/weapp/cell-group/index",
"van-cell": "wxcomponents/weapp/cell/index",
"van-radio": "wxcomponents/weapp/radio/index",
"van-radio-group": "wxcomponents/weapp/radio-group/index",
"van-checkbox": "wxcomponents/weapp/checkbox/index",
"van-checkbox-group": "wxcomponents/weapp/checkbox-group/index",
"van-picker": "wxcomponents/weapp/picker/index",
"van-popup": "wxcomponents/weapp/popup/index",
"van-grid": "wxcomponents/weapp/grid/index",
"van-grid-item": "wxcomponents/weapp/grid-item/index",
"van-row": "wxcomponents/weapp/row/index",
"van-col": "wxcomponents/weapp/col/index",
"van-count-down": "wxcomponents/weapp/count-down/index",
"van-icon": "wxcomponents/weapp/icon/index",
"van-tab": "wxcomponents/weapp/tab/index",
"van-tabs": "wxcomponents/weapp/tabs/index",
"van-divider": "wxcomponents/weapp/divider/index",
"van-dialog": "wxcomponents/weapp/dialog/index",
"van-toast": "wxcomponents/weapp/toast/index",
"van-stepper": "wxcomponents/weapp/stepper/index",
"van-slider": "wxcomponents/weapp/slider/index",
"van-tag": "wxcomponents/weapp/tag/index",
"van-loading": "wxcomponents/weapp/loading/index",
"van-overlay": "wxcomponents/weapp/overlay/index",
"van-collapse": "wxcomponents/weapp/collapse/index",
"van-collapse-item": "wxcomponents/weapp/collapse-item/index",
"van-dropdown-item": "wxcomponents/weapp/dropdown-item/index",
"van-dropdown-menu": "wxcomponents/weapp/dropdown-menu/index",
"van-empty": "wxcomponents/weapp/empty/index",
"van-notice-bar": "wxcomponents/weapp/notice-bar/index",
"van-image": "wxcomponents/weapp/image/index",
"van-datetime-picker": "wxcomponents/weapp/datetime-picker/index",
"van-uploader": "wxcomponents/weapp/uploader/index"
}
},
"uniIdRouter": {}
}

136
src/pages/index/index.vue Normal file
View File

@ -0,0 +1,136 @@
<template>
<view class="index-wrap">
<van-button round block type="primary" native-type="submit">提交</van-button>
<div class="index-wrap-block">
<div style="padding: 20px 0 40px 0; font-size: 15px; text-align:center;">
<span>本服务由浙江政务网永康市应急管理局提供</span><br />
<span>服务咨询热线</span><span style="color: #1492FF">0579-87101962</span>
</div>
</div>
</view>
</template>
<script setup>
import {
inject, reactive, ref, onMounted,
} from 'vue';
import { useRequest } from 'ahooks-vue';
import { appTweets } from '@/api/index';
import { answerquery } from '@/api/question'
// answerquery().then(res=>{
// console.log(res)
// })
// const global = inject('global');
// const $store = inject('store');
// const { user } = $store.state;
// const router = useRouter()
// function toPath(name) {
// if (name == "danger-company" && user?.userInfo?.tag == 'enterprise') {
// router.push({ name: 'danger-company-hidden', query: { entId: user?.userInfo?.enterpriseCode } });
// return;
// } else if (name == "injury-company" && user?.userInfo?.tag == 'enterprise') {
// router.push({ name: 'injury-company-view', query: { entId: user?.userInfo?.enterpriseCode } });
// return;
// } else if (name == "notification-list" && user?.userInfo?.tag == 'enterprise') {
// router.push({ name: 'notification-list', query: { entId: user?.userInfo?.enterpriseCode } });
// return;
// }
// router.push({ name });
// }
// function goDetail(path) {
// router.push({ name: path })
// }
// const { data: noticeList, loading: noticeLoading } = useRequest(() => appTweets({
// type: "notice",
// pageNumber: 1,
// pageSize: 5
// }), {
// formatResult: (res) => res.contentList,
// });
const { run: getRun, data: quesInfo } = useRequest(answerquery);
</script>
<style lang="less" scoped>
.index-wrap {
/* background-color: var(--bg-color-f5f5f5); */
.van-grid {
background-color: #fff;
margin-bottom: 30px;
}
.van-grid-item {
.van-image {
width: 102px;
margin-bottom: 10px;
}
}
:deep(.van-card__thumb) {
width: 240px;
height: 120px;
}
:deep(.van-card__header) {
height: 120px;
}
:deep(.van-card__content) {
min-height: 120px;
}
.van-card {
background-color: #fff;
padding: 30px 30px;
}
&-block {
padding: 0 20px;
background-color: #fff;
margin-bottom: 30px;
> img {
display: block;
width: 100%;
}
.title {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28px;
color: #333;
padding: 20px 20px 20px 36px;
/* border-bottom: 1px solid var(--border-color); */
position: relative;
&::before {
content: '';
position: absolute;
left: 20px;
height: 28px;
top: 50%;
width: 4px;
border-radius: 4px;
margin-top: -14px;
/* background-color: var(--theme-color); */
}
text:first-child {
font-weight: bold;
}
text:last-child {
color: #999;
font-size: 12px;
}
}
}
}
</style>

BIN
src/static/battery.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
src/static/bg-3x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
src/static/calendar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
src/static/danger.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
src/static/date.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
src/static/device/cd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src/static/device/fire.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

BIN
src/static/device/gaota.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
src/static/device/more.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

BIN
src/static/device/more1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

BIN
src/static/device/one.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/static/device/run.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

BIN
src/static/device/smoke.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/static/device/wind.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

BIN
src/static/doc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
src/static/file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
src/static/gas.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
src/static/hiddenType.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
src/static/index/b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
src/static/index/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
src/static/index/icon01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
src/static/index/icon02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
src/static/index/icon03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
src/static/index/icon04.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
src/static/index/icon05.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
src/static/index/icon06.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
src/static/index/icon07.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
src/static/index/icon08.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
src/static/index/icon09.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
src/static/index/icon10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
src/static/index/px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
src/static/k.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
src/static/law.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
src/static/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
src/static/mh3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
src/static/space.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
src/static/spray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
src/static/tabBar/net.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
src/static/yinhuan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

12
src/store/index.js Normal file
View File

@ -0,0 +1,12 @@
import { createStore } from 'vuex';
import app from './modules/app';
import user from './modules/user';
export default createStore({
modules: {
app,
user,
},
// 启用严格模式,非mutation改变值都会报错
strict: true,
});

28
src/store/modules/app.js Normal file
View File

@ -0,0 +1,28 @@
import * as dictsApi from '@/api/dicts';
export default {
namespaced: true,
state: {
dicts: {},
caches: {},
},
mutations: {
},
actions: {
getDict({ state, commit }, type) {
const fetchDict = (name) => {
if (state.dicts[name]?.length || state.dicts[`${name}Loading`]) return Promise.resolve();
commit('SET_CONSTANT', { key: `${name}Loading`, val: true });
return dictsApi[name]?.().then((res) => {
commit('SET_CONSTANT', { key: name, val: res });
commit('SET_CONSTANT', { key: `${name}Loading`, val: false });
});
};
if (Array.isArray(type)) {
return Promise.all(type.map(fetchDict));
}
return fetchDict(type);
},
},
};

149
src/store/modules/user.js Normal file
View File

@ -0,0 +1,149 @@
/* eslint-disable no-unused-vars */
import {
login,
} from '@/api/user';
import router from '@/router';
export default {
namespaced: true,
state: {
isLogin: false,
// userInfo: sessionStorage.getItem('userInfo') ?? {},
userInfo: sessionStorage.getItem('userInfo') ? JSON.parse(sessionStorage.getItem('userInfo')) : {},
walletInfo: {},
checkLoginDialog: false,
loginDialog: false,
loginLoading: false,
registerDialog: false,
registerLoading: false,
updateLoading: false,
walletLoading: false,
uploadWalletLoading: false,
bindMobile: false,
},
mutations: {
SET_REGISTER_DIALOG(state, val) {
state.registerDialog = val;
},
SET_CHECK_LOGIN_DIALOG(state, val) {
state.checkLoginDialog = val;
},
SET_LOGIN_DIALOG(state, val) {
state.loginDialog = val;
},
SET_USER_INFO(state, val) {
state.isLogin = !!Object.keys(val).length;
state.userInfo = JSON.parse(sessionStorage.getItem('userInfo'));
},
SET_WALLET_INFO(state, val) {
state.walletInfo = val;
},
SET_LOADING(state, { key, val }) {
state[key] = val;
},
SET_BINDMOBILE_DIALOG(state, val) {
state.bindMobile = val;
},
},
actions: {
async register({ commit, dispatch }, data) {
const {
name,
data: { clause, ...registerInfo },
} = data;
commit('SET_LOADING', { key: 'registerLoading', val: true });
const fn = { account: register, quick: quickregister };
const res = await fn[name]({ ...registerInfo, domain: document.domain });
const { repassword, ...loginInfo } = registerInfo;
const { username, password } = res;
const loginParams = password ? { username, password } : loginInfo;
commit('SET_LOADING', { key: 'registerLoading', val: false });
dispatch('login', { ...loginParams, action: name }).then(() => {
sessionStorage.setItem('pwd', loginParams.password);
return Promise.resolve('success');
});
router.push({
name: 'registerSuccess',
query: {
...res,
name,
},
});
return res;
},
async login({ commit, dispatch }, { name, ...data }) {
commit('SET_LOADING', { key: 'loginLoading', val: true });
try {
const res = await login(data);
console.log('121312', res);
const { token } = res;
sessionStorage.setItem('token', token);
sessionStorage.setItem('userInfo', JSON.stringify(res));
commit('SET_USER_INFO', res);
return true;
} catch (err) {
commit('SET_LOADING', { key: 'loginLoading', val: false });
return false;
}
},
async mobileLogin({ commit, dispatch }, data) {
commit('SET_LOADING', { key: 'loginLoading', val: true });
try {
const res = await mobileLogin(data);
const { token } = res;
localStorage.setItem('token', token);
dispatch('getWalletInfo');
dispatch('getUserInfo');
return true;
} catch (err) {
commit('SET_LOADING', { key: 'loginLoading', val: false });
return false;
}
},
async getUserInfo({ commit }, fn) {
if (!fn) commit('SET_LOADING', { key: 'loginLoading', val: true });
commit('SET_USER_INFO');
commit('SET_LOGIN_DIALOG', false);
fn?.();
if (!fn) commit('SET_LOADING', { key: 'loginLoading', val: false });
return Promise.resolve('success');
},
updateUserInfo({ commit }, data) {
console.log(data)
sessionStorage.setItem('token', data.token);
sessionStorage.setItem('userInfo', JSON.stringify(data));
commit('SET_USER_INFO', data);
},
getWalletInfo({ state, commit }) {
if (state.walletLoading) {
return;
}
const isRefresh = !!Object.keys(state.walletInfo).length;
commit('SET_LOADING', {
key: 'walletLoading',
val: true,
});
wallet()
.then((res) => {
commit('SET_WALLET_INFO', res);
})
.finally(() => {
commit('SET_LOADING', {
key: 'walletLoading',
val: false,
});
});
},
logout({ commit }) {
localStorage.clear();
sessionStorage.clear();
commit('SET_USER_INFO', {});
commit('SET_LOGIN_DIALOG', false);
commit('SET_LOADING', { key: 'loginLoading', val: false });
return Promise.resolve();
},
},
};

76
src/uni.scss Normal file
View File

@ -0,0 +1,76 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
/* 文字基本颜色 */
$uni-text-color:#333;//基本色
$uni-text-color-inverse:#fff;//反色
$uni-text-color-grey:#999;//辅助灰色如加载更多的提示信息
$uni-text-color-placeholder: #808080;
$uni-text-color-disable:#c0c0c0;
/* 背景颜色 */
$uni-bg-color:#ffffff;
$uni-bg-color-grey:#f8f8f8;
$uni-bg-color-hover:#f1f1f1;//点击状态颜色
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
/* 边框颜色 */
$uni-border-color:#c8c7cc;
/* 尺寸变量 */
/* 文字尺寸 */
$uni-font-size-sm:24rpx;
$uni-font-size-base:28rpx;
$uni-font-size-lg:32rpx;
/* 图片尺寸 */
$uni-img-size-sm:40rpx;
$uni-img-size-base:52rpx;
$uni-img-size-lg:80rpx;
/* Border Radius */
$uni-border-radius-sm: 4rpx;
$uni-border-radius-base: 6rpx;
$uni-border-radius-lg: 12rpx;
$uni-border-radius-circle: 50%;
/* 水平间距 */
$uni-spacing-row-sm: 10px;
$uni-spacing-row-base: 20rpx;
$uni-spacing-row-lg: 30rpx;
/* 垂直间距 */
$uni-spacing-col-sm: 8rpx;
$uni-spacing-col-base: 16rpx;
$uni-spacing-col-lg: 24rpx;
/* 透明度 */
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
/* 文章场景相关 */
$uni-color-title: #2C405A; // 文章标题颜色
$uni-font-size-title:40rpx;
$uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:36rpx;
$uni-color-paragraph: #3F536E; // 文章段落颜色
$uni-font-size-paragraph:30rpx;

45
src/utils/MessageQueue.js Normal file
View File

@ -0,0 +1,45 @@
import { Toast } from 'vant';
export default class MessageQueue {
constructor(queue = [], duration = 2000) {
this.queue = queue;
this.duration = duration;
this.queueing = false;
}
pushQueue(data) {
this.queue.push(data);
this.update();
}
update() {
console.log('update');
if (!this.queueing) {
this.next();
}
}
clear() {
this.queue = [];
}
next() {
if (this.queue.length) {
this.queueing = true;
const data = this.queue.shift();
Toast.fail({
duration: this.duration,
message: data.msg,
onClose: () => {
if (data.code === -999 || data.code === -998) {
this.clear();
} else {
this.next();
}
},
});
} else {
this.queueing = false;
}
}
}

3
src/utils/expCommon.js Normal file
View File

@ -0,0 +1,3 @@
export const idCardPattern = /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}([0-9]|x|X)$/
export const regPhone = /^1[3456789]{1}\d{9}$/;

46
src/utils/formatDate.js Normal file
View File

@ -0,0 +1,46 @@
const englishMonthList = [
'一月',
'二月',
'三月',
'四月',
'五月',
'六月',
'七月',
'八月',
'九月',
'十月',
'十一月',
'十二月'
];
const getNewDate = (date) => {
let year = date.getFullYear();
let month = date.getMonth();
let day = date.getDate();
return { year, month, day };
}
const getDate = (year, month, day) => {
return new Date(year, month, day);
}
const englishMonth = (month) => {
let engMonth;
englishMonthList.map(() => {
engMonth = englishMonthList[month]
});
return engMonth
}
const formatDate = (date) => {
date = Number(date);
return date < 10 ? `0${date}` : date;
}
export {
getNewDate,
getDate,
englishMonth,
formatDate
}

56
src/utils/getSrc.js Normal file
View File

@ -0,0 +1,56 @@
import { reactive } from 'vue';
const ImageMap = reactive({});
const allImages = import.meta.glob(`/src/assets/{images,dark}/**/*.{png,jpg,svg,gif,webp}`);
const findSrc = (path, defaultPath) => {
if (!defaultPath.includes('/')) {
let [start, end] = path?.split('.') ?? [];
start = start?.split('/') ?? [];
start.pop();
defaultPath = `${start.join('/')}/${defaultPath}.${end}`;
} else if (path.includes('/dark/')) {
defaultPath = defaultPath.replace('/images/', '/dark/');
}
// console.log('~~~~~~~~~~~ path', path);
const targetPath = allImages[path] ? path : defaultPath;
if (allImages[targetPath]) {
if (!ImageMap[targetPath]) {
ImageMap[targetPath] = '';
allImages[targetPath]()
.then((result) => {
ImageMap[targetPath] = result.default;
});
}
} else {
return null;
}
// if (!ImageMap[targetPath]) {
// ImageMap[targetPath] = '';
//
// if (allImages[path]) {
// allImages[path]()
// .then((result) => {
// ImageMap[path] = result.default;
// });
// } else if (allImages[defaultPath]) {
// console.log('defaultPath', defaultPath);
// allImages[defaultPath]()
// .then((result) => {
// ImageMap[path] = result.default;
// });
// }
// }
return ImageMap[path] || ImageMap[defaultPath];
};
export const $getSrc = ($store, path, defaultPath = '') => {
const { darkTheme } = $store.state.app;
if (darkTheme === 'dark') {
const target = findSrc(path.replace('/images/', '/dark/'), defaultPath);
if (target !== null) return target;
}
return findSrc(path, defaultPath);
};

18
src/utils/globalFunc.js Normal file
View File

@ -0,0 +1,18 @@
// /* eslint-disable no-param-reassign */
import store from '@/store';
// import router from '@/router';
// import { openGame } from '@/api/app';
// import { Toast } from 'vant';
// import { ref } from 'vue';
export default (app) => {
app.config.globalProperties.$getPermission = (val) => {
// console.log('55555', val);
// console.log('124564', store.state.user.userInfo);
if (store.state.user.userInfo.resources.includes(val)) {
return true
} else {
return false
}
};
};

82
src/utils/hooks.js Normal file
View File

@ -0,0 +1,82 @@
/* eslint-disable import/prefer-default-export */
import {
reactive,
getCurrentInstance,
nextTick,
inject,
watch,
onBeforeMount,
} from 'vue'; // expose public api
export function useExpose(apis) {
const instance = getCurrentInstance();
if (instance) {
Object.assign(instance.proxy, apis);
}
}
/**
* @description: timeout定时器
* @param {Function} fn 回调方法
* @param {Number} time 执行间隔
* @param {Object} options 配置项
* @param {Boolean} options.manual 是否手动执行默认false
* @return {Function} 返回可终止定时器方法
*/
export const useTimeout = (fn, time, options = { manual: false }) => {
let timer = null;
const run = (...args) => {
timer = setTimeout(() => fn.call(null, ...args), time);
};
if (!options.manual) run();
const stop = () => clearTimeout(timer);
onBeforeMount(stop);
return {
run,
stop,
};
};
export function usePopupState() {
const state = reactive({
show: false,
});
const toggle = (show) => {
state.show = show;
};
const open = (props) => {
Object.assign(state, props);
nextTick(() => toggle(true));
};
const close = () => toggle(false);
useExpose({
open,
close,
toggle,
});
return {
open,
close,
state,
toggle,
};
}
export function useDicts(type, callback) {
console.log('useDicts', type);
const $store = inject('store');
const { dicts } = $store.state.app;
if (!dicts[type]?.length && !dicts[`${type}Loading`]) {
$store.dispatch('app/getDict', [type]);
}
watch(dicts, () => {
if (callback && dicts[type]) {
callback(dicts[type]);
}
});
}

170
src/utils/index.js Normal file
View File

@ -0,0 +1,170 @@
// const images = import.meta.globEager(`/src/assets/*/**/*.{png,svg,jpg,gif}`);
const allDialog = import.meta.glob('/src/components/{Dialog,Popup}/*.vue');
export const loadModule = async (modulePath) => {
try {
return await allDialog[modulePath]();
} catch (e) {
throw new ImportError(`找不到模块路径 ${modulePath}`);
}
};
export function isFunction(functionToCheck) {
return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]';
}
// 代理密码校验
export function testPassword(value, maxLength = 20) {
const reg = new RegExp(`^[0-9a-zA-Z]{6,${maxLength}}$`);
return reg.test(value);
}
export function shuffle(array) {
let currentIndex = array.length;
let randomIndex;
// While there remain elements to shuffle...
while (currentIndex !== 0) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
// eslint-disable-next-line no-unexpected-multiline
const current = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = current;
// [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
}
return array;
}
export function validateEmail(email) {
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
export const priceFormat = (price) => (price.toString().indexOf('.') !== -1
? `${price
.toString()
.split('.')[0]
.replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')}.00`
: `${price.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')}.00`);
export const timeFilter = (str) => str.substr(0, 10);
export function dateFormat(formatString, dateValue) {
const date = new Date(dateValue);
let fmt = formatString;
let ret;
const opt = {
'Y+': date.getFullYear().toString(), // 年
'm+': (date.getMonth() + 1).toString(), // 月
'd+': date.getDate().toString(), // 日
'H+': date.getHours().toString(), // 时
'M+': date.getMinutes().toString(), // 分
'S+': date.getSeconds().toString(), // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
Object.keys(opt).forEach((k) => {
ret = new RegExp(`(${k})`).exec(fmt);
if (ret) {
fmt = fmt.replace(
ret[1],
ret[1].length === 1 ? opt[k] : opt[k].padStart(ret[1].length, '0'),
);
}
});
return fmt;
}
export const download = (url, name) => {
const a = document.createElement('a');
const event = new MouseEvent('click');
a.download = `${name || new Date().getTime()}.png`;
a.href = url;
a.dispatchEvent(event);
};
export function getDate(dates) {
const dd = new Date();
const n = dates || 0;
dd.setDate(dd.getDate() + n);
const y = dd.getFullYear();
let m = dd.getMonth() + 1;
let d = dd.getDate();
m = m < 10 ? `0${m}` : m;
d = d < 10 ? `0${d}` : d;
const day = `${y}-${m}-${d}`;
return day;
}
/*
*getMonth(type,months) //type为字符串类型有两种选择"s"代表开始,"e"代表结束months为数字类型不传或0代表本月-1代表上月1代表下月
*getMonth("s",1) //得到下月第一天的yyyy-mm-dd格式日期
*getMonth("e",1) //得到下月最后一天的yyyy-mm-dd格式日期
*/
export function getMonth(type, monthArg) {
const d = new Date();
let year = d.getFullYear();
let months = monthArg;
let month = d.getMonth() + 1;
if (Math.abs(months) > 12) {
months %= 12;
}
if (months !== 0) {
if (month + months > 12) {
year += 1;
month = (month + months) % 12;
} else if (month + months < 1) {
year -= 1;
month = 12 + month + months;
} else {
month += months;
}
}
month = month < 10 ? `0${month}` : month;
const firstDay = `${year}-${month}-01`;
let lastDay = '';
if (
month === '01'
|| month === '03'
|| month === '05'
|| month === '07'
|| month === '08'
|| month === '10'
|| month === '12'
) {
lastDay = `${year}-${month}-${31}`;
} else if (month === '02') {
if (
(year % 4 === 0 && year % 100 !== 0)
|| (year % 100 === 0 && year % 400 === 0)
) {
lastDay = `${year}-${month}-${29}`;
} else {
lastDay = `${year}-${month}-${28}`;
}
} else {
lastDay = `${year}-${month}-${30}`;
}
let day = '';
if (type === 's') {
day = firstDay;
} else {
day = lastDay;
}
return day;
}
// 密码校验
export function formatMobile(value) {
return value?.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2")
}
export function formatIdCard(value) {
return value?.replace(/^(.{6})(?:\d+)(.{4})$/, "$1********$2")
}

View File

@ -0,0 +1,17 @@
/* eslint-disable import/prefer-default-export */
import { createApp } from 'vue';
export function mountComponent(RootComponent) {
const app = createApp(RootComponent);
const root = document.createElement('div');
document.body.appendChild(root);
return {
instance: app.mount(root),
unmount() {
app.unmount();
document.body.removeChild(root);
},
};
}

60
src/utils/request.js Normal file
View File

@ -0,0 +1,60 @@
import axios from 'axios'
import settle from 'axios/lib/core/settle'
let baseURL = 'http://apiv2.yksafety.net/ssp/v2'
const instance = axios.create({
baseURL,
timeout : 6000,
responseType: 'json',
})
// 请求拦截
instance.interceptors.request.use(
config => {
// return config
return new Promise( ( resolve , reject ) => {
// let settle = require('/axios/lib/core/settle')
uni.request({
method : config.type.toUpperCase(),
url : config.baseURL + config.path,
header : config.headers,
data : config.data,
dataType : config.dataType,
responseType : config.responseType,
complete : function complete( response ) {
response = {
data : response.data,
status : response.statusCode,
errMsg : response.errMsg,
header : response.header,
config : config
};
settle( resolve , reject , response );
},
});
})
},
error => {
return Promise.reject( error );
}
);
// 响应拦截
instance.interceptors.response.use( res => {
console.log('res',res)
if ( res.status == 200 ){
return res;
} else {
return Promise.reject( res.data.msg );
}
});
// 自定义适配器 适配uniapp语法
// axios.defaults.adapter = function( config ) {
// console.log('config',config)
// }
export default function request(url, params) {
console.log('url', url);
return instance(url, params);
}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,70 @@
import { VantComponent } from '../common/component';
import { button } from '../mixins/button';
VantComponent({
mixins: [button],
props: {
show: Boolean,
title: String,
cancelText: String,
description: String,
round: {
type: Boolean,
value: true,
},
zIndex: {
type: Number,
value: 100,
},
actions: {
type: Array,
value: [],
},
overlay: {
type: Boolean,
value: true,
},
closeOnClickOverlay: {
type: Boolean,
value: true,
},
closeOnClickAction: {
type: Boolean,
value: true,
},
safeAreaInsetBottom: {
type: Boolean,
value: true,
},
},
methods: {
onSelect(event) {
const { index } = event.currentTarget.dataset;
const { actions, closeOnClickAction, canIUseGetUserProfile } = this.data;
const item = actions[index];
if (item) {
this.$emit('select', item);
if (closeOnClickAction) {
this.onClose();
}
if (item.openType === 'getUserInfo' && canIUseGetUserProfile) {
wx.getUserProfile({
desc: item.getUserProfileDesc || ' ',
complete: (userProfile) => {
this.$emit('getuserinfo', userProfile);
},
});
}
}
},
onCancel() {
this.$emit('cancel');
},
onClose() {
this.$emit('close');
},
onClickOverlay() {
this.$emit('click-overlay');
this.onClose();
},
},
});

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-popup": "../popup/index",
"van-loading": "../loading/index"
}
}

View File

@ -0,0 +1,69 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<van-popup
show="{{ show }}"
position="bottom"
round="{{ round }}"
z-index="{{ zIndex }}"
overlay="{{ overlay }}"
custom-class="van-action-sheet"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
bind:close="onClickOverlay"
>
<view wx:if="{{ title }}" class="van-action-sheet__header">
{{ title }}
<van-icon
name="cross"
custom-class="van-action-sheet__close"
bind:click="onClose"
/>
</view>
<view wx:if="{{ description }}" class="van-action-sheet__description van-hairline--bottom">
{{ description }}
</view>
<view wx:if="{{ actions && actions.length }}">
<!-- button外包一层view防止actions动态变化导致渲染时button被打散 -->
<button
wx:for="{{ actions }}"
wx:key="index"
open-type="{{ item.disabled || item.loading || (canIUseGetUserProfile && item.openType === 'getUserInfo') ? '' : item.openType }}"
style="{{ item.color ? 'color: ' + item.color : '' }}"
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} {{ item.className || '' }}"
hover-class="van-action-sheet__item--hover"
data-index="{{ index }}"
bindtap="{{ item.disabled || item.loading ? '' : 'onSelect' }}"
bindgetuserinfo="onGetUserInfo"
bindcontact="onContact"
bindgetphonenumber="onGetPhoneNumber"
binderror="onError"
bindlaunchapp="onLaunchApp"
bindopensetting="onOpenSetting"
lang="{{ lang }}"
session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}"
>
<block wx:if="{{ !item.loading }}">
{{ item.name }}
<view wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</view>
</block>
<van-loading wx:else custom-class="van-action-sheet__loading" size="22px" />
</button>
</view>
<slot />
<block wx:if="{{ cancelText }}">
<view class="van-action-sheet__gap" />
<view
class="van-action-sheet__cancel"
hover-class="van-action-sheet__cancel--hover"
hover-stay-time="70"
bind:tap="onCancel"
>
{{ cancelText }}
</view>
</block>
</van-popup>

View File

@ -0,0 +1 @@
@import '../common/index.wxss';.van-action-sheet{color:var(--action-sheet-item-text-color,#323233);max-height:var(--action-sheet-max-height,90%)!important}.van-action-sheet__cancel,.van-action-sheet__item{background-color:var(--action-sheet-item-background,#fff);font-size:var(--action-sheet-item-font-size,16px);line-height:var(--action-sheet-item-line-height,22px);padding:14px 16px;text-align:center}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{background-color:var(--action-sheet-cancel-padding-color,#f7f8fa);display:block;height:var(--action-sheet-cancel-padding-top,8px)}.van-action-sheet__item--disabled{color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{color:var(--action-sheet-subname-color,#969799);font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.van-action-sheet__header{font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--font-weight-bold,500);line-height:var(--action-sheet-header-height,48px);text-align:center}.van-action-sheet__description{color:var(--action-sheet-description-color,#969799);font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.van-action-sheet__close{color:var(--action-sheet-close-icon-color,#c8c9cc);font-size:var(--action-sheet-close-icon-size,22px)!important;line-height:inherit!important;padding:var(--action-sheet-close-icon-padding,0 16px);position:absolute!important;right:0;top:0}.van-action-sheet__loading{display:flex!important}

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,220 @@
import { VantComponent } from '../common/component';
import { pickerProps } from '../picker/shared';
import { requestAnimationFrame } from '../common/utils';
const EMPTY_CODE = '000000';
VantComponent({
classes: ['active-class', 'toolbar-class', 'column-class'],
props: Object.assign(Object.assign({}, pickerProps), { showToolbar: {
type: Boolean,
value: true,
}, value: {
type: String,
observer(value) {
this.code = value;
this.setValues();
},
}, areaList: {
type: Object,
value: {},
observer: 'setValues',
}, columnsNum: {
type: null,
value: 3,
}, columnsPlaceholder: {
type: Array,
observer(val) {
this.setData({
typeToColumnsPlaceholder: {
province: val[0] || '',
city: val[1] || '',
county: val[2] || '',
},
});
},
} }),
data: {
columns: [{ values: [] }, { values: [] }, { values: [] }],
typeToColumnsPlaceholder: {},
},
mounted() {
requestAnimationFrame(() => {
this.setValues();
});
},
methods: {
getPicker() {
if (this.picker == null) {
this.picker = this.selectComponent('.van-area__picker');
}
return this.picker;
},
onCancel(event) {
this.emit('cancel', event.detail);
},
onConfirm(event) {
const { index } = event.detail;
let { value } = event.detail;
value = this.parseValues(value);
this.emit('confirm', { value, index });
},
emit(type, detail) {
detail.values = detail.value;
delete detail.value;
this.$emit(type, detail);
},
parseValues(values) {
const { columnsPlaceholder } = this.data;
return values.map((value, index) => {
if (value &&
(!value.code || value.name === columnsPlaceholder[index])) {
return Object.assign(Object.assign({}, value), { code: '', name: '' });
}
return value;
});
},
onChange(event) {
var _a;
const { index, picker, value } = event.detail;
this.code = value[index].code;
(_a = this.setValues()) === null || _a === void 0 ? void 0 : _a.then(() => {
this.$emit('change', {
picker,
values: this.parseValues(picker.getValues()),
index,
});
});
},
getConfig(type) {
const { areaList } = this.data;
return (areaList && areaList[`${type}_list`]) || {};
},
getList(type, code) {
if (type !== 'province' && !code) {
return [];
}
const { typeToColumnsPlaceholder } = this.data;
const list = this.getConfig(type);
let result = Object.keys(list).map((code) => ({
code,
name: list[code],
}));
if (code != null) {
// oversea code
if (code[0] === '9' && type === 'city') {
code = '9';
}
result = result.filter((item) => item.code.indexOf(code) === 0);
}
if (typeToColumnsPlaceholder[type] && result.length) {
// set columns placeholder
const codeFill = type === 'province'
? ''
: type === 'city'
? EMPTY_CODE.slice(2, 4)
: EMPTY_CODE.slice(4, 6);
result.unshift({
code: `${code}${codeFill}`,
name: typeToColumnsPlaceholder[type],
});
}
return result;
},
getIndex(type, code) {
let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
const list = this.getList(type, code.slice(0, compareNum - 2));
// oversea code
if (code[0] === '9' && type === 'province') {
compareNum = 1;
}
code = code.slice(0, compareNum);
for (let i = 0; i < list.length; i++) {
if (list[i].code.slice(0, compareNum) === code) {
return i;
}
}
return 0;
},
setValues() {
const picker = this.getPicker();
if (!picker) {
return;
}
let code = this.code || this.getDefaultCode();
const provinceList = this.getList('province');
const cityList = this.getList('city', code.slice(0, 2));
const stack = [];
const indexes = [];
const { columnsNum } = this.data;
if (columnsNum >= 1) {
stack.push(picker.setColumnValues(0, provinceList, false));
indexes.push(this.getIndex('province', code));
}
if (columnsNum >= 2) {
stack.push(picker.setColumnValues(1, cityList, false));
indexes.push(this.getIndex('city', code));
if (cityList.length && code.slice(2, 4) === '00') {
[{ code }] = cityList;
}
}
if (columnsNum === 3) {
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
indexes.push(this.getIndex('county', code));
}
return Promise.all(stack)
.catch(() => { })
.then(() => picker.setIndexes(indexes))
.catch(() => { });
},
getDefaultCode() {
const { columnsPlaceholder } = this.data;
if (columnsPlaceholder.length) {
return EMPTY_CODE;
}
const countyCodes = Object.keys(this.getConfig('county'));
if (countyCodes[0]) {
return countyCodes[0];
}
const cityCodes = Object.keys(this.getConfig('city'));
if (cityCodes[0]) {
return cityCodes[0];
}
return '';
},
getValues() {
const picker = this.getPicker();
if (!picker) {
return [];
}
return this.parseValues(picker.getValues().filter((value) => !!value));
},
getDetail() {
const values = this.getValues();
const area = {
code: '',
country: '',
province: '',
city: '',
county: '',
};
if (!values.length) {
return area;
}
const names = values.map((item) => item.name);
area.code = values[values.length - 1].code;
if (area.code[0] === '9') {
area.country = names[1] || '';
area.province = names[2] || '';
}
else {
area.province = names[0] || '';
area.city = names[1] || '';
area.county = names[2] || '';
}
return area;
},
reset(code) {
this.code = code || '';
return this.setValues();
},
},
});

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-picker": "../picker/index"
}
}

View File

@ -0,0 +1,20 @@
<wxs src="./index.wxs" module="computed" />
<van-picker
class="van-area__picker"
active-class="active-class"
toolbar-class="toolbar-class"
column-class="column-class"
show-toolbar="{{ showToolbar }}"
value-key="name"
title="{{ title }}"
loading="{{ loading }}"
columns="{{ computed.displayColumns(columns, columnsNum) }}"
item-height="{{ itemHeight }}"
visible-item-count="{{ visibleItemCount }}"
cancel-button-text="{{ cancelButtonText }}"
confirm-button-text="{{ confirmButtonText }}"
bind:change="onChange"
bind:confirm="onConfirm"
bind:cancel="onCancel"
/>

View File

@ -0,0 +1,8 @@
/* eslint-disable */
function displayColumns(columns, columnsNum) {
return columns.slice(0, +columnsNum);
}
module.exports = {
displayColumns: displayColumns,
};

View File

@ -0,0 +1 @@
@import '../common/index.wxss';

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,64 @@
import { VantComponent } from '../common/component';
import { button } from '../mixins/button';
import { canIUseFormFieldButton } from '../common/version';
const mixins = [button];
if (canIUseFormFieldButton()) {
mixins.push('wx://form-field-button');
}
VantComponent({
mixins,
classes: ['hover-class', 'loading-class'],
data: {
baseStyle: '',
},
props: {
formType: String,
icon: String,
classPrefix: {
type: String,
value: 'van-icon',
},
plain: Boolean,
block: Boolean,
round: Boolean,
square: Boolean,
loading: Boolean,
hairline: Boolean,
disabled: Boolean,
loadingText: String,
customStyle: String,
loadingType: {
type: String,
value: 'circular',
},
type: {
type: String,
value: 'default',
},
dataset: null,
size: {
type: String,
value: 'normal',
},
loadingSize: {
type: String,
value: '20px',
},
color: String,
},
methods: {
onClick(event) {
this.$emit('click', event);
const { canIUseGetUserProfile, openType, getUserProfileDesc, lang, } = this.data;
if (openType === 'getUserInfo' && canIUseGetUserProfile) {
wx.getUserProfile({
desc: getUserProfileDesc || ' ',
lang: lang || 'en',
complete: (userProfile) => {
this.$emit('getuserinfo', userProfile);
},
});
}
},
},
});

View File

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-loading": "../loading/index"
}
}

Some files were not shown because too many files have changed in this diff Show More