wjx 2 yıl önce
ebeveyn
işleme
19355b3069

+ 1 - 0
.env.development

@@ -5,6 +5,7 @@ ENV = 'development'
 VUE_APP_BASE_API = 'http://test.api.zanxiangwl.com'
 VUE_APP_DATA_API = 'http://data.zanxiangnet.com:8009'
 VUE_APP_BASE_URL = 'http://test.erp.zanxiangnet.com/#/login'
+VUE_APP_CORP_URL = 'http://test.erp.zanxiangnet.com/#/corpDoAuth'
 VUE_APP_DDAPPID = 'dingtqel20goyqnsnekd'
 #VUE_APP_BASE_API = 'http://localhost:8081'
 

+ 1 - 0
.env.production

@@ -5,6 +5,7 @@ ENV = 'production'
 VUE_APP_BASE_API = 'https://api.zanxiangwl.com'
 VUE_APP_DATA_API = 'http://data.zanxiangnet.com:8009'
 VUE_APP_BASE_URL = 'http://erp.zanxiangnet.com/admin/#/login'
+VUE_APP_CORP_URL = 'http://erp.zanxiangnet.com/#/corpDoAuth'
 VUE_APP_DDAPPID = 'dingwfmhucedfluenpuj'
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 0 - 1
src/api/accounts/account.js

@@ -1,5 +1,4 @@
 import request from '@/utils/request'
-import { data } from 'autoprefixer'
 
 // 获取公众号授权链接(前端新页面跳转)
 export function getAccount(query) {

+ 175 - 0
src/api/accounts/corpWeChat.js

@@ -0,0 +1,175 @@
+import request from '@/utils/request'
+
+
+/**
+ * 企微去授权
+ * @param {*} params {redirectUri: 回调地址}
+ * @returns 
+ */
+export function getCorpToAuth(params) {
+    return request({
+        url: '/corp/admin/corp/toAuth',
+        method: 'get',
+        params
+    })
+}
+
+
+/**
+ * 授权成功回调
+ * @param {*} data {authCode: 回调的 code,expiresIn:"临时授权码有效时常", state: 回调的 state} 
+ * @returns 
+ */
+export function addCorpDoAuth(data) {
+    return request({
+        url: '/corp/admin/corp/doAuth',
+        method: 'POST',
+        data
+    })
+}
+
+
+/**
+ * 获取企微列表
+ * @param {*} data {pageSize: 20, pageNum: 1, corpName: "企微名", corpId: "企微 id"}
+ * @returns 
+ */
+export function getCorpList(data) {
+    return request({
+        url: '/corp/admin/corp/list',
+        method: 'POST',
+        data
+    })
+}
+
+/**
+ * 刷新企微信息
+ * @param {*} corpId 
+ * @returns 
+ */
+export function putRefreshCorp(corpId) {
+    return request({
+        url: `/corp/admin/corp/refresh/${corpId}`,
+        method: 'PUT'
+    })
+}
+
+/**
+ * 获取企微通讯录
+ * @param {*} data {pageNum: 1, pageSize: 20, corpId: "企微 id(必传)", name: ""}
+ * @returns 
+ */
+export function getCorpMailList(data) {
+    return request({
+        url: `/corp/admin/corpUser/list`,
+        method: 'POST',
+        data
+    })
+}
+
+/**
+ * 指派投手运营
+ * @param {*} data  {corpId: "", corpUserId: "", beginTime: "2023-01-01", putUserId: 1, operUserId: 2}
+ * @returns 
+ */
+export function putCorpSysUser(data) {
+    return request({
+        url: `/corp/admin/corpUser/configSysUser`,
+        method: 'PUT',
+        data
+    })
+}
+
+/**
+ * 同步企微通讯录
+ * @param {*} corpId 
+ * @returns 
+ */
+export function putSyncCorpUser(corpId) {
+    return request({
+        url: `/corp/admin/corpUser/sync/${corpId}`,
+        method: 'PUT'
+    })
+}
+
+/**
+ * 同步所有
+ * @param {*} corpId 
+ * @returns 
+ */
+export function putSyncAllCorpUser(corpId) {
+    return request({
+        url: `/corp/admin/corp/syncAll/${corpId} `,
+        method: 'PUT'
+    })
+}
+
+
+/**
+ * 更新企微明文密钥
+ * @param {*} corpId 
+ * @param {*} data {"originCorpId":"企微 id", userSecret:"通讯录密钥",externalUserSecret:"客户密钥", remark:"备注" }
+ * @returns 
+ */
+export function refreshCorp(params) {
+    const { corpId, ...data } = params
+    return request({
+        url: `/corp/admin/corp/config/${corpId} `,
+        method: 'PUT',
+        data
+    })
+}
+
+/*****************变更记录*******************/
+/**
+ * 变更记录
+ * @param {*} corpId 
+ * @param {*} corpUserId 
+ * @returns 
+ */
+export function getAllOfCorpList(corpId, corpUserId) {
+    return request({
+        url: `/corp/admin/corpUserChangeRecord/allOfCorp/${corpId}/${corpUserId}`,
+        method: 'GET'
+    })
+}
+
+/**
+ * 新增记录
+ * @param {*} data {nextId: 1, corpId: "", corpUserId:"", beginTime: "2021-01-01", putUserId: 1, operUserId: 1}
+ * @returns 
+ */
+export function addAllOfCorp(data) {
+    return request({
+        url: `/corp/admin/corpUserChangeRecord/addNewRecord`,
+        method: 'POST',
+        data
+    })
+}
+
+/**
+ * 修改记录
+ * @param {*} data {recordId: 1, beginTime: "2021-01-01", putUserId: 1, operUserId: 1}
+ * @returns 
+ */
+export function putAllOfCorp(data) {
+    return request({
+        url: `/corp/admin/corpUserChangeRecord/modifyRecord`,
+        method: 'PUT',
+        data
+    })
+}
+
+/**
+ * 删除记录
+ * @param {*} recordId 
+ * @returns 
+ */
+export function delAllOfCorp(recordId) {
+    return request({
+        url: `/corp/admin/corpUserChangeRecord/delRecord/${recordId}`,
+        method: 'DELETE',
+    })
+}
+
+/*****************变更记录*******************/

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
src/assets/icons/svg/corpWechat.svg


+ 5 - 0
src/router/index.js

@@ -75,6 +75,11 @@ export const constantRoutes = [
     component: (resolve) => require(['@/views/ad'], resolve),
     hidden: true
   },
+  {
+    path: '/corpDoAuth',
+    component: (resolve) => require(['@/views/corpDoAuth'], resolve),
+    hidden: true
+  },
   {
     path: '/ttAdCode',
     component: (resolve) => require(['@/views/ttAd'], resolve),

+ 1 - 1
src/store/modules/user.js

@@ -155,7 +155,7 @@ const user = {
         dispatch('GetInfo')
         resolve();
       })
-    },
+    }
   }
 };
 

