登录添加查询日志状态

dev_2022-04-07
yujialong 3 years ago
parent 35075caac7
commit 67c0225b70
  1. 1
      src/api/index.js
  2. BIN
      src/assets/img/update.png
  3. 2
      src/layouts/navbar/index.vue
  4. 68
      src/pages/account/login/index.vue
  5. 2
      src/setting.js

@ -10,6 +10,7 @@ export default {
getTopList: `${Setting.cryptoBaseURL}currency/market/getTopList`, getTopList: `${Setting.cryptoBaseURL}currency/market/getTopList`,
platformLogList: `/nakadai/log/platformLogList`, platformLogList: `/nakadai/log/platformLogList`,
logNotification: `/nakadai/log/logNotification`,
// 公用接口 // 公用接口
queryProvince: `/nakadai/nakadai/province/queryProvince`, queryProvince: `/nakadai/nakadai/province/queryProvince`,
queryCity: `/nakadai/nakadai/city/queryCity`, queryCity: `/nakadai/nakadai/city/queryCity`,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

@ -25,7 +25,7 @@ export default {
title: '数据看板' title: '数据看板'
}, { }, {
index: "/log/list", index: "/log/list",
title: "最近更新" title: "更新日志"
}], }],
// //
dataMenu: { dataMenu: {

@ -53,11 +53,12 @@
</template> </template>
<script> <script>
import { mapActions } from 'vuex' import { mapMutations, mapActions } from 'vuex'
import vHead from '@/layouts/header' import vHead from '@/layouts/header'
import util from '@/libs/util' import util from '@/libs/util'
import Setting from '@/setting' import Setting from '@/setting'
import vFooter from '@/layouts/footer' import vFooter from '@/layouts/footer'
import axios from 'axios'
export default { export default {
data: function() { data: function() {
return { return {
@ -76,13 +77,16 @@ export default {
account: '', account: '',
password: '', password: '',
random: '', random: '',
code: '' code: '',
type: 2, // 0-> 1-> 2->
platform: Setting.platformId, // id(1. 2. 3.)
}, },
rules: { rules: {
account: [{ required: true, message: '请输入账号', trigger: 'blur' }], account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }], password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
code: [{ required: true, message: '请输入验证码', trigger: 'blur' }], code: [{ required: true, message: '请输入验证码', trigger: 'blur' }],
}, },
token: '',
phoneVisible: false, phoneVisible: false,
phone: '', phone: '',
phoneCode: '', phoneCode: '',
@ -96,6 +100,9 @@ export default {
this.getVerImg() this.getVerImg()
}, },
methods: { methods: {
...mapMutations("user", [
'SET_CUSTOMERNAME', 'SET_CUSTOMER', 'SET_INFO'
]),
...mapActions('user', [ ...mapActions('user', [
'login','setCustomer' 'login','setCustomer'
]), ]),
@ -105,18 +112,48 @@ export default {
this.$refs.login.clearValidate() this.$refs.login.clearValidate()
this.rules.account[0].message = item.id == 1 ? '请输入账号' : '请输入手机号/邮箱' this.rules.account[0].message = item.id == 1 ? '请输入账号' : '请输入手机号/邮箱'
}, },
//
setLogin() {
window.opener && window.opener.location.reload() //
util.local.set(Setting.tokenKey, this.token, Setting.tokenExpires)
//
this.$get(this.api.isClient).then(res => {
//
this.SET_CUSTOMER(res.customer)
const userName = res.customerName
userName && this.SET_INFO({
userName
})
}).catch(res => {})
// schoolId
this.$post(this.api.getSchoolIdByToken).then(res => {
this.SET_INFO(res)
}).catch(res => {})
// +1
this.$post(this.api.saveRecord,{
type: 3,
}).then(res => {}).catch(res => {})
// true
this.$get(this.api.logNotification).then(res => {
const history = this.$route.query.redirect
const redirect = res.notification ?
'/log' :
history ?
decodeURIComponent(history) :
'/index'
util.successMsg('登录成功')
this.$router.replace(redirect)
}).catch(res => {})
},
submitForm() { submitForm() {
this.$refs.login.validate(valid => { this.$refs.login.validate(valid => {
if (valid) { if (valid) {
this.login(this.form).then(() => { this.$post(this.api.logins, this.form).then(res => {
window.opener && window.opener.location.reload() // this.token = res.data.token
let redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : '/index' this.setLogin()
this.$router.replace(redirect)
}).catch(res => { }).catch(res => {
// //
if(res && res.status == 30001){ if (res && res.status == 30001) this.phoneVisible = true
this.phoneVisible = true
}
this.getVerImg() this.getVerImg()
this.form.code = '' this.form.code = ''
}) })
@ -178,18 +215,7 @@ export default {
util.successMsg('绑定成功') util.successMsg('绑定成功')
this.form.phone = this.phone this.form.phone = this.phone
this.phoneVisible = false this.phoneVisible = false
// this.setLogin()
this.$get(this.api.isClient).then(res => {
this.setCustomer(res.customer)
}).catch(res => {})
util.local.set(Setting.tokenKey,res.token,43200000)
util.successMsg('登录成功')
setTimeout(() => {
this.$post(this.api.saveRecord,{
type: 3,
}).then(res => {}).catch(res => {})
},3000)
this.$router.push('/index/list')
}).catch(res => {}) }).catch(res => {})
}, },
}, },

@ -25,7 +25,7 @@ const Setting = {
* 正式http://www.dataforward.cn:9000 * 正式http://www.dataforward.cn:9000
* */ * */
// apiBaseURL: env === 'development' ? 'http://192.168.31.151:9000' : 'http://39.108.250.202:9000', // apiBaseURL: env === 'development' ? 'http://192.168.31.151:9000' : 'http://39.108.250.202:9000',
apiBaseURL: env === 'development' ? 'http://192.168.31.151:9000' : `${location.origin}:9000`, apiBaseURL: env === 'development' ? 'http://39.108.250.202:9000' : `${location.origin}:9000`,
// 加密货币接口地址 // 加密货币接口地址
cryptoBaseURL: `http://159.138.53.111/`, cryptoBaseURL: `http://159.138.53.111/`,
// 接口请求返回错误时,弹窗的持续时间,单位:秒 // 接口请求返回错误时,弹窗的持续时间,单位:秒

Loading…
Cancel
Save