reghao 1 năm trước cách đây
mục cha
commit
4ced2509c9

+ 0 - 4
src/api/mall.js

@@ -60,10 +60,6 @@ export function payOrder(orderId) {
   return post(mallApi.payOrderApi + '/' + orderId)
 }
 
-export function createWallet() {
-  return post(mallApi.walletApi)
-}
-
 export function getWallet() {
   return get(mallApi.walletApi)
 }

+ 7 - 7
src/api/map.js

@@ -1,13 +1,13 @@
 import { get, post } from '@/utils/request'
 
 const mapAPI = {
-  center: '/api/mall/map/center',
-  markers: '/api/mall/map/markers',
-  markerInfoApi: '/api/mall/map/marker',
-  location: '/api/mall/map/location',
-  mainland: '/api/mall/map/cn',
-  geoItemApi: '/api/mall/map/item',
-  addGeoPointApi: '/api/mall/map/point'
+  center: '/api/content/map/center',
+  markers: '/api/content/map/markers',
+  markerInfoApi: '/api/content/map/marker',
+  location: '/api/content/map/location',
+  mainland: '/api/content/map/cn',
+  geoItemApi: '/api/content/map/item',
+  addGeoPointApi: '/api/content/map/point'
 }
 
 export function getMapCenter() {

+ 3 - 3
src/api/user.js

@@ -11,7 +11,7 @@ const userApi = {
   userFollowingApi: '/api/user/relation/following',
   unreadMessageApi: '/api/user/message/unread',
   unreadMessagesApi: '/api/user/message/unread/list',
-  setReadMessageApi: '/api/user/message/read'
+  setReadMessageApi: '/api/user/message/detail'
 }
 
 export function getUserInfo(userId) {
@@ -56,6 +56,6 @@ export function getUnreadMessages(page) {
   return get(userApi.unreadMessagesApi + '?pageNumber=' + page)
 }
 
-export function setReadMessages(messageId) {
-  return post(userApi.setReadMessageApi + '/' + messageId)
+export function getMessageDetail(messageId) {
+  return get(userApi.setReadMessageApi + '/' + messageId)
 }

+ 15 - 8
src/assets/js/mixin.js

@@ -26,6 +26,10 @@ export const userMixin = {
         captchaCode: null,
         plat: 2
       },
+      verifyCodeForm: {
+        principal: null,
+        channel: 2
+      },
       userForgot: {
         principal: null,
         verifyCode: null,
@@ -90,7 +94,9 @@ export const userMixin = {
         return
       }
 
-      this.getVerifyCode(1, this.userRegistry.principal)
+      this.verifyCodeForm.channel = 1
+      this.verifyCodeForm.receiver = this.userRegistry.principal
+      this.getVerifyCode(this.verifyCodeForm)
     },
     loginVerifyCode() {
       if (this.userLogin.principal === null || this.userLogin.principal === '') {
@@ -98,7 +104,9 @@ export const userMixin = {
         return
       }
 
-      getVerifyCode(2, this.userRegistry.principal)
+      this.verifyCodeForm.channel = 2
+      this.verifyCodeForm.receiver = this.userRegistry.principal
+      getVerifyCode(this.verifyCodeForm)
     },
     forgotVerifyCode() {
       if (this.userForgot.principal === null || this.userForgot.principal === '') {
@@ -106,9 +114,11 @@ export const userMixin = {
         return
       }
 
-      this.getVerifyCode(3, this.userForgot.principal)
+      this.verifyCodeForm.channel = 3
+      this.verifyCodeForm.receiver = this.userRegistry.principal
+      this.getVerifyCode(this.verifyCodeForm)
     },
-    getVerifyCode(channel, receiver) {
+    getVerifyCode(verifyCodeForm) {
       this.isBtn = true
       let time = 60
       const timeout = setInterval(() => {
@@ -122,10 +132,7 @@ export const userMixin = {
         }
       }, 1000)
 
-      const verifyCodeReq = {}
-      verifyCodeReq.receiver = receiver
-      verifyCodeReq.channel = channel
-      getVerifyCode(verifyCodeReq).then(resp => {
+      getVerifyCode(verifyCodeForm).then(resp => {
         if (resp.code === 0) {
           this.$message.success('验证码已发送, 请注意查收')
         } else {

+ 0 - 7
src/router/my.js

@@ -2,7 +2,6 @@
 // 用户后台主页
 const My = () => import('views/my/My')
 const MyProfile = () => import('views/my/MyProfile')
-const MyRealname = () => import('views/my/MyRealname')
 const MyOAuth = () => import('views/my/MyOAuth')
 const MyMessage = () => import('views/my/MyMessage')
 const MyRecord = () => import('views/my/MyRecord')
@@ -21,12 +20,6 @@ export default {
       component: MyProfile,
       meta: { needAuth: true }
     },
-    {
-      path: '/my/realname',
-      name: '实名认证',
-      component: MyRealname,
-      meta: { needAuth: true }
-    },
     {
       path: '/my/vip',
       name: '小会员',

+ 0 - 4
src/views/my/My.vue

@@ -56,10 +56,6 @@
             <i class="el-icon-wallet" />
             <span slot="title">我的钱包</span>
           </el-menu-item>
-          <el-menu-item index="/my/realname">
-            <i class="el-icon-film" />
-            <span slot="title">实名认证</span>
-          </el-menu-item>
           <el-menu-item index="/my/oauth">
             <i class="el-icon-film" />
             <span slot="title">OAuth</span>

+ 23 - 10
src/views/my/MyMessage.vue

@@ -13,17 +13,21 @@
             style="width: 100%"
           >
             <el-table-column
-              prop="title"
-              label="标题"
+              prop="createAt"
+              label="时间"
             />
             <el-table-column
-              prop="content"
-              label="内容"
+              prop="title"
+              label="标题"
             />
             <el-table-column
               label="操作"
             >
               <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  @click="view(scope.row)"
+                >查看</el-button>
                 <el-button
                   size="mini"
                   @click="delete(scope.row)"
@@ -34,17 +38,23 @@
         </el-card>
       </el-col>
     </el-row>
+
+    <el-dialog title="消息内容" :visible.sync="messageDialog" @close="onCloseDialog">
+      <span>{{ this.messageContent }}</span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import {getUnreadMessages, setReadMessages} from "@/api/user";
+import { getUnreadMessages, getMessageDetail } from '@/api/user'
 
 export default {
   name: 'MyMessage',
   data() {
     return {
-      dataList: []
+      dataList: [],
+      messageDialog: false,
+      messageContent: ''
     }
   },
   created() {
@@ -57,13 +67,16 @@ export default {
     })
   },
   methods: {
-    delete(row) {
-      setReadMessages(row.messageId).then(resp => {
+    view(row) {
+      getMessageDetail(row.messageId).then(resp => {
         if (resp.code === 0) {
-          this.$message('已处理')
-          this.dataList.pop()
+          this.messageDialog = true
+          this.messageContent = resp.data.content
         }
       })
+    },
+    onCloseDialog() {
+      this.messageContent = ''
     }
   }
 }

+ 186 - 12
src/views/my/MyProfile.vue

@@ -4,7 +4,7 @@
       <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
         <el-card class="box-card">
           <div slot="header" class="clearfix">
-            <span>我的资料</span>
+            <span>我的帐号</span>
           </div>
           <div class="text item">
             <el-form ref="form" :model="loginUser" label-width="80px">
@@ -26,8 +26,8 @@
                 <el-input v-model="loginUser.mobile" style="width: 70%; padding-right: 10px" readonly />
                 <el-button size="mini" type="info" @click="showUpdateDialog(3)">更新</el-button>
               </el-form-item>
-              <el-form-item label="签名">
-                <el-input v-model="loginUser.signature" type="textarea" style="width: 70%; padding-right: 10px" readonly />
+              <el-form-item label="密码">
+                <el-input v-model="loginUser.mobile" style="width: 70%; padding-right: 10px" readonly />
                 <el-button size="mini" type="info" @click="showUpdateDialog(4)">更新</el-button>
               </el-form-item>
             </el-form>
@@ -61,6 +61,27 @@
         </el-card>
       </el-row>
     </el-col>
+    <el-col :md="8" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
+      <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
+        <el-card class="box-card">
+          <div slot="header" class="clearfix">
+            <span>我的资料</span>
+          </div>
+          <div class="text item">
+            <el-form ref="form" :model="loginUser" label-width="80px">
+              <el-form-item label="性别">
+                <el-input v-model="loginUser.mobile" style="width: 70%; padding-right: 10px" readonly />
+                <el-button size="mini" type="info" @click="showUpdateDialog(5)">更新</el-button>
+              </el-form-item>
+              <el-form-item label="签名">
+                <el-input v-model="loginUser.signature" type="textarea" style="width: 70%; padding-right: 10px" readonly />
+                <el-button size="mini" type="info" @click="showUpdateDialog(6)">更新</el-button>
+              </el-form-item>
+            </el-form>
+          </div>
+        </el-card>
+      </el-row>
+    </el-col>
 
     <el-dialog
       :title="updateTitle"
@@ -69,27 +90,130 @@
       width="30%"
       center
     >
-      <el-row>
-        <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-          <el-row>
-            <el-form :inline="true" :model="updateForm">
+      <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px; text-align: center">
+        <el-card class="box-card">
+          <div class="text item">
+            <el-form :model="updateForm">
               <el-form-item>
                 <el-input
                   v-model="updateForm.content"
+                  type="text"
+                  clearable
                 />
               </el-form-item>
               <el-form-item>
-                <el-button size="mini" type="warning" @click="onUpdate">更新</el-button>
+                <el-button
+                  type="primary"
+                  @click.native="onUpdate"
+                >更新</el-button>
               </el-form-item>
             </el-form>
-          </el-row>
-        </el-col>
+          </div>
+        </el-card>
+      </el-row>
+    </el-dialog>
+    <el-dialog
+      :title="updateTitle"
+      append-to-body
+      :visible.sync="updateEmailDialog"
+      width="30%"
+      center
+    >
+      <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px; text-align: center">
+        <el-card class="box-card">
+          <div class="text item">
+            <el-form ref="form" :model="updateEmailForm" label-width="100px">
+              <el-form-item label="邮箱/手机号" label-width="100px">
+                <el-input
+                  v-model="updateEmailForm.principal"
+                  placeholder="请输入邮箱或手机号"
+                  style="width: 45%; padding-right: 10px"
+                  clearable
+                />
+                <el-button :disabled="isBtn" @click="sendVerifyCode">{{ code }}</el-button>
+              </el-form-item>
+              <el-form-item label="验证码" label-width="90px">
+                <el-input
+                  v-model="updateEmailForm.verifyCode"
+                  placeholder="请输入短信验证码"
+                  style="padding-right: 1px"
+                  clearable
+                />
+              </el-form-item>
+              <el-form-item label="密码">
+                <el-input
+                  v-model="updateEmailForm.credential"
+                  type="password"
+                  placeholder="请输入密码"
+                  style="padding-right: 1px"
+                  clearable
+                />
+              </el-form-item>
+              <el-form-item>
+                <el-button
+                  type="primary"
+                  @click.native="updateUserEmail"
+                >更新</el-button>
+              </el-form-item>
+            </el-form>
+          </div>
+        </el-card>
+      </el-row>
+    </el-dialog>
+    <el-dialog
+      :title="updateTitle"
+      append-to-body
+      :visible.sync="updatePasswordDialog"
+      width="30%"
+      center
+    >
+      <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px; text-align: center">
+        <el-card class="box-card">
+          <div class="text item">
+            <el-form ref="form" :model="updatePasswordForm" label-width="100px">
+              <el-form-item label="当前密码">
+                <el-input
+                  v-model="updatePasswordForm.credential"
+                  type="password"
+                  placeholder="请输入当前密码"
+                  style="padding-right: 1px"
+                  clearable
+                />
+              </el-form-item>
+              <el-form-item label="新密码">
+                <el-input
+                  v-model="updatePasswordForm.credential"
+                  type="password"
+                  placeholder="请输入新密码"
+                  style="padding-right: 1px"
+                  clearable
+                />
+              </el-form-item>
+              <el-form-item label="确认新密码">
+                <el-input
+                  v-model="updatePasswordForm.credential"
+                  type="password"
+                  placeholder="请确认新密码"
+                  style="padding-right: 1px"
+                  clearable
+                />
+              </el-form-item>
+              <el-form-item>
+                <el-button
+                  type="primary"
+                  @click.native="updateUserPassword"
+                >更新</el-button>
+              </el-form-item>
+            </el-form>
+          </div>
+        </el-card>
       </el-row>
     </el-dialog>
   </el-row>
 </template>
 
 <script>
+import { userMixin } from 'assets/js/mixin'
 import { updateAvatar } from '@/api/account'
 import { getAuthedUser, updateAuthedUser } from '@/utils/auth'
 import { getAvatarChannelInfo } from '@/api/file'
@@ -97,6 +221,7 @@ import { updateUserProfile } from '@/api/user'
 
 export default {
   name: 'MyProfile',
+  mixins: [userMixin],
   data() {
     return {
       imgOssUrl: '',
@@ -115,6 +240,24 @@ export default {
       updateForm: {
         type: 1,
         content: null
+      },
+      updateEmailDialog: false,
+      updateEmailForm: {
+        principal: null,
+        verifyCode: null,
+        credential: null,
+        captchaCode: null,
+        channel: 1,
+        plat: 2
+      },
+      updatePasswordDialog: false,
+      updatePasswordForm: {
+        principal: null,
+        verifyCode: null,
+        credential: null,
+        captchaCode: null,
+        channel: 1,
+        plat: 2
       }
     }
   },
@@ -193,17 +336,28 @@ export default {
       if (type === 1) {
         this.updateType = 1
         this.updateTitle = '更新用户显示名'
+        this.updateDialog = true
       } else if (type === 2) {
         this.updateType = 2
         this.updateTitle = '更新用户邮箱'
+        this.updateEmailDialog = true
       } else if (type === 3) {
         this.updateType = 3
         this.updateTitle = '更新用户手机号'
+        this.updateEmailDialog = true
       } else if (type === 4) {
         this.updateType = 4
+        this.updateTitle = '更新用户密码'
+        this.updatePasswordDialog = true
+      } else if (type === 5) {
+        this.updateType = 5
+        this.updateTitle = '更新用户性别'
+        this.updateDialog = true
+      } else if (type === 6) {
+        this.updateType = 6
         this.updateTitle = '更新用户签名'
+        this.updateDialog = true
       }
-      this.updateDialog = true
     },
     onUpdate() {
       updateUserProfile(this.updateForm).then(resp => {
@@ -219,9 +373,29 @@ export default {
             duration: 3000
           })
         }
+      }).catch(error => {
+        this.$notify.error({
+          message: error.message,
+          duration: 3000
+        })
       })
 
-      this.updateDialog = false
+      if (this.updateType === 2 || this.updateType === 3) {
+        this.updateEmailDialog = false
+      } else {
+        this.updateDialog = false
+      }
+    },
+    sendVerifyCode() {
+      this.$message.info('发送验证码')
+    },
+    updateUserEmail() {
+      this.$message.info(this.updateEmailForm)
+      this.updateEmailDialog = false
+    },
+    updateUserPassword() {
+      this.$message.info(this.updatePasswordForm)
+      this.updatePasswordDialog = false
     }
   }
 }

+ 0 - 246
src/views/my/MyRealname.vue

@@ -1,246 +0,0 @@
-<template>
-  <el-main>
-    <el-row class="movie-list">
-      <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-        <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-          <el-card class="box-card">
-            <div slot="header" class="clearfix">
-              <span>实名认证资料</span>
-            </div>
-            <div class="text item">
-              <el-form ref="form" :model="loginUser" label-width="90px">
-                <el-form-item label="身份证号码">
-                  <el-input v-model="loginUser.userId" style="padding-right: 1px" readonly />
-                </el-form-item>
-                <el-form-item label="姓名">
-                  <el-input v-model="loginUser.screenName" style="padding-right: 1px" readonly />
-                </el-form-item>
-                <el-form-item label="出生日期">
-                  <el-input v-model="loginUser.screenName" style="padding-right: 1px" readonly />
-                </el-form-item>
-                <el-form-item label="居住地址">
-                  <el-input v-model="loginUser.screenName" style="padding-right: 1px" readonly />
-                </el-form-item>
-              </el-form>
-            </div>
-          </el-card>
-        </el-row>
-      </el-col>
-      <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-        <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-          <el-card class="box-card">
-            <div slot="header" class="clearfix">
-              <span>手持身份证照</span>
-            </div>
-            <div class="text item">
-              <el-tooltip class="item" effect="dark" content="点击更新我的头像" placement="top-end">
-                <el-upload
-                  class="avatar-uploader"
-                  :action="imgOssUrl"
-                  :headers="imgHeaders"
-                  :data="imgData"
-                  :with-credentials="true"
-                  :show-file-list="false"
-                  :before-upload="beforeAvatarUpload"
-                  :on-success="handleAvatarSuccess"
-                >
-                  <img v-if="loginUser" :src="loginUser.avatarUrl" class="avatar">
-                  <i v-else class="el-icon-plus avatar-uploader-icon" />
-                </el-upload>
-              </el-tooltip>
-            </div>
-          </el-card>
-        </el-row>
-      </el-col>
-    </el-row>
-    <el-row class="movie-list">
-      <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-        <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-          <el-card class="box-card">
-            <div slot="header" class="clearfix">
-              <span>身份证背面照</span>
-            </div>
-            <div class="text item">
-              <el-tooltip class="item" effect="dark" content="点击更新我的头像" placement="top-end">
-                <el-upload
-                  class="avatar-uploader"
-                  :action="imgOssUrl"
-                  :headers="imgHeaders"
-                  :data="imgData"
-                  :with-credentials="true"
-                  :show-file-list="false"
-                  :before-upload="beforeAvatarUpload"
-                  :on-success="handleAvatarSuccess"
-                >
-                  <img v-if="loginUser" :src="loginUser.avatarUrl" class="avatar">
-                  <i v-else class="el-icon-plus avatar-uploader-icon" />
-                </el-upload>
-              </el-tooltip>
-            </div>
-          </el-card>
-        </el-row>
-      </el-col>
-      <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-        <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-          <el-card class="box-card">
-            <div slot="header" class="clearfix">
-              <span>身份证反面照</span>
-            </div>
-            <div class="text item">
-              <el-tooltip class="item" effect="dark" content="点击更新我的头像" placement="top-end">
-                <el-upload
-                  class="avatar-uploader"
-                  :action="imgOssUrl"
-                  :headers="imgHeaders"
-                  :data="imgData"
-                  :with-credentials="true"
-                  :show-file-list="false"
-                  :before-upload="beforeAvatarUpload"
-                  :on-success="handleAvatarSuccess"
-                >
-                  <img v-if="loginUser" :src="loginUser.avatarUrl" class="avatar">
-                  <i v-else class="el-icon-plus avatar-uploader-icon" />
-                </el-upload>
-              </el-tooltip>
-            </div>
-          </el-card>
-        </el-row>
-      </el-col>
-    </el-row>
-  </el-main>
-</template>
-
-<script>
-import { getServerInfo } from '@/api/content'
-import { updateAvatar } from '@/api/account'
-import { getAuthedUser, updateAuthedUser } from '@/utils/auth'
-import {getAvatarChannelInfo} from "@/api/file";
-
-export default {
-  name: 'MyRealname',
-  data() {
-    return {
-      imgOssUrl: '',
-      imgHeaders: {
-        Authorization: ''
-      },
-      imgData: {
-        channelId: 0
-      },
-      coverUrl: null,
-      // ****************************************************************************************************************
-      loginUser: null
-    }
-  },
-  created() {
-    document.title = '我的实名认证'
-    this.loginUser = getAuthedUser()
-
-    getAvatarChannelInfo().then(res => {
-      if (res.code === 0) {
-        const resData = res.data
-        this.imgData.channelId = resData.channelId
-        this.imgOssUrl = resData.ossUrl
-        this.imgHeaders.Authorization = 'Bearer ' + resData.token
-      } else {
-        this.$notify({
-          title: '提示',
-          message: '获取 OSS 服务器地址失败, 暂时无法上传文件',
-          type: 'error',
-          duration: 3000
-        })
-      }
-    }).catch(error => {
-      this.$notify({
-        title: '提示',
-        message: error.message,
-        type: 'warning',
-        duration: 3000
-      })
-    })
-  },
-  mounted() {
-  },
-  methods: {
-    // ****************************************************************************************************************
-    beforeAvatarUpload(file) {
-      const isJPG = file.type === 'image/jpeg'
-      const isLt2M = file.size / 1024 / 1024 < 2
-      if (!isJPG) {
-        this.$message.error('头像文件只能是 JPG 格式!')
-      }
-      if (!isLt2M) {
-        this.$message.error('头像文件大小不能超过 2MB!')
-      }
-      return isJPG && isLt2M
-    },
-    handleAvatarSuccess(res, file) {
-      if (res.code === 0) {
-        const resData = res.data
-        this.coverUrl = URL.createObjectURL(file.raw)
-
-        const avatar = {}
-        avatar.channelId = this.imgData.channelId
-        avatar.uploadId = resData.uploadId
-        updateAvatar(avatar).then(resp => {
-          if (resp.code === 0) {
-            this.loginUser.avatarUrl = resp.data.url
-            updateAuthedUser(this.loginUser)
-          } else {
-            this.$notify({
-              title: '头像更新失败',
-              message: resp.msg,
-              type: 'warning',
-              duration: 3000
-            })
-          }
-        })
-      } else {
-        this.$notify({
-          title: '提示',
-          message: '头像上传失败,请重试!' + res.msg,
-          type: 'warning',
-          duration: 3000
-        })
-      }
-    }
-    // ****************************************************************************************************************
-  }
-}
-</script>
-
-<style>
-.uploader-example .uploader-btn {
-  margin-right: 4px;
-}
-.uploader-example .uploader-list {
-  max-height: 440px;
-  overflow: auto;
-  overflow-x: hidden;
-  overflow-y: auto;
-}
-
-.avatar-uploader .el-upload {
-  border: 1px dashed #d9d9d9;
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-}
-.avatar-uploader .el-upload:hover {
-  border-color: #409EFF;
-}
-.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 256px;
-  height: 256px;
-  line-height: 178px;
-  text-align: center;
-}
-.avatar {
-  width: 256px;
-  height: 256px;
-  display: block;
-}
-</style>

+ 2 - 2
src/views/my/MyVip.vue

@@ -25,7 +25,7 @@
         <StampBadge
           size="small"
           color="warning"
-          content="会员"
+          content="会员"
           :rotate="0"
         />
       </div>
@@ -44,7 +44,7 @@
       title="小会员计划"
       append-to-body
       :visible.sync="planDialog"
-      width="70%"
+      width="50%"
       center
     >
       <el-form ref="form" :model="planForm">