+ 20 - 0
src/utils/index.js

@@ -89,6 +89,26 @@ export function getQueryObject(url) {
   return obj
 }
 
+
+/**
+ * 腾讯授权
+ * @param {string} url
+ * @returns {Object}
+ */
+export function getQueryObjectSearch() {
+  const search = window.location.search
+  const obj = {}
+  const reg = /([^?&=]+)=([^?&=]*)/g
+  search.replace(reg, (rs, $1, $2) => {
+    const name = decodeURIComponent($1)
+    let val = decodeURIComponent($2)
+    val = String(val)
+    obj[name] = val
+    return rs
+  })
+  return obj
+}
+
 /**
  * @param {string} input value
  * @returns {number} output value

+ 1 - 0
src/views/accounts/account/components/changeRecord.vue

@@ -146,6 +146,7 @@
                         <el-option label="头条企微" value="头条企微" />
                         <el-option label="MP企微" value="MP企微" />
                         <el-option label="ADQ公众号" value="ADQ公众号" />
+                        <el-option label="直投小程序" value="直投小程序" />
                     </el-select>
                 </el-form-item>
                 <el-form-item label="充值模板" prop="rechargeTemplate">

+ 1 - 0
src/views/accounts/account/components/cutBook.vue

@@ -50,6 +50,7 @@
                         <el-option label="头条企微" value="头条企微" />
                         <el-option label="MP企微" value="MP企微" />
                         <el-option label="ADQ公众号" value="ADQ公众号" />
+                        <el-option label="直投小程序" value="直投小程序" />
                     </el-select>
                 </el-form-item>
                 <el-form-item label="充值模板" prop="rechargeTemplate">

+ 15 - 10
src/views/accounts/account/index.vue

@@ -323,6 +323,7 @@
                         <el-option label="头条企微" value="头条企微" />
                         <el-option label="MP企微" value="MP企微" />
                         <el-option label="ADQ公众号" value="ADQ公众号" />
+                        <el-option label="直投小程序" value="直投小程序" />
                     </el-select>
                 </el-form-item>
                 <el-form-item label="充值模板" prop="rechargeTemplate" v-if="isAdd">
@@ -581,7 +582,19 @@ export default {
     },
     mounted(){
         this.total = this.accountList.length
-        window.addEventListener('storage', (e) => {
+        window.addEventListener('storage', this.listener)
+    },
+    beforeDestroy() { // 在组件生命周期结束的时候销毁。
+        window.removeEventListener('storage', this.listener, false)
+    },
+    created() {
+        this.getAll()
+        this.getList()
+        this.getGroupList()
+        this.getCutXgData()
+    },
+    methods: {
+        listener(e) {
             if (e.key === 'code') {
                 if (e.newValue === 'ok') {
                     this.$router.go(0)
@@ -592,15 +605,7 @@ export default {
                     localStorage.removeItem('code')
                 }
             }
-        })
-    },
-    created() {
-        this.getAll()
-        this.getList()
-        this.getGroupList()
-        this.getCutXgData()
-    },
-    methods: {
+        },
         selectZh(e, id) {
             // 获取所有账号
             getBookAcc(e).then(res => {

+ 1 - 0
src/views/accounts/account/use.vue

@@ -371,6 +371,7 @@
             <el-option label="头条企微" value="头条企微" />
             <el-option label="MP企微" value="MP企微" />
             <el-option label="ADQ公众号" value="ADQ公众号" />
+            <el-option label="直投小程序" value="直投小程序" />
           </el-select>
         </el-form-item>
         <el-form-item label="充值模板" prop="rechargeTemplate" v-if="isAdd">

+ 12 - 8
src/views/accounts/adWarrant/index.vue

@@ -435,7 +435,17 @@ export default {
         }
     },
     mounted() {
-        window.addEventListener('storage', (e) => {
+        window.addEventListener('storage', this.listener)
+    },
+    beforeDestroy() { // 在组件生命周期结束的时候销毁。
+        window.removeEventListener('storage', this.listener, false)
+    },
+    created() {
+        this.getAppListAll()
+        this.getAll()
+    },
+    methods: {
+        listener(e) {
             if (e.key === 'adMp') {
                 if (e.newValue === 'ok') {
                     // this.$router.go(0)
@@ -447,13 +457,7 @@ export default {
                     localStorage.removeItem('adMp')
                 }
             }
-        })
-    },
-    created() {
-        this.getAppListAll()
-        this.getAll()
-    },
-    methods: {
+        },
         putUserHandle(row) {
             console.log(row);
             this.putUserShow = true

+ 242 - 0
src/views/accounts/corpWechat/changeRecord.vue

@@ -0,0 +1,242 @@
+<template>
+    <div>
+        <el-drawer :title="recordData.name + ' 变更记录'" append-to-body :visible.sync="visible" direction="rtl"
+            :before-close="recordClose" custom-class="custom">
+            <div class="cut">
+                <el-button class="button" type="primary" icon="el-icon-plus" size="mini"
+                    @click="handleCutRecord">插入起始记录</el-button>
+                <el-table :data="recordList" size="mini">
+                    <el-table-column label="开始时间" prop="beginTime" align="center" width="90" />
+                    <el-table-column label="结束时间" prop="endTime" align="center" width="90" />
+                    <el-table-column label="企业号ID" prop="corpUserId" align="center" :show-overflow-tooltip="true"
+                        width="120" />
+                    <el-table-column label="企微ID" prop="corpId" :show-overflow-tooltip="true" width="300" />
+                    <el-table-column label="运营" prop="operUserId" align="center" width="100">
+                        <template slot-scope="scope">
+                            <div>{{ scope.row.operUserId ? scope.row.operUser.nickName : '--' }}</div>
+                        </template>
+                    </el-table-column>
+                    <el-table-column label="投手" prop="putUserId" align="center" width="100">
+                        <template slot-scope="scope">
+                            <div>{{ scope.row.putUserId ? scope.row.putUser.nickName : '--' }}</div>
+                        </template>
+                    </el-table-column>
+                    <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right"
+                        width="150">
+                        <template slot-scope="scope">
+                            <div>
+                                <el-button type="text" @click="insertDownHandle(scope.row, '向后插入')"
+                                    size="mini">往后插入</el-button>
+                                <el-button type="text" @click="insertDownHandle(scope.row, '修改')" size="mini">修改</el-button>
+                                <el-button type="text" style="color: red" size="mini"
+                                    @click="delRecordHandle(scope.row)">删除</el-button>
+                            </div>
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </div>
+        </el-drawer>
+
+        <!-- 新增 编辑记录弹窗 -->
+        <el-dialog :title="title" :visible.sync="editShow" width="360px" append-to-body @close="editShow = false">
+            <el-form :model="queryPlatformRecord" :rules="rules" ref="platFormRecord" label-width="80px">
+                <el-form-item label="开始时间" prop="beginTime">
+                    <el-date-picker v-model="queryPlatformRecord.beginTime" size="small" format="yyyy-MM-dd"
+                        value-format="yyyy-MM-dd" type="date" placeholder="选择开始时间" />
+                </el-form-item>
+                <el-form-item label="结束时间" prop="endTime">
+                    <el-date-picker v-model="queryPlatformRecord.endTime" size="small" format="yyyy-MM-dd"
+                        value-format="yyyy-MM-dd" type="date" placeholder="选择开始时间" />
+                </el-form-item>
+                <el-form-item label="运营" prop="operUserId">
+                    <el-select v-model="queryPlatformRecord.operUserId" size="small" placeholder="选择运营" filterable
+                        clearable>
+                        <el-option v-for="item in userAll" :key="item.id" :label="item.nickName" :value="item.id" />
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="投手" prop="putUserId">
+                    <el-select v-model="queryPlatformRecord.putUserId" size="small" placeholder="选择投手" filterable clearable>
+                        <el-option v-for="item in userAll" :key="item.id" :label="item.nickName" :value="item.id" />
+                    </el-select>
+                </el-form-item>
+            </el-form>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="editShow = false; queryPlatformRecord = {}">取 消</el-button>
+                <el-button type="primary" @click="submitRecord('platFormRecord')">确 定</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { getAllOfCorpList, addAllOfCorp, putAllOfCorp, delAllOfCorp } from "@/api/accounts/corpWeChat";
+export default {
+    data() {
+        return {
+            recordList: [],
+            loading: false,
+            title: '',
+            editShow: false,
+            queryPlatformRecord: {},
+            rules: {
+                beginTime: [
+                    { required: true, message: '请选择开始时间', trigger: 'change' }
+                ]
+            }
+        }
+    },
+    props: {
+        recordData: {
+            type: Object,
+            default: {},
+        },
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        userAll: {
+            type: Array,
+            default: []
+        }
+    },
+    watch: {
+        visible: {
+            handler(val) {
+                if (val) {
+                    this.$nextTick(() => {
+                        this.getList()
+                    })
+                }
+            },
+            immediate: true,
+        },
+    },
+    methods: {
+        submitRecord(formName) {
+            this.$refs[formName].validate((valid) => {
+                if (valid) {
+                    let params = JSON.parse(JSON.stringify(this.queryPlatformRecord))
+                    if(params.beginTime) {
+                        params.beginTime = params.beginTime
+                    }
+                    if(params.endTime) {
+                        params.endTime = params.endTime
+                    }
+                    if(!params.id) { // 新增
+                        addAllOfCorp(params).then(res => {
+                            this.msgSuccess("插入成功");
+                            this.resetForm(formName);
+                            this.editShow = false
+                            this.getList()
+                        })
+                    } else { // 修改
+                        let { id, ...data } = params
+                        putAllOfCorp({ recordId: id, ...data }).then(res => {
+                            this.msgSuccess("修改成功");
+                            this.resetForm(formName);
+                            this.editShow = false
+                            this.getList()
+                        })
+                    }
+                }
+            })
+        },
+        handleCutRecord() {
+            const { id, putUserId, operUserId, corpId, corpUserId } = this.recordData
+            this.title = '插入起始记录'
+            this.editShow = true
+            this.queryPlatformRecord = {
+                resourceId: id,
+                operUserId,
+                putUserId,
+                corpId,
+                corpUserId
+            }
+        },
+        /** 修改插入 */
+        insertDownHandle(item, type) {
+            this.title = `${type}记录`
+            this.editShow = true
+            let data = {}
+            if (item.beginTime) {
+                item.beginTime = item.beginTime.split(' ')[0]
+            }
+            if (item.endTime) {
+                item.endTime = item.endTime.split(' ')[0]
+            }
+            const { beginTime, endTime, id, operUserId, putUserId, corpId, corpUserId } = item
+            if (type === '修改') {
+                data = { beginTime, endTime, id }
+            } else {
+                data = { nextId: id, corpId, corpUserId }
+            }
+            this.queryPlatformRecord = {
+                ...data,
+                operUserId,
+                putUserId,
+            }
+        },
+        /** 删除 */
+        delRecordHandle(row) {
+            this.$confirm('确定删除?', '删除', {
+                distinguishCancelAndClose: true,
+                confirmButtonText: '确定',
+                cancelButtonText: '取消'
+            }).then(() => {
+                delAllOfCorp(row.id).then(res => {
+                    if (res.data) {
+                        this.msgSuccess('删除成功');
+                        this.getList()
+                    }
+                })
+            })
+        },
+        getList() {
+            this.loading = true
+            getAllOfCorpList(this.recordData.corpId, this.recordData.corpUserId).then(res => {
+                if (res) {
+                    this.recordList = res.data
+                }
+                this.loading = false
+            }).catch(() => this.loading = false)
+        },
+        // 关闭
+        recordClose() {
+            this.$emit("close");
+        }
+    }
+}
+</script>
+
+<style lang="scss">
+.custom {
+    width: 55% !important;
+}
+
+.cut {
+    padding: 0 10px;
+    box-sizing: border-box;
+
+    .button {
+        margin-bottom: 10px;
+    }
+
+    .el-table .cell {
+        line-height: normal;
+    }
+
+    ul {
+        padding-left: 0;
+
+        .sumitInfo {
+            // margin-top: 20px;
+            font-weight: 600;
+            margin-bottom: 10px;
+
+            .button {
+                margin-left: 20px;
+            }
+        }
+    }
+}
+</style>

