flx:新增头部返回指定路由
This commit is contained in:
parent
7cdec9c568
commit
11a9766ad6
13
App.vue
13
App.vue
@ -20,9 +20,16 @@ export default {
|
|||||||
|
|
||||||
// console.log(JSON.stringify(arg), "登录用户");
|
// console.log(JSON.stringify(arg), "登录用户");
|
||||||
if (arg.data.page) {
|
if (arg.data.page) {
|
||||||
uni.reLaunch({
|
if(arg.data.current) {
|
||||||
url: arg.data.page + "?current=" + arg.data.current,
|
uni.reLaunch({
|
||||||
});
|
url: arg.data.page + "?current=" + arg.data.current,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: arg.data.page,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: "/pages/submit/submit",
|
url: "/pages/submit/submit",
|
||||||
|
|||||||
@ -5,7 +5,10 @@
|
|||||||
<text class="w-click-input-value">{{_value}}</text>
|
<text class="w-click-input-value">{{_value}}</text>
|
||||||
</slot>
|
</slot>
|
||||||
<text v-else style="color: #999;" class="w-click-input-value">{{props.placeholder}}</text>
|
<text v-else style="color: #999;" class="w-click-input-value">{{props.placeholder}}</text>
|
||||||
<uni-icons v-show="!disabled" v-if="!props.readonly" type="right" :size="20" color="#999"></uni-icons>
|
<label v-if="isColse && !props.readonly" @click.stop="onClose">
|
||||||
|
<uni-icons v-show="!disabled" type="close" :size="20" color="#999"></uni-icons>
|
||||||
|
</label>
|
||||||
|
<uni-icons v-show="!disabled" v-if="!props.readonly && !isColse" type="right" :size="20" color="#999"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -29,7 +32,11 @@
|
|||||||
//自定义取名函数
|
//自定义取名函数
|
||||||
valueFunc: Function,
|
valueFunc: Function,
|
||||||
placeholder: String,
|
placeholder: String,
|
||||||
disabled: Boolean
|
disabled: Boolean,
|
||||||
|
isColse: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const showVal = computed(() => {
|
const showVal = computed(() => {
|
||||||
@ -54,7 +61,9 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const emits = defineEmits(['update:modelValue'])
|
const emits = defineEmits(['update:modelValue'])
|
||||||
|
const onClose = () => {
|
||||||
|
emits('customEvent')
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
<uni-search-bar v-if="isSearch" bgColor="#fff" v-model="searchValue" class="search" radius="5"
|
<uni-search-bar v-if="isSearch" bgColor="#fff" v-model="searchValue" class="search" radius="5"
|
||||||
placeholder="请输入" clearButton="auto" cancelButton="none" @input="searchChange" />
|
placeholder="请输入" clearButton="auto" cancelButton="none" @input="searchChange" />
|
||||||
|
|
||||||
<click-input @click="isSearchFn()" :value="(modelValue || []).length > 0 ? dataOptions[index]:null"
|
<click-input :isColse="true" @click="isSearchFn()" @customEvent="customEventClear" :value="(modelValue || []).length > 0 ? dataOptions[index]:null"
|
||||||
index="name" :placeholder="formProps.placeholder || '请选择'" />
|
index="name" :placeholder="formProps.placeholder || '请选择'" />
|
||||||
<!-- <van-pagination v-model="pageInfo.pageNo" :total-items="Number(pageInfo.total)" :items-per-page="pageInfo.pageSize" @change="pagechange" /> -->
|
<!-- <van-pagination v-model="pageInfo.pageNo" :total-items="Number(pageInfo.total)" :items-per-page="pageInfo.pageSize" @change="pagechange" /> -->
|
||||||
</picker>
|
</picker>
|
||||||
@ -191,6 +191,11 @@
|
|||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
isSearch.value = false;
|
isSearch.value = false;
|
||||||
}
|
}
|
||||||
|
const customEventClear = (e) => {
|
||||||
|
console.log('关闭',e)
|
||||||
|
index.value = "";
|
||||||
|
__value.value = "";
|
||||||
|
}
|
||||||
const isSearchFn = () => {
|
const isSearchFn = () => {
|
||||||
//.box获取class为box的元素,如果使用的id= 'box' 则使用'#box'
|
//.box获取class为box的元素,如果使用的id= 'box' 则使用'#box'
|
||||||
// uni.createSelectorQuery().in(this).select('.picker').boundingClientRect(data => {
|
// uni.createSelectorQuery().in(this).select('.picker').boundingClientRect(data => {
|
||||||
|
|||||||
@ -86,28 +86,35 @@
|
|||||||
const arrListCode = [{
|
const arrListCode = [{
|
||||||
code: 'wf66f6451c48b718d0aaf27522',
|
code: 'wf66f6451c48b718d0aaf27522',
|
||||||
name: '安全检查',
|
name: '安全检查',
|
||||||
path: '/pages/projectEnd/safeSame/index'
|
path: '/pages/projectEnd/safeSame/index',
|
||||||
|
routePath: '/pages/projectEnd/safeSame/list'
|
||||||
}, {
|
}, {
|
||||||
code: "wf67072b923afc947a1a819313",
|
code: "wf67072b923afc947a1a819313",
|
||||||
name: '质量检查',
|
name: '质量检查',
|
||||||
path: '/pages/projectEnd/qualityManage/index'
|
path: '/pages/projectEnd/qualityManage/index',
|
||||||
|
routePath: '/pages/projectEnd/qualityManage/list'
|
||||||
},{
|
},{
|
||||||
code: "wf670a4a6c2384bf3e58f62681",
|
code: "wf670a4a6c2384bf3e58f62681",
|
||||||
name: '质量监督',
|
name: '质量监督',
|
||||||
path: '/pages/projectEnd/qualitySurveillance/index'
|
path: '/pages/projectEnd/qualitySurveillance/index',
|
||||||
|
routePath: '/pages/projectEnd/qualitySurveillance/list'
|
||||||
},{
|
},{
|
||||||
code: "wf670735f73afc947a1a819314",
|
code: "wf670735f73afc947a1a819314",
|
||||||
name: '文明施工',
|
name: '文明施工',
|
||||||
path: '/pages/projectEnd/civilConstruction/constructionProblemRecord/index'
|
path: '/pages/projectEnd/civilConstruction/constructionProblemRecord/index',
|
||||||
|
routePath: '/pages/projectEnd/civilConstruction/constructionProblemRecord/list'
|
||||||
}]
|
}]
|
||||||
let pathUrl = "/pages/projectEnd/projectIndex/projectIndex";
|
let pathUrl = "/pages/projectEnd/projectIndex/projectIndex";
|
||||||
console.log('pages', pages)
|
console.log('pages', pages)
|
||||||
|
|
||||||
const find = arrListCode.find(item => pages[0].options.code && pages[0].options.code.includes(item.code));
|
console.log('prevPage',pages, pages[0].options.code)
|
||||||
// console.log('prevPage',pages, pages[0].options.code)
|
// routeName
|
||||||
|
|
||||||
|
const find = arrListCode.find(item => pages[0].options.code && pages[0].options.code.includes(item.code) || pages[0].options.routeName && pages[0].options.routeName.includes(item.name));
|
||||||
if(find) {
|
if(find) {
|
||||||
pathUrl = find.path;
|
pathUrl = pages[0].options.code ? find.path : find.routePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('pathUrl', pathUrl)
|
console.log('pathUrl', pathUrl)
|
||||||
if(window.plus) {
|
if(window.plus) {
|
||||||
webUni.webView.postMessage({
|
webUni.webView.postMessage({
|
||||||
|
|||||||
288
utils/tool.js
288
utils/tool.js
@ -1,15 +1,15 @@
|
|||||||
import {
|
import {
|
||||||
BASE_URL
|
BASE_URL
|
||||||
} from '@/api/request.js'
|
} from '@/api/request.js'
|
||||||
|
|
||||||
//获取文件访问路径
|
//获取文件访问路径
|
||||||
export function getRes(url) {
|
export function getRes(url) {
|
||||||
if (url) {
|
if (url) {
|
||||||
const reg = /^(http:|https:).*/gi
|
const reg = /^(http:|https:).*/gi
|
||||||
return reg.test(url) ? url : BASE_URL + '/image/' + url
|
return reg.test(url) ? url : BASE_URL + '/image/' + url
|
||||||
} else {
|
} else {
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,194 +19,194 @@ export function getRes(url) {
|
|||||||
* @returns {(function(): void)|*}
|
* @returns {(function(): void)|*}
|
||||||
*/
|
*/
|
||||||
export function debounce(call, cycle = 800) {
|
export function debounce(call, cycle = 800) {
|
||||||
var timer = null; // 创建一个用来存放定时器的变量
|
var timer = null; // 创建一个用来存放定时器的变量
|
||||||
let func = call
|
let func = call
|
||||||
return function(...args) {
|
return function(...args) {
|
||||||
clearTimeout(timer); //只要触发就清除
|
clearTimeout(timer); //只要触发就清除
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
func.apply(this, args);
|
func.apply(this, args);
|
||||||
}, cycle);
|
}, cycle);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFileSize(size) {
|
export function getFileSize(size) {
|
||||||
if (size > 1048576) {
|
if (size > 1048576) {
|
||||||
return (size / 1048576).toFixed(1) + 'MB'
|
return (size / 1048576).toFixed(1) + 'MB'
|
||||||
} else if (size > 1024) {
|
} else if (size > 1024) {
|
||||||
return (size / 1024).toFixed(1) + 'KB'
|
return (size / 1024).toFixed(1) + 'KB'
|
||||||
} else {
|
} else {
|
||||||
return size + 'B'
|
return size + 'B'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function $deepCopy(obj) {
|
export function $deepCopy(obj) {
|
||||||
return JSON.parse(JSON.stringify(obj))
|
return JSON.parse(JSON.stringify(obj))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function $nEmpty(obj) {
|
export function $nEmpty(obj) {
|
||||||
return obj && (obj || '') !== ''
|
return obj && (obj || '') !== ''
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseNumber(val, precision) {
|
export function parseNumber(val, precision) {
|
||||||
if (typeof(val) === 'string') {
|
if (typeof(val) === 'string') {
|
||||||
return precision > 0 ? parseFloat(parseFloat(val).toFixed(precision)) : parseInt(val)
|
return precision > 0 ? parseFloat(parseFloat(val).toFixed(precision)) : parseInt(val)
|
||||||
}
|
}
|
||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
//常用文件格式
|
//常用文件格式
|
||||||
const fileTypes = {
|
const fileTypes = {
|
||||||
pdf: ['pdf'],
|
pdf: ['pdf'],
|
||||||
img: ['bmp', 'jpg', 'png', 'tif', 'gif', 'svg', 'psd', 'webp', 'apng'],
|
img: ['bmp', 'jpg', 'png', 'tif', 'gif', 'svg', 'psd', 'webp', 'apng'],
|
||||||
video: ['mp4', 'avi', 'mpeg', 'mkv', 'mov', 'rmvb', 'flv', '3gp', 'wav'],
|
video: ['mp4', 'avi', 'mpeg', 'mkv', 'mov', 'rmvb', 'flv', '3gp', 'wav'],
|
||||||
word: ['doc', 'docx'],
|
word: ['doc', 'docx'],
|
||||||
excel: ['xls', 'xlsx'],
|
excel: ['xls', 'xlsx'],
|
||||||
ppt: ['ppt', 'pptx'],
|
ppt: ['ppt', 'pptx'],
|
||||||
txt: ['txt'],
|
txt: ['txt'],
|
||||||
zip: ['zip', 'rar', '7z', 'iso'],
|
zip: ['zip', 'rar', '7z', 'iso'],
|
||||||
}
|
}
|
||||||
const fileTypeMap = new Map()
|
const fileTypeMap = new Map()
|
||||||
for (const key of Object.keys(fileTypes)) {
|
for (const key of Object.keys(fileTypes)) {
|
||||||
fileTypes[key].forEach(v => fileTypeMap.set(v, key))
|
fileTypes[key].forEach(v => fileTypeMap.set(v, key))
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 从文件名获取文件对应图标
|
* 从文件名获取文件对应图标
|
||||||
* @param {Object} fileName 文件名
|
* @param {Object} fileName 文件名
|
||||||
*/
|
*/
|
||||||
export function getFileImgByType(fileName) {
|
export function getFileImgByType(fileName) {
|
||||||
const type = fileTypeMap.get(fileName.split('.').pop())
|
const type = fileTypeMap.get(fileName.split('.').pop())
|
||||||
return `/static/image/filetype/${(type || '') === '' ? 'file': type}.png`
|
return `/static/image/filetype/${(type || '') === '' ? 'file': type}.png`
|
||||||
}
|
}
|
||||||
|
|
||||||
//记录下本地文件,方便打开的时候直接取本地
|
//记录下本地文件,方便打开的时候直接取本地
|
||||||
export function saveFileTemp(file) {
|
export function saveFileTemp(file) {
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
let fileObj = uni.getStorageSync('localFile')
|
let fileObj = uni.getStorageSync('localFile')
|
||||||
if (!fileObj) {
|
if (!fileObj) {
|
||||||
fileObj = {}
|
fileObj = {}
|
||||||
}
|
}
|
||||||
fileObj[file.name] = file
|
fileObj[file.name] = file
|
||||||
uni.setStorageSync('localFile', fileObj)
|
uni.setStorageSync('localFile', fileObj)
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//记录下本地文件,方便打开的时候直接取本地
|
//记录下本地文件,方便打开的时候直接取本地
|
||||||
export function removeFileTemp(name) {
|
export function removeFileTemp(name) {
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
let fileObj = uni.getStorageSync('localFile')
|
let fileObj = uni.getStorageSync('localFile')
|
||||||
delete fileObj[name]
|
delete fileObj[name]
|
||||||
uni.setStorageSync('localFile', fileObj)
|
uni.setStorageSync('localFile', fileObj)
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
//下载并打开文件
|
//下载并打开文件
|
||||||
export function openLocalFile(name, path) {
|
export function openLocalFile(name, path) {
|
||||||
//除h5外其他端先看本地有没有,没有就下载到本地再打开,有就直接打开
|
//除h5外其他端先看本地有没有,没有就下载到本地再打开,有就直接打开
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
window.open(path)
|
window.open(path)
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
let fileObj = uni.getStorageSync('localFile')
|
let fileObj = uni.getStorageSync('localFile')
|
||||||
if (fileObj && fileObj[name]) {
|
if (fileObj && fileObj[name]) {
|
||||||
uni.openDocument({
|
uni.openDocument({
|
||||||
filePath: fileObj.path,
|
filePath: fileObj.path,
|
||||||
showMenu: true,
|
showMenu: true,
|
||||||
fileType: getFileImgByType(name),
|
fileType: getFileImgByType(name),
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log('打开文档成功');
|
console.log('打开文档成功');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uni.downloadFile({
|
uni.downloadFile({
|
||||||
url: path,
|
url: path,
|
||||||
header: {
|
header: {
|
||||||
//大家在这里传自定义的token,这里默认wflow的
|
//大家在这里传自定义的token,这里默认wflow的
|
||||||
Authorization: "Bearer " + uni.getStorageSync('wflow-token'),
|
Authorization: "Bearer " + uni.getStorageSync('wflow-token'),
|
||||||
TenantId: JSON.parse(uni.getStorageSync("loginUser")).sn
|
TenantId: JSON.parse(uni.getStorageSync("loginUser")).sn
|
||||||
},
|
},
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '文件下载成功'
|
title: '文件下载成功'
|
||||||
});
|
});
|
||||||
//ios中文文件名会报错,需要编码下
|
//ios中文文件名会报错,需要编码下
|
||||||
let filePath = uni.getSystemInfoSync().platform === 'ios' ? res.tempFilePath : escape(res
|
let filePath = uni.getSystemInfoSync().platform === 'ios' ? res.tempFilePath : escape(res
|
||||||
.tempFilePath)
|
.tempFilePath)
|
||||||
uni.saveFile({
|
uni.saveFile({
|
||||||
tempFilePath: filePath, //临时路径
|
tempFilePath: filePath, //临时路径
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
mask: true,
|
mask: true,
|
||||||
title: '保存在:' + res.savedFilePath, //保存路径
|
title: '保存在:' + res.savedFilePath, //保存路径
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
});
|
});
|
||||||
// 保存好再打开文件
|
// 保存好再打开文件
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.openDocument({
|
uni.openDocument({
|
||||||
filePath: res.savedFilePath,
|
filePath: res.savedFilePath,
|
||||||
showMenu: true,
|
showMenu: true,
|
||||||
fileType: getFileImgByType(name),
|
fileType: getFileImgByType(name),
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log('打开文档成功');
|
console.log('打开文档成功');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
uni.openDocument({
|
uni.openDocument({
|
||||||
filePath: filePath,
|
filePath: filePath,
|
||||||
showMenu: true,
|
showMenu: true,
|
||||||
fileType: getFileImgByType(name),
|
fileType: getFileImgByType(name),
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log('打开文档成功');
|
console.log('打开文档成功');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取表单组件文本值
|
//获取表单组件文本值
|
||||||
export function getFormValText(obj) {
|
export function getFormValText(obj) {
|
||||||
switch (obj.type) {
|
switch (obj.type) {
|
||||||
case 'DeptPicker':
|
case 'DeptPicker':
|
||||||
case 'GroupPicker':
|
case 'GroupPicker':
|
||||||
case 'UserPicker':
|
case 'UserPicker':
|
||||||
case 'FileUpload':
|
case 'FileUpload':
|
||||||
case 'ImageUpload':
|
case 'ImageUpload':
|
||||||
return (obj.value || []).map(v => v.name).join('、');
|
return (obj.value || []).map(v => v.name).join('、');
|
||||||
case 'TimeRangePicker':
|
case 'TimeRangePicker':
|
||||||
case 'DateTimeRange':
|
case 'DateTimeRange':
|
||||||
case 'SelectPlus':
|
case 'SelectPlus':
|
||||||
case 'MultipleSelect':
|
case 'MultipleSelect':
|
||||||
return (obj.value || []).join('、');
|
return (obj.value || []).join('、');
|
||||||
case 'ProcessIndex':
|
case 'ProcessIndex':
|
||||||
return (obj.value || []).map(v => v.startUser.name + '-' + v.name).join('、');
|
return (obj.value || []).map(v => v.startUser.name + '-' + v.name).join('、');
|
||||||
default:
|
default:
|
||||||
return obj.value;
|
return obj.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showItem(item, val) {
|
export function showItem(item, val) {
|
||||||
return !(item.perm === 'R' && isEm(val)) || item.perm === 'H'
|
return !(item.perm === 'R' && isEm(val)) && item.perm !== 'H'
|
||||||
}
|
}
|
||||||
|
|
||||||
function isEm(val) {
|
function isEm(val) {
|
||||||
return !$nEmpty(val) ||
|
return !$nEmpty(val) ||
|
||||||
((val instanceof String) && val.trim() === '') ||
|
((val instanceof String) && val.trim() === '') ||
|
||||||
(Array.isArray(val) && val.length === 0)
|
(Array.isArray(val) && val.length === 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isVideoLink(url) {
|
export function isVideoLink(url) {
|
||||||
const videoExtensions = ['mp4', 'webm', 'ogg', 'mov', 'avi', 'flv', 'wmv'];
|
const videoExtensions = ['mp4', 'webm', 'ogg', 'mov', 'avi', 'flv', 'wmv'];
|
||||||
const extension = url.split('.').pop().toLowerCase();
|
const extension = url.split('.').pop().toLowerCase();
|
||||||
return videoExtensions.includes(extension);
|
return videoExtensions.includes(extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isImageLink(url) {
|
export function isImageLink(url) {
|
||||||
// 正则表达式匹配常见的图片文件扩展名
|
// 正则表达式匹配常见的图片文件扩展名
|
||||||
const imageExtensionsRegex = /\.(jpg|jpeg|png|gif|webp)$/i;
|
const imageExtensionsRegex = /\.(jpg|jpeg|png|gif|webp)$/i;
|
||||||
return imageExtensionsRegex.test(url);
|
return imageExtensionsRegex.test(url);
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user