修改验证码

This commit is contained in:
余同学 2024-11-19 18:33:53 +08:00
parent 77663be0a1
commit a98bd21673
5 changed files with 312 additions and 179 deletions

View File

@ -178,4 +178,16 @@ export const mer_admin = {
changePassword: (data) => { changePassword: (data) => {
return $http.put(`/merchant-api/brand/admin_password`, data); return $http.put(`/merchant-api/brand/admin_password`, data);
}, },
//修改管理员
editAdmin: (data) => {
return $http.put(`/merchant-api/brand/change/administrator`, data);
},
//获取验证码
getCaptcha: (data) => {
return $http.request({
method: "get",
url: `/merchant-api/brand/sms_code`,
params: data,
});
},
}; };

View File

@ -35,7 +35,7 @@
</div> </div>
</div> </div>
<div class="info-item"> <div class="info-item">
品牌首页: {{ list.homepageStatus == 0 ? "禁用" : "启用" }} 品牌首页: {{ list.homepageStatus == 1 ? "启用" : "禁用" }}
</div> </div>
<div class="info-item">宣传语: {{ list.tagline }}</div> <div class="info-item">宣传语: {{ list.tagline }}</div>
<div class="info-item" style="display: flex"> <div class="info-item" style="display: flex">
@ -43,8 +43,8 @@
<div v-if="list.video" style="margin-left: 20px"> <div v-if="list.video" style="margin-left: 20px">
<video <video
id="videoPlayer" id="videoPlayer"
width="300px" width="200px"
height="200px" height="100px"
object-fit="fill" object-fit="fill"
muted="muted" muted="muted"
loop loop
@ -61,8 +61,8 @@
</div> </div>
<div class="info-content"> <div class="info-content">
<div class="info-item"> <div class="info-item">
管理员账号{{ list.administrator.substr(0, 3) }}****{{ 管理员账号{{ list.administrator?.substr(0, 3) }}****{{
list.administrator.substr(7) list.administrator?.substr(7)
}} }}
<span @click="passwordUpdate(true)" class="brandInfo-update">修改</span> <span @click="passwordUpdate(true)" class="brandInfo-update">修改</span>
</div> </div>
@ -88,20 +88,23 @@
<div class="info-content"> <div class="info-content">
<div class="info-item"> <div class="info-item">
品牌分销推广: 品牌分销推广:
<span @click="infoUpdate" class="brandInfo-update">配置</span> <span @click="getConfig" class="brandInfo-update">配置</span>
</div> </div>
</div> </div>
<!-- 编辑品牌信息 --> <!-- 编辑品牌信息 -->
<addOrUpdate @getList="getList" ref="addOrUpdate"></addOrUpdate> <addOrUpdate @getList="getList" ref="addOrUpdate"></addOrUpdate>
<!-- 修改密码 --> <!-- 修改密码 -->
<changePassword ref="changePassword"></changePassword> <changePassword ref="changePassword"></changePassword>
<!-- 配置 -->
<toConfigure @getList="getList" ref="toConfigure"></toConfigure>
</div> </div>
</template> </template>
<script> <script>
import toConfigure from "./popup/to-configure.vue";
import changePassword from "./popup/change-password.vue"; import changePassword from "./popup/change-password.vue";
import addOrUpdate from "./popup/add-or-update.vue"; import addOrUpdate from "./popup/add-or-update.vue";
export default { export default {
components: { addOrUpdate, changePassword }, components: { addOrUpdate, changePassword, toConfigure },
data() { data() {
return { return {
list: [], list: [],
@ -124,22 +127,12 @@ export default {
console.log("123"); console.log("123");
}, },
passwordUpdate(state) { passwordUpdate(state) {
console.log("123"); this.$refs.changePassword.init(state);
if (state) {
this.$nextTick(() => {
this.$refs.changePassword.toggle().add();
});
} else {
this.$nextTick(() => {
this.$refs.changePassword.toggle().update();
});
}
}, },
pause() { getConfig() {
console.log("暂停播放"); this.$nextTick(() => {
}, this.$refs.toConfigure.init(this.list);
ended() { });
console.log("播放结束");
}, },
}, },
}; };

View File

@ -143,7 +143,7 @@ export default {
<el-switch <el-switch
active-value="1" active-value="1"
inactive-value="0" inactive-value="0"
v-model={this.modalData.status} v-model={this.modalData.homepageStatus}
active-text="开启" active-text="开启"
inactive-text="禁用" inactive-text="禁用"
></el-switch> ></el-switch>

View File

@ -1,175 +1,158 @@
<template> <template>
<div> <el-dialog
<obj-modal :title="isAdd ? '修改管理员账号' : '修改密码'"
ref="modal" :visible.sync="dialogFormVisible"
labelWidth="150px"
:modalCols="modalCols"
:modalConfig="modalConfig"
:modalData="modalData"
:modalHandles="modalHandles"
> >
</obj-modal> <el-form ref="ruleForm" :model="form" :rules="rules">
<el-form-item
label="密码:"
prop="password"
:label-width="formLabelWidth"
>
<el-input
style="width: 240px"
type="password"
placeholder="请输入密码"
v-model="form.password"
autocomplete="off"
></el-input>
</el-form-item>
<el-form-item
label="管理员账号"
:label-width="formLabelWidth"
prop="mobile"
>
<el-input
placeholder="请输入账号"
style="width: 240px; margin-right: 20px"
v-model="form.mobile"
></el-input
><el-button @click="getCode" v-if="this.isCode" type="primary"
>获取验证码</el-button
>
<el-button v-else :disabled="totalTime < 60" type="primary">{{
this.content
}}</el-button>
</el-form-item>
<el-form-item prop="code" label="验证码:" :label-width="formLabelWidth">
<el-input
style="width: 240px"
placeholder="请输入验证码"
v-model="form.code"
></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="determine"> </el-button>
</div> </div>
</el-dialog>
</template> </template>
<script> <script>
import { debounce, cloneDeep } from "lodash";
import { Divider } from "element-ui";
export default { export default {
components: {},
data() { data() {
return { return {
dialogFormVisible: false,
isAdd: true, isAdd: true,
// formLabelWidth: "120px",
modalConfig: { form: {},
title: "修改密码",
show: false,
width: "60%",
},
modalData: {},
value1: "",
ProductData: {},
fileList: [],
isAdd: "",
totalTime: 60, totalTime: 60,
content: "获取验证码", content: "获取验证码",
isCode: true,
rules: {
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
mobile: [
{
required: true,
message: "请输入手机号",
trigger: "blur",
},
{
validator: function (rule, value, callback) {
if (/^1[3456789]\d{9}$/.test(value) == false) {
callback(new Error("请输入正确的手机号"));
} else {
callback();
}
},
trigger: "blur",
},
],
code: [
{
required: true,
min: 6,
max: 6,
message: "请输入正确的验证码",
trigger: "blur",
},
],
},
}; };
}, },
watch: {
addDialogVisible(newVal, oldVal) {
if (!newVal) {
this.$refs.ruleForm.resetFields();
}
},
},
methods: { methods: {
queryTableData(pageNo, pageSize) {}, init(row) {
toggle(e) { if (row) {
if (this.modalConfig.show == false) {
this.modalConfig.show = true;
} else {
this.modalConfig.show = false;
}
if (e) {
this.init(cloneDeep(e));
}
return {
add: () => {
this.$nextTick(() => {
this.modalData = {};
});
this.isAdd = true; this.isAdd = true;
}, this.form = {
update: () => { mobile: "",
this.isAdd = false; code: "",
}, password: "",
}; };
}
this.dialogFormVisible = true;
}, },
init(row) {}, getCode() {
console.log("发送验证码");
if (this.form.mobile && this.form.mobile.length == 11) {
this.$api.mer_admin
.getCaptcha({
mobile: this.form.mobile,
password: this.form.password,
})
.then((res) => {
console.log(res);
});
this.isCode = false;
this.countDown();
} else {
this.$message.error("请输入正确的手机号");
}
}, },
computed: { countDown() {
modalCols() {
if (this.isAdd) {
return [
{
label: "密码",
prop: "password",
type: "Input",
width: "300px",
rules: { required: true, message: "请输入密码" },
},
{
label: "管理员账号",
prop: "discoun",
type: "Input",
width: "300px",
rules: { required: true, message: "请输入管理员账号" },
type: "jsx",
render: () => {
let getCode = () => {
console.log("123"); console.log("123");
if (this.totalTime == 0) { if (this.totalTime == 0) {
this.content = "获取验证码"; this.content = "获取验证码";
this.totalTime = 60; this.totalTime = 60;
this.isCode = true;
return; return;
} }
this.content = this.totalTime + "秒后重新获取"; this.content = this.totalTime + "秒后重新获取";
this.totalTime--; this.totalTime--;
setTimeout(getCode, 1000); setTimeout(this.countDown, 1000);
};
return (
<div>
<div>
<el-input
style="width:200px;margin-right:20px;margin-bottom:20px"
placeholder="请输入管理员账号"
></el-input>
<el-button
disabled={this.totalTime < 60}
onclick={getCode}
type="primary"
>
{this.content}
</el-button>
</div>
<div>
<el-input
v-model={this.modalData.mobile}
style="width:300px"
placeholder="请输入验证码"
></el-input>
</div>
</div>
);
}, },
}, determine() {
]; this.$refs.ruleForm.validate((valid) => {
} else { console.log(valid);
return [
{ if (valid) {
label: "旧密码", this.$api.mer_admin.editAdmin(this.form).then((res) => {
prop: "discount",
type: "Input",
width: "300px",
rules: { required: true, message: "请输入旧密码" },
},
{
label: "新密码",
prop: "limitCount",
type: "Input",
width: "300px",
rules: { required: true, message: "请输入新密码" },
},
{
label: "确认新密码",
prop: "limitCot",
type: "Input",
width: "300px",
rules: { required: true, message: "请输入新密码" },
},
];
}
},
modalHandles() {
return [
{
label: "取消",
handle: () => {
this.toggle();
},
},
{
label: this.isAdd ? "保存" : "确认",
type: "primary",
loading: this.isLoading,
submit: true,
handle: () => {
if (this.isAdd) {
console.log(this.modalData);
} else {
this.$api.mer_admin.changePassword(this.modalData).then((res) => {
console.log(res); console.log(res);
}); });
} }
});
}, },
}, },
];
},
},
asyncComputed: {},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
</style> </style>

View File

@ -1,13 +1,158 @@
<template> <template>
<div>配置</div> <el-dialog title="品牌分销推广" :visible.sync="dialogFormVisible">
<el-form ref="ruleForm" :model="form" :rules="rules">
<div class="brandInfo">
<span class="pattern"></span>
推广营销工具
</div>
<div style="font-size: 14px; margin-bottom: 20px">
<i
class="el-icon-warning-outline"
style="width: 1em; height: 1em; margin-right: 4px"
></i>
分销推广功能开启后平台的分销商有机会优先选择本品牌进行推广推广成功分销商可获得佣金品牌方可根据实际情况对推广本品牌的分销商佣金比例进行调整品牌分销和商铺分销不叠加同享且优先按品牌分销佣金比例进行分销商分佣
</div>
<el-form-item label="状态:" :label-width="formLabelWidth">
<el-switch
:active-value="1"
:inactive-value="0"
v-model="form.status"
active-text="开启"
inactive-text="禁用"
></el-switch>
<div style="font-size: 14px">
请勿频繁切换已产生的关系&订单不受影响
</div>
</el-form-item>
<div class="brandInfo">
<span class="pattern"></span>
推广佣金配置
</div>
<div style="font-size: 14px; margin-bottom: 20px">
<i
class="el-icon-warning-outline"
style="width: 1em; height: 1em; margin-right: 4px"
></i>
配置推广成功分销商可获得的订单佣金奖励比例订单实付金额品牌分销订单无上级分佣
</div>
<el-form-item
label="订单佣金比例 (单位:%)"
:label-width="formLabelWidth"
prop="sharingRatio"
>
<el-select
:disabled="form.status != 1"
v-model="form.sharingRatio"
filterable
placeholder="请选择"
style="width: 240px"
>
<el-option
v-for="item in proportion"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
<div class="brandInfo">
<span class="pattern"></span>
品牌分销商招募令配置
</div>
<div style="font-size: 14px; margin-bottom: 20px">
<i
class="el-icon-warning-outline"
style="width: 1em; height: 1em; margin-right: 4px"
></i>
此配置将展示在店铺页吸引用户申请分销商并为店铺进行宣传推广长度限制在100字内
</div>
<el-form-item
prop="promotionWords"
label="推广文案:"
:label-width="formLabelWidth"
>
<el-input
:disabled="form.status != 1"
style="width: 80%"
type="textarea"
:rows="5"
placeholder="请输入内容"
maxlength="100"
show-word-limit
v-model="form.promotionWords"
>
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="determine"> </el-button>
</div>
</el-dialog>
</template> </template>
<script> <script>
export default { export default {
data() {
return {
dialogFormVisible: false,
formLabelWidth: "200px",
form: {},
proportion: [],
rules: {
sharingRatio: [
{ required: true, message: "请选择佣金比例", trigger: "change" },
],
promotionWords: [
{ required: true, message: "请输入推广文案", trigger: "blur" },
{ max: 100, message: "长度100个字符内", trigger: "blur" },
],
},
};
},
methods: {
init(row) {
this.form = JSON.parse(JSON.stringify(row));
console.log(this.form);
this.proportion = [];
for (let i = row.minSharingRate; i <= row.maxSharingRate; i++) {
this.proportion.push(i);
}
console.log(this.proportion);
} this.dialogFormVisible = true;
},
determine() {
if (this.form.status == 0) {
this.$api.mer_admin.editBrandInfo(this.form).then((res) => {
this.dialogFormVisible = false;
this.$emit("getList");
});
} else {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.$api.mer_admin.editBrandInfo(this.form).then((res) => {
this.dialogFormVisible = false;
this.$emit("getList");
});
}
});
}
},
},
};
</script> </script>
<style> <style lang="scss" scoped>
.brandInfo {
margin-bottom: 20px;
font-size: 18px;
font-weight: 700;
}
.pattern {
display: inline-block;
width: 8px;
height: 16px;
background: rgba(28, 146, 152, 1);
}
</style> </style>