Commit 8eb954cc authored by zhengke's avatar zhengke

账号编辑

parent ec89cfb0
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
/></el-icon> /></el-icon>
<template #dropdown> <template #dropdown>
<div class="MarketPopoverMore row wrap pointer"> <div class="MarketPopoverMore row wrap pointer">
<div class="column" v-for="(item, index) in moreList" @click="forward(item.Url)"> <div class="column" v-for="(item, index) in moreList" @click="forward(item)">
<div> <div>
<img :src="item.icon" width="34" height="34" /> <img :src="item.icon" width="34" height="34" />
</div> </div>
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
<!-- 创建设计 --> <!-- 创建设计 -->
<temDesign :addTem="addVisible" @close="addVisible=false"/> <temDesign :addTem="addVisible" @close="addVisible=false"/>
<OrderReview v-if="orderVisible" :show-person="isShowPerson" :default-type="isShowPerson?1:2" @close="()=>orderVisible=false"></OrderReview> <OrderReview v-if="orderVisible" :show-person="isShowPerson" :default-type="isShowPerson?1:2" @close="()=>orderVisible=false"></OrderReview>
<follow v-if="isPublicAccount" @close="isPublicAccount=false"></follow>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { ref } from "vue";
...@@ -112,6 +113,7 @@ import { EntMemberRight, ENT_USER_THEME, FreeMemberRight, PersonMemberRight, VIP ...@@ -112,6 +113,7 @@ import { EntMemberRight, ENT_USER_THEME, FreeMemberRight, PersonMemberRight, VIP
import OrderReview from '@/views/components/Order/Review.vue' import OrderReview from '@/views/components/Order/Review.vue'
import UserServices from "@/services/UserService"; import UserServices from "@/services/UserService";
import { ApiResult } from "@/configs/axios"; import { ApiResult } from "@/configs/axios";
import follow from "@/components/home/follow.vue";
const props = defineProps({ const props = defineProps({
size: { size: {
...@@ -136,14 +138,15 @@ const currentRoute = router.currentRoute.value ...@@ -136,14 +138,15 @@ const currentRoute = router.currentRoute.value
const parmas = ref({} as any) const parmas = ref({} as any)
parmas.value = currentRoute parmas.value = currentRoute
const isPublicAccount = ref(false)
const format = (percentage: number) => { const format = (percentage: number) => {
return percentage == 100 ? '' : `` return percentage == 100 ? '' : ``
} }
const moreList = [ const moreList = [
{ icon: require("@/assets/img/homeMore0.png"), Name: "添加到桌面" }, { icon: require("@/assets/img/homeMore0.png"), Name: "添加到桌面", Id:1, },
{ icon: require("@/assets/img/homeMore1.png"), Name: "关注公众号" }, { icon: require("@/assets/img/homeMore1.png"), Name: "关注公众号", Id:2, },
{ icon: require("@/assets/img/homeMore2.png"), Name: "我的订单", Url:'/u/order' }, { icon: require("@/assets/img/homeMore2.png"), Name: "我的订单", Url:'/u/order', Id:3, },
{ icon: require("@/assets/img/homeMore3.png"), Name: "意见反馈", Url:'https://work.weixin.qq.com/kfid/kfc378aada578ca8b0e' }, { icon: require("@/assets/img/homeMore3.png"), Name: "意见反馈", Url:'https://work.weixin.qq.com/kfid/kfc378aada578ca8b0e', Id:4, },
]; ];
const TravelDesign = ref({} as any) const TravelDesign = ref({} as any)
...@@ -155,10 +158,12 @@ const goDesNorm = () => { ...@@ -155,10 +158,12 @@ const goDesNorm = () => {
const forwardUserCenter = ()=>{ const forwardUserCenter = ()=>{
router.push('/u') router.push('/u')
} }
const forward = (url:string|undefined)=>{ const forward = (item:any)=>{
if(url){ if(item.Url){
if(url.includes('http://')||url.includes('https://')) openNewBlank(url) if(url.includes('http://')||url.includes('https://')) openNewBlank(url)
else router.push(url) else router.push(url)
}else{
// if(item.Id==2) isPublicAccount.value = true
} }
} }
const loginOutHandler = ()=>{ const loginOutHandler = ()=>{
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="followForm-bj"></div> <div class="followForm-bj"></div>
<div class="followBox row flex-center"> <div class="followBox row flex-center">
<div class="followBox-center"> <div class="followBox-center">
<img src="../../assets//img/follow.png" <img src="../../assets/img/follow.png"
style="height: 33.7vw;"/> style="height: 33.7vw;"/>
<span class="close-btn cursor-pointer column items-center flex-center" <span class="close-btn cursor-pointer column items-center flex-center"
@click="close"><IconClose size="0.83vw"></IconClose></span> @click="close"><IconClose size="0.83vw"></IconClose></span>
......
<template> <template>
<div class="wechatLoginForm text-center q-mt-lg" v-loading="qrLoading"> <div class="wechatLoginForm text-center q-mt-lg" v-loading="qrLoading">
<QRCode :value="qrCode" style="width: 159px;height: 159px;border: 1px solid #EBEBEB;" v-if="!qrLoading"></QRCode> <img :src="qrCode" style="width: 159px;height: 159px;border: 1px solid #EBEBEB;border-radius: 8px;" v-if="!qrLoading"></img>
<QRCode value="http://www.viitto.com" style="width: 159px;height: 159px;border: 1px solid #EBEBEB;" v-if="qrLoading"></QRCode> <QRCode value="http://www.viitto.com" style="width: 159px;height: 159px;border: 1px solid #EBEBEB;" v-if="qrLoading"></QRCode>
</div> </div>
</template> </template>
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
<div class="setting-item"> <div class="setting-item">
<div> <div>
<div class="text-dark">账号</div> <div class="text-dark">账号</div>
<div class="">+86 173****7817</div> <div class="">{{personalInfor.EmLoginMobile}}</div>
</div> </div>
<el-button>更换账号</el-button> <el-button v-if="personalInfor.IsDefaultAccount==1" :disabled="personalInfor.IsDefaultAccount!=1" @click="bindDatas(4)">修改账号</el-button>
</div> </div>
<div class="setting-item"> <div class="setting-item">
<div> <div>
...@@ -100,6 +100,11 @@ ...@@ -100,6 +100,11 @@
<el-input v-model="model.pwd" type="password" :placeholder="isPwd?'设置密码':'新密码'" autocomplete="new-password" show-password/> <el-input v-model="model.pwd" type="password" :placeholder="isPwd?'设置密码':'新密码'" autocomplete="new-password" show-password/>
</el-form-item> </el-form-item>
</template> </template>
<template v-if="dialogType==4">
<el-form-item label="" prop="account">
<el-input v-model="model.account" type="text" placeholder="编辑账号" />
</el-form-item>
</template>
<!-- <el-form-item label=""> <!-- <el-form-item label="">
<vue-hcaptcha ref="invisibleHcaptchaBind" sitekey="46e00e53-ddb2-4e7b-9c51-621534c2f1f5" @verify="verifyHandler"></vue-hcaptcha> <vue-hcaptcha ref="invisibleHcaptchaBind" sitekey="46e00e53-ddb2-4e7b-9c51-621534c2f1f5" @verify="verifyHandler"></vue-hcaptcha>
</el-form-item> --> </el-form-item> -->
...@@ -108,7 +113,9 @@ ...@@ -108,7 +113,9 @@
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="dialogVisible = false" class="ppt-button" size="large" >取消</el-button> <el-button @click="dialogVisible = false" class="ppt-button" size="large" >取消</el-button>
<el-button type="primary" @click="submitForm(bindFormRef)" class="ppt-button" size="large" :loading="loading"> <el-button type="primary" @click="submitForm(bindFormRef)" class="ppt-button" size="large" :loading="loading">
确定<template v-if="dialogType==1">{{Mailbox?'换绑':'绑定'}}</template><template v-else>{{isPwd?'设置':'更换'}}</template> 确定<template v-if="dialogType==1">{{Mailbox?'换绑':'绑定'}}</template>
<template v-if="dialogType==2">{{isPwd?'设置':'更换'}}</template>
<template v-if="dialogType==4">编辑</template>
</el-button> </el-button>
</div> </div>
</template> </template>
...@@ -116,7 +123,7 @@ ...@@ -116,7 +123,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ElMessage, FormInstance, FormRules } from 'element-plus'; import { ElMessage, FormInstance, FormRules,ElMessageBox } from 'element-plus';
import { useUserStore } from "@/store"; import { useUserStore } from "@/store";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { nextTick } from "vue"; import { nextTick } from "vue";
...@@ -139,7 +146,7 @@ const dialogType = ref(null as any) ...@@ -139,7 +146,7 @@ const dialogType = ref(null as any)
const dialogTitle = ref('') const dialogTitle = ref('')
const mailRegex = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$/ const mailRegex = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$/
const model = ref({ const model = ref({
//account:'', account:'',
oldpwd:'', oldpwd:'',
pwd:'', pwd:'',
mail:'', mail:'',
...@@ -155,6 +162,7 @@ const isSend = ref(false) ...@@ -155,6 +162,7 @@ const isSend = ref(false)
const isCountdown = ref(false) const isCountdown = ref(false)
const countValue = ref<number>(0) const countValue = ref<number>(0)
const loadingImg = ref(false) const loadingImg = ref(false)
const personalInfor = ref({})
const validateMail = (rule:any,value:any,callback:any)=>{ const validateMail = (rule:any,value:any,callback:any)=>{
if (value === '') { if (value === '') {
callback(new Error('请输入你的邮箱账户')) callback(new Error('请输入你的邮箱账户'))
...@@ -165,6 +173,10 @@ const validateMail = (rule:any,value:any,callback:any)=>{ ...@@ -165,6 +173,10 @@ const validateMail = (rule:any,value:any,callback:any)=>{
} }
} }
const rules = reactive<FormRules<RuleForm>>({ const rules = reactive<FormRules<RuleForm>>({
account: [
{ required: true, message: '请输入你的账号', trigger: 'blur' },
{ min: 6, message: '请输入正确的账号', trigger: 'blur' },
],
oldpwd: [ oldpwd: [
{ required: true, message: '请输入你的原密码', trigger: 'blur' }, { required: true, message: '请输入你的原密码', trigger: 'blur' },
{ min: 6,max:20, message: '密码的长度应为6-20位', trigger: 'blur' }, { min: 6,max:20, message: '密码的长度应为6-20位', trigger: 'blur' },
...@@ -234,6 +246,23 @@ const bindHandler = async () =>{ ...@@ -234,6 +246,23 @@ const bindHandler = async () =>{
if(dialogType.value==1) response = await UserServices.setBindUserEmail(model.value.mail,model.value.code) if(dialogType.value==1) response = await UserServices.setBindUserEmail(model.value.mail,model.value.code)
if(dialogType.value==2) response = await UserServices.setModifyUserPwd(model.value.pwd,model.value.oldpwd) if(dialogType.value==2) response = await UserServices.setModifyUserPwd(model.value.pwd,model.value.oldpwd)
if(dialogType.value==3) response = await UserServices.ModifyUserPhoto(userInfo.value.photo) if(dialogType.value==3) response = await UserServices.ModifyUserPhoto(userInfo.value.photo)
if(dialogType.value==4) {
ElMessageBox.confirm(
`确认编辑后将无法更改,请谨慎!`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(async () => {
response = await UserServices.SetMembers(personalInfor.value.id,1,model.value.account,'','')
getResponse(response)
}).catch(() => {})
}else getResponse(response)
}
const getResponse = async (response:any) => {
if(response){ if(response){
if(response.data.resultCode == ApiResult.SUCCESS){ if(response.data.resultCode == ApiResult.SUCCESS){
if(dialogType.value==1) { if(dialogType.value==1) {
...@@ -244,6 +273,10 @@ const bindHandler = async () =>{ ...@@ -244,6 +273,10 @@ const bindHandler = async () =>{
ElMessage.success({message:`${isPwd.value?'设置':'更换'}密码成功`}) ElMessage.success({message:`${isPwd.value?'设置':'更换'}密码成功`})
useUser.setUserLoginOut() useUser.setUserLoginOut()
} }
if(dialogType.value==4) {
ElMessage.success({message:`编辑账号成功`})
getInfo()
}
dialogVisible.value = false dialogVisible.value = false
dialogType.value = null dialogType.value = null
loadingImg.value = false loadingImg.value = false
...@@ -254,7 +287,6 @@ const bindHandler = async () =>{ ...@@ -254,7 +287,6 @@ const bindHandler = async () =>{
validateToken.value='' validateToken.value=''
loadingImg.value = false loadingImg.value = false
} }
} }
// 发送邮箱验证码 // 发送邮箱验证码
...@@ -279,6 +311,7 @@ const bindDatas = (type:Number) =>{ ...@@ -279,6 +311,7 @@ const bindDatas = (type:Number) =>{
dialogType.value = type dialogType.value = type
if(type==1) dialogTitle.value = Mailbox.value?'更换邮箱':'绑定邮箱' if(type==1) dialogTitle.value = Mailbox.value?'更换邮箱':'绑定邮箱'
if(type==2) dialogTitle.value = `${isPwd.value?'设置':'更换'}密码` if(type==2) dialogTitle.value = `${isPwd.value?'设置':'更换'}密码`
if(type==4) dialogTitle.value = `编辑账号`
dialogVisible.value = true dialogVisible.value = true
} }
...@@ -296,8 +329,9 @@ const getInfo = async () => { ...@@ -296,8 +329,9 @@ const getInfo = async () => {
const response = await UserServices.GetMemberUserInfo() const response = await UserServices.GetMemberUserInfo()
if(response.data.resultCode == ApiResult.SUCCESS){ if(response.data.resultCode == ApiResult.SUCCESS){
Mailbox.value = response.data.data.mail Mailbox.value = response.data.data.mail
console.log(response.data.data,'-------')
isPwd.value = response.data.data.Pwd isPwd.value = response.data.data.Pwd
personalInfor.value = response.data.data
model.value.account = response.data.data.EmLoginMobile
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment