初始代码

This commit is contained in:
wangmingwei
2026-04-21 16:55:00 +08:00
parent be9f1657b9
commit 35101db700
1335 changed files with 211213 additions and 0 deletions

584
pages/index/apply.vue Normal file
View File

@@ -0,0 +1,584 @@
<template>
<view class="apply-v">
<view class="nav-bar-box">
<uni-nav-bar :fixed="true" :statusBar="true" :border="false" left-icon="bars"
@clickLeft="showSelectBox('left')" height="44px">
<block #default>
<view class="nav-left" @click="showSelectBox('center')">
<view class="nav-left-text">{{ selectData.name }}</view>
<uni-icons class="right-icons" type="down" color="#000000" size="14"
v-if="userInfo.systemIds.length > 1" :class="{ 'select-right-icons': showSelect }" />
</view>
</block>
</uni-nav-bar>
</view>
<view class="notice-warp" :style="{'top':topSearch,'height':noticeWarpH+'px'}">
<view class="search-box">
<u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
:show-action="false" @change="search" bg-color="#f0f2f6" shape="square" style="width: 100%;">
</u-search>
</view>
</view>
<mescroll-body ref="mescrollRef" @down="downCallback" :down="downOption" :sticky="false" @up="upCallback"
:up="upOption" :bottombar="false" @init="mescrollInit" :top="mescrollTop">
<view class="common-block">
<view class="caption u-flex">
<text class="caption-left">常用菜单</text>
<view class="u-flex" @click="openPage">
<text class="caption-right">{{$t('common.moreText')}}</text>
<u-icon name="arrow-right" size="24"></u-icon>
</view>
</view>
<view class="u-flex u-flex-wrap">
<view class="item u-flex-col u-col-center" v-for="(item, i) in usualList" :key="i"
@click="handelClick(item)">
<text class="u-font-40 item-icon" :class="item.icon"
:style="{ background: item.iconBackground || '#008cff' }" />
<text class="u-font-24 u-line-1 item-text">{{ item.fullName}}</text>
</view>
<view class="item u-flex-col u-col-center" @click="moreApp">
<text class="u-font-40 item-icon more">+</text>
<text class="u-font-24 u-line-1 item-text">添加</text>
</view>
</view>
</view>
<view class="workFlow-list">
<view class="part" v-for="(item, i) in menuList" :key="i">
<view class="caption u-line-1" v-if="item?.children?.length">
{{ item.fullName }}
</view>
<view class="u-flex u-flex-wrap">
<view class="item u-flex-col u-col-center" v-for="(child, ii) in item.children" :key="ii"
@click="handelClick(child)">
<text class="u-font-40 item-icon" :class="child.icon"
:style="{ background: child.iconBackground || '#008cff' }" />
<text class="u-font-24 u-line-1 item-text">{{child.fullName}}</text>
</view>
</view>
</view>
</view>
</mescroll-body>
<uni-popup ref="popup" background-color="#fff" @change="popupChange">
<!-- #ifdef MP -->
<view :style="{ 'margin-top': statusBarHeight + 226 + 'rpx' }"></view>
<!-- #endif -->
<!-- #ifndef MP -->
<view :style="{ 'margin-top': statusBarHeight + 220+ 'rpx' }"></view>
<!-- #endif -->
<view class="notice-warp" :style="{'top':topSearch,'height':noticeWarpH+'px'}">
<view class="search-box">
<u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="systemKeyword" height="72"
:show-action="false" @change="onSearchInput" bg-color="#f0f2f6" shape="square"
style="width: 100%;">
</u-search>
</view>
</view>
<view class="item popupItem">
<view v-for="(item, index) in filteredList" :key="index" class="select-item"
@click="selectItem(item, index)" v-if="filteredList.length">
<text class="u-m-r-12 u-font-40"
:class="[item.icon, { currentItem: item.id === userInfo.appSystemId }]" />
<text class="item-text sysName"
:class="{ currentItem: item.id === userInfo.appSystemId }">{{ item.name }}</text>
<u-icon name="checkbox-mark " class="currentItem" v-if="item.id === userInfo.appSystemId"></u-icon>
</view>
</view>
</uni-popup>
<treeCollapse :show="showApply" v-if="showApply" :treeData="menuList" @change="handelClick">
<!-- #ifdef APP -->
<view :style="{ 'margin-top': statusBarHeight + 40 + 'rpx' }"></view>
<!-- #endif -->
</treeCollapse>
</view>
</template>
<script>
import {
getMenuList,
getUsualList,
getChildList
} from "@/api/apply/apply.js";
import treeCollapse from '@/components/treeCollapse'
import {
setMajor,
updatePassword,
getSystemConfig,
} from "@/api/common";
import resources from "@/libs/resources.js";
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import IndexMixin from "./mixin.js";
import {
useUserStore
} from '@/store/modules/user'
import {
useChatStore
} from '@/store/modules/chat'
export default {
mixins: [MescrollMixin, IndexMixin],
components: {
treeCollapse
},
data() {
return {
mescrollTop: 198,
systemKeyword: '',
showApply: false,
topSearch: '80px',
appTopHeight: 0,
usualList: [],
menuList: [],
downOption: {
use: true,
auto: true,
},
upOption: {
page: {
num: 0,
size: 50,
time: null,
},
empty: {
use: true,
icon: resources.message.nodata,
tip: this.$t('common.noData'),
fixed: false,
top: "560rpx",
},
textNoMore: this.$t('app.apply.noMoreData'),
},
keyword: "",
statusBarHeight: "",
userInfo: {
systemIds: [],
},
showSelect: false,
selectData: {
name: "",
id: "",
},
modelId: "",
fullName: "",
key: +new Date(),
listChild: [],
height: 0,
noticeWarpH: 0
};
},
computed: {
baseURL() {
return this.define.baseURL;
},
token() {
return uni.getStorageSync('token')
},
report() {
return this.define.report;
},
hasChildren() {
let hasChildren = false
for (let i = 0; i < this.menuList.length; i++) {
if (this.menuList[i].children && this.menuList[i].children.length) {
hasChildren = true
break
}
}
return hasChildren
},
filteredList() {
return this.userInfo.systemIds.filter(item => {
return item.name.includes(this.systemKeyword);
});
}
},
onShow() {
this.keyword = "";
this.systemKeyword = ''
this.$nextTick(() => {
this.mescroll.resetUpScroll();
})
},
mounted() {
this.getContentHeight()
},
onLoad() {
uni.$on('updateUsualList', data => {
this.getUsualList()
})
uni.$on('refresh', () => {
this.menuList = [];
this.mescroll.resetUpScroll();
});
},
onUnload() {
uni.$off("updateUsualList");
},
methods: {
async getContentHeight() {
const windowHeight = this.$u.sys().windowHeight;
// 获取元素尺寸
const [navBarHeight, noticeWarpRect, searchBoxRect, stickyBoxTabsRect] = await Promise.all([
this.$uGetRect('.nav-bar-box'),
this.$uGetRect('.notice-warp'),
this.$uGetRect('.search-box')
]);
// 计算高度
const appTopHeight = navBarHeight.height;
const searchBoxHeight = searchBoxRect.height;
// 设置组件数据
this.topSearch = `${appTopHeight}px`;
this.appTopHeight = appTopHeight;
this.noticeWarpH = `${searchBoxHeight}`;
this.mescrollTop = appTopHeight + searchBoxHeight;
// #ifdef MP
this.mescrollTop = 54 + searchBoxHeight;
// #endif
},
popupChange(e) {
this.showSelect = e.show
},
showSelectBox(type) {
if (type === 'center' && this.userInfo.systemIds.length > 1) {
if (this.showApply) this.showApply = false
if (this.showSelect) this.$refs.popup.close();
this.$refs.popup.open('top')
}
if (type === 'left' && this.menuList.length) {
if (this.showSelect) this.$refs.popup.close()
this.showApply = !this.showApply;
}
},
handelClick(item) {
this.showApply = false
if (item.type == 1) {
getChildList(item.id).then(res => {
this.listChild = res.data || []
this.handleProperty(this.listChild)
this.$nextTick(() => {
uni.navigateTo({
url: "/pages/apply/catalog/index?config=" +
this.yunzhupaas.base64.encode(JSON.stringify(this.listChild[0])),
fail: (err) => {
this.$u.toast("暂无此页面");
},
});
})
})
return;
}
if (item.type == 2) {
uni.navigateTo({
url: item.urlAddress +
"?menuId=" +
item.id +
"&fullName=" +
item.fullName,
fail: (err) => {
this.$u.toast("暂无此页面");
},
});
return;
}
if (item.type == 3 || item.type == 9) {
this.modelId = item.moduleId;
if (!item.moduleId) {
this.$u.toast("暂无此页面");
return;
}
uni.navigateTo({
url: "/pages/apply/dynamicModel/index?config=" +
this.yunzhupaas.base64.encode(JSON.stringify(item)),
fail: (err) => {
this.$u.toast("暂无此页面");
},
});
}
if (item.type == 7 || item.type == 5) {
let url =
encodeURIComponent(item.urlAddress) + "&fullName=" + item.fullName;
if (item.type == 5) {
url = encodeURIComponent(
`${this.report}/preview.html?id=${item.moduleId}&token=${this.token}&page=1&from=menu`
);
}
if (!item.urlAddress && item.type == 7) {
this.$u.toast("暂无此页面");
return;
}
uni.navigateTo({
url: "/pages/apply/externalLink/index?url=" +
url +
"&fullName=" +
item.fullName +
"&type=" +
item.type,
fail: (err) => {
this.$u.toast("暂无此页面");
},
});
return;
}
if (item.type == 8) {
if (!item.urlAddress) {
this.$u.toast("暂无此页面");
return;
}
uni.navigateTo({
url: "/pages/portal/scanPortal/index?id=" + item.moduleId + "&portalType=1&fullName=" +
item.fullName,
fail: (err) => {
this.$u.toast("暂无此页面");
},
});
return
}
},
openPage() {
uni.navigateTo({
url: '/pages/commonPage/morePage/index?type=2',
});
},
onSearchInput(value) {
this.systemKeyword = value;
},
initSysList(res) {
this.userInfo = res;
if (this.userInfo.systemIds && this.userInfo.systemIds.length) {
this.userInfo.systemIds.forEach((item) => {
if (item.id == this.userInfo.appSystemId) this.selectData = item
});
}
getSystemConfig().then((res) => {
this.baseForm = res.data;
});
},
processObject(obj) {
const objectDataParsed = obj.objectData ? JSON.parse(obj.objectData) : {};
const propertyJsonParsed = JSON.parse(obj.propertyJson);
const moduleId = propertyJsonParsed.moduleId || "";
this.$set(obj, "moduleId", moduleId);
return {
...obj,
...objectDataParsed,
};
},
getUsualList() {
getUsualList(2).then((res) => {
// 使用 map 方法处理 res.data.list 中的每个对象
let list = res.data.list.map(o => (this.processObject(o))).slice(0, 11);
// 更新 usualList
this.usualList = [...list];
});
},
upCallback(keyword) {
let query = {
keyword: this.keyword,
};
uni.showLoading({
title: '正在加载',
mask: true
})
const userStore = useUserStore()
userStore.getCurrentUser().then((res) => {
this.initSysList(res);
this.getUsualList();
getMenuList(query)
.then((res) => {
let list = res.data.list || [];
this.mescroll.endSuccess(list.length);
this.list = list.filter(o => o.children && o.children.length)
this.menuList = this.list;
this.handleProperty(this.list)
uni.hideLoading()
this.key = +new Date();
this.mescroll.endSuccess(this.menuList.length, false);
}).catch(() => {
this.mescroll.endSuccess(0);
this.mescroll.endErr();
});
});
},
handleProperty(list) {
const loop = (par) => {
par.map(o => {
if (o?.propertyJson) {
let propertyJson = JSON.parse(o.propertyJson);
this.$set(o, "iconBackground", propertyJson.iconBackgroundColor || "");
this.$set(o, "moduleId", propertyJson.moduleId || "");
}
if (o?.children && o?.children?.length) loop(o.children)
})
}
loop(list)
},
search() {
this.searchTimer && clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.list = [];
this.menuList = [];
this.mescroll.resetUpScroll();
}, 300);
},
moreApp() {
uni.navigateTo({
url: "/pages/commonPage/allApp/index?type=2",
});
},
selectItem(item, index) {
if (item.id === this.userInfo.appSystemId) return
let query = {
majorId: item.id,
majorType: "System",
menuType: 1,
};
setMajor(query).then((res) => {
if (res.code == 200) {
this.changeSelData(item, index);
this.keyword = "";
this.systemKeyword = "";
this.$u.toast(res.msg);
this.$nextTick(() => {
this.mescroll.resetUpScroll();
})
}
}).catch((err) => {
this.$u.toast(err);
setTimeout(() => {
this.$nextTick(() => {
this.mescroll.resetUpScroll();
})
}, 1200)
});
},
changeSelData(item, index) {
this.selectData = item
this.userInfo.appSystemId = item.id
this.$refs.popup.close()
},
getFullName(item) {
if (!item.enCode) return item.name;
return this.$t('routes.' + item.enCode.replace(/\./g, '-'));
}
},
};
</script>
<style lang="scss">
page {
background-color: #f0f2f6;
}
.apply-v {
.notice-warp {
width: 100%;
.search-box {
height: 120rpx;
padding: 0rpx 20rpx;
display: flex;
align-items: center;
}
}
.common-block {
background-color: #fff;
margin: 20rpx 0;
.caption {
padding: 0 32rpx;
line-height: 100rpx;
justify-content: space-between;
.caption-left {
font-size: 36rpx;
font-weight: bold;
}
.caption-right {}
}
.item {
margin-bottom: 32rpx;
width: 25%;
.item-icon {
width: 88rpx;
height: 88rpx;
margin-bottom: 8rpx;
line-height: 82rpx;
text-align: center;
border-radius: 30rpx;
color: #fff;
font-size: 40rpx;
&.more {
background: #ececec;
color: #666666;
font-size: 50rpx;
}
}
.item-text {
width: 100%;
text-align: center;
padding: 0 16rpx;
}
}
}
.select-box {
max-height: 600rpx;
:deep(.u-drawer-content) {
height: 100% !important;
}
}
.popupItem {
height: 400rpx;
overflow-y: scroll;
/* #ifdef APP-HARMONY || MP */
padding-top: 40rpx;
/* #endif */
}
.item {
.currentItem {
color: #2979ff;
}
.select-item {
height: 100rpx;
display: flex;
align-items: center;
padding: 0 20rpx;
font-size: 30rpx;
color: #303133;
text-align: left;
position: relative;
&::after {
content: " ";
position: absolute;
left: 2%;
top: 0;
box-sizing: border-box;
width: 96%;
height: 1px;
transform: scale(1, 0.3);
border: 0 solid #e4e7ed;
z-index: 2;
border-bottom-width: 1px;
}
.sysName {
flex: 1;
overflow: auto;
min-width: 0;
}
}
}
}
</style>

