1
2
env/.env.development
vendored
@ -5,5 +5,5 @@ VITE_DELETE_CONSOLE = false
|
||||
# 是否开启sourcemap
|
||||
VITE_SHOW_SOURCEMAP = true
|
||||
|
||||
#VITE_SERVER_BASEURL = 'http://127.0.0.1:8080/jeecg-boot'
|
||||
#VITE_SERVER_BASEURL = 'http://10.75.15.249:8080/jeecg-boot'
|
||||
VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot'
|
||||
104
pages.config.ts
@ -1,55 +1,55 @@
|
||||
import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
|
||||
|
||||
export default defineUniPages({
|
||||
globalStyle: {
|
||||
navigationStyle: 'default',
|
||||
navigationBarTitleText: 'uniapp',
|
||||
navigationBarBackgroundColor: '#f8f8f8',
|
||||
navigationBarTextStyle: 'black',
|
||||
backgroundColor: '#FFFFFF',
|
||||
},
|
||||
easycom: {
|
||||
autoscan: true,
|
||||
custom: {
|
||||
'^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue',
|
||||
'^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)':
|
||||
'z-paging/components/z-paging$1/z-paging$1.vue',
|
||||
},
|
||||
},
|
||||
tabBar: {
|
||||
color: '#aaa',
|
||||
selectedColor: '#39b54a',
|
||||
backgroundColor: '#F8F8F8',
|
||||
borderStyle: 'black',
|
||||
height: '50px',
|
||||
fontSize: '11px',
|
||||
iconWidth: '24px',
|
||||
spacing: '3px',
|
||||
list: [
|
||||
{
|
||||
iconPath: 'static/tabbar/tabbar-message-2.png',
|
||||
selectedIconPath: 'static/tabbar/tabbar-message.png',
|
||||
pagePath: 'pages/message/message',
|
||||
text: '消息',
|
||||
},
|
||||
{
|
||||
iconPath: 'static/tabbar/tabbar-home-2.png',
|
||||
selectedIconPath: 'static/tabbar/tabbar-home.png',
|
||||
pagePath: 'pages/index/index',
|
||||
text: '协作',
|
||||
},
|
||||
{
|
||||
iconPath: 'static/tabbar/tabbar-workHome-2.png',
|
||||
selectedIconPath: 'static/tabbar/tabbar-workHome.png',
|
||||
pagePath: 'pages/workHome/index',
|
||||
text: '工作台',
|
||||
},
|
||||
{
|
||||
iconPath: 'static/tabbar/tabbar-user-2.png',
|
||||
selectedIconPath: 'static/tabbar/tabbar-user.png',
|
||||
pagePath: 'pages/user/people',
|
||||
text: '个人',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
globalStyle: {
|
||||
navigationStyle: 'default',
|
||||
navigationBarTitleText: 'uniapp',
|
||||
navigationBarBackgroundColor: '#f8f8f8',
|
||||
navigationBarTextStyle: 'black',
|
||||
backgroundColor: '#FFFFFF',
|
||||
},
|
||||
easycom: {
|
||||
autoscan: true,
|
||||
custom: {
|
||||
'^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue',
|
||||
'^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)':
|
||||
'z-paging/components/z-paging$1/z-paging$1.vue',
|
||||
},
|
||||
},
|
||||
tabBar: {
|
||||
color: '#aaa',
|
||||
selectedColor: '#39b54a',
|
||||
backgroundColor: '#F8F8F8',
|
||||
borderStyle: 'black',
|
||||
height: '50px',
|
||||
fontSize: '11px',
|
||||
iconWidth: '24px',
|
||||
spacing: '3px',
|
||||
list: [
|
||||
{
|
||||
iconPath: 'static/tabbar/tabbar-home-2.png',
|
||||
selectedIconPath: 'static/tabbar/tabbar-home.png',
|
||||
pagePath: 'pages/index/index',
|
||||
text: '首页',
|
||||
},
|
||||
{
|
||||
iconPath: 'static/tabbar/tabbar-message-2.png',
|
||||
selectedIconPath: 'static/tabbar/tabbar-message.png',
|
||||
pagePath: 'pages/message/message',
|
||||
text: '消息',
|
||||
},
|
||||
{
|
||||
iconPath: 'static/tabbar/tabbar-workHome-2.png',
|
||||
selectedIconPath: 'static/tabbar/tabbar-workHome.png',
|
||||
pagePath: 'pages/workHome/index',
|
||||
text: '工作台',
|
||||
},
|
||||
{
|
||||
iconPath: 'static/tabbar/tabbar-user-2.png',
|
||||
selectedIconPath: 'static/tabbar/tabbar-user.png',
|
||||
pagePath: 'pages/user/people',
|
||||
text: '个人',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
18
src/App.vue
@ -1,20 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { onLaunch, onShow, onHide, onLoad, onReady } from '@dcloudio/uni-app'
|
||||
import { onLaunch, onShow } from '@dcloudio/uni-app'
|
||||
import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
|
||||
import { beforEach } from '@/router/index'
|
||||
import { jurisdictionApi } from '@/api/system';
|
||||
import { useAppStore, useUpdateApp } from '@/store'
|
||||
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { getLocation } from '@/utils';
|
||||
export default {
|
||||
onLaunch: function (options) {
|
||||
console.log('App Launch')
|
||||
console.log('应用启动路径:', options.path)
|
||||
// 检查更新
|
||||
useUpdateApp().checkAppUpdate()
|
||||
// useUpdateApp().checkAppUpdate()
|
||||
// 定位
|
||||
getLocation()
|
||||
},
|
||||
onShow: function (options) {
|
||||
console.log('App Show')
|
||||
console.log('应用启动路径:', options.path)
|
||||
|
||||
// 首次进入页面时路由拦截
|
||||
setTimeout(() => {
|
||||
const currentPage = options.path
|
||||
@ -32,10 +32,6 @@
|
||||
appStore.setIsGray(res.result.value) // 更新状态
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
onHide: function () {
|
||||
console.log('App Hide')
|
||||
},
|
||||
|
||||
// 全局变量
|
||||
|
||||
27
src/api/system/department.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { http } from '@/utils/http';
|
||||
|
||||
/**
|
||||
* 根据单位code获取单位名称
|
||||
* @param 单位code
|
||||
* @returns 单位名称
|
||||
*/
|
||||
export function queryDepByOrgCodeApi(code : string) {
|
||||
return http({
|
||||
url: '/sys/sysDepart/queryDepNameByDepCode',
|
||||
method: 'GET',
|
||||
data: {
|
||||
code
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前用户的所有部门/当前部门编码
|
||||
* @returns 单位编码
|
||||
*/
|
||||
export function queryDepsByUserIdApi() {
|
||||
return http({
|
||||
url: '/sys/user/getCurrentUserDeparts',
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
@ -35,10 +35,10 @@ export function upDateAppApi() {
|
||||
|
||||
/**
|
||||
* 获取是否灰化
|
||||
* @param id 登录参数
|
||||
* @param id 权限id
|
||||
* @returns 0正常 1灰化
|
||||
*/
|
||||
export function jurisdictionApi(id : string) { // 是否灰化
|
||||
export function jurisdictionApi(id : string) {
|
||||
return http({
|
||||
url: '/CxcJurisdiction/cxcJurisdiction/queryById',
|
||||
method: 'GET',
|
||||
@ -48,3 +48,21 @@ export function jurisdictionApi(id : string) { // 是否灰化
|
||||
});
|
||||
}
|
||||
|
||||
export function getUserPermissionApi(config) { // 获取权限
|
||||
return http({
|
||||
url: '/sys/permission/getUserPermissionByToken',
|
||||
method: 'GET',
|
||||
data: config
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页轮播图
|
||||
*/
|
||||
export function queryCarouselApi(config) {
|
||||
return http({
|
||||
url: '/CxcDaping/cxcDaping/list',
|
||||
method: 'GET',
|
||||
data: config
|
||||
});
|
||||
}
|
||||
29
src/api/system/user.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { http } from '@/utils/http';
|
||||
|
||||
/**
|
||||
* 根据用户名获取职务名称
|
||||
* @param username 用户名
|
||||
* @returns 职务名称
|
||||
*/
|
||||
export function queryPostByUserIdApi(userid : string) {
|
||||
return http({
|
||||
url: '/sys/user/queryPostByUserId',
|
||||
method: 'GET',
|
||||
data: {
|
||||
userid
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
* @param config 用户信息
|
||||
* @returns
|
||||
*/
|
||||
export function editUserApi(config) {
|
||||
return http({
|
||||
url: '/sys/user/appEdit',
|
||||
method: 'PUT',
|
||||
data: config
|
||||
});
|
||||
}
|
||||
@ -8,7 +8,7 @@ export const X_TENANT_ID = 'X-Tenant-Id'
|
||||
export const X_Low_App_ID = 'X-Low-App-ID'
|
||||
export const TENANT_LIST = 'tenant_list'
|
||||
export const ROUTE_PARAMS = "cacheRouteParams"
|
||||
export const HOME_PAGE = "/pages/message/message"
|
||||
export const HOME_PAGE = "/pages/index/index"
|
||||
//首页配置项缓存时间10分钟
|
||||
export const HOME_CONFIG_EXPIRED_TIME = 10*60
|
||||
export const phone = '---'
|
||||
|
||||
@ -1,135 +0,0 @@
|
||||
/**
|
||||
* 常用服务
|
||||
* useful server
|
||||
*/
|
||||
|
||||
const icon_prefix = '/static/index/128/'
|
||||
|
||||
/*
|
||||
*/
|
||||
export const us = {
|
||||
data: [
|
||||
{
|
||||
title: 'online',
|
||||
icon: icon_prefix + 'qingjia1.png',
|
||||
description: '请假申请',
|
||||
useCount: 10000,
|
||||
routeIndex: 'online',
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
title: '组件示例',
|
||||
icon: icon_prefix + 'chuchai.png',
|
||||
description: '出差申请',
|
||||
useCount: 10000,
|
||||
routeIndex: 'demo',
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
title: '公文发文',
|
||||
icon: icon_prefix + 'gongwen.png',
|
||||
description: '公文发文',
|
||||
useCount: 10000,
|
||||
routeIndex: 'docSend',
|
||||
},
|
||||
{
|
||||
title: '通知公告',
|
||||
icon: icon_prefix + 'tongzhi.png',
|
||||
description: '查看企业对员工下发的通知公告',
|
||||
useCount: 10000,
|
||||
routeIndex: 'annotationList',
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
title: '日程',
|
||||
icon: icon_prefix + 'richeng.png',
|
||||
description: '建立和查看个人工作安排',
|
||||
useCount: 10000,
|
||||
routeIndex: 'plan',
|
||||
},
|
||||
{
|
||||
title: '考勤',
|
||||
icon: icon_prefix + 'kaoqin.png',
|
||||
description: '工作考勤',
|
||||
routeIndex: 'attendance',
|
||||
useCount: 10000,
|
||||
},
|
||||
{
|
||||
title: '内部邮件',
|
||||
icon: icon_prefix + 'youjian.png',
|
||||
description: '查看内部消息',
|
||||
useCount: 10000,
|
||||
dot: false,
|
||||
routeIndex: 'mailHome',
|
||||
},
|
||||
{
|
||||
title: '通讯录',
|
||||
icon: icon_prefix + 'tongxun.png',
|
||||
description: '查看组员',
|
||||
useCount: 10000,
|
||||
//routeIndex:'addressBook',
|
||||
routeIndex: 'levelAddressBook',
|
||||
},
|
||||
{
|
||||
title: '日报',
|
||||
icon: icon_prefix + 'richang.png',
|
||||
description: '记录每天的工作经验和心得',
|
||||
useCount: 1000,
|
||||
},
|
||||
{
|
||||
title: '周报',
|
||||
icon: icon_prefix + 'zhoubao.png',
|
||||
description: '总结每周的工作情况和下周计划',
|
||||
useCount: 10000,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
/**
|
||||
* other server 其他服务
|
||||
*/
|
||||
export const os = {
|
||||
data: [
|
||||
{
|
||||
title: '新闻中心',
|
||||
icon: icon_prefix + 'xinwen.png',
|
||||
description: '新闻中心',
|
||||
routeIndex: 'columnList',
|
||||
useCount: 10000,
|
||||
},
|
||||
{
|
||||
title: '文档中心',
|
||||
icon: icon_prefix + 'wendang.png',
|
||||
description: '文档中心',
|
||||
routeIndex: 'fileHome',
|
||||
useCount: 10000,
|
||||
},
|
||||
{
|
||||
title: '会议',
|
||||
icon: icon_prefix + 'huiyi.png',
|
||||
description: '会议',
|
||||
useCount: 10000,
|
||||
routeIndex: 'meeting',
|
||||
},
|
||||
{
|
||||
title: '任务中心',
|
||||
icon: icon_prefix + 'renwu.png',
|
||||
description: '任务中心',
|
||||
useCount: 10000,
|
||||
},
|
||||
{
|
||||
title: '合同',
|
||||
icon: icon_prefix + 'hetong.png',
|
||||
description: '合同',
|
||||
useCount: 10000,
|
||||
},
|
||||
// #ifndef MP-WEIXIN
|
||||
{
|
||||
title: '聊天',
|
||||
icon: icon_prefix + 'kehu.png',
|
||||
description: '聊天',
|
||||
routeIndex: 'chathome',
|
||||
},
|
||||
// #endif
|
||||
],
|
||||
}
|
||||
@ -1,124 +1,123 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<template v-if="imgSrc">
|
||||
<view class="showArea">
|
||||
<view class="iconBox" @click="handleDel">
|
||||
<view class="cuIcon-close"></view>
|
||||
</view>
|
||||
<wd-img
|
||||
:radius="4"
|
||||
enable-preview
|
||||
label="头像"
|
||||
width="60px"
|
||||
height="60px"
|
||||
:src="imgSrc"
|
||||
></wd-img>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="uploadArea" @click="handleUpload">
|
||||
<view class="iconBox">
|
||||
<view class="cuIcon-cameraadd"></view>
|
||||
</view>
|
||||
</div>
|
||||
</template>
|
||||
<wd-message-box></wd-message-box>
|
||||
</view>
|
||||
<view class="wrap">
|
||||
<template v-if="imgSrc">
|
||||
<view class="showArea">
|
||||
<view class="iconBox" @click="handleDel">
|
||||
<view class="cuIcon-close"></view>
|
||||
</view>
|
||||
<wd-img :radius="4" enable-preview label="头像" width="60px" height="60px" :src="imgSrc"></wd-img>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="uploadArea" @click="handleUpload">
|
||||
<view class="iconBox">
|
||||
<view class="cuIcon-cameraadd"></view>
|
||||
</view>
|
||||
</div>
|
||||
</template>
|
||||
<wd-message-box></wd-message-box>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useMessage, useToast } from 'wot-design-uni'
|
||||
import { computed, watch } from 'vue'
|
||||
import { getEnvBaseUrl } from '@/utils/index'
|
||||
import { useMessage, useToast } from 'wot-design-uni'
|
||||
import { computed, watch } from 'vue'
|
||||
import { getEnvBaseUrl } from '@/utils/index'
|
||||
import { getFileAccessHttpUrl } from '@/common/uitls'
|
||||
import { useUserStore } from '@/store/user'
|
||||
const userStore = useUserStore()
|
||||
|
||||
defineOptions({
|
||||
name: 'avatar',
|
||||
options: {
|
||||
// apply-shared:当前页面样式会影响到子组件样式.(小程序)
|
||||
// shared:当前页面样式影响到子组件,子组件样式也会影响到当前页面.(小程序)
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
})
|
||||
const props = defineProps(['modelValue'])
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
defineOptions({
|
||||
name: 'avatar',
|
||||
options: {
|
||||
// apply-shared:当前页面样式会影响到子组件样式.(小程序)
|
||||
// shared:当前页面样式影响到子组件,子组件样式也会影响到当前页面.(小程序)
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
})
|
||||
const props = defineProps(['modelValue'])
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const toast = useToast()
|
||||
const message = useMessage()
|
||||
const api = {
|
||||
uploadUrl: `${getEnvBaseUrl()}/sys/common/upload`,
|
||||
}
|
||||
let stopWatch
|
||||
|
||||
const toast = useToast()
|
||||
const message = useMessage()
|
||||
const api = {
|
||||
uploadUrl: `${getEnvBaseUrl()}/sys/common/upload`,
|
||||
}
|
||||
let stopWatch
|
||||
|
||||
const imgSrc = computed(() => {
|
||||
return props.modelValue
|
||||
})
|
||||
const handleDel = () => {
|
||||
message
|
||||
.confirm({
|
||||
msg: '确定要删除这个头像吗?',
|
||||
title: '提示',
|
||||
})
|
||||
.then(() => {
|
||||
emit('update:modelValue', '')
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('点击了取消按钮')
|
||||
})
|
||||
}
|
||||
const handleUpload = () => {
|
||||
const { loading, data, error, run } = useUpload({ name: 'file' }, { url: api.uploadUrl })
|
||||
if (stopWatch) stopWatch()
|
||||
run()
|
||||
stopWatch = watch(
|
||||
() => [loading.value, error.value, data.value],
|
||||
([loading, err, data], oldValue) => {
|
||||
if (loading == false) {
|
||||
if (err) {
|
||||
toast.warning('修改失败')
|
||||
} else {
|
||||
if (data) {
|
||||
emit('update:modelValue', data.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
const imgSrc = computed(() => {
|
||||
return getFileAccessHttpUrl(props.modelValue)
|
||||
})
|
||||
const handleDel = () => {
|
||||
message
|
||||
.confirm({
|
||||
msg: '确定要删除这个头像吗?',
|
||||
title: '提示',
|
||||
})
|
||||
.then(() => {
|
||||
emit('update:modelValue', '')
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('点击了取消按钮')
|
||||
})
|
||||
}
|
||||
const handleUpload = () => {
|
||||
const { loading, data, error, run } = useUpload({ name: 'file' }, { url: `${getEnvBaseUrl()}/sys/common/upload?appPath=用户头像/` + userStore.userInfo.realname})
|
||||
if (stopWatch) stopWatch()
|
||||
run()
|
||||
stopWatch = watch(
|
||||
() => [loading.value, error.value, data.value],
|
||||
([loading, err, data], oldValue) => {
|
||||
if (loading == false) {
|
||||
if (err) {
|
||||
toast.warning('修改失败')
|
||||
} else {
|
||||
if (data) {
|
||||
emit('update:modelValue', data.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.showArea {
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
.iconBox {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
border-bottom-left-radius: 3px;
|
||||
padding: 3px 6px;
|
||||
height: auto;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 1;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
.uploadArea {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
.iconBox {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
border: 2px solid #eee;
|
||||
color: #8799a3;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
font-size: 27px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.showArea {
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
|
||||
.iconBox {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
border-bottom-left-radius: 3px;
|
||||
padding: 3px 6px;
|
||||
height: auto;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 1;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.uploadArea {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
|
||||
.iconBox {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
border: 2px solid #eee;
|
||||
color: #8799a3;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
font-size: 27px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,188 +1,162 @@
|
||||
<route lang="json5" type="page">
|
||||
{
|
||||
layout: 'default',
|
||||
style: {
|
||||
navigationBarTitleText: '',
|
||||
navigationStyle: 'custom',
|
||||
},
|
||||
}
|
||||
{
|
||||
layout: 'default',
|
||||
style: {
|
||||
navigationBarTitleText: '',
|
||||
navigationStyle: 'custom',
|
||||
},
|
||||
}
|
||||
</route>
|
||||
|
||||
<template>
|
||||
<PageLayout navTitle="编辑资料" backRouteName="people" routeMethod="pushTab">
|
||||
<wd-form custom-class="pt3" ref="form" :model="model">
|
||||
<wd-cell-group border>
|
||||
<wd-input
|
||||
label="用户名"
|
||||
prop="username"
|
||||
clearable
|
||||
label-width="70px"
|
||||
v-model="model.username"
|
||||
:readonly="true"
|
||||
placeholder="请输入用户名"
|
||||
/>
|
||||
<wd-input
|
||||
label="名称"
|
||||
prop="realname"
|
||||
clearable
|
||||
label-width="70px"
|
||||
v-model="model.realname"
|
||||
placeholder="请输入用户名"
|
||||
:rules="[{ validator: rules.realname }]"
|
||||
/>
|
||||
<wd-cell title="头像">
|
||||
<avatar v-model="model.avatar"></avatar>
|
||||
</wd-cell>
|
||||
<wd-select-picker
|
||||
label="性别"
|
||||
type="radio"
|
||||
v-model="model.sex"
|
||||
:columns="columns"
|
||||
title="请选择性别"
|
||||
:safe-area-inset-bottom="false"
|
||||
></wd-select-picker>
|
||||
<wd-input
|
||||
label="手机号"
|
||||
prop="phone"
|
||||
clearable
|
||||
label-width="70px"
|
||||
v-model="model.phone"
|
||||
:readonly="true"
|
||||
placeholder="请输入手机号"
|
||||
:rules="[{ validator: rules.phone }]"
|
||||
/>
|
||||
<wd-input
|
||||
label="邮箱"
|
||||
prop="email"
|
||||
clearable
|
||||
label-width="70px"
|
||||
v-model="model.email"
|
||||
:readonly="true"
|
||||
placeholder="请输入邮箱"
|
||||
:rules="[{ validator: rules.email }]"
|
||||
/>
|
||||
</wd-cell-group>
|
||||
<view class="footer p5">
|
||||
<wd-button type="primary" size="large" @click="handleSubmit" block>提交</wd-button>
|
||||
</view>
|
||||
</wd-form>
|
||||
</PageLayout>
|
||||
<view :class="{ 'gray': appStore.isGray == 1 }">
|
||||
<PageLayout navTitle="编辑资料" backRouteName="people" routeMethod="pushTab">
|
||||
<wd-form ref="form" :model="model">
|
||||
<wd-cell-group border>
|
||||
<wd-cell title="头像" title-width="100px">
|
||||
<avatar v-model="model.avatar"></avatar>
|
||||
</wd-cell>
|
||||
<wd-input label="统一身份认证" prop="username" label-width="100px" v-model="model.username"
|
||||
:readonly="true" />
|
||||
<wd-input label="姓名" prop="realname" label-width="100px" v-model="model.realname"
|
||||
:readonly="true" />
|
||||
<wd-input label="劳动合同号" prop="workno" label-width="100px" v-model="model.workno" :readonly="true" />
|
||||
<wd-select-picker label="单位" type="radio" v-model="model.orgCode" :columns="columns" title="切换登录单位"
|
||||
:safe-area-inset-bottom="false" label-width="100px"></wd-select-picker>
|
||||
<!-- <wd-select-picker label="性别" type="radio" v-model="model.sex" :columns="columns" title="请选择性别"
|
||||
:safe-area-inset-bottom="false"></wd-select-picker> -->
|
||||
<wd-input label="手机号" prop="phone" clearable label-width="100px" v-model="model.phone"
|
||||
placeholder="请输入手机号" :rules="[{ validator: rules.phone }]" />
|
||||
<wd-input label="邮箱" prop="email" clearable label-width="100px" v-model="model.email"
|
||||
placeholder="请输入邮箱" :rules="[{ validator: rules.email }]" />
|
||||
</wd-cell-group>
|
||||
<view class="footer p5">
|
||||
<wd-button type="primary" size="large" @click="handleSubmit" block>提交</wd-button>
|
||||
</view>
|
||||
</wd-form>
|
||||
</PageLayout>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { http } from '@/utils/http'
|
||||
import { useToast, useMessage, useNotify, dayjs } from 'wot-design-uni'
|
||||
import { useRouter } from '@/plugin/uni-mini-router'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import avatar from './components/avatar.vue'
|
||||
import { http } from '@/utils/http'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { useRouter } from '@/plugin/uni-mini-router'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import avatar from './components/avatar.vue'
|
||||
import { editUserApi } from '@/api/system/user'
|
||||
import { getFileAccessHttpUrl } from '@/common/uitls'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { queryDepsByUserIdApi } from '@/api/system/department'
|
||||
import { useAppStore } from '@/store'
|
||||
|
||||
defineOptions({
|
||||
name: 'chatList',
|
||||
options: {
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
})
|
||||
const toast = useToast()
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const columns = [
|
||||
{ label: '男', value: 1 },
|
||||
{ label: '女', value: 2 },
|
||||
]
|
||||
const model = reactive({
|
||||
username: userStore.userInfo.username,
|
||||
realname: userStore.userInfo.realname,
|
||||
avatar: userStore.userInfo.avatar,
|
||||
sex: userStore.userInfo.sex ?? 1,
|
||||
phone: userStore.userInfo.phone,
|
||||
email: userStore.userInfo.email,
|
||||
})
|
||||
const rules = {
|
||||
realname: (value) => {
|
||||
if (value?.trim()?.length) {
|
||||
return true
|
||||
} else {
|
||||
toast.warning('请输入名称')
|
||||
return false
|
||||
}
|
||||
},
|
||||
phone: (value) => {
|
||||
if (value?.trim()?.length) {
|
||||
if (/^1[3-9]\d{9}$/.test(value)) {
|
||||
return true
|
||||
} else {
|
||||
toast.warning('请输入正确的手机号')
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
toast.warning('请输入手机号')
|
||||
return false
|
||||
}
|
||||
},
|
||||
email: (value) => {
|
||||
if (value?.trim()?.length) {
|
||||
if (/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*@([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(value)) {
|
||||
return true
|
||||
} else {
|
||||
toast.warning('请输入正确的邮箱')
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
toast.warning('请输入邮箱')
|
||||
return false
|
||||
}
|
||||
},
|
||||
}
|
||||
const form = ref()
|
||||
defineOptions({
|
||||
name: 'chatList',
|
||||
options: {
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
})
|
||||
const toast = useToast()
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const appStore = useAppStore()
|
||||
const columns = ref([])
|
||||
const model = reactive({
|
||||
avatar: getFileAccessHttpUrl(userStore.userInfo.avatar),
|
||||
username: userStore.userInfo.username,
|
||||
realname: userStore.userInfo.realname,
|
||||
workno: userStore.userInfo.workNo,
|
||||
orgCode: userStore.userInfo.orgCode,
|
||||
// sex: userStore.userInfo.sex ?? 1,
|
||||
phone: userStore.userInfo.phone,
|
||||
email: userStore.userInfo.email,
|
||||
})
|
||||
const rules = {
|
||||
phone: (value : string) => {
|
||||
if (value?.trim()?.length) {
|
||||
if (/^1[3-9]\d{9}$/.test(value)) {
|
||||
return true
|
||||
} else {
|
||||
toast.warning('请输入正确的手机号')
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
toast.warning('请输入手机号')
|
||||
return false
|
||||
}
|
||||
},
|
||||
email: (value : string) => {
|
||||
if (value?.trim()?.length) {
|
||||
if (/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*@([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(value)) {
|
||||
return true
|
||||
} else {
|
||||
toast.warning('请输入正确的邮箱')
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
},
|
||||
}
|
||||
const form = ref()
|
||||
|
||||
function handleSubmit() {
|
||||
form.value
|
||||
.validate()
|
||||
.then(({ valid, errors }) => {
|
||||
if (valid) {
|
||||
if (!model.avatar) {
|
||||
toast.warning('上传头像')
|
||||
return
|
||||
}
|
||||
// toast.success('校验通过')
|
||||
const data = { ...model, id: userStore.userInfo.userid }
|
||||
delete data.username
|
||||
uni.showLoading()
|
||||
http
|
||||
.post('/sys/user/login/setting/userEdit', { ...data })
|
||||
.then((res: any) => {
|
||||
uni.hideLoading()
|
||||
if (res.success) {
|
||||
toast.success('修改成功~')
|
||||
setTimeout(() => {
|
||||
userStore.editUserInfo({ ...data })
|
||||
router.replaceAll({ name: 'people' })
|
||||
}, 1e3)
|
||||
} else {
|
||||
toast.warning(res.message)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
toast.error('提交失败')
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error, 'error')
|
||||
})
|
||||
}
|
||||
function handleSubmit() {
|
||||
form.value
|
||||
.validate()
|
||||
.then(({ valid }) => {
|
||||
if (valid) {
|
||||
const data = { ...model, id: userStore.userInfo.userid }
|
||||
delete data.username
|
||||
uni.showLoading()
|
||||
editUserApi({ ...data })
|
||||
.then((res : any) => {
|
||||
uni.hideLoading()
|
||||
if (res.success) {
|
||||
toast.success('修改成功~请重新登录')
|
||||
setTimeout(() => {
|
||||
// userStore.editUserInfo({ ...data })
|
||||
userStore.clearUserInfo()
|
||||
router.replaceAll({ name: 'login' })
|
||||
}, 1e3)
|
||||
} else {
|
||||
toast.warning(res.message)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
toast.error('提交失败')
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch((error : any) => {
|
||||
console.log(error, 'error')
|
||||
})
|
||||
}
|
||||
|
||||
const changeDeptment = () => {
|
||||
queryDepsByUserIdApi().then((res : any) => {
|
||||
columns.value = res.result.list.map((dept : { departName : any; orgCode : any }) => ({
|
||||
label: dept.departName,
|
||||
value: dept.orgCode
|
||||
}));
|
||||
})
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
changeDeptment()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
//
|
||||
:deep(.wd-cell) {
|
||||
.wd-cell__left {
|
||||
width: 70px;
|
||||
flex: none;
|
||||
}
|
||||
.wd-cell__value {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
//
|
||||
:deep(.wd-cell) {
|
||||
.wd-cell__left {
|
||||
width: 70px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.wd-cell__value {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -23,18 +23,18 @@
|
||||
"iconWidth": "24px",
|
||||
"spacing": "3px",
|
||||
"list": [
|
||||
{
|
||||
"iconPath": "static/tabbar/tabbar-home-2.png",
|
||||
"selectedIconPath": "static/tabbar/tabbar-home.png",
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/tabbar/tabbar-message-2.png",
|
||||
"selectedIconPath": "static/tabbar/tabbar-message.png",
|
||||
"pagePath": "pages/message/message",
|
||||
"text": "消息"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/tabbar/tabbar-home-2.png",
|
||||
"selectedIconPath": "static/tabbar/tabbar-home.png",
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "协作"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/tabbar/tabbar-workHome-2.png",
|
||||
"selectedIconPath": "static/tabbar/tabbar-workHome.png",
|
||||
@ -51,12 +51,11 @@
|
||||
},
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"path": "pages/login/login",
|
||||
"type": "home",
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "首页"
|
||||
"navigationBarTitleText": "登录页"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -130,11 +129,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login/login",
|
||||
"path": "pages/index/index",
|
||||
"type": "page",
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": ""
|
||||
"navigationBarTitleText": "主页"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from '@/plugin/uni-mini-router'
|
||||
import { useToast, useMessage, useNotify } from 'wot-design-uni'
|
||||
import { us, os } from '@/common/work'
|
||||
// import { us, os } from '@/common/work'
|
||||
import Grid from '@/components/Grid/Grid.vue'
|
||||
|
||||
const toast = useToast()
|
||||
@ -116,11 +116,11 @@ const { showNotify, closeNotify } = useNotify()
|
||||
const router = useRouter()
|
||||
const selected = ref([])
|
||||
const gridData = ref([])
|
||||
us.data.forEach((item: any, index) => {
|
||||
if (index < 9) {
|
||||
gridData.value.push({ text: item.title, img: item.icon, itemKey: index })
|
||||
}
|
||||
})
|
||||
// us.data.forEach((item: any, index) => {
|
||||
// if (index < 9) {
|
||||
// gridData.value.push({ text: item.title, img: item.icon, itemKey: index })
|
||||
// }
|
||||
// })
|
||||
// 图片预览
|
||||
const imgPreview = ref({
|
||||
show: false,
|
||||
|
||||
@ -1,334 +1,347 @@
|
||||
<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page;推荐使用json5,更强大,且允许注释 -->
|
||||
<route lang="json5" type="home">
|
||||
{
|
||||
layout: 'default',
|
||||
style: {
|
||||
navigationStyle: 'custom',
|
||||
navigationBarTitleText: '首页',
|
||||
},
|
||||
}
|
||||
<route lang="json5" type="page">
|
||||
{
|
||||
layout: 'default',
|
||||
style: {
|
||||
navigationStyle: 'custom',
|
||||
navigationBarTitleText: '主页',
|
||||
},
|
||||
}
|
||||
</route>
|
||||
<template>
|
||||
<PageLayout :navbarShow="false">
|
||||
<!--轮播图-->
|
||||
<!-- prettier-ignore -->
|
||||
<swiper class="swiper" :indicator-dots="true" :circular="true" :autoplay="true" :interval="5000" :duration="500">
|
||||
<!--本地配置轮播图-->
|
||||
<swiper-item v-for="(item, index) in swiperList" :key="index" v-if="isLocalConfig">
|
||||
<image :src="item.url" mode="aspectFill" v-if="item.type == 'image'"></image>
|
||||
<video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover" v-if="item.type == 'video'"></video>
|
||||
</swiper-item>
|
||||
<!--线上配置轮播图-->
|
||||
<swiper-item v-for="(item, index) in carouselList" :key="index" v-if="!isLocalConfig">
|
||||
<image :src="getFileAccessHttpUrl(item)" mode="aspectFill"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<scroll-view class="scrollView" :scroll-y="true" scroll-with-animation>
|
||||
<!--流程服务-->
|
||||
<!-- <wd-row>-->
|
||||
<!-- <wd-col :span="12" v-for="(item, index) in middleApps" :key="index">-->
|
||||
<!-- <wd-img :width="50" :height="50" :src="getFileAccessHttpUrl(item.icon)"></wd-img>-->
|
||||
<!-- <view class="textBox">-->
|
||||
<!-- <wd-text :text="item.title"></wd-text>-->
|
||||
<!-- <wd-text :text="item.subTitle"></wd-text>-->
|
||||
<!-- </view>-->
|
||||
<!-- </wd-col>-->
|
||||
<!-- </wd-row>-->
|
||||
<!--常用服务-->
|
||||
<view class="serveBox">
|
||||
<view class="title">
|
||||
<view class="dot"></view>
|
||||
<wd-text text="常用服务"></wd-text>
|
||||
</view>
|
||||
<Grid :column="4" v-model="usList" @itemClik="goPage"></Grid>
|
||||
</view>
|
||||
<!--其他服务-->
|
||||
<view class="serveBox">
|
||||
<view class="title">
|
||||
<view class="dot"></view>
|
||||
<wd-text text="其他服务"></wd-text>
|
||||
</view>
|
||||
<Grid :column="4" v-model="osList" @itemClik="goPage"></Grid>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</PageLayout>
|
||||
<PageLayout :navbarShow="false">
|
||||
<view class="nav">
|
||||
<view class="nav_box">
|
||||
<view class="weather_calender">
|
||||
<view class="position position-left">
|
||||
<image src="@/static/index/index/position.png"></image>
|
||||
<text>{{!appStore.position?'暂未定位':appStore.position}}</text>
|
||||
</view>
|
||||
<view class="position position-center">
|
||||
<image style="height:60rpx;width:60rpx;"
|
||||
:src="`http://openweathermap.org/img/w/${appStore.weather}.png`"></image>
|
||||
<text>{{appStore.temperature}}℃</text>
|
||||
</view>
|
||||
<uni-datetime-picker type="date">
|
||||
<view class="position position-right">
|
||||
<image src="@/static/index/index/calendar.png"></image>
|
||||
<text>{{getTime()}}</text>
|
||||
</view>
|
||||
</uni-datetime-picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view class="scrollView" :scroll-y="true" scroll-with-animation>
|
||||
<!--轮播图-->
|
||||
<swiper class="swiper" :indicator-dots="true" :circular="true" :autoplay="true" :interval="5000"
|
||||
:duration="500">
|
||||
<swiper-item v-for="(item, index) in carouselList" :key="index">
|
||||
<image :src="getFileAccessHttpUrl(item)" mode="aspectFill"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<!--流程服务-->
|
||||
<wd-row>
|
||||
<wd-col :span="12" v-for="(item, index) in middleApps" :key="index">
|
||||
<wd-img :width="50" :height="50" :src="getFileAccessHttpUrl(item.icon)"></wd-img>
|
||||
<view class="textBox">
|
||||
<wd-text :text="item.title"></wd-text>
|
||||
<wd-text :text="item.subTitle"></wd-text>
|
||||
</view>
|
||||
</wd-col>
|
||||
</wd-row>
|
||||
<!--常用服务-->
|
||||
<view class="serveBox">
|
||||
<view class="title">
|
||||
<view class="dot"></view>
|
||||
<wd-text text="常用服务"></wd-text>
|
||||
</view>
|
||||
<Grid :column="4" v-model="usList" @itemClik="goPage"></Grid>
|
||||
</view>
|
||||
<!--其他服务-->
|
||||
<view class="serveBox">
|
||||
<view class="title">
|
||||
<view class="dot"></view>
|
||||
<wd-text text="其他服务"></wd-text>
|
||||
</view>
|
||||
<Grid :column="4" v-model="osList" @itemClik="goPage"></Grid>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</PageLayout>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { TestEnum } from '@/typings'
|
||||
import { us, os } from '@/common/work'
|
||||
// 获取当前运行平台
|
||||
import PLATFORM from '@/utils/platform'
|
||||
import { cache, getFileAccessHttpUrl, hasRoute } from '@/common/uitls'
|
||||
import { onLaunch, onShow, onHide, onLoad, onReady } from '@dcloudio/uni-app'
|
||||
import { useToast, useMessage, useNotify } from 'wot-design-uni'
|
||||
import { useRouter } from '@/plugin/uni-mini-router'
|
||||
import Grid from '@/components/Grid/Grid.vue'
|
||||
import { ref } from 'vue'
|
||||
import { getFileAccessHttpUrl } from '@/common/uitls'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
import { useRouter } from '@/plugin/uni-mini-router'
|
||||
import Grid from '@/components/Grid/Grid.vue'
|
||||
import { queryCarouselApi, getUserPermissionApi } from '@/api/system'
|
||||
import { getEnvBaseUrl } from '@/utils/index'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { useAppStore } from '@/store'
|
||||
defineOptions({
|
||||
name: 'index',
|
||||
options: {
|
||||
// apply-shared:当前页面样式会影响到子组件样式.(小程序)
|
||||
// shared:当前页面样式影响到子组件,子组件样式也会影响到当前页面.(小程序)
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
})
|
||||
const toast = useToast()
|
||||
const router = useRouter()
|
||||
const carouselList = ref([])
|
||||
const middleApps = ref([])
|
||||
const usList = ref([])
|
||||
const osList = ref([])
|
||||
const msgCount = ref(0)
|
||||
const dot = ref({ mailHome: false })
|
||||
const userStore = useUserStore()
|
||||
const appStore = useAppStore()
|
||||
const res = wx.getSystemInfoSync();
|
||||
const statusHeight = res.statusBarHeight; //状态栏高度
|
||||
const cusnavbarheight = (statusHeight + 30) + "px";
|
||||
const goPage = (item) => {
|
||||
// let page = item.routeIndex
|
||||
// console.log('-----------page------------', page)
|
||||
// if (!page) {
|
||||
// toast.info('该功能暂未实现')
|
||||
// } else {
|
||||
// if (['other', 'common'].includes(page)) {
|
||||
// goPageMore(page)
|
||||
// return
|
||||
// }
|
||||
// if (page === 'annotationList') {
|
||||
// msgCount.value = 0
|
||||
// }
|
||||
// dot.value[page] = false
|
||||
// if (page.indexOf('/app/online') == 0) {
|
||||
// let code = page.substring(page.lastIndexOf('/') + 1)
|
||||
// let real = { desformCode: code, desformName: item.title }
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/check/onlineForm/add?item=' + encodeURIComponent(JSON.stringify(real)),
|
||||
// })
|
||||
// } else if (page.indexOf('/app/desform') == 0) {
|
||||
// let code = page.substring(page.lastIndexOf('/') + 1)
|
||||
// let real = { desformCode: code, desformName: item.title }
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/check/designForm/designForm?item=' + encodeURIComponent(JSON.stringify(real)),
|
||||
// })
|
||||
// } else {
|
||||
// if (!hasRoute({ name: page })) {
|
||||
// router.replace({ name: 'demo', params: { backRouteName: 'index' } })
|
||||
// } else {
|
||||
// router.replace({ name: page, params: { backRouteName: 'index' } })
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
import {
|
||||
ACCESS_TOKEN,
|
||||
USER_NAME,
|
||||
USER_INFO,
|
||||
APP_ROUTE,
|
||||
APP_CONFIG,
|
||||
HOME_CONFIG_EXPIRED_TIME,
|
||||
} from '@/common/constants'
|
||||
import { http } from '@/utils/http'
|
||||
const goPageMore = (page) => {
|
||||
router.replace({ name: 'more', params: { backRouteName: 'index', type: page } })
|
||||
}
|
||||
|
||||
defineOptions({
|
||||
name: 'index',
|
||||
options: {
|
||||
// apply-shared:当前页面样式会影响到子组件样式.(小程序)
|
||||
// shared:当前页面样式影响到子组件,子组件样式也会影响到当前页面.(小程序)
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
})
|
||||
const toast = useToast()
|
||||
const router = useRouter()
|
||||
// 获取屏幕边界到安全区域距离
|
||||
const { safeAreaInsets } = uni.getSystemInfoSync()
|
||||
const isLocalConfig = getApp().globalData.isLocalConfig
|
||||
const carouselList = ref([])
|
||||
const swiperList = ref([])
|
||||
const middleApps = ref([])
|
||||
const usList = ref([])
|
||||
const osList = ref([])
|
||||
const msgCount = ref(0)
|
||||
const dot = ref({ mailHome: false })
|
||||
const goPage = (item) => {
|
||||
let page = item.routeIndex
|
||||
console.log('-----------page------------', page)
|
||||
if (!page) {
|
||||
toast.info('该功能暂未实现')
|
||||
} else {
|
||||
if (['other', 'common'].includes(page)) {
|
||||
goPageMore(page)
|
||||
return
|
||||
}
|
||||
if (page === 'annotationList') {
|
||||
msgCount.value = 0
|
||||
}
|
||||
dot.value[page] = false
|
||||
if (page.indexOf('/app/online') == 0) {
|
||||
let code = page.substring(page.lastIndexOf('/') + 1)
|
||||
let real = { desformCode: code, desformName: item.title }
|
||||
uni.navigateTo({
|
||||
url: '/pages/check/onlineForm/add?item=' + encodeURIComponent(JSON.stringify(real)),
|
||||
})
|
||||
} else if (page.indexOf('/app/desform') == 0) {
|
||||
let code = page.substring(page.lastIndexOf('/') + 1)
|
||||
let real = { desformCode: code, desformName: item.title }
|
||||
uni.navigateTo({
|
||||
url: '/pages/check/designForm/designForm?item=' + encodeURIComponent(JSON.stringify(real)),
|
||||
})
|
||||
} else {
|
||||
if (!hasRoute({ name: page })) {
|
||||
router.replace({ name: 'demo', params: { backRouteName: 'index' } })
|
||||
} else {
|
||||
router.replace({ name: page, params: { backRouteName: 'index' } })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const getAppConfigRoute = () => {
|
||||
//判断是否过期
|
||||
let config = cache(APP_CONFIG)
|
||||
if (config) {
|
||||
homeConfig()
|
||||
} else {
|
||||
//更新首页配置
|
||||
http.get('/eoa/sysAppConfig/queryAppConfigRoute').then((res: any) => {
|
||||
console.log('更新首页配置res', res)
|
||||
let result = res
|
||||
if (result.success) {
|
||||
cache(APP_ROUTE, result.result.route, HOME_CONFIG_EXPIRED_TIME)
|
||||
cache(APP_CONFIG, result.result.config, HOME_CONFIG_EXPIRED_TIME)
|
||||
homeConfig()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
const homeConfig = () => {
|
||||
var indexRouteList = cache(APP_ROUTE)
|
||||
var appConfig = cache(APP_CONFIG)
|
||||
usList.value = indexRouteList.filter((item) => item.type == 'common')
|
||||
osList.value = indexRouteList.filter((item) => item.type == 'other')
|
||||
middleApps.value = indexRouteList.filter((item) => item.type == 'approve')
|
||||
let carouselImgStr = appConfig[0].carouselImgJson
|
||||
var carouselImgArr = carouselImgStr && carouselImgStr.length > 0 ? carouselImgStr.split(',') : []
|
||||
carouselList.value = carouselImgArr
|
||||
}
|
||||
const goPageMore = (page) => {
|
||||
// router.replace({ path: `/pages/more/more`, query: { type: page } })
|
||||
router.replace({ name: 'more', params: { backRouteName: 'index', type: page } })
|
||||
}
|
||||
onLoad(() => {
|
||||
console.log('index页面:onLoad')
|
||||
})
|
||||
onReady(() => {
|
||||
console.log('index页面:onReady')
|
||||
})
|
||||
const queryCarousel = () => {
|
||||
// 轮播图
|
||||
queryCarouselApi({
|
||||
zslb: 6
|
||||
}).then((res : any) => {
|
||||
if (res.success) {
|
||||
let arr = res.result.records[0].wenjian.split(',')
|
||||
carouselList.value = arr.map((item) => {
|
||||
return getEnvBaseUrl() + '/sys/common/static/' + item
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (isLocalConfig) {
|
||||
usList.value = us.data.map((item) => ({
|
||||
...item,
|
||||
text: item.title,
|
||||
img: item.icon,
|
||||
itemKey: item.routeIndex,
|
||||
}))
|
||||
osList.value = os.data.map((item) => ({
|
||||
...item,
|
||||
text: item.title,
|
||||
img: item.icon,
|
||||
itemKey: item.routeIndex,
|
||||
}))
|
||||
usList.value.push({
|
||||
text: '更多',
|
||||
img: '/static/index/128/more.png',
|
||||
routeIndex: 'other',
|
||||
itemKey: 'other',
|
||||
})
|
||||
osList.value.push({
|
||||
text: '更多',
|
||||
img: '/static/index/128/more.png',
|
||||
routeIndex: 'common',
|
||||
itemKey: 'common',
|
||||
})
|
||||
middleApps.value = [
|
||||
{
|
||||
icon: 'https://static.jeecg.com/upload/test/line2_icon1_1595818065964.png',
|
||||
title: '审批',
|
||||
subTitle: '个人审批',
|
||||
routeIndex: 'paper',
|
||||
},
|
||||
{
|
||||
icon: 'https://static.jeecg.com/upload/test/line2_icon2_1595818070168.png',
|
||||
title: '审批稿',
|
||||
subTitle: '审批草稿箱',
|
||||
routeIndex: 'draft',
|
||||
},
|
||||
]
|
||||
swiperList.value = [
|
||||
{
|
||||
id: 1,
|
||||
type: 'image',
|
||||
url: 'https://static.jeecg.com/upload/test/banner0_1595850438042.jpeg',
|
||||
link: '',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
type: 'image',
|
||||
url: 'https://static.jeecg.com/upload/test/banner2_1595818081327.jpg',
|
||||
link: '',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
type: 'image',
|
||||
url: 'https://static.jeecg.com/upload/test/oabanner-2_1595648520760.png',
|
||||
link: '',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
type: 'image',
|
||||
url: 'https://static.jeecg.com/upload/test/banner5_1595818089013.jpeg',
|
||||
link: '',
|
||||
},
|
||||
]
|
||||
} else {
|
||||
getAppConfigRoute()
|
||||
}
|
||||
const queryModule = () => {
|
||||
getUserPermissionApi({
|
||||
token: userStore.userInfo.token,
|
||||
}).then((res : any) => {
|
||||
if (res.success) {
|
||||
let data = res.result.menu
|
||||
data = data.filter(e => e.name == 'APP')[0] //保留APP菜单
|
||||
let userfulServer = data.children.filter(e => e.name == 'usefulServer') //常用服务
|
||||
usList.value = userfulServer[0].children.map(item => ({
|
||||
...item,
|
||||
text: item.meta.title,
|
||||
img: `/static/index/index/${item.meta.icon}.png`,
|
||||
itemKey: item.meta.sort
|
||||
}))
|
||||
let otherServer = data.children.filter(e => e.name == 'otherServer') //其他服务
|
||||
osList.value = otherServer[0].children.map(item => ({
|
||||
...item,
|
||||
text: item.meta.title,
|
||||
img: `/static/index/index/${item.meta.icon}.png`,
|
||||
itemKey: item.meta.sort
|
||||
}))
|
||||
osList.value.push({
|
||||
text: '更多',
|
||||
img: '/static/index/index/more.png',
|
||||
routeIndex: 'common',
|
||||
itemKey: 'common',
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
middleApps.value = [
|
||||
{
|
||||
icon: 'https://static.jeecg.com/upload/test/line2_icon1_1595818065964.png',
|
||||
title: '审批',
|
||||
subTitle: '个人审批',
|
||||
routeIndex: 'paper',
|
||||
},
|
||||
{
|
||||
icon: 'https://static.jeecg.com/upload/test/line2_icon2_1595818070168.png',
|
||||
title: '流程',
|
||||
subTitle: '我发起流程',
|
||||
routeIndex: 'draft',
|
||||
},
|
||||
]
|
||||
|
||||
/**
|
||||
* 获取年月日
|
||||
*/
|
||||
const getTime = () => {
|
||||
let date = new Date(); //Fri Oct 29 2021 16:37:56 GMT+0800 (CST)
|
||||
let y = date.getFullYear(); //获取完整的年份(4位)
|
||||
let m = (date.getMonth() + 1).toString().padStart(2, 0); //获取当前月份(0-11,0代表1月)
|
||||
let d = (date.getDate()).toString().padStart(2, 0); //获取当前日(1-31)
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
queryCarousel()
|
||||
queryModule()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.swiper {
|
||||
height: 375upx;
|
||||
flex: none;
|
||||
image,
|
||||
video {
|
||||
width: 100%;
|
||||
display: block;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
:deep(.uni-swiper-dot) {
|
||||
transition: all 400ms ease;
|
||||
background-color: rgba(255, 255, 255, 0.4);
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
margin: 0 4px;
|
||||
}
|
||||
:deep(.uni-swiper-dot-active) {
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
width: 16px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
.scrollView {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
background-color: #f1f1f1;
|
||||
:deep(.wd-row) {
|
||||
background-color: #fff;
|
||||
margin-bottom: 32upx;
|
||||
.wd-col {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
&:first-child {
|
||||
border-right: 1px solid rgba(165, 165, 165, 0.1);
|
||||
}
|
||||
.wd-img {
|
||||
margin: 20upx;
|
||||
margin-left: 0;
|
||||
}
|
||||
.textBox {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.wd-text {
|
||||
color: #666;
|
||||
&:last-child {
|
||||
font-weight: 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.serveBox {
|
||||
margin-bottom: 32upx;
|
||||
background-color: #fff;
|
||||
&:last-child {
|
||||
.title {
|
||||
.dot {
|
||||
background-color: #fbbd08;
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.wd-grid-item) {
|
||||
&:not(.enabled) {
|
||||
// filter: grayscale(1);
|
||||
}
|
||||
}
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 30upx;
|
||||
height: 52px;
|
||||
.dot {
|
||||
width: 14upx;
|
||||
height: 14upx;
|
||||
background-color: #0081ff;
|
||||
border-radius: 100%;
|
||||
margin-right: 20upx;
|
||||
}
|
||||
.wd-text {
|
||||
color: #666;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.nav {
|
||||
width: calc(100%);
|
||||
height: v-bind(cusnavbarheight);
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
background-image: url('@/static/navbg.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: 750rpx 458rpx;
|
||||
}
|
||||
|
||||
.nav_box {
|
||||
position: absolute;
|
||||
bottom: 6rpx;
|
||||
width: calc(100% - 60rpx);
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
}
|
||||
|
||||
.weather_calender {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
.position {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
|
||||
image {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/* 左对齐 */
|
||||
.position-left {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
/* 居中 */
|
||||
.position-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* 右对齐 */
|
||||
.position-right {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.scrollView {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
background-color: #f1f1f1;
|
||||
|
||||
:deep(.wd-row) {
|
||||
background-color: #fff;
|
||||
margin-bottom: 32upx;
|
||||
|
||||
.wd-col {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.wd-img {
|
||||
margin: 20upx;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.textBox {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.wd-text {
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.serveBox {
|
||||
margin-bottom: 32upx;
|
||||
background-color: #fff;
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 30upx;
|
||||
height: 52px;
|
||||
|
||||
.dot {
|
||||
width: 14upx;
|
||||
height: 14upx;
|
||||
background-color: #0081ff;
|
||||
border-radius: 100%;
|
||||
margin-right: 20upx;
|
||||
}
|
||||
|
||||
.wd-text {
|
||||
color: #666;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.swiper {
|
||||
height: 575upx;
|
||||
flex: none;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -1,8 +1,9 @@
|
||||
<route lang="json5" type="page">
|
||||
<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page;推荐使用json5,更强大,且允许注释 -->
|
||||
<route lang="json5" type="home">
|
||||
{
|
||||
style: {
|
||||
navigationStyle: 'custom',
|
||||
navigationBarTitleText: '',
|
||||
navigationBarTitleText: '登录页',
|
||||
},
|
||||
}
|
||||
</route>
|
||||
@ -12,7 +13,6 @@
|
||||
<view :class="['page-container', { 'gray': appStore.isGray == 1 }]">
|
||||
<view class="text-center">
|
||||
<image src="@/static/sinopec.png" mode="aspectFit" class="logo"></image>
|
||||
<!-- <view class="title text-shadow">{{ compTitle || 'JEECG BOOT' }}</view> -->
|
||||
<view class="enter-area">
|
||||
<view class="account-login-area">
|
||||
<view class="box account">
|
||||
@ -56,41 +56,23 @@
|
||||
import { useAppStore } from '@/store'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { http } from '@/utils/http'
|
||||
import {
|
||||
ACCESS_TOKEN,
|
||||
USER_NAME,
|
||||
USER_INFO,
|
||||
APP_ROUTE,
|
||||
APP_CONFIG,
|
||||
HOME_CONFIG_EXPIRED_TIME,
|
||||
HOME_PAGE,
|
||||
} from '@/common/constants'
|
||||
// import { cache, getFileAccessHttpUrl } from '@/common/uitls'
|
||||
import { HOME_PAGE } from '@/common/constants'
|
||||
import { useRouter } from '@/plugin/uni-mini-router'
|
||||
// import { useParamsStore } from '@/store/page-params'
|
||||
import Base64 from 'base-64';
|
||||
import { loginApi } from '@/api/system';
|
||||
|
||||
defineOptions({
|
||||
name: 'login',
|
||||
options: {
|
||||
// apply-shared:当前页面样式会影响到子组件样式.(小程序)
|
||||
// shared:当前页面样式影响到子组件,子组件样式也会影响到当前页面.(小程序)
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
})
|
||||
const router = useRouter()
|
||||
// const defLogo = 'https://static.jeecg.com/files/app_logo.png'
|
||||
const loading = ref(false)
|
||||
const userName = ref()
|
||||
const password = ref()
|
||||
const showPassword = ref(false) //是否显示明文
|
||||
const remPW = ref(false) //是否记住密码
|
||||
// const compLogo = ref(defLogo)
|
||||
// const compTitle = ref('Jeecg Uniapp')
|
||||
// const paramsStore = useParamsStore()
|
||||
// paramsStore.reset()
|
||||
// let isLocalConfig = true
|
||||
/**h5系统信息中没有appWgtVersion值*/
|
||||
const version = uni.getSystemInfoSync().appWgtVersion ? uni.getSystemInfoSync().appWgtVersion : uni.getSystemInfoSync().appVersion
|
||||
const toast = useToast()
|
||||
@ -123,9 +105,9 @@
|
||||
let pw = Base64.encode(encodeURIComponent(password.value))
|
||||
loading.value = true
|
||||
/*生产环境 begin */
|
||||
// loginApi({ username: un, password: pw })
|
||||
/*开发环境 begin */
|
||||
loginApi({ username: userName.value, password: password.value, captcha: 'app' })
|
||||
loginApi({ username: un, password: pw })
|
||||
/*开发环境 begin */
|
||||
// loginApi({ username: userName.value, password: password.value, captcha: 'app' })
|
||||
.then((res : any) => {
|
||||
if (res.success) {
|
||||
const { result } = res
|
||||
@ -137,6 +119,7 @@
|
||||
username: userInfo.username,
|
||||
realname: userInfo.realname,
|
||||
avatar: userInfo.avatar,
|
||||
post: userInfo.post,
|
||||
tenantId: userInfo.loginTenantId,
|
||||
localStorageTime: +new Date(),
|
||||
})
|
||||
@ -161,63 +144,6 @@
|
||||
remPW.value = uni.getStorageSync('savePwd')
|
||||
}
|
||||
})
|
||||
// const appConfig = () => {
|
||||
// if (isLocalConfig) {
|
||||
// toast.success('登录成功!')
|
||||
// router.pushTab({ path: HOME_PAGE })
|
||||
// } else {
|
||||
// http
|
||||
// .get('/eoa/sysAppConfig/queryAppConfigRoute')
|
||||
// .then((res : any) => {
|
||||
// if (res.success) {
|
||||
// cache(APP_ROUTE, res.result.route, HOME_CONFIG_EXPIRED_TIME)
|
||||
// cache(APP_CONFIG, res.result.config, HOME_CONFIG_EXPIRED_TIME)
|
||||
// }
|
||||
// toast.success('登录成功!')
|
||||
// router.pushTab({ path: HOME_PAGE })
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// toast.success('登录成功!')
|
||||
// router.pushTab({ path: HOME_PAGE })
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
// const loadConfig = () => {
|
||||
// http.get('/eoa/sysAppConfig/queryAppConfig').then((res : any) => {
|
||||
// if (res.success) {
|
||||
// let info = res.result
|
||||
// if (info) {
|
||||
// compLogo.value = getFileAccessHttpUrl(info.appLogo) || defLogo
|
||||
// compTitle.value = info.appTitle || 'JEECG-BOOT'
|
||||
// } else {
|
||||
// compLogo.value = defLogo
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// const checkToken = () => {
|
||||
// const { userInfo, clearUserInfo } = userStore
|
||||
// if (userInfo.token) {
|
||||
// if (+new Date() - userInfo.localStorageTime > 2 * 3600000) {
|
||||
// // 超过2小时过期
|
||||
// clearUserInfo()
|
||||
// } else {
|
||||
// router.pushTab({ path: HOME_PAGE })
|
||||
// }
|
||||
// } else {
|
||||
// clearUserInfo()
|
||||
// }
|
||||
// }
|
||||
// const checkAccount = () => { }
|
||||
// // #ifdef APP-PLUS || H5
|
||||
// checkToken()
|
||||
// checkAccount()
|
||||
// // #endif
|
||||
// // @ts-ignore
|
||||
// if (isLocalConfig === false) {
|
||||
// loadConfig()
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@ -235,10 +161,6 @@
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 58upx;
|
||||
}
|
||||
|
||||
.enter-area {
|
||||
padding-top: 30px;
|
||||
width: 87%;
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { us, os } from '@/common/work'
|
||||
// import { us, os } from '@/common/work'
|
||||
import { cache, getFileAccessHttpUrl } from '@/common/uitls'
|
||||
import {
|
||||
ACCESS_TOKEN,
|
||||
@ -50,7 +50,7 @@ let type = 'common'
|
||||
|
||||
const init = () => {
|
||||
if (isLocalConfig) {
|
||||
routeList.value = type == 'common' ? us.data : os.data
|
||||
// routeList.value = type == 'common' ? us.data : os.data
|
||||
} else {
|
||||
var indexRouteList = cache(APP_ROUTE)
|
||||
routeList.value = indexRouteList.filter((item) => item.type == type)
|
||||
|
||||
@ -1,322 +1,303 @@
|
||||
<route lang="json5" type="page">
|
||||
{
|
||||
layout: 'default',
|
||||
style: {
|
||||
navigationStyle: 'custom',
|
||||
navigationBarTitleText: '个人',
|
||||
},
|
||||
}
|
||||
{
|
||||
layout: 'default',
|
||||
style: {
|
||||
navigationStyle: 'custom',
|
||||
navigationBarTitleText: '个人',
|
||||
},
|
||||
}
|
||||
</route>
|
||||
|
||||
<template>
|
||||
<PageLayout :navbarShow="false">
|
||||
<view class="avatar-area">
|
||||
<!-- prettier-ignore -->
|
||||
<wd-img width="100" height="100" :round="true" :radius="50" :src="personalList.avatar ? personalList.avatar : defAvatar" @click="ChooseImage"></wd-img>
|
||||
</view>
|
||||
<view class="info-area shadow-warp mb-5">
|
||||
<view class="user">
|
||||
<wd-text custom-class="title" :text="personalList.username"></wd-text>
|
||||
<view class="tag">
|
||||
<view class="cuIcon-people mr-1"></view>
|
||||
<wd-text text="用户"></wd-text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="job">
|
||||
<!-- prettier-ignore -->
|
||||
<wd-text custom-class="title":text="personalList.post ? personalList.post : '员工'"></wd-text>
|
||||
<view class="tag">
|
||||
<view class="cuIcon-news mr-1"></view>
|
||||
<wd-text text="职务"></wd-text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view scroll-y>
|
||||
<wd-cell-group custom-class="shadow-warp" border clickable>
|
||||
<template v-for="(item, index) in dataSource" :key="index">
|
||||
<wd-cell :title="item.title" is-link @click="handleCell(item)">
|
||||
<template #icon>
|
||||
<view :class="item.class" class="mr-2"></view>
|
||||
</template>
|
||||
</wd-cell>
|
||||
</template>
|
||||
</wd-cell-group>
|
||||
</scroll-view>
|
||||
</PageLayout>
|
||||
<PageLayout :navbarShow="false">
|
||||
<view :class="{ 'gray': appStore.isGray == 1 }">
|
||||
<view class="avatar-area">
|
||||
<wd-img width="100" height="100" :round="true" :radius="50"
|
||||
:src="getFileAccessHttpUrl(userStore.userInfo.avatar)" @click="ChooseImage"></wd-img>
|
||||
</view>
|
||||
<view class="info-area shadow-warp mb-5">
|
||||
<view class="user">
|
||||
<wd-text custom-class="title" :text="userStore.userInfo.realname"></wd-text>
|
||||
<view class="tag">
|
||||
<view class="cuIcon-people mr-1"></view>
|
||||
<wd-text text="用户"></wd-text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="department">
|
||||
<wd-text custom-class="title" :text="userStore.userInfo.department"></wd-text>
|
||||
<view class="tag">
|
||||
<view class="cuIcon-group mr-1"></view>
|
||||
<wd-text text="单位"></wd-text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="job">
|
||||
<wd-text custom-class="title" :text="post"></wd-text>
|
||||
<view class="tag">
|
||||
<view class="cuIcon-news mr-1"></view>
|
||||
<wd-text text="职务"></wd-text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view scroll-y>
|
||||
<wd-cell-group custom-class="shadow-warp" border clickable>
|
||||
<template v-for="(item, index) in dataSource" :key="index">
|
||||
<wd-cell :title="item.title" is-link @click="handleCell(item)">
|
||||
<template #icon>
|
||||
<view :class="item.class" class="mr-2"></view>
|
||||
</template>
|
||||
</wd-cell>
|
||||
</template>
|
||||
</wd-cell-group>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</PageLayout>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch, onBeforeUnmount } from 'vue'
|
||||
import { cache, getFileAccessHttpUrl, hasRoute } from '@/common/uitls'
|
||||
import { onLaunch, onShow, onHide, onLoad, onReady } from '@dcloudio/uni-app'
|
||||
import { useToast, useMessage, useNotify } from 'wot-design-uni'
|
||||
import { useRouter } from '@/plugin/uni-mini-router'
|
||||
import {
|
||||
ACCESS_TOKEN,
|
||||
USER_NAME,
|
||||
USER_INFO,
|
||||
APP_ROUTE,
|
||||
APP_CONFIG,
|
||||
HOME_CONFIG_EXPIRED_TIME,
|
||||
} from '@/common/constants'
|
||||
import { http } from '@/utils/http'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import useUpload from '@/hooks/useUpload'
|
||||
import { getEnvBaseUrl } from '@/utils/index'
|
||||
import { ref, watch, onBeforeUnmount } from 'vue'
|
||||
import { getFileAccessHttpUrl } from '@/common/uitls'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useToast, useMessage } from 'wot-design-uni'
|
||||
import { useRouter } from '@/plugin/uni-mini-router'
|
||||
import { http } from '@/utils/http'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import useUpload from '@/hooks/useUpload'
|
||||
import { getEnvBaseUrl } from '@/utils/index'
|
||||
import { queryPostByUserIdApi, editUserApi } from '@/api/system/user'
|
||||
import { useAppStore } from '@/store'
|
||||
|
||||
//
|
||||
const userStore = useUserStore()
|
||||
const toast = useToast()
|
||||
const router = useRouter()
|
||||
const message = useMessage()
|
||||
const defAvatar = 'https://static.jeecg.com/upload/test/login4_1595818039175.png'
|
||||
const personalList = reactive({
|
||||
avatar: '',
|
||||
realname: '',
|
||||
username: '',
|
||||
post: '',
|
||||
depart: '',
|
||||
})
|
||||
const userId = ref(userStore.userInfo.userid)
|
||||
const id = ref('')
|
||||
let stopWatch: any = null
|
||||
const api = {
|
||||
positionUrl: '/sys/position/list',
|
||||
departUrl: '/sys/user/userDepartList',
|
||||
userUrl: '/sys/user/queryById',
|
||||
postUrl: '/sys/position/queryByCode',
|
||||
uploadUrl: `${getEnvBaseUrl()}/sys/common/upload`,
|
||||
}
|
||||
const dataSource = [
|
||||
{ key: 'collect', title: '收藏', class: 'cuIcon-favorfill text-yellow' },
|
||||
{ key: 'redPacket', title: '红包', class: 'cuIcon-redpacket_fill text-red' },
|
||||
{ key: 'scan', title: '扫码', class: 'cuIcon-scan text-red' },
|
||||
{ key: 'location', title: '定位', class: 'cuIcon-location text-cyan' },
|
||||
{ key: 'setttings', title: '设置', class: 'cuIcon-settingsfill text-cyan' },
|
||||
{ key: 'exit', title: '退出', class: 'cuIcon-exit text-cyan' },
|
||||
]
|
||||
const userStore = useUserStore()
|
||||
const appStore = useAppStore()
|
||||
const toast = useToast()
|
||||
const router = useRouter()
|
||||
const message = useMessage()
|
||||
const post = ref('')
|
||||
let stopWatch : any = null
|
||||
|
||||
const load = () => {
|
||||
if (!userId.value) {
|
||||
return
|
||||
}
|
||||
http
|
||||
.get(api.userUrl, { id: userId.value })
|
||||
.then((res: any) => {
|
||||
if (res.success) {
|
||||
let perArr = res.result
|
||||
let avatar =
|
||||
perArr.avatar && perArr.avatar.length > 0
|
||||
? getFileAccessHttpUrl(perArr.avatar)
|
||||
: '/static/avatar_boy.png'
|
||||
personalList.avatar = avatar
|
||||
personalList.realname = perArr.realname
|
||||
personalList.username = perArr.username
|
||||
personalList.depart = perArr.departIds
|
||||
getpost(perArr.post)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
const getpost = (code) => {
|
||||
if (!code || code.length == 0) {
|
||||
personalList.post = '员工'
|
||||
return false
|
||||
}
|
||||
http
|
||||
.get(api.postUrl, { params: { code: code } })
|
||||
.then((res: any) => {
|
||||
console.log('postUrl', res)
|
||||
if (res.success) {
|
||||
personalList.post = res.result.name
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
const dataSource = [
|
||||
// { key: 'collect', title: '收藏', class: 'cuIcon-favorfill text-yellow' },
|
||||
// { key: 'redPacket', title: '红包', class: 'cuIcon-redpacket_fill text-red' },
|
||||
{ key: 'setting', title: '个人资料', class: 'cuIcon-settingsfill text-cyan' },
|
||||
{ key: 'scan', title: '扫码', class: 'cuIcon-scan text-red' },
|
||||
// { key: 'location', title: '定位', class: 'cuIcon-location text-cyan' },
|
||||
{ key: 'exit', title: '退出', class: 'cuIcon-exit text-cyan' },
|
||||
]
|
||||
|
||||
const ChooseImage = (params) => {
|
||||
uni.showLoading({ title: '上传中...' })
|
||||
const { loading, data, error, run } = useUpload({ name: 'file' }, { url: api.uploadUrl })
|
||||
if (stopWatch) stopWatch()
|
||||
run()
|
||||
stopWatch = watch(
|
||||
() => [loading.value, error.value, data.value],
|
||||
([loading, err, data], oldValue) => {
|
||||
if (loading == false) {
|
||||
if (err) {
|
||||
toast.warning('修改失败')
|
||||
uni.hideLoading()
|
||||
} else {
|
||||
if (data) {
|
||||
editAvatar(data.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
const editAvatar = (avatar) => {
|
||||
http
|
||||
.put('/sys/user/appEdit', { id: userId.value, avatar })
|
||||
.then((res: any) => {
|
||||
if (res.success) {
|
||||
toast.success('修改成功~')
|
||||
userStore.editUserInfo({ avatar: getFileAccessHttpUrl(avatar) })
|
||||
personalList.avatar = getFileAccessHttpUrl(avatar)
|
||||
} else {
|
||||
toast.warning(res.message)
|
||||
}
|
||||
uni.hideLoading()
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading()
|
||||
toast.warning('修改失败')
|
||||
})
|
||||
}
|
||||
const scan = () => {
|
||||
// #ifndef H5
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
console.log('条码res:' + res)
|
||||
console.log('条码类型:' + res.scanType)
|
||||
console.log('条码内容:' + res.result)
|
||||
//条码内容包含QRCODELOGIN则是去扫码登录的逻辑
|
||||
if (res.result.indexOf('QRCODELOGIN') != -1) {
|
||||
const data = {
|
||||
qrcodeId: res.result,
|
||||
token: userStore.userInfo.token,
|
||||
}
|
||||
http({
|
||||
url: '/sys/scanLoginQrcode',
|
||||
data,
|
||||
header: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
}).then((res: any) => {
|
||||
console.log('扫码接口返回内容res:', res)
|
||||
if (res.success) {
|
||||
toast.success(res.result)
|
||||
} else {
|
||||
toast.warning(res.result)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
toast.warning('H5暂不支持')
|
||||
// #endif
|
||||
}
|
||||
const exit = () => {
|
||||
message
|
||||
.confirm({
|
||||
title: '提示',
|
||||
msg: '确定退出吗?',
|
||||
})
|
||||
.then(() => {
|
||||
userStore.clearUserInfo()
|
||||
router.replaceAll({ name: 'login' })
|
||||
})
|
||||
}
|
||||
const handleCell = (item) => {
|
||||
switch (item.key) {
|
||||
case 'scan':
|
||||
scan()
|
||||
break
|
||||
case 'location':
|
||||
router.push({ name: 'location' })
|
||||
break
|
||||
case 'setttings':
|
||||
router.push({ name: 'userEdit' })
|
||||
break
|
||||
case 'exit':
|
||||
exit()
|
||||
break
|
||||
default:
|
||||
toast.show('功能暂未开发~')
|
||||
}
|
||||
}
|
||||
onBeforeUnmount(() => {
|
||||
stopWatch?.()
|
||||
})
|
||||
onLoad(() => {
|
||||
load()
|
||||
})
|
||||
const load = () => {
|
||||
//根据userid获取职位名称
|
||||
queryPostByUserIdApi(userStore.userInfo.userid).then((res : any) => {
|
||||
post.value = res
|
||||
})
|
||||
}
|
||||
|
||||
const ChooseImage = () => {
|
||||
uni.showLoading({ title: '上传中...' })
|
||||
const { loading, data, error, run } = useUpload({ name: 'file' }, { url: `${getEnvBaseUrl()}/sys/common/upload?appPath=用户头像/` + userStore.userInfo.realname })
|
||||
if (stopWatch) stopWatch()
|
||||
run()
|
||||
stopWatch = watch(
|
||||
() => [loading.value, error.value, data.value],
|
||||
([loading, err, data]) => {
|
||||
if (loading == false) {
|
||||
if (err) {
|
||||
toast.warning('修改失败')
|
||||
uni.hideLoading()
|
||||
} else {
|
||||
if (data) {
|
||||
editAvatar(data.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
const editAvatar = (avatar) => {
|
||||
editUserApi({ id: userStore.userInfo.userid, avatar }).then((res : any) => {
|
||||
if (res.success) {
|
||||
toast.success('修改成功~')
|
||||
userStore.editUserInfo({ avatar: getFileAccessHttpUrl(avatar) })
|
||||
} else {
|
||||
toast.warning(res.message)
|
||||
}
|
||||
uni.hideLoading()
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading()
|
||||
toast.warning('修改失败')
|
||||
})
|
||||
}
|
||||
const scan = () => {
|
||||
// #ifndef H5
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
console.log('条码res:' + res)
|
||||
console.log('条码类型:' + res.scanType)
|
||||
console.log('条码内容:' + res.result)
|
||||
//条码内容包含QRCODELOGIN则是去扫码登录的逻辑
|
||||
if (res.result.indexOf('QRCODELOGIN') != -1) {
|
||||
const data = {
|
||||
qrcodeId: res.result,
|
||||
token: userStore.userInfo.token,
|
||||
}
|
||||
http({
|
||||
url: '/sys/scanLoginQrcode',
|
||||
data,
|
||||
header: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||
method: 'POST',
|
||||
}).then((res : any) => {
|
||||
console.log('扫码接口返回内容res:', res)
|
||||
if (res.success) {
|
||||
toast.success(res.result)
|
||||
} else {
|
||||
toast.warning(res.result)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
toast.warning('H5暂不支持')
|
||||
// #endif
|
||||
}
|
||||
const exit = () => {
|
||||
message
|
||||
.confirm({
|
||||
title: '提示',
|
||||
msg: '确定退出吗?',
|
||||
})
|
||||
.then(() => {
|
||||
userStore.clearUserInfo()
|
||||
router.replaceAll({ name: 'login' })
|
||||
})
|
||||
}
|
||||
const handleCell = (item) => {
|
||||
switch (item.key) {
|
||||
case 'scan':
|
||||
scan()
|
||||
break
|
||||
case 'setting':
|
||||
router.push({ name: 'userEdit' })
|
||||
break
|
||||
case 'exit':
|
||||
exit()
|
||||
break
|
||||
default:
|
||||
toast.show('功能暂未开发~')
|
||||
}
|
||||
}
|
||||
onBeforeUnmount(() => {
|
||||
stopWatch?.()
|
||||
})
|
||||
onLoad(() => {
|
||||
load()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
//
|
||||
.avatar-area {
|
||||
/* #ifdef MP-WEIXIN */
|
||||
background-image: url('https://static.jeecg.com/upload/test/blue_1595818030310.png');
|
||||
/* #endif */
|
||||
/* #ifndef MP-WEIXIN */
|
||||
background-image: url('@/static/blue.png');
|
||||
/* #endif */
|
||||
background-size: cover;
|
||||
height: 400upx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding-top: 40upx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
font-weight: 300;
|
||||
text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.info-area {
|
||||
display: flex;
|
||||
padding: 30upx;
|
||||
background-color: #fff;
|
||||
color: #8799a3;
|
||||
:deep(.wd-text) {
|
||||
color: var(--color-gray);
|
||||
}
|
||||
.user,
|
||||
.job {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.wd-text.title {
|
||||
font-size: 18px;
|
||||
min-height: 18px;
|
||||
margin-bottom: 16upx;
|
||||
}
|
||||
}
|
||||
.user {
|
||||
border-right: 0.5px solid rgba(0, 0, 0, 0.1);
|
||||
.wd-text.title {
|
||||
color: #f37b1d;
|
||||
}
|
||||
}
|
||||
.job {
|
||||
.wd-text.title {
|
||||
color: #39b54a;
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.wd-cell-group) {
|
||||
margin: 0 26upx;
|
||||
border-radius: 18upx;
|
||||
overflow: hidden;
|
||||
--wot-cell-line-height: 32px;
|
||||
.wd-cell {
|
||||
--wot-cell-title-fs: 15px;
|
||||
--wot-cell-title-color: var(--color-gray);
|
||||
.wd-cell__left {
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
//
|
||||
.avatar-area {
|
||||
/* #ifdef MP-WEIXIN */
|
||||
background-image: url('https://static.jeecg.com/upload/test/blue_1595818030310.png');
|
||||
/* #endif */
|
||||
/* #ifndef MP-WEIXIN */
|
||||
background-image: url('@/static/blue.png');
|
||||
/* #endif */
|
||||
background-size: cover;
|
||||
height: 400upx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding-top: 40upx;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
font-weight: 300;
|
||||
text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.info-area {
|
||||
display: flex;
|
||||
padding: 30upx;
|
||||
background-color: #fff;
|
||||
color: #8799a3;
|
||||
justify-content: space-around;
|
||||
/* 新增:均匀分配空间 */
|
||||
|
||||
:deep(.wd-text) {
|
||||
color: var(--color-gray);
|
||||
}
|
||||
|
||||
.user,
|
||||
.job,
|
||||
.department {
|
||||
flex: 1 1 auto;
|
||||
/* 修改:允许项目增长 */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0 15upx;
|
||||
/* 新增:增加内边距扩大间距 */
|
||||
min-width: 0;
|
||||
/* 新增:防止文本溢出 */
|
||||
|
||||
.tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wd-text.title {
|
||||
font-size: 18px;
|
||||
min-height: 18px;
|
||||
margin-bottom: 16upx;
|
||||
white-space: nowrap;
|
||||
/* 新增:防止文本换行 */
|
||||
overflow: hidden;
|
||||
/* 新增:隐藏溢出 */
|
||||
text-overflow: ellipsis;
|
||||
/* 新增:显示省略号 */
|
||||
max-width: 100%;
|
||||
/* 新增:限制最大宽度 */
|
||||
}
|
||||
}
|
||||
|
||||
.user {
|
||||
border-right: 0.5px solid rgba(0, 0, 0, 0.1);
|
||||
|
||||
.wd-text.title {
|
||||
color: #f37b1d;
|
||||
}
|
||||
}
|
||||
|
||||
.job {
|
||||
.wd-text.title {
|
||||
color: #39b54a;
|
||||
}
|
||||
}
|
||||
|
||||
.department {
|
||||
border-right: 0.5px solid rgba(0, 0, 0, 0.1);
|
||||
|
||||
.wd-text.title {
|
||||
color: #aa00ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.wd-cell-group) {
|
||||
margin: 0 26upx;
|
||||
border-radius: 18upx;
|
||||
overflow: hidden;
|
||||
--wot-cell-line-height: 32px;
|
||||
|
||||
.wd-cell {
|
||||
--wot-cell-title-fs: 15px;
|
||||
--wot-cell-title-color: var(--color-gray);
|
||||
|
||||
.wd-cell__left {
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 527 B |
|
Before Width: | Height: | Size: 689 B |
|
Before Width: | Height: | Size: 971 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
src/static/index/index/calendar.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
src/static/index/index/position.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
BIN
src/static/navbg.png
Normal file
|
After Width: | Height: | Size: 1.8 MiB |
@ -1,7 +1,9 @@
|
||||
import { createPinia, defineStore } from 'pinia'
|
||||
import { createPersistedState } from 'pinia-plugin-persistedstate' // 数据持久化
|
||||
import { upDateAppApi } from '@/api/system';
|
||||
import { hasNewVersion, onClickUpdate } from '@/utils/index';
|
||||
import { upDateAppApi } from '@/api/system'
|
||||
import { hasNewVersion, onClickUpdate } from '@/utils/index'
|
||||
import { getEnvBaseUrl } from '@/utils/index'
|
||||
|
||||
const store = createPinia()
|
||||
store.use(
|
||||
createPersistedState({
|
||||
@ -14,11 +16,27 @@ store.use(
|
||||
export const useAppStore = defineStore('app', {
|
||||
state: () => ({
|
||||
isGray: 0 as 0 | 1, // 0=正常,1=灰化
|
||||
position: null, //市
|
||||
location: null, //省市区
|
||||
temperature: null, //温度
|
||||
weather: null //天气
|
||||
}),
|
||||
actions: {
|
||||
setIsGray(value : 0 | 1) {
|
||||
this.isGray = value
|
||||
},
|
||||
setPosition(value : string) {
|
||||
this.position = value
|
||||
},
|
||||
setLocation(value : string) {
|
||||
this.location = value
|
||||
},
|
||||
setTemperature(value : number) {
|
||||
this.temperature = value
|
||||
},
|
||||
setWeather(value : string) {
|
||||
this.weather = value
|
||||
},
|
||||
},
|
||||
persist: true, // 启用持久化
|
||||
})
|
||||
@ -45,8 +63,8 @@ export const useUpdateApp = defineStore('updateApp', () => {
|
||||
let {
|
||||
result
|
||||
} = res
|
||||
result.apkUrl = import.meta.env.VITE_SERVER_BASEURL + '/sys/common/static/' + result.apkUrl;
|
||||
result.wgtUrl = import.meta.env.VITE_SERVER_BASEURL + '/sys/common/static/' + result.wgtUrl
|
||||
result.apkUrl = getEnvBaseUrl() + '/sys/common/static/' + result.apkUrl
|
||||
result.wgtUrl = getEnvBaseUrl() + '/sys/common/static/' + result.wgtUrl
|
||||
updateOptions.wgtUrl = result.wgtUrl
|
||||
if (systemInfo.osName === 'android') {
|
||||
// Android
|
||||
|
||||
@ -1,50 +1,58 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { queryDepByOrgCodeApi } from '@/api/system/department'
|
||||
|
||||
const initState = {
|
||||
token: '',
|
||||
userid: '',
|
||||
username: '',
|
||||
realname: '',
|
||||
welcome: '',
|
||||
avatar: '',
|
||||
tenantId: 0,
|
||||
phone: '',
|
||||
email: '',
|
||||
sex: 1,
|
||||
// 本地存储时间
|
||||
localStorageTime: 0,
|
||||
token: '',
|
||||
userid: '',
|
||||
username: '',
|
||||
realname: '',
|
||||
avatar: '',
|
||||
tenantId: 0,
|
||||
phone: '',
|
||||
email: '',
|
||||
// sex: 1,
|
||||
post: '',
|
||||
orgCode: '',
|
||||
workNo: '',
|
||||
// 本地存储时间
|
||||
localStorageTime: 0,
|
||||
}
|
||||
|
||||
export const useUserStore = defineStore(
|
||||
'user',
|
||||
() => {
|
||||
const userInfo = ref<IUserInfo>({ ...initState })
|
||||
const setUserInfo = (val: IUserInfo) => {
|
||||
userInfo.value = val
|
||||
}
|
||||
const clearUserInfo = () => {
|
||||
userInfo.value = { ...initState }
|
||||
}
|
||||
const editUserInfo = (options) => {
|
||||
userInfo.value = { ...userInfo.value, ...options }
|
||||
}
|
||||
// 一般没有reset需求,不需要的可以删除
|
||||
const reset = () => {
|
||||
userInfo.value = { ...initState }
|
||||
}
|
||||
const isLogined = computed(() => !!userInfo.value.token)
|
||||
return {
|
||||
userInfo,
|
||||
setUserInfo,
|
||||
clearUserInfo,
|
||||
isLogined,
|
||||
editUserInfo,
|
||||
reset,
|
||||
}
|
||||
},
|
||||
{
|
||||
// 如果需要持久化就写 true, 不需要持久化就写 false(或者去掉这个配置项)
|
||||
persist: true,
|
||||
},
|
||||
)
|
||||
'user',
|
||||
() => {
|
||||
const userInfo = ref<IUserInfo>({ ...initState })
|
||||
const setUserInfo = (val : IUserInfo) => {
|
||||
userInfo.value = val
|
||||
if (val.orgCode) {
|
||||
queryDepByOrgCodeApi(val.orgCode).then((res : any) => {
|
||||
userInfo.value.department = res.result; // 假设 API 返回 { result: "部门名称" }
|
||||
})
|
||||
}
|
||||
}
|
||||
const clearUserInfo = () => {
|
||||
userInfo.value = { ...initState }
|
||||
}
|
||||
const editUserInfo = (options) => {
|
||||
userInfo.value = { ...userInfo.value, ...options }
|
||||
}
|
||||
// 一般没有reset需求,不需要的可以删除
|
||||
const reset = () => {
|
||||
userInfo.value = { ...initState }
|
||||
}
|
||||
const isLogined = computed(() => !!userInfo.value.token)
|
||||
return {
|
||||
userInfo,
|
||||
setUserInfo,
|
||||
clearUserInfo,
|
||||
isLogined,
|
||||
editUserInfo,
|
||||
reset,
|
||||
}
|
||||
},
|
||||
{
|
||||
// 如果需要持久化就写 true, 不需要持久化就写 false(或者去掉这个配置项)
|
||||
persist: true,
|
||||
},
|
||||
)
|
||||
@ -741,6 +741,16 @@
|
||||
content: "\e736";
|
||||
}
|
||||
|
||||
.cuIcon-homefill:before {
|
||||
content: "\e6bb";
|
||||
}
|
||||
.cuIcon-home:before {
|
||||
content: "\e6bc";
|
||||
}
|
||||
.cuIcon-group:before {
|
||||
content: "\e753";
|
||||
}
|
||||
|
||||
.cuIcon-servicefill:before {
|
||||
content: "\e737";
|
||||
}
|
||||
|
||||
6
src/types/uni-pages.d.ts
vendored
@ -4,7 +4,7 @@
|
||||
// Generated by vite-plugin-uni-pages
|
||||
|
||||
interface NavigateToOptions {
|
||||
url: "/pages/index/index" |
|
||||
url: "/pages/login/login" |
|
||||
"/pages/about/about" |
|
||||
"/pages/annotation/annotationDetail" |
|
||||
"/pages/annotation/annotationList" |
|
||||
@ -13,7 +13,7 @@ interface NavigateToOptions {
|
||||
"/pages/demo/indexBar" |
|
||||
"/pages/demo/selectPicker" |
|
||||
"/pages/demo/tree" |
|
||||
"/pages/login/login" |
|
||||
"/pages/index/index" |
|
||||
"/pages/message/message" |
|
||||
"/pages/more/more" |
|
||||
"/pages/user/people" |
|
||||
@ -36,7 +36,7 @@ interface NavigateToOptions {
|
||||
interface RedirectToOptions extends NavigateToOptions {}
|
||||
|
||||
interface SwitchTabOptions {
|
||||
url: "/pages/message/message" | "/pages/index/index" | "/pages/workHome/index" | "/pages/user/people"
|
||||
url: "/pages/index/index" | "/pages/message/message" | "/pages/workHome/index" | "/pages/user/people"
|
||||
}
|
||||
|
||||
type ReLaunchOptions = NavigateToOptions | SwitchTabOptions;
|
||||
|
||||
63
src/typings.d.ts
vendored
@ -1,37 +1,40 @@
|
||||
// 全局要用的类型放到这里
|
||||
|
||||
declare global {
|
||||
type IResData<T> = {
|
||||
code: number
|
||||
msg: string
|
||||
data: T
|
||||
}
|
||||
type IResData<T> = {
|
||||
code : number
|
||||
msg : string
|
||||
data : T
|
||||
}
|
||||
|
||||
// uni.uploadFile文件上传参数
|
||||
type IUniUploadFileOptions = {
|
||||
file?: File
|
||||
files?: UniApp.UploadFileOptionFiles[]
|
||||
filePath?: string
|
||||
name?: string
|
||||
formData?: any
|
||||
}
|
||||
// uni.uploadFile文件上传参数
|
||||
type IUniUploadFileOptions = {
|
||||
file ?: File
|
||||
files ?: UniApp.UploadFileOptionFiles[]
|
||||
filePath ?: string
|
||||
name ?: string
|
||||
formData ?: any
|
||||
}
|
||||
|
||||
type IUserInfo = {
|
||||
token?: string
|
||||
userid?: string
|
||||
username?: string
|
||||
realname?: string
|
||||
welcome?: string
|
||||
avatar?: string
|
||||
tenantId?: string | number
|
||||
sex?: number
|
||||
phone?: string
|
||||
email?: string
|
||||
/** 微信的 openid,非微信没有这个字段 */
|
||||
openid?: string
|
||||
// 存到本地的时间戳
|
||||
localStorageTime: number
|
||||
}
|
||||
type IUserInfo = {
|
||||
token ?: string
|
||||
userid ?: string
|
||||
username ?: string
|
||||
realname ?: string
|
||||
orgCode ?: string
|
||||
department ?: string
|
||||
workNo ?: string
|
||||
avatar ?: string
|
||||
tenantId ?: string | number
|
||||
// sex ?: number
|
||||
phone ?: string
|
||||
post ?: string
|
||||
email ?: string
|
||||
/** 微信的 openid,非微信没有这个字段 */
|
||||
openid ?: string
|
||||
// 存到本地的时间戳
|
||||
localStorageTime : number
|
||||
}
|
||||
}
|
||||
|
||||
export {} // 防止模块污染
|
||||
export { } // 防止模块污染
|
||||
@ -1,5 +1,6 @@
|
||||
import { pages, subPackages, tabBar } from '@/pages.json'
|
||||
import { isMpWeixin } from './platform'
|
||||
import { useAppStore } from '@/store'
|
||||
|
||||
const getLastPage = () => {
|
||||
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
||||
@ -103,7 +104,7 @@ export const getAllPages = (key = 'needLogin') => {
|
||||
})
|
||||
})
|
||||
const result = [...mainPages, ...subPages]
|
||||
// console.log(`getAllPages by ${key} result: `, result)
|
||||
console.log(`getAllPages by ${key} result: `, result)
|
||||
return result
|
||||
}
|
||||
|
||||
@ -317,4 +318,117 @@ function installApp(tempFilePath : string) {
|
||||
})
|
||||
)
|
||||
// #endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 定位
|
||||
*/
|
||||
export const getLocation = () => {
|
||||
const store = useAppStore()
|
||||
// 先尝试获取位置,失败时再回退
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (position) {
|
||||
// 成功获取位置后请求地理编码
|
||||
uni.request({
|
||||
url: 'http://api.tianditu.gov.cn/geocoder',
|
||||
method: 'GET',
|
||||
data: {
|
||||
postStr: JSON.stringify({
|
||||
lon: position.longitude,
|
||||
lat: position.latitude,
|
||||
ver: 1
|
||||
}),
|
||||
type: 'geocode',
|
||||
tk: '30fe0f0c1b2320e112bde797f3ddaff4'
|
||||
},
|
||||
success: function (res : any) {
|
||||
let data = res.data;
|
||||
if (data.status == 0) {
|
||||
const obj = data.result.addressComponent
|
||||
store.setPosition(obj.city ? obj.city : obj.province) //市
|
||||
store.setLocation(obj.city ? obj.province + obj.city + obj.county : obj.province + obj.county) //省市区
|
||||
getWeather(position.latitude, position.longitude)
|
||||
} else {
|
||||
handleDefaultLocation()
|
||||
}
|
||||
},
|
||||
fail: function (err) {
|
||||
uni.showToast({
|
||||
title: '位置解析失败',
|
||||
icon: 'error'
|
||||
})
|
||||
handleDefaultLocation()
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: function (err) {
|
||||
// 根据不同错误码处理
|
||||
if (err.errCode === 2 || err.errCode === 12) {
|
||||
// 2: 位置服务不可用, 12: 定位权限未开启
|
||||
uni.showToast({
|
||||
title: '请开启定位服务',
|
||||
icon: 'error'
|
||||
})
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '定位获取失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
handleDefaultLocation()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const getWeather = (lat : string, lon : string) => {
|
||||
let params = {
|
||||
lat: lat,
|
||||
lon: lon
|
||||
}
|
||||
weatherRequest(params)
|
||||
}
|
||||
|
||||
// 处理默认位置和天气
|
||||
function handleDefaultLocation() {
|
||||
useAppStore().setPosition('濮阳市')
|
||||
weatherRequest({
|
||||
q: '濮阳市'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function weatherRequest(params: { lat?: string; lon?: string; q?: string }) {
|
||||
const store = useAppStore()
|
||||
uni.request({
|
||||
url: 'https://api.openweathermap.org/data/2.5/weather',
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params,
|
||||
appid: '600a60694b0e453dfbaafa862f1d1482',
|
||||
lang: 'zh_cn'
|
||||
},
|
||||
success: function (res : any) {
|
||||
if (res.data && res.data.main && res.data.weather) {
|
||||
store.setTemperature(
|
||||
Math.round(res.data.main.temp - 273.15)
|
||||
)
|
||||
store.setWeather(
|
||||
res.data.weather[0].icon
|
||||
)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '天气数据格式错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function () {
|
||||
uni.showToast({
|
||||
title: '天气获取失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -39,7 +39,7 @@ export default class signMd5Utils {
|
||||
//update-end---author:wangshuai---date:2024-04-16---for:【QQYUN-9005】发送短信加签---
|
||||
let requestBody:any = this.sortAsc(jsonObj);
|
||||
delete requestBody._t;
|
||||
console.log('sign requestBody:', requestBody);
|
||||
// console.log('sign requestBody:', requestBody);
|
||||
return md5(JSON.stringify(requestBody) + signatureSecret).toUpperCase();
|
||||
}
|
||||
/**
|
||||
|
||||
@ -29,8 +29,7 @@
|
||||
},
|
||||
"exclude": ["node_modules"],
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.js",
|
||||
"src/**/*",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.min.js",
|
||||
"src/**/*.tsx",
|
||||
|
||||