panhui 4 лет назад
Родитель
Сommit
75fc7baec6

+ 20 - 7
src/main/nine-space/src/router/index.js

@@ -62,7 +62,7 @@ const routes = [
   {
     path: "/login",
     name: "userLogin",
-    component: () => import("../views/user/Login.vue"),
+    component: () => import("../views/account/Login.vue"),
     meta: {
       pageType: Page.Login,
       title: "登录",
@@ -71,7 +71,7 @@ const routes = [
   {
     path: "/register",
     name: "userRegister",
-    component: () => import("../views/user/Register.vue"),
+    component: () => import("../views/account/Register.vue"),
     meta: {
       pageType: Page.Login,
       title: "注册",
@@ -80,31 +80,44 @@ const routes = [
   {
     path: "/forget",
     name: "userForget",
-    component: () => import("../views/user/Forget.vue"),
+    component: () => import("../views/account/Forget.vue"),
     meta: {
       pageType: Page.Login,
       title: "忘记密码",
     },
   },
+  {
+    path: "/changePsd",
+    name: "changePsd",
+    component: () => import("../views/account/ChangePsd.vue"),
+    meta: {
+      title: "修改密码",
+    },
+  },
   {
     path: "/verified",
     name: "userVerified",
-    component: () => import("../views/user/Verified.vue"),
+    component: () => import("../views/account/Verified.vue"),
   },
   {
     path: "/setting",
     name: "userSetting",
-    component: () => import("../views/user/Setting.vue"),
+    component: () => import("../views/account/Setting.vue"),
   },
   {
     path: "/changeText",
     name: "userChangeText",
-    component: () => import("../views/user/ChangeText.vue"),
+    component: () => import("../views/account/ChangeText.vue"),
   },
   {
     path: "/waiting",
     name: "userWaiting",
-    component: () => import("../views/user/Waiting.vue"),
+    component: () => import("../views/account/Waiting.vue"),
+  },
+  {
+    path: "/security",
+    name: "security",
+    component: () => import("../views/account/Security.vue"),
   },
   {
     path: "/detail",

+ 1 - 1
src/main/nine-space/src/views/Home.vue

@@ -64,7 +64,7 @@
       <template v-for="(item, index) in miners" :key="index">
         <creator-info
           :rank="index < 3 ? index + 1 : 0"
-          :info="item"
+          v-model:info="miners[index]"
         ></creator-info>
       </template>
     </div>

+ 1 - 1
src/main/nine-space/src/views/Mine.vue

@@ -183,7 +183,7 @@
           />
         </template>
       </van-cell>
-      <van-cell title="账号与安全" is-link>
+      <van-cell title="账号与安全" is-link :to="{ path: '/security' }">
         <template #icon>
           <van-icon
             :name="require('../assets/svgs/icon-anquan.svg')"

+ 0 - 0
src/main/nine-space/src/views/user/Forget.vue → src/main/nine-space/src/views/account/ChangePsd.vue


+ 0 - 0
src/main/nine-space/src/views/user/ChangeText.vue → src/main/nine-space/src/views/account/ChangeText.vue


+ 234 - 0
src/main/nine-space/src/views/account/Forget.vue

@@ -0,0 +1,234 @@
+<template>
+  <div class="login">
+    <div class="tabs">
+      <div class="tab active">设置新密码</div>
+    </div>
+
+    <van-form ref="form" @submit="submit">
+      <van-field
+        type="tel"
+        name="手机号码"
+        placeholder="请输入手机号码"
+        v-model="form.phone"
+        :maxlength="11"
+        :rules="[
+          { required: true, message: '请输入手机号码' },
+          {
+            pattern: phonePattern,
+            message: '手机号码格式错误',
+          },
+        ]"
+      >
+        <template #left-icon>
+          <img
+            :src="require('../../assets/svgs/login_icon_zhanghao.svg')"
+            class="icon"
+          />
+        </template>
+      </van-field>
+
+      <van-field
+        type="digit"
+        name="验证码"
+        placeholder="请输入验证码"
+        v-model="form.code"
+        :maxlength="4"
+        :rules="[{ required: true, message: '请输入验证码' }]"
+      >
+        <template #left-icon>
+          <img
+            :src="require('../../assets/svgs/login_icon_code.svg')"
+            class="icon"
+          />
+        </template>
+        <template #button>
+          <van-button
+            @click="sendPhone"
+            class="sub-code"
+            size="small"
+            plain
+            :disabled="isSend"
+            type="primary"
+          >
+            {{ isSend ? `已发送(${sendNum})S` : "发送验证码" }}
+          </van-button>
+        </template>
+      </van-field>
+
+      <van-field
+        type="password"
+        name="密码"
+        placeholder="请输入密码"
+        v-model="form.password"
+        :rules="[{ required: true, message: '请填写密码' }]"
+      >
+        <template #left-icon>
+          <img
+            :src="require('../../assets/svgs/login_icon_mima.svg')"
+            class="icon"
+          />
+        </template>
+      </van-field>
+
+      <van-field
+        type="password"
+        name="密码"
+        placeholder="请再次输入密码"
+        v-model="form.password2"
+        :rules="[
+          { required: true, message: '请再次填写密码' },
+          {
+            validator: (val) => {
+              if (val == form.password) {
+                return true;
+              } else {
+                return false;
+              }
+            },
+            message: '两次密码输入不一致',
+          },
+        ]"
+      >
+        <template #left-icon>
+          <img
+            :src="require('../../assets/svgs/login_icon_mima.svg')"
+            class="icon"
+          />
+        </template>
+      </van-field>
+
+      <div class="button">
+        <van-button
+          round
+          block
+          native-type="submit"
+          color="linear-gradient(to right, #FDFB60, #FF8F3E)"
+          class="sure"
+          >确定修改</van-button
+        >
+        <!-- <van-button
+          class="del"
+          round
+          block
+          plain
+          @click="$router.replace('/login')"
+          >想起密码,立即登陆</van-button
+        > -->
+      </div>
+    </van-form>
+  </div>
+</template>
+
+<script>
+import phone from "../../mixins/phone";
+export default {
+  mixins: [phone],
+  data() {
+    return {
+      active: "phone",
+      form: {
+        phone: "",
+        password: "",
+        password2: "",
+        code: "",
+      },
+    };
+  },
+  methods: {
+    sendPhone() {
+      this.$refs.form.validate("手机号码").then(() => {
+        this.sendMsg(this.form.phone);
+      });
+    },
+    submit() {
+      this.$toast.loading({
+        message: "加载中...",
+        forbidClick: true,
+      });
+      this.$http
+        .post(
+          `/user/changePassword?password=${this.form.password}&key=${this.form.phone}&code=${this.form.code}`
+        )
+        .then((res) => {
+          this.$toast.success("修改成功");
+          setTimeout(() => {
+            this.$router.back();
+          }, 1500);
+        })
+        .catch((e) => {
+          if (e) {
+            this.$toast(e.error);
+          }
+        });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.login {
+  padding: 40px 50px 100px;
+}
+
+.tabs {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  .tab {
+    font-size: 18px;
+    color: #c8c9cc;
+    line-height: 25px;
+
+    &.active {
+      font-size: 24px;
+      font-weight: bold;
+      color: #ffffff;
+      line-height: 33px;
+    }
+  }
+}
+
+.icon {
+  display: block;
+  margin-top: 12px;
+}
+/deep/ .van-form {
+  margin-top: 28px;
+  .van-cell {
+    padding: 0px 0;
+
+    .van-field__left-icon {
+      margin-right: 8px;
+    }
+  }
+
+  .van-cell + .van-cell {
+    margin-top: 20px;
+  }
+  .van-field__body {
+    height: 44px;
+    align-items: center;
+  }
+}
+.button {
+  margin-top: 60px;
+
+  .del {
+    margin-top: 20px;
+    border-color: #ffffff;
+  }
+
+  .sure {
+    color: @bg !important;
+  }
+
+  .van-button {
+    font-weight: bold;
+  }
+}
+
+.sub-code {
+  padding-right: 0;
+  border-width: 0;
+}
+</style>

+ 2 - 2
src/main/nine-space/src/views/user/Login.vue → src/main/nine-space/src/views/account/Login.vue

@@ -82,9 +82,9 @@
         </template>
       </van-field>
       <div class="button">
-        <van-button plain class="forget" @click="$router.replace('/forget')">
+        <!-- <van-button plain class="forget" @click="$router.replace('/forget')">
           忘记密码?
-        </van-button>
+        </van-button> -->
 
         <van-button
           round

+ 3 - 2
src/main/nine-space/src/views/user/Register.vue → src/main/nine-space/src/views/account/Register.vue

@@ -154,8 +154,9 @@ export default {
               this.form.password
           );
         })
-        .then(() => {
-          return this.loginByPhone(this.form.phone, this.form.password);
+        .then((res) => {
+          localStorage.setItem("nineToken", res);
+          return this.$store.dispatch("getUserInfo");
         })
         .then(() => {
           this.$toast.success("注册成功");

+ 31 - 0
src/main/nine-space/src/views/account/Security.vue

@@ -0,0 +1,31 @@
+<template>
+  <div class="page">
+    <div class="title">账户与安全</div>
+    <van-cell-group>
+      <van-cell title="修改登录密码" :to="{ path: '/changePsd' }" is-link />
+      <van-cell title="修改支付密码" is-link />
+      <van-cell title="修改手机号" is-link />
+    </van-cell-group>
+  </div>
+</template>
+
+<style lang="less" scoped>
+.title {
+  background-color: #181818;
+  padding: 10px 16px;
+  font-size: 20px;
+  font-weight: bold;
+  color: #ffffff;
+  line-height: 30px;
+}
+.page {
+  background-color: #0f0f0f;
+}
+
+.van-cell-group {
+  background-color: #181818;
+}
+.van-cell {
+  padding: 23px 16px;
+}
+</style>

+ 0 - 0
src/main/nine-space/src/views/user/Setting.vue → src/main/nine-space/src/views/account/Setting.vue


+ 0 - 0
src/main/nine-space/src/views/user/Verified.vue → src/main/nine-space/src/views/account/Verified.vue


+ 0 - 0
src/main/nine-space/src/views/user/Waiting.vue → src/main/nine-space/src/views/account/Waiting.vue


+ 1 - 0
src/main/nine-space/src/views/order/Orders.vue

@@ -196,6 +196,7 @@ export default {
 
 .discover {
   background-color: @bg3;
+  min-height: 100vh;
 }
 
 .grid-img {

+ 86 - 19
src/main/nine-space/src/views/user/Likes.vue

@@ -1,49 +1,105 @@
 <template>
   <div class="follow">
-    <van-sticky>
+    <van-sticky ref="top" @change="change">
       <div class="top">
         <div class="name">我赞过的</div>
       </div>
+      <van-tabs
+        v-model:active="type"
+        :ellipsis="false"
+        line-width="16"
+        line-height="2"
+      >
+        <van-tab
+          :title="item.label"
+          :name="item.type"
+          :key="index"
+          v-for="(item, index) in typeOptions"
+        ></van-tab>
+      </van-tabs>
     </van-sticky>
     <div class="list">
       <template v-for="(item, index) in showList" :key="index">
-        <creator-info v-model:info="showList[index]"></creator-info>
+        <product-info
+          v-model:info="list[item.index]"
+          @update:info="init"
+        ></product-info>
       </template>
-      <van-empty v-if="empty" description="你还没有任何关注哦~" />
+      <van-empty
+        v-if="showList.length === 0"
+        description="你还没有赞过任何藏品哦~"
+      />
     </div>
   </div>
 </template>
 
 <script>
-import CreatorInfo from "../../components/creator/CreatorInfo.vue";
+import ProductInfo from "../../components/product/productInfo.vue";
 export default {
-  components: { CreatorInfo },
+  components: { ProductInfo },
   inject: ["bs"],
   data() {
     return {
       list: [],
       empty: false,
+      type: "",
+      typeOptions: [
+        {
+          label: "全部",
+          type: "",
+        },
+        {
+          label: "收藏品",
+          type: "DEFAULT",
+        },
+        {
+          label: "数字盲盒",
+          type: "BLIND_BOX",
+        },
+      ],
     };
   },
   computed: {
     showList() {
-      return [...this.list].filter((item) => {
-        return item.follow;
-      });
+      return [...this.list]
+        .map((item, index) => {
+          return {
+            ...item,
+            index,
+          };
+        })
+        .filter((item) => {
+          return !this.type || this.type === item.type;
+        });
     },
   },
   mounted() {
-    this.$toast.loading({
-      message: "加载中...",
-      forbidClick: true,
-    });
-    this.$http.get("/user/myFollows").then((res) => {
-      this.list = res;
-      this.empty = res.length === 0;
-      setTimeout(() => {
-        this.bs.value.refresh();
-      }, 500);
-    });
+    this.init();
+  },
+  methods: {
+    change(isFixed) {
+      if (isFixed) {
+        this.$nextTick(() => {
+          document.body.appendChild(this.stiky);
+        });
+      } else {
+        // this.$refs.top.$el.appendChild(this.stiky);
+      }
+    },
+    init() {
+      this.$toast.loading({
+        message: "加载中...",
+        forbidClick: true,
+      });
+      this.empty = false;
+      this.$http.get("/collection/myLikes").then((res) => {
+        this.list = res;
+        this.empty = res.length === 0;
+        setTimeout(() => {
+          this.bs.value.refresh();
+        }, 500);
+      });
+    },
   },
 };
 </script>
@@ -51,6 +107,7 @@ export default {
 <style lang="less" scoped>
 .follow {
   background-color: #0f0f0f;
+  padding-bottom: 100px;
 }
 .top {
   background-color: #181818;
@@ -65,4 +122,14 @@ export default {
     line-height: 30px;
   }
 }
+/deep/.van-tabs {
+  .van-tabs__nav {
+    padding-left: 16px;
+  }
+}
+/deep/.van-tab {
+  flex-grow: 0;
+  padding: 0 0 0 0;
+  margin-right: 50px;
+}
 </style>