followUpList.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no, viewport-fit=cover" />
  8. <title>微分机器人</title>
  9. <!--引入 element-ui 的样式,-->
  10. <link rel="stylesheet"
  11. href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742018383195/element-ui.css">
  12. <!-- 必须先引入vue, 后使用element-ui -->
  13. <script
  14. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
  15. <!-- 引入element 的组件库-->
  16. <script
  17. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017747738/element-ui.js"></script>
  18. <!-- <script src="js/vconsole.min.js"></script>
  19. <script>
  20. var vConsole = new window.VConsole();
  21. </script> -->
  22. </head>
  23. <style>
  24. body {
  25. margin: 0;
  26. padding: 0;
  27. }
  28. .box {
  29. width: 100vw;
  30. min-height: 100vh;
  31. box-sizing: border-box;
  32. background: #ECEDF1;
  33. }
  34. .page4 {
  35. width: 100vw;
  36. box-sizing: border-box;
  37. padding: 20px 15px;
  38. }
  39. .followup_item {
  40. width: 100%;
  41. background: #FFFFFF;
  42. border-radius: 10px;
  43. padding: 12px 12px 15px;
  44. box-sizing: border-box;
  45. margin-bottom: 20px;
  46. }
  47. .brand {
  48. display: flex;
  49. align-items: center;
  50. padding-bottom: 12px;
  51. border-bottom: 1px dashed #CCCCCC;
  52. font-weight: 400;
  53. font-size: 12px;
  54. color: #999999;
  55. }
  56. .brand img{
  57. width: 20px;
  58. height: 20px;
  59. margin-right: 5px;
  60. }
  61. .content {
  62. display: flex;
  63. align-items: center;
  64. padding: 25px 0;
  65. }
  66. .content img{
  67. width: 64px;
  68. height: 64px;
  69. border-radius: 8px;
  70. margin-right: 10px;
  71. }
  72. .item_msg {
  73. flex: 1;
  74. font-weight: 400;
  75. font-size: 14px;
  76. color: #666666;
  77. }
  78. .item_name {
  79. display: flex;
  80. justify-content: space-between;
  81. align-items: center;
  82. font-weight: 500;
  83. font-size: 16px;
  84. color: #222222;
  85. padding-bottom: 10px;
  86. }
  87. .item_step {
  88. font-weight: 500;
  89. font-size: 12px;
  90. color: #CCCCCC;
  91. }
  92. .item_btn {
  93. width: 100%;
  94. font-weight: bold;
  95. font-size: 14px;
  96. color: #FFFFFF;
  97. padding: 10px 0;
  98. background: #1677FF;
  99. border-radius: 10px;
  100. text-align: center;
  101. }
  102. .loading {
  103. text-align: center;
  104. margin-top: 10px;
  105. }
  106. .loading span {
  107. display: inline-block;
  108. width: 20px;
  109. height: 20px;
  110. border: 2px solid #409eff;
  111. border-left: transparent;
  112. animation: zhuan 0.5s linear infinite;
  113. border-radius: 50%;
  114. }
  115. @keyframes zhuan {
  116. 0% {
  117. transform: rotate(0);
  118. }
  119. 100% {
  120. transform: rotate(360deg);
  121. }
  122. }
  123. .no_data {
  124. text-align: center;
  125. color: #999999;
  126. font-size: 14px;
  127. }
  128. </style>
  129. <body>
  130. <div id="box" class="box">
  131. <!-- 数据查看 -->
  132. <div class="page4">
  133. <div class="followup_list" v-infinite-scroll="getLoad" :infinite-scroll-disabled="disabled" style="overflow:auto">
  134. <div class="followup_item" v-for="(item, index) in followList" :key="index">
  135. <div class="brand">
  136. <img src="./img/wefan.png" alt="">
  137. <span>微分机器人</span>
  138. </div>
  139. <div class="content">
  140. <img :src="item.clientAvatar" />
  141. <div class="item_msg">
  142. <div class="item_name">
  143. <div>{{item.clientName}}</div>
  144. <div class="item_step">当前阶段:<span style="color: #1677FF;">{{item.step}}</span></div>
  145. </div>
  146. <div>该阶段停留时间超过{{item.day}}天</div>
  147. </div>
  148. </div>
  149. <div class="item_btn" @click="toShow(item)">查看</div>
  150. </div>
  151. <p v-if="loading" class="loading">
  152. <span></span>
  153. </p>
  154. <p v-if="noMore" class="no_data">没有更多了</p>
  155. </div>
  156. </div>
  157. </div>
  158. </body>
  159. <script>
  160. new Vue({
  161. el: '#box',
  162. data() {
  163. return {
  164. httpUrl: '',
  165. bId: null,
  166. env: '',
  167. memberId: null,
  168. page: 1,
  169. totalPages: 0,
  170. followList: [],
  171. loading: false,
  172. }
  173. },
  174. computed: {
  175. noMore() {
  176. //当起始页数大于总页数时停止加载
  177. return this.page >= this.totalPages - 1
  178. },
  179. disabled() {
  180. return this.loading || this.noMore
  181. }
  182. },
  183. created() {
  184. this.bId = this.getQueryParam('bId')
  185. this.env = this.getQueryParam('env')
  186. if (!this.env || this.env === 'prod') {
  187. this.httpUrl = 'https://wlapi.wefanbot.com'
  188. } else {
  189. this.httpUrl = 'http://test.wefanbot.com:18993'
  190. }
  191. if (this.getQueryParam('memberId')) {
  192. // 已授权
  193. this.memberId = this.getQueryParam('memberId')
  194. this.getFollowList()
  195. } else {
  196. // 授权
  197. this.getAuth()
  198. }
  199. // this.memberId = "woU17nDAAAnoSca19vZVKiNEKdc9tyYQ"
  200. // this.getFollowList()
  201. },
  202. methods: {
  203. getAuth() {
  204. fetch(this.httpUrl + `/p/insuite/p/getRedirectUri?env=${this.env}&bId=${this.bId}`)
  205. .then(res => {
  206. return res.json()
  207. }).then(result => {
  208. let { data, code, msg } = result
  209. if (code === 1) {
  210. window.location.replace(data)
  211. } else {
  212. this.$message({
  213. message: msg,
  214. type: 'warning'
  215. })
  216. }
  217. })
  218. },
  219. getFollowList() {
  220. fetch(this.httpUrl + '/scrm/v1/wxcp-client-pro/p/stepNoticeList', {
  221. method: 'post',
  222. body: JSON.stringify({
  223. bid: this.bId,
  224. memberId: this.memberId,
  225. page: this.page,
  226. pageCount: 10,
  227. }),
  228. headers: {
  229. 'Content-Type': 'application/json'
  230. }
  231. }).then(res => {
  232. return res.json()
  233. }).then(result => {
  234. let { data, code, msg } = result
  235. if (code === 1) {
  236. this.followList = this.followList.concat(data.records)
  237. this.totalPages = data.pages
  238. this.loading = false
  239. } else {
  240. this.$message({
  241. message: msg,
  242. type: 'warning'
  243. })
  244. }
  245. })
  246. },
  247. getLoad() {
  248. //滑到底部时进行加载
  249. this.loading = true
  250. setTimeout(() => {
  251. this.page += 1
  252. this.getFollowList()
  253. }, 2000)
  254. },
  255. toShow(item) {
  256. window.location.href = `userProfile.html?bId=${item.bid}&env=${this.env}&memberId=${this.memberId}&externalUserId=${item.externalUserId}`
  257. },
  258. // 截取url中的数据
  259. getQueryParam(paramName) {
  260. // 获取当前URL的查询字符串部分
  261. const queryString = window.location.search;
  262. // 创建一个URLSearchParams对象
  263. const urlParams = new URLSearchParams(queryString);
  264. // 返回指定参数的值,如果不存在则返回null
  265. return urlParams.get(paramName);
  266. },
  267. }
  268. })
  269. </script>
  270. </html>