This commit is contained in:
yangzhq68909 2025-05-09 09:42:19 +08:00
parent f0060f0a02
commit 09ce6fbb11
66 changed files with 1290 additions and 1314 deletions

View File

@ -5,5 +5,5 @@ VITE_DELETE_CONSOLE = false
# 是否开启sourcemap # 是否开启sourcemap
VITE_SHOW_SOURCEMAP = true 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' VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot'

View File

@ -1,55 +1,55 @@
import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages' import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
export default defineUniPages({ export default defineUniPages({
globalStyle: { globalStyle: {
navigationStyle: 'default', navigationStyle: 'default',
navigationBarTitleText: 'uniapp', navigationBarTitleText: 'uniapp',
navigationBarBackgroundColor: '#f8f8f8', navigationBarBackgroundColor: '#f8f8f8',
navigationBarTextStyle: 'black', navigationBarTextStyle: 'black',
backgroundColor: '#FFFFFF', backgroundColor: '#FFFFFF',
}, },
easycom: { easycom: {
autoscan: true, autoscan: true,
custom: { custom: {
'^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue', '^wd-(.*)': 'wot-design-uni/components/wd-$1/wd-$1.vue',
'^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)': '^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)':
'z-paging/components/z-paging$1/z-paging$1.vue', 'z-paging/components/z-paging$1/z-paging$1.vue',
}, },
}, },
tabBar: { tabBar: {
color: '#aaa', color: '#aaa',
selectedColor: '#39b54a', selectedColor: '#39b54a',
backgroundColor: '#F8F8F8', backgroundColor: '#F8F8F8',
borderStyle: 'black', borderStyle: 'black',
height: '50px', height: '50px',
fontSize: '11px', fontSize: '11px',
iconWidth: '24px', iconWidth: '24px',
spacing: '3px', spacing: '3px',
list: [ list: [
{ {
iconPath: 'static/tabbar/tabbar-message-2.png', iconPath: 'static/tabbar/tabbar-home-2.png',
selectedIconPath: 'static/tabbar/tabbar-message.png', selectedIconPath: 'static/tabbar/tabbar-home.png',
pagePath: 'pages/message/message', pagePath: 'pages/index/index',
text: '消息', text: '首页',
}, },
{ {
iconPath: 'static/tabbar/tabbar-home-2.png', iconPath: 'static/tabbar/tabbar-message-2.png',
selectedIconPath: 'static/tabbar/tabbar-home.png', selectedIconPath: 'static/tabbar/tabbar-message.png',
pagePath: 'pages/index/index', pagePath: 'pages/message/message',
text: '协作', text: '消息',
}, },
{ {
iconPath: 'static/tabbar/tabbar-workHome-2.png', iconPath: 'static/tabbar/tabbar-workHome-2.png',
selectedIconPath: 'static/tabbar/tabbar-workHome.png', selectedIconPath: 'static/tabbar/tabbar-workHome.png',
pagePath: 'pages/workHome/index', pagePath: 'pages/workHome/index',
text: '工作台', text: '工作台',
}, },
{ {
iconPath: 'static/tabbar/tabbar-user-2.png', iconPath: 'static/tabbar/tabbar-user-2.png',
selectedIconPath: 'static/tabbar/tabbar-user.png', selectedIconPath: 'static/tabbar/tabbar-user.png',
pagePath: 'pages/user/people', pagePath: 'pages/user/people',
text: '个人', text: '个人',
}, },
], ],
}, },
}) })

View File

@ -1,20 +1,20 @@
<script lang="ts"> <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 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
import { beforEach } from '@/router/index' import { beforEach } from '@/router/index'
import { jurisdictionApi } from '@/api/system'; import { jurisdictionApi } from '@/api/system';
import { useAppStore, useUpdateApp } from '@/store' import { useAppStore, useUpdateApp } from '@/store'
import { useUserStore } from '@/store/user'
import { getLocation } from '@/utils';
export default { export default {
onLaunch: function (options) { onLaunch: function (options) {
console.log('App Launch')
console.log('应用启动路径:', options.path)
// //
useUpdateApp().checkAppUpdate() // useUpdateApp().checkAppUpdate()
//
getLocation()
}, },
onShow: function (options) { onShow: function (options) {
console.log('App Show')
console.log('应用启动路径:', options.path)
// //
setTimeout(() => { setTimeout(() => {
const currentPage = options.path const currentPage = options.path
@ -32,10 +32,6 @@
appStore.setIsGray(res.result.value) // appStore.setIsGray(res.result.value) //
} }
}) })
},
onHide: function () {
console.log('App Hide')
}, },
// //

View 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',
});
}

View File

