优化
This commit is contained in:
parent
f273070ace
commit
e2b4e1a03b
@ -23,7 +23,7 @@
|
|||||||
"svg-sprite-loader": "^5.0.0",
|
"svg-sprite-loader": "^5.0.0",
|
||||||
"vconsole": "^3.3.4",
|
"vconsole": "^3.3.4",
|
||||||
"vue": "^2.5.2",
|
"vue": "^2.5.2",
|
||||||
"vue-cookie": "^1.1.4",
|
"vue-cookies": "^1.7.4",
|
||||||
"vue-router": "^3.0.1",
|
"vue-router": "^3.0.1",
|
||||||
"vuedraggable": "^2.24.2",
|
"vuedraggable": "^2.24.2",
|
||||||
"vuex": "^3.5.1"
|
"vuex": "^3.5.1"
|
||||||
@ -85,7 +85,6 @@
|
|||||||
"uglifyjs-webpack-plugin": "^1.1.1",
|
"uglifyjs-webpack-plugin": "^1.1.1",
|
||||||
"url-loader": "^0.5.8",
|
"url-loader": "^0.5.8",
|
||||||
"vconsole": "^3.3.4",
|
"vconsole": "^3.3.4",
|
||||||
"vue-cookie": "^1.1.4",
|
|
||||||
"vue-jest": "^1.0.2",
|
"vue-jest": "^1.0.2",
|
||||||
"vue-loader": "^13.3.0",
|
"vue-loader": "^13.3.0",
|
||||||
"vue-style-loader": "^3.0.1",
|
"vue-style-loader": "^3.0.1",
|
||||||
|
|||||||
38
src/App.vue
38
src/App.vue
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapActions } from 'vuex'
|
import { mapState, mapActions } from 'vuex'
|
||||||
|
import * as dd from 'dingtalk-jsapi'
|
||||||
|
import { apiDingtalkLogin } from '@/api/login'
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
data () {
|
data () {
|
||||||
@ -17,11 +18,42 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState(['user'])
|
...mapState(['user'])
|
||||||
},
|
},
|
||||||
mounted () {
|
async mounted () {
|
||||||
|
this.$cookies.set('token', '123', 60)
|
||||||
this.GET_DEPLIST()
|
this.GET_DEPLIST()
|
||||||
},
|
},
|
||||||
methods: {
|
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>
|
</script>
|
||||||
|
|||||||
@ -16,3 +16,21 @@ export function getDimensions (quer = {}) {
|
|||||||
method: 'get'
|
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 './style/index.less'
|
||||||
import '@/icons'
|
import '@/icons'
|
||||||
import VConsole from 'vconsole'
|
import VConsole from 'vconsole'
|
||||||
import VueCookie from 'vue-cookie'
|
import VueCookie from 'vue-cookies'
|
||||||
import {debounce, departGetForm, personlGetForm, handleInput} from '@/utils/common'
|
import {debounce, departGetForm, personlGetForm, handleInput} from '@/utils/common'
|
||||||
import { format } from '@/utils/dateFormat'
|
import { format } from '@/utils/dateFormat'
|
||||||
|
|
||||||
let hostList = ['lzmanagement.ldxinyong.com']
|
// let hostList = ['lzmanagement.ldxinyong.com']
|
||||||
if (!hostList.includes(window.location.host)) {
|
// if (!hostList.includes(window.location.host)) {
|
||||||
var vConsole = new VConsole({
|
var vConsole = new VConsole({
|
||||||
vConsole_switch_x: 0,
|
vConsole_switch_x: 0,
|
||||||
vConsole_switch_y: 0
|
vConsole_switch_y: 0
|
||||||
})
|
})
|
||||||
}
|
// }
|
||||||
|
|
||||||
Vue.use(VueCookie)
|
Vue.use(VueCookie)
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|||||||
@ -38,7 +38,8 @@ service.interceptors.request.use(config => {
|
|||||||
// if (getToken() && !isToken) {
|
// if (getToken() && !isToken) {
|
||||||
// config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
// 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
|
return config
|
||||||
}, error => {
|
}, error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
import report from './report'
|
import report from './report'
|
||||||
import tableItem from '../todo/tableItem'
|
import tableItem from '../todo/tableItem'
|
||||||
import { apiGetWaitList } from '@/api/toDo'
|
import { apiGetWaitList } from '@/api/toDo'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -2,26 +2,74 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<router-view></router-view>
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
isShow: true,
|
||||||
|
islzmanagement,
|
||||||
|
input: '',
|
||||||
|
verify: '888888'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
beforeMount () {},
|
beforeMount () {},
|
||||||
mounted () {},
|
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: {}
|
watch: {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='' scoped>
|
<style lang='less' scoped>
|
||||||
|
.login{
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
.hide{
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user