@@ -396,12 +397,17 @@ import "swiper/dist/js/swiper";
import "swiper/dist/css/swiper.css";
import Swiper from "swiper";
import { mapState, mapActions } from "vuex";
+import top from "../common/top.vue";
+import baseUrl from "../../api/baseUrl";
import { Toast } from "vant";
import Vue from "vue";
Vue.use(Toast);
export default {
+ components: {
+ top,
+ },
data() {
return {
userName: "",
@@ -601,8 +607,30 @@ export default {
...mapActions(["setCharacters"]),
goLogin() {
- console.log(111);
- this.$router.push("/login");
+ const AccessToken = localStorage.getItem("AccessToken");
+ if (AccessToken) {
+ this.$axios({
+ method: "get",
+ url: `${baseUrl}/api/userVideo/list?pageNum=1&pageSize=3`,
+ headers: {
+ "Content-Type": "application/json;charset=UTF-8",
+ token: AccessToken,
+ },
+ })
+ .then((res) => {
+ if (res.data.code == 1052) {
+ this.$router.push("/login");
+ Toast.fail("登录过期,请重新登录!");
+ } else {
+ this.$router.push("/myPage");
+ }
+ })
+ .catch((err) => {
+ Toast.fail(err.message);
+ });
+ } else {
+ this.$router.push("/login");
+ }
},
showPopup() {
diff --git a/src/copy.vue b/src/copy.vue
new file mode 100644
index 0000000..5cdf2f9
--- /dev/null
+++ b/src/copy.vue
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
diff --git a/src/router/index.js b/src/router/index.js
index 2980867..6a25c65 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -28,12 +28,28 @@ const routes = [
// component: Home
component: () => import("../components/styleAdd/styleAdd"),
},
+ // 登录
{
path: '/login',
name: 'login',
// component: Home
component: () => import("../views/login/login"),
},
+ // 创作中心首页
+ {
+ path: '/myPage',
+ name: 'myPage',
+ // component: Home
+ component: () => import("../views/myPage/myPage"),
+ },
+ // 创作中心首页
+ {
+ path: '/chooseModel',
+ name: 'chooseModel',
+ // component: Home
+ component: () => import("../views/model/chooseModel"),
+ },
+
]
const router = new VueRouter({
diff --git a/src/views/login/login.vue b/src/views/login/login.vue
index cfe5e33..e59c5ab 100644
--- a/src/views/login/login.vue
+++ b/src/views/login/login.vue
@@ -1,7 +1,11 @@
+
+
+
+
-
欢迎加入MetAvatar
+
欢迎加入metAvatar
{
- Toast.success("短信验证码发送成功!");
- this.codeInfo = 60;
- const timer = setInterval(() => {
- if (this.codeInfo != 1) {
- this.codeInfo--;
- } else {
- clearInterval(timer);
- this.codeInfo = "获取验证码";
- }
- }, 1000);
+ console.log(res.data);
+ if (res.data.code != 200) {
+ Toast.fail(res.data.message);
+ } else {
+ Toast.success("短信验证码发送成功!");
+ this.codeInfo = 60;
+ const timer = setInterval(() => {
+ if (this.codeInfo != 1) {
+ this.codeInfo--;
+ } else {
+ clearInterval(timer);
+ this.codeInfo = "获取验证码";
+ }
+ }, 1000);
+ }
})
.catch((err) => {
Toast.fail(err.message);
});
}
},
+ go(url) {
+ this.$router.push(url);
+ },
login() {
const data = {
phone: this.form.phone,
@@ -116,21 +129,21 @@ export default {
};
this.$axios({
method: "post",
- url: `https://smapitest.malls.iformall.com/C/api/user/doLoginByPhone`,
+ url: `${baseUrl}/api/user/doLoginByPhone`,
headers: {
"Content-Type": "application/json;charset=UTF-8",
},
data,
})
.then((res) => {
- console.log(res, "res");
- if (res.data.code == 200) {
+ // console.log(res, "res");
+ if (res.data.code != 200) {
+ Toast.fail(res.data.message);
+ } else {
Toast.success("登录成功!");
const token = res.data.data.token;
localStorage.setItem("AccessToken", token);
- this.$router.push("/");
- } else {
- Toast.fail(res.data.message);
+ this.$router.push("/myPage");
}
})
.catch((err) => {
@@ -138,13 +151,31 @@ export default {
});
},
},
+ created() {
+ const phoneValue = localStorage.getItem("phoneValue");
+ if (phoneValue) {
+ this.form.phone = phoneValue;
+ }
+ },
};
diff --git a/src/views/myPage/myPage.vue b/src/views/myPage/myPage.vue
new file mode 100644
index 0000000..79b0053
--- /dev/null
+++ b/src/views/myPage/myPage.vue
@@ -0,0 +1,182 @@
+
+
+
+
+
+
我的视频作品
+
+
+
+
+
+
+
+ 视频名称视频名称视频名称视频名称视频名称视频名称
+
+
创建时间:2022-10-18 12:13:14
+
+
+
+
+
+
+
+
+
+ 视频名称视频名称视频名称视频名称视频名称视频名称
+
+
创建时间:2022-10-18 12:13:14
+
+
+
+
+
+
+
+
+
+ 视频名称视频名称视频名称视频名称视频名称视频名称
+
+
创建时间:2022-10-18 12:13:14
+
+
+
+
+
+ 创作新作品
+
+
+
+
+
+