panhui 4 anos atrás
pai
commit
f881d01000

+ 1 - 1
src/main/java/com/izouma/nineth/web/UserController.java

@@ -53,7 +53,7 @@ public class UserController extends BaseController {
         return userService.create(userRegister);
     }
 
-    @PreAuthorize("hasRole('ADMIN')")
+
     @PostMapping("/save")
     public User save(@RequestBody User user) {
         if (user.getId() != null) {

+ 27 - 0
src/main/nine-space/package-lock.json

@@ -18,6 +18,7 @@
         "vant": "^3.2.3",
         "vue": "^3.0.0",
         "vue-clipboard2": "^0.3.3",
+        "vue-croppie": "^2.0.2",
         "vue-router": "^4.0.0-0",
         "vuex": "^4.0.0-0"
       },
@@ -5738,6 +5739,11 @@
         "sha.js": "^2.4.8"
       }
     },
+    "node_modules/croppie": {
+      "version": "2.6.5",
+      "resolved": "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz",
+      "integrity": "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ=="
+    },
     "node_modules/cross-spawn": {
       "version": "6.0.5",
       "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
@@ -15493,6 +15499,14 @@
         "clipboard": "^2.0.0"
       }
     },
+    "node_modules/vue-croppie": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/vue-croppie/-/vue-croppie-2.0.2.tgz",
+      "integrity": "sha512-+yiDryp76tkHpYvbFdKSTM2VSU4TTLIikOvWlSaTaomvTky2Fiig7aRr1+AcHdB1mhrtEAZQRrWFbvc7NX0qBQ==",
+      "dependencies": {
+        "croppie": "^2.6.4"
+      }
+    },
     "node_modules/vue-eslint-parser": {
       "version": "7.11.0",
       "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.11.0.tgz",
@@ -20932,6 +20946,11 @@
         "sha.js": "^2.4.8"
       }
     },
+    "croppie": {
+      "version": "2.6.5",
+      "resolved": "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz",
+      "integrity": "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ=="
+    },
     "cross-spawn": {
       "version": "6.0.5",
       "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
@@ -28122,6 +28141,14 @@
         "clipboard": "^2.0.0"
       }
     },
+    "vue-croppie": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/vue-croppie/-/vue-croppie-2.0.2.tgz",
+      "integrity": "sha512-+yiDryp76tkHpYvbFdKSTM2VSU4TTLIikOvWlSaTaomvTky2Fiig7aRr1+AcHdB1mhrtEAZQRrWFbvc7NX0qBQ==",
+      "requires": {
+        "croppie": "^2.6.4"
+      }
+    },
     "vue-eslint-parser": {
       "version": "7.11.0",
       "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.11.0.tgz",

+ 1 - 0
src/main/nine-space/package.json

@@ -19,6 +19,7 @@
     "vant": "^3.2.3",
     "vue": "^3.0.0",
     "vue-clipboard2": "^0.3.3",
+    "vue-croppie": "^2.0.2",
     "vue-router": "^4.0.0-0",
     "vuex": "^4.0.0-0"
   },

+ 1 - 0
src/main/nine-space/public/index.html

@@ -7,6 +7,7 @@
       name="viewport"
       content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
     />
+    <meta name="msapplication-tap-highlight" content="no" />
     <meta name="format-detection" content="telphone=no" />
     <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
     <title><%= htmlWebpackPlugin.options.title %></title>

+ 34 - 5
src/main/nine-space/src/mixins/common.js

@@ -3,25 +3,54 @@ export default {
     isLogin() {
       return !!this.$store.state.userInfo;
     },
+    authStatus() {
+      return this.$store.state.authStatus;
+    },
+  },
+  data() {
+    return {
+      AuthStatus: [],
+    };
   },
   methods: {
     updateUser(info, sucess = true) {
       if (info) {
         return this.$http
-          .post("/user/save", {
-            ...this.$store.state.userInfo,
-            ...info,
-          })
+          .post(
+            "/user/save",
+            {
+              ...this.$store.state.userInfo,
+              ...info,
+            },
+            {
+              body: "json",
+            }
+          )
           .then(() => {
             return this.$store.dispatch("getUserInfo");
           })
           .then(() => {
             if (sucess) {
-              this.$toast.success("保持");
+              this.$toast.success("更新成功");
             }
             return Promise.resolve();
+          })
+          .catch((e) => {
+            if (e) {
+              this.$toast(e.error);
+            }
+            return Promise.reject();
           });
       }
     },
+    updateFile(file) {
+      return this.$http
+        .post("/upload/base64", {
+          base64: file.content,
+        })
+        .then((res) => {
+          return Promise.resolve(res);
+        });
+    },
   },
 };

+ 5 - 0
src/main/nine-space/src/router/index.js

@@ -87,6 +87,11 @@ const routes = [
     name: "userSetting",
     component: () => import("../views/user/Setting.vue"),
   },
+  {
+    path: "/changeText",
+    name: "userChangeText",
+    component: () => import("../views/user/ChangeText.vue"),
+  },
   {
     path: "/detail",
     name: "detail",

+ 11 - 0
src/main/nine-space/src/styles/app.less

@@ -26,6 +26,17 @@
   --van-divider-margin: 0;
   --van-field-error-message-color: #fdfb60;
   --van-action-sheet-item-text-color: #000;
+  --van-uploader-upload-active-color: transparent;
+  --van-uploader-upload-background-color: transparent;
+  --van-uploader-file-background-color: transparent;
+}
+input,
+select,
+button {
+  outline: none;
+  border: none;
+  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+  -webkit-appearance: none;
 }
 .van-divider::after,
 .van-divider::before {

+ 5 - 2
src/main/nine-space/src/views/Mine.vue

@@ -14,7 +14,9 @@
             round
             width="78"
             height="78"
-            :src="require('../assets/svgs/img_default_photo.svg')"
+            :src="
+              userInfo.avatar || require('../assets/svgs/img_default_photo.svg')
+            "
             fit="cover"
             @click="$router.push('/setting')"
           />
@@ -28,7 +30,7 @@
         </div>
 
         <div class="sub">
-          广州小云互娱科技有限公司成立于2017年,作为广东省游戏产业协会成员,是一家集游戏研发
+          {{ userInfo.intro }}
         </div>
 
         <div class="btns">
@@ -47,6 +49,7 @@
             size="mini"
             :icon="require('../assets/svgs/person.svg')"
             round
+            @click="Re"
           >
             未认证
           </van-button>

+ 1 - 1
src/main/nine-space/src/views/user/Register.vue

@@ -148,7 +148,7 @@ export default {
       this.verifyMsg(this.form.phone, this.form.code)
         .then(() => {
           return this.$http.post(
-            "/user/registerByPhone?phone=" +
+            "/auth/phoneRegister?phone=" +
               this.form.phone +
               "&password=" +
               this.form.password

+ 56 - 12
src/main/nine-space/src/views/user/Setting.vue

@@ -15,9 +15,16 @@
             "
             fit="cover"
           />
+
+          <van-uploader class="avatar" :after-read="afterRead" />
         </template>
       </van-cell>
-      <van-cell title="昵称" is-link :value="userInfo.nickname" />
+      <van-cell
+        title="昵称"
+        @click="$router.push('/changeText?type=nickname')"
+        is-link
+        :value="userInfo.nickname"
+      />
       <van-cell
         title="性别"
         :class="{ not: !userInfo.sex }"
@@ -27,16 +34,17 @@
       />
       <van-cell
         title="简介"
-        :class="{ not: !userInfo.intro }"
+        :class="[userInfo.intro ? 'intro' : 'not']"
+        @click="$router.push('/changeText?type=intro')"
         is-link
         :value="userInfo.intro || '请添加介绍'"
       />
-      <van-cell
-        title="主页背景"
-        :class="{ not: !userInfo.bg }"
-        is-link
-        :value="userInfo.bg || '更换背景图片'"
-      />
+      <van-cell title="主页背景" class="not" is-link>
+        <template #value>
+          <span> 更换背景图片</span>
+          <van-uploader class="avatar" :after-read="afterRead2" />
+        </template>
+      </van-cell>
       <van-cell class="not" title="编码" :value="userInfo.id" />
     </van-cell-group>
 
@@ -61,16 +69,27 @@ export default {
     //性别
     const show = ref(false);
     const actions = [{ name: "男" }, { name: "女" }];
-    const chooseSex = (val) => {
-      this.updateUser({ sex: val.name});
-    };
 
     return {
       show,
       actions,
-      chooseSex,
     };
   },
+  methods: {
+    chooseSex(val) {
+      this.updateUser({ sex: val.name });
+    },
+    afterRead(e) {
+      this.updateFile(e).then((img) => {
+        this.updateUser({ avatar: img });
+      });
+    },
+    afterRead2(e) {
+      this.updateFile(e).then((img) => {
+        this.updateUser({ bg: img });
+      });
+    },
+  },
 };
 </script>
 
@@ -86,9 +105,18 @@ export default {
   line-height: 30px;
 }
 
+.avatar {
+  position: absolute;
+  right: 0;
+  top: 0;
+  opacity: 0;
+  bottom: 0;
+}
+
 /deep/ .van-cell {
   align-items: center;
   height: 70px;
+  position: relative;
   .van-cell__title {
     span {
       font-weight: bold;
@@ -113,5 +141,21 @@ export default {
       }
     }
   }
+
+  &.intro {
+    overflow: hidden;
+    .van-cell__value {
+      span {
+        font-size: 13px;
+        color: #fff;
+        line-height: 24px;
+        display: -webkit-box;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        -webkit-line-clamp: 2;
+        -webkit-box-orient: vertical;
+      }
+    }
+  }
 }
 </style>

+ 12 - 0
src/main/nine-space/yarn.lock

@@ -3095,6 +3095,11 @@
     "safe-buffer" "^5.0.1"
     "sha.js" "^2.4.8"
 
+"croppie@^2.6.4":
+  "integrity" "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ=="
+  "resolved" "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz"
+  "version" "2.6.5"
+
 "cross-spawn@^5.0.1":
   "integrity" "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk="
   "resolved" "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz"
@@ -8900,6 +8905,13 @@
   dependencies:
     "clipboard" "^2.0.0"
 
+"vue-croppie@^2.0.2":
+  "integrity" "sha512-+yiDryp76tkHpYvbFdKSTM2VSU4TTLIikOvWlSaTaomvTky2Fiig7aRr1+AcHdB1mhrtEAZQRrWFbvc7NX0qBQ=="
+  "resolved" "https://registry.npmjs.org/vue-croppie/-/vue-croppie-2.0.2.tgz"
+  "version" "2.0.2"
+  dependencies:
+    "croppie" "^2.6.4"
+
 "vue-eslint-parser@^7.10.0":
   "integrity" "sha512-qh3VhDLeh773wjgNTl7ss0VejY9bMMa0GoDG2fQVyDzRFdiU3L7fw74tWZDHNQXdZqxO3EveQroa9ct39D2nqg=="
   "resolved" "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.11.0.tgz"