Commit 87215652 by 怪兽?别跑

客户公海调整 && 企业微信授权调整

1 parent 6b4932e2
...@@ -224,7 +224,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -224,7 +224,7 @@ router.beforeEach(async (to, from, next) => {
if (init && !noAuth) { if (init && !noAuth) {
Toast.loading() Toast.loading()
await store.dispatch('login') await store.dispatch('login')
window.lwConfig.TOKEN || (await wxConfig()) await wxConfig()
init = false init = false
Toast.clear() Toast.clear()
} }
......
...@@ -26,26 +26,28 @@ export default new Vuex.Store({ ...@@ -26,26 +26,28 @@ export default new Vuex.Store({
// 企业微信端授权登录 // 企业微信端授权登录
async login({ commit }) { async login({ commit }) {
//取缓存中的用户信息 //取缓存中的用户信息
window.lwConfig.TOKEN && (sessionStorage.token = window.lwConfig.TOKEN)
if (!sessionStorage.token) { if (!sessionStorage.token) {
// 解决授权重定向返回问题 // 解决授权重定向返回问题
let indexRoute = router.getRoutes().find((e) => e.path == '') let indexRoute = router.getRoutes().find((e) => e.path == '')
indexRoute && (indexRoute.redirect = window.location.hash.slice(1)) indexRoute && (indexRoute.redirect = window.location.hash.slice(1))
//缓存中没有用户信息,进入授权流程 //缓存中没有用户信息,进入授权流程
let code = getQueryValue('code') //是否存在code let code = getQueryValue('code') //是否存在code
// 第三方授权重定向回来手动刷新页面
if (code && count === 1) {
commit('reload')
}
if (!code) { if (!code) {
count++ count++
let url = (await getWcRedirect()).data let url = (await getWcRedirect()).data
window.location.replace(url) window.location.replace(url)
return Promise.reject()
} }
// 第三方授权重定向回来手动刷新页面
if (code && count === 1) {
commit('reload')
}
if (code) {
let dataLogin = await login(code) let dataLogin = await login(code)
// 存入sessionStorage,解决刷新重复code获取用户问题 // 存入sessionStorage,解决刷新重复code获取用户问题
dataLogin.data && sessionStorage.setItem('token', dataLogin.data.access_token) dataLogin.data && sessionStorage.setItem('token', dataLogin.data.access_token)
} }
}
if (sessionStorage.token && !sessionStorage.userId) { if (sessionStorage.token && !sessionStorage.userId) {
let dataUser = {} let dataUser = {}
try { try {
...@@ -56,6 +58,7 @@ export default new Vuex.Store({ ...@@ -56,6 +58,7 @@ export default new Vuex.Store({
try { try {
let corpInfo = dataUser.corpInfo let corpInfo = dataUser.corpInfo
dataUser.user.weUserId && sessionStorage.setItem('userId', dataUser.user.weUserId) // 当前 登录/使用 企业员工真实姓名大驼峰 eg:QinShiHuang dataUser.user.weUserId && sessionStorage.setItem('userId', dataUser.user.weUserId) // 当前 登录/使用 企业员工真实姓名大驼峰 eg:QinShiHuang
dataUser.user.userId && sessionStorage.setItem('sysId', dataUser.user.userId) // 当前系统的userId
commit('userId', sessionStorage.userId) commit('userId', sessionStorage.userId)
corpInfo.appId && sessionStorage.setItem('appId', corpInfo.appId) // 微信公众号appid corpInfo.appId && sessionStorage.setItem('appId', corpInfo.appId) // 微信公众号appid
sessionStorage.setItem('corpId', corpInfo.corpId) // 企业id sessionStorage.setItem('corpId', corpInfo.corpId) // 企业id
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div> <div>
<van-tabs v-model="active"> <van-tabs v-model="active">
<van-tab :title="'待添加(' + total + ')'"> <van-tab :title="'待添加(' + total + ')'">
<van-cell-group> <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="getData">
<van-cell> <van-cell>
<template v-for="(unit, key) in list"> <template v-for="(unit, key) in list">
<div class="content" :key="key"> <div class="content" :key="key">
...@@ -11,31 +11,29 @@ ...@@ -11,31 +11,29 @@
{{ unit.customerName }} {{ unit.customerName }}
</div> </div>
<div> <div>
<van-button plain round type="info" @click="copyFn($event, unit.phone)" <van-button plain round type="info" @click="copyFn($event, unit.phone)">复制</van-button>
>复制</van-button
>
</div> </div>
</div> </div>
</template> </template>
</van-cell> </van-cell>
</van-cell-group> </van-list>
</van-tab> </van-tab>
<!-- <van-tab :title="'待通过(' + total2 + ')'"> <van-tab :title="'待通过(' + total2 + ')'">
<van-cell-group> <van-list v-model="loading2" :finished="finished2" finished-text="没有更多了" @load="getData2">
<van-cell> <van-cell>
<template v-for="(unit, key) in list2"> <template v-for="(unit, key) in list2">
<div class="content" :key="key"> <div class="content" :key="key">
<div>{{unit.phone}}</div> <div>{{ unit.phone }}</div>
<div> <div>
{{unit.customerName}} {{ unit.customerName }}
</div> </div>
</div> </div>
</template> </template>
</van-cell> </van-cell>
</van-cell-group> </van-list>
</van-tab> --> </van-tab>
<van-tab :title="'已添加(' + total1 + ')'"> <van-tab :title="'已添加(' + total1 + ')'">
<van-cell-group> <van-list v-model="loading1" :finished="finished1" finished-text="没有更多了" @load="getData1">
<van-cell> <van-cell>
<template v-for="(unit, key) in list1"> <template v-for="(unit, key) in list1">
<div class="content" :key="key"> <div class="content" :key="key">
...@@ -46,26 +44,26 @@ ...@@ -46,26 +44,26 @@
</div> </div>
</template> </template>
</van-cell> </van-cell>
</van-cell-group> </van-list>
</van-tab> </van-tab>
</van-tabs> </van-tabs>
</div> </div>
</template> </template>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script> <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<script> <script>
import ClipboardJS from 'clipboard' import ClipboardJS from 'clipboard'
import { getTypeList, setState } from '@/api/seas.js' import { getTypeList, setState } from '@/api/seas.js'
export default { export default {
name: 'highSeas-index', name: 'highSeas-index',
data() { data() {
return { return {
active: 0, active: 0,
query: { query: {
pageSize: 500, pageSize: 20,
pageNum: 1, pageNum: 1,
addState: 0, // 0:待添加;1:已添加;3:待通过 addState: 0, // 0:待添加;1:已添加;3:待通过
userId: '', userId: ''
}, },
list: [], list: [],
total: 0, total: 0,
...@@ -73,56 +71,91 @@ export default { ...@@ -73,56 +71,91 @@ export default {
total2: 0, total2: 0,
list1: [], list1: [],
list2: [], list2: [],
loading: false,
finished: false,
loading1: false,
finished1: false,
loading2: false,
finished2: false,
query1: {
pageSize: 20,
pageNum: 1,
addState: 1, // 0:待添加;1:已添加;3:待通过
userId: ''
},
query2: {
pageSize: 20,
pageNum: 1,
addState: 3, // 0:待添加;1:已添加;3:待通过
userId: ''
}
} }
}, },
watch: {}, watch: {},
methods: { methods: {
init() { init() {
this.getData() this.query.userId = this.userId
this.getData1() this.query1.userId = this.userId
this.query2.userId = this.userId
getTypeList(this.query).then((res) => {
this.total = res.total
})
getTypeList(this.query1).then((res) => {
this.total1 = res.total
})
getTypeList(this.query2).then((res) => {
this.total2 = res.total
})
}, },
getData() { getData() {
let obj = { this.query.userId = this.userId
pageSize: 500, getTypeList(this.query).then((res) => {
pageNum: 1,
addState: 0, // 0:待添加;1:已添加;3:待通过
userId: this.userId,
}
getTypeList(obj).then((res) => {
this.total = res.total this.total = res.total
this.list = res.rows this.list.push(...res.rows)
this.loading = false
this.query.pageNum++
if (this.list.length >= Number(this.total)) {
this.finished = true
}
}) })
}, },
getData1() { getData1() {
let obj = { this.query1.userId = this.userId
pageSize: 500, getTypeList(this.query1).then((res) => {
pageNum: 1,
addState: 1, // 0:待添加;1:已添加;3:待通过
userId: this.userId,
}
getTypeList(obj).then((res) => {
this.total1 = res.total this.total1 = res.total
this.list1 = res.rows this.list1.push(...res.rows)
this.loading1 = false
this.query1.pageNum++
if (this.list1.length >= Number(this.total1)) {
this.finished1 = true
}
}) })
}, },
getData2() { getData2() {
let obj = { this.query2.userId = this.userId
pageSize: 500, getTypeList(this.query2).then((res) => {
pageNum: 1,
addState: 3, // 0:待添加;1:已添加;3:待通过
userId: this.userId,
}
getTypeList(obj).then((res) => {
this.total2 = res.total this.total2 = res.total
this.list3 = res.rows this.list2.push(...res.rows)
this.loading2 = false
this.query2.pageNum++
if (this.list2.length >= Number(this.total2)) {
this.finished2 = true
}
}) })
}, },
setGoto(text) { setGoto(text) {
setState({ phone: text }).then((res) => { setState({ phone: text }).then((res) => {
this.list = []
this.list1 = []
this.list2 = []
this.query.pageNum = 1
this.query1.pageNum = 1
this.query2.pageNum = 1
this.getData() this.getData()
this.getData1() this.getData1()
wx.invoke('navigateToAddCustomer', {}, function(res) {}) this.getData2()
wx.invoke('navigateToAddCustomer', {}, function (res) {})
}) })
}, },
copyFn(e, text) { copyFn(e, text) {
...@@ -144,7 +177,7 @@ export default { ...@@ -144,7 +177,7 @@ export default {
clipboard.destroy() clipboard.destroy()
}) })
clipboard.onClick(e) clipboard.onClick(e)
}, }
}, },
mounted() { mounted() {
this.init() this.init()
...@@ -152,26 +185,26 @@ export default { ...@@ -152,26 +185,26 @@ export default {
computed: { computed: {
userId() { userId() {
return this.$store.state.userId // 员工Id return this.$store.state.userId // 员工Id
}
}, },
}, created() {}
created() {}, }
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.page { .page {
height: 100vh; height: 100vh;
background: #f6f6f6; background: #f6f6f6;
} }
.content { .content {
font-size: 15px; font-size: 15px;
font-weight: 500; font-weight: 500;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
line-height: 60px; line-height: 60px;
} }
/deep/ .van-button--info { /deep/ .van-button--info {
border: none; border: none;
} }
</style> </style>
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
<el-select clearable v-model="query.addState"> <el-select clearable v-model="query.addState">
<el-option label="待添加" :value="0"></el-option> <el-option label="待添加" :value="0"></el-option>
<el-option label="已添加" :value="1"></el-option> <el-option label="已添加" :value="1"></el-option>
<!-- <el-option label="待通过" :value="3"> <el-option label="待通过" :value="3">
</el-option> --> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label-width="0"> <el-form-item label-width="0">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!