Browse Source

个人信息增加手机和邮箱更换设置

hangb 6 years ago
parent
commit
557ef97e3f
5 changed files with 80 additions and 4 deletions
  1. 18 3
      components/mobile/user/Info.vue
  2. 3 1
      nuxt.config.js
  3. 6 0
      pages/mobile/user/info/personal.vue
  4. 20 0
      store/user.js
  5. 33 0
      store/user/updateUser.js

+ 18 - 3
components/mobile/user/Info.vue

@@ -15,11 +15,11 @@
         <span><i class="iconfont icon-yonghuming"></i>用户名:</span>
         <span class="describe">{{info.userName}}</span>
       </div>
-      <div class="line">
+      <div class="line" @click="jumpSet('email')">
         <span><i class="iconfont icon-youxiang"></i>邮箱:</span>
         <span class="describe">{{info.userEmail}}</span>
       </div>
-      <div class="line">
+      <div class="line" @click="jumpSet('mobile')">
         <span><i class="iconfont icon-shouji"></i>手机:</span>
         <span class="describe">{{info.userTel}}</span>
       </div>
@@ -39,6 +39,14 @@
         imageUploadUrl: ''
       }
     },
+    computed: {
+      getEmail () {
+        return this.$store.state.user.updateUser.email.data.content
+      },
+      getMobile () {
+        return this.$store.state.user.updateUser.mobile.data.content
+      }
+    },
     methods: {
       uploadImg (e) {
         let file = e.target.files[0]
@@ -62,6 +70,13 @@
               }
             })
         }
+      },
+      jumpSet (info) {
+        if (info === 'email') {
+          window.open(this.getEmail, '_blank')
+        } else if (info === 'mobile') {
+          window.open(this.getMobile, '_blank')
+        }
       }
     }
   }
@@ -121,7 +136,7 @@
         img{
           width: .58rem;
           height: .58rem;
-          border: 1px solid #bebebe;
+          /*border: 1px solid #bebebe;*/
         }
       }
     }

+ 3 - 1
nuxt.config.js

@@ -188,6 +188,8 @@ module.exports = {
     '/wx/**': baseUrl,
     '/messages**': messageUrl,
     '/messages/**': messageUrl,
-    '/cmsApi**': cmsUrl
+    '/cmsApi**': cmsUrl,
+    '/mEmail/**': baseUrl,
+    '/mPhone/**': baseUrl
   }
 }

+ 6 - 0
pages/mobile/user/info/personal.vue

@@ -7,6 +7,12 @@
     layout: 'mobile',
     components: {
       Info
+    },
+    mounted () {
+      this.$nextTick(() => {
+        this.$store.dispatch('user/updateUserEmail', { params: {returnUrl: window.location.href} })
+        this.$store.dispatch('user/updateUserMobile', { params: {returnUrl: window.location.href} })
+      })
     }
   }
 </script>

+ 20 - 0
store/user.js

@@ -50,5 +50,25 @@ export const actions = {
       }, err => {
         commit('car/GET_CAR_FAILURE', err)
       })
+  },
+  // 获取修改邮箱地址
+  updateUserEmail ({ commit }, params = {}) {
+    commit('updateUser/REQUEST_USER_EMAIL')
+    return axios.get(`/mEmail/page`, params)
+      .then(response => {
+        commit('updateUser/GET_USER_EMAIL_SUCCESS', response.data)
+      }, err => {
+        commit('updateUser/GET_USER_EMAIL_FAILURE', err)
+      })
+  },
+  // 获取修改手机号地址
+  updateUserMobile ({ commit }, params = {}) {
+    commit('updateUser/REQUEST_USER_MOBILE')
+    return axios.get(`/mPhone/page`, params)
+      .then(response => {
+        commit('updateUser/GET_USER_MOBILE_SUCCESS', response.data)
+      }, err => {
+        commit('updateUser/GET_USER_MOBILE_FAILURE', err)
+      })
   }
 }

+ 33 - 0
store/user/updateUser.js

@@ -0,0 +1,33 @@
+export const state = () => ({
+  email: {
+    fetching: false,
+    data: []
+  },
+  mobile: {
+    fetching: false,
+    data: []
+  }
+})
+
+export const mutations = {
+  REQUEST_USER_EMAIL (state) {
+    state.email.fetching = true
+  },
+  GET_USER_EMAIL_FAILURE (state) {
+    state.email.fetching = false
+  },
+  GET_USER_EMAIL_SUCCESS (state, result) {
+    state.email.fetching = false
+    state.email.data = result
+  },
+  REQUEST_USER_MOBILE (state) {
+    state.mobile.fetching = true
+  },
+  GET_USER_MOBILE_FAILURE (state) {
+    state.mobile.fetching = false
+  },
+  GET_USER_MOBILE_SUCCESS (state, result) {
+    state.mobile.fetching = false
+    state.mobile.data = result
+  }
+}