Commit 7d26ad2e authored by sixiaofeng's avatar sixiaofeng

1

parent 24852213
......@@ -14,7 +14,8 @@ export interface Staff {
"depName": string,
"entName": string,
"id": string,
"workplace": string
"workplace": string,
"isActivated": boolean
}
// 通讯录
......
......@@ -138,8 +138,11 @@ export default Vue.extend({
}
},
watch: {
value(val) {
value: {
handler(val) {
this.length = val.length
},
immediate: true
}
}
})
......
export const global = {
success: 0
success: 0,
sig: ''
}
......@@ -41,7 +41,7 @@ export const teamRoutes: Array<RouteConfig> = [
name: 'Team',
component: () => import('@/views/team/team-frame.vue'),
meta: {
title: '团队架构'
title: '组织架构'
}
},
{
......
import axios, { AxiosInstance } from "axios"
import {global} from '@/const/Global'
import router from '@/router'
......@@ -12,6 +13,7 @@ export const Account = {
entId: '166961152260050944',
staffId: '1FKxgaEh5fuSm7a35BfUnKYAmradowpiTR'
}
interface RouterConfig{
path: string
method?: string
......@@ -27,6 +29,10 @@ export default class BaseService {
})
this.service.interceptors.request.use(
(res)=>{
if (global.sig !== '') {
// from pc
res.headers['FZM-SIGNATURE'] = global.sig
}
return res
},
(err)=>{
......
......@@ -39,7 +39,7 @@ export interface DeleteEnterpriseDTO {
}
export interface updateEnterpriseDTO {
avator: string,
avatar: string,
description: string,
id: string,
name: string
......
......@@ -169,5 +169,6 @@ export default {
signAuth,
scanCode,
openCompanyUserInfo,
goBack
goBack,
close
}
......@@ -48,7 +48,6 @@
<script lang="ts">
import { useRequest } from 'ahooks-vue'
import Vue from 'vue'
import {AddSubDTO} from '@/service/moudles/service.dto'
import { Department, Staff } from '@/Interface'
......@@ -65,6 +64,12 @@ export default Vue.extend({
'dep-selector': () => import('@/views/team/components/dep-selector.vue'),
},
name: 'AddDepartment',
beforeRouteEnter(to, from, next) {
const path = from.path
next((vm: any) => {
vm.fromManagement = path === '/team/team-management'
})
},
data() {
const addDep:AddSubDTO = {
entId: '',
......@@ -104,7 +109,8 @@ export default Vue.extend({
selectedDepId: '',
contacts: {},
loading: false,
showDepSelector: false
showDepSelector: false,
fromManagement: false
}
},
created(){
......@@ -119,7 +125,12 @@ export default Vue.extend({
},
methods: {
goBack() {
this.$router.replace('/team/team-frame')
// this.$router.replace('/team/team-frame')
if (this.fromManagement) {
this.$router.push('/team/team-management')
} else {
this.$router.push('/team/team-frame')
}
},
addDepConfirm(){
if (this.name === '') {
......
......@@ -29,7 +29,6 @@
/>
<input-cell
v-model="acceptJoin.position"
required
:limit="10"
label="职位"
placeholder="请输入职位"
......@@ -37,6 +36,7 @@
/>
<!-- 手机号/员工编号/入职时间 -->
<c-cell
v-if="!isEdit"
v-model="acceptJoin.phone"
required
title="手机号"
......@@ -47,6 +47,12 @@
:validator="checkPhone"
/>
<c-cell
v-else
title="手机号"
:content="acceptJoin.phone"
class="mt-4"
/>
<c-cell
v-model="acceptJoin.shortPhone"
title="短号"
placeholder="请输入短号"
......@@ -55,7 +61,6 @@
<c-cell
v-model="date"
dot
required
title="入职时间"
:content="formatDate(acceptJoin.joinTime*1000 || new Date().getTime(), 'YYYY-MM-DD')"
@click="show = true"
......@@ -69,10 +74,10 @@
@confirm="selectJoinTime"
/>
<!-- 选择部门 -->
<group-cell required class="mt-4" title="所属部门" @click.native="selectDep">
<group-cell class="mt-4" title="所属部门" @click.native="selectDep">
<c-cell dot :title="currentDep.name" />
</group-cell>
<group-cell class="mt-4" title="绑定账户">
<group-cell v-if="isEdit" class="mt-4" title="绑定账户">
<c-cell
v-model="usrId"
class-input="text-left"
......@@ -116,6 +121,12 @@ export default Vue.extend({
'group-cell': () => import('@/components/common/group-cell.vue'),
'dep-selector': () => import('@/views/team/components/dep-selector.vue')
},
beforeRouteEnter(to, from, next) {
const path = from.path
next((vm: any) => {
vm.fromManagement = path === '/team/team-management'
})
},
data() {
const currentDep: Department = {
entId: '',
......@@ -160,7 +171,8 @@ export default Vue.extend({
pageTitle: '添加成员',
isEdit: false,
usrId: '',
shortPhone: ''
shortPhone: '',
fromManagement: false
}
},
async created() {
......@@ -171,6 +183,7 @@ export default Vue.extend({
this.pageTitle = '编辑成员'
this.usrId = query.usrId
const usrInfo = await this.getStaff(this.usrId)
console.log(usrInfo, 'usrInfo')
this.selectedDepId = this.depId = usrInfo.depId
this.entId = usrInfo.entId
this.date = this.formatDate(usrInfo.joinTime)
......@@ -179,7 +192,7 @@ export default Vue.extend({
// 添加
const entInfo = JSON.parse(localStorage.getItem('ENT_INFO') || '{}')
this.selectedDepId = this.depId = this.$route.query.id as string || entInfo.rootDepId
this.entId = entInfo.id || '168398222891421696'
this.entId = entInfo.id
this.date = this.formatDate(new Date())
this.pageTitle = '添加成员'
}
......@@ -189,7 +202,7 @@ export default Vue.extend({
methods: {
validateParmas(): boolean {
const {phone, name, position, joinTime} = this.acceptJoin
return !this.validatePhone(phone) || trim(name) === '' || trim(position) === '' || joinTime === 0 || trim(this.depId) === ''
return !this.validatePhone(phone) || trim(name) === ''
},
getStaff(id: string) {
this.loading = true
......@@ -308,7 +321,12 @@ export default Vue.extend({
}
},
handleClickLeft() {
this.$router.replace('/team/team-frame')
// this.$router.replace('/team/team-frame')
if (this.fromManagement) {
this.$router.push('/team/team-management')
} else {
this.$router.push('/team/team-frame')
}
},
// 入职日期
selectJoinTime(date: Date) {
......@@ -330,9 +348,9 @@ export default Vue.extend({
this.acceptJoin.expiration = Math.round(new Date().getTime()/1000) + 24 * 60 * 60
this.acceptJoin.inviterId = process.env.NODE_ENV ==='production'? getPublicKey(): "1FKxgaEh5fuSm7a35BfUnKYAmradowpiTR"
this.acceptJoin.oaServer = localStorage.getItem('ENT_INFO')? JSON.parse(localStorage.getItem('ENT_INFO') as any).oaServer : 'http://172.16.101.107:20000'
const {depId,entId,expiration,inviterId,joinTime,name,oaServer,phone,position} = this.acceptJoin
const {depId,entId,expiration,inviterId,joinTime,name,oaServer,phone,position,shortPhone} = this.acceptJoin
this.acceptJoin.hash = process.env.NODE_ENV ==='production'? getSign({
depId,entId,expiration,inviterId,joinTime,name,oaServer,phone,position
depId,entId,expiration,inviterId,joinTime,name,oaServer,phone,position,shortPhone
}) : 'mock-hash'
this.$store.commit('setAcceptJoin', this.acceptJoin)
this.$router.push('/team/two-code')
......
......@@ -23,6 +23,7 @@
</div>
<!-- 负责人 -->
<div class="text-xs text-text-secondary mt-4">负责人</div>
<div v-if="leaderList.length > 0">
<div
v-for="l in leaderList"
:key="l.id"
......@@ -34,6 +35,10 @@
/>
<div class="name truncate ml-3">{{l.name}}</div>
</div>
</div>
<div v-else>
暂无负责人
</div>
<!-- 管理员 -->
<div class="text-xs text-text-secondary mt-2">管理员</div>
<!-- 没有管理员 -->
......@@ -80,7 +85,6 @@
import Vue from 'vue'
import {LocalStoreEnt, Staff} from '@/Interface'
import { Role } from '@/service/moudles/service.dto'
import axios from 'axios'
export default Vue.extend({
name: 'AuthManagement',
......@@ -109,20 +113,8 @@ export default Vue.extend({
methods: {
// 添加管理员
confirm(arr: string[]) {
console.log(arr, 'arr')
const requests = [] as any[]
if (arr.length === 0) return
arr.forEach((i: string) => {
requests.push(this.changeRole(i, 1))
})
this.loading=true
axios.all(requests).then(res => {
this.loading = false
this.getSub()
}).catch(err =>{
this.loading = false
this.$toast(err)
})
this.changeRole(arr[0], 1)
},
changeRole(id: string, role: number) {
this.loading=true
......@@ -134,11 +126,13 @@ export default Vue.extend({
const {data} = res
this.loading=false
if (data.code === this.$global.success) {
return data.data
this.$toast('添加成功')
// this.getSub()
this.$router.push('/team/team-management')
} else {
Promise.reject(data.msg)
this.$toast(data.msg)
}
}).catch((err) => Promise.reject(err))
}).catch(() =>this.loading=false)
},
getSub() {
this.loading = true
......@@ -166,8 +160,10 @@ export default Vue.extend({
const {data} = res
this.loading = false
if (data.code === this.$global.success) {
// 转让成功
this.$router.replace('/team/team-frame')
// 移除成功
this.$toast('删除成功')
// this.getSub()
this.$router.push('/team/team-management')
} else {
this.$toast(data.msg)
}
......@@ -180,7 +176,7 @@ export default Vue.extend({
})
this.showMemberSelector = true
this.selectorTitle = '添加管理员'
this.multiple = true
this.multiple = false
}
}
})
......
<template>
<!-- 头像 -->
<div v-if="show" class="min-h-screen w-full border relative z-2001 bg-black px-4">
<div v-if="show" class="w-full h-screen overflow-y-scroll relative z-2001 bg-black pb-4">
<van-action-sheet
v-model="showActionSheet"
:actions="actions"
cancel-text="取消"
close-on-click-action
@select="onSelect"
>
<div class="">
<!-- <div class="px-4 py-3 text-center">拍照</div> -->
<div class="px-4 py-3 text-center" @click="uploadFile">
<div>从手机相册中选择</div>
<input
type="file"
id="uploadFile"
ref="uploadFile"
accept="image/*"
class="hidden"
@input="fileHandler"
/>
<div class="header h-12 flex items-center justify-between">
</div>
</div>
</van-action-sheet>
<div class="header w-full px-4 bg-black fixed top-0 left-0 z-2001 h-12 flex items-center justify-between">
<app-icon
class-name="w-6.5 h-6.5"
icon-name="left-arrow-white"
......@@ -21,17 +34,23 @@
@click="showActionSheet=true"
/>
</div>
<div class="py-16 px-6">
<!-- 默认头像 -->
<div v-if="showDefault" class="default-avator mt-4 rounde overflow-hidden mx-auto mt-4">
<img :src="defaultImg" alt="">
<c-button class="mt-4" @click="saveImage">保存</c-button>
<div v-if="showDefault" class="mt-4">
<div class="default-avator flex items-center justify-center rounde overflow-hidden mx-auto">
<img v-if="defaultImg" :src="defaultImg" alt="">
<div v-else class="text-gray-200">暂无头像</div>
</div>
<c-button v-if="defaultImg" class="mt-4" @click="saveImage">保存</c-button>
</div>
<!-- 裁剪图片 -->
<div v-if="showCropper">
<div class='cropper-wrapper' v-if="showCropper">
<div class="before"></div>
<!-- <div class="w-screnn h-screnn bg-center" > -->
<img :src="img" alt="" class="" ref="image">
<c-button class="mt-4" @click="saveCropper">保存</c-button>
<div class="fixed z-2001 bottom-0 left-0 w-full py-1.5 px-4">
<c-button @click="saveCropper">保存</c-button>
</div>
</div>
<!-- 拍照 -->
......@@ -41,6 +60,7 @@
<c-button class="mt-4" @click="saveImg">拍照</c-button>
</div>
</div>
</div>
</template>
<script lang="ts">
......@@ -74,10 +94,10 @@ export default Vue.extend({
showDefault: true,
img: '',
actions: [
{name: '拍照', action: 'photo'},
// {name: '拍照', action: 'photo'},
{name: '从手机相册选择', action: 'file'}
],
defaultImg: require('@/assets/qrcode.png')
defaultImg: ''
}
},
watch: {
......@@ -86,6 +106,28 @@ export default Vue.extend({
}
},
methods: {
fileHandler(e: InputEvent) {
const target = e.target as HTMLInputElement
if (target.files && target.files?.length !== 0) {
console.log(target.files)
const file = target.files[0]
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onloadend = () => {
this.img = reader.result as string
this.showCropper = true
this.showDefault = false
this.$nextTick(() => {
this.initCropper()
})
}
}
},
uploadFile() {
const fileInput = this.$refs.uploadFile as HTMLInputElement
fileInput.click()
this.showActionSheet = false
},
goBack() {
this.$emit('update:show', false)
},
......@@ -101,7 +143,7 @@ export default Vue.extend({
},
// 保存头像
saveImage() {
// this.showAvator = false
this.showCropper = false
this.$emit('update:img-src', this.defaultImg)
this.$emit('update:show', false)
},
......@@ -129,12 +171,13 @@ export default Vue.extend({
}
},
initCropper() {
this.myCropper.destroy && this.myCropper.destroy()
this.myCropper = new Cropper(this.$refs.image as HTMLImageElement, {
viewMode: 1,
dragMode: 'none',
initialAspectRatio: 1,
aspectRatio: 1,
preview: '.before',
// preview: '.before',
background: false,
autoCropArea: 0.6,
zoomOnWheel: false,
......@@ -195,7 +238,9 @@ export default Vue.extend({
this.defaultImg = imgData
this.showDefault = true
this.showCropper = false
this.myCropper.destroy()
},
// 摄像头读取头像
saveImg() {
this.readImg()
this.stream.getTracks().forEach(function(track: any){
......@@ -238,11 +283,14 @@ export default Vue.extend({
<style lang="less" scoped>
/deep/ .cropper-container {
width: 100% !important
// width: 100% !important;
}
.default-avator {
min-width: 60vw;
min-height: 60vw;
// border: 1px solid red;
}
.cropper-wrapper {
height: calc(100vh - 140px)
}
</style>
......@@ -19,6 +19,9 @@
>
主管
</div>
<div v-if="!member.isActivated" class="tag ml-1.5 text-xs text-text-secondary px-1 py-0.5 bg-mygray rounded">
未激活
</div>
</div>
</template>
......
......@@ -121,7 +121,7 @@ export default Vue.extend({
}
},
mounted() {
this.entId = JSON.parse(localStorage.getItem('ENT_INFO') || '{}').id
this.entId = JSON.parse(localStorage.getItem('USR_INFO') || '{}').entId
this.getEntInfo()
},
computed: {
......
......@@ -7,12 +7,13 @@
:loading="loading"
>
<!-- 顶部左侧插槽 -->
<!-- <div v-if="!fromPc" slot="left">
<app-icon
slot="left"
class-name="w-6.5 w-6.5"
icon-name="left-arrow-white"
@click="appNavBack()"
/>
</div> -->
<div class="relative w-full h-40 bg-color-primary">
<!-- 背景图 -->
<!-- <img class="w-82 absolute top-0 right-0" src="@/assets/images/header-bg.png" alt=""> -->
......@@ -23,14 +24,15 @@
<div class="top-28 px-4 w-full absolute top-10">
<div class="bg-white w-full rounded pt-8 pb-4 flex flex-col items-center shadow-bg">
<div class="font-medium">{{entName}}</div>
<!-- <div class="font-medium text-sm text-text-secondary mt-0.5">团队号 HZFZM0001</div> -->
<div class="font-medium text-sm text-text-secondary mt-0.5">服务器 {{info.oaServer}}</div>
<div class="font-medium text-sm text-text-secondary mt-0.5">团队号 {{info.entId}}</div>
<!-- <div class="h-20 overflow-auto text-xs text-text-secondary px-4 mt-3.5">
公司成立于2008年,2013 年启动区块链、智能合约的研发与创新,2014年申请区块链发明专利:钱包找回功能。已申请区块链相关专利500余项,其中已获得授权超80项,2019年据德温特专利家族统计,复杂美区块链发明专利排名位于全球第三,仅次于阿里巴巴和IBM。 公司总部位于杭州,并在南京、广州、海南设有分部。目前,公司员工100余人,其中80%左右为技术人员,吸引了一批甲骨文、阿里、华为程序员。公司与多家世界500强开展区块链项目合作,在票据、供应链金融、积分、仓单有区块链应用落地。 2018年11月,复杂美区块链Chain33在Github上开源,是较早落地运行的平行链架构系统,并基于模块设计可协作开发,大幅降低区块链的开发维护成本,实现快捷易用的跨链交易,有近100个平行链项目落地,去中心化交易、去中心化社交、去中心化电商、去中心化溯源存证、去中心化借贷等一系列应用。
</div> -->
</div>
</div>
</div>
<div class="px-4 pt-16 pb-28">
<div class="px-4 pt-24 pb-28">
<group-cell title="个人信息">
<c-cell
title="真实姓名"
......@@ -62,6 +64,12 @@
>
<div slot="content" class="text-text-primary">{{info.phone}}</div>
</c-cell>
<c-cell
title="短号"
title-class="text-sm text-text-secondary"
>
<div slot="content" class="text-text-primary">{{info.shortPhone}}</div>
</c-cell>
</group-cell>
<!-- 底部操作 -->
<div class="pt-1 pb-3 px-4 bg-common-bg w-screen fixed bottom-0 left-0 z-30">
......@@ -77,7 +85,11 @@
import Vue from 'vue'
import {formatDate} from '@/util/FormatDate'
import {AcceptJoinDTO} from '@/service/moudles/service.dto'
import { appNavBack, getSign, goBack, refreshCompanyState } from '@/util/Bridge'
import { appNavBack, getSign, close, refreshCompanyState } from '@/util/Bridge'
interface QueryInfo extends AcceptJoinDTO {
sig?: string
}
export default Vue.extend({
name: 'JoinTeam',
......@@ -90,7 +102,7 @@ export default Vue.extend({
'c-cell': () => import('@/components/common/c-cell.vue')
},
data() {
const info:AcceptJoinDTO = {
const info: QueryInfo = {
expiration: 0,
inviterId: '',
name: '',
......@@ -107,12 +119,19 @@ export default Vue.extend({
info,
departName: '',
entName: '',
loading: false
loading: false,
fromPc: false
}
},
created() {
this.info = this.$route.query as unknown as AcceptJoinDTO
this.info = this.$route.query as unknown as QueryInfo
// this.entName = JSON.parse(localStorage.getItem('ENT_INFO') as string).name
const sig = this.info.sig
if (typeof this.info.sig !== 'undefined' && this.info.sig !== '') {
// 聊天pc进入
this.$global.sig = decodeURIComponent(sig as string)
this.fromPc = true
}
this.getDepInfo(this.info)
this.getEntInfo(this.info)
},
......@@ -120,9 +139,9 @@ export default Vue.extend({
appNavBack,
async submit() {
this.loading = true
const {depId,entId,expiration,hash,inviterId,joinTime,name,oaServer,phone,position} = this.info as AcceptJoinDTO
const {depId,entId,expiration,hash,inviterId,joinTime,name,oaServer,phone,position,shortPhone} = this.info as AcceptJoinDTO
let req = {
depId,entId,expiration: Number(expiration) ,hash,inviterId,joinTime: Number(joinTime),name,oaServer,phone,position
depId,entId,expiration: Number(expiration) ,hash,inviterId,joinTime: Number(joinTime),name,oaServer,phone,position,shortPhone
}
console.log(this.info);
this.$service.enterprise.acceptJoin(req)
......@@ -130,11 +149,15 @@ export default Vue.extend({
const {data} = res
this.loading = false
if (data.code === this.$global.success) {
if (this.fromPc) {
parent.location.reload()
return
}
this.$toast('加入成功')
this.$store.commit('acceptJoin', {})
// this.$router.replace('/team/team-frame')
await refreshCompanyState()
goBack()
close()
}else {
this.$toast(data.msg)
}
......@@ -151,7 +174,7 @@ export default Vue.extend({
if (data.code === this.$global.success) {
this.departName = data.data.name
}
})
}).catch(() => this.loading=false)
},
getEntInfo(item:AcceptJoinDTO) {
this.loading = true
......@@ -163,7 +186,7 @@ export default Vue.extend({
if (data.code === this.$global.success) {
this.entName = data.data.name
}
})
}).catch(() => this.loading=false)
}
}
})
......
......@@ -17,7 +17,7 @@
<app-icon
class-name="w-6.5 h-6.5"
icon-name="home"
@click="close"
@click="handleBack"
/>
</div>
<template slot="right">
......@@ -78,7 +78,7 @@
<script lang="ts">
import Vue from 'vue'
import { getUserInfo, close, openCompanyUserInfo } from '@/util/Bridge'
import { getUserInfo, close, goBack, openCompanyUserInfo } from '@/util/Bridge'
import { Department, Staff } from '@/Interface'
import { ActionSheet } from 'vant'
import { Role } from '@/service/moudles/service.dto'
......@@ -113,7 +113,6 @@ export default Vue.extend({
parentId: '',
entId: '',
ifContainChildDep: true,
enterpriseInfo: {},
currentDep,
// 是否显示check
checkedMemberId: [],
......@@ -127,18 +126,22 @@ export default Vue.extend({
}
},
async mounted() {
// const userInfoDev = {
// depId: '168398222891421697',
// entId: '168398222891421696',
// id: '1K7cApKbEU9h5WySPVLNgdSd67i2XkSuoS',
// joinTime: 1631090065,
// name: '徐丹',
// role: 0
// }
const userInfoDev = {
depId: '168398222891421697',
entId: '168398222891421696',
id: '1K7cApKbEU9h5WySPVLNgdSd67i2XkSuoS',
joinTime: 1631090065,
name: '徐丹',
role: 0
}
if (process.env.NODE_ENV === 'production') {
localStorage.setItem('USR_INFO', getUserInfo())
const usrInfo = process.env.NODE_ENV==='production' ? JSON.parse(getUserInfo() || "{}") : {}
} else {
localStorage.setItem('USR_INFO', JSON.stringify(userInfoDev))
}
const usrInfo = JSON.parse(localStorage.getItem('USR_INFO') as string)
this.role = usrInfo.role
this.entId = process.env.NODE_ENV==='production'?usrInfo.entId : '168398222891421696'
this.entId = usrInfo.entId
this.getEntInfo()
},
computed: {
......@@ -160,6 +163,9 @@ export default Vue.extend({
}
},
methods: {
handleBack() {
this.close()
},
handleAction(item: {name: string, action: string}) {
if (item.action === 'manage') {
this.$router.push('/team/team-management')
......@@ -167,6 +173,32 @@ export default Vue.extend({
}
if (item.action === 'edit') {
this.isEdit = true
return
}
if (item.action === 'quit') {
this.$dialog.confirm({
title: '提示',
message: '确定要退出当前团队吗?'
// confirmButtonText: '解散'
}).then(() => {
const entId = JSON.parse(localStorage.getItem('ENT_INFO') as string).id
const id = JSON.parse(localStorage.getItem('USR_INFO') as string).id
this.loading=true
this.$service.staff.resign({
entId,
id
}).then((res: any) => {
this.loading=false
const {data} = res
if (data.code === this.$global.success) {
this.close()
} else {
this.$toast(data.msg)
}
})
}).catch(() => {
console.log('取消解散')
})
}
},
confirmEdit() {
......@@ -187,6 +219,7 @@ export default Vue.extend({
},
// 返回原生页面
close,
goBack,
// 获取企业信息
getEntInfo() {
this.loading = true
......
<template>
<!-- 完善团队信息 -->
<main-page
:loading="loading"
left-arrow
@click-left="$router.go(-1)"
@click-left="$router.push('/team/team-management')"
>
<avator-editor
:show.sync="showEditor"
:img-src.sync="defaultImg"
/>
<div class="px-4 pt-14">
<div v-if="!showEditor" class="px-4 pt-14">
<c-cell
dot
title="团队头像"
......@@ -16,7 +17,7 @@
>
<template slot="right">
<div class="w-7 h-7 rounded overflow-hidden flex items-center justify-center">
<img class="max-w-full" :src="defaultImg" alt="">
<img v-if="defaultImg" class="max-w-full" :src="defaultImg" alt="">
</div>
</template>
</c-cell>
......@@ -38,7 +39,7 @@
label="团队描述"
placeholder="请输入团队描述"
/>
<c-button class="mt-4">保存</c-button>
<c-button class="mt-4" @click="save">保存</c-button>
</div>
</main-page>
</template>
......@@ -46,9 +47,10 @@
<script lang="ts">
import Vue from 'vue'
import {updateEnterpriseDTO} from '@/service/moudles/service.dto'
// import Cropper from "cropperjs"
// import "cropperjs/dist/cropper.css"
import {ActionSheet} from 'vant'
import axios from 'axios'
import { signAuth } from '@/util/Bridge'
import { EnterpriseInfo } from '@/store/store.dto'
Vue.use(ActionSheet)
......@@ -67,23 +69,99 @@ export default Vue.extend({
updateInfo: {} as updateEnterpriseDTO,
showActionSheet: false,
defaultImg: require('@/assets/qrcode.png'),
showEditor: false
showEditor: false,
loading: false,
entInfo: {} as EnterpriseInfo
}
},
mounted() {
// const service = new BaseService()
// service.useService
this.entInfo = {...JSON.parse(localStorage.getItem('ENT_INFO') as string)}
const {id, avatar, description, name} = this.entInfo
this.updateInfo = {
id,
avatar,
description,
name
}
this.defaultImg = avatar
},
methods: {
// onSelect(item: {name: string, action: string}) {
// if (item.action === 'photo') {
// this.showCamera = true
// this.showDefault = false
// // this.showVideo=true
// this.$nextTick(() => {
// this.openCamera()
// })
// }
// }
// base64 转 file
transferFile(base64Str: string, fileName: string) {
let arr = base64Str.split(','),
mime = (arr[0].match(/:(.*?);/) as any)[1], //base64解析出来的图片类型
bstr = atob(arr[1]) , //对base64串进行操作,去掉url头,并转换为byte atob为window内置方法
len = bstr.length,
ab = new ArrayBuffer(len), //将ASCII码小于0的转换为大于0
u8arr = new Uint8Array(ab) //
while (len--) {
u8arr[len] = bstr.charCodeAt(len)
}
// 创建新的 File 对象实例[utf-8内容,文件名称或者路径,[可选参数,type:文件中的内容mime类型]]
return new File([u8arr], fileName, {
type: mime
})
},
async getImgUrl() {
const imServer = JSON.parse(localStorage.getItem('ENT_INFO') as string).imServer
const token = process.env.NODE_ENV === 'production' ? signAuth() : "MOCK"
const file = this.transferFile(this.defaultImg, 'text')
const formData = new FormData()
formData.append('appId', 'dtalk')
formData.append('key', `oa/${this.entInfo.id}`)
formData.append('file', file)
return axios({
method: 'post',
url: `${imServer}/oss/upload`,
data: formData,
headers: {
'content-type': 'multipart/form-data',
'FZM-SIGNATURE': token
}
}).then((res: any) => {
return res.data.data
})
},
async save() {
const {description, name} = this.updateInfo
if (!description || !name || !this.defaultImg) {
this.$toast('请检查填写信息')
return
}
if (this.defaultImg.indexOf(';base64') > -1) {
const imgUrlObj = await this.getImgUrl()
this.updateInfo.avatar = imgUrlObj.url
} else {
this.updateInfo.avatar = this.defaultImg
}
this.loading = true
this.$service.enterprise.updateEnterprise(this.updateInfo)
.then((res: any) => {
this.loading = false
const {data} = res
if (data.code === this.$global.success) {
this.$toast('修改成功')
this.getEntInfo(this.updateInfo.id)
} else {
this.$toast(data.msg)
}
}).catch(() => this.loading=false)
},
getEntInfo(id: string) {
this.loading = true
this.$service.enterprise.getEnterpriseInfo({id})
.then((res: any) => {
const {data} = res
this.loading=false
if (data.code === this.$global.success) {
localStorage.setItem('ENT_INFO', JSON.stringify(data.data))
this.entInfo = data.data
this.defaultImg = data.data.avatar
}
})
}
}
})
</script>
......
......@@ -3,7 +3,7 @@
<main-page
left-arrow
:loading="loading"
@click-left="$router.replace('/team/team-frame')"
@click-left="goBack"
>
<!-- 右侧二维码图标 -->
<template slot="right">
......@@ -33,24 +33,35 @@
/>
<div class="px-4 pt-14">
<!-- 头部 -->
<div class="flex items-center pt-1 pb-5">
<div class="flex items-start pt-1 pb-5">
<div class="h-13 w-13 rounded overflow-hidden flex-shrink-0">
<div v-if="enterpriseInfo.avatar">
<img :src="enterpriseInfo.avatar" alt="">
</div>
<div v-else class="">
<app-icon
type="png"
:path="require('@/assets/icons/team-icon.png')"
class-name="h-13 w-13"
/>
</div>
</div>
<!-- 名称 -->
<div class="ml-4 flex-1 text-text-primary">
<div class="ml-4 flex-1 text-text-primary overflow-hidden">
<span class="break-all">
{{ enterpriseInfo.name }}
</span>
<!-- 团队号 -->
<!-- <div class="text-text-secondary text-sm font-medium mt-1.5">
团队号 ABCDE1234
</div> -->
<div class="text-text-secondary text-sm">
<div class="mt-1 truncate">团队号 {{enterpriseInfo.id}}</div>
<div class=""></div>
<div class="truncate">服务器 {{enterpriseInfo.oaServer}}</div>
<div class=""></div>
</div>
</div>
</div>
<c-cell dot title="团队架构" @click="$router.push('/team/team-frame')" />
<c-cell dot title="组织架构" @click="$router.push('/team/team-frame')" />
<c-cell dot title="添加成员" @click="$router.push('/team/add-member')" />
<c-cell dot title="添加部门" @click="$router.push('/team/add-department')" />
<div class="mt-4">
......@@ -70,6 +81,7 @@
<script lang="ts">
import { Role } from '@/service/moudles/service.dto'
import {LocalStoreEnt, Staff} from '@/Interface'
import {close, getUserInfo} from '@/util/Bridge'
import Vue from 'vue'
export default Vue.extend({
......@@ -81,6 +93,12 @@ export default Vue.extend({
'c-button': () => import('@/components/common/c-button.vue'),
'member-selector': () => import('@/views/team/components/member-selector.vue')
},
beforeRouteEnter(to, from, next) {
const path = from.path
next((vm: any) => {
vm.fromFrame = path === '/team/team-frame'
})
},
data() {
return {
enterpriseInfo: {} as LocalStoreEnt,
......@@ -89,20 +107,46 @@ export default Vue.extend({
showMemberSelector: false,
selectorTitle: '',
multiple: false,
selectedLeaderId: [] as string[]
selectedLeaderId: [] as string[],
fromFrame: true,
// 企业id,跟部门id
entId: ''
}
},
mounted() {
this.enterpriseInfo = JSON.parse(localStorage.getItem('ENT_INFO') as string)
this.getSub()
created() {
const userInfoDev = {
depId: '168398222891421697',
entId: '168398222891421696',
id: '1K7cApKbEU9h5WySPVLNgdSd67i2XkSuoS',
joinTime: 1631090065,
name: '徐丹',
role: 0
}
if (process.env.NODE_ENV === 'production') {
localStorage.setItem('USR_INFO', getUserInfo())
} else {
localStorage.setItem('USR_INFO', JSON.stringify(userInfoDev))
}
const usrInfo = JSON.parse(localStorage.getItem('USR_INFO') as string)
this.entId = usrInfo.entId
this.getEntInfo()
// this.enterpriseInfo = JSON.parse(localStorage.getItem('ENT_INFO') as string)
// this.getSub()
},
computed: {
isLeader() {
const userInfo = JSON.parse(localStorage.getItem("USR_INFO") as string)
return userInfo.role === Role.LEADER
return userInfo?.role === Role.LEADER
}
},
methods: {
goBack() {
if (this.fromFrame) {
this.$router.push('/team/team-frame')
} else {
close()
}
},
getSub() {
const {id, rootDepId} = this.enterpriseInfo
this.loading=true
......@@ -122,6 +166,22 @@ export default Vue.extend({
}
}).catch(() => this.loading=false)
},
getEntInfo() {
this.loading = true
this.$service.enterprise.getEnterpriseInfo({
id: this.entId
}).then((res: any) => {
const { data } = res
this.loading = false
if (data.code === this.$global.success) {
localStorage.setItem('ENT_INFO', JSON.stringify(data.data))
this.enterpriseInfo = data.data
this.getSub()
} else {
this.$toast(data.msg)
}
})
},
editTeamName() {
console.log('edit')
this.$router.push('/team/team-info')
......@@ -163,6 +223,8 @@ export default Vue.extend({
const {data} = res
if (data.code === this.$global.success) {
this.$toast('解散成功')
localStorage.removeItem('ENT_INFO')
close()
} else {
this.$toast(data.msg)
}
......
......@@ -41,19 +41,22 @@
<div class=" text-center text-gray-400 pb-8 pt-4">扫描二维码加入{{entName}}</div>
</div>
</div>
<div class="w-24 ml-auto mt-4">
<div class="w-24 mt-4 ml-auto">
<c-button @click="saveQrcode">保存</c-button>
</div>
<div class="mt-4 border text-sm text-text-secondary border border-border rounded break-all p-2">
{{copyText}}
</div>
<div class="w-24 ml-auto mt-4">
<div class="flex mt-4 items-center justify-between">
<div class="text-sm text-color-primary bg-color-primary-light px-6 py-2.5 rounded flex-shrink-0">仅适用于网页版打开</div>
<div class="w-24">
<c-button
id="copyBtn"
:data-clipboard-text="qrCodeText"
:data-clipboard-text="copyText"
data-clipboard-action="copy"
@click="copy">复制</c-button>
</div>
</div>
<c-button type="secondary" class="mt-4" @click="handleClickLeft">进入团队工作台</c-button>
</div>
</main-page>
......@@ -66,7 +69,6 @@ import { Image } from 'vant'
import { formatDate } from '@/util/FormatDate'
import VueQr from 'vue-qr'
import html2canvas from 'html2canvas'
import { CanvasRenderer } from 'html2canvas/dist/types/render/canvas/canvas-renderer'
import { Department } from '@/Interface'
interface JoinInfoType{
depId: string
......@@ -108,7 +110,6 @@ export default Vue.extend({
this.qrCodeText = JSON.stringify(this.joinInfo)
let url = window.location.origin + '/team/confirm-join'
this.qrCodeText = `${url}?${urloutput}`
console.log(this.qrCodeText);
this.dpr()
// this.drawCanvas()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment