Browse Source

初始化工程

dev-msy
庄锐波 6 months ago
parent
commit
a4858d8acf
  1. BIN
      zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/assets/logo.png
  2. 44
      zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/components/enterprise/footerNav.vue
  3. 4051
      zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/area.js
  4. 97
      zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/dictUtil.js
  5. 59
      zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/fileUpload.js
  6. 19
      zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/siqUtil.js
  7. 11
      zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/timeUtil.js
  8. 8
      zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/mockHome.vue

BIN
zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/assets/logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

44
zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/components/enterprise/footerNav.vue

@ -1,44 +0,0 @@
<template>
<div class="footer_nav">
<van-tabbar class="footer-bar" v-model="data.footerActive" :route="true" safe-area-inset-bottom>
<van-tabbar-item name="Home" replace icon="wap-home" to="/enterprise/enterpriseHome">{{
$t("common.lang_home")
}}</van-tabbar-item>
</van-tabbar>
</div>
</template>
<script setup name="footerNav">
let data = reactive({
footerActive: "Home",
});
</script>
<style lang="less" scoped>
.footer_body {
height: 1.5rem;
}
.footer_nav {
height: 1.5rem;
background-color: #fff;
box-shadow: 0 0 0.15rem #d7d7d7;
.footer-bar {
position: absolute;
bottom: 0.2rem;
}
}
.van-hairline--top-bottom:after,
.van-hairline-unset--top-bottom:after {
border: 0;
}
:deep(.van-tabbar-item) {
color: #bbb;
}
:deep(.van-tabbar-item--active) {
color: #1989fa;
}
</style>

4051
zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/area.js

File diff suppressed because it is too large

97
zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/dictUtil.js

@ -1,97 +0,0 @@
/**
* 字典工具 —— 通用字典加载、缓存、翻译
* 使用方式:
* import { loadDict, getDictText, getDictColumns } from '@/util/dictUtil';
* loadDict('caseType'); // 加载字典(自动缓存)
* getDictText('caseType', 0); // 翻译 value → text
* getDictColumns('caseType'); // 获取 [{text, value}] 用于 van-picker
*/
import { queryDict } from '@/api/enterprise';
// 内存缓存 { dictType → [{text, value}] }
const dictStore = {};
// sessionStorage key 生成
const cacheKey = (dictType) => `DICT_CACHE::${dictType}`;
/**
* 解析接口响应,兼容多种结构
*/
const parseRows = (res) => {
if (Array.isArray(res)) return res;
if (res && Array.isArray(res.rows)) return res.rows;
if (res && Array.isArray(res.data)) return res.data;
if (res && res.data && Array.isArray(res.data.rows)) return res.data.rows;
return [];
};
/**
* 标准化为 [{text, value}]
*/
const normalizeColumns = (rows) => {
return rows.map(item => ({
text: item.dictLabel || item.label || item.name || '',
value: item.dictValue || item.value || item.code || ''
})).filter(c => c.text);
};
/**
* 加载指定字典类型(含 sessionStorage 缓存)
* @param {string} dictType 字典类型
* @param {Function} [onSuccess] 可选回调,接收 columns [{text, value}]
* @param {Function} [onError] 可选失败回调
*/
export const loadDict = (dictType, onSuccess, onError) => {
// 内存命中直接返回
if (dictStore[dictType] && dictStore[dictType].length > 0) {
onSuccess && onSuccess(dictStore[dictType]);
return;
}
// sessionStorage 命中
const cached = sessionStorage.getItem(cacheKey(dictType));
if (cached) {
try {
const columns = JSON.parse(cached);
if (Array.isArray(columns) && columns.length > 0) {
dictStore[dictType] = columns;
onSuccess && onSuccess(columns);
return;
}
} catch (e) { /* 解析失败继续走接口 */ }
}
// 请求接口
queryDict({ dictType }, (res) => {
const columns = normalizeColumns(parseRows(res));
dictStore[dictType] = columns;
if (columns.length > 0) {
sessionStorage.setItem(cacheKey(dictType), JSON.stringify(columns));
}
onSuccess && onSuccess(columns);
}, (err) => {
onError && onError(err);
});
};
/**
* 获取字典翻译文本
* @param {string} dictType 字典类型
* @param {*} val 字典值
* @param {string} [fallback='-'] 未匹配时的降级显示
* @returns {string}
*/
export const getDictText = (dictType, val, fallback) => {
if (val === undefined || val === null || val === '') return fallback !== undefined ? fallback : '-';
const columns = dictStore[dictType] || [];
const key = String(val);
const found = columns.find(c => String(c.value) === key);
return found ? found.text : (fallback !== undefined ? fallback : val);
};
/**
* 获取字典列表(用于 van-picker :columns)
* @param {string} dictType
* @returns {Array} [{text, value}]
*/
export const getDictColumns = (dictType) => {
return dictStore[dictType] || [];
};

