Parcourir la source

添加一些兼容ios上架需求

wzh il y a 2 ans
Parent
commit
780276c574
8 fichiers modifiés avec 52 ajouts et 11 suppressions
  1. 6 0
      api/login.js
  2. 1 0
      config.js
  3. 8 1
      locale/en.json
  4. 4 3
      manifest.json
  5. 10 0
      pages/mine/pwd/index.vue
  6. 16 1
      store/modules/user.js
  7. 1 1
      utils/request.js
  8. 6 5
      utils/upload.js

+ 6 - 0
api/login.js

@@ -58,6 +58,12 @@ export function logout() {
   })
 }
 
+export function deleteUser(){
+  return request({
+    'url': '/deleteUser',
+    'method': 'post'
+  })
+}
 
 // // 获取验证码
 // export function getCodeImg() {

+ 1 - 0
config.js

@@ -1,6 +1,7 @@
 // 应用全局配置
 module.exports = {
   //baseUrl: 'https://vue.ruoyi.vip/prod-api',
+  //baseUrl: 'https://ev.weguyun.com',
   baseUrl: 'https://ev.weguyun.com',
   socketUrl: 'ws://ev.weguyun.com/websocket',
   imgUrl:'/static/images/new/start',

+ 8 - 1
locale/en.json

@@ -136,7 +136,14 @@
     "正在重置中,请稍等...": "Reseting pease wait",
     "查看状态": "Watch status",
     "忘记序列号": "Forget device no",
-    "请截图该页面联系售后部门": "Please take a screenshot of this page and contact the after-sales department"
+    "请截图该页面联系售后部门": "Please take a screenshot of this page and contact the after-sales department",
+    "用户不存在/密码错误": "User does not exist/Incorrect password.",
+    "后端接口连接异常": "Backend API connection exception.",
+    "系统接口请求超时": "System API request timed out.",
+    "登录状态已过期,您可以继续留在该页面,或者重新登录?": "The login session has expired, you can continue staying on this page, or log in again?",
+    "无效的会话,或者会话已过期,请重新登录。": "Invalid session, or session has expired, please log in again.",
+    "注销账号": "Delete account",
+    "确定删除账号吗?": "Are you sure you want to delete the account?"
   },
   "locale.auto": "System",
   "locale.en": "English",

+ 4 - 3
manifest.json

@@ -2,8 +2,8 @@
     "name" : "WeGoodCharger",
     "appid" : "__UNI__60E8019",
     "description" : "",
-    "versionName" : "1.0.7",
-    "versionCode" : 107,
+    "versionName" : "1.0.9",
+    "versionCode" : 109,
     "transformPx" : false,
     "app-plus" : {
         "usingComponents" : true,
@@ -45,7 +45,8 @@
                 ]
             },
             "ios" : {
-                "dSYMs" : false
+                "dSYMs" : false,
+                "idfa" : false
             },
             "sdkConfigs" : {
                 "ad" : {},

+ 10 - 0
pages/mine/pwd/index.vue

@@ -12,6 +12,9 @@
       </uni-forms-item>
       <button type="primary" style="background: #0E9F9B;color: white" @click="submit">{{i18('提交')}}</button>
 
+      <view style="bottom: 80px;position: absolute;left: 10px;right:10px">
+        <button type="warn"  @click="" style="background: #0E9F9B;color: white" @click="deleteUser">{{i18('注销账号')}}</button>
+      </view>
       <view style="bottom: 10px;position: absolute;left: 10px;right:10px">
         <button type="warn"  @click="" style="background: #0E9F9B;color: white" @click="handleLogout">{{i18('退出登录')}}</button>
       </view>
@@ -87,6 +90,13 @@
             this.$tab.reLaunch('/pages/index')
           })
         })
+      },
+      deleteUser() {
+        this.$modal.confirm('确定删除账号吗?').then(() => {
+          this.$store.dispatch('DeleteUser').then(() => {
+            this.$tab.reLaunch('/pages/index')
+          })
+        })
       }
     }
   }

+ 16 - 1
store/modules/user.js

@@ -1,7 +1,7 @@
 import config from '@/config'
 import storage from '@/utils/storage'
 import constant from '@/utils/constant'
-import { login, logout, getInfo, register} from '@/api/login'
+import { login, logout, getInfo, register,deleteUser} from '@/api/login'
 import { getToken, setToken, removeToken } from '@/utils/auth'
 
 const baseUrl = config.baseUrl
@@ -107,6 +107,21 @@ const user = {
           reject(error)
         })
       })
+    },
+    // 退出系统
+    DeleteUser({ commit, state }) {
+      return new Promise((resolve, reject) => {
+        deleteUser().then(() => {
+          commit('SET_TOKEN', '')
+          commit('SET_ROLES', [])
+          commit('SET_PERMISSIONS', [])
+          removeToken()
+          storage.clean()
+          resolve()
+        }).catch(error => {
+          reject(error)
+        })
+      })
     }
   }
 }

+ 1 - 1
utils/request.js

@@ -51,7 +51,7 @@ const request = config => {
           })
           reject(i18('无效的会话,或者会话已过期,请重新登录。'))
         } else if (code === 500) {
-          toast(msg)
+          toast(i18(msg))
           reject('500')
         } else if (code !== 200) {
           toast(msg)

+ 6 - 5
utils/upload.js

@@ -3,6 +3,7 @@ import config from '@/config'
 import { getToken } from '@/utils/auth'
 import errorCode from '@/utils/errorCode'
 import { toast, showConfirm, tansParams } from '@/utils/common'
+import i18 from '@/utils/i18.js'
 
 let timeout = 10000
 const baseUrl = config.baseUrl
@@ -35,14 +36,14 @@ const upload = config => {
           if (code === 200) {
             resolve(result)
           } else if (code == 401) {
-            showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => {
+            showConfirm(i18("登录状态已过期,您可以继续留在该页面,或者重新登录?")).then(res => {
               if (res.confirm) {
                 store.dispatch('LogOut').then(res => {
                   uni.reLaunch({ url: '/pages/login/login' })
                 })
               }
             })
-            reject('无效的会话,或者会话已过期,请重新登录。')
+            reject(i18('无效的会话,或者会话已过期,请重新登录。'))
           } else if (code === 500) {
             toast(msg)
             reject('500')
@@ -54,11 +55,11 @@ const upload = config => {
         fail: (error) => {
           let { message } = error
           if (message == 'Network Error') {
-            message = '后端接口连接异常'
+            message = i18('后端接口连接异常')
           } else if (message.includes('timeout')) {
-            message = '系统接口请求超时'
+            message = i18('系统接口请求超时')
           } else if (message.includes('Request failed with status code')) {
-            message = '系统接口' + message.substr(message.length - 3) + '异常'
+            message = 'System API' + message.substr(message.length - 3) + 'Exception'
           }
           toast(message)
           reject(error)