+ 222 - 0
src/views/accounts/corpWechat/index.vue

@@ -0,0 +1,222 @@
+<template>
+    <div class="app-container">
+        <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true">
+            <el-form-item label="" prop="corpName">
+                <el-input v-model="queryParams.corpName" placeholder="企微名称" clearable size="small" style="width: 140px"
+                    @keyup.enter.native="getList" />
+            </el-form-item>
+            <el-form-item label="" prop="originCorpId">
+                <el-input v-model="queryParams.originCorpId" placeholder="企微ID" clearable size="small" style="width: 140px"
+                    @keyup.enter.native="getList" />
+            </el-form-item>
+            <el-form-item label="" prop="authStatus">
+                <el-select v-model="queryParams.authStatus" placeholder="授权状态" clearable filterable style="width: 140px"
+                    size="small" @keyup.enter.native="handleQuery">
+                    <el-option label="成功授权" :value="1" />
+                    <el-option label="取消授权" :value="-1" />
+                </el-select>
+            </el-form-item>
+            <el-form-item label="" prop="configStatus">
+                <el-select v-model="queryParams.configStatus" placeholder="配置状态" clearable filterable style="width: 140px"
+                    size="small" @keyup.enter.native="handleQuery">
+                    <el-option label="未配置" value="ING" />
+                    <el-option label="配置成功" value="SUCCESS" />
+                    <el-option label="配置失败" value="ERROR" />
+                </el-select>
+            </el-form-item>
+            <el-form-item>
+                <el-button type="cyan" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
+                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+            </el-form-item>
+        </el-form>
+
+        <el-row :gutter="10" class="mb8" align="middle">
+            <el-col :span="1.5">
+                <div class="grid-content">
+                    <el-button type="primary" size="mini" @click="warrantHandle">企微授权</el-button>
+                </div>
+            </el-col>
+            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
+
+        <el-table :data="corpList" v-loading="loading" size="mini">
+            <el-table-column label="企微名称" prop="corpName" width="150" align="center" fixed="left" />
+            <el-table-column label="企微头像" prop="corpSquareLogoUrl" align="center" width="150">
+                <template slot-scope="scope">
+                    <el-image style="height: 23px" :src="scope.row.corpSquareLogoUrl" fit="fit" />
+                </template>
+            </el-table-column>
+            <el-table-column label="企微ID" prop="originCorpId" align="center" width="150" />
+            <el-table-column label="用户规模" prop="corpUserMax" align="center" width="100" />
+            <el-table-column label="授权方企业类型" prop="corpType" align="center" width="150">
+                <template slot-scope="scope">{{ scope.row.corpType | filterCorpType }}</template>
+            </el-table-column>
+            <el-table-column label="认证到期时间" prop="verifiedEndTime" align="center" width="120" />
+            <el-table-column label="授权状态" prop="authStatus" align="center" width="120">
+                <template slot-scope="scope">
+                    <el-tag type="success" v-if="scope.row.authStatus === 1">成功授权</el-tag>
+                    <el-tag type="danger" v-else>取消授权</el-tag>
+                </template>
+            </el-table-column>
+            <el-table-column label="配置状态" prop="configStatus" align="center" width="120">
+                <template slot-scope="scope">
+                    <el-tag type="success" v-if="scope.row.configStatus === 'SUCCESS'">配置成功</el-tag>
+                    <el-tag type="warning" v-else-if="scope.row.configStatus === 'ING'">未配置</el-tag>
+                    <el-tag type="danger" v-else>配置失败</el-tag>
+                </template>
+            </el-table-column>
+            <el-table-column label="回调地址" prop="externalUserCallbackUrl" width="200" :show-overflow-tooltip="true" />
+            <el-table-column label="Token" prop="externalUserToken" width="150" :show-overflow-tooltip="true" />
+            <el-table-column label="AESKey" prop="externalUserSecret" width="150" :show-overflow-tooltip="true" />
+            <el-table-column label="备注" prop="remark" width="250" :show-overflow-tooltip="true" />
+            <el-table-column label="操作" width="250" align="center" class-name="small-padding fixed-width" fixed="right">
+                <template slot-scope="scope">
+                    <template v-if="scope.row.authStatus === 1">
+                        <el-button size="mini" type="text" icon="el-icon-refresh"
+                            @click="handleRefresh(scope.row)">刷新</el-button>
+                        <el-button size="mini" type="text" icon="el-icon-refresh"
+                            @click="handleSync(scope.row)">同步所有</el-button>
+                        <el-button size="mini" type="text" icon="el-icon-tickets"
+                            @click="handleMailList(scope.row)">企微通讯录</el-button>
+                        <el-button size="mini" type="text" icon="el-icon-refresh"
+                            @click="setSecretHandle(scope.row)">配置密钥</el-button>
+                    </template>
+                </template>
+            </el-table-column>
+        </el-table>
+
+        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+            @pagination="getList" />
+
+        <setSecret :value="secretData" :visible="setShow" @close="setShow = false; secretData = {}"
+            @change="closeSetSecret(); getList()" />
+        <mailList :corpId="corpId" :visible="mailShow" @close="mailShow = false; corpId = null" />
+    </div>
+</template>
+
+<script>
+import { getCorpToAuth, getCorpList, putRefreshCorp, putSyncAllCorpUser } from "@/api/accounts/corpWeChat";
+import setSecret from './setSecret.vue'
+import mailList from './mailList.vue'
+export default {
+    name: 'corp',
+    components: { setSecret, mailList },
+    data() {
+        return {
+            showSearch: true,
+            loading: false,
+            queryParams: {
+                pageSize: 20,
+                pageNum: 1,
+                corpName: '',
+                originCorpId: ''
+            },
+            corpList: [],
+            total: 0,
+            setShow: false,
+            secretData: {},
+            mailShow: false,
+            corpId: null,
+        }
+    },
+    mounted() {
+        this.$nextTick(() => {
+            window.addEventListener('storage', this.listener)
+        })
+    },
+    beforeDestroy() { // 在组件生命周期结束的时候销毁。
+        window.removeEventListener('storage', this.listener, false)
+    },
+    created() {
+        this.getList()
+    },
+    filters: {
+        filterCorpType(val) {
+            if (val) {
+                return { verified: '认证号', unverified: '注册号' }[val]
+            }
+            return '-1'
+        }
+    },
+    methods: {
+        handleSync(row) {
+            const loading = this.$loading({
+                lock: true,
+                text: 'Loading',
+                spinner: 'el-icon-loading',
+                background: 'rgba(0, 0, 0, 0.7)'
+            });
+            putSyncAllCorpUser(row.corpId).then(res => {
+                loading.close()
+                this.getList()
+            })
+        },
+        handleMailList(row) {
+            this.mailShow = true
+            this.corpId = row.corpId
+        },
+        listener(e) {
+            if (e.key === 'corpAdMp') {
+                if (e.newValue === 'ok') {
+                    this.getList()
+                    this.msgSuccess("授权成功");
+                    localStorage.removeItem('corpAdMp')
+                } else {
+                    this.$message.error('授权失败');
+                    localStorage.removeItem('corpAdMp')
+                }
+            }
+        },
+        getList() {
+            this.loading = true
+            getCorpList(this.queryParams).then(res => {
+                this.corpList = res.data.records
+                this.total = res.data.total
+                this.loading = false
+            }).catch(() => this.loading = false)
+        },
+        /** 重置搜索条件 */
+        resetQuery() {
+            this.resetForm("queryForm");
+            this.getList();
+        },
+        /** 企微授权 */
+        warrantHandle() {
+            getCorpToAuth({ redirectUri: encodeURIComponent(process.env.VUE_APP_CORP_URL) }).then(res => {
+                if (res.data) {
+                    window.open(res.data)
+                }
+            })
+        },
+        /** 刷新企微信息 */
+        handleRefresh(row) {
+            const loading = this.$loading({
+                lock: true,
+                text: 'Loading',
+                spinner: 'el-icon-loading',
+                background: 'rgba(0, 0, 0, 0.7)'
+            });
+            putRefreshCorp(row.corpId).then(res => {
+                loading.close()
+                this.getList()
+            }).catch(() => loading.close())
+        },
+        /** 配置密钥 */
+        setSecretHandle(row) {
+            this.setShow = true
+            this.secretData = {
+                corpId: row.corpId,
+                originCorpId: row.originCorpId,
+                externalUserSecret: row.externalUserSecret,
+                bookAgentId: row.bookAgentId,
+                remark: row.remark
+            }
+        },
+        /** 关闭配置 */
+        closeSetSecret() {
+            this.setShow = false
+            this.secretData = {}
+        }
+    }
+}
+</script>

