企微考试用的值班信息
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import {mapActions, mapMutations, mapState} from "vuex";
|
||||
import {mapMutations, mapState} from "vuex";
|
||||
import qs from 'query-string'
|
||||
|
||||
export default {
|
||||
name: "AppDutyInfo",
|
||||
@@ -12,8 +13,7 @@ export default {
|
||||
{label: '值班人员', prop: 'dutyUserName'},
|
||||
{label: '开始时间', prop: 'dutyStartTime'},
|
||||
{label: '结束时间', prop: 'dutyEndTime'},
|
||||
],
|
||||
typeList: [{value: '1', label: '陈锐-超管'}]
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -23,15 +23,44 @@ export default {
|
||||
document.title = '值班信息'
|
||||
if (this.user.token) {
|
||||
this.getList()
|
||||
} else if (this.$route.query.code) {
|
||||
this.getToken().then(this.getList)
|
||||
} else this.getCode().then(this.getToken).then(this.getList)
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['setToken']),
|
||||
...mapActions(['getCode']),
|
||||
getCode() {
|
||||
/**
|
||||
* 构建oauth2链接获取code
|
||||
*/
|
||||
const oauth2Weixin = params => {
|
||||
const redirect = qs.parseUrl(location.href)
|
||||
delete redirect.query.code
|
||||
delete redirect.query.state
|
||||
return qs.stringifyUrl({
|
||||
url: "https://open.weixin.qq.com/connect/oauth2/authorize",
|
||||
query: {
|
||||
response_type: 'code',
|
||||
redirect_uri: qs.stringifyUrl(redirect),
|
||||
...params
|
||||
},
|
||||
fragmentIdentifier: "wechat_redirect"
|
||||
})
|
||||
}
|
||||
const oauthURL = oauth2Weixin({
|
||||
appid: "ww596787bb70f08288",
|
||||
agentid: "1000211",
|
||||
scope: "snsapi_privateinfo"
|
||||
})
|
||||
location.replace(oauthURL)
|
||||
},
|
||||
getToken() {
|
||||
return this.$http.post("/node/wxtest/token", null, {withoutToken: 1}).then(res => {
|
||||
const {code} = this.$route.query
|
||||
return this.$http.post("/node/wxtest/token", null, {withoutToken: 1, params: {code}}).then(res => {
|
||||
if (res?.data) {
|
||||
return this.setToken(res.data.data)
|
||||
} else if (res?.err?.errcode == 40029) {
|
||||
this.getCode().then(this.getToken).then(this.getList)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -53,7 +82,6 @@ export default {
|
||||
<div class="select" @click="show=true">艾贤凌
|
||||
<u-icon name="arrow-down" color="#999" size="24"/>
|
||||
</div>
|
||||
<u-select v-model="show" :list="typeList"/>
|
||||
<u-table>
|
||||
<u-tr>
|
||||
<u-th width="33%" v-for="column in columns" :key="column.prop">{{ column.label }}</u-th>
|
||||
|
||||
Reference in New Issue
Block a user