Merge branch 'master' of http://git.luyuan.tk/luyuan/beelink into xbx

This commit is contained in:
luyuan 2020-10-16 19:35:29 +08:00
commit ce3104abce
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
6 changed files with 129 additions and 71 deletions

View File

@ -1,6 +1,6 @@
import router from '@/router';
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 { message } from 'ant-design-vue';
import { del, get, post, put, setToken } from './base'
@ -40,26 +40,7 @@ export async function userinfo(){
router.push("/")
return '未登录';
}
return {
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
}
return user.data;
}
/**
@ -124,11 +105,16 @@ interface VideoList{
updated_at: string;
statusname: string;
}
export async function getvideolist(): Promise<VideoList[]> {
const res = await get<Array<VideoList>>('video')
interface VideoListInfo {
data: VideoList[];
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)
return res.data
return res
}
/**
@ -376,7 +362,7 @@ export async function deleteaccount(data:any) {
/**
*
*
*
*/
interface TransactionInfo{
accountid:number,
@ -397,6 +383,28 @@ export async function transactioninfo(data?: any){
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
@ -465,8 +473,30 @@ export async function getlanguages(): Promise<Language[]>{
*
*/
export async function putmember(data: unknown): Promise<Liveaddrule>{
return (await put<Liveaddrule>(`member/${store.state.userinfo.memberid}`, data) )
// export async function putmember(data: unknown): Promise<Liveaddrule>{
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="user" style="overflow: hidden;">
<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>
</div>

View File

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

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
};
},
});