|
@@ -86,11 +86,11 @@
|
|
</view>
|
|
</view>
|
|
<view class="justify-around botfun bgf">
|
|
<view class="justify-around botfun bgf">
|
|
<view class="justify-start align-center bottom-btns base-bg"
|
|
<view class="justify-start align-center bottom-btns base-bg"
|
|
- @click="navTo('/pages/user/courseManage?externalUserId='+externalUserId)" >
|
|
|
|
|
|
+ @click="navTo('/pages/user/courseManage?userId='+userId)" >
|
|
<view class="colorf ml12">课程管理</view>
|
|
<view class="colorf ml12">课程管理</view>
|
|
</view>
|
|
</view>
|
|
<view class="justify-start align-center bottom-btns base-bg"
|
|
<view class="justify-start align-center bottom-btns base-bg"
|
|
- @click="navTo('/pages/user/UrgeClasses?externalUserId='+externalUserId)">
|
|
|
|
|
|
+ @click="navTo('/pages/user/UrgeClasses?userId='+userId)">
|
|
<view class="colorf ml12" >催课管理</view>
|
|
<view class="colorf ml12" >催课管理</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -102,6 +102,7 @@
|
|
getcustomerlist,
|
|
getcustomerlist,
|
|
getcustomer
|
|
getcustomer
|
|
} from "@/api/user.js";
|
|
} from "@/api/user.js";
|
|
|
|
+ import { getConfigSignature,getQwExternalContactDetails } from '@/api/common.js'
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -126,10 +127,8 @@
|
|
user: [],
|
|
user: [],
|
|
answerlist:[],
|
|
answerlist:[],
|
|
answerText:'禁用',
|
|
answerText:'禁用',
|
|
- userId:[],
|
|
|
|
id:'',
|
|
id:'',
|
|
dateTag:'',
|
|
dateTag:'',
|
|
- externalUserId:'',
|
|
|
|
qwUserId:'',
|
|
qwUserId:'',
|
|
startTime:"",
|
|
startTime:"",
|
|
endTime:'',
|
|
endTime:'',
|
|
@@ -152,7 +151,9 @@
|
|
{ status: 5 },
|
|
{ status: 5 },
|
|
{ status: 3 },
|
|
{ status: 3 },
|
|
],
|
|
],
|
|
- typestate:0
|
|
|
|
|
|
+ typestate:0,
|
|
|
|
+ externalUserId:'',
|
|
|
|
+ userId:''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
@@ -173,10 +174,185 @@
|
|
},
|
|
},
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
// this.id=option.id
|
|
// this.id=option.id
|
|
- // this.corpId=options.corpId;
|
|
|
|
|
|
+ this.corpId=options.corpId;
|
|
// uni.setStorageSync("corpId",this.corpId);
|
|
// uni.setStorageSync("corpId",this.corpId);
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ getQwExternalContactDetails(){
|
|
|
|
+ var that=this
|
|
|
|
+ var data = {
|
|
|
|
+ corpId: this.corpId,
|
|
|
|
+ userId:this.userId,
|
|
|
|
+ externalUserId:this.externalUserId,
|
|
|
|
+ };
|
|
|
|
+ getQwExternalContactDetails(data).then(res => {
|
|
|
|
+ if(res.code==200){
|
|
|
|
+ this.user=res.data;
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ getConfigSignature(){
|
|
|
|
+ var data = {
|
|
|
|
+ corpId: this.corpId,
|
|
|
|
+ url: this.url,
|
|
|
|
+ code: this.code
|
|
|
|
+ };
|
|
|
|
+ if(this.userId!=null){
|
|
|
|
+ data.isGetUserId=0;
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ data.isGetUserId=1;
|
|
|
|
+ }
|
|
|
|
+ var that=this;
|
|
|
|
+ // var obj={cmd:"log",data:"getConfigSignature开始"};
|
|
|
|
+ // uni.$emit('sendMsg',obj);
|
|
|
|
+ getConfigSignature(data).then(
|
|
|
|
+ res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ // var obj={cmd:"log",data:JSON.stringify(res)};
|
|
|
|
+ // uni.$emit('sendMsg',obj);
|
|
|
|
+ if(res.code==200){
|
|
|
|
+ that.isConfig=true;
|
|
|
|
+ const agentConfigSignature = res.config.agentConfigSignature;
|
|
|
|
+ const configSignature = res.config.configSignature;
|
|
|
|
+ const corpId = res.config.corpId;
|
|
|
|
+ const nonceStr = res.config.nonceStr;
|
|
|
|
+ const timestamp = res.config.timestamp;
|
|
|
|
+ const agentId = res.config.agentId;
|
|
|
|
+
|
|
|
|
+ if(res.config.userid!=null&&res.config.userid!=''){
|
|
|
|
+ that.userId = res.config.userid;//当前员工ID
|
|
|
|
+ uni.setStorageSync("qwUserId",that.userId);
|
|
|
|
+ console.log("获取到USERID")
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ console.log("不需要获取USERID")
|
|
|
|
+ }
|
|
|
|
+ console.log(this.userId)
|
|
|
|
+ jWeixin.config({
|
|
|
|
+ beta: true,
|
|
|
|
+ debug: false,
|
|
|
|
+ appId: corpId,
|
|
|
|
+ timestamp: timestamp,
|
|
|
|
+ nonceStr: nonceStr,
|
|
|
|
+ signature: configSignature,
|
|
|
|
+ jsApiList: ['getCurExternalContact','sendChatMessage','openEnterpriseChat']
|
|
|
|
+ });
|
|
|
|
+ // const newSignature={
|
|
|
|
+ // 'timestamp':timestamp,
|
|
|
|
+ // 'nonceStr':nonceStr,
|
|
|
|
+ // 'signature':configSignature,
|
|
|
|
+ // }
|
|
|
|
+ // ww.register({
|
|
|
|
+ // corpId: corpId, // 必填,当前用户企业所属企业ID
|
|
|
|
+ // jsApiList: ['openEnterpriseChat'], // 必填,需要使用的JSAPI列表
|
|
|
|
+ // newSignature // 必填,根据url生成企业签名的回调函数
|
|
|
|
+ // })
|
|
|
|
+ jWeixin.ready(() => {
|
|
|
|
+ jWeixin.agentConfig({
|
|
|
|
+ corpid: corpId,
|
|
|
|
+ agentid: agentId,
|
|
|
|
+ timestamp: timestamp,
|
|
|
|
+ nonceStr: nonceStr,
|
|
|
|
+ signature: agentConfigSignature,
|
|
|
|
+ jsApiList: ['getCurExternalContact','sendChatMessage','openEnterpriseChat'],
|
|
|
|
+ success: (res) => {
|
|
|
|
+ jWeixin.invoke('getCurExternalContact', {}, async (res) => {
|
|
|
|
+ if (res.err_msg === "getCurExternalContact:ok") {
|
|
|
|
+ that.externalUserId = res.userId;
|
|
|
|
+ uni.setStorageSync("externalUserId",res.userId)
|
|
|
|
+ that.getQwExternalContactDetails()
|
|
|
|
+ // that.initInterval=setInterval(function(){
|
|
|
|
+ // if(that.isInit){
|
|
|
|
+ // clearInterval(that.initInterval);
|
|
|
|
+ // that.getQwSopLogsByJsApi();
|
|
|
|
+ // }
|
|
|
|
+ // },200)
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ // 错误处理
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // jWeixin.openEnterpriseChat({
|
|
|
|
+ // // 注意:userIds和externalUserIds至少选填一个。内部群最多2000人;外部群最多500人;如果有微信联系人,最多40人
|
|
|
|
+ // externalUserIds: 'wmfFKfDQAAhvgwhJr9fqkRWjvN0CzFcA', // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
|
|
|
|
+ // groupName: '', // 会话名称。单聊时该参数传入空字符串""即可。
|
|
|
|
+ // chatId: "", // 若要打开已有会话,需指定此参数。如果是新建会话,chatId必须为空串
|
|
|
|
+ // success: function(res) {
|
|
|
|
+ // var chatId = res.chatId; //返回当前群聊ID,仅当使用agentConfig注入该接口权限时才返回chatId
|
|
|
|
+ // // 回调
|
|
|
|
+ // that.externalUserId=res.chatId;
|
|
|
|
+ // console.log(res)
|
|
|
|
+ // setTimeout(function(){
|
|
|
|
+ // jWeixin.invoke('sendChatMessage', {
|
|
|
|
+ // msgtype:"news", //消息类型,必填
|
|
|
|
+ // enterChat: true,
|
|
|
|
+ // text: {
|
|
|
|
+ // content:"你好11111111111111111", //文本内容
|
|
|
|
+ // },
|
|
|
|
+ // news:
|
|
|
|
+ // {
|
|
|
|
+ // link: "https://www.baidu.com/", //H5消息页面url 必填
|
|
|
|
+ // title: "百度一下", //H5消息标题
|
|
|
|
+ // desc: "百度一下你就知道", //H5消息摘要
|
|
|
|
+ // imgUrl: "https://cos.his.cdwjyyh.com/fs/20240914/efc6995ee755489b8a3e0c8413846a4e.jpg", //H5消息封面图片URL
|
|
|
|
+ // },
|
|
|
|
+ // }, function(res) {
|
|
|
|
+
|
|
|
|
+ // if (res.err_msg == 'sendChatMessage:ok') {
|
|
|
|
+ // //发送成功
|
|
|
|
+ // uni.showToast({
|
|
|
|
+ // title: "回车发送",
|
|
|
|
+ // icon: 'none',
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // },500);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // },
|
|
|
|
+ // fail: function(res) {
|
|
|
|
+ // if(res.errMsg.indexOf('function not exist') > -1){
|
|
|
|
+ // alert('版本过低请升级')
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+ },
|
|
|
|
+ fail: (res) => {
|
|
|
|
+ console.error('agentConfig fail:', res);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ jWeixin.error((res) => {
|
|
|
|
+
|
|
|
|
+ console.error('wx.error:', res);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ // uni.setStorageSync("qwUserId",null);
|
|
|
|
+ console.log("获取USERID失败")
|
|
|
|
+ // setTimeout(function(){
|
|
|
|
+ // window.location.reload();
|
|
|
|
+ // },5000);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ rej => {
|
|
|
|
+ setTimeout(function(){
|
|
|
|
+ window.location.reload();
|
|
|
|
+ },5000);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ },
|
|
todetail(){
|
|
todetail(){
|
|
if(this.typestate==0){
|
|
if(this.typestate==0){
|
|
this.typestate=1
|
|
this.typestate=1
|
|
@@ -187,7 +363,7 @@
|
|
},
|
|
},
|
|
getuser(){
|
|
getuser(){
|
|
const data={
|
|
const data={
|
|
- qwExternalContactId:50
|
|
|
|
|
|
+ qwExternalContactId:this.externalUserId
|
|
}
|
|
}
|
|
getcustomer(data).then(res=>{
|
|
getcustomer(data).then(res=>{
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
@@ -204,7 +380,7 @@
|
|
getAnswerlists() {
|
|
getAnswerlists() {
|
|
const params = {
|
|
const params = {
|
|
type:this.typestate,
|
|
type:this.typestate,
|
|
- qwExternalContactId:50
|
|
|
|
|
|
+ qwExternalContactId:this.externalUserId
|
|
}
|
|
}
|
|
getcustomerlist(params).then(res => {
|
|
getcustomerlist(params).then(res => {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|