| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no, viewport-fit=cover" />
- <title>待办任务</title>
- <!-- 引入样式文件 -->
- <link rel="stylesheet"
- href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1758012584633/vant.css" />
- <link rel="stylesheet" href="../css/page-return.css">
- <!-- 必须先引入vue, 后使用vant-ui -->
- <script
- src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
- <!-- 引入vant的组件库-->
- <!-- 引入 Vant 的 JS 文件 -->
- <script
- src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1758012748487/vant.min.js"></script>
- <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
- <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
- <script src="../js/page-return.js"></script>
- <script src="../js/vconsole.min.js"></script>
- <script>
- var vConsole = new window.VConsole();
- </script>
- </head>
- <style>
- body {
- margin: 0;
- padding: 0;
- }
- .box {
- width: 100vw;
- height: 100vh;
- box-sizing: border-box;
- background: #F7F9FC;
- }
- .page5 {
- width: 100vw;
- box-sizing: border-box;
- padding: 15px;
- padding-bottom: 39px;
- }
- .task_list {
- }
- .task_item {
- width: 100%;
- background: linear-gradient( 180deg, rgba(255,255,255,0.8) 0%, #FFFFFF 100%);
- border-radius: 15px ;
- border: 1px solid #FFFFFF;
- box-sizing: border-box;
- margin-bottom: 15px;
- }
- .task_item:last-child {
- margin-bottom: 0;
- }
- .task_item_title {
- display: flex;
- align-items: center;
- padding: 15px 15px 0;
- position: relative;
- }
- .created_time {
- font-size: 12px;
- color: #999999;
- line-height: 17px;
- position: absolute;
- top: 10px;
- right: 10px;
- }
- .task_item_title img {
- width: 48px;
- height: 48px;
- border-radius: 8px;
- margin-right: 10px;
- }
- .task_item_text {
- font-weight: 500;
- font-size: 14px;
- color: #222222;
- display: flex;
- flex-direction: column;
- gap: 9px;
- }
- .client_tag {
- display: flex;
- align-items: center;
- gap: 8px;
- height: 21px;
- }
- .client_tag span {
- height: 21px;
- font-size: 12px;
- color: #FF4141;
- line-height: 17px;
- border-radius: 5px;
- padding: 2px 8px;
- background: rgba(255, 65, 65, 0.05);
- box-sizing: border-box;
- }
- .task_item_line {
- width: 100%;
- height: 1px;
- margin: 14px 0 10px;
- background: linear-gradient( 180deg, rgba(217,219,227,0) 0%, #D9DBE3 49%, rgba(217,219,227,0) 100%);
- }
- .task_item_des {
- display: flex;
- align-items: flex-start;
- padding: 0 15px 20px;
- }
- .task_des_title {
- font-size: 12px;
- color: #222222;
- line-height: 17px;
- white-space: nowrap;
- }
- .task_des {
- font-size: 12px;
- color: #999999;
- line-height: 18px;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .notask {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding-top: 198px;
- }
- .notask img {
- width: 102px;
- height: 90px;
- }
- .notask_text {
- font-size: 14px;
- color: #CCCCCC;
- line-height: 20px;
- padding-top: 20px;
- }
- .task_btn_box {
- padding: 0 20px 15px;
- }
- .task_btn {
- width: 100%;
- height: 50px;
- color: #136DFB;
- border-radius: 20px;
- font-weight: 500;
- font-size: 14px;
- background: rgba(22, 119, 255, 0.1);
- line-height: 50px;
- text-align: center;
- }
- .task_btn_read {
- width: 100%;
- height: 50px;
- border-radius: 20px;
- font-weight: 500;
- font-size: 14px;
- color: #7D97BF;
- background: rgba(125, 151, 191, 0.1);
- line-height: 50px;
- text-align: center;
- }
- </style>
- <body>
- <div id="box" class="box">
- <div class="page5">
- <div class="task_list" v-if="taskList.length > 0">
- <div class="task_item" v-for="item in taskList" :key="item.id">
- <div class="task_item_title">
- <img :src="item.clientAvatar ? item.clientAvatar : '../img/qw/mem_icon.png'" alt="">
- <div class="task_item_text">
- <div>{{ item.clientName }}</div>
- <div class="client_tag">
- <span v-for="(tag, tagIndex) in item.businessTags" :key="tagIndex">{{ tag }}</span>
- </div>
- </div>
- <div class="created_time">{{ item.createdTime }}</div>
- </div>
- <div class="task_item_line"></div>
- <div class="task_item_des">
- <div class="task_des_title">任务描述:</div>
- <div class="task_des" v-if="taskType === 'CLIENT_LOG'" v-html="item.taskDesc"></div>
- <div class="task_des" v-else>{{item.taskDesc}}</div>
- </div>
- <div class="task_btn_box" @click="handleTaskDetail(item)">
- <div :class="item.isRead ? 'task_btn_read' : 'task_btn'" v-if="taskType === 'MONITORED_MESSAGE'">{{item.isRead ? '已读' : '去回复'}}</div>
- <div :class="item.isRead ? 'task_btn_read' : 'task_btn'" v-else>{{item.isRead ? '已读' : '查看详情'}}</div>
- </div>
- </div>
- </div>
- <div class="notask" v-else>
- <img src="../img/qw/no_task.png" alt="">
- <div class="notask_text">暂无待办任务</div>
- </div>
- </div>
- <!-- 底部返回栏 -->
- <page-return></page-return>
- </div>
- </body>
- <script>
- new Vue({
- el: '#box',
- data() {
- return {
- httpUrl: '',
- bId: null,
- env: '',
- memberId: null,
- taskType: null,
- taskList: [],
- }
- },
- created() {
- this.bId = this.getQueryParam('bId')
- this.env = this.getQueryParam('env')
- if (!this.env || this.env === 'prod') {
- this.httpUrl = 'https://wlapi.wefanbot.com'
- } else {
- this.httpUrl = 'http://test.wefanbot.com:18993'
- }
- if (this.getQueryParam('memberId')) {
- this.memberId = this.getQueryParam('memberId')
- this.taskType = this.getQueryParam('type')
- this.getTaskList()
- }
- this.getQyWxSign()
- },
- methods: {
- getTaskList() {
- fetch(this.httpUrl + `/scrm/v1/wxcp-member-todo-task/p/page?memberId=${this.memberId}&taskType=${this.taskType}&page=1&pageCount=1000`)
- .then(res => {
- return res.json()
- }).then(result => {
- let { data, code, msg } = result
- if (code === 1) {
- this.taskList = data.records || []
- } else {
- vant.Toast.fail(msg)
- }
- })
- },
- handleTaskDetail(item) {
- if (this.taskType === 'MONITORED_MESSAGE') {
- if (!item.clientExternalUserId) {
- vant.Toast.fail('无效')
- return
- }
- wx.openEnterpriseChat({
- externalUserIds: item.clientExternalUserId, // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
- groupName: "", // 会话名称。单聊时该参数传入空字符串""即可。
- chatId: "",
- success: function (res) {
- var chatId = res.chatId; //返回当前群聊ID,仅当使用agentConfig注入该接口权限时才返回chatId
- // 回调
- console.log('成功', res);
- },
- fail: function (res) {
- // 回调
- if (res.errMsg.indexOf('function not exist') > -1) {
- alert('版本过低请升级');
- }
- console.log('失败', res);
- },
- complete: function (res) {
- // 回调
- console.log('完成', res);
- }
- });
- } else if (this.taskType === 'CLIENT_SOP') {
- window.location.href = `taskDetail.html?taskId=${item.businessId}&type=${item.type}&env=${this.env}&bId=${this.bId}`
- } else {
- window.location.href = `taskDetail.html?taskId=${item.todoTaskId}&type=${item.type}&env=${this.env}&bId=${this.bId}`
- }
- },
- getQyWxSign() {
- fetch(this.httpUrl + '/scrm/v1/wxcp-corp/p/getAgentConfig', {
- method: 'post',
- body: JSON.stringify({
- bid: this.bId,
- url: window.location.href,
- }),
- headers: {
- 'Content-Type': 'application/json'
- }
- }).then(res => {
- return res.json()
- }).then(result => {
- let { data, code, msg } = result
- if (code === 1) {
- wx.config({
- beta: true,
- debug: false,
- appId: data.corpid, // 必填,企业号的唯一标识,此处填写企业号corpid
- timestamp: data.timestamp, // 必填,生成签名的时间戳
- nonceStr: data.nonceStr, // 必填,生成签名的随机串
- signature: data.agentSignature, // 必填,签名,见附录1
- jsApiList: ['checkJsApi', 'openEnterpriseChat'] // 必填,需要使用的JS接口列表
- })
- wx.agentConfig({
- corpid: data.corpid,
- agentid: data.agentId,
- timestamp: data.timestamp, // 必填,生成签名的时间戳
- nonceStr: data.nonceStr, // 必填,生成签名的随机串
- signature: data.agentSignature, // 必填,签名,见附录1
- jsApiList: ['openEnterpriseChat'], // 必填,需要使用的JS接口列表
- success: function (res) {
- // 回调
- console.log('agentConfig成功', res);
- },
- fail: function (res) {
- if (res.errMsg.indexOf('function not exist') > -1) {
- alert('版本过低请升级');
- }
- },
- complete: function (res) {
- // 回调
- console.log('complete', res);
- }
- });
- } else {
- vant.Toast.fail(msg)
- }
- })
- },
- // 截取url中的数据
- getQueryParam(paramName) {
- // 获取当前URL的查询字符串部分
- const queryString = window.location.search;
- // 创建一个URLSearchParams对象
- const urlParams = new URLSearchParams(queryString);
- // 返回指定参数的值,如果不存在则返回null
- return urlParams.get(paramName);
- },
- }
- })
- </script>
- </html>
|