+ 213 - 0
src/views/accounts/corpWechat/mailList.vue

@@ -0,0 +1,213 @@
+<template>
+    <div>
+        <el-dialog title="企微通讯录" v-if="visible" :visible.sync="visible" :before-close="beforeClose" width="750px">
+            <el-row :gutter="10" class="mb8" align="middle">
+                <el-col :span="1.5">
+                    <div class="grid-content">
+                        <el-button type="primary" size="mini" @click="syncHandle">同步通讯录</el-button>
+                    </div>
+                </el-col>
+            </el-row>
+            <el-table :data="mailList" v-loading="loading" size="mini">
+                <el-table-column label="企微号" prop="name" width="120" align="center" />
+                <el-table-column label="运营" prop="operUserId" align="center" width="100">
+                    <template slot-scope="scope">
+                        <div>{{ scope.row.operUserId ? scope.row.operUser.nickName : '--' }}</div>
+                    </template>
+                </el-table-column>
+                <el-table-column label="投手" prop="putUserId" align="center" width="100">
+                    <template slot-scope="scope">
+                        <div>{{ scope.row.putUserId ? scope.row.putUser.nickName : '--' }}</div>
+                    </template>
+                </el-table-column>
+                <el-table-column label="状态" prop="status" align="center" width="100">
+                    <template slot-scope="scope">
+                        <div>{{ scope.row.status === 1 ? '已激活' : scope.row.status === 2 ? '已禁用' : scope.row.status === 4 ?
+                            '未激活' : scope.row.status === 5 ? '退出企业' : '--' }}</div>
+                    </template>
+                </el-table-column>
+                <el-table-column label="创建时间" prop="createTime" align="center" width="150" />
+                <el-table-column label="操作" width="150" align="center" class-name="small-padding fixed-width" fixed="right">
+                    <template slot-scope="scope">
+                        <template>
+                            <el-button size="mini" type="text" icon="el-icon-sort"
+                                @click="handlePut(scope.row)">指派</el-button>
+                            <el-button size="mini" type="text" icon="el-icon-tickets"
+                                @click="handleRecord(scope.row)">变更记录</el-button>
+                        </template>
+                    </template>
+                </el-table-column>
+            </el-table>
+
+            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
+                :limit.sync="queryParams.pageSize" @pagination="getList" />
+        </el-dialog>
+
+        <el-dialog title="指派" :visible.sync="openSys" width="500px" append-to-body>
+            <el-form :model="assignUSerData" :rules="rules" ref="platFormSysType" label-width="80px" label-position="top">
+                <el-form-item label="开始时间" prop="beginTime">
+                    <el-date-picker v-model="assignUSerData.beginTime" type="date" format="yyyy-MM-dd"
+                        value-format="yyyy-MM-dd" placeholder="选择开始时间"></el-date-picker>
+                </el-form-item>
+                <el-form-item label="运营" prop="operUserId">
+                    <el-select v-model="assignUSerData.operUserId" placeholder="请选择" filterable style="width: 100%"
+                        clearable>
+                        <el-option v-for="item in userAll" :key="item.id" :label="item.nickName" :value="item.id" />
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="投手" prop="putUserId">
+                    <el-select v-model="assignUSerData.putUserId" placeholder="请选择" filterable style="width: 100%"
+                        clearable>
+                        <el-option v-for="item in userAll" :key="item.id" :label="item.nickName" :value="item.id" />
+                    </el-select>
+                </el-form-item>
+            </el-form>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="openSys = false; assignUSerData = {}">取 消</el-button>
+                <el-button type="primary" @click="assignUSerSubmit">确 定</el-button>
+            </span>
+        </el-dialog>
+        <changeRecord :visible="recordShow" :recordData="recordData" :userAll="userAll" @close="recordShow = false; recordData = {}"/>
+    </div>
+</template>
+
+<script>
+import { putSyncCorpUser, getCorpMailList, putCorpSysUser } from "@/api/accounts/corpWeChat";
+import { allUser } from "@/api/system/user";
+import { formatDateYMD } from "@/utils"
+import changeRecord from './changeRecord.vue'
+export default {
+    name: 'mailList',
+    components: { changeRecord },
+    data() {
+        return {
+            queryParams: {
+                pageNum: 1,
+                pageSize: 20
+            },
+            mailList: [],
+            loading: false,
+            total: 0,
+            openSys: false,
+            userAll: [], //所有用户
+            assignUSerData: {},
+            rules: {
+                beginTime: [
+                    { required: true, message: '请输入开始时间', trigger: 'blur' }
+                ],
+                operUserId: [
+                    { required: true, message: '请选择运营', trigger: 'blur' }
+                ],
+                putUserId: [
+                    { required: true, message: '请选择投手', trigger: 'blur' }
+                ],
+            },
+            recordShow: false,
+            recordData: {}
+        }
+    },
+    props: {
+        corpId: {
+            type: String,
+            default: '',
+        },
+        visible: {
+            type: Boolean,
+            default: false
+        }
+    },
+    watch: {
+        visible: {
+            handler(val) {
+                if (val) {
+                    this.$nextTick(() => {
+                        this.getList()
+                        this.getAll()
+                    })
+                }
+            },
+            immediate: true,
+        },
+    },
+    methods: {
+        // 变更记录
+        handleRecord(row) {
+            this.recordShow = true
+            this.recordData = row
+        },
+        // 指派
+        handlePut(row) {
+            this.openSys = true
+            this.assignUSerData = {
+                beginTime: formatDateYMD(new Date()),
+                operUserId: row.operUserId,
+                putUserId: row.putUserId,
+                corpId: this.corpId,
+                corpUserId: row.corpUserId
+            }
+        },
+        assignUSerSubmit() {
+            this.$refs['platFormSysType'].validate((valid) => {
+                if (valid) {
+                    console.log(this.assignUSerData);
+                    const loading = this.$loading({
+                        lock: true,
+                        text: 'Loading',
+                        spinner: 'el-icon-loading',
+                        background: 'rgba(0, 0, 0, 0.7)'
+                    });
+                    putCorpSysUser(this.assignUSerData).then(res => {
+                        if (res.data) {
+                            this.$message({
+                                showClose: true,
+                                message: '指派成功',
+                                type: 'success'
+                            });
+                            this.openSys = false
+                            this.assignUSerData = {}
+                            this.getList()
+                        }
+                        loading.close()
+                    }).catch(() => loading.close())
+                }
+            })
+        },
+        getAll() {
+            // 所有用户
+            allUser().then((response) => {
+                let data = response.data;
+                this.userAll = data.map((item) => {
+                    return { id: item.userId, nickName: item.nickname };
+                });
+            });
+        },
+        beforeClose() {
+            this.$emit("close");
+        },
+        syncHandle() {
+            const loading = this.$loading({
+                lock: true,
+                text: 'Loading',
+                spinner: 'el-icon-loading',
+                background: 'rgba(0, 0, 0, 0.7)'
+            });
+            putSyncCorpUser(this.corpId).then(res => {
+                this.msgSuccess("同步成功");
+                loading.close()
+                this.getList()
+            }).catch(() => loading.close())
+        },
+        getList() {
+            this.loading = true
+            getCorpMailList({ corpId: this.corpId, ...this.queryParams }).then(res => {
+                this.mailList = res.data.records
+                this.total = res.data.total
+                this.loading = false
+            }).catch(() => this.loading = false)
+        },
+        onClose() {
+            this.visible = false
+        }
+    }
+}
+</script>

