This commit is contained in:
熊成强 2020-11-09 12:00:37 +08:00
parent d03fa9eef9
commit d68b14233a
7 changed files with 37 additions and 51 deletions

View File

@ -6,7 +6,7 @@
<script> <script>
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
// import * as dd from 'dingtalk-jsapi' import * as dd from 'dingtalk-jsapi'
import { apiDingtalkLogin, apiUserInfo } from '@/api/login' import { apiDingtalkLogin, apiUserInfo } from '@/api/login'
export default { export default {
name: 'App', name: 'App',
@ -26,11 +26,10 @@ export default {
...mapState(['user']) ...mapState(['user'])
}, },
async created () { async created () {
console.log('this', this) if (!dd.other) {
// if (!dd.other) { await this.handleGetDingtalkCode()
// await this.handleGetDingtalkCode() await this.handleDingtalkLogin()
// await this.handleDingtalkLogin() }
// }
this.GET_DEPLIST() this.GET_DEPLIST()
}, },
@ -40,24 +39,24 @@ export default {
}, },
...mapActions(['GET_DEPLIST', 'SET_USER_INFO']), ...mapActions(['GET_DEPLIST', 'SET_USER_INFO']),
// //
// handleGetDingtalkCode () { handleGetDingtalkCode () {
// return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// let _this = this let _this = this
// dd.runtime.permission.requestAuthCode({ dd.runtime.permission.requestAuthCode({
// corpId: 'ding267474e759bbca1c35c2f4657eb6378f', corpId: 'ding267474e759bbca1c35c2f4657eb6378f',
// onSuccess (res) { onSuccess (res) {
// console.log('result===', res) console.log('result===', res)
// _this.dingCode = res _this.dingCode = res
// resolve() resolve()
// }, },
// onFail (err) { onFail (err) {
// console.log('err===', err) console.log('err===', err)
// _this.dingCode = err _this.dingCode = err
// resolve() resolve()
// } }
// }) })
// }) })
// }, },
// //
async handleDingtalkLogin (val = this.dingCode) { async handleDingtalkLogin (val = this.dingCode) {
const res = await apiDingtalkLogin(val) const res = await apiDingtalkLogin(val)
@ -79,7 +78,8 @@ export default {
console.log('获取用户信息res: ', res) console.log('获取用户信息res: ', res)
if (res.code === 200) { if (res.code === 200) {
console.log('this.SET_USER_INFO: ', this.SET_USER_INFO) console.log('this.SET_USER_INFO: ', this.SET_USER_INFO)
this.SET_USER_INFO(res.user) // this.SET_USER_INFO(res.user)
this.$store.commit('SET_USER_INFO', res.user)
} }
} }
} }

View File

@ -2,7 +2,7 @@
<template> <template>
<div class="header-title"> <div class="header-title">
<div class="header-title-img"> <div class="header-title-img">
<img onerror="javascript:this.src='@/assets/img/default.jpg';" :src="obj.src|| ''" alt=""> <img :src="obj.src|| ''" alt="">
</div> </div>
<div class="header-title-right commonFont"> <div class="header-title-right commonFont">
<span style="font-size:14px;">{{obj.name || "熊成强"}}</span> <span style="font-size:14px;">{{obj.name || "熊成强"}}</span>

View File

@ -12,19 +12,10 @@
{{i.meta.title}}</li> {{i.meta.title}}</li>
</ul> </ul>
<nav-header v-if="!isNav"/> <nav-header v-if="!isNav"/>
<!-- <div class="noNav" v-if="!isNav">
<div class="noNav-left">
<i @click="handleBack" class="el-icon-arrow-left"></i>
</div>
<div>{{name}}</div>
</div> -->
</transition> </transition>
<div>{{isNav}}---{{this.userInfo.realName}}</div> <div class="navBar-right" v-if="isNav">
<div class="navBar-right"> <span>{{this.info.realName}}</span>
<span>{{this.userInfo.realName}}</span><span>{{this.userInfo}}</span><span>熊承强</span> <img :src="this.info || ''" alt="">
<img src="@/assets/img/default.jpg" />
<!-- <img src="../../../@/assets/img/default.jpg" /> -->
<!-- <img onerror="javascript:this.src='@/assets/img/default.jpg';" :src="this.userInfo.avatar || ''" alt=""> -->
</div> </div>
</div> </div>
</template> </template>
@ -32,7 +23,7 @@
<script> <script>
import routeList from '@/router/kpi_route' import routeList from '@/router/kpi_route'
import NavHeader from './NavHeader' import NavHeader from './NavHeader'
import { mapGetters } from 'vuex' import { mapState } from 'vuex'
export default { export default {
name: 'NavBar', name: 'NavBar',
data () { data () {
@ -46,7 +37,7 @@ export default {
NavHeader NavHeader
}, },
computed: { computed: {
...mapGetters(['userInfo']), ...mapState({ info: state => state.user.info }),
isNav () { isNav () {
return !!this.$route.meta.isNav return !!this.$route.meta.isNav
}, },
@ -56,7 +47,6 @@ export default {
}, },
beforeMount () {}, beforeMount () {},
mounted () { mounted () {
console.log('userInfo: ', this.userInfo)
}, },
methods: { methods: {
handleToRouter (item) { handleToRouter (item) {

View File

@ -30,13 +30,7 @@ export default {
mounted () {}, mounted () {},
methods: { methods: {
handleBack () { handleBack () {
console.log('this.isPopup: ', this.isPopup)
if (this.isPopup) return this.open() if (this.isPopup) return this.open()
console.log('history: ', history)
console.log('this.$router: ', this.$router)
console.log('this.$store: ', this.$store)
// window.history.back()
this.$router.go(-1) this.$router.go(-1)
}, },
open () { open () {

View File

@ -91,7 +91,7 @@
<div class="performance-content-jilu-item-content"> <div class="performance-content-jilu-item-content">
<div class="performance-content-jilu-item-content-img"> <div class="performance-content-jilu-item-content-img">
<img <img
onerror="javascript:this.src='@/assets/img/default.jpg';" :src="i.avatar|| ''" :src="i.avatar|| ''"
alt="" alt=""
> >
</div> </div>

View File

@ -28,7 +28,7 @@ const islzmanagement = window.location.host.indexOf('hostList') > -1 && window.l
export default { export default {
data () { data () {
return { return {
isShow: false, isShow: true,
islzmanagement, islzmanagement,
input: localStorage.getItem('input'), input: localStorage.getItem('input'),
verify: '888888', verify: '888888',
@ -56,8 +56,10 @@ export default {
this.token = res.token this.token = res.token
this.$cookies.set('token', res.token, res.expire) this.$cookies.set('token', res.token, res.expire)
let ress = await apiUserInfo() let ress = await apiUserInfo()
console.log('ress.user: ', ress.user)
if (ress.code === 200) { if (ress.code === 200) {
this.SET_USER_INFO(ress.user) // this.SET_USER_INFO(ress.user)
this.$store.commit('SET_USER_INFO', ress.user)
} }
console.log('ress: ', ress) console.log('ress: ', ress)
location.reload() location.reload()

View File

@ -12,7 +12,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<img <img
:src="scope.row.avatar" :src="scope.row.avatar"
onerror="javascript:this.src='@/assets/img/default.jpg';"
class="todo-content-right-avatar" class="todo-content-right-avatar"
/> />
</template> </template>