@ -35,10 +35,10 @@ export function upDateAppApi() {
/** /**
* 获取是否灰化 * 获取是否灰化
* @param id 登录参数 * @param id 权限id
* @returns 0正常 1灰化 * @returns 0正常 1灰化
*/ */
export function jurisdictionApi(id : string) { // export function jurisdictionApi(id : string) {
return http({ return http({
url: '/CxcJurisdiction/cxcJurisdiction/queryById', url: '/CxcJurisdiction/cxcJurisdiction/queryById',
method: 'GET', 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
View 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
});
}

View File

View File

@ -8,7 +8,7 @@ export const X_TENANT_ID = 'X-Tenant-Id'
export const X_Low_App_ID = 'X-Low-App-ID' export const X_Low_App_ID = 'X-Low-App-ID'
export const TENANT_LIST = 'tenant_list' export const TENANT_LIST = 'tenant_list'
export const ROUTE_PARAMS = "cacheRouteParams" export const ROUTE_PARAMS = "cacheRouteParams"
export const HOME_PAGE = "/pages/message/message" export const HOME_PAGE = "/pages/index/index"
//10 //10
export const HOME_CONFIG_EXPIRED_TIME = 10*60 export const HOME_CONFIG_EXPIRED_TIME = 10*60
export const phone = '---' export const phone = '---'

View File

@ -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
],
}

View File

@ -1,124 +1,123 @@
<template> <template>
<view class="wrap"> <view class="wrap">
<template v-if="imgSrc"> <template v-if="imgSrc">
<view class="showArea"> <view class="showArea">
<view class="iconBox" @click="handleDel"> <view class="iconBox" @click="handleDel">
<view class="cuIcon-close"></view> <view class="cuIcon-close"></view>
</view> </view>
<wd-img <wd-img :radius="4" enable-preview label="头像" width="60px" height="60px" :src="imgSrc"></wd-img>
:radius="4" </view>
enable-preview </template>
label="头像" <template v-else>
width="60px" <div class="uploadArea" @click="handleUpload">
height="60px" <view class="iconBox">
:src="imgSrc" <view class="cuIcon-cameraadd"></view>
></wd-img> </view>
</view> </div>
</template> </template>
<template v-else> <wd-message-box></wd-message-box>
<div class="uploadArea" @click="handleUpload"> </view>
<view class="iconBox">
<view class="cuIcon-cameraadd"></view>
</view>
</div>
</template>
<wd-message-box></wd-message-box>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useMessage, useToast } from 'wot-design-uni' import { useMessage, useToast } from 'wot-design-uni'
import { computed, watch } from 'vue' import { computed, watch } from 'vue'
import { getEnvBaseUrl } from '@/utils/index' import { getEnvBaseUrl } from '@/utils/index'
import { getFileAccessHttpUrl } from '@/common/uitls'
import { useUserStore } from '@/store/user'
const userStore = useUserStore()
defineOptions({ defineOptions({
name: 'avatar', name: 'avatar',
options: { options: {
// apply-shared.() // apply-shared.()
// shared.() // shared.()
styleIsolation: 'shared', styleIsolation: 'shared',
}, },
}) })
const props = defineProps(['modelValue']) const props = defineProps(['modelValue'])
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const toast = useToast() const toast = useToast()
const message = useMessage() const message = useMessage()
const api = { const api = {
uploadUrl: `${getEnvBaseUrl()}/sys/common/upload`, uploadUrl: `${getEnvBaseUrl()}/sys/common/upload`,
} }
let stopWatch let stopWatch
const imgSrc = computed(() => { const imgSrc = computed(() => {
return props.modelValue return getFileAccessHttpUrl(props.modelValue)
}) })
const handleDel = () => { const handleDel = () => {
message message
.confirm({ .confirm({
msg: '确定要删除这个头像吗?', msg: '确定要删除这个头像吗?',
title: '提示', title: '提示',
}) })
.then(() => { .then(() => {
emit('update:modelValue', '') emit('update:modelValue', '')
}) })
.catch(() => { .catch(() => {
console.log('点击了取消按钮') console.log('点击了取消按钮')
}) })
} }
const handleUpload = () => { const handleUpload = () => {
const { loading, data, error, run } = useUpload({ name: 'file' }, { url: api.uploadUrl }) const { loading, data, error, run } = useUpload({ name: 'file' }, { url: `${getEnvBaseUrl()}/sys/common/upload?appPath=用户头像/` + userStore.userInfo.realname})
if (stopWatch) stopWatch() if (stopWatch) stopWatch()
run() run()
stopWatch = watch( stopWatch = watch(
() => [loading.value, error.value, data.value], () => [loading.value, error.value, data.value],
([loading, err, data], oldValue) => { ([loading, err, data], oldValue) => {
if (loading == false) { if (loading == false) {
if (err) { if (err) {
toast.warning('修改失败') toast.warning('修改失败')
} else { } else {
if (data) { if (data) {
emit('update:modelValue', data.message) emit('update:modelValue', data.message)
} }
} }
} }
}, },
) )
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.showArea { .showArea {
position: relative; position: relative;
width: fit-content; width: fit-content;
.iconBox {
position: absolute; .iconBox {
right: 0; position: absolute;
top: 0; right: 0;
border-bottom-left-radius: 3px; top: 0;
padding: 3px 6px; border-bottom-left-radius: 3px;
height: auto; padding: 3px 6px;
background-color: rgba(0, 0, 0, 0.5); height: auto;
z-index: 1; background-color: rgba(0, 0, 0, 0.5);
color: #fff; z-index: 1;
font-size: 12px; color: #fff;
line-height: 1; font-size: 12px;
border-radius: 2px; line-height: 1;
} border-radius: 2px;
} }
.uploadArea { }
width: 60px;
height: 60px; .uploadArea {
.iconBox { width: 60px;
height: 100%; height: 60px;
width: 100%;
border: 2px solid #eee; .iconBox {
color: #8799a3; height: 100%;
margin: auto; width: 100%;
display: flex; border: 2px solid #eee;
justify-content: center; color: #8799a3;
align-items: center; margin: auto;
flex-direction: column; display: flex;
font-size: 27px; justify-content: center;
} align-items: center;
} flex-direction: column;
font-size: 27px;
}
}
</style> </style>

View File

@ -1,188 +1,162 @@
<route lang="json5" type="page"> <route lang="json5" type="page">
{ {
layout: 'default', layout: 'default',
style: { style: {
navigationBarTitleText: '', navigationBarTitleText: '',
navigationStyle: 'custom', navigationStyle: 'custom',
}, },
} }
</route> </route>
<template> <template>
<PageLayout navTitle="编辑资料" backRouteName="people" routeMethod="pushTab"> <view :class="{ 'gray': appStore.isGray == 1 }">
<wd-form custom-class="pt3" ref="form" :model="model"> <PageLayout navTitle="编辑资料" backRouteName="people" routeMethod="pushTab">
<wd-cell-group border> <wd-form ref="form" :model="model">
<wd-input <wd-cell-group border>
label="用户名" <wd-cell title="头像" title-width="100px">
prop="username" <avatar v-model="model.avatar"></avatar>
clearable </wd-cell>
label-width="70px" <wd-input label="统一身份认证" prop="username" label-width="100px" v-model="model.username"
v-model="model.username" :readonly="true" />
:readonly="true" <wd-input label="姓名" prop="realname" label-width="100px" v-model="model.realname"
placeholder="请输入用户名" :readonly="true" />
/> <wd-input label="劳动合同号" prop="workno" label-width="100px" v-model="model.workno" :readonly="true" />
<wd-input <wd-select-picker label="单位" type="radio" v-model="model.orgCode" :columns="columns" title="切换登录单位"
label="名称" :safe-area-inset-bottom="false" label-width="100px"></wd-select-picker>
prop="realname" <!-- <wd-select-picker label="性别" type="radio" v-model="model.sex" :columns="columns" title="请选择性别"
clearable :safe-area-inset-bottom="false"></wd-select-picker> -->
label-width="70px" <wd-input label="手机号" prop="phone" clearable label-width="100px" v-model="model.phone"
v-model="model.realname" placeholder="请输入手机号" :rules="[{ validator: rules.phone }]" />
placeholder="请输入用户名" <wd-input label="邮箱" prop="email" clearable label-width="100px" v-model="model.email"
:rules="[{ validator: rules.realname }]" placeholder="请输入邮箱" :rules="[{ validator: rules.email }]" />
/> </wd-cell-group>
<wd-cell title="头像"> <view class="footer p5">
<avatar v-model="model.avatar"></avatar> <wd-button type="primary" size="large" @click="handleSubmit" block>提交</wd-button>
</wd-cell> </view>
<wd-select-picker </wd-form>
label="性别" </PageLayout>
type="radio" </view>
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>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { http } from '@/utils/http' import { http } from '@/utils/http'
import { useToast, useMessage, useNotify, dayjs } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
import { useRouter } from '@/plugin/uni-mini-router' import { useRouter } from '@/plugin/uni-mini-router'
import { useUserStore } from '@/store/user' import { useUserStore } from '@/store/user'
import avatar from './components/avatar.vue' 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({ defineOptions({
name: 'chatList', name: 'chatList',
options: { options: {
styleIsolation: 'shared', styleIsolation: 'shared',
}, },
}) })
const toast = useToast() const toast = useToast()
const router = useRouter() const router = useRouter()
const userStore = useUserStore() const userStore = useUserStore()
const columns = [ const appStore = useAppStore()
{ label: '男', value: 1 }, const columns = ref([])
{ label: '女', value: 2 }, const model = reactive({
] avatar: getFileAccessHttpUrl(userStore.userInfo.avatar),
const model = reactive({ username: userStore.userInfo.username,
username: userStore.userInfo.username, realname: userStore.userInfo.realname,
realname: userStore.userInfo.realname, workno: userStore.userInfo.workNo,
avatar: userStore.userInfo.avatar, orgCode: userStore.userInfo.orgCode,
sex: userStore.userInfo.sex ?? 1, // sex: userStore.userInfo.sex ?? 1,
phone: userStore.userInfo.phone, phone: userStore.userInfo.phone,
email: userStore.userInfo.email, email: userStore.userInfo.email,
}) })
const rules = { const rules = {
realname: (value) => { phone: (value : string) => {
if (value?.trim()?.length) { if (value?.trim()?.length) {
return true if (/^1[3-9]\d{9}$/.test(value)) {
} else { return true
toast.warning('请输入名称') } else {
return false toast.warning('请输入正确的手机号')
} return false
}, }
phone: (value) => { } else {
if (value?.trim()?.length) { toast.warning('请输入手机号')
if (/^1[3-9]\d{9}$/.test(value)) { return false
return true }
} else { },
toast.warning('请输入正确的手机号') email: (value : string) => {
return false if (value?.trim()?.length) {
} if (/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*@([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(value)) {
} else { return true
toast.warning('请输入手机号') } else {
return false toast.warning('请输入正确的邮箱')
} return false
}, }
email: (value) => { } else {
if (value?.trim()?.length) { return true
if (/^[a-zA-Z0-9_%+-]+(\.[a-zA-Z0-9_%+-]+)*@([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(value)) { }
return true },
} else { }
toast.warning('请输入正确的邮箱') const form = ref()
return false
}
} else {
toast.warning('请输入邮箱')
return false
}
},
}
const form = ref()
function handleSubmit() { function handleSubmit() {
form.value form.value
.validate() .validate()
.then(({ valid, errors }) => { .then(({ valid }) => {
if (valid) { if (valid) {
if (!model.avatar) { const data = { ...model, id: userStore.userInfo.userid }
toast.warning('上传头像') delete data.username
return uni.showLoading()
} editUserApi({ ...data })
// toast.success('') .then((res : any) => {
const data = { ...model, id: userStore.userInfo.userid } uni.hideLoading()
delete data.username if (res.success) {
uni.showLoading() toast.success('修改成功~请重新登录')
http setTimeout(() => {
.post('/sys/user/login/setting/userEdit', { ...data }) // userStore.editUserInfo({ ...data })
.then((res: any) => { userStore.clearUserInfo()
uni.hideLoading() router.replaceAll({ name: 'login' })
if (res.success) { }, 1e3)
toast.success('修改成功~') } else {
setTimeout(() => { toast.warning(res.message)
userStore.editUserInfo({ ...data }) }
router.replaceAll({ name: 'people' }) })
}, 1e3) .catch(() => {
} else { toast.error('提交失败')
toast.warning(res.message) uni.hideLoading()
} })
}) }
.catch(() => { })
toast.error('提交失败') .catch((error : any) => {
uni.hideLoading() console.log(error, 'error')
}) })
} }
})
.catch((error) => { const changeDeptment = () => {
console.log(error, 'error') queryDepsByUserIdApi().then((res : any) => {
}) columns.value = res.result.list.map((dept : { departName : any; orgCode : any }) => ({
} label: dept.departName,
value: dept.orgCode
}));
})
}
onLoad(() => {
changeDeptment()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// //
:deep(.wd-cell) { :deep(.wd-cell) {
.wd-cell__left { .wd-cell__left {
width: 70px; width: 70px;
flex: none; flex: none;
} }
.wd-cell__value {
text-align: left; .wd-cell__value {
} text-align: left;
} }
}
</style> </style>

View File

@ -23,18 +23,18 @@
"iconWidth": "24px", "iconWidth": "24px",
"spacing": "3px", "spacing": "3px",
"list": [ "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", "iconPath": "static/tabbar/tabbar-message-2.png",
"selectedIconPath": "static/tabbar/tabbar-message.png", "selectedIconPath": "static/tabbar/tabbar-message.png",
"pagePath": "pages/message/message", "pagePath": "pages/message/message",
"text": "消息" "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", "iconPath": "static/tabbar/tabbar-workHome-2.png",
"selectedIconPath": "static/tabbar/tabbar-workHome.png", "selectedIconPath": "static/tabbar/tabbar-workHome.png",
@ -51,12 +51,11 @@
}, },
"pages": [ "pages": [
{ {
"path": "pages/index/index", "path": "pages/login/login",
"type": "home", "type": "home",
"layout": "default",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTitleText": "页" "navigationBarTitleText": "登录页"
} }
}, },
{ {
@ -130,11 +129,12 @@
} }
}, },
{ {
"path": "pages/login/login", "path": "pages/index/index",
"type": "page", "type": "page",
"layout": "default",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTitleText": "" "navigationBarTitleText": "主页"
} }
}, },
{ {

View File

@ -104,7 +104,7 @@
import { ref } from 'vue' import { ref } from 'vue'
import { useRouter } from '@/plugin/uni-mini-router' import { useRouter } from '@/plugin/uni-mini-router'
import { useToast, useMessage, useNotify } from 'wot-design-uni' 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' import Grid from '@/components/Grid/Grid.vue'
const toast = useToast() const toast = useToast()
@ -116,11 +116,11 @@ const { showNotify, closeNotify } = useNotify()
const router = useRouter() const router = useRouter()
const selected = ref([]) const selected = ref([])
const gridData = ref([]) const gridData = ref([])
us.data.forEach((item: any, index) => { // us.data.forEach((item: any, index) => {
if (index < 9) { // if (index < 9) {
gridData.value.push({ text: item.title, img: item.icon, itemKey: index }) // gridData.value.push({ text: item.title, img: item.icon, itemKey: index })
} // }
}) // })
// //
const imgPreview = ref({ const imgPreview = ref({
show: false, show: false,

View File

@ -1,334 +1,347 @@
<!-- 使用 type="home" 属性设置首页其他页面不需要设置默认为page推荐使用json5更强大且允许注释 --> <route lang="json5" type="page">
<route lang="json5" type="home"> {
{ layout: 'default',
layout: 'default', style: {
style: { navigationStyle: 'custom',
navigationStyle: 'custom', navigationBarTitleText: '主页',
navigationBarTitleText: '首页', },
}, }
}
</route> </route>
<template> <template>
<PageLayout :navbarShow="false"> <PageLayout :navbarShow="false">
<!--轮播图--> <view class="nav">
<!-- prettier-ignore --> <view class="nav_box">
<swiper class="swiper" :indicator-dots="true" :circular="true" :autoplay="true" :interval="5000" :duration="500"> <view class="weather_calender">
<!--本地配置轮播图--> <view class="position position-left">
<swiper-item v-for="(item, index) in swiperList" :key="index" v-if="isLocalConfig"> <image src="@/static/index/index/position.png"></image>
<image :src="item.url" mode="aspectFill" v-if="item.type == 'image'"></image> <text>{{!appStore.position?'暂未定位':appStore.position}}</text>
<video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover" v-if="item.type == 'video'"></video> </view>
</swiper-item> <view class="position position-center">
<!--线上配置轮播图--> <image style="height:60rpx;width:60rpx;"
<swiper-item v-for="(item, index) in carouselList" :key="index" v-if="!isLocalConfig"> :src="`http://openweathermap.org/img/w/${appStore.weather}.png`"></image>
<image :src="getFileAccessHttpUrl(item)" mode="aspectFill"></image> <text>{{appStore.temperature}}</text>
</swiper-item> </view>
</swiper> <uni-datetime-picker type="date">
<scroll-view class="scrollView" :scroll-y="true" scroll-with-animation> <view class="position position-right">
<!--流程服务--> <image src="@/static/index/index/calendar.png"></image>
<!-- <wd-row>--> <text>{{getTime()}}</text>
<!-- <wd-col :span="12" v-for="(item, index) in middleApps" :key="index">--> </view>
<!-- <wd-img :width="50" :height="50" :src="getFileAccessHttpUrl(item.icon)"></wd-img>--> </uni-datetime-picker>
<!-- <view class="textBox">--> </view>
<!-- <wd-text :text="item.title"></wd-text>--> </view>
<!-- <wd-text :text="item.subTitle"></wd-text>--> </view>
<!-- </view>--> <scroll-view class="scrollView" :scroll-y="true" scroll-with-animation>
<!-- </wd-col>--> <!--轮播图-->
<!-- </wd-row>--> <swiper class="swiper" :indicator-dots="true" :circular="true" :autoplay="true" :interval="5000"
<!--常用服务--> :duration="500">
<view class="serveBox"> <swiper-item v-for="(item, index) in carouselList" :key="index">
<view class="title"> <image :src="getFileAccessHttpUrl(item)" mode="aspectFill"></image>
<view class="dot"></view> </swiper-item>
<wd-text text="常用服务"></wd-text> </swiper>
</view> <!--流程服务-->
<Grid :column="4" v-model="usList" @itemClik="goPage"></Grid> <wd-row>
</view> <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="serveBox"> <view class="textBox">
<view class="title"> <wd-text :text="item.title"></wd-text>
<view class="dot"></view> <wd-text :text="item.subTitle"></wd-text>
<wd-text text="其他服务"></wd-text> </view>
</view> </wd-col>
<Grid :column="4" v-model="osList" @itemClik="goPage"></Grid> </wd-row>
</view> <!--常用服务-->
</scroll-view> <view class="serveBox">
</PageLayout> <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> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue' import { ref } from 'vue'
import { TestEnum } from '@/typings' import { getFileAccessHttpUrl } from '@/common/uitls'
import { us, os } from '@/common/work' import { onLoad } from '@dcloudio/uni-app'
// import { useToast } from 'wot-design-uni'
import PLATFORM from '@/utils/platform' import { useRouter } from '@/plugin/uni-mini-router'
import { cache, getFileAccessHttpUrl, hasRoute } from '@/common/uitls' import Grid from '@/components/Grid/Grid.vue'
import { onLaunch, onShow, onHide, onLoad, onReady } from '@dcloudio/uni-app' import { queryCarouselApi, getUserPermissionApi } from '@/api/system'
import { useToast, useMessage, useNotify } from 'wot-design-uni' import { getEnvBaseUrl } from '@/utils/index'
import { useRouter } from '@/plugin/uni-mini-router' import { useUserStore } from '@/store/user'
import Grid from '@/components/Grid/Grid.vue' 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 { const goPageMore = (page) => {
ACCESS_TOKEN, router.replace({ name: 'more', params: { backRouteName: 'index', type: page } })
USER_NAME, }
USER_INFO,
APP_ROUTE,
APP_CONFIG,
HOME_CONFIG_EXPIRED_TIME,
} from '@/common/constants'
import { http } from '@/utils/http'
defineOptions({ const queryCarousel = () => {
name: 'index', //
options: { queryCarouselApi({
// apply-shared.() zslb: 6
// shared.() }).then((res : any) => {
styleIsolation: 'shared', if (res.success) {
}, let arr = res.result.records[0].wenjian.split(',')
}) carouselList.value = arr.map((item) => {
const toast = useToast() return getEnvBaseUrl() + '/sys/common/static/' + item
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')
})
if (isLocalConfig) { const queryModule = () => {
usList.value = us.data.map((item) => ({ getUserPermissionApi({
...item, token: userStore.userInfo.token,
text: item.title, }).then((res : any) => {
img: item.icon, if (res.success) {
itemKey: item.routeIndex, let data = res.result.menu
})) data = data.filter(e => e.name == 'APP')[0] //APP
osList.value = os.data.map((item) => ({ let userfulServer = data.children.filter(e => e.name == 'usefulServer') //
...item, usList.value = userfulServer[0].children.map(item => ({
text: item.title, ...item,
img: item.icon, text: item.meta.title,
itemKey: item.routeIndex, img: `/static/index/index/${item.meta.icon}.png`,
})) itemKey: item.meta.sort
usList.value.push({ }))
text: '更多', let otherServer = data.children.filter(e => e.name == 'otherServer') //
img: '/static/index/128/more.png', osList.value = otherServer[0].children.map(item => ({
routeIndex: 'other', ...item,
itemKey: 'other', text: item.meta.title,
}) img: `/static/index/index/${item.meta.icon}.png`,
osList.value.push({ itemKey: item.meta.sort
text: '更多', }))
img: '/static/index/128/more.png', osList.value.push({
routeIndex: 'common', text: '更多',
itemKey: 'common', img: '/static/index/index/more.png',
}) routeIndex: 'common',
middleApps.value = [ itemKey: 'common',
{ })
icon: 'https://static.jeecg.com/upload/test/line2_icon1_1595818065964.png', }
title: '审批', })
subTitle: '个人审批', }
routeIndex: 'paper',
}, middleApps.value = [
{ {
icon: 'https://static.jeecg.com/upload/test/line2_icon2_1595818070168.png', icon: 'https://static.jeecg.com/upload/test/line2_icon1_1595818065964.png',
title: '审批稿', title: '审批',
subTitle: '审批草稿箱', subTitle: '个人审批',
routeIndex: 'draft', routeIndex: 'paper',
}, },
] {
swiperList.value = [ icon: 'https://static.jeecg.com/upload/test/line2_icon2_1595818070168.png',
{ title: '流程',
id: 1, subTitle: '我发起流程',
type: 'image', routeIndex: 'draft',
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', const getTime = () => {
link: '', 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,01)
id: 3, let d = (date.getDate()).toString().padStart(2, 0); //(1-31)
type: 'image', return `${y}-${m}-${d}`
url: 'https://static.jeecg.com/upload/test/oabanner-2_1595648520760.png', }
link: '',
}, onLoad(() => {
{ queryCarousel()
id: 4, queryModule()
type: 'image', })
url: 'https://static.jeecg.com/upload/test/banner5_1595818089013.jpeg',
link: '',
},
]
} else {
getAppConfigRoute()
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.swiper { .nav {
height: 375upx; width: calc(100%);
flex: none; height: v-bind(cusnavbarheight);
image, font-size: 24rpx;
video { color: #333333;
width: 100%; position: fixed;
display: block; z-index: 99;
height: 100%; background-image: url('@/static/navbg.png');
margin: 0; background-repeat: no-repeat;
} background-size: 750rpx 458rpx;
:deep(.uni-swiper-dot) { }
transition: all 400ms ease;
background-color: rgba(255, 255, 255, 0.4); .nav_box {
width: 5px; position: absolute;
height: 5px; bottom: 6rpx;
border-radius: 50%; width: calc(100% - 60rpx);
margin: 0 4px; left: 30rpx;
} right: 30rpx;
:deep(.uni-swiper-dot-active) { }
background-color: rgba(255, 255, 255, 1);
width: 16px; .weather_calender {
border-radius: 2px; display: flex;
} justify-content: space-between;
} align-items: center;
.scrollView { flex-wrap: nowrap;
display: flex;
flex-direction: column; .position {
min-height: 0; display: flex;
background-color: #f1f1f1; align-items: center;
:deep(.wd-row) { white-space: nowrap;
background-color: #fff;
margin-bottom: 32upx; image {
.wd-col { width: 36rpx;
display: flex; height: 36rpx;
align-items: center; margin-right: 8rpx;
justify-content: center; }
&:first-child { }
border-right: 1px solid rgba(165, 165, 165, 0.1);
} /* 左对齐 */
.wd-img { .position-left {
margin: 20upx; justify-content: flex-start;
margin-left: 0; }
}
.textBox { /* 居中 */
text-align: center; .position-center {
display: flex; justify-content: center;
flex-direction: column; }
.wd-text {
color: #666; /* 右对齐 */
&:last-child { .position-right {
font-weight: 200; justify-content: flex-end;
} }
} }
}
} .scrollView {
} display: flex;
.serveBox { flex-direction: column;
margin-bottom: 32upx; min-height: 0;
background-color: #fff; background-color: #f1f1f1;
&:last-child {
.title { :deep(.wd-row) {
.dot { background-color: #fff;
background-color: #fbbd08; margin-bottom: 32upx;
}
} .wd-col {
} display: flex;
:deep(.wd-grid-item) { align-items: center;
&:not(.enabled) { justify-content: center;
// filter: grayscale(1);
} .wd-img {
} margin: 20upx;
.title { margin-left: 0;
display: flex; }
align-items: center;
padding-left: 30upx; .textBox {
height: 52px; text-align: center;
.dot { display: flex;
width: 14upx; flex-direction: column;
height: 14upx;
background-color: #0081ff; .wd-text {
border-radius: 100%; color: #666;
margin-right: 20upx; }
} }
.wd-text { }
color: #666; }
font-size: 15px;
} .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> </style>

View File

@ -1,8 +1,9 @@
<route lang="json5" type="page"> <!-- 使用 type="home" 属性设置首页其他页面不需要设置默认为page推荐使用json5更强大且允许注释 -->
<route lang="json5" type="home">
{ {
style: { style: {
navigationStyle: 'custom', navigationStyle: 'custom',
navigationBarTitleText: '', navigationBarTitleText: '登录页',
}, },
} }
</route> </route>
@ -12,7 +13,6 @@
<view :class="['page-container', { 'gray': appStore.isGray == 1 }]"> <view :class="['page-container', { 'gray': appStore.isGray == 1 }]">
<view class="text-center"> <view class="text-center">
<image src="@/static/sinopec.png" mode="aspectFit" class="logo"></image> <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="enter-area">
<view class="account-login-area"> <view class="account-login-area">
<view class="box account"> <view class="box account">
@ -56,41 +56,23 @@
import { useAppStore } from '@/store' import { useAppStore } from '@/store'
import { useUserStore } from '@/store/user' import { useUserStore } from '@/store/user'
import { http } from '@/utils/http' import { http } from '@/utils/http'
import { import { HOME_PAGE } from '@/common/constants'
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 { useRouter } from '@/plugin/uni-mini-router' import { useRouter } from '@/plugin/uni-mini-router'
// import { useParamsStore } from '@/store/page-params'
import Base64 from 'base-64'; import Base64 from 'base-64';
import { loginApi } from '@/api/system'; import { loginApi } from '@/api/system';
defineOptions({ defineOptions({
name: 'login', name: 'login',
options: { options: {
// apply-shared.()
// shared.()
styleIsolation: 'shared', styleIsolation: 'shared',
}, },
}) })
const router = useRouter() const router = useRouter()
// const defLogo = 'https://static.jeecg.com/files/app_logo.png'
const loading = ref(false) const loading = ref(false)
const userName = ref() const userName = ref()
const password = ref() const password = ref()
const showPassword = ref(false) // const showPassword = ref(false) //
const remPW = 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值*/ /**h5系统信息中没有appWgtVersion值*/
const version = uni.getSystemInfoSync().appWgtVersion ? uni.getSystemInfoSync().appWgtVersion : uni.getSystemInfoSync().appVersion const version = uni.getSystemInfoSync().appWgtVersion ? uni.getSystemInfoSync().appWgtVersion : uni.getSystemInfoSync().appVersion
const toast = useToast() const toast = useToast()
@ -123,9 +105,9 @@
let pw = Base64.encode(encodeURIComponent(password.value)) let pw = Base64.encode(encodeURIComponent(password.value))
loading.value = true loading.value = true
/*生产环境 begin */ /*生产环境 begin */
// loginApi({ username: un, password: pw }) loginApi({ username: un, password: pw })
/*开发环境 begin */ /*开发环境 begin */
loginApi({ username: userName.value, password: password.value, captcha: 'app' }) // loginApi({ username: userName.value, password: password.value, captcha: 'app' })
.then((res : any) => { .then((res : any) => {
if (res.success) { if (res.success) {
const { result } = res const { result } = res
@ -137,6 +119,7 @@
username: userInfo.username, username: userInfo.username,
realname: userInfo.realname, realname: userInfo.realname,
avatar: userInfo.avatar, avatar: userInfo.avatar,
post: userInfo.post,
tenantId: userInfo.loginTenantId, tenantId: userInfo.loginTenantId,
localStorageTime: +new Date(), localStorageTime: +new Date(),
}) })
@ -161,63 +144,6 @@
remPW.value = uni.getStorageSync('savePwd') 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -235,10 +161,6 @@
height: 200px; height: 200px;
} }
.title {
font-size: 58upx;
}
.enter-area { .enter-area {
padding-top: 30px; padding-top: 30px;
width: 87%; width: 87%;

View File

@ -27,7 +27,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { us, os } from '@/common/work' // import { us, os } from '@/common/work'
import { cache, getFileAccessHttpUrl } from '@/common/uitls' import { cache, getFileAccessHttpUrl } from '@/common/uitls'
import { import {
ACCESS_TOKEN, ACCESS_TOKEN,
@ -50,7 +50,7 @@ let type = 'common'
const init = () => { const init = () => {
if (isLocalConfig) { if (isLocalConfig) {
routeList.value = type == 'common' ? us.data : os.data // routeList.value = type == 'common' ? us.data : os.data
} else { } else {
var indexRouteList = cache(APP_ROUTE) var indexRouteList = cache(APP_ROUTE)
routeList.value = indexRouteList.filter((item) => item.type == type) routeList.value = indexRouteList.filter((item) => item.type == type)

View File

@ -1,322 +1,303 @@
<route lang="json5" type="page"> <route lang="json5" type="page">
{ {
layout: 'default', layout: 'default',
style: { style: {
navigationStyle: 'custom', navigationStyle: 'custom',
navigationBarTitleText: '个人', navigationBarTitleText: '个人',
}, },
} }
</route> </route>
<template> <template>
<PageLayout :navbarShow="false"> <PageLayout :navbarShow="false">
<view class="avatar-area"> <view :class="{ 'gray': appStore.isGray == 1 }">
<!-- prettier-ignore --> <view class="avatar-area">
<wd-img width="100" height="100" :round="true" :radius="50" :src="personalList.avatar ? personalList.avatar : defAvatar" @click="ChooseImage"></wd-img> <wd-img width="100" height="100" :round="true" :radius="50"
</view> :src="getFileAccessHttpUrl(userStore.userInfo.avatar)" @click="ChooseImage"></wd-img>
<view class="info-area shadow-warp mb-5"> </view>
<view class="user"> <view class="info-area shadow-warp mb-5">
<wd-text custom-class="title" :text="personalList.username"></wd-text> <view class="user">
<view class="tag"> <wd-text custom-class="title" :text="userStore.userInfo.realname"></wd-text>
<view class="cuIcon-people mr-1"></view> <view class="tag">
<wd-text text="用户"></wd-text> <view class="cuIcon-people mr-1"></view>
</view> <wd-text text="用户"></wd-text>
</view> </view>
<view class="job"> </view>
<!-- prettier-ignore --> <view class="department">
<wd-text custom-class="title":text="personalList.post ? personalList.post : '员工'"></wd-text> <wd-text custom-class="title" :text="userStore.userInfo.department"></wd-text>
<view class="tag"> <view class="tag">
<view class="cuIcon-news mr-1"></view> <view class="cuIcon-group mr-1"></view>
<wd-text text="职务"></wd-text> <wd-text text="单位"></wd-text>
</view> </view>
</view> </view>
</view> <view class="job">
<scroll-view scroll-y> <wd-text custom-class="title" :text="post"></wd-text>
<wd-cell-group custom-class="shadow-warp" border clickable> <view class="tag">
<template v-for="(item, index) in dataSource" :key="index"> <view class="cuIcon-news mr-1"></view>
<wd-cell :title="item.title" is-link @click="handleCell(item)"> <wd-text text="职务"></wd-text>
<template #icon> </view>
<view :class="item.class" class="mr-2"></view> </view>
</template> </view>
</wd-cell> <scroll-view scroll-y>
</template> <wd-cell-group custom-class="shadow-warp" border clickable>
</wd-cell-group> <template v-for="(item, index) in dataSource" :key="index">
</scroll-view> <wd-cell :title="item.title" is-link @click="handleCell(item)">
</PageLayout> <template #icon>
<view :class="item.class" class="mr-2"></view>
</template>
</wd-cell>
</template>
</wd-cell-group>
</scroll-view>
</view>
</PageLayout>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, watch, onBeforeUnmount } from 'vue' import { ref, watch, onBeforeUnmount } from 'vue'
import { cache, getFileAccessHttpUrl, hasRoute } from '@/common/uitls' import { getFileAccessHttpUrl } from '@/common/uitls'
import { onLaunch, onShow, onHide, onLoad, onReady } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { useToast, useMessage, useNotify } from 'wot-design-uni' import { useToast, useMessage } from 'wot-design-uni'
import { useRouter } from '@/plugin/uni-mini-router' import { useRouter } from '@/plugin/uni-mini-router'
import { import { http } from '@/utils/http'
ACCESS_TOKEN, import { useUserStore } from '@/store/user'
USER_NAME, import useUpload from '@/hooks/useUpload'
USER_INFO, import { getEnvBaseUrl } from '@/utils/index'
APP_ROUTE, import { queryPostByUserIdApi, editUserApi } from '@/api/system/user'
APP_CONFIG, import { useAppStore } from '@/store'
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'
// const userStore = useUserStore()
const userStore = useUserStore() const appStore = useAppStore()
const toast = useToast() const toast = useToast()
const router = useRouter() const router = useRouter()
const message = useMessage() const message = useMessage()
const defAvatar = 'https://static.jeecg.com/upload/test/login4_1595818039175.png' const post = ref('')
const personalList = reactive({ let stopWatch : any = null
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 load = () => { const dataSource = [
if (!userId.value) { // { key: 'collect', title: '', class: 'cuIcon-favorfill text-yellow' },
return // { key: 'redPacket', title: '', class: 'cuIcon-redpacket_fill text-red' },
} { key: 'setting', title: '个人资料', class: 'cuIcon-settingsfill text-cyan' },
http { key: 'scan', title: '扫码', class: 'cuIcon-scan text-red' },
.get(api.userUrl, { id: userId.value }) // { key: 'location', title: '', class: 'cuIcon-location text-cyan' },
.then((res: any) => { { key: 'exit', title: '退出', class: 'cuIcon-exit text-cyan' },
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 ChooseImage = (params) => { const load = () => {
uni.showLoading({ title: '上传中...' }) //userid
const { loading, data, error, run } = useUpload({ name: 'file' }, { url: api.uploadUrl }) queryPostByUserIdApi(userStore.userInfo.userid).then((res : any) => {
if (stopWatch) stopWatch() post.value = res
run() })
stopWatch = watch( }
() => [loading.value, error.value, data.value],
([loading, err, data], oldValue) => { const ChooseImage = () => {
if (loading == false) { uni.showLoading({ title: '上传中...' })
if (err) { const { loading, data, error, run } = useUpload({ name: 'file' }, { url: `${getEnvBaseUrl()}/sys/common/upload?appPath=用户头像/` + userStore.userInfo.realname })
toast.warning('修改失败') if (stopWatch) stopWatch()
uni.hideLoading() run()
} else { stopWatch = watch(
if (data) { () => [loading.value, error.value, data.value],
editAvatar(data.message) ([loading, err, data]) => {
} if (loading == false) {
} if (err) {
} toast.warning('修改失败')
}, uni.hideLoading()
) } else {
} if (data) {
const editAvatar = (avatar) => { editAvatar(data.message)
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) const editAvatar = (avatar) => {
} else { editUserApi({ id: userStore.userInfo.userid, avatar }).then((res : any) => {
toast.warning(res.message) if (res.success) {
} toast.success('修改成功~')
uni.hideLoading() userStore.editUserInfo({ avatar: getFileAccessHttpUrl(avatar) })
}) } else {
.catch((err) => { toast.warning(res.message)
uni.hideLoading() }
toast.warning('修改失败') uni.hideLoading()
}) })
} .catch((err) => {
const scan = () => { uni.hideLoading()
// #ifndef H5 toast.warning('修改失败')
uni.scanCode({ })
success: function (res) { }
console.log('条码res' + res) const scan = () => {
console.log('条码类型:' + res.scanType) // #ifndef H5
console.log('条码内容:' + res.result) uni.scanCode({
//QRCODELOGIN success: function (res) {
if (res.result.indexOf('QRCODELOGIN') != -1) { console.log('条码res' + res)
const data = { console.log('条码类型:' + res.scanType)
qrcodeId: res.result, console.log('条码内容:' + res.result)
token: userStore.userInfo.token, //QRCODELOGIN
} if (res.result.indexOf('QRCODELOGIN') != -1) {
http({ const data = {
url: '/sys/scanLoginQrcode', qrcodeId: res.result,
data, token: userStore.userInfo.token,
header: { 'content-type': 'application/x-www-form-urlencoded' }, }
method: 'POST', http({
}).then((res: any) => { url: '/sys/scanLoginQrcode',
console.log('扫码接口返回内容res', res) data,
if (res.success) { header: { 'content-type': 'application/x-www-form-urlencoded' },
toast.success(res.result) method: 'POST',
} else { }).then((res : any) => {
toast.warning(res.result) console.log('扫码接口返回内容res', res)
} if (res.success) {
}) toast.success(res.result)
} } else {
}, toast.warning(res.result)
}) }
// #endif })
// #ifdef H5 }
toast.warning('H5暂不支持') },
// #endif })
} // #endif
const exit = () => { // #ifdef H5
message toast.warning('H5暂不支持')
.confirm({ // #endif
title: '提示', }
msg: '确定退出吗?', const exit = () => {
}) message
.then(() => { .confirm({
userStore.clearUserInfo() title: '提示',
router.replaceAll({ name: 'login' }) msg: '确定退出吗?',
}) })
} .then(() => {
const handleCell = (item) => { userStore.clearUserInfo()
switch (item.key) { router.replaceAll({ name: 'login' })
case 'scan': })
scan() }
break const handleCell = (item) => {
case 'location': switch (item.key) {
router.push({ name: 'location' }) case 'scan':
break scan()
case 'setttings': break
router.push({ name: 'userEdit' }) case 'setting':
break router.push({ name: 'userEdit' })
case 'exit': break
exit() case 'exit':
break exit()
default: break
toast.show('功能暂未开发~') default:
} toast.show('功能暂未开发~')
} }
onBeforeUnmount(() => { }
stopWatch?.() onBeforeUnmount(() => {
}) stopWatch?.()
onLoad(() => { })
load() onLoad(() => {
}) load()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// //
.avatar-area { .avatar-area {
/* #ifdef MP-WEIXIN */ /* #ifdef MP-WEIXIN */
background-image: url('https://static.jeecg.com/upload/test/blue_1595818030310.png'); background-image: url('https://static.jeecg.com/upload/test/blue_1595818030310.png');
/* #endif */ /* #endif */
/* #ifndef MP-WEIXIN */ /* #ifndef MP-WEIXIN */
background-image: url('@/static/blue.png'); background-image: url('@/static/blue.png');
/* #endif */ /* #endif */
background-size: cover; background-size: cover;
height: 400upx; height: 400upx;
display: flex; display: flex;
justify-content: center; justify-content: center;
padding-top: 40upx; padding-top: 40upx;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
color: #fff; color: #fff;
font-weight: 300; font-weight: 300;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.3); text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
} }
.info-area {
display: flex; .info-area {
padding: 30upx; display: flex;
background-color: #fff; padding: 30upx;
color: #8799a3; background-color: #fff;
:deep(.wd-text) { color: #8799a3;
color: var(--color-gray); justify-content: space-around;
} /* 新增:均匀分配空间 */
.user,
.job { :deep(.wd-text) {
flex: 1; color: var(--color-gray);
display: flex; }
flex-direction: column;
align-items: center; .user,
.tag { .job,
display: flex; .department {
align-items: center; flex: 1 1 auto;
} /* 修改:允许项目增长 */
.wd-text.title { display: flex;
font-size: 18px; flex-direction: column;
min-height: 18px; align-items: center;
margin-bottom: 16upx; padding: 0 15upx;
} /* 新增:增加内边距扩大间距 */
} min-width: 0;
.user { /* 新增:防止文本溢出 */
border-right: 0.5px solid rgba(0, 0, 0, 0.1);
.wd-text.title { .tag {
color: #f37b1d; display: flex;
} align-items: center;
} }
.job {
.wd-text.title { .wd-text.title {
color: #39b54a; font-size: 18px;
} min-height: 18px;
} margin-bottom: 16upx;
} white-space: nowrap;
:deep(.wd-cell-group) { /* 新增:防止文本换行 */
margin: 0 26upx; overflow: hidden;
border-radius: 18upx; /* 新增:隐藏溢出 */
overflow: hidden; text-overflow: ellipsis;
--wot-cell-line-height: 32px; /* 新增:显示省略号 */
.wd-cell { max-width: 100%;
--wot-cell-title-fs: 15px; /* 新增:限制最大宽度 */
--wot-cell-title-color: var(--color-gray); }
.wd-cell__left { }
font-size: 15px;
} .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> </style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
src/static/navbg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@ -1,7 +1,9 @@
import { createPinia, defineStore } from 'pinia' import { createPinia, defineStore } from 'pinia'
import { createPersistedState } from 'pinia-plugin-persistedstate' // import { createPersistedState } from 'pinia-plugin-persistedstate' //
import { upDateAppApi } from '@/api/system'; import { upDateAppApi } from '@/api/system'
import { hasNewVersion, onClickUpdate } from '@/utils/index'; import { hasNewVersion, onClickUpdate } from '@/utils/index'
import { getEnvBaseUrl } from '@/utils/index'
const store = createPinia() const store = createPinia()
store.use( store.use(
createPersistedState({ createPersistedState({
@ -14,11 +16,27 @@ store.use(
export const useAppStore = defineStore('app', { export const useAppStore = defineStore('app', {
state: () => ({ state: () => ({
isGray: 0 as 0 | 1, // 0=1= isGray: 0 as 0 | 1, // 0=1=
position: null, //
location: null, //
temperature: null, //
weather: null //
}), }),
actions: { actions: {
setIsGray(value : 0 | 1) { setIsGray(value : 0 | 1) {
this.isGray = value 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, // persist: true, //
}) })
@ -45,8 +63,8 @@ export const useUpdateApp = defineStore('updateApp', () => {
let { let {
result result
} = res } = res
result.apkUrl = import.meta.env.VITE_SERVER_BASEURL + '/sys/common/static/' + result.apkUrl; result.apkUrl = getEnvBaseUrl() + '/sys/common/static/' + result.apkUrl
result.wgtUrl = import.meta.env.VITE_SERVER_BASEURL + '/sys/common/static/' + result.wgtUrl result.wgtUrl = getEnvBaseUrl() + '/sys/common/static/' + result.wgtUrl
updateOptions.wgtUrl = result.wgtUrl updateOptions.wgtUrl = result.wgtUrl
if (systemInfo.osName === 'android') { if (systemInfo.osName === 'android') {
// Android // Android

View File

@ -1,50 +1,58 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { ref } from 'vue' import { ref } from 'vue'
import { queryDepByOrgCodeApi } from '@/api/system/department'
const initState = { const initState = {
token: '', token: '',
userid: '', userid: '',
username: '', username: '',
realname: '', realname: '',
welcome: '', avatar: '',
avatar: '', tenantId: 0,
tenantId: 0, phone: '',
phone: '', email: '',
email: '', // sex: 1,
sex: 1, post: '',
// orgCode: '',
localStorageTime: 0, workNo: '',
//
localStorageTime: 0,
} }
export const useUserStore = defineStore( export const useUserStore = defineStore(
'user', 'user',
() => { () => {
const userInfo = ref<IUserInfo>({ ...initState }) const userInfo = ref<IUserInfo>({ ...initState })
const setUserInfo = (val: IUserInfo) => { const setUserInfo = (val : IUserInfo) => {
userInfo.value = val userInfo.value = val
} if (val.orgCode) {
const clearUserInfo = () => { queryDepByOrgCodeApi(val.orgCode).then((res : any) => {
userInfo.value = { ...initState } userInfo.value.department = res.result; // API { result: "" }
} })
const editUserInfo = (options) => { }
userInfo.value = { ...userInfo.value, ...options } }
} const clearUserInfo = () => {
// reset userInfo.value = { ...initState }
const reset = () => { }
userInfo.value = { ...initState } const editUserInfo = (options) => {
} userInfo.value = { ...userInfo.value, ...options }
const isLogined = computed(() => !!userInfo.value.token) }
return { // reset
userInfo, const reset = () => {
setUserInfo, userInfo.value = { ...initState }
clearUserInfo, }
isLogined, const isLogined = computed(() => !!userInfo.value.token)
editUserInfo, return {
reset, userInfo,
} setUserInfo,
}, clearUserInfo,
{ isLogined,
// true, false editUserInfo,
persist: true, reset,
}, }
},
{
// true, false
persist: true,
},
) )

View File

@ -741,6 +741,16 @@
content: "\e736"; content: "\e736";
} }
.cuIcon-homefill:before {
content: "\e6bb";
}
.cuIcon-home:before {
content: "\e6bc";
}
.cuIcon-group:before {
content: "\e753";
}
.cuIcon-servicefill:before { .cuIcon-servicefill:before {
content: "\e737"; content: "\e737";
} }

View File

@ -4,7 +4,7 @@
// Generated by vite-plugin-uni-pages // Generated by vite-plugin-uni-pages
interface NavigateToOptions { interface NavigateToOptions {
url: "/pages/index/index" | url: "/pages/login/login" |
"/pages/about/about" | "/pages/about/about" |
"/pages/annotation/annotationDetail" | "/pages/annotation/annotationDetail" |
"/pages/annotation/annotationList" | "/pages/annotation/annotationList" |
@ -13,7 +13,7 @@ interface NavigateToOptions {
"/pages/demo/indexBar" | "/pages/demo/indexBar" |
"/pages/demo/selectPicker" | "/pages/demo/selectPicker" |
"/pages/demo/tree" | "/pages/demo/tree" |
"/pages/login/login" | "/pages/index/index" |
"/pages/message/message" | "/pages/message/message" |
"/pages/more/more" | "/pages/more/more" |
"/pages/user/people" | "/pages/user/people" |
@ -36,7 +36,7 @@ interface NavigateToOptions {
interface RedirectToOptions extends NavigateToOptions {} interface RedirectToOptions extends NavigateToOptions {}
interface SwitchTabOptions { 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; type ReLaunchOptions = NavigateToOptions | SwitchTabOptions;

63
src/typings.d.ts vendored
View File

@ -1,37 +1,40 @@
// //
declare global { declare global {
type IResData<T> = { type IResData<T> = {
code: number code : number
msg: string msg : string
data: T data : T
} }
// uni.uploadFile // uni.uploadFile
type IUniUploadFileOptions = { type IUniUploadFileOptions = {
file?: File file ?: File
files?: UniApp.UploadFileOptionFiles[] files ?: UniApp.UploadFileOptionFiles[]
filePath?: string filePath ?: string
name?: string name ?: string
formData?: any formData ?: any
} }
type IUserInfo = { type IUserInfo = {
token?: string token ?: string
userid?: string userid ?: string
username?: string username ?: string
realname?: string realname ?: string
welcome?: string orgCode ?: string
avatar?: string department ?: string
tenantId?: string | number workNo ?: string
sex?: number avatar ?: string
phone?: string tenantId ?: string | number
email?: string // sex ?: number
/** 微信的 openid非微信没有这个字段 */ phone ?: string
openid?: string post ?: string
// email ?: string
localStorageTime: number /** 微信的 openid非微信没有这个字段 */
} openid ?: string
//
localStorageTime : number
}
} }
export {} // export { } //

View File

@ -1,5 +1,6 @@
import { pages, subPackages, tabBar } from '@/pages.json' import { pages, subPackages, tabBar } from '@/pages.json'
import { isMpWeixin } from './platform' import { isMpWeixin } from './platform'
import { useAppStore } from '@/store'
const getLastPage = () => { const getLastPage = () => {
// getCurrentPages() 1 // getCurrentPages() 1
@ -103,7 +104,7 @@ export const getAllPages = (key = 'needLogin') => {
}) })
}) })
const result = [...mainPages, ...subPages] const result = [...mainPages, ...subPages]
// console.log(`getAllPages by ${key} result: `, result) console.log(`getAllPages by ${key} result: `, result)
return result return result
} }
@ -318,3 +319,116 @@ function installApp(tempFilePath : string) {
) )
// #endif // #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'
})
}
});
}

View File

@ -39,7 +39,7 @@ export default class signMd5Utils {
//update-end---author:wangshuai---date:2024-04-16---for:QQYUN-9005--- //update-end---author:wangshuai---date:2024-04-16---for:QQYUN-9005---
let requestBody:any = this.sortAsc(jsonObj); let requestBody:any = this.sortAsc(jsonObj);
delete requestBody._t; delete requestBody._t;
console.log('sign requestBody:', requestBody); // console.log('sign requestBody:', requestBody);
return md5(JSON.stringify(requestBody) + signatureSecret).toUpperCase(); return md5(JSON.stringify(requestBody) + signatureSecret).toUpperCase();
} }
/** /**

View File

@ -29,8 +29,7 @@
}, },
"exclude": ["node_modules"], "exclude": ["node_modules"],
"include": [ "include": [
"src/**/*.ts", "src/**/*",
"src/**/*.js",
"src/**/*.d.ts", "src/**/*.d.ts",
"src/**/*.min.js", "src/**/*.min.js",
"src/**/*.tsx", "src/**/*.tsx",