+ 108 - 0
src/views/accounts/corpWechat/setSecret.vue

@@ -0,0 +1,108 @@
+<template>
+    <el-dialog :title="title" :visible.sync="visible" width="380px">
+        <el-form :model="queryForm" ref="setSecret" :rules="rules">
+            <el-form-item label="企微ID" prop="originCorpId">
+                <el-input v-model.number="queryForm.originCorpId" placeholder="请输入企微ID" clearable size="small" />
+            </el-form-item>
+            <el-form-item label="客户密钥" prop="externalUserSecret">
+                <el-input v-model="queryForm.externalUserSecret" placeholder="请输入客户密钥" clearable size="small" />
+            </el-form-item>
+            <el-form-item label="书城应用ID" prop="bookAgentId">
+                <el-input v-model.number="queryForm.bookAgentId" placeholder="请输入书城应用ID" clearable size="small" />
+            </el-form-item>
+            <el-form-item label="备注" prop="remark">
+                <el-input type="textarea" v-model="queryForm.remark" placeholder="请输入备注" clearable size="small" />
+            </el-form-item>
+        </el-form>
+
+        <span slot="footer" class="dialog-footer">
+            <el-button @click="onClose">取 消</el-button>
+            <el-button type="primary" @click="onSubmit()">确 定</el-button>
+        </span>
+    </el-dialog>
+</template>
+<script>
+import { refreshCorp } from "@/api/accounts/corpWeChat";
+export default {
+    name: 'setSecret',
+    data() {
+        return {
+            title: '配置通讯录',
+            rules: {
+                originCorpId: [
+                    { required: true, message: '请输入企微ID', trigger: 'blur' }
+                ],
+                externalUserSecret: [
+                    { required: true, message: '请输入客户密钥', trigger: 'blur' }
+                ],
+            },
+            queryForm: {
+
+            }
+        }
+    },
+    props: {
+        /* 编辑器的内容 */
+        value: {
+            type: Object,
+            default: {},
+        },
+        visible: {
+            type: Boolean,
+            default: false
+        }
+    },
+    watch: {
+        value: {
+            handler(val) {
+                this.queryForm = val
+            },
+            immediate: true,
+        },
+    },
+    methods: {
+        onClose() {
+            this.$emit("close");
+        },
+        onSubmit() {
+            this.$refs['setSecret'].validate((valid) => {
+                if (valid) {
+                    console.log('=======>', this.queryForm);
+                    const loading = this.$loading({
+                        lock: true,
+                        text: 'Loading',
+                        spinner: 'el-icon-loading',
+                        background: 'rgba(0, 0, 0, 0.7)'
+                    });
+                    refreshCorp(this.queryForm).then(res => {
+                        const h = this.$createElement;
+                        this.$msgbox({
+                            customClass: 'boxsss',
+                            title: '配置成功',
+                            closeOnPressEscape: false,
+                            closeOnClickModal: false,
+                            closeOnHashChange: false,
+                            showClose: false,
+                            message: h('div', null, [
+                                h('div', { style: { 'overflow': 'hidden' } }, `URL: ${res.data.externalUserCallbackUrl}`),
+                                h('div', null, `AESKey: ${res.data.aesKey}`),
+                                h('div', null, `Token: ${res.data.token}`),
+                            ]),
+                            confirmButtonText: '确定'
+                        }).then(action => {
+                            this.$emit("change");
+                            loading.close()
+                        });
+
+                    }).catch(() => loading.close())
+                }
+            })
+        }
+    }
+}
+</script>
+<style>
+    .boxsss {
+        width: 600px !important;
+    }
+</style>

