123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470 |
- <template>
- <view>
- <view class="topBgline plr20">
- <view class="justify-start p30 bgcolf radius12">
- <u-avatar :src='detailUser.avatar'></u-avatar>
- <view class="ml16">
- <view class="bold fs28">{{detailUser.name}}</view>
- <view class="fs24 base-color-3">备注:{{detailUser.remark}}</view>
- </view>
- </view>
- </view>
- <view class="bgf p20">
- <view class="justify-between align-center">
- <view>会员资料</view>
- <view class="fs24 u-border plr20 ptb6 radius40 base-color-6"
- @click="changeuser()">修改用户信息</view>
- </view>
- <view class="justify-between">
- <view class="justify-start align-center fs24 mt20 widthpath" >
- <view class="base-color-6 mr40">性别</view>
- <view>{{moreInfo.sex?moreInfo.sex:'未知'}}</view>
- </view>
- <view class="justify-start align-center fs24 mt20 widthpath" >
- <view class="base-color-6 mr40">年龄</view>
- <view>{{moreInfo.age?moreInfo.age:'未知'}}</view>
- </view>
- </view>
- <view class="justify-start align-center fs24 mtb20">
- <view class="base-color-6 mr40">行为习惯</view>
- <view>{{moreInfo.habits?moreInfo.habits:'无'}}</view>
- </view>
- <view class="justify-start align-center fs24">
- <view class="base-color-6 mr40">患病时间</view>
- <view>{{moreInfo.illnessTime?moreInfo.illnessTime:'无'}}</view>
- </view>
- <view class="justify-start align-center fs24 mt20" >
- <view class="base-color-6 mr40">疾病</view>
- <view>{{moreInfo.disease?moreInfo.disease:'无'}}</view>
- </view>
- <view class="justify-start align-center fs24 mt20" >
- <view class="base-color-6 mr40">家人的疾病</view>
- <view>{{moreInfo.familyDisease?moreInfo.familyDisease:'无'}}</view>
- </view>
- <view class="justify-between align-center">
- <view class="justify-start align-center fs24 mt20 widthpath">
- <view class="base-color-6 mr40">是否线下就诊</view>
- <view>{{moreInfo.isLine?'已线下就诊':'无'}}</view>
- </view>
- <view class="justify-start align-center fs24 mt20 widthpath" >
- <view class="base-color-6 mr40 ">体质</view>
- <view>{{moreInfo.constitution?moreInfo.constitution:'无'}}</view>
- </view>
- </view>
- <view class="justify-start align-center fs24 mt20" >
- <view class="base-color-6 mr40">使用药品</view>
- <view>{{moreInfo.medicine?moreInfo.medicine:'无'}}</view>
- </view>
- <view class="justify-start align-center fs24 mt20" >
- <view class="base-color-6 mr40">咨询产品</view>
- <view>{{moreInfo.consultProduct?moreInfo.consultProduct:'无'}}</view>
- </view>
- <view class="justify-start align-center fs24 mt20" >
- <view class="base-color-6 mr40">是否已经购买产品</view>
- <view>{{moreInfo.isBuy?'已购买':'无'}}</view>
- </view>
- </view>
- <view class="center bgf fs28">看课记录</view>
- <view class="bgf p20">
- <view class="justify-start ">
- <view v-for="(item,index) in titname" :key="index" class="justify-start align-center ml28">
- <view :style="{ backgroundColor: statusColors[index] || '#CCCCCC' }"
- class="w24 h24 radius4"></view>
- <view class="fs24 mr6 ml10">{{item}}</view>
- </view>
- </view>
- <view class="fs24 mt20 base-color-6" >近{{typestate==0?'7':'30'}}天看课记录</view>
- <view class="justify-between mt20">
- <view class="justify-start align-center mt12 " style="width: 80%;flex-wrap: wrap">
- <view class="w54 h54 mr20 radius4 mb12" v-for="(item,index) in answerlist" :key="index"
- >
- <view class="fs24 base-color-6">{{item.date.slice(-2)}}</view>
- <view :style="{ backgroundColor: statusColors[item.logType] || '#CCCCCC' }"
- class="w30 h30 radius4"></view>
- </view>
- </view>
- <view class="u-border lh45 plr20 fs24 radius40 base-color-3 h50"
- @click="todetail">{{typestate==0?'详情':'收起'}}</view>
- </view>
- <view class="pt120"></view>
- </view>
- <view class="justify-around botfun bgf">
- <view class="justify-start align-center bottom-btns base-bg"
- @click="navTo('/pages/user/courseManage?userId='+userId)" >
- <view class="colorf ml12">课程管理</view>
- </view>
- <view class="justify-start align-center bottom-btns base-bg"
- @click="navTo('/pages/user/UrgeClasses?userId='+userId)">
- <view class="colorf ml12" >催课管理</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getcustomerlist,
- getcustomer
- } from "@/api/user.js";
- import { getConfigSignature,getQwExternalContactDetails } from '@/api/common.js'
- export default {
- data() {
- return {
- typeOption: [{
- label: '全部',
- value: 0
- }, {
- label: '今天',
- value: 1
- }, {
- label: '昨天',
- value: 2
- }, {
- label: '前天',
- value: 3
- }, {
- label: '近七天',
- value: 4
- }],
- tabindex: 0,
- detailUser: [],
- user: [],
- answerlist:[],
- answerText:'禁用',
- id:'',
- dateTag:'',
- qwUserId:'',
- startTime:"",
- endTime:'',
- todayday: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
- moreInfo:{},
- statusColors: {
- 0: '#909399',
- 1: '#0bc6ff',
- 2: '#67c23a',
- 3: '#f55a4f',
- 4: '#ffd700',
- },
- titname:['未看课','看课中','完课','待看课','看课中断',],
- statelist:[
- { status: 4 },
- { status: 1 },
- { status: 2 },
- { status: 5 },
- { status: 3 },
- { status: 5 },
- { status: 3 },
- ],
- typestate:0,
- externalUserId:'',
- userId:''
- }
- },
- onShow() {
- this.getuser()
- // this.detailUser =uni.getStorageSync('detailUser')
- // if(this.detailUser.status==0){
- // this.answerText='取消禁用'
- // }
- this.qwUserId=uni.getStorageSync('qwUserId')
- this.$nextTick(()=>{
- setTimeout(()=>{
- this.getAnswerlists()
- },200)
- })
- },
- mounted() {
-
- },
- onLoad(option) {
- // this.id=option.id
- this.url=window.location.href;
- this.code=options.code;
- this.corpId=options.corpId;
- uni.setStorageSync("corpId",this.corpId);
- this.externalUserId=uni.getStorageSync("externalUserId");
- var userId=uni.getStorageSync("qwUserId");
- if(userId!=null&&userId!=undefined&&userId!=""){
- this.userId=userId;
- }
- this.getConfigSignature()
- if(this.externalUserId!=null&&this.externalUserId!=undefined&&this.userId!=null&&this.userId!=undefined){
- console.log("获取外部联系人")
- this.getQwExternalContactDetails()
- }
- },
- methods: {
- changeuser(){
- uni.navigateTo({
- url:'/pages/user/editUser?externalUserId='+this.externalUserId
- })
- },
- 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(){
- if(this.typestate==0){
- this.typestate=1
- }else{
- this.typestate=0
- }
- this.getAnswerlists()
- },
- getuser(){
- const data={
- qwExternalContactId:this.externalUserId
- }
- getcustomer(data).then(res=>{
- if (res.code == 200) {
- this.detailUser=res.data
- this.moreInfo=res.moreInfo
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- },
- getAnswerlists() {
- const params = {
- type:this.typestate,
- qwExternalContactId:this.externalUserId
- }
- getcustomerlist(params).then(res => {
- if (res.code == 200) {
- this.answerlist=res.data.data
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- },
- navTo(url){
- uni.navigateTo({
- url
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .widthpath {
- width: 50%;
- }
- .topBgline {
- background: linear-gradient(to right, rgba(225, 238, 255, 1), rgba(223, 224, 254, 1));
- padding-top: 40rpx;
- }
- .bgcolf {
- background: rgba(255, 255, 255, 0.4);
- }
- .actsel {
- background-color: #1773ff;
- color: #fff;
- transition: background-color 0.4s ease-in-out;
- }
- .notact {
- background-color: #f8f8f8;
- }
- .livebox {
- width: calc(50% - 10rpx);
- background-color: #f8f8f8;
- padding: 20rpx 10rpx;
- border-radius: 12rpx;
- }
- .liveboxs {
- width: calc(33% - 10rpx);
- background-color: #f8f8f8;
- padding: 20rpx 10rpx;
- border-radius: 12rpx;
- }
- .bottom-btns {
- padding: 10rpx 40rpx;
- border-radius: 50rpx;
- }
- .botfun {
- position: fixed;
- width: 100%;
- bottom: 0rpx;
- padding: 20rpx 0;
- }
- </style>
|