init
This commit is contained in:
101
src/views/xq/user/bind-invite-dialog.vue
Normal file
101
src/views/xq/user/bind-invite-dialog.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<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="用户编号" 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/xq/user'
|
||||
import { genderList } from '@/constant/statusMap'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ImageUpload,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
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>
|
||||
@@ -149,19 +149,23 @@
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<bind-invite-dialog v-if="bindInviteDialogVisible" ref="bindInviteDialog" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listUser, getUser, delUser, addUser, updateUser } from "@/api/xq/user";
|
||||
import { listUser, resetUserMobile, delUser, resetUserPassword, userUnBindInvite, getUser, userResetAvatar, userResetNickname } from "@/api/xq/user";
|
||||
import { genderList, userStatusList } from '@/constant/statusMap'
|
||||
import { resetUserMobile, resetUserPassword } from '@/api/cai/user'
|
||||
import BindInviteDialog from '@/views/xq/user/bind-invite-dialog.vue'
|
||||
|
||||
export default {
|
||||
name: "User",
|
||||
components: {BindInviteDialog},
|
||||
data() {
|
||||
return {
|
||||
userStatusList,genderList,
|
||||
bindInviteDialogVisible: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@@ -222,6 +226,32 @@ export default {
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
},
|
||||
handleUserResetAvatar(row){
|
||||
this.$modal.confirm('是否确认重置用户"' + row.nickname + '"的头像?').then(() => {
|
||||
this.loading = true;
|
||||
return userResetAvatar(row.id);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("重置成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleUserResetNickname(row){
|
||||
this.$modal.confirm('是否确认重置用户"' + row.nickname + '"的昵称?').then(() => {
|
||||
this.loading = true;
|
||||
return userResetNickname(row.id);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("重置成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 重置密码按钮操作 */
|
||||
handleResetPwd(row) {
|
||||
this.$prompt('请输入"' + row.usercode + '"的新密码', "提示", {
|
||||
@@ -256,6 +286,40 @@ export default {
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
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
|
||||
})
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
|
||||
Reference in New Issue
Block a user