Commit 87215652 by 怪兽?别跑

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

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