Forráskód Böngészése

登录调整 状态调整

James 4 éve
szülő
commit
d0f3019e4e
5 módosított fájl, 36 hozzáadás és 30 törlés
  1. 4 4
      build/webpack.dev.conf.js
  2. 8 7
      src/config/data.js
  3. 17 16
      src/pages/login/index.vue
  4. 4 0
      src/router/index.js
  5. 3 3
      src/util/http.js

+ 4 - 4
build/webpack.dev.conf.js

@@ -44,16 +44,16 @@ const devWebpackConfig = merge(baseWebpackConfig, {
       poll: config.dev.poll,
     },
     proxy: {
-      '/api/sso/user/login': {
-        target: 'https://test.4dkankan.com',
+      '/admin/login': {
+        target: 'http://192.168.0.245:8010/',
         changeOrigin: true,
       },
       '/manage/scene':{
-        target: 'http://192.168.0.135:8010',
+        target: 'http://192.168.0.245:8010/',
         changeOrigin: true,
       },
       '/download':{
-        target: 'http://192.168.0.135:8010',
+        target: 'http://192.168.0.245:8010/',
         changeOrigin: true,
         pathRewrite:{
           '/download':''

+ 8 - 7
src/config/data.js

@@ -1,9 +1,10 @@
 export const MANAGE_SCENE_STATUS = {
-        0:'下载中',
-        1:'下载完成(mp数据转换中)',
-        2:'mp数据转换完成',
-        3:'模型数据转换中',
-        4:'模型数据转换完成',
-        5:'全景图数据转换中',
-        6:'全景图数据转换完成'
+        '-1':"下载失败",
+        '0':'下载中',
+        '1':'下载完成(mp数据转换中)',
+        '2':'mp数据转换完成',
+        '3':'模型数据转换中',
+        '4':'模型数据转换完成',
+        '5':'全景图数据转换中',
+        '6':'全景图数据转换完成'
 }

+ 17 - 16
src/pages/login/index.vue

@@ -24,11 +24,11 @@
               label-width="100px"
               class="demo-ruleForm"
             >
-              <el-form-item prop="phoneNum">
+              <el-form-item prop="userName">
                 <el-input
-                  type="phoneNum"
-                  placeholder="手机号码"
-                  v-model="ruleForm2.phoneNum"
+                  type="userName"
+                  placeholder="用户名"
+                  v-model="ruleForm2.userName"
                   auto-complete="off"
                 ></el-input>
               </el-form-item>
@@ -75,9 +75,9 @@ export default {
   data () {
     var validateUser = (rule, value, callback) => {
       if (!value) {
-        return callback(new Error('手机号码不能为空'))
+        return callback(new Error('用户名不能为空'))
       } else if (value.length < 3) {
-        callback(new Error('手机号码不合法'))
+        callback(new Error('用户名不合法'))
       } else {
         callback()
       }
@@ -97,11 +97,11 @@ export default {
       fullscreenLoading: false,
       checked: true,
       ruleForm2: {
-        phoneNum: '',
+        userName: '',
         pass: ''
       },
       rules2: {
-        phoneNum: [
+        userName: [
           {
             validator: validateUser,
             trigger: 'blur'
@@ -118,16 +118,17 @@ export default {
   },
 
   mounted () {
-    this.ruleForm2.phoneNum = window.localStorage.getItem('cjt_phoneNum') || ''
+    this.ruleForm2.userName = window.localStorage.getItem('cjt_userName') || ''
     this.ruleForm2.pass = window.localStorage.getItem('cjt_pass') || ''
   },
   methods: {
     async login () {
-      let {phoneNum, pass} = this.ruleForm2
+      let {userName, pass} = this.ruleForm2
       this.fullscreenLoading = true
-      let res = await this.$http.post('/api/sso/user/login', {
-        phoneNum,
-        password: encodeStr(Base64.encode(pass)),
+      let res = await this.$http.post('/admin/login', {
+        userName,
+        // password: encodeStr(Base64.encode(pass)),
+        password: pass,
       })
       this.fullscreenLoading = false
       if (res.code === 0) {
@@ -135,12 +136,12 @@ export default {
         window.localStorage.setItem('cjt_token', data.token)
         if (this.checked) {
           window.localStorage.setItem(
-            'cjt_phoneNum',
-            phoneNum
+            'cjt_userName',
+            userName
           )
           window.localStorage.setItem('cjt_pass', pass)
         } else {
-          window.localStorage.setItem('cjt_phoneNum', '')
+          window.localStorage.setItem('cjt_userName', '')
           window.localStorage.setItem('cjt_pass', '')
         }
         this.$router.push('/list')

+ 4 - 0
src/router/index.js

@@ -9,6 +9,10 @@ Vue.use(Router)
 let router = new Router({
   routes: [
     {
+      path:'/',
+      redirect:'/list'
+    },
+    {
       path: '/list',
       name: 'List',
       component: List

+ 3 - 3
src/util/http.js

@@ -3,11 +3,11 @@ import Vue from 'vue'
 import router from '../router'
 
 var isProduction = process.env.NODE_ENV === 'production'
-const serverName = isProduction ? '' : ''
-// const serverName = isProduction ? '' : 'http://192.168.0.135:8105'
+// const serverName = isProduction ? '' : ''
+const serverName = isProduction ? 'http://192.168.0.245:8010' : ''
 
 const vue = new Vue()
-const notTokenApis = ['/api/sso/user/login']
+const notTokenApis = ['/admin/login']
 axios.defaults.baseURL = serverName
 axios.defaults.headers['X-Requested-with'] = 'XMLHttpRequest'