diff --git a/src/router/index.js b/src/router/index.js index 295c2d6..0e27058 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -159,6 +159,11 @@ let router = new Router({ component: () => import('../views/Login.vue'), meta: { title: '登录' } }, + { + path: '/join', + component: () => import('../views/join'), + // meta: { title: '个人中心' } + }, { path: '*', redirect: '/404' @@ -170,7 +175,7 @@ router.beforeEach(function(to, from, next) { // 根据路由元信息设置文档标题 window.document.title = to.meta.title || '中台'; //使用钩子函数对路由进行权限跳转 - if (!sessionStorage.getItem('token') && to.path !== '/login') { + if (!sessionStorage.getItem('token') && to.path !== '/login' && to.path !== '/join') { next('/login'); } else { next(); diff --git a/src/setting.js b/src/setting.js index 1f122c1..4a9750d 100644 --- a/src/setting.js +++ b/src/setting.js @@ -9,8 +9,8 @@ let jumpPath = `${location.origin}/judgmentPoint` let host = `${location.origin}:9000/` if (isDev) { jumpPath = "http://192.168.31.125:8087/"; // 本地调试-需要启动本地判分点系统 - // host = 'http://39.108.250.202:9000/' - host = 'http://192.168.31.151:9000/'// 榕 + host = 'http://39.108.250.202:9000/' + // host = 'http://192.168.31.151:9000/'// 榕 // host = 'http://192.168.31.137:9000/'// 赓 } else if (isPro) { jumpPath = "http://www.huorantech.cn/judgmentPoint/"; @@ -40,6 +40,8 @@ const Setting = { name: '中台' } ], + isDev, + isPro, // 是否使用动态路由 dynamicRoute: false, /** diff --git a/src/utils/api.js b/src/utils/api.js index 3164520..0da3504 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -266,4 +266,5 @@ export default { partnerAccountDetail: `${host1}nakadai/partnerAccount/partnerAccountDetail`, partnerAccountList: `${host1}nakadai/partnerAccount/partnerAccountList`, savePartnerAccount: `${host1}nakadai/partnerAccount/savePartnerAccount`, + generateInvitationCode: `${host1}nakadai/partnerAccount/generateInvitationCode`, }; \ No newline at end of file diff --git a/src/views/join/index.vue b/src/views/join/index.vue new file mode 100644 index 0000000..1c74824 --- /dev/null +++ b/src/views/join/index.vue @@ -0,0 +1,172 @@ + + + + + diff --git a/src/views/parner/staff.vue b/src/views/parner/staff.vue index 1e76c9d..aef3544 100644 --- a/src/views/parner/staff.vue +++ b/src/views/parner/staff.vue @@ -22,8 +22,10 @@ {{ node.label }} + @@ -102,11 +104,11 @@ -

链接/二维码失效日期:2022-11-11

+

链接/二维码失效时间:{{ expireTime }}

城市合伙人 邀请链接

加盟商、合作伙伴可以通过这个链接加入 城市合伙人计划

城市合伙人 邀请二维码

@@ -138,19 +140,6 @@ export default { } } } - const workNumberPass = (rule, value, callback) => { - if (value === '') { - callback(new Error('请输入工号')) - } else { - const pattern = /^[A-Za-z0-9]*$/ - if(pattern.test(value)){ - this.worknumberChange() - callback() - }else{ - callback(new Error('请输入正确工号格式')) - } - } - } const phonePass = (rule, value, callback) => { if (value) { const pattern = /^1[3456789]\d{9}$/ @@ -178,9 +167,9 @@ export default { } } return { + token: sessionStorage.getItem('token'), orgList: [], orgListDia: [], - studentType: 1, //类型:必填一个(1.所有员工 2.未加入班级员工) orgVisible: false, // 员工组织架对话框 typeForm: { id: '', @@ -197,17 +186,11 @@ export default { treeResolve: [], isDetail: false, keyWord: '', - roleList: [], form: { - accountId: '', userName: '', phone: '', - roleList: [], - uniqueIdentification: '', - workNumber: '', email: '', - account: '', - staffArchitectureId: [] + account: '' }, orgRules: { partnerClassificationName: [ @@ -221,12 +204,6 @@ export default { userName: [ { required: true, message: "请输入姓名", trigger: "blur" } ], - workNumber: [ - { required: true,validator: workNumberPass, trigger: 'blur' } - ], - roleList: [ - { required: true, message: "请选择授权角色", trigger: "change" } - ], phone: [ { validator: phonePass, trigger: 'blur' } ], @@ -241,12 +218,6 @@ export default { multipleSelection: [], parnerVisible: false, - accountReapeat: false, - originAccount: '', - workNumberReapeat: false, - originWorkNumber: '', - phoneRepeat: false, - emailRepeat: false, casProps: { multiple: true, checkStrictly: true, @@ -254,15 +225,9 @@ export default { value: 'id', isLeaf: 'leaf' }, - - importVisible: false, - uploadList: [], - uploadFaild: false, - exportCode: '', - headers: { - token: util.local.get(Setting.tokenKey) - }, - disableds:false, + link: '', + expireTime: '', + curTeamId: '', submiting: false // 新增编辑防抖标识 }; }, @@ -292,20 +257,6 @@ export default { } handleLeaf(list) this.orgList = list - this.handleOrgId(list) - this.getList() - }, - // 每个层级加上父级id的集合 - handleOrgId(list, ids) { - list.forEach(e => { - e.ids = ids ? [...ids, e.id] : [e.id] - e.children && this.handleOrgId(e.children, e.ids) - }) - }, - // 组织类别筛选回调 - changeType() { - this.$refs.orgTree.setCurrentKey(null) - this.initData() }, // 添加部门 addOrg(node, data) { @@ -321,7 +272,7 @@ export default { // 编辑部门 editOrg(node, data) { const list = JSON.parse(JSON.stringify(this.orgList)) - this.handleOrg(list, data.id, 0) + this.handleOrg(list) this.orgListDia = list this.typeForm = { id: data.id, @@ -333,25 +284,20 @@ export default { this.cascaderValue = ids }, // 处理更换部门的禁选 - handleOrg(list, id, disabled) { - list.forEach(e => { - // 如果是已经找到了要禁选的层级,则直接改变disabled,并递归 - if (disabled) { + handleOrg(list) { + for (const i in list) { + const e = list[i] + // 如果是团队,则禁选 + if (e.isTeam) { e.disabled = true - e.children && this.handleOrg(e.children, id, 1) } else { - if (e.id === id) { - e.disabled = true - e.children && this.handleOrg(e.children, id, 1) - } else { - e.children && this.handleOrg(e.children, id, 0) - } + this.handleOrg(e.children) } - }) + } }, // 删除部门 delOrg(node, data) { - this.$confirm("确定要删除吗?", "提示", { + this.$confirm(data.isTeam ? '确定删除城市合伙人' : '确定要删除吗?', "提示", { type: "warning" }).then(() => { this.$post(`${this.api.deleteParner}?id=${data.id}`).then(res => { @@ -387,11 +333,31 @@ export default { } }); }, + // 获得点击层级里的第一个城市合伙人id + getTeamId(list) { + for (const i in list) { + const e = list[i] + if (e.isTeam) { + this.curTeamId = e.id + break + } else { + this.getTeamId(e.children) + } + } + }, // 点击树节点查询列表数据 handleNodeClick(data) { + this.curTeamId = '' + if (data.isTeam) { + this.curTeamId = data.id + } else { + this.getTeamId(data.children) + } + if (this.curTeamId) { + this.$refs.orgTree.setCurrentKey(this.curTeamId) + this.getList() + } this.$refs.table.clearSelection() - this.studentType = null - this.getList() }, // 关闭组织新增编辑弹框 closeOrg() { @@ -402,13 +368,13 @@ export default { // 员工列表 getList() { this.$post(this.api.partnerAccountList, { - partnerClassificationId: this.$refs.orgTree.getCurrentKey() || '', + partnerClassificationId: this.curTeamId, keyWord: this.keyWord, pageNum: this.page, pageSize: this.pageSize }).then(res => { - this.listData = res.page.records - this.total = res.page.total + this.listData = res.page.records + this.total = res.page.total }).catch(err => {}) }, // 切换页码 @@ -426,11 +392,24 @@ export default { }, // 添加 add() { - this.parnerVisible = true + const { orgList } = this + if (orgList.length) { + const token = this.token + // 获取邀请码 + this.$post(`${this.api.generateInvitationCode}?token=${token}`).then(({ expireTime, invitationCode }) => { + const date = new Date(Date.now() + expireTime) + this.expireTime = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getMinutes()}` + this.parnerVisible = true + const cur = this.$refs.orgTree.getCurrentKey() + this.link = `${location.origin}${Setting.isDev || Setting.isPro ? '' : 'nakadai'}/#/join?token=${encodeURI(window.btoa(token))}&id=${cur ? cur: this.orgList[0].id}&invitationCode=${invitationCode}` + }).catch(res => {}) + } else { + util.errorMsg('请添加分类!') + } }, // 复制链接 copy(e) { - clipboard('测试地址', e, '文件路径已复制!') + clipboard(this.link, e, '链接已复制!') } } };