dev_2022-05-11
yujialong 3 years ago
parent 52f9049880
commit 27adac2ec4
  1. 7
      src/router/index.js
  2. 6
      src/setting.js
  3. 1
      src/utils/api.js
  4. 172
      src/views/join/index.vue
  5. 137
      src/views/parner/staff.vue

@ -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();

@ -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,
/**

@ -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`,
};

@ -0,0 +1,172 @@
<template>
<div class="wrap">
<el-form ref="form" :model="form" :rules="rules">
<el-form-item prop="userName" label="姓名">
<el-input v-model.trim="form.userName" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item prop="account" label="账号">
<el-input v-model.trim="form.account" placeholder="请输入账号"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11"></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model.trim="form.email" placeholder="请输入邮箱"></el-input>
</el-form-item>
</el-form>
<div class="btn-wrap">
<el-button type="primary" @click="submit">确定</el-button>
</div>
</div>
</template>
<script>
import util from "@/libs/util"
import Setting from "@/setting"
export default {
data() {
const accountPass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入账号'))
} else {
const pattern = /^[A-Za-z0-9]*$/
if(pattern.test(value)){
this.accountChange()
callback()
}else{
callback(new Error('请输入正确账号格式'))
}
}
}
const phonePass = (rule, value, callback) => {
if (value) {
const pattern = /^1[3456789]\d{9}$/
if(pattern.test(value)){
this.phoneChange()
callback()
}else{
callback(new Error('请输入正确手机号格式'))
}
} else {
callback(new Error('请输入手机号'))
}
}
const emailPass = (rule, value, callback) => {
if (value) {
const pattern = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/
if(pattern.test(value)){
// this.emailChange()
callback()
}else{
callback(new Error('请输入正确邮箱格式'))
}
} else {
callback()
}
}
return {
token: window.atob(decodeURI(this.$route.query.token)),
form: {
partnerClassificationId: this.$route.query.id,
isTeam: 0,
account: '',
email: '',
phone: '',
userName: ''
},
rules: {
account: [
{ required: true, validator: accountPass, trigger: 'blur' }
],
userName: [
{ required: true, message: "请输入姓名", trigger: "blur" }
],
phone: [
{ required: true, validator: phonePass, trigger: 'blur' }
],
email: [
{ validator: emailPass, trigger: 'blur' }
]
},
submiting: false //
};
},
mounted() {
sessionStorage.setItem('token', this.token)
this.form.token = this.token
},
methods: {
//
accountChange() {
const form = this.form
const { account } = form
if (account === this.originAccount) {
this.accountReapeat = false
} else {
const { accountId } = form
this.$post(`${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=2&account=${account}${accountId ? `&accountId=${accountId}` : ''}`).then(res => {
this.accountReapeat = false
}).catch(err => {
this.accountReapeat = true
})
}
},
//
phoneChange() {
const form = this.form
const { phone } = form
if (phone) {
const { accountId } = form
this.$post(`${this.api.checkEmailOrPhone}?phone=${phone}${accountId ? `&accountId=${accountId}` : ''}`).then(res => {
this.phoneRepeat = false
}).catch(err => {
this.phoneRepeat = true
})
}
},
//
emailChange() {
const form = this.form
const { email } = form
if (email) {
const { accountId } = form
this.$post(`${this.api.checkEmailOrPhone}?email=${email}${accountId ? `&accountId=${accountId}` : ''}`).then(res => {
this.emailRepeat = false
}).catch(err => {
this.emailRepeat = true
})
}
},
//
submit() {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.submiting) return false
if (this.accountReapeat) return util.warningMsg("该账号已存在")
if (this.phoneRepeat) return util.warningMsg("该手机号已存在")
if (this.emailRepeat) return util.warningMsg("该邮箱已存在")
const { form } = this
form.uniqueIdentification = Date.now()
this.submiting = true
this.$post(this.api.savePartnerAccount, form).then(res => {
util.successMsg('加入成功!')
setTimeout(location.reload, 1000)
}).catch(res => {
this.submiting = false
})
}
})
},
}
};
</script>
<style lang="scss" scoped>
.wrap {
width: 500px;
margin: 40px auto;
}
.btn-wrap {
text-align: center;
}
</style>

@ -22,8 +22,10 @@
<span class="custom-tree-node" slot-scope="{ node, data }">
<span class="org-name">{{ node.label }}</span>
<span>
<!-- isTeam 0: 分类1: 团队 -->
<el-button
v-auth="'/system:后台账号:新增部门'"
v-if="!data.isTeam"
type="text"
icon="el-icon-circle-plus-outline"
@click="() => addOrg(node, data)">
@ -102,11 +104,11 @@
</div>
<el-dialog title="添加城市合伙人" :visible.sync="parnerVisible" width="580px" custom-class="add-dia" :close-on-click-modal="false">
<p class="tips">链接/二维码失效日期2022-11-11</p>
<p class="tips">链接/二维码失效时间{{ expireTime }}</p>
<p class="title">城市合伙人 <em>邀请链接</em></p>
<p class="des">加盟商合作伙伴可以通过这个链接加入 <em>城市合伙人计划</em></p>
<div class="link-wrap">
<div class="link">https://modao.cc/app/0023f7e0e933f5fc4f01a1a7c138dbfc47448580#screen=sl2soyh8c61vnmp</div>
<div class="link">{{ link }}</div>
<el-button type="primary" size="small" @click="copy">复制链接</el-button>
</div>
<p class="title">城市合伙人 <em>邀请二维码</em></p>
@ -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, '链接已复制!')
}
}
};

Loading…
Cancel
Save