+ 8 - 4
src/views/accounts/ttAdWarrant/index.vue

@@ -108,7 +108,13 @@ export default {
         this.getAll()
     },
     mounted(){
-        window.addEventListener('storage', (e) => {
+        window.addEventListener('storage', this.listener)
+    },
+    beforeDestroy() { // 在组件生命周期结束的时候销毁。
+        window.removeEventListener('storage', this.listener, false)
+    },
+    methods: {
+        listener(e) {
             if (e.key === 'ttAdMp') {
                 if (e.newValue === 'ok') {
                     this.getList()
@@ -119,9 +125,7 @@ export default {
                     localStorage.removeItem('ttAdMp')
                 }
             }
-        })
-    },
-    methods: {
+        },
         /** 获取所有应用 */
         getAll() {
             getAdApp().then(res => {

+ 41 - 0
src/views/corpDoAuth.vue

@@ -0,0 +1,41 @@
+<template>
+    <div></div>
+</template>
+<script>
+import { getQueryObjectSearch } from '@/utils'
+import { addCorpDoAuth } from "@/api/accounts/corpWeChat";
+export default {
+    name: 'corpDoAuth',
+    data() {
+        return {
+
+        }
+    },
+    created() {
+        let query = getQueryObjectSearch()
+        if (Object.keys(query).length > 0) {
+            const loading = this.$loading({
+                lock: true,
+                text: '正在授权,请稍后。。。',
+                spinner: 'el-icon-loading',
+                background: 'rgba(0, 0, 0, 0.8)'
+            });
+            console.log(query);
+            addCorpDoAuth({ authCode: query.auth_code, expiresIn: query.expires_in, state: query.state }).then(response => {
+                loading.close();
+                console.log('response----->', response);
+                let data = response.data
+                if (data) {
+                    localStorage.setItem("corpAdMp", "ok");
+                } else {
+                    localStorage.setItem("corpAdMp", "false");
+                    return
+                }
+                setTimeout(() => {
+                    window.close()
+                }, 200)
+            }).catch(() => loading.close())
+        }
+    }
+}
+</script>

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor