Merge pull request '个人档案修改' (#52) from zj into master

Reviewed-on: http://git.luyuan.tk/luyuan/beelink/pulls/52
This commit is contained in:
asd 2020-10-16 19:14:15 +08:00
commit 0f3c81499d
6 changed files with 129 additions and 71 deletions

View File

@ -1,6 +1,6 @@
import router from '@/router'; import router from '@/router';
import store from '@/store'; import store from '@/store';
import { LiveList, LivelistInfo, LoginData, UserInfo, VideoInfo } from '@/types'; import { LiveList, LivelistInfo, LoginData, UserInfo } from '@/types';
import { saveValue } from '@/utils/common'; import { saveValue } from '@/utils/common';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { del, get, post, put, setToken } from './base' import { del, get, post, put, setToken } from './base'
@ -40,26 +40,7 @@ export async function userinfo(){
router.push("/") router.push("/")
return '未登录'; return '未登录';
} }
return { return user.data;
head: user.data.img,
username: user.data.name,
language: user.data.language,
currency: user.data.currency,
zoneStr: user.data.zoneStr,
memberid: user.data.memberid,
country: user.data.country,
live: user.data.live,
mtongue: user.data.mtongue,
tlanguage: user.data.tlanguage,
willsay: user.data.willsay,
interest: user.data.interest,
mobile: user.data.mobile,
email: user.data.email,
birthday: user.data.birthday,
video: user.data.video,
desc: user.data.desc,
money: user.data.money
}
} }
/** /**
@ -124,11 +105,16 @@ interface VideoList{
updated_at: string; updated_at: string;
statusname: string; statusname: string;
} }
interface VideoListInfo {
export async function getvideolist(): Promise<VideoList[]> { data: VideoList[];
const res = await get<Array<VideoList>>('video') code: number;
msg: string;
total: number;
}
export async function getvideolist(data?:any): Promise<VideoListInfo>{
const res = await get<Array<VideoList>>('video',data)
console.log(res) console.log(res)
return res.data return res
} }
/** /**
@ -376,7 +362,7 @@ export async function deleteaccount(data:any) {
/** /**
* *
* *
*/ */
interface TransactionInfo{ interface TransactionInfo{
accountid:number, accountid:number,
@ -397,6 +383,28 @@ export async function transactioninfo(data?: any){
return res.data return res.data
} }
/**
*
*/
export async function editpassword(data?:any) :Promise<void> {
console.log(data,111)
const newdata={
memberid:0,
password:"",
topassword:""
}
newdata.memberid=store.state.userinfo.memberid
newdata.password=data.password
newdata.topassword=data.topassword
console.log(newdata)
const res = await post<Liveaddrule>('resetPassword',newdata)
if(res.code==0){
message.success("修改成功")
}
}
/** /**
* *
* @param phone * @param phone
@ -465,8 +473,30 @@ export async function getlanguages(): Promise<Language[]>{
* *
*/ */
export async function putmember(data: unknown): Promise<Liveaddrule>{ // export async function putmember(data: unknown): Promise<Liveaddrule>{
return (await put<Liveaddrule>(`member/${store.state.userinfo.memberid}`, data) )
export async function putmember(data: any): Promise<any>{
console.log(data)
const newdata={
name:data.name,
mobile:data.mobile,
img:data.img,
country:data.countryValue,
live:data.live,
mtongue:data.mtongue,
email:data.email,
interest:JSON.stringify(data.interest),
willsay:JSON.stringify(data.willsayValue),
birthday:data.birthday,
zoneid:data.zoneid,
currency:data.currencyValue,
language:data.languageValue,
tlanguage:data.tlanguageValue,
video:data.video,
desc:data.desc
}
console.log(newdata)
return (await put<Liveaddrule>(`member/${store.state.userinfo.memberid}`, newdata) )
} }

View File

@ -2,7 +2,7 @@
<div class="menu"> <div class="menu">
<div class="user" style="overflow: hidden;"> <div class="user" style="overflow: hidden;">
<div class="user" :class="{'seltop': selnum == 0}"> <div class="user" :class="{'seltop': selnum == 0}">
<img :src="userinfo.head" alt="" class="head"> <img :src="userinfo.img" alt="" class="head">
<div class="name">{{userinfo.username}}</div> <div class="name">{{userinfo.username}}</div>
</div> </div>
</div> </div>

View File

@ -8,21 +8,25 @@ export default createStore({
api_token: "", api_token: "",
birthday: "", birthday: "",
country: "", country: "",
countryValue: "",
cover: "", cover: "",
created_at: "", created_at: "",
currency: 2, currency: "",
currencyValue: "",
deleted_at: null, deleted_at: null,
desc: "", desc: "",
email: "", email: "",
img: "", img: "",
interest: "", interest: "",
language: "中文", language: "中文",
languageValue: "zh",
live: "", live: "",
livetime: "", livetime: "",
login_type: 0, login_type: 0,
memberid: 0, memberid: 0,
mobile: "", mobile: "",
money: "", money: "",
moneyValue: 0,
msg: "", msg: "",
mtongue: "", mtongue: "",
name: "", name: "",
@ -30,18 +34,17 @@ export default createStore({
position: 0, position: 0,
publish: 0, publish: 0,
score: "", score: "",
status: true, status: false,
tlanguage: "", tlanguage: "中文",
type: 0, tlanguageValue: 1,
type: 1,
uid: "", uid: "",
updated_at: "", updated_at: "",
video: "", video: "",
willsay: [{ willsay: [{name: "请选择", level: 0}],
"name": "请选择", willsayValue: [{name: "0", level: 0}],
"level": 0
}],
zoneStr: "中途岛GMT-11:00", zoneStr: "中途岛GMT-11:00",
zoneid: 0 zoneid: 1,
}, },
islogin: false islogin: false
}, },

View File

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

View File

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

View File

@ -17,12 +17,12 @@
</div> </div>
<div class="sel"> <div class="sel">
<img src="@/static/images/sousuo.png" alt="" class="icon" /> <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> </div>
<div class="list" v-if="tabindex == 4"> <div class="list" v-if="tabindex == 4">
<VideoItem <VideoItem
v-for="(i, j) in videolist" v-for="(i, j) in videolist.data"
:key="j" :key="j"
:videoid="i.videoid" :videoid="i.videoid"
:img="i.img" :img="i.img"
@ -39,7 +39,7 @@
<div class="list" v-if="tabindex == 0"> <div class="list" v-if="tabindex == 0">
<VideoItem <VideoItem
v-for="(i, j) in videolist" v-for="(i, j) in videolist.data"
:key="j" :key="j"
:img="i.img" :img="i.img"
:title="i.title" :title="i.title"
@ -54,7 +54,7 @@
</div> </div>
<div class="list" v-if="tabindex == 1"> <div class="list" v-if="tabindex == 1">
<VideoItem <VideoItem
v-for="(i, j) in videolist" v-for="(i, j) in videolist.data"
:key="j" :key="j"
:img="i.img" :img="i.img"
:title="i.title" :title="i.title"
@ -69,7 +69,7 @@
</div> </div>
<div class="list" v-if="tabindex == 2"> <div class="list" v-if="tabindex == 2">
<VideoItem <VideoItem
v-for="(i, j) in videolist" v-for="(i, j) in videolist.data"
:key="j" :key="j"
:img="i.img" :img="i.img"
:title="i.title" :title="i.title"
@ -83,7 +83,7 @@
></VideoItem> ></VideoItem>
</div> </div>
<div class="pages"> <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>
</div> </div>
</template> </template>
@ -215,9 +215,9 @@ export default defineComponent({
statusname: string; statusname: string;
} }
const videolist = ref<Array<VideoList>>(); const videolist = ref({})
// const newvideolist = ref<Array<VideoList>>(); // const newvideolist = ref<Array<VideoList>>();
const input = ref("")
onMounted(async () => { onMounted(async () => {
@ -230,11 +230,21 @@ export default defineComponent({
tabindex.value = e; tabindex.value = e;
// console.log(videolist) // 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 { return {
page, page,
tabindex, tabindex,
tabchange, tabchange,
videolist videolist,
sel,
input,
pagechange
}; };
}, },
}); });