init
This commit is contained in:
@@ -110,3 +110,23 @@ export function delUser(id) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解绑用户邀请人
|
||||||
|
export function userUnBindInvite(userId) {
|
||||||
|
return request({
|
||||||
|
url: '/cai/user/unBindInvite',
|
||||||
|
method: 'get',
|
||||||
|
params:{userId}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绑定用户邀请人
|
||||||
|
export function userBindInvite(userId,inviteUsercode) {
|
||||||
|
return request({
|
||||||
|
url: '/cai/user/bindInvite',
|
||||||
|
method: 'get',
|
||||||
|
params:{
|
||||||
|
userId,inviteUsercode
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
102
src/views/cai/user/bind-invite-dialog.vue
Normal file
102
src/views/cai/user/bind-invite-dialog.vue
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item :label="systemName+'号'" prop="usercode">
|
||||||
|
<el-autocomplete
|
||||||
|
class="inline-input"
|
||||||
|
v-model="form.usercode"
|
||||||
|
:fetch-suggestions="querySearch"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
@select="handleSelect"
|
||||||
|
></el-autocomplete>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="昵称" v-if="info.nickname">
|
||||||
|
{{ info.nickname }} 【{{ info.usercode }}】
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="性别" v-if="info.gender">
|
||||||
|
<cai-dict-tag :options="genderList" :value="info.gender" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="头像" v-if="info.avatar">
|
||||||
|
<image-avatar :src="info.avatar"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="open = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ImageUpload from '@/components/ImageUpload/index'
|
||||||
|
import { getUserByUsercode, listUserByUserCode, userBindInvite } from '@/api/cai/user'
|
||||||
|
import { genderList } from '@/constant/statusMap'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
ImageUpload,
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
systemName: process.env.VUE_APP_SYSTEM_HOME,
|
||||||
|
genderList,
|
||||||
|
open: false,
|
||||||
|
title: '',
|
||||||
|
form:{
|
||||||
|
id: undefined,
|
||||||
|
usercode: undefined,
|
||||||
|
},
|
||||||
|
info:{},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
usercode: [
|
||||||
|
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
buttonLoading: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init (id) {
|
||||||
|
this.open = true;
|
||||||
|
this.title = "设置用户邀请人"
|
||||||
|
this.info = {};
|
||||||
|
this.form.id = id
|
||||||
|
this.form.usercode = undefined
|
||||||
|
},
|
||||||
|
querySearch(querySearch,cb){
|
||||||
|
listUserByUserCode(querySearch).then(res => {
|
||||||
|
cb(res.data.map((terminal) => {
|
||||||
|
return {
|
||||||
|
value: terminal,
|
||||||
|
name: terminal,
|
||||||
|
};
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSelect(item){
|
||||||
|
getUserByUsercode(item.value).then(res => {
|
||||||
|
this.info = res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 表单提交
|
||||||
|
submitForm () {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.buttonLoading = true;
|
||||||
|
userBindInvite(this.form.id,this.form.usercode).then(data => {
|
||||||
|
this.$modal.msgSuccess("绑定成功");
|
||||||
|
this.buttonLoading = false;
|
||||||
|
this.open = false
|
||||||
|
this.$emit('refreshDataList')
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -80,6 +80,7 @@
|
|||||||
<cai-dict-tag :options="genderList" :value="scope.row.gender" />
|
<cai-dict-tag :options="genderList" :value="scope.row.gender" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="邀请人" align="center" prop="inviteId"/>
|
||||||
<el-table-column label="年龄" align="center" prop="age" />
|
<el-table-column label="年龄" align="center" prop="age" />
|
||||||
<el-table-column label="所在城市" align="center" prop="city" />
|
<el-table-column label="所在城市" align="center" prop="city" />
|
||||||
<el-table-column label="主播" align="center" prop="isAnchor">
|
<el-table-column label="主播" align="center" prop="isAnchor">
|
||||||
@@ -128,6 +129,8 @@
|
|||||||
<el-dropdown-item v-hasPermi="['cai:user:restPwd']" command="handleResetPwd" icon="el-icon-key">重置密码</el-dropdown-item>
|
<el-dropdown-item v-hasPermi="['cai:user:restPwd']" command="handleResetPwd" icon="el-icon-key">重置密码</el-dropdown-item>
|
||||||
<el-dropdown-item v-hasPermi="['cai:user:updateMobile']" command="handleResetMobile" icon="el-icon-phone">修改手机</el-dropdown-item>
|
<el-dropdown-item v-hasPermi="['cai:user:updateMobile']" command="handleResetMobile" icon="el-icon-phone">修改手机</el-dropdown-item>
|
||||||
<el-dropdown-item v-hasPermi="['cai:user:lock']" command="handleUserForbid" icon="el-icon-lock">封禁</el-dropdown-item>
|
<el-dropdown-item v-hasPermi="['cai:user:lock']" command="handleUserForbid" icon="el-icon-lock">封禁</el-dropdown-item>
|
||||||
|
<el-dropdown-item v-hasPermi="['cai:user:unBindInvite']" v-if="scope.row.inviteId" command="handleUserUnBindInvite" icon="el-icon-lock">解绑邀请</el-dropdown-item>
|
||||||
|
<el-dropdown-item v-hasPermi="['cai:user:bindInvite']" v-if="!scope.row.inviteId" command="handleUserBindInvite" icon="el-icon-lock">绑定邀请</el-dropdown-item>
|
||||||
<el-dropdown-item v-hasPermi="['cai:user:resetAvatar']" command="handleUserResetAvatar" icon="el-icon-lock">重置头像</el-dropdown-item>
|
<el-dropdown-item v-hasPermi="['cai:user:resetAvatar']" command="handleUserResetAvatar" icon="el-icon-lock">重置头像</el-dropdown-item>
|
||||||
<el-dropdown-item v-hasPermi="['cai:user:resetNickname']" command="handleUserResetNickname" icon="el-icon-lock">重置昵称</el-dropdown-item>
|
<el-dropdown-item v-hasPermi="['cai:user:resetNickname']" command="handleUserResetNickname" icon="el-icon-lock">重置昵称</el-dropdown-item>
|
||||||
<el-dropdown-item v-hasPermi="['cai:user:remove']" command="handleDelete" icon="el-icon-delete" >删除</el-dropdown-item>
|
<el-dropdown-item v-hasPermi="['cai:user:remove']" command="handleDelete" icon="el-icon-delete" >删除</el-dropdown-item>
|
||||||
@@ -148,28 +151,30 @@
|
|||||||
<user-add-update-dialog v-if="userAddUpdateDialogVisible" ref="userAddUpdateDialog" @refreshDataList="getList" />
|
<user-add-update-dialog v-if="userAddUpdateDialogVisible" ref="userAddUpdateDialog" @refreshDataList="getList" />
|
||||||
<user-info-dialog v-if="userInfoDialogVisible" ref="userInfoDialog" />
|
<user-info-dialog v-if="userInfoDialogVisible" ref="userInfoDialog" />
|
||||||
<user-forbid-dialog v-if="userForbidVisible" ref="userForbid" @refreshDataList="getList" />
|
<user-forbid-dialog v-if="userForbidVisible" ref="userForbid" @refreshDataList="getList" />
|
||||||
|
<bind-invite-dialog v-if="bindInviteDialogVisible" ref="bindInviteDialog" @refreshDataList="getList" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
delUser,
|
delUser,
|
||||||
getFullUser,
|
getFullUser, getUser,
|
||||||
listUser,
|
listUser,
|
||||||
resetUserMobile,
|
resetUserMobile,
|
||||||
resetUserPassword,
|
resetUserPassword,
|
||||||
userResetAvatar,
|
userResetAvatar,
|
||||||
userResetNickname
|
userResetNickname, userUnBindInvite
|
||||||
} from '@/api/cai/user'
|
} from '@/api/cai/user'
|
||||||
import {authList, genderList, isAnchorList, userStatusList, videoStatusList} from '@/constant/statusMap'
|
import {authList, genderList, isAnchorList, userStatusList, videoStatusList} from '@/constant/statusMap'
|
||||||
import UserAddUpdateDialog from '@/views/cai/user/user-add-update-dialog.vue'
|
import UserAddUpdateDialog from '@/views/cai/user/user-add-update-dialog.vue'
|
||||||
import UserInfoDialog from "@/views/cai/user/user-info-dialog";
|
import UserInfoDialog from "@/views/cai/user/user-info-dialog";
|
||||||
import UserForbidDialog from "@/views/cai/user/user-forbid-dialog";
|
import UserForbidDialog from "@/views/cai/user/user-forbid-dialog";
|
||||||
|
import BindInviteDialog from '@/views/cai/user/bind-invite-dialog.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "User",
|
name: "User",
|
||||||
components:{
|
components:{
|
||||||
UserForbidDialog,
|
UserForbidDialog,BindInviteDialog,
|
||||||
UserAddUpdateDialog,UserInfoDialog
|
UserAddUpdateDialog,UserInfoDialog
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -177,6 +182,7 @@ export default {
|
|||||||
genderList,authList,userStatusList,isAnchorList,videoStatusList,
|
genderList,authList,userStatusList,isAnchorList,videoStatusList,
|
||||||
systemName: process.env.VUE_APP_SYSTEM_HOME,
|
systemName: process.env.VUE_APP_SYSTEM_HOME,
|
||||||
userForbidVisible: false,
|
userForbidVisible: false,
|
||||||
|
bindInviteDialogVisible: false,
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
@@ -277,8 +283,10 @@ export default {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.getList()
|
this.getList()
|
||||||
this.msgSuccess('删除成功')
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
}).finally(()=>{
|
||||||
|
this.loading = false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -348,6 +356,40 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleUserBindInvite(row){
|
||||||
|
this.bindInviteDialogVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.bindInviteDialog.init(row.id)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleUserUnBindInvite(row){
|
||||||
|
getUser(row.inviteId).then(response => {
|
||||||
|
let inviteUser = response.data;
|
||||||
|
if(!inviteUser){
|
||||||
|
this.$modal.msgError("该用户不存在推荐人,无需解除")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let html = `<p>确认解除用户:<span style="color: cadetblue">` + row.nickname + `</span> 的推荐人?</p>`
|
||||||
|
+ `<p>推荐人蜜瓜号:<span style="color: red">` + inviteUser.usercode + `</span></p>`
|
||||||
|
+ `<p>推荐人昵称:<span style="color: red">` + inviteUser.nickname + `</span></p>`
|
||||||
|
this.$confirm(html, '警告', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = true
|
||||||
|
return userUnBindInvite(row.id)
|
||||||
|
}).then(() => {
|
||||||
|
this.$modal.msgSuccess("解除成功");
|
||||||
|
this.loading = false
|
||||||
|
this.getList()
|
||||||
|
}).catch(() => {
|
||||||
|
}).finally(()=>{
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
handleCommand(command, row) {
|
handleCommand(command, row) {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case "handleDelete":
|
case "handleDelete":
|
||||||
@@ -368,6 +410,12 @@ export default {
|
|||||||
case "handleUserResetNickname":
|
case "handleUserResetNickname":
|
||||||
this.handleUserResetNickname(row);
|
this.handleUserResetNickname(row);
|
||||||
break;
|
break;
|
||||||
|
case "handleUserBindInvite":
|
||||||
|
this.handleUserBindInvite(row);
|
||||||
|
break;
|
||||||
|
case "handleUserUnBindInvite":
|
||||||
|
this.handleUserUnBindInvite(row);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user