View File

@@ -0,0 +1,182 @@
<template>
<u-popup v-model="showPopup" mode="center" length="auto">
<view class="yunzhupaas-wrap yunzhupaas-wrap-workflow">
<u-form :model="dataForm" :rules="rules" ref="dataForm" label-position="left" label-width="150"
label-align="left">
<u-form-item label="旧密码" prop="oldPassword" required>
<u-input v-model="dataForm.oldPassword" placeholder="旧密码" type="password"></u-input>
</u-form-item>
<u-form-item label="新密码" prop="password" required>
<u-input v-model="dataForm.password" placeholder="新密码" type="password"></u-input>
</u-form-item>
<u-form-item label="重复密码" prop="repeatPsd" required>
<u-input v-model="dataForm.repeatPsd" placeholder="重复密码" type="password"></u-input>
</u-form-item>
<u-form-item label="验证码" prop="code" required>
<view class="u-flex">
<u-input v-model="dataForm.code" placeholder="验证码"></u-input>
<view style="flex: 0.1">
<u-image :showLoading="true" :src="baseURL + imgUrl" width="130px" height="38px"
@click="changeCode">
</u-image>
</view>
</view>
</u-form-item>
<u-button class="buttom-btn" type="primary" @click.stop="dataFormSubmit">
{{ "保存" }}
</u-button>
</u-form>
</view>
</u-popup>
</template>
<script>
import md5Libs from "@/uni_modules/vk-uview-ui/libs/function/md5";
export default {
props: {
passwordShow: {
type: Boolean,
default: true
},
baseForm: {
type: Object,
default: () => {}
},
},
data() {
var validatePass = (rule, value, callback) => {
// const passwordreg = /(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{6,16}/
//是否包含数字
const containsNumbers = /[0-9]+/;
//是否包含小写字符
const includeLowercaseLetters = /[a-z]+/;
//是否包含大写字符
const includeUppercaseLetters = /[A-Z]+/;
//是否包含字符
const containsCharacters = /\W/;
if (value === "") {
callback(new Error("新密码不能为空"));
} else if (this.baseForm.passwordStrengthLimit == 1) {
if (this.baseForm.passwordLengthMin) {
if (value.length < this.baseForm.passwordLengthMinNumber) {
callback(
new Error(
"新密码长度不能小于" +
this.baseForm.passwordLengthMinNumber +
"位"
)
);
}
}
if (this.baseForm.containsNumbers) {
if (!containsNumbers.test(value)) {
callback(new Error("新密码必须包含数字"));
}
}
if (this.baseForm.includeLowercaseLetters) {
if (!includeLowercaseLetters.test(value)) {
callback(new Error("新密码必须包含小写字母"));
}
}
if (this.baseForm.includeUppercaseLetters) {
if (!includeUppercaseLetters.test(value)) {
callback(new Error("新密码必须包含大写字字母"));
}
}
if (this.baseForm.containsCharacters) {
if (!containsCharacters.test(value)) {
callback(new Error("新密码必须包含字符"));
}
}
callback();
} else {
callback();
}
};
var validatePass2 = (rule, value, callback) => {
if (value === "") {
callback(new Error("重复密码不能为空"));
} else if (value !== this.dataForm.password) {
callback(new Error("两次密码输入不一致"));
} else {
callback();
}
};
return {
showPopup: false,
imgUrl: "",
timestamp: "",
dataForm: {
oldPassword: "",
password: "",
repeatPsd: "",
code: "",
timestamp: "",
},
rules: {
oldPassword: [{
required: true,
message: "旧密码不能为空",
trigger: "blur",
}, ],
password: [{
required: true,
validator: validatePass,
trigger: "blur",
}, ],
repeatPsd: [{
required: true,
validator: validatePass2,
trigger: "blur",
}, ],
code: [{
required: true,
message: "验证码不能为空",
trigger: "blur",
}, ],
},
}
},
computed: {
baseURL() {
return this.define.baseURL;
}
},
watch: {
passwordShow(val) {
if (val) {
this.showPopup = val
this.$nextTick(() => {
this.$refs.dataForm.setRules(this.rules);
});
}
},
},
created() {
this.changeCode()
},
methods: {
changeCode() {
let timestamp = Math.random();
this.timestamp = timestamp;
this.imgUrl = `/api/file/ImageCode/${timestamp}`;
},
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (valid) {
let query = {
oldPassword: md5Libs.md5(this.dataForm.oldPassword),
password: md5Libs.md5(this.dataForm.password),
code: this.dataForm.code,
timestamp: this.timestamp,
};
this.$emit('submit', query)
}
});
},
}
}
</script>
<style>
</style>