59
zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/fileUpload.js

@ -1,59 +0,0 @@
import {_form, _post} from '../http/index'
import { baseUrl } from "../config/env";
import axios from 'axios';
const http = axios.create({
traditional: true,
contentType : "application/json",
timeout: 1000 * 500000, // 1 秒
});
const uploadFile = (files,callback) => {
files.status = "uploading";
files.message = "上传中...";
// 需要使用 FormData 进行文件上传
let form = new FormData();
form.append("file", files.file);
axios({
method: "post",
url: baseUrl+ "/app-enf/common/file/upload",
data: form,
headers: {
'Content-Type': 'multipart/form-data'
}
})
.then((res) => {
files.status = "done";
files.message = "上传成功";
callback && callback(res);
})
.catch((err) => {
files.status = "failed";
files.message = "上传失败";
console.log(err);
});
}
const nameCorrect=(name)=>{
//筛选出两个字人名
let name1=[{}];
name1=String(name).split(" ");
// console.log(name1);
if(name1[0].length==2){
if(name1.length>1){
return (String(name1[0]).substr(0,1)+"\u3000"+String(name1[0]).substr(1)+" "+name1[1]);
}else{
return (String(name1[0]).substr(0,1)+"\u3000"+String(name1[0]).substr(1));
}
}else{
return name;
}
}
// 手机号加密
const encryptPhone=(num)=>{
if(!/^\d{11}$/.test(num))return num;
const al= num.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
return al;
}
export{uploadFile,nameCorrect,encryptPhone};

19
zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/siqUtil.js

@ -1,19 +0,0 @@
const access_key = '6374106c5eb449a4ad6c2430f30796e6';
const access_secret = '434fec85aa5846e88bbeb8fac6cf6d7f';
// generateRandomNumber()
const nonce = "887954";
const timestamp = `${Date.now()}`;
const str = [access_secret, nonce, timestamp]
.sort()
.reduce((str, item) => str += item, '');
// 最终还需要转成全小写
const signature = sha1(str).toString().toLowerCase();
var siqObject = {
access_key: access_key,
nonce: nonce,
timestamp: timestamp,
signature: signature,
};

11
zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/util/timeUtil.js

@ -1,11 +0,0 @@
const getYear = () =>{
var date = new Date();
return date.getFullYear();
}
const getMouth = () =>{
var date = new Date();
var month = date.getMonth();
return month + 1;
}
export { getYear, getMouth};

8
zdxt-web-client/zdxt-efcode-nos-enterprise-app/src/views/enterprise/nos/mockHome.vue

@ -63,10 +63,6 @@
</div> </div>
</div> </div>
<!-- 底部导航栏 -->
<div class="footer_body">
<footer-nav></footer-nav>
</div>
</div> </div>
</template> </template>
@ -336,8 +332,4 @@ const toEnforcementCaseInfoView = () => {
background-size: 100% 100%; background-size: 100% 100%;
} }
/* ===== 底部导航 ===== */
.footer_body {
flex-shrink: 0;
}
</style> </style>

Loading…
Cancel
Save