xbx #60

Merged
theluyuan merged 9 commits from xbx into master 2020-10-20 17:09:35 +08:00
10 changed files with 2848 additions and 2629 deletions

View File

@ -4,14 +4,22 @@ import { AxiosRequestConfig, CustomSuccessData } from 'axios';
import { getValue } from '@/utils/common';
import { message } from 'ant-design-vue';
import router from '@/router';
import { MessageType } from 'ant-design-vue/types/message';
// 泛型接口
export interface Get {
<T>(url: string, params?: unknown, config?: AxiosRequestConfig): Promise<CustomSuccessData<T>>;
}
const login:MessageType[] = []
axios.interceptors.request.use((config)=>{
login.push(message.loading('加载中..', 0))
return config;
})
axios.interceptors.response.use((response)=>{
// console.log(response)
login[0]();
login.splice(0,1);
if(response.data.code == 1001){
router.push("/")
}

View File

@ -574,6 +574,9 @@ export async function getarchives(): Promise<[Countries[],Willsay[]]>{
return [(await get<Countries[]>("countries")).data, (await get<Willsay[]>("willsay")).data];
}
export async function getwillsay(): Promise<Willsay[]>{
return (await get<Willsay[]>("willsay")).data;
}
/**
*
@ -629,8 +632,9 @@ export async function putmember(data: any): Promise<any>{
desc:data.desc
}
console.log(newdata)
return (await put<Liveaddrule>(`member/${store.state.userinfo.memberid}`, newdata) )
const res = await put<Liveaddrule>(`member/${store.state.userinfo.memberid}`, newdata)
store.dispatch("setUserInfo");
return res;
}
@ -698,3 +702,51 @@ export async function cancellive(id: number, status: number){
return false;
}
}
/**
*
*/
export async function checksmscode(phone: string, smscode: string){
const res = await get("checkSmscode",{phone, smscode});
if(res.code == 0){
return true;
}else{
message.error(res.msg);
return false;
}
}
export async function register(data: any){
const res = await post<any>("register",{
mobile: data.phone,
code: data.quhao,
password: data.pass,
topassword: data.passtow,
name: data.name,
email: data.emil,
mtongue: data.muyu,
tlanguage: data.jiaoshou
})
if(res.code == 0){
message.success(res.msg)
if(!saveValue("token", res.data.api_token) && !saveValue("memberid", res.data.memberid) ){
message.error("存储错误, 请允许网页使用本地存储!")
return false;
}else{
setToken();
store.commit("login", true);
store.dispatch("setUserInfo");
// router.push("/mine/archives")
}
return true;
}else{
message.error(res.msg)
return false;
}
}

View File

@ -68,30 +68,36 @@ export function getweek(zhou?: number){
if(zhou != undefined){
now = now.day(now.day() + (zhou * 6));
}
const yue = now.month() + 1;
const yue = (now.month() + 1 < 10 ? '0' + (now.month() + 1) : (now.month() + 1));
const day = now.date() // 当前天
zhou = now.day(); // 当前周几
const year = now.year()
const startd = now.day(1).date();
const start = `${year}-${yue}-${startd}`
interface Date{
day: string;
list?: Array<any>;
}
const date: Array<Date> = [];
for(let i = 0; i < 7; i++){
console.log(i);
now = now.day(i + 1)
date[i] = {day: ""};
date[i].day = now.year() + "-" + (now.month() < 10 ? '0' + now.month() : now.month()) + "-" + (now.date() < 10 ? '0' + now.date() : now.date())
date[i].day = now.year() + "-" + (now.month() + 1 < 10 ? '0' + (now.month() + 1) : (now.month() + 1)) + "-" + (now.date() < 10 ? '0' + now.date() : now.date())
date[i].list = []
for(let j = 0;j < 24; j++){
date[i].list?.push({
start:"",
num:""
num:"",
title: "",
time:""
})
}
}
const end = `${now.year()}-${(now.month() + 1 < 10 ? '0' + (now.month() + 1) : (now.month() + 1))}-${now.date()}`
console.log(date)
return {date, year, yue, day, zhou}
return {date, year, yue, day, zhou, start, end}
}
@ -100,3 +106,23 @@ export function getDay(date: string){
console.log(now.date())
return now.date();
}
export function gethour(date: string){
const now = dayjs(date)
console.log(now.hour(), now.date(), now.minute())
return now.hour();
}
export function getminute(date: string){
const now = dayjs(date)
// console.log(now.hour(), now.date(), now.minute())
return now.minute();
}
export function gettime(date: string, num: number){
let now = dayjs(date)
const start = `${now.hour() > 9 ? now.hour() : '0' + now.hour()}:${now.minute() > 9 ? now.minute() : '0' + now.minute()}`
now = now.minute(now.minute() + num);
const end = `${now.hour() > 9 ? now.hour() : '0' + now.hour()}:${now.minute() > 9 ? now.minute() : '0' + now.minute()}`
return start + "-" + end;
}

View File

@ -1,25 +0,0 @@
<template>
<div class="home">
<!-- <img alt="Vue logo" src="../assets/logo.png"> -->
<HelloWorld msg="Welcome to Your Vue.js + TypeScript App"/>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src
import { getinfo } from "../api/index"
export default defineComponent({
name: 'Home',
components: {
HelloWorld,
},
setup(){
// ctx.axios.get("https://www.baidu.com")
getinfo().then((res)=>{
console.log(res)
})
}
});
</script>

View File

@ -10,7 +10,7 @@
<div v-if="stepnow == 1">
<div class="nosign">
已有账号
<span class="tosign"> 去登录 </span>
<span class="tosign" @click="navto('/')"> 去登录 </span>
</div>
<a-form :layout="formLayout">
@ -21,13 +21,15 @@
style="width: 50%"
v-model:value="phone.quhao"
>
<a-select-option value="86">
中国+0086
</a-select-option>
<a-select-option value="86"> 中国+0086 </a-select-option>
<a-select-option value="Jiangsu"> Jiangsu </a-select-option>
</a-select>
<div class="line"></div>
<a-input v-model:value="phone.phone" style="width: 50%" placeholder="请输入您的手机号" />
<a-input
v-model:value="phone.phone"
style="width: 50%"
placeholder="请输入您的手机号"
/>
</a-input-group>
</a-form-item>
<a-form-item label="验证码" class="form-item">
@ -36,7 +38,11 @@
点击获取验证码{{ time == 60 ? "" : "(" + time + ")" }}
</div>
<div class="line"></div>
<a-input v-model:value="phone.code" style="width: 50%" placeholder="请输入您的验证码" />
<a-input
v-model:value="phone.code"
style="width: 50%"
placeholder="请输入您的验证码"
/>
</a-input-group>
</a-form-item>
<div class="submit" @click="next(2)">下一步</div>
@ -57,7 +63,7 @@
<div v-if="stepnow == 2">
<div class="nosign">
已有账号
<span class="tosign"> 去登录 </span>
<span class="tosign" @click="navto('/')"> 去登录 </span>
</div>
<a-form :layout="formLayout">
<div class="signform">
@ -66,6 +72,7 @@
class="shuru"
placeholder="请输入您的密码"
type="password"
v-model:value="userinfo.pass"
/>
</a-form-item>
<a-form-item label="设置密码" class="form-item">
@ -73,23 +80,44 @@
class="shuru"
placeholder="请再次输入您的密码"
type="password"
v-model:value="userinfo.passtow"
/>
</a-form-item>
<a-form-item label="姓名" class="form-item">
<a-input class="shuru" placeholder="请输入您的姓名" />
<a-input
class="shuru"
placeholder="请输入您的姓名"
v-model:value="userinfo.name"
/>
</a-form-item>
<a-form-item label="邮箱" class="form-item">
<a-input class="shuru" placeholder="请输入您的邮箱" />
<a-input
class="shuru"
placeholder="请输入您的邮箱"
v-model:value="userinfo.emil"
/>
</a-form-item>
<a-form-item label="母语" class="form-item">
<a-input class="shuru" placeholder="请输入您的母语" />
<a-input
class="shuru"
placeholder="请输入您的母语"
v-model:value="userinfo.muyu"
/>
</a-form-item>
<a-form-item label="教授" class="form-item">
<a-select class="getcode" placeholder="请选择您的教授">
<a-select-option value="Zhejiang">
中国+0086
<a-select
v-model:value="userinfo.jiaoshou"
class="getcode"
style="color: #111"
placeholder="请选择您的教授"
>
<a-select-option
v-for="(item, index) in willsay"
:key="index"
:value="item.languageid"
>
{{ item.name }}
</a-select-option>
<a-select-option value="Jiangsu"> Jiangsu </a-select-option>
</a-select>
</a-form-item>
</div>
@ -102,7 +130,9 @@
<div v-if="stepnow == 3">
<div class="nosign">您已完成注册</div>
<img src="@/static/images/success.png" alt="" class="success" />
<div class="ale">恭喜您注册成功点击跳转到我的档案页面</div>
<div class="ale" @click="navto('/mine/archives')">
恭喜您注册成功点击跳转到我的档案页面
</div>
</div>
</div>
<div :class="stepnow != 2 ? 'right' : 'right right1'">
@ -136,9 +166,11 @@
</template>
<script lang="ts">
import { defineComponent, reactive, ref } from "vue";
import { defineComponent, reactive, ref, toRaw } from "vue";
import NavTop from "@/components/NavTop.vue";
import { sendsms } from '@/api';
import { checksmscode, getwillsay, register, sendsms } from "@/api";
import { message } from "ant-design-vue";
import router from "@/router";
export default defineComponent({
name: "Sign",
@ -149,12 +181,23 @@ export default defineComponent({
wrapperCol: 14,
};
const time = ref(60); //
const phone = reactive({
quhao:"86",
const phone = ref({
quhao: "86",
phone: "",
code: ""
code: "",
});
const userinfo = ref({
pass: "",
passtow: "",
name: "",
emil: "",
muyu: "",
jiaoshou: "",
});
const willsay = ref<any>();
getwillsay().then((res) => {
willsay.value = res;
});
/**
* @param
* 点击获取验证码 触发60S倒计时
@ -165,8 +208,12 @@ export default defineComponent({
if (lock) {
return;
}
if (phone.value.phone == "") {
message.error("手机号不能为空");
return;
}
lock = true;
sendsms(phone.quhao + phone.phone, 0);
sendsms(phone.value.quhao + phone.value.phone, 0);
const timestep = setInterval(() => {
console.log(phone);
time.value = time.value - 1;
@ -190,13 +237,80 @@ export default defineComponent({
const stepnow = ref(1); //
function yanzheng() {
if (userinfo.value.pass == "") {
message.error("密码不能为空");
return false;
}
if (userinfo.value.passtow == "") {
message.error("密码不能为空");
return false;
}
if (userinfo.value.name == "") {
message.error("姓名不能为空");
return false;
}
if (userinfo.value.emil == "") {
message.error("邮箱不能为空");
return false;
}
if (userinfo.value.muyu == "") {
message.error("母语不能为空");
return false;
}
if (userinfo.value.jiaoshou == "") {
message.error("请选择教授语言");
return false;
}
return true;
}
/**
*@param e 跳到哪一步
* 步骤条跳到某一步
*/
const next: (e: number) => void = (e: number) => {
async function next(e: number) {
if (stepnow.value > e) {
stepnow.value = e;
};
return;
}
switch (e) {
case 2: {
console.log(e);
if (phone.value.phone == "") {
message.error("手机号不能为空");
return;
} else if (phone.value.code == "") {
message.error("验证码不能为空");
return;
}
const res = await checksmscode(
phone.value.quhao + phone.value.phone,
phone.value.code
);
if (res) {
stepnow.value = e;
}
break;
}
case 3: {
console.log(userinfo.value);
const yz = yanzheng();
if (yz) {
const res = await register({
...toRaw(phone.value),
...toRaw(userinfo.value),
});
if (res) {
stepnow.value = e;
}
}
}
}
}
function navto(url: string) {
router.push(url);
}
return {
formLayout,
getcode,
@ -205,7 +319,10 @@ export default defineComponent({
ifagree,
stepnow,
next,
phone
phone,
userinfo,
willsay,
navto,
};
},
});

View File

@ -203,20 +203,20 @@
</template>
<!-- 换绑手机号第一步 -->
<div class="public-class phone-container" v-if="!isSecondStep">
<div class="title">完成以下操作修改账号密码</div>
<div class="title sub-title">请输入{{ formData.phone }}收到的验证短信码</div>
<div class="title">请完成以下认证</div>
<div class="title sub-title">请输入{{ userinfo.mobile }}收到的验证短信码</div>
<div class="form-box">
<div class="form-item">
<label class="label">手机验证码</label>
<a-input size="small" v-model:value="verificationCode" />
<div @click="sendVerificationCode" class="confirm-btn">获取验证码<span v-if="remainTime>0">{{ remainTime }}s</span></div>
<div @click="sendVerificationCode(userinfo.mobile)" class="confirm-btn">获取验证码<span v-if="remainTime>0">{{ remainTime }}s</span></div>
</div>
</div>
<div @click="nextPhoneStep" class="confirm-btn">下一步</div>
</div>
<!-- 换绑手机号第二步 -->
<div class="public-class phone-container second-step" v-else>
<div class="title">完成以下操作修改账号密</div>
<div class="title">完成以下操作绑定新号</div>
<div class="form-box">
<div class="form-item">
<label class="label">手机号</label>
@ -277,7 +277,7 @@ import { uploadflie } from "@/utils/vod"
import store from '@/store';
import smile from "@/static/images/smile.png"
import smilet from "@/static/images/smilet.png"
import { editpassword, getarchives, getlanguages, putmember } from "@/api/index"
import { editpassword, getarchives, getlanguages, putmember, sendsms } from "@/api/index"
import { message } from 'ant-design-vue';
export default defineComponent({
@ -360,16 +360,20 @@ export default defineComponent({
function computedVerificationCode(): void {
remainTime.value = 60;
const timer = setInterval(() => {
if(remainTime.value > 0) remainTime.value --;
else clearInterval(timer);
if(remainTime.value > 0) {
remainTime.value --;
} else {
clearInterval(timer);
}
}, 1000)
}
/**
* 发送验证码
*/
function sendVerificationCode(): void {
function sendVerificationCode(phone: string): void {
if(remainTime.value === 0) {
computedVerificationCode();
sendsms(phone, 0)
}
}
//

View File

@ -16,34 +16,34 @@
<div class="info">
<div class="infoitem">
<span class="label">姓名:</span>
<span>{{i.name}}</span>
<span class="one-line-hide">{{i.name}}</span>
</div>
<div class="infoitem">
<span class="label">所在国家:</span>
<span>{{i.live}}</span>
<span class="one-line-hide">{{i.live}}</span>
</div>
<div class="infoitem">
<span class="label">年龄:</span>
<span>{{i.age}}</span>
<span class="one-line-hide">{{i.age}}</span>
</div>
</div>
<div class="info">
<div class="infoitem">
<span class="label">学生母语:</span>
<span>{{i.mtongue }}</span>
<span class="one-line-hide">{{i.mtongue }}</span>
</div>
<div class="infoitem">
<span class="label">兴趣点:</span>
<span>{{interest}}</span>
<span class="one-line-hide">{{i.interestStr}}</span>
</div>
<div class="infoitem">
<span class="label">语言等级:</span>
<span>asd</span>
<span class="one-line-hide">asd</span>
</div>
<div>参加平台直播课程总时长<span class="time">{{i.longtime}}min</span></div>
@ -130,6 +130,10 @@
line-height: 45px;
.infoitem {
width: 194px;
display: flex;
.label{
flex-shrink: 0;
}
}
}

View File

@ -6,7 +6,7 @@
上一月
</div>
{{month.year}}{{month.yue}}
<a-button type="primary" class="button">
<a-button type="primary" class="button" @click="navto()">
周日历
</a-button>
<div @click="xia">
@ -190,6 +190,7 @@ import { computed, defineComponent, ref, watch } from 'vue';
import { getdate, getDay } from "@/utils/date"
import { getdatelist } from '@/api';
import store from '@/store';
import router from '@/router';
export default defineComponent({
props:{
@ -238,12 +239,16 @@ export default defineComponent({
console.log(month.value.date)
})
}
function navto(){
router.push("/regime/week")
}
getdates(userid.value);
return {
month,
xia,
shang,
yue
yue,
navto
}
}
})

View File

@ -2,36 +2,56 @@
<div class="week">
<div class="head">
<div @click="zhou--">
<img src="" alt="">
<img src="" alt="" />
上一周
</div>
2020年10月
<a-button type="primary" class="button">
月日历
</a-button>
<a-button type="primary" class="button"> 月日历 </a-button>
<div @click="zhou++">
下一周
<img src="" alt="">
<img src="" alt="" />
</div>
</div>
<div class="week">
<div class="heads">
<div></div>
<div :class="{zhou: zhou == 0 && week.zhou == 1}">周一<span>{{week.date[0].day}}</span></div>
<div :class="{zhou: zhou == 0 && week.zhou == 2}">周二<span>{{week.date[1].day}}</span></div>
<div :class="{zhou: zhou == 0 && week.zhou == 3}">周三<span>{{week.date[2].day}}</span></div>
<div :class="{zhou: zhou == 0 && week.zhou == 4}">周四<span>{{week.date[3].day}}</span></div>
<div :class="{zhou: zhou == 0 && week.zhou == 5}">周五<span>{{week.date[4].day}}</span></div>
<div :class="{zhou: zhou == 0 && week.zhou == 6}">周六<span>{{week.date[5].day}}</span></div>
<div :class="{zhou: zhou == 0 && week.zhou == 0}">周日<span>{{week.date[6].day}}</span></div>
<div :class="{ zhou: zhou == 0 && week.zhou == 1 }">
周一<span>{{ week.date[0].day }}</span>
</div>
<div :class="{ zhou: zhou == 0 && week.zhou == 2 }">
周二<span>{{ week.date[1].day }}</span>
</div>
<div :class="{ zhou: zhou == 0 && week.zhou == 3 }">
周三<span>{{ week.date[2].day }}</span>
</div>
<div :class="{ zhou: zhou == 0 && week.zhou == 4 }">
周四<span>{{ week.date[3].day }}</span>
</div>
<div :class="{ zhou: zhou == 0 && week.zhou == 5 }">
周五<span>{{ week.date[4].day }}</span>
</div>
<div :class="{ zhou: zhou == 0 && week.zhou == 6 }">
周六<span>{{ week.date[5].day }}</span>
</div>
<div :class="{ zhou: zhou == 0 && week.zhou == 0 }">
周日<span>{{ week.date[6].day }}</span>
</div>
</div>
<div class="body">
<div class="row" v-for="item in 24" :key="item">
<div class="day date">{{item > 10 ? item : '0' + item}}:00</div>
<div class="day date">
{{ item > 10 ? item - 1 : "0" + (item - 1) }}:00-{{
item > 9 ? item : "0" + item
}}:00
</div>
<div v-for="i in 7" :key="i">
<div class="day">
<div class="next" v-if="week.date[i -1].list[item - 1].title != ''">
<div class="one-line-hide" style="max-width: 1.5rem">
{{week.date[i -1].list[item - 1].title}}
</div>
<div>{{week.date[i -1].list[item - 1].time}}</div>
</div>
</div>
</div>
</div>
@ -40,11 +60,11 @@
</div>
</template>
<style lang="scss" scoped>
.week{
.week {
display: flex;
flex-direction: column;
align-items: center;
.head{
.head {
width: 1320px;
height: 57px;
background-color: #fff;
@ -52,33 +72,33 @@
align-items: center;
justify-content: center;
position: relative;
>div{
> div {
display: flex;
align-items: center;
font-size: 13px;
color: #0DBBA4;
>img{
color: #0dbba4;
> img {
width: 7px;
height: 11px;
}
}
>div:first-child{
> div:first-child {
margin-right: 90px;
>img{
> img {
margin-right: 11px;
}
}
>div:last-child{
> div:last-child {
margin-left: 90px;
>img{
> img {
margin-left: 11px;
}
}
.button{
.button {
width: 57px;
height: 26px;
background-color: #0DBBA4;
background-color: #0dbba4;
border-right: 4px;
border: none;
font-size: 10px;
@ -88,19 +108,19 @@
right: 40px;
}
}
.week{
.heads{
.week {
.heads {
width: 1320px;
height: 63px;
display: flex;
>div{
> div {
width: 100%;
height: 100%;
background-color: #F5FEFD;
background-color: #f5fefd;
text-align: center;
line-height: 1;
font-size: 13px;
color: #08AE98;
color: #08ae98;
border-right: 1px solid #eee;
box-sizing: border-box;
display: flex;
@ -108,91 +128,77 @@
align-items: center;
justify-content: center;
>span{
> span {
font-size: 11px;
margin-top: 9px;
color: #111;
}
}
.zhou{
.zhou {
color: #fff;
background: #08AE98;
>span{
background: #08ae98;
> span {
color: #fff;
}
}
}
.body{
.body {
width: 100%;
.row{
.row {
background-color: #fff;
height: 63px;
width: 100%;
display: flex;
.date{
background-color: #F5FEFD;
.date {
background-color: #f5fefd;
text-align: center;
line-height: 63px;
font-size: 11px;
color: #111;
}
>div{
> div {
width: 100%;
border-top: 1px solid #eee;
border-right: 1px solid #eee;
.day{
width: 100%;
.day {
height: 100%;
display: flex;
flex-direction: column;
color: #111;
>div{
height: 100%;
> div {
min-height: 100%;
width: 100%;
border-radius: 6px;
padding: 18px;
overflow: hidden;
.item{
display: flex;
flex-direction: column;
align-items: center;
margin-top: 11px;
>div{
width: 6px;
height: 6px;
background-color: #111;
margin-right: 6px;
border-radius: 50%;
}
>p{
line-height: 1;
margin: 0;
}
}
}
.old{
background-color: #F7F7F7;
}
.ing{
background-color: #0DBBA4;
color: #fff;
.item{
>div{
background-color: #fff;
}
}
}
.next{
background-color: #CEF9F0;
color: #0DBBA4;
.item{
>div{
background-color: #0DBBA4;
}
}
justify-content: center;
font-size: 11px;
border-radius: 6px;
overflow: hidden;
> div:last-child {
font-size: 11px;
margin-top: 8px;
}
}
.old {
background-color: #f7f7f7;
color: #111;
}
>div::last-child{
.ing {
background-color: #0dbba4;
color: #fff;
}
.next {
background-color: #cef9f0;
color: #0dbba4;
}
}
}
> div::last-child {
border: unset;
}
}
@ -201,25 +207,48 @@
}
</style>
<script lang="ts">
import { defineComponent, ref, watch } from 'vue';
import { getweek } from "@/utils/date"
import { defineComponent, ref, watch } from "vue";
import { getDay, gethour, getminute, gettime, getweek } from "@/utils/date";
import store from '@/store';
import { getdatelist, userinfo } from '@/api';
export default defineComponent({
props:{
},
setup(){
props: {},
setup() {
const zhou = ref(0);
const week = ref(getweek());
console.log(week.value)
watch(zhou,(value) => {
week.value = getweek(value)
const week = ref<any>(getweek());
const userid = store.state.userinfo.memberid;
console.log(week.value);
getdates(userid);
function getdates(userid: number){
getdatelist(week.value.start, week.value.end, userid).then((res: any)=>{
console.log(res)
for(let i in res){
const day = getDay(res[i].dateline)
console.log(day)
for(let j in week.value.date){
console.log(getDay(week.value.date[j].day))
if(day == getDay(week.value.date[j].day)){
console.log("fuzhi")
week.value.date[j].list[gethour(res[i].dateline)].start = getminute(res[i].dateline);
week.value.date[j].list[gethour(res[i].dateline)].num = res[i].livetime
week.value.date[j].list[gethour(res[i].dateline)].title = res[i].title
week.value.date[j].list[gethour(res[i].dateline)].time = gettime(res[i].dateline, res[i].livetime)
}
}
}
console.log(week.value)
})
}
watch(zhou, (value) => {
week.value = getweek(value);
console.log(week.value);
getdates(userid)
});
return {
zhou,
week
}
}
})
week,
};
},
});
</script>

4529
yarn.lock

File diff suppressed because it is too large Load Diff