优化
This commit is contained in:
parent
f273070ace
commit
e2b4e1a03b
@ -23,7 +23,7 @@
|
||||
"svg-sprite-loader": "^5.0.0",
|
||||
"vconsole": "^3.3.4",
|
||||
"vue": "^2.5.2",
|
||||
"vue-cookie": "^1.1.4",
|
||||
"vue-cookies": "^1.7.4",
|
||||
"vue-router": "^3.0.1",
|
||||
"vuedraggable": "^2.24.2",
|
||||
"vuex": "^3.5.1"
|
||||
@ -85,7 +85,6 @@
|
||||
"uglifyjs-webpack-plugin": "^1.1.1",
|
||||
"url-loader": "^0.5.8",
|
||||
"vconsole": "^3.3.4",
|
||||
"vue-cookie": "^1.1.4",
|
||||
"vue-jest": "^1.0.2",
|
||||
"vue-loader": "^13.3.0",
|
||||
"vue-style-loader": "^3.0.1",
|
||||
|
||||
38
src/App.vue
38
src/App.vue
@ -6,7 +6,8 @@
|
||||
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
|
||||
import * as dd from 'dingtalk-jsapi'
|
||||
import { apiDingtalkLogin } from '@/api/login'
|
||||
export default {
|
||||
name: 'App',
|
||||
data () {
|
||||
@ -17,11 +18,42 @@ export default {
|
||||
computed: {
|
||||
...mapState(['user'])
|
||||
},
|
||||
mounted () {
|
||||
async mounted () {
|
||||
this.$cookies.set('token', '123', 60)
|
||||
this.GET_DEPLIST()
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['GET_DEPLIST'])
|
||||
...mapActions(['GET_DEPLIST']),
|
||||
// 获取钉钉鉴权码
|
||||
handleGetDingtalkCode () {
|
||||
let _this = this
|
||||
dd.runtime.permission.requestAuthCode({
|
||||
corpId: 'ding267474e759bbca1c35c2f4657eb6378f',
|
||||
onSuccess (res) {
|
||||
console.log('result===', res)
|
||||
_this.handleDingtalkLogin(res)
|
||||
_this.dingCode = res
|
||||
},
|
||||
onFail (err) {
|
||||
console.log('err===', err)
|
||||
_this.dingCode = err
|
||||
}
|
||||
})
|
||||
},
|
||||
// 钉钉免登录
|
||||
handleDingtalkLogin (val) {
|
||||
apiDingtalkLogin(val).then(res => {
|
||||
if (res && res.code === 0) {
|
||||
this.$cookie.set('token', res.token)
|
||||
this.dataForm.verify = '登录成功,跳转中...'
|
||||
window.open(window.location.protocol + '//' + window.location.host + '/digitization/kpi/workbench/home?code=' + this.dingCode.code)
|
||||
} else {
|
||||
this.dataForm.verify = '身份验证失败' + res.msg
|
||||
this.$message.error(this.dataForm.verify)
|
||||
this.$router.replace({ name: 'dingTalkLogin' })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -16,3 +16,21 @@ export function getDimensions (quer = {}) {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 登陆
|
||||
export function apiLogin (query = {}) {
|
||||
return request({
|
||||
url: '/lz_management/sys/login',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
// 发送验证码
|
||||
export function apiSendSMS (query = {}) {
|
||||
return request({
|
||||
url: 'lz_management/sys/sendSMS',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
@ -9,17 +9,17 @@ import './utils/permission'
|
||||
import './style/index.less'
|
||||
import '@/icons'
|
||||
import VConsole from 'vconsole'
|
||||
import VueCookie from 'vue-cookie'
|
||||
import VueCookie from 'vue-cookies'
|
||||
import {debounce, departGetForm, personlGetForm, handleInput} from '@/utils/common'
|
||||
import { format } from '@/utils/dateFormat'
|
||||
|
||||
let hostList = ['lzmanagement.ldxinyong.com']
|
||||
if (!hostList.includes(window.location.host)) {
|
||||
// let hostList = ['lzmanagement.ldxinyong.com']
|
||||
// if (!hostList.includes(window.location.host)) {
|
||||
var vConsole = new VConsole({
|
||||
vConsole_switch_x: 0,
|
||||
vConsole_switch_y: 0
|
||||
})
|
||||
}
|
||||
// }
|
||||
|
||||
Vue.use(VueCookie)
|
||||
Vue.config.productionTip = false
|
||||
|
||||
@ -38,7 +38,8 @@ service.interceptors.request.use(config => {
|
||||
// if (getToken() && !isToken) {
|
||||
// config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
// }
|
||||
config.headers['token'] = Vue.cookie.get('token') || ''
|
||||
console.log(' Vue.cookies: ', Vue.$cookies)
|
||||
config.headers['token'] = Vue.$cookies.get('token') || ''
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
import report from './report'
|
||||
import tableItem from '../todo/tableItem'
|
||||
import { apiGetWaitList } from '@/api/toDo'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
|
||||
@ -2,26 +2,74 @@
|
||||
<template>
|
||||
<div>
|
||||
<router-view></router-view>
|
||||
<div @dblclick="handleClick" class="hide">
|
||||
|
||||
</div>
|
||||
<div v-if="!islzmanagement && isShow" class="login">
|
||||
<el-input
|
||||
style="width:400px;"
|
||||
placeholder="请输入内容"
|
||||
v-model="input"
|
||||
clearable>
|
||||
</el-input>
|
||||
<el-button @click="handleLogin" type="primary">登 陆</el-button>
|
||||
<!-- <div style="margin:20px 0;">
|
||||
<el-input
|
||||
style="width:400px;"
|
||||
placeholder="请输入内容"
|
||||
v-model="verify"
|
||||
clearable>
|
||||
</el-input>
|
||||
<el-button @click="handleVerify" type="primary">获取验证码</el-button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { apiLogin, apiSendSMS } from '@/api/data'
|
||||
let hostList = 'lzmanagement.ldxinyong.com'
|
||||
let thostList = 'tlzmanagement.ldxinyong.com'
|
||||
const islzmanagement = window.location.host.indexOf('hostList') > -1 && window.location.host.indexOf('hostList') < 0
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
|
||||
isShow: true,
|
||||
islzmanagement,
|
||||
input: '',
|
||||
verify: '888888'
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
beforeMount () {},
|
||||
mounted () {},
|
||||
methods: {},
|
||||
methods: {
|
||||
handleClick () {
|
||||
this.isShow = !this.isShow
|
||||
},
|
||||
// async handleVerify () {
|
||||
// const params = {'userName': this.input, 'password': 'admin', 'uuid': '', 'verify': this.verify, 'verifyCode': this.verify}
|
||||
// let res = await apiSendSMS(params)
|
||||
// console.log('res: ', res)
|
||||
// },
|
||||
async handleLogin () {
|
||||
const params = {'userName': this.input, 'password': 'admin', 'uuid': '', 'verify': this.verify, 'verifyCode': this.verify}
|
||||
let res = await apiLogin(params)
|
||||
console.log('res: ', res)
|
||||
}
|
||||
},
|
||||
watch: {}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang='' scoped>
|
||||
|
||||
<style lang='less' scoped>
|
||||
.login{
|
||||
margin: 20px 0;
|
||||
}
|
||||
.hide{
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user