UNPKG

@tencentcloud/ai-desk-customer-wechat

Version:

AI Desk customer UIKit for wechat mini program

3 lines (2 loc) 3.79 kB
"use strict";const n=require("../../../@aidesk/uikit-engine/index.js"),d=require("../../../../common/assets.js"),l=require("../../common/Toast/index-uniapp.js"),p=require("../../../utils/logger.js"),k=require("../../../utils/env.js"),f=require("../../../constant.js"),u=require("../../../utils/utils.js"),m=require("../../common/Toast/type.js"),t=require("../../../../common/vendor.js"),T=()=>"../../common/uni-ui/uni-popup/components/uni-popup/uni-popup.js",b=()=>"../message-list/message-elements/message-desk/message-desk-elements/customer-icon.js",_={components:{uniPopup:T,Icon:b},data(){const e=[{id:"101",content:"答非所问",isSelected:!1},{id:"102",content:"信息错误",isSelected:!1},{id:"103",content:"格式不规范",isSelected:!1},{id:"104",content:"内容不完整",isSelected:!1},{id:"105",content:"未匹配相关内容",isSelected:!1},{id:"106",content:"上下文理解错误",isSelected:!1}];return{TUITranslateService:n.jt,iconClose:d.iconClose,feedbackButtonList:e,feedbackButtonListFromStore:!1,feedbackText:"",isTikTok:k.isTikTok,_messageInfo:{}}},mounted(){n.Kt.watch(n.a.CUSTOM,{feedbackTags:this.onFeedbackTags})},unmounted(){n.Kt.unwatch(n.a.CUSTOM,{feedbackTags:this.onFeedbackTags})},computed:{isSubmitEnabled(){return!(this.feedbackButtonList.filter(i=>i.isSelected).length===0&&this.feedbackText.trim()==="")}},methods:{hide(){this.postFeedback(2,this._messageInfo,!1),this.reset()},dialogButtonClick(e){e.isSelected=!e.isSelected},onFeedbackTags(e){e&&(this.feedbackButtonListFromStore=!0,this.feedbackButtonList=e)},reset(){this.feedbackButtonList.forEach(e=>{e.isSelected=!1}),this.feedbackText="",u.closeBottomPopup(this.$refs.popup)},async postFeedback(e,i,r=!1){p.Log.i(`postFeedback type:${e} messageInfo:`,i);let a={type:e,menuSelected:[],otherContent:""};r&&(this.feedbackText&&(a.otherContent=this.feedbackText),a.menuSelected=this.feedbackButtonList.filter(s=>s.isSelected).map(s=>({id:s.id,content:s.content}))),n.Yt.sendCustomMessage({to:i.toAccount,conversationType:n.Vt.TYPES.CONV_C2C,payload:{data:JSON.stringify({src:f.CUSTOM_MESSAGE_SRC.SEND_FEEDBACK,customerServicePlugin:0,feedbackDetail:a,messageInfo:i})}},{onlineUserOnly:!0})},async submit(){await this.postFeedback(2,this._messageInfo,!0),this.showToast(),this.reset()},showToast(){l.Toast({message:n.jt.t("AIDesk.提交成功"),type:m.TOAST_TYPE.SUCCESS,duration:1e3})},onLike(e){this.postFeedback(1,e,!1)},onDislike(e){this._messageInfo=e,u.showBottomPopup(this.$refs.popup)}}};if(!Array){const e=t.resolveComponent("Icon"),i=t.resolveComponent("uniPopup");(e+i)()}function h(e,i,r,a,s,c){return t.e$1({a:t.t(s.TUITranslateService.t("AIDesk.感谢您的反馈,我们会持续优化改进")),b:s.isTikTok},s.isTikTok?{c:s.iconClose}:{d:t.p({src:s.iconClose,width:"16px",height:"16px"})},{e:t.o((...o)=>c.hide&&c.hide(...o)),f:t.t(s.TUITranslateService.t("AIDesk.您遇到了哪方面的问题")),g:t.f(s.feedbackButtonList,(o,C,g)=>({a:t.t(s.feedbackButtonListFromStore?o.content:s.TUITranslateService.t(`AIDesk.${o.content}`)),b:t.n(o.isSelected?"dialog-button-selected":""),c:t.o(x=>c.dialogButtonClick(o))})),h:t.t(s.TUITranslateService.t("AIDesk.其他反馈内容")),i:s.feedbackText,j:t.o(o=>s.feedbackText=o.detail.value),k:t.t(s.TUITranslateService.t("AIDesk.提交")),l:t.n(c.isSubmitEnabled?"dialog-submit":"dialog-submit disabled"),m:t.o((...o)=>c.submit&&c.submit(...o)),n:t.sr("popup","65d321f4-0"),o:t.o(c.hide),p:t.p({type:"bottom",safeArea:!1,isMaskClick:!0,"background-color":"#fff",borderRadius:"20px 20px 20px 20px"})})}const S=t._export_sfc(_,[["render",h],["__scopeId","data-v-65d321f4"]]);wx.createComponent(S); //# sourceMappingURL=../../../../../.sourcemap/mp-weixin/ai-desk-customer-uniapp/components/CustomerServiceChat/feedback-modal/bottom-popup.js.map