701
pages/index/index.vue Normal file
View File

@@ -0,0 +1,701 @@
<template>
<view class="index-v">
<!-- #ifndef MP -->
<uni-nav-bar class='nav' :fixed="true" :statusBar="true" :border="false" :right-icon="rightIcon"
@clickRight="scan">
<!-- 左边插槽 -->
<template #left>
<view class="">
<uni-icons class='icon-ym icon-ym-app-role-toggle' color="#222222" size="20"
@click="showSelectBox(0)" />
</view>
</template>
<template #default>
<view class="nav-left">
<view class="nav-left-text">
零和万物快速开发平台
</view>
</view>
</template>
</uni-nav-bar>
<template v-if="userInfo.appPortalId">
<view class="portal-select" v-if="columnList.length">
<view class="u-flex portal-select-inner" @click.stop="showSelectBox(1)">
<text class="portal-select-text u-line-1">
{{portalTitle}}
</text>
<uni-icons class='right-icons' type="down" color="#000000" size="14"
v-if="portalList.length > 0 && userInfo.appPortalId"
:class="{'select-right-icons':showSelect && type ==1}" />
</view>
</view>
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" :down="downOption"
@up="upCallback" :up="upOption" :bottombar="false" top='10'>
<view class="portal-v" v-if="authConfig.type==0">
<template v-if="formData.length">
<view class="portal-box" v-for="(item,index) in formData" :key="index">
<portalItem :item='item' ref="portalItem" :key="key" v-if="item.show" />
</view>
</template>
<view v-else class="portal-v portal-nodata">
<view class="u-flex-col" style="align-items: center;">
<u-image width="280rpx" height="280rpx" :src="emptyImg1"></u-image>
<text class="u-m-t-20" style="color: #909399;">{{$t('common.noData')}}</text>
</view>
</view>
</view>
<template v-if="authConfig.type==1">
<!-- #ifdef APP -->
<view v-if="authConfig.linkType==1 && showWebView">
<web-view :src="authConfig.customUrl"></web-view>
</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view v-if="authConfig.linkType==1 && showWebView">
<web-view :src="authConfig.customUrl" :fullscreen="false"
style="width: 100%;height: calc(100vh - 300rpx);"></web-view>
</view>
<!-- #endif -->
<view v-else class="portal-v portal-nodata">
<view class="u-flex-col" style="align-items: center;">
<u-image width="280rpx" height="280rpx" :src="emptyImg"></u-image>
<text class="u-m-t-20" style="color: #909399;">当前内容无法在APP上显示请前往PC门户查看</text>
</view>
</view>
</template>
</mescroll-body>
</template>
<view class="portal-v" style="padding-top: 20rpx;" v-else>
<view class="portal-box">
<defaultPortal></defaultPortal>
</view>
</view>
<u-popup v-model="showSelect" mode="bottom" class="select-box" height="600rpx" @close="closePopup">
<view class="search-box" v-if="type == 1">
<u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
:show-action="false" bg-color="#f0f2f6" shape="square" search-icon-color="#909399" />
</view>
<view v-for="(item,index) in columnList" :key="index" class="select-item" @click="selectItem(item,index)">
<text class="u-m-r-12 u-font-30"
:class="[item.icon,{'currentItem':item.isDefault || item.id === item.appPortalId }]" />
<text class="item-text sysName"
:class="{'currentItem':item.isDefault || item.id === item.appPortalId}">{{item.fullName}}</text>
<u-icon name="checkbox-mark " class="currentItem"
v-if="item.isDefault || item.id === item.appPortalId"></u-icon>
</view>
</u-popup>
<PasswordPopup @submit="dataFormSubmit" :passwordShow="passwordShow" :formData="baseForm"></PasswordPopup>
<!-- #endif -->
<!-- #ifdef MP -->
<view>
<web-view :src="mpPortalUrl"></web-view>
</view>
<!-- #endif -->
</view>
</template>
<script>
var wv; //计划创建的webview
import {
PortalList,
SetPortal
} from '@/api/portal/portal.js'
// #ifndef MP
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js"
import IndexMixin from './mixin.js'
import portalItem from '@/pages/portal/components/index.vue'
import defaultPortal from '@/pages/portal/components/defaultPortal.vue'
import {
auth
} from '@/api/portal/portal.js'
// #endif
import resources from '@/libs/resources.js'
import emptyImg from '@/static/image/defPortal.png'
import PasswordPopup from './components/PasswordPopup'
import chat from '@/libs/chat.js'
import {
useChatStore
} from '@/store/modules/chat'
import {
useUserStore
} from '@/store/modules/user'
import {
getUserOrganizes,
updatePassword,
getSystemConfig,
updatePasswordMessage,
setMajor
} from '@/api/common.js'
import {
refreshCurrentPage
} from '@/utils/refreshCurrent.js'
export default {
// #ifndef MP
mixins: [MescrollMixin, IndexMixin],
// #endif
components: {
// #ifndef MP
portalItem,
defaultPortal,
PasswordPopup
// #endif
},
data() {
return {
passwordShow: false,
keyword: '',
showWebView: true,
emptyImg: emptyImg,
emptyImg1: resources.message.nodata,
rightIcon: '',
key: +new Date(),
formData: [],
portalTitle: '门户',
statusBarHeight: '',
showSelect: false,
selectData: {
name: '',
id: ''
},
upOption: {
page: {
num: 0,
size: 50,
time: null
},
empty: {
use: false,
},
textNoMore: this.$t('app.apply.noMoreData'),
},
portalList: [],
id: '',
userInfo: {},
downOption: {
use: true,
auto: true
},
authConfig: {},
token: '',
mpPortalUrl: '',
timer: null,
type: 0,
baseForm: {
passwordStrengthLimit: 0,
passwordLengthMin: false,
passwordLengthMinNumber: 0,
containsNumbers: false,
includeLowercaseLetters: false,
includeUppercaseLetters: false,
containsCharacters: false,
mandatoryModificationOfInitialPassword: 0,
},
userOrganizes: '',
oldUserOrganizes: ''
};
},
onShow() {
this.token = uni.getStorageSync('token')
this.mpPortalUrl = this.define.baseURL + '/pages/portal/mpPortal/index?token=' + this.token
this.userInfo = uni.getStorageSync('userInfo') || {}
this.showSelect = false
if (!this.userInfo.appPortalId) return
// #ifndef MP
this.getPortalList()
this.$nextTick(() => {
this.mescroll.resetUpScroll();
this.portalList = []
})
// #endif
// #ifdef APP
this.rightIcon = 'scan'
// #endif
},
onReady() {
// #ifdef APP
this.setWebview()
// #endif
},
onLoad(e) {
// #ifndef MP
this.token = uni.getStorageSync('token')
// #endif
const chatStore = useChatStore()
if (!chatStore.getSocket) chat && chat.initSocket()
},
computed: {
isPortalListValid() {
return Array.isArray(this.portalList) && this.portalList.length;
},
columnList() {
return this.portalList.filter((o) => (o.fullName && o.fullName.match(this.keyword)))
}
},
methods: {
dataFormSubmit(query) {
updatePassword(query).then((res) => {
const userStore = useUserStore()
userStore.logout().then(() => {
uni.reLaunch({
url: "/pages/login/index",
});
});
})
},
setWebview() {
if (this.authConfig.linkType == 1) {
var currentWebview = this.$scope
.$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
let height = 0;
uni.getSystemInfo({
//成功获取的回调函数,返回值为系统信息
success: (sysinfo) => {
height = sysinfo.windowHeight - 50; //自行修改,自己需要的高度 此处如底部有其他内容,可以直接---(-50)这种
},
complete: () => {}
});
this.$nextTick(() => {
setTimeout(() => {
wv = currentWebview.children()[0]
wv.setStyle({
top: 80,
height,
scalable: true
})
}, 500); //如果是页面初始化调用时,需要延时一下
})
}
},
getSystemConfig() {
updatePasswordMessage();
getSystemConfig().then((res) => {
if (this.userInfo.changePasswordDate == null && res.data
.mandatoryModificationOfInitialPassword == 1) this.passwordShow = true;
this.baseForm = res.data;
});
},
upCallback(keyword) {
auth(this.userInfo.appPortalId).then(res => {
this.authConfig = res.data || {}
let data = JSON.parse(res.data.formData) || {};
this.formData = data.layout ? JSON.parse(JSON.stringify(data.layout)) : [];
this.handelFormData(data);
this.getSystemConfig()
if (data.refresh.autoRefresh) {
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
uni.$emit('proRefresh')
}, data.refresh.autoRefreshTime * 60000)
}
this.mescroll.endSuccess(this.formData.length);
this.key = +new Date()
// #ifdef APP
this.setWebview()
// #endif
}).catch(() => {
this.formData = []
this.mescroll.endSuccess(0);
this.mescroll.endErr();
this.key = +new Date()
})
},
handelFormData(data) {
const loop = (list) => {
list.forEach(o => {
o.allRefresh = data.refresh
o.show = false
if (o.visibility && o.visibility.length && o.visibility.includes('app')) o.show =
true
if (o.children && o.children.length) loop(o.children)
})
this.key = +new Date()
}
loop(this.formData)
this.dataList = this.formData.filter(o => o.show)
if (this.dataList.length < 1) {
this.formData = this.dataList
this.mescroll.endSuccess(this.dataList.length);
}
},
isJSON(str) {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
},
scan() {
uni.scanCode({
success: res => {
let url = ""
if (this.isJSON(res.result.trim())) {
const result = JSON.parse(res.result.trim())
if (result.t === 'ADP') {
let config = {
isPreview: 1,
moduleId: result.id,
previewType: result.previewType
}
url = '/pages/apply/dynamicModel/index?config=' + this.yunzhupaas.base64.encode(JSON
.stringify(config))
}
if (result.t === 'DFD') {
url = '/pages/apply/dynamicModel/scanForm?config=' + JSON.stringify(result)
}
if (result.t === 'WFP') {
url = '/pages/workFlow/scanForm/index?config=' + JSON.stringify(result)
}
if (result.t === 'report') {
let url_ =
`${this.report}/preview.html?id=${result.id}&token=${this.token}&page=1&from=menu`
url = '/pages/apply/externalLink/index?url=' + encodeURIComponent(url_) +
'&fullName= ' + result.fullName
}
if (result.t === 'portal') {
url = '/pages/portal/scanPortal/index?id=' + result.id
}
if (result.t === 'login') {
url = '/pages/login/scanLogin?id=' + result.id
}
} else {
url = '/pages/my/scanResult/index?result=' + res.result
}
uni.navigateTo({
url,
fail: (err) => {
this.$u.toast("暂无此页面")
}
})
}
});
},
getPortalList() {
PortalList().then(res => {
let list = res.data.list || [];
this.portalList = []
list.map(o => {
o.children && this.portalList.push(...o.children)
this.portalList.forEach(o => {
o.appPortalId = this.userInfo.appPortalId
if (o.id === o.appPortalId) this.portalTitle = o.fullName
})
})
})
},
closePopup() {
// #ifdef APP
this.setWebview()
uni.$emit('showVideo', true)
this.showWebView = true
// #endif
},
showSelectBox(type) {
this.type = type;
if (type === 0) {
getUserOrganizes().then(res => {
this.portalList = res.data;
this.portalList.forEach(o => {
o.icon = 'icon-ym icon-ym-flow-node-condition';
});
if (this.isPortalListValid) this.showSelect = !this.showSelect;
});
} else {
if (this.isPortalListValid) this.showSelect = !this.showSelect;
// #ifndef MP
this.getPortalList();
// #endif
// #ifdef APP
uni.$emit('showVideo', false);
this.showWebView = false;
this.setWebview();
// #endif
}
},
getStatusBarHeight() {
let that = this;
wx.getSystemInfo({
success: function(res) {
that.statusBarHeight = res.statusBarHeight;
},
});
},
/* 组织切换 */
selectItem(item, index) {
if (this.type === 1) {
this.handleTypeOneSelection(item, index);
} else {
this.handleOtherTypeSelection(item);
}
},
handleTypeOneSelection(item, index) {
SetPortal(item.id).then(res => {
this.portalTitle = this.portalList[index].fullName;
this.userInfo.appPortalId = item.id;
// #ifndef MP
this.mescroll.triggerDownScroll();
// #endif
this.showSelectBox(false);
uni.setStorageSync('userInfo', this.userInfo);
});
},
handleOtherTypeSelection(item) {
this.userOrganizes = item.id;
this.portalList = this.portalList.map(o => {
o.isDefault = o.id === item.id;
return o;
});
this.changeMajor(item.id, this.majorType);
},
changeMajor(majorId, majorType) {
let query = {
majorId,
majorType: 'Organize'
}
setMajor(query).then(res => {
return this.getCurrentUser()
}).catch(() => {})
},
getCurrentUser() {
const userStore = useUserStore()
userStore.getCurrentUser().then(() => {
/* 刷新当前页 */
refreshCurrentPage();
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f0f2f6;
}
.index-v {
.portal-v {
padding: 0 20rpx 20rpx 20rpx;
.portal-box {
width: 100%;
height: 100%;
.htabs {
.u-scroll-box {
height: 80rpx;
.u-tab-item {
border-right: 1px solid #e4e7ed;
&::before {
content: "";
}
}
}
}
.card-v {
&.u-card {
margin: 0rpx !important;
padding: 0rpx !important;
}
}
}
}
.nav {
z-index: 99999;
::v-deep .uni-navbar__content {
z-index: 99999;
}
::v-deep .uni-navbar__header-container {
justify-content: center;
}
.nav-left {
max-width: 100%;
display: flex;
align-items: center;
.nav-left-text {
font-weight: 700;
font-size: 32rpx;
flex: 1;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.portal-select {
background-color: #fff;
height: 80rpx;
padding-left: 20rpx;
line-height: 80rpx;
.portal-select-inner {
width: 200rpx;
height: 100%;
.portal-select-text {
color: #303133;
}
}
.right-icons {
font-weight: 700;
margin-top: 2px;
margin-left: 4px;
transition-duration: 0.3s;
color: #606266 !important;
}
.select-right-icons {
transform: rotate(-180deg);
}
}
.select-box {
overflow-y: scroll;
.search-box {
height: 112rpx;
width: 100%;
padding: 20rpx 20rpx;
z-index: 10000;
background: #fff;
&::after {
content: " ";
position: absolute;
left: 2%;
top: 62px;
box-sizing: border-box;
width: 96%;
height: 1px;
transform: scale(1, .3);
border: 0 solid #e4e7ed;
z-index: 2;
border-bottom-width: 1px;
}
}
.currentItem {
color: #02a7f0;
}
.select-item {
height: 88rpx;
display: flex;
align-items: center;
padding: 0 20rpx;
font-size: 30rpx;
color: #303133;
text-align: left;
position: relative;
&::after {
content: " ";
position: absolute;
left: 2%;
bottom: 0;
box-sizing: border-box;
width: 96%;
height: 1px;
transform: scale(1, .3);
border: 0 solid #e4e7ed;
z-index: 2;
border-bottom-width: 1px;
}
.sysName {
flex: 1;
overflow: auto;
min-width: 0;
font-size: 28rpx;
}
}
}
.popup {
position: absolute;
top: 244rpx;
z-index: 99999;
width: 70%;
height: 200px;
border: 1px solid #ccc;
background-color: #fff;
left: 283rpx;
border-radius: 4rpx;
transform: translate(-50%, -50%) scale(0);
animation: popup-animation 0.4s ease-in-out forwards;
}
.uni-select--mask {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
z-index: 2;
}
@keyframes popup-animation {
from {
transform: translate(-50%, -50%) scale(0);
opacity: 0;
}
to {
transform: translate(-50%, -50%) scale(1);
opacity: 1;
}
}
.nav {
z-index: 99999;
::v-deep .uni-navbar__content {
z-index: 99999;
}
::v-deep .uni-navbar__header-container {
justify-content: center;
}
.nav-left {
max-width: 100%;
display: flex;
align-items: center;
.nav-left-text {
font-weight: 700;
font-size: 29rpx;
flex: 1;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
.portal-nodata {
position: absolute;
top: 450rpx;
width: 100%;
text-align: center;
z-index: 100;
background-color: #f0f2f6;
}
</style>

345
pages/index/message.vue Normal file
View File

@@ -0,0 +1,345 @@
<template>
<view class="message-v">
<view class="search-box_sticky">
<view class="reply-item u-border-bottom u-flex " @click="openPage('/pages/message/message/index?type=')">
<view class="reply-item-img-sysMsg reply-item-icon u-flex u-row-center reply-item-icon-color2">
<text class="icon-ym icon-ym-xitong" />
</view>
<view class="reply-item-txt u-flex-1">
<view class="reply-item-cell reply-item-title u-flex u-row-between">
<text class="title">站内消息</text>
<text
class="u-font-24">{{msgInfo.messageDate?$u.timeFormat(msgInfo.messageDate, 'mm-dd hh:MM'):''}}</text>
</view>
<view class="reply-item-cell u-flex u-row-between">
<text class="reply-item-txt-msg u-line-1 againColor">{{msgInfo.messageText}}</text>
<u-badge type="error" :count="msgInfo.messageCount" :absolute="false"
v-if="msgInfo.messageCount" />
</view>
</view>
</view>
<view class="reply-item u-border-bottom u-flex " @click="openPage('/pages/message/contacts/index')">
<view class="reply-item-img-sysMsg reply-item-icon u-flex u-row-center reply-item-icon-color">
<text class="icon-ym icon-ym-contacts" />
</view>
<view class="reply-item-txt u-flex-1">
<view class="reply-item-cell reply-item-title u-flex u-row-between" style="margin: 0;">
<text class="title">通讯录</text>
</view>
</view>
</view>
</view>
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" :sticky="false" :up="upOption"
:bottombar="false">
<!-- #ifndef APP-HARMONY -->
<view class="message-list">
<view class="message-list-box">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item v-for="(item, index) in list" :key="item.id" :right-options="options"
@click="handleRelocation(item.id)">
<view class="reply-item u-border-bottom u-flex" @click="toIm(item)" :id="'item'+index"
ref="mydom">
<view class="reply-item-img">
<u-avatar :src="baseURL+item.headIcon" mode="square" size="96" />
</view>
<view class="reply-item-txt u-flex-1">
<view class="reply-item-cell reply-item-title u-flex u-row-between">
<text class="title">{{item.realName}}/{{item.account}}</text>
<text class="u-font-24 againColor">{{yunzhupaas.toDateText(item.latestDate)}}</text>
</view>
<view class="reply-item-cell u-flex u-row-between">
<text
class="reply-item-txt-msg u-line-1 againColor">{{getMsgText(item.latestMessage,item.messageType)}}</text>
<u-badge type="error" :count="item.unreadMessage" :absolute="false" />
</view>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</view>
<!-- #endif -->
<!-- #ifdef APP-HARMONY -->
<view class="message-list">
<view class="message-list-box" :key="key">
<u-swipe-action v-show="swipeAction" v-for="(item, index) in list" :key="key" :options="options"
@open="openAction" @click="handleRelocation(item.id)" :show="item.show" :index="index">
<view class="reply-item u-border-bottom u-flex" @click="toIm(item)" :id="'item'+index"
ref="mydom">
<view class="reply-item-img">
<u-avatar :src="baseURL+item.headIcon" mode="square" size="96" />
</view>
<view class="reply-item-txt u-flex-1">
<view class="reply-item-cell reply-item-title u-flex u-row-between">
<text class="title">{{item.realName}}/{{item.account}}</text>
<text class="u-font-24 againColor">{{yunzhupaas.toDateText(item.latestDate)}}</text>
</view>
<view class="reply-item-cell u-flex u-row-between">
<text
class="reply-item-txt-msg u-line-1 againColor">{{getMsgText(item.latestMessage,item.messageType)}}</text>
<u-badge type="error" :count="item.unreadMessage" :absolute="false" />
</view>
</view>
</view>
</u-swipe-action>
</view>
</view>
<!-- #endif -->
</mescroll-body>
</view>
</template>
<script>
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import IndexMixin from './mixin.js'
import {
useChatStore
} from '@/store/modules/chat'
import {
getIMReply,
relocation
} from '@/api/message.js'
export default {
mixins: [MescrollMixin, IndexMixin],
data() {
return {
key: +new Date(),
keyword: '',
list: [],
options: [{
text: '移除',
style: {
backgroundColor: '#dd524d'
}
}],
upOption: {
use: false
},
swipeAction: false
}
},
watch: {
badgeNum(val) {
this.setTabBarBadge()
},
},
computed: {
msgInfo() {
const chatStore = useChatStore()
return chatStore.getMsgInfo
},
baseURL() {
return this.define.baseURL
},
},
onLoad() {
uni.$on('updateList', data => {
this.$nextTick(() => {
this.mescroll.triggerDownScroll()
})
})
uni.$on('updateMsgNum', id => {
this.updateMsgNum(id)
})
},
onUnload() {
uni.$off('updateList')
uni.$off('updateMsgNum')
},
methods: {
openAction(index) {
this.list[index].show = true;
this.list.map((val, idx) => {
if (index != idx) this.list[idx].show = false;
});
},
handleRelocation(id) {
relocation(id).then(res => {
this.init()
})
},
isJSON(str) {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
},
downCallback(page) {
this.init()
},
init() {
getIMReply().then(res => {
this.mescroll.endSuccess(res.data.list.length, false);
this.list = res.data.list || [];
this.swipeAction = true
uni.hideLoading()
}).catch(() => {
this.mescroll && this.mescroll.endErr();
})
},
search() {
return
this.searchTimer && clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.list = [];
this.mescroll.resetUpScroll();
}, 300)
},
updateMsgNum(id) {
const chatStore = useChatStore()
const len = this.list.length
for (let i = 0; i < len; i++) {
if (id === this.list[i].id) {
const num = this.list[i].unreadMessage
chatStore.reduceBadgeNum(num)
this.list[i].unreadMessage = 0
break
}
}
},
getMsgText(text, type) {
if (!text) return ""
let message = ''
switch (type) {
case 'voice':
message = '[语音]'
break;
case 'image':
message = '[图片]'
break;
default:
message = text
break;
}
return message
},
openPage(path) {
if (!path) return
uni.navigateTo({
url: path
})
},
toIm(item) {
const chatStore = useChatStore()
const name = item.realName + '/' + item.account
if (item.unreadMessage) {
chatStore.reduceBadgeNum(item.unreadMessage)
item.unreadMessage = 0
}
uni.navigateTo({
url: '/pages/message/im/index?name=' + name + '&formUserId=' + item.id + '&headIcon=' + item
.headIcon
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f0f2f6;
}
.message-v {
.search-box_sticky {
margin-bottom: 20rpx;
padding: 0 20rpx;
}
.replyList {
padding: 0 20rpx;
background-color: #fff;
.againColor {
color: #909399;
}
}
.reply-item {
height: 142rpx;
background-color: #fff;
padding: 0 20rpx;
.reply-item-img-sysMsg {
width: 96rpx;
height: 96rpx;
border-radius: 16rpx;
overflow: hidden;
margin-right: 16rpx;
flex-shrink: 0;
}
.reply-item-img {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
overflow: hidden;
margin-right: 16rpx;
flex-shrink: 0;
}
.reply-item-icon-color {
background-color: #2bd34f;
}
.reply-item-icon-color2 {
background-color: #3B87F7;
}
.reply-item-icon {
.icon-ym {
color: #fff;
font-size: 50rpx;
}
}
.reply-item-txt {
.reply-item-cell {
height: 40rpx;
color: #C6C6C6;
font-size: 24rpx;
&.reply-item-title {
height: 44rpx;
margin-bottom: 4px;
.title {
font-size: 28rpx;
color: #303133;
}
}
.reply-item-txt-msg {
width: 480rpx;
}
}
}
}
}
.search-box_sticky {
padding: 0 32rpx;
}
.message-list .uni-swipe {
margin-bottom: 0px !important;
border-radius: 0px !important;
}
.message-list {
.message-list-box {
margin: 0px !important;
::v-deep .u-swipe-action {
border-radius: 0;
}
}
}
</style>

24
pages/index/mixin.js Normal file
View File

@@ -0,0 +1,24 @@
import {
useChatStore
} from '@/store/modules/chat'
export default {
onShow() {
this.setTabBarBadge()
},
methods: {
setTabBarBadge() {
const chatStore = useChatStore()
const badgeNum = chatStore.getBadgeNum || 0
if (badgeNum) {
uni.setTabBarBadge({
index: 3,
text: badgeNum > 99 ? '99+' : badgeNum.toString()
});
} else {
uni.removeTabBarBadge({
index: 3
});
}
}
}
}

361
pages/index/my.vue Normal file
View File

@@ -0,0 +1,361 @@
<template>
<view class="my-v" v-if="loading">
<view class="u-flex user-box u-p-l-20 u-p-r-10 u-p-b-20">
<view class="u-m-r-10">
<u-avatar size="127" @click='chooseAvatar' :src='avatarSrc'></u-avatar>
</view>
<view class="u-flex-1 f-right" @click="personalPage('/pages/my/personalData/index')">
<view class="u-font-36 u-m-l-16">{{baseInfo.realName}}</view>
<view class="u-m-l-10 u-p-10">
<u-icon name="arrow-right" color="#969799" size="28"></u-icon>
</view>
</view>
</view>
<view class="u-m-t-20 my-group-box">
<view class="my-group-box-inner">
<u-cell-group :border="false" class="cell-group">
<u-cell-item :title="$t('app.my.organization')"
@click="openPage('/pages/my/business/index','Organize')" :title-style="titleStyle">
<template #icon>
<text class="icon-ym icon-ym-zuzhi u-m-r-16 u-font-32 my-list" />
</template>
</u-cell-item>
<u-cell-item :title="$t('app.my.position')" @click="openPage('/pages/my/business/index','Position')"
:title-style="titleStyle">
<template #icon>
<text class="icon-ym icon-ym-position1 u-m-r-16 u-font-32 my-list" />
</template>
</u-cell-item>
<u-cell-item :title="$t('app.my.subordinates')" @click="openPage('/pages/my/subordinate/index')"
:title-style="titleStyle">
<template #icon>
<text class="icon-ym icon-ym-generator-section u-m-r-16 u-font-32 my-list" />
</template>
</u-cell-item>
<u-cell-item :title="$t('app.my.entrustedAgency')" @click="openPage('/pages/my/entrustAgent/index')"
:title-style="titleStyle">
<template #icon>
<text class="icon-ym icon-ym-header-role-toggle u-m-r-16 u-font-32 my-list" />
</template>
</u-cell-item>
<u-cell-item :title="$t('app.my.switchIdentity')" @click="selectShow = true"
v-if="userInfo.standingList?.length > 1" :title-style="titleStyle">
<template #icon>
<text class="icon-ym icon-ym-header-role-toggle u-m-r-16 u-font-32 my-list" />
</template>
</u-cell-item>
<!-- #ifndef H5 -->
<u-cell-item :title="$t('app.my.scanCode')" @click="scanCode()" :title-style="titleStyle">
<template #icon>
<text class="icon-ym icon-ym-scanCode1 u-m-r-16 u-font-32 my-list" />
</template>
</u-cell-item>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<u-cell-item :title="$t('app.my.accountSecurity')"
@click="openPage('/pages/my/accountSecurity/index')" :title-style="titleStyle">
<template #icon>
<text class="icon-ym icon-ym-zhanghao u-m-r-16 u-font-32 my-list" />
</template>
</u-cell-item>
<!-- #endif -->
<u-cell-item :title="$t('app.my.setting')" @click="openPage('/pages/my/settings/index')"
:title-style="titleStyle" :border-bottom="false">
<template #icon>
<text class="icon-ym icon-ym-shezhi u-m-r-16 u-font-32 my-list" />
</template>
</u-cell-item>
</u-cell-group>
</view>
</view>
<view class="u-p-t-20">
<view class="logout-cell" hover-class="u-cell-hover" @click="logout">{{$t('app.my.logOut')}}</view>
</view>
<u-select v-model="selectShow" :list="selectList" mode="single-column" value-name='id' label-name='name'
:default-value="defaultValue" @confirm="confirm"></u-select>
</view>
</template>
<script>
import IndexMixin from './mixin.js'
import {
UpdateAvatar,
UserSettingInfo,
setMajor
} from '@/api/common'
import chat from '@/libs/chat.js'
import {
useUserStore
} from '@/store/modules/user'
import {
useChatStore
} from '@/store/modules/chat'
export default {
mixins: [IndexMixin],
data() {
return {
defaultValue: [],
selectList: [],
selectShow: false,
titleStyle: {
color: '#606266'
},
userInfo: '',
avatarSrc: '',
baseInfo: {},
loading: false,
cellItemColor: ['#6071F5', '#F4A02F', '#2B7FF0', '#4CBF2A']
}
},
computed: {
baseURL() {
return this.define.comUploadUrl
},
baseURL2() {
return this.define.baseURL
},
token() {
return uni.getStorageSync('token')
},
report() {
return this.define.report
}
},
onLoad() {
const chatStore = useChatStore()
if (!chatStore.getSocket) chat.initSocket()
},
onShow() {
UserSettingInfo().then(res => {
this.baseInfo = res.data || {}
this.avatarSrc = this.baseURL2 + this.baseInfo.avatar
this.loading = true
})
this.setStanding()
},
methods: {
confirm(e) {
if (e[0].index == this.defaultValue[0]) return
let data = {
majorId: e[0].value,
majorType: "Standing",
menuType: 1,
}
setMajor(data).then(res => {
this.$u.toast(res.msg)
this.getCurrentUser()
})
},
setStanding() {
this.selectShow = false
this.userInfo = uni.getStorageSync('userInfo') || {}
this.selectList = []
this.selectList = JSON.parse(JSON.stringify(this.userInfo.standingList))
this.selectList.forEach((o, i) => {
o.id = Number(this.selectList[i].id)
})
this.defaultValue = [this.selectList.findIndex(o => o.currentStanding)];
},
getCurrentUser() {
const userStore = useUserStore()
userStore.getCurrentUser().then(() => {
this.setStanding()
})
},
chooseAvatar() {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
success: (res) => {
// #ifdef H5
let isAccept = new RegExp('image/*').test(res.tempFiles[0].type)
if (!isAccept) return this.$u.toast(`请上传图片`)
// #endif
let tempFilePaths = res.tempFilePaths[0]
uni.uploadFile({
url: this.baseURL + 'userAvatar',
filePath: tempFilePaths,
name: 'file',
header: {
'Authorization': this.token
},
success: (uploadFileRes) => {
let data = JSON.parse(uploadFileRes.data)
if (data.code === 200) {
UpdateAvatar(data.data.name).then(res => {
this.$u.toast('头像更换成功')
this.avatarSrc = this.baseURL2 + data.data.url
})
} else {
this.$u.toast(data.msg)
}
},
fail: (err) => {
this.$u.toast('头像更换失败')
}
});
}
});
},
openPage(path, type) {
if (!path) return
let url = !!type ? path + '?majorType=' + type : path
uni.navigateTo({
url: url
})
},
personalPage(path) {
if (!path) return
uni.navigateTo({
url: path + '?baseInfo=' + encodeURIComponent(JSON
.stringify(this.baseInfo))
})
},
isJSON(str) {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
} else {
return false;
}
} catch (e) {
return false;
}
},
logout() {
uni.showModal({
title: '提示',
content: '确定退出当前账号吗?',
success: res => {
if (res.confirm) {
const userStore = useUserStore()
userStore.logout().then(() => {
uni.closeSocket()
uni.reLaunch({
url: '/pages/login/index'
})
})
this.removeAccount()
}
}
})
},
removeAccount() {
let model = uni.getStorageSync('rememberAccount')
if (!model.remember) {
model.account = ''
model.password = ''
model.remember = false
uni.setStorageSync('rememberAccount', model)
}
},
scanCode() {
uni.scanCode({
success: res => {
let url = ""
if (this.isJSON(res.result.trim())) {
const result = JSON.parse(res.result.trim())
if (result.t === 'ADP') {
let config = {
isPreview: 1,
moduleId: result.id,
previewType: result.previewType
}
url = '/pages/apply/dynamicModel/index?config=' + this.yunzhupaas.base64.encode(JSON
.stringify(config))
}
if (result.t === 'DFD') {
url = '/pages/apply/dynamicModel/scanForm?config=' + JSON.stringify(result)
}
if (result.t === 'WFP') {
url = '/pages/workFlow/scanForm/index?config=' + JSON.stringify(result)
}
if (result.t === 'report') {
let url_ =
`${this.report}/preview.html?id=${result.id}&token=${this.token}&page=1&from=menu`
url = '/pages/apply/externalLink/index?url=' + encodeURIComponent(url_) +
'&fullName= ' + result.fullName
}
if (result.t === 'portal') {
url = '/pages/portal/scanPortal/index?id=' + result.id
}
if (result.t === 'login') {
url = '/pages/login/scanLogin?id=' + result.id
}
} else {
url = '/pages/my/scanResult/index?result=' + res.result
}
uni.navigateTo({
url,
fail: (err) => {
this.$u.toast("暂无此页面")
}
})
}
});
}
}
}
</script>
<style lang="scss">
page {
background-color: #f0f2f6;
}
.my-v {
:deep(.u-cell) {
height: 112rpx;
padding: 0;
}
.my-group-box {
.my-group-box-inner {
background-color: #fff;
.cell-group {
padding: 0 20rpx;
.icon-ym-zuzhi {
color: #6071F5;
}
.icon-ym-position1 {
color: #2B7FF0;
}
.icon-ym-generator-section {
color: #F4A02F;
}
.icon-ym-shezhi {
color: #4CBF2A;
}
}
}
}
.user-box {
background-color: #fff;
}
.logout-cell {
text-align: center;
font-size: 32rpx;
height: 108rpx;
background-color: #fff;
color: #D82828;
line-height: 98rpx;
font-family: PingFang SC;
}
.f-right {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
text-align: center;
}
}
</style>

410
pages/index/workFlow.vue Normal file
View File

@@ -0,0 +1,410 @@
<template>
<view class="workFlow-v">
<view class="workFlow-nodata" v-show="!workflowEnabled">
<view class="u-flex-col" style="align-items: center;">
<u-image width="280rpx" height="280rpx" :src="emptyImg"></u-image>
<text class="u-m-t-20" style="color: #909399;">该应用协同办公未开启</text>
</view>
</view>
<view class="notice-warp" v-show="workflowEnabled" :style="{'height':noticeWarpH+'px'}">
<view class="search-box">
<u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
:show-action="false" @change="search" bg-color="#f0f2f6" shape="square" />
</view>
<view class="head-tabs u-flex">
<view class="head-tabs-item" @click="openPage('/pages/workFlow/flowTodo/index')">
<text class="icon-ym icon-ym-flowTodo-app u-m-r-4 icon-style" />
<text class="u-font-24 head-tabs-name">审批</text>
<u-badge type="error" class="badge" :count="count" :absolute="true" :offset="offset">
</u-badge>
</view>
<u-line color="#EEF0F4" style="flex: none;height: 34%;" direction="col" />
<view class="head-tabs-item" @click="openPage('/pages/workFlow/schedule/index')">
<text class="icon-ym icon-ym-flowDone-app u-m-r-4 icon-style" />
<text class="u-font-24 head-tabs-name">日程</text>
</view>
<u-line color="#EEF0F4" style="flex: none;height: 34%;" direction="col" />
<view class="head-tabs-item" @click="openPage('/pages/workFlow/document/index')">
<text class="icon-ym icon-ym-flowCopy-app u-m-r-4 icon-style" />
<text class="u-font-24 head-tabs-name">文档</text>
</view>
</view>
</view>
<mescroll-body ref="mescrollRef" @down="downCallback" :down="downOption" :sticky="false" @up="upCallback"
:up="upOption" :bottombar="false" @init="mescrollInit" v-show="workflowEnabled" :top='mescrollTop'>
<view class="common-block">
<view class="caption u-flex">
<text class="caption-left">常用流程</text>
<view class="u-flex" @click="openPage('/pages/commonPage/morePage/index?type=1')">
<text class="caption-right">{{$t('common.moreText')}}</text>
<u-icon name="arrow-right" size="24"></u-icon>
</view>
</view>
<view class="u-flex u-flex-wrap">
<view class="item u-flex-col u-col-center" v-for="(item, i) in usualList" :key="i"
@click="Jump(item, 1)">
<text class="u-font-40 item-icon" :class="item.icon"
:style="{ background: item.iconBackground || '#008cff' }" />
<text class="u-font-24 u-line-1 item-text">{{ item.fullName }}</text>
</view>
<view class="item u-flex-col u-col-center" @click="moreApp">
<text class="u-font-40 item-icon more">+</text>
<text class="u-font-24 u-line-1 item-text">添加</text>
</view>
</view>
</view>
<view>
<CommonTabs :list="categoryList" @change="change" :current="current" ref="CommonTabs"></CommonTabs>
</view>
<view class="workFlow-list u-m-t-20">
<view class="part">
<view class="caption u-line-1" v-if="list.length >= 1">
{{ current === 0 ? "全部流程" : fullName }}
</view>
<view class="u-flex u-flex-wrap">
<view class="item u-flex-col u-col-center" v-for="(child, ii) in list" :key="ii"
@click="Jump(child)">
<text class="u-font-40 item-icon" :class="child.icon"
:style="{ background: child.iconBackground || '#008cff' }" />
<text class="u-font-24 u-line-1 item-text">{{ child.fullName }}</text>
</view>
</view>
</view>
</view>
</mescroll-body>
<MultSelect :show="show" :list="selector" @confirm="confirm" @close="show = false" isFlow />
</view>
</template>
<script>
import {
getFlowSelector,
getFlowTodoCount
} from "@/api/workFlow/flowEngine";
import MultSelect from '@/components/MultSelect'
import CommonTabs from '@/components/CommonTabs'
import {
getFlowUsualList
} from "@/api/apply/apply.js";
import resources from "@/libs/resources.js";
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import IndexMixin from "./mixin.js";
import {
useUserStore
} from '@/store/modules/user'
import {
useBaseStore
} from '@/store/modules/base'
const baseStore = useBaseStore()
export default {
mixins: [MescrollMixin, IndexMixin],
components: {
MultSelect,
CommonTabs
},
data() {
return {
selector: [],
show: false,
activeFlow: {},
templateList: [],
count: 0,
offset: [-25, 60],
usualList: [],
downOption: {
use: true,
auto: true,
},
className: "",
emptyImg: resources.message.nodata,
upOption: {
page: {
num: 0,
size: 50,
time: null,
},
empty: {
use: true,
icon: resources.message.nodata,
tip: this.$t('common.noData'),
fixed: false,
top: "560rpx",
},
textNoMore: this.$t('app.apply.noMoreData'),
},
keyword: "",
category: "",
current: 0,
categoryList: [],
list: [],
fullName: "",
loading: false,
selectFlowValue: 0,
enCode: "",
workflowEnabled: false,
noticeWarpH: 120,
mescrollTop: 120
};
},
onLoad() {
uni.showLoading()
const userStore = useUserStore()
userStore.getCurrentUser().then((res) => {
const userInfo = uni.getStorageSync('userInfo') || {}
uni.hideLoading()
this.workflowEnabled = !!userInfo.workflowEnabled
if (!this.workflowEnabled) return
uni.$on("updateUsualList", (data) => {
this.getFlowUsualList();
});
this.getPaymentMethodOptions();
this.getContentHeight()
})
},
onUnload() {
uni.$off("updateUsualList");
},
onShow() {
this.keyword = ""
const userInfo = uni.getStorageSync('userInfo') || {}
this.workflowEnabled = !!userInfo.workflowEnabled
this.$nextTick(() => {
this.list = [];
this.mescroll.resetUpScroll();
if (!this.workflowEnabled) return
this.setFlowTodoCount()
this.getPaymentMethodOptions();
})
},
onHide() {
this.restTabs()
},
methods: {
async getContentHeight() {
const windowHeight = this.$u.sys().windowHeight;
// 获取元素尺寸
const [headTabs, searchBox] = await Promise.all([
this.$uGetRect('.head-tabs'),
this.$uGetRect('.search-box')
]);
this.noticeWarpH = headTabs.height + searchBox.height
this.mescrollTop = this.noticeWarpH + 10
},
restTabs() {
this.current = 0;
this.category = ""
},
change(i) {
this.list = [];
this.current = i
this.category = this.categoryList[i].id || "";
this.mescroll.resetUpScroll();
},
setFlowTodoCount() {
const query = {
flowCirculateType: [],
flowDoneType: [],
toBeReviewedType: [],
}
getFlowTodoCount(query).then((res) => {
this.count = res.data.toBeReviewed || 0;
})
},
openPage(path) {
if (!path) return;
this.restTabs()
uni.navigateTo({
url: path,
});
},
upCallback(page) {
this.$nextTick(() => {
this.getFlowUsualList();
});
let query = {
currentPage: page.num,
pageSize: page.size,
keyword: this.keyword,
category: this.category == 0 ? "" : this.category,
flowType: 0,
};
this.loading = false;
getFlowSelector(query, {
load: page.num == 1,
}).then((res) => {
let resData = res.data.list || [];
this.mescroll.endSuccess(resData.length);
if (page.num == 1) this.list = [];
const list = resData.map((o) => ({
show: false,
...o,
}));
this.list = this.list.concat(list);
this.loading = true;
}).catch(() => {
this.mescroll.endErr();
});
},
search() {
this.searchTimer && clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.list = [];
this.mescroll.resetUpScroll();
}, 300);
},
//获取常用
getFlowUsualList() {
let query = {
category: 'commonFlow',
flowType: 0
}
getFlowUsualList(query).then((res) => {
let list = res.data.list.map((o) => {
const objectData = o.objectData ? JSON.parse(o.objectData) : {};
return {
...o,
...objectData,
};
});
this.usualList = [...list].slice(0, 11)
});
},
getPaymentMethodOptions() {
baseStore.getDictionaryData({
sort: "businessType",
}).then((res) => {
const firstItem = {
fullName: "全部流程",
id: ''
}
this.categoryList = [firstItem, ...(res || [])]
});
},
moreApp() {
uni.navigateTo({
url: "/pages/commonPage/allApp/index?categoryList=" +
encodeURIComponent(JSON.stringify(this.categoryList)),
});
},
confirm(e) {
this.activeFlow = e[0];
this.Jump();
},
Jump(item) {
const config = {
id: "",
flowId: item.id,
opType: "-1",
isFlow: 1
};
uni.navigateTo({
url: "/pages/workFlow/flowBefore/index?config=" +
this.yunzhupaas.base64.encode(JSON.stringify(config))
});
}
},
};
</script>
<style lang="scss">
page {
background-color: #f0f2f6;
}
.workFlow-v {
.common-block {
background: #fff;
margin-bottom: 20rpx;
.caption {
padding: 0 32rpx;
line-height: 100rpx;
justify-content: space-between;
.caption-left {
font-size: 36rpx;
font-weight: bold;
}
.caption-right {}
}
.item {
// margin-bottom: 32rpx;
padding: 1rem 0;
width: 25%;
.item-icon {
width: 88rpx;
height: 88rpx;
margin-bottom: 8rpx;
line-height: 88rpx;
text-align: center;
border-radius: 20rpx;
color: #fff;
font-size: 56rpx;
&.more {
background: #ececec;
color: #666666;
font-size: 50rpx;
}
}
.item-text {
width: 100%;
text-align: center;
padding: 0 16rpx;
}
}
}
.notice-warp {
height: 210rpx;
.search-box {
padding: 20rpx;
}
}
.head-tabs {
width: 100%;
padding: 0 32rpx;
height: 100rpx;
justify-content: space-between;
.head-tabs-item {
width: 25%;
display: flex;
justify-content: center;
font-size: 28rpx;
color: #303133;
flex-shrink: 0;
position: relative;
align-items: center;
.icon-style {
font-size: 46rpx;
color: #666666;
}
.head-tabs-name {
color: #303133;
font-family: PingFang SC;
}
}
}
.workFlow-nodata {
position: absolute;
top: 450rpx;
width: 100%;
text-align: center;
z-index: 100;
background-color: #f0f2f6;
}
}
</style>