企微助手 ,仓库名 短剧

quickwordH5.vue 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  1. <template>
  2. <div class="pageCon quickH5">
  3. <form action="/">
  4. <van-search
  5. v-model="key_word"
  6. show-action
  7. placeholder="搜索话术名称"
  8. @search="onSearch">
  9. <template #action>
  10. <div @click="onSearch" class="searchBox">搜索</div>
  11. </template>
  12. </van-search>
  13. </form>
  14. <van-tabs v-model:active="active" @click-tab="onClickTab" title-active-color="#333" shrink>
  15. <van-tab title="分组话术">
  16. <div class="listBox_group">
  17. <van-collapse
  18. v-model="activeName" accordion @change="switchGroup">
  19. <van-empty v-if="radarGrouplist.length==0" description="暂无数据" />
  20. <template v-for="item in radarGrouplist" :key="item.group_id">
  21. <van-collapse-item :title="item.group_name" :name="item.group_id">
  22. <van-empty v-if="radarlist.length==0" description="暂无数据" />
  23. <van-list
  24. class="listBox_nogroup"
  25. style="max-height: 440px"
  26. v-model:loading="loading"
  27. :finished="finished"
  28. finished-text=""
  29. @load="onLoad" >
  30. <div class="radar_box" v-for="item in radarlist" :key="item.rule_id">
  31. <div class="radar_item">
  32. <div class="titleBox">{{item.title?item.title:'-'}}</div>
  33. <div class="itemBox" v-for="msg in item.msg_list">
  34. <template v-if="msg.chat_type==1">
  35. {{msg.chat_message[msg.chat_message.msgtype].content?msg.chat_message[msg.chat_message.msgtype].content:'-'}}
  36. </template>
  37. <template v-else-if="msg.chat_type==2">
  38. <div class="flex">
  39. <img :src="msg.chat_message[msg.chat_message.msgtype].oss_url" alt="" class="coverImg">
  40. <div class="title">{{msg.chat_message[msg.chat_message.msgtype].name?msg.chat_message[msg.chat_message.msgtype].name:'-'}}</div>
  41. </div>
  42. </template>
  43. <template v-else-if="msg.chat_type==5">
  44. <div class="flex">
  45. <img :src="msg.chat_message[msg.chat_message.msgtype].imgUrl" alt="" class="coverImg">
  46. <div>
  47. <div class="title">{{msg.chat_message[msg.chat_message.msgtype].title?msg.chat_message[msg.chat_message.msgtype].title:'-'}}</div>
  48. <div class="desc">{{msg.chat_message[msg.chat_message.msgtype].desc?msg.chat_message[msg.chat_message.msgtype].desc:'-'}}</div>
  49. </div>
  50. </div>
  51. </template>
  52. <div v-else>
  53. <span v-if="msg.fileType_Val==1">文字: </span>
  54. <span v-if="msg.fileType_Val==2">图片: </span>
  55. <span v-if="msg.fileType_Val==5">链接: </span>
  56. <span v-if="msg.fileType_Val==6">小程序: </span>
  57. <span v-if="msg.fileType_Val==4">文件: </span>
  58. <span v-if="msg.fileType_Val==3">视频: </span>
  59. {{msg.chat_message[msg.chat_message.msgtype].name?
  60. msg.chat_message[msg.chat_message.msgtype].name:
  61. (msg.chat_message[msg.chat_message.msgtype].title?
  62. msg.chat_message[msg.chat_message.msgtype].title:'-')}}
  63. </div>
  64. <div class="flex">
  65. <div class="send_box" @click="send(msg.rule_id,msg.msg_id)">
  66. <van-icon name="guide-o" color="#fff" /> 发送
  67. </div>
  68. <div class="send_box edit_box" v-if="msg.chat_type==1"
  69. @click="editBoxShow(msg.rule_id,msg.msg_id,msg.chat_message[msg.chat_message.msgtype].content)">
  70. <van-icon name="edit" color="#00b38a" /> 修改发送
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </van-list>
  77. </van-collapse-item>
  78. </template>
  79. </van-collapse>
  80. </div>
  81. </van-tab>
  82. <van-tab title="未分组话术">
  83. <van-list
  84. class="listBox_nogroup"
  85. v-model:loading="loading"
  86. :finished="finished"
  87. finished-text=""
  88. @load="onLoad" >
  89. <van-empty v-if="radarlist.length==0" description="暂无数据" />
  90. <div class="radar_box" v-for="item in radarlist" :key="item.rule_id">
  91. <div class="radar_item">
  92. <div class="titleBox">{{item.title?item.title:'-'}}</div>
  93. <div class="itemBox" v-for="msg in item.msg_list">
  94. <template v-if="msg.chat_type==1">
  95. {{msg.chat_message[msg.chat_message.msgtype].content?msg.chat_message[msg.chat_message.msgtype].content:'-'}}
  96. </template>
  97. <template v-else-if="msg.chat_type==2">
  98. <div class="flex">
  99. <img :src="msg.chat_message[msg.chat_message.msgtype].oss_url" alt="" class="coverImg">
  100. <div class="title">{{msg.chat_message[msg.chat_message.msgtype].name?msg.chat_message[msg.chat_message.msgtype].name:'-'}}</div>
  101. </div>
  102. </template>
  103. <template v-else-if="msg.chat_type==5">
  104. <div class="flex">
  105. <img :src="msg.chat_message[msg.chat_message.msgtype].imgUrl" alt="" class="coverImg">
  106. <div>
  107. <div class="title">{{msg.chat_message[msg.chat_message.msgtype].title?msg.chat_message[msg.chat_message.msgtype].title:'-'}}</div>
  108. <div class="desc">{{msg.chat_message[msg.chat_message.msgtype].desc?msg.chat_message[msg.chat_message.msgtype].desc:'-'}}</div>
  109. </div>
  110. </div>
  111. </template>
  112. <div v-else>
  113. <span v-if="msg.fileType_Val==1">文字: </span>
  114. <span v-if="msg.fileType_Val==2">图片: </span>
  115. <span v-if="msg.fileType_Val==5">链接: </span>
  116. <span v-if="msg.fileType_Val==6">小程序: </span>
  117. <span v-if="msg.fileType_Val==4">文件: </span>
  118. <span v-if="msg.fileType_Val==3">视频: </span>
  119. {{msg.chat_message[msg.chat_message.msgtype].name?
  120. msg.chat_message[msg.chat_message.msgtype].name:
  121. (msg.chat_message[msg.chat_message.msgtype].title?
  122. msg.chat_message[msg.chat_message.msgtype].title:'-')}}
  123. </div>
  124. <div class="flex">
  125. <div class="send_box" @click="send(msg.rule_id,msg.msg_id)">
  126. <van-icon name="guide-o" color="#fff" /> 发送
  127. </div>
  128. <div class="send_box edit_box" v-if="msg.chat_type==1"
  129. @click="editBoxShow(msg.rule_id,msg.msg_id,msg.chat_message[msg.chat_message.msgtype].content)">
  130. <van-icon name="edit" color="#00b38a" /> 修改发送
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. </van-list>
  137. </van-tab>
  138. <!-- S 个人SOP -->
  139. <van-tab v-if="isShowUserSop" title="SOP">
  140. <div class="radar_box">
  141. <div class="radar_item">
  142. <div class="itemBox" v-for="(msg, idx) in userSopList" :key="idx">
  143. <template v-if="msg.chat_type==1">
  144. {{msg.content?msg.content:'-'}}
  145. </template>
  146. <template v-else-if="msg.chat_type==2">
  147. <div class="flex">
  148. <img :src="msg.oss_url" class="coverImg">
  149. <div class="title">{{msg.name?msg.name:'-'}}</div>
  150. </div>
  151. </template>
  152. <template v-else-if="msg.chat_type==5">
  153. <div class="flex">
  154. <img :src="msg.imgUrl" alt="" class="coverImg">
  155. <div>
  156. <div class="title">{{msg.title?msg.title:'-'}}</div>
  157. <div class="desc">{{msg.desc?msg.desc:'-'}}</div>
  158. </div>
  159. </div>
  160. </template>
  161. <div v-else>
  162. <span v-if="msg.chat_type==1">文字: </span>
  163. <span v-if="msg.chat_type==2">图片: </span>
  164. <span v-if="msg.chat_type==5">链接: </span>
  165. <span v-if="msg.chat_type==6">小程序: </span>
  166. <span v-if="msg.chat_type==4">文件: </span>
  167. <span v-if="msg.chat_type==3">视频: </span>
  168. {{msg.name ? msg.name : (msg.title ? msg.title : '-')}}
  169. </div>
  170. <div class="flex">
  171. <div class="send_box" @click="send(msg.rule_id,msg.msg_id,'',{isUserSop: true})">
  172. <van-icon name="guide-o" color="#fff" /> 发送
  173. </div>
  174. <!-- <div class="send_box edit_box" v-if="msg.chat_type==1"
  175. @click="editBoxShow(msg.rule_id,msg.msg_id,msg.chat_message[msg.chat_message.msgtype].content)">
  176. <van-icon name="edit" color="#00b38a" /> 修改发送
  177. </div> -->
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </van-tab>
  183. <!-- E 个人SOP -->
  184. </van-tabs>
  185. <van-overlay :show="overshow" >
  186. <div class="overBox">
  187. <van-loading type="spinner" color="#00b38a" />
  188. </div>
  189. </van-overlay>
  190. <van-action-sheet v-model:show="actionShow" title="修改发送">
  191. <div class="actionContent">
  192. <div class="tips">
  193. <van-icon name="bell" color="#00b38a" />
  194. 可对话术进行修改,【发送】后不会影响原有话术
  195. </div>
  196. <div class="textAreaBox">
  197. <div>
  198. <span class="c-00b38a f14" @click="appendCon(1)">[插入用户昵称]</span>
  199. <span class="c-00b38a f14" style="margin-left: 10px;" @click="appendCon(2)">[插入备注名]</span>
  200. </div>
  201. <div class="splitLine"></div>
  202. <van-cell-group inset>
  203. <van-field
  204. v-model="actionedit_obj.actioneditCon"
  205. @blur="campaignNameBlur"
  206. rows="5"
  207. type="textarea"
  208. maxlength="2000"
  209. placeholder="请输入内容"
  210. show-word-limit/>
  211. </van-cell-group>
  212. </div>
  213. <div class="actionSend_box" @click="editSend_Btn">发送</div>
  214. </div>
  215. </van-action-sheet>
  216. </div>
  217. </template>
  218. <script lang="ts" >
  219. import {ref, reactive, onBeforeMount, getCurrentInstance} from "vue";
  220. import { Toast, Search, Tab, Tabs, Collapse, CollapseItem, Empty, Overlay, ActionSheet,Dialog } from 'vant';
  221. import { getQueryString } from '@/utils/common'
  222. import getWxConfig from "@/utils/getWxConfig";
  223. export default {
  224. components: {
  225. [Search.name]: Search,
  226. [Tab.name]: Tab,
  227. [Tabs.name]: Tabs,
  228. [Collapse.name]: Collapse,
  229. [CollapseItem.name]: CollapseItem,
  230. [Empty .name]: Empty ,
  231. [Overlay .name]: Overlay ,
  232. [ActionSheet .name]: ActionSheet ,
  233. },
  234. setup() {
  235. const { proxy } = getCurrentInstance();
  236. const configInfo = reactive({
  237. corpid:'',
  238. user_id:'',
  239. external_userid:''
  240. })
  241. const list = ref([]);
  242. const radarlist = ref([]);
  243. const radarGrouplist = ref([]);
  244. const loading = ref(false);
  245. const actionShow = ref(false);
  246. const overshow = ref(false);
  247. const finished = ref(true);
  248. const pointerIndex = ref();
  249. const activeName = ref();
  250. const key_word = ref('');
  251. const active = ref(0);
  252. const sendMes = ref({});
  253. const actionedit_obj = reactive({
  254. actioneditCon:'',
  255. rule_id:'',
  256. msg_id:''
  257. });
  258. const user_nick = reactive({
  259. name:'',
  260. remark:'',
  261. });
  262. const onSearch = () => {getRadarlist(activeName.value)};
  263. const editSend_Btn = () => {send(actionedit_obj.rule_id,actionedit_obj.msg_id,actionedit_obj.actioneditCon)};
  264. const editBoxShow = (rule_id,msg_id,content) => {
  265. actionedit_obj.actioneditCon = content
  266. actionedit_obj.rule_id = rule_id
  267. actionedit_obj.msg_id = msg_id
  268. actionShow.value = true
  269. if(configInfo.user_id&&configInfo.external_userid){
  270. get_nick()
  271. }else{
  272. if(!configInfo.user_id){
  273. getWxConfig('',(authInfo)=>{url_pin(authInfo)});
  274. }
  275. if(!configInfo.external_userid){
  276. getWxConfig(()=>{get_external_userid()});
  277. }
  278. get_nick()
  279. }
  280. };
  281. const get_nick=()=>{ //获取用户昵称和备注
  282. (proxy as any).$axios.get("/api/h5/chatMenuPage/customerInfo", {
  283. corpid: configInfo.corpid,
  284. user_id:configInfo.user_id,
  285. external_userid:configInfo.external_userid,
  286. }, true).then((res) => {
  287. let data = res.rst.user_info;
  288. user_nick.name = data.name
  289. user_nick.remark = data.remark
  290. }).catch(err => {
  291. Toast.loading({
  292. duration:2000,
  293. message: err,
  294. forbidClick: true,
  295. });
  296. })
  297. }
  298. const campaignNameBlur=(e)=>{//获取光标位置
  299. pointerIndex.value = e.srcElement.selectionStart
  300. }
  301. const appendCon = (type)=>{//将昵称添加到指定位置
  302. let con = actionedit_obj.actioneditCon
  303. if(type==1){
  304. actionedit_obj.actioneditCon = con.slice(0,pointerIndex.value) + ' ' + user_nick.name + ' ' + con.slice(pointerIndex.value)
  305. }else if(type==2){
  306. actionedit_obj.actioneditCon = con.slice(0,pointerIndex.value) + ' ' + user_nick.remark + ' ' + con.slice(pointerIndex.value)
  307. }
  308. }
  309. const switchGroup = (val) => val&&getRadarlist(val);
  310. const onClickTab = ({ title }) =>{
  311. if(title == '分组话术'){
  312. getRadarGrouplist()
  313. }else if(title == '未分组话术'){
  314. activeName.value=0
  315. getRadarlist(0)
  316. }
  317. };
  318. onBeforeMount(() => {//组件挂载之前
  319. if(getQueryString('againJump')){
  320. configInfo.corpid = getQueryString('corpid')
  321. getRadarGrouplist()
  322. wx_getuserinfo()
  323. getWxConfig(()=>{get_external_userid()});
  324. handleGetIsShowUserSop() // 获取个人SOP数据
  325. }else{//获取code
  326. overshow.value = true;
  327. getWxConfig('',(authInfo)=>{url_pin(authInfo) });
  328. }
  329. });
  330. // S ========= 个人sop
  331. const isShowUserSop = ref(false)
  332. const userSopList: any = ref([])
  333. // 获取 external_userid 返回Promise
  334. const handleGetExternalUserid = () => {
  335. return new Promise((resolve, reject) => {
  336. wx.invoke('getCurExternalContact', {}, function(res){
  337. if(res.err_msg == "getCurExternalContact:ok") {
  338. resolve(res.userId)
  339. } else {
  340. reject('获取失败')
  341. }
  342. });
  343. })
  344. }
  345. const handleGetIsShowUserSop = async () => {
  346. Dialog({ message: 'handleGetIsShowUserSop 执行' }) // mock
  347. let external_userid: any = configInfo.external_userid
  348. let USER_SOP = localStorage.getItem('USER_SOP') || ''
  349. Dialog({ message: 'USER_SOP => ' + USER_SOP }) // mock
  350. if (USER_SOP) {
  351. USER_SOP = JSON.parse(USER_SOP)
  352. console.log('USER_SOP => ', USER_SOP)
  353. if (!external_userid) {
  354. external_userid = await handleGetExternalUserid()
  355. }
  356. Dialog({ message: 'external_userid => ' + external_userid }) // mock
  357. let msgList = USER_SOP[external_userid]
  358. Dialog({ message: 'msgList => ' + USER_SOP[external_userid] }) // mock
  359. if (msgList && Array.isArray(msgList)) { // 有当前联系人对应的sop数据
  360. userSopList.value = msgList.map(item => item.content)
  361. isShowUserSop.value = true
  362. } else {
  363. isShowUserSop.value = false
  364. }
  365. } else {
  366. isShowUserSop.value = false
  367. }
  368. }
  369. // E ========= 个人sop
  370. const url_pin = (authInfo)=>{
  371. let redirect_uri = encodeURIComponent(window.location.href+'&againJump=true')
  372. let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${authInfo.corpid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=1&agentid=${authInfo.agent_id}#wechat_redirect`;
  373. let link = document.createElement("a");
  374. link.href = url;
  375. document.body.appendChild(link);
  376. link.click();
  377. document.body.removeChild(link);
  378. }
  379. function get_external_userid () {//获取external_userid
  380. wx.invoke('getCurExternalContact', {
  381. }, function(res){
  382. if(res.err_msg == "getCurExternalContact:ok"){
  383. configInfo.external_userid = res.userId ; //返回当前外部联系人userId
  384. }else {
  385. Toast.loading({
  386. duration:2000,
  387. message: '当前外部联系人userId获取错误',
  388. forbidClick: true,
  389. });
  390. }
  391. });
  392. }
  393. function wx_getuserinfo(){ //获取user_id
  394. (proxy as any).$axios.get("/api/oauth2/userInfo", {
  395. corpid:configInfo.corpid,
  396. code:getQueryString('code'),
  397. },true).then((res) => {
  398. let data = res.rst;
  399. if(res&&res.errno==0){
  400. configInfo.user_id = data.user_id;
  401. }else{
  402. Toast.loading({
  403. duration:2000,
  404. message: res.err,
  405. forbidClick: true,
  406. });
  407. }
  408. }).catch( err => {
  409. Toast.loading({
  410. duration:2000,
  411. message: err,
  412. forbidClick: true,
  413. });
  414. })
  415. }
  416. const getRadarGrouplist=()=>{
  417. overshow.value = true;
  418. (proxy as any).$axios.get("/api/h5/chatMenuPage/groupList", {
  419. corpid: configInfo.corpid,
  420. page: 1,
  421. page_size: 500
  422. }, true).then((res) => {
  423. overshow.value = false;
  424. let data = res.rst;
  425. radarGrouplist.value = data.data
  426. if (data && data.data && data.data.length > 0) {
  427. activeName.value = data.data[0].group_id
  428. getRadarlist(activeName.value)
  429. }
  430. if(res&&res.errno==0){
  431. }else{
  432. Toast.loading({
  433. duration:2000,
  434. message: res.err,
  435. forbidClick: true,
  436. });
  437. }
  438. }).catch(err => {
  439. overshow.value = false;
  440. Toast.loading({
  441. duration:2000,
  442. message: err,
  443. forbidClick: true,
  444. });
  445. })
  446. }
  447. const getRadarlist=(group_id)=>{
  448. if(group_id || group_id==0){
  449. overshow.value = true;
  450. (proxy as any).$axios.get("/api/h5/chatMenuPage/list", {
  451. corpid: configInfo.corpid,
  452. group_id: group_id,
  453. title: key_word.value,
  454. page: 1,
  455. page_size: 500
  456. }, true).then((res) => {
  457. //请求成功
  458. overshow.value = false;
  459. if(res&&res.errno==0){
  460. let data = res.rst;
  461. data.data.forEach(item=>{
  462. item.msg_list.forEach(chart=>{
  463. chart.chat_message = JSON.parse(chart.chat_message)
  464. })
  465. })
  466. radarlist.value = data.data
  467. }else{
  468. Toast.loading({
  469. duration:2000,
  470. message: res.err,
  471. forbidClick: true,
  472. });
  473. }
  474. }).catch(err => {
  475. overshow.value = false;
  476. Toast.loading({
  477. duration:2000,
  478. message: err,
  479. forbidClick: true,
  480. });
  481. })
  482. }else{
  483. Toast.loading({
  484. duration:1000,
  485. message: '暂无数据',
  486. forbidClick: true,
  487. });
  488. }
  489. }
  490. const send=(rule_id,msg_id,editCon,options?)=>{
  491. actionShow.value = false;
  492. overshow.value = true;
  493. getmesBody(rule_id,msg_id,editCon,options)//直接发送,因为发送不需要user_id he external_userid
  494. if (options && options.isUserSop) { // sop数据上报
  495. if(configInfo.user_id && configInfo.external_userid){//如果有user_id he external_userid,直接上报数据
  496. dataReportUserSop(rule_id,msg_id)
  497. }else{//没有,重新获取code
  498. if(!configInfo.user_id){
  499. getWxConfig('',(authInfo)=>{url_pin(authInfo)});
  500. }
  501. if(!configInfo.external_userid){
  502. getWxConfig(()=>{get_external_userid()});
  503. }
  504. dataReportUserSop(rule_id,msg_id)
  505. }
  506. } else {
  507. if(configInfo.user_id && configInfo.external_userid){//如果有user_id he external_userid,直接上报数据
  508. dataReport(rule_id,msg_id)
  509. }else{//没有,重新获取code
  510. if(!configInfo.user_id){
  511. getWxConfig('',(authInfo)=>{url_pin(authInfo)});
  512. }
  513. if(!configInfo.external_userid){
  514. getWxConfig(()=>{get_external_userid()});
  515. }
  516. dataReport(rule_id,msg_id)
  517. }
  518. }
  519. }
  520. const getmesBody=(rule_id,msg_id,editCon,options?)=>{
  521. overshow.value = true;
  522. const params: any = {
  523. corpid: configInfo.corpid,
  524. msg_id: msg_id,
  525. rule_id: rule_id,
  526. }
  527. if (options && options.isUserSop) { // sop类型添加参数
  528. params.type = 2
  529. }
  530. ;(proxy as any).$axios.get("/api/h5/chatMenuPage/chatMessage", params, true).then((res) => {
  531. if(res&&res.errno=='0'){
  532. overshow.value = false;
  533. let res_new = res.rst.data
  534. if(editCon){
  535. res_new.text.content = editCon
  536. }
  537. sendMes.value = res_new
  538. sendRadar()
  539. }else{
  540. overshow.value = false;
  541. Toast.loading({
  542. duration:2000,
  543. message: '失败了,请联系管理员',
  544. forbidClick: true,
  545. });
  546. }
  547. }).catch(err => {
  548. overshow.value = false;
  549. Toast.loading({
  550. duration:2000,
  551. message: err,
  552. forbidClick: true,
  553. });
  554. })
  555. }
  556. const dataReport=(rule_id,msg_id)=>{
  557. (proxy as any).$axios.get("/api/h5/chatMenuPage/report", {
  558. corpid: configInfo.corpid,
  559. user_id:configInfo.user_id,
  560. external_userid:configInfo.external_userid,
  561. msg_id: msg_id,
  562. rule_id: rule_id,
  563. }, true).then((res) => {
  564. if(res&&res.errno=='0'){}else{
  565. Toast.loading({
  566. duration:2000,
  567. message: '上报数据失败了,请联系管理员',
  568. forbidClick: false,
  569. });
  570. }
  571. }).catch(err => {
  572. })
  573. }
  574. const sendRadar=()=>{
  575. let enterChat_obj={enterChat: true}
  576. let synthetic_obj = {...enterChat_obj,...sendMes.value}
  577. wx.invoke('sendChatMessage', synthetic_obj, function (res) {
  578. if (res.err_msg == 'sendChatMessage:ok') { //发送成功
  579. }else if(res.err_msg == 'sendChatMessage:fail_unexpect err'){
  580. Toast.loading({
  581. duration:2000,
  582. message: '发送失败,请检查消息是否合法',
  583. forbidClick: true,
  584. });
  585. }
  586. })
  587. }
  588. const dataReportUserSop=(rule_id,msg_id)=>{
  589. (proxy as any).$axios.get("/api/h5/userSop/report", {
  590. corpid: configInfo.corpid,
  591. rule_id: rule_id,
  592. user_id:configInfo.user_id,
  593. external_userid:configInfo.external_userid,
  594. msg_id: msg_id,
  595. }, true).then((res) => {
  596. if(res&&res.errno=='0'){}else{
  597. Toast.loading({
  598. duration:2000,
  599. message: '上报数据失败了,请联系管理员',
  600. forbidClick: false,
  601. });
  602. }
  603. }).catch(err => {
  604. })
  605. }
  606. const onLoad = () => {
  607. // 异步更新数据
  608. // setTimeout 仅做示例,真实场景中一般为 ajax 请求
  609. // setTimeout(() => {
  610. // for (let i = 0; i < 10; i++) {
  611. // list.value.push(list.value.length + 1);
  612. // }
  613. //
  614. // // 加载状态结束
  615. // loading.value = false;
  616. //
  617. // // 数据全部加载完成
  618. // if (list.value.length >= 40) {
  619. // finished.value = true;
  620. // }
  621. // }, 1000);
  622. };
  623. return {
  624. actionedit_obj,
  625. key_word,
  626. active,
  627. activeName,
  628. list,
  629. loading,
  630. overshow,
  631. actionShow,
  632. finished,
  633. radarlist,
  634. radarGrouplist,
  635. user_nick,
  636. onLoad,
  637. onSearch,
  638. onClickTab,
  639. switchGroup,
  640. send,
  641. editBoxShow,
  642. editSend_Btn,
  643. appendCon,
  644. campaignNameBlur,
  645. isShowUserSop,
  646. userSopList,
  647. };
  648. }
  649. }
  650. </script>
  651. <style lang="scss">
  652. .quickH5{
  653. .van-search__action{
  654. padding: 0;
  655. }
  656. .van-tab__text{
  657. ///*color: #666;*/
  658. font-size: 16px;
  659. }
  660. .van-tab--active{
  661. font-weight: 600;
  662. color: #333;
  663. }
  664. .van-tab--shrink{
  665. padding-left: 0;
  666. padding-right: 20px;
  667. }
  668. .van-tabs__content{
  669. padding: 5px 15px 0;
  670. background-color: #f8f8f8;
  671. height: 700px;
  672. overflow-y: auto;
  673. }
  674. .van-search{
  675. padding: 10px 15px;
  676. .van-search__content{
  677. background: #F8F8F8;
  678. height: 33px;
  679. line-height: 33px;
  680. }
  681. .van-search__field{
  682. padding: 0;
  683. }
  684. .van-field__control{
  685. height: 33px;
  686. line-height: 33px;
  687. }
  688. .van-field__left-icon .van-icon{
  689. margin-top: 6px;
  690. }
  691. }
  692. .van-tabs__wrap{
  693. padding: 0 10px;
  694. }
  695. }
  696. </style>
  697. <style lang="scss" scoped>
  698. .f14{
  699. font-size: 14px;
  700. }
  701. .actionContent{
  702. padding:10px;
  703. .textAreaBox{
  704. background-color: #f8f8f8;
  705. padding:10px;
  706. margin-top:20px;
  707. .splitLine{
  708. height:1px;
  709. border-bottom:1px dashed #f0f0f0;
  710. margin:10px 0;
  711. }
  712. }
  713. .actionSend_box{
  714. height:36px;
  715. line-height:36px;
  716. background: #00b38a;
  717. color: #fff;
  718. width:80%;
  719. text-align:center;
  720. margin: 0 auto;
  721. margin-top:30px;
  722. }
  723. .tips{
  724. font-size: 13px;
  725. text-align: center;
  726. padding: 12px;
  727. background-color: #f8f8f8;
  728. color: #58A392;
  729. }
  730. }
  731. .flex{
  732. display:flex;
  733. align-items:center;
  734. }
  735. .c-00b38a{
  736. color:#00b38a
  737. }
  738. .overBox{
  739. font-size: 18px;
  740. text-align: center;
  741. margin-top: 70%;
  742. }
  743. .pageCon{
  744. //padding: 10px;
  745. .searchBox{
  746. width: 60px;
  747. text-align: center;
  748. background: #00b38a;
  749. color: #fff;
  750. border-top-right-radius: 4px;
  751. border-bottom-right-radius: 4px;
  752. }
  753. .listBox_group{
  754. margin-top: 10px;
  755. }
  756. .listBox_nogroup{
  757. /*border:1px solid red;*/
  758. max-height:500px;
  759. overflow-y:auto;
  760. /*margin-top: 10px;*/
  761. }
  762. .radar_box{
  763. background-color: #f8f8f8;
  764. .radar_item{
  765. padding: 10px;
  766. background-color: #fff;
  767. .titleBox{
  768. color: #000;
  769. font-weight:600;
  770. font-size:14px;
  771. word-wrap:break-word;
  772. }
  773. .coverImg{
  774. width:50px;
  775. height:50px;
  776. margin-right:10px;
  777. }
  778. .title{
  779. color: #444;
  780. font-size: 14px;
  781. word-wrap:break-word;
  782. }
  783. .desc{
  784. color: #999;
  785. margin-top: 4px;
  786. font-size: 12px;
  787. word-wrap:break-word;
  788. }
  789. .itemBox{
  790. background-color: #f8f8f8;
  791. padding:13px 14px;
  792. margin-top:4px;
  793. color: #333;
  794. word-wrap:break-word;
  795. }
  796. }
  797. .send_box{
  798. width: 60px;
  799. height: 26px;
  800. background-color: #00b38a;
  801. color:#fff;
  802. text-align: center;
  803. line-height: 26px;
  804. margin-top:5px;
  805. border-radius: 20px;
  806. margin-right:5px;
  807. font-size:10px;
  808. }
  809. .edit_box{
  810. width: 80px;
  811. background-color: transparent;
  812. color: #00b38a;
  813. border:1px solid #00b38a
  814. }
  815. }
  816. }
  817. </style>