个人档案修改

This commit is contained in:
asd
2020-10-16 19:12:57 +08:00
parent 9db63a6a1d
commit 41009afeec
6 changed files with 129 additions and 71 deletions

View File

@@ -2,11 +2,11 @@
<div class="archives">
<div class="user-info">
<div class="avatar">
<a-avatar :size="85" shape="circle" :src="userinfo.head">
<a-avatar :size="85" shape="circle" :src="userinfo.img">
<template v-slot:icon><UserOutlined /></template>
</a-avatar>
<div class="user-name">
<div class="value">{{ userinfo.username }}</div>
<div class="value">{{ userinfo.name }}</div>
<div class="update-btn" @click="updateUserName">修改</div>
</div>
</div>
@@ -251,11 +251,11 @@
</div>
<div class="form-item">
<label class="label">新密码</label>
<a-input-password size="small" :visibilityToggle="false" v-model:value="passwordForm.new" />
<a-input-password size="small" :visibilityToggle="false" v-model:value="passwordForm.password" />
</div>
<div class="form-item">
<label class="label">确认新密码</label>
<a-input-password size="small" :visibilityToggle="false" v-model:value="passwordForm.confirm" />
<a-input-password size="small" :visibilityToggle="false" v-model:value="passwordForm.topassword" />
</div>
</div>
<div @click="updateUserPassword" class="confirm-btn">修改密码</div>
@@ -276,7 +276,8 @@ import { uploadflie } from "@/utils/vod"
import store from '@/store';
import smile from "@/static/images/smile.png"
import smilet from "@/static/images/smilet.png"
import { getarchives, getlanguages, putmember } from "@/api/index"
import { editpassword, getarchives, getlanguages, putmember } from "@/api/index"
import { message } from 'ant-design-vue';
export default defineComponent({
name: "Archives",
@@ -294,10 +295,12 @@ export default defineComponent({
lang: '请选择',
proficiency: 0,
}];
const userinfo = computed(() => store.state.userinfo)
const userinfo = computed(() => {return store.state.userinfo})
// 表单数据
const formData = reactive(userinfo);
const formData = ref(toRaw(userinfo.value));
watch(userinfo,() => {
formData.value = toRaw(userinfo.value);
})
const modalNode = () => document.getElementsByClassName('modal-container')[0]
const chiveslist = ref<unknown>([[],[]]);
@@ -332,6 +335,8 @@ export default defineComponent({
*/
function hidePhoneModal(): void {
verificationCode.value = '';
isSecondStep.value=false
console.log("close")
}
/**
* 显示修改手机号对话框
@@ -390,21 +395,21 @@ export default defineComponent({
const updatePasswordVisible: Ref<boolean> = ref(false);
interface PassWord {
original?: string;
new?: string;
confirm?: string;
password?: string;
topassword?: string;
}
const passwordForm: PassWord = reactive({
original: '',
new: '',
confirm: '',
password: '',
topassword: '',
})
/**
* 密码对话框清空数据
*/
function hidePasswordModal(): void {
passwordForm.original = '';
passwordForm.new = '';
passwordForm.confirm = '';
passwordForm.password = '';
passwordForm.topassword = '';
}
/**
* 显示修改密码对话框
@@ -420,22 +425,29 @@ export default defineComponent({
* @return { void }
*/
function updateUserPassword(): void {
if(passwordForm.new === passwordForm.confirm) {
if(passwordForm.original === '') {
console.log(passwordForm.new);
console.log(toRaw(passwordForm))
if(toRaw(passwordForm).password === toRaw(passwordForm).topassword) {
if(toRaw(passwordForm).original != '') {
// console.log(toRaw(passwordForm).password);
editpassword(toRaw(passwordForm))
togglePasswordModal(false);
}else{
message.error("原密码不能为空")
}
}else{
message.error("两次密码输入不一致")
}
}
/**
* 提交表单
* @return { void }
*/
function submitInfo (): void {
console.log(toRaw(formData.value));
putmember(toRaw(formData.value)).then((res) => {
console.log(res)
})
async function submitInfo (): Promise<void> {
// console.log(toRaw(formData.value));
putmember(toRaw(formData.value))
// putmember(toRaw(formData.value)).then((res) => {
// console.log(res)
// })
}

View File

@@ -54,7 +54,7 @@
</div>
</div>
<div class="pages">
<a-pagination v-model:current="page" :total="teacherlikedlist.total" :showLessItems="true" />
<a-pagination v-model:current="page" :total="teacherlikedlist.total" :showLessItems="true" @change="pagechange"/>
</div>
</div>
</template>
@@ -162,7 +162,7 @@
</style>
<script lang="ts">
import { getteacherliked } from '@/api';
import { defineComponent, onMounted, ref } from "vue";
import { defineComponent, onMounted, ref, toRaw } from "vue";
export default defineComponent({
name: "Subscriber",
components: {},
@@ -181,6 +181,9 @@ export default defineComponent({
async function search(e:any){
teacherlikedlist.value=await getteacherliked(e)
}
async function pagechange(){
teacherlikedlist.value=await getteacherliked(toRaw(condition.value))
}
return {
page,

View File

@@ -17,12 +17,12 @@
</div>
<div class="sel">
<img src="@/static/images/sousuo.png" alt="" class="icon" />
<input type="text" />
<input type="text" placeholder="请输入想要搜索的直播标题" @keyup.enter="sel()" v-model="input"/>
</div>
</div>
<div class="list" v-if="tabindex == 4">
<VideoItem
v-for="(i, j) in videolist"
v-for="(i, j) in videolist.data"
:key="j"
:videoid="i.videoid"
:img="i.img"
@@ -39,7 +39,7 @@
<div class="list" v-if="tabindex == 0">
<VideoItem
v-for="(i, j) in videolist"
v-for="(i, j) in videolist.data"
:key="j"
:img="i.img"
:title="i.title"
@@ -54,7 +54,7 @@
</div>
<div class="list" v-if="tabindex == 1">
<VideoItem
v-for="(i, j) in videolist"
v-for="(i, j) in videolist.data"
:key="j"
:img="i.img"
:title="i.title"
@@ -69,7 +69,7 @@
</div>
<div class="list" v-if="tabindex == 2">
<VideoItem
v-for="(i, j) in videolist"
v-for="(i, j) in videolist.data"
:key="j"
:img="i.img"
:title="i.title"
@@ -83,7 +83,7 @@
></VideoItem>
</div>
<div class="pages">
<a-pagination v-model:current="page" :total="500" :showLessItems="true" />
<a-pagination v-model:current="page" :total="50" :showLessItems="true" @change="pagechange" />
</div>
</div>
</template>
@@ -215,9 +215,9 @@ export default defineComponent({
statusname: string;
}
const videolist = ref<Array<VideoList>>();
const videolist = ref({})
// const newvideolist = ref<Array<VideoList>>();
const input = ref("")
onMounted(async () => {
@@ -230,11 +230,21 @@ export default defineComponent({
tabindex.value = e;
// console.log(videolist)
}
async function sel(){
console.log(input.value);
videolist.value = await getvideolist({title: input.value,page:page.value});
}
async function pagechange() {
videolist.value = await getvideolist({title: input.value,page:page.value});
}
return {
page,
tabindex,
tabchange,
videolist
videolist,
sel,
input,
pagechange
};
},
});