pushrulesPages.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <script setup>
  2. import { reactive, toRefs, onMounted, ref, unref, watch } from "vue";
  3. import { getUserChoose, getUser, postChooseSubmitPush, postChooseSubmitType } from "@/api/cygx/api.js";
  4. import { Toast, Checkbox, CheckboxGroup } from "vant";
  5. import { useRouter, useRoute } from "vue-router";
  6. import "vant/es/toast/style";
  7. const router = useRouter();
  8. const route = useRoute();
  9. /**
  10. * 用户详情
  11. */
  12. const userInfo = ref({});
  13. const permissionList = ref([]);
  14. // 获取用户详情
  15. const getUseDate = async () => {
  16. let res = await getUser();
  17. if (res.Ret === 200) {
  18. userInfo.value = res.Data;
  19. console.log(userInfo.value);
  20. }
  21. };
  22. /**
  23. * 获取用户的选择
  24. */
  25. const chooseList = ref([]);
  26. const activeTag = ref(0);
  27. const tabsHandler = (item, index) => {
  28. activeTag.value = index;
  29. };
  30. //获取用户的选择
  31. const getChooseList = async () => {
  32. const res = await getUserChoose();
  33. if (res.Ret === 200) {
  34. const { Data } = res;
  35. IsRefuse.value = Data.IsRefuse;
  36. IsSubjective.value = Data.IsSubjective;
  37. IsObjective.value = Data.IsObjective;
  38. permissionList.value = Data.List;
  39. }
  40. };
  41. //用户的选择保存
  42. const chooseSubmit = async () => {};
  43. const CheckListPushAll = ref(false); // 接受推送的全选
  44. const followAll = ref(false); // 接受推送的全选
  45. const uninterestedAll = ref(false); // 接受推送的全选
  46. // 点击每个小选项的全选
  47. const allHandleCheck = async (e, key) => {
  48. if (key == "TS") {
  49. if (!CheckListPushAll.value) {
  50. permissionList.value[activeTag.value].CheckListPush = [];
  51. } else {
  52. permissionList.value[activeTag.value].CheckListPush = permissionList.value[activeTag.value].ListPush.map((item) => item.IndustrialManagementId);
  53. }
  54. } else if (key == "GZ") {
  55. if (!followAll.value) {
  56. permissionList.value[activeTag.value].CheckListFollow = [];
  57. } else {
  58. permissionList.value[activeTag.value].CheckListFollow = permissionList.value[activeTag.value].ListFollow.map((item) => item.IndustrialManagementId);
  59. }
  60. } else {
  61. if (!uninterestedAll.value) {
  62. permissionList.value[activeTag.value].CheckListUninterested = [];
  63. } else {
  64. permissionList.value[activeTag.value].CheckListUninterested = permissionList.value[activeTag.value].ListUninterested.map((item) => item.IndustrialManagementId);
  65. }
  66. }
  67. };
  68. const allCheck = ref(false);
  69. const allInHandleCheck = (e) => {
  70. CheckListPushAll.value = followAll.value = uninterestedAll.value = e;
  71. };
  72. // 推送更新内容
  73. const IsRefuse = ref(0);
  74. const IsSubjective = ref(0);
  75. const IsObjective = ref(0);
  76. // 推送规则的请求
  77. const pushHandle = async () => {
  78. const res = await postChooseSubmitPush({
  79. IsRefuse: IsRefuse.value,
  80. IsSubjective: IsSubjective.value ? 1 : 0,
  81. IsObjective: IsObjective.value ? 1 : 0,
  82. });
  83. if (res.Ret === 200) {
  84. Toast("操作成功");
  85. getChooseList();
  86. }
  87. };
  88. // 底部的确认按钮
  89. import FocusBtn from "../../assets/cygx/img/FocusBtn.png";
  90. import AcceptBtn from "../../assets/cygx/img/AcceptBtn.png";
  91. import uninterestedBtn from "../../assets/cygx/img/uninterestedBtn.png";
  92. const confirmList = [
  93. {
  94. name: "重点关注",
  95. key: 1,
  96. imgUrl: FocusBtn,
  97. },
  98. {
  99. name: "接受推送",
  100. key: 0,
  101. imgUrl: AcceptBtn,
  102. },
  103. {
  104. name: "不感兴趣",
  105. key: 3,
  106. imgUrl: uninterestedBtn,
  107. },
  108. ];
  109. // 底部确认按钮
  110. const btnConfirm = async (item) => {
  111. let List = [];
  112. permissionList.value.forEach((_, index) => {
  113. if (activeTag.value === index) {
  114. List.push({
  115. ChartPermissionName: _.PermissionName,
  116. CheckList: [..._.CheckListFollow, ..._.CheckListPush, ..._.CheckListUninterested],
  117. });
  118. }
  119. });
  120. console.log(List);
  121. return;
  122. const res = await postChooseSubmitType({
  123. FollowType: item.key,
  124. List,
  125. });
  126. if (res.Ret == 200) {
  127. Toast("操作成功");
  128. getChooseList();
  129. }
  130. };
  131. onMounted(() => {
  132. document.title = "推送规则";
  133. let access_token = route.query.token || "";
  134. localStorage.setItem("access_token", access_token);
  135. getChooseList();
  136. getUseDate();
  137. });
  138. </script>
  139. <template>
  140. <div class="container-tag">
  141. <div class="top-content">
  142. <div class="personal-details">
  143. <div class="head-portrait">
  144. <img :src="userInfo.Headimgurl" v-if="userInfo.Headimgurl" />
  145. <img src="@/assets/cygx/img/init_imgurl.png" v-else />
  146. </div>
  147. <div class="details-item">
  148. <template v-if="userInfo.HasPermission == 0 || userInfo.HasPermission == 2 || userInfo.HasPermission == 3">
  149. <p class="name">{{ userInfo.RealName }}</p>
  150. <p class="phone">{{ userInfo.Mobile }}</p>
  151. <p class="company">{{ userInfo.CompanyName }}</p>
  152. </template>
  153. <p class="no-info" v-else>暂无您的客户信息</p>
  154. </div>
  155. </div>
  156. <div class="authority">
  157. <template v-if="userInfo.HasPermission == 0">
  158. <div :class="['item', activeTag == index && 'act-item']" v-for="(item, index) in permissionList" :key="item.ChartPermissionId" @click="tabsHandler(item, index)">
  159. {{ item.PermissionName }}
  160. <img v-if="item.HasCheck" src="@/assets/cygx/img/WithPermission.png" alt="" />
  161. <img v-else src="@/assets/cygx/img/NoPermission.png" alt="" />
  162. </div>
  163. </template>
  164. <template v-else-if="userInfo.HasPermission == 2 || userInfo.HasPermission == 3">
  165. <div class="item">暂无权限</div>
  166. </template>
  167. </div>
  168. </div>
  169. <template v-if="userInfo.HasPermission == 0">
  170. <div class="push-updates-content">
  171. <div class="switch-content">
  172. <div>
  173. <span>推送更新内容</span>
  174. <span>(重点关注+接受推送) </span>
  175. </div>
  176. <van-switch v-model="IsRefuse" :active-value="1" :inactive-value="0" @change="pushHandle" />
  177. </div>
  178. <div class="distinguish" v-show="IsRefuse">
  179. <div class="distinguish-content">
  180. <Checkbox key="one" @toggle="pushHandle" :name="1" v-model="IsObjective" icon-size="14" shape="square" checked-color="#E2C586">请向我推送【客观类】内容</Checkbox>
  181. <p class="check-explain">(线上/线下调研及调研纪要、产业跟踪、季度跟踪)</p>
  182. </div>
  183. <div class="distinguish-content">
  184. <Checkbox v-model="IsSubjective" @toggle="pushHandle" :name="1" icon-size="14" shape="square" checked-color="#E2C586">请向我推送【主观类】内容</Checkbox>
  185. <p class="check-explain">(行业深度报告、路演精华、财报点评、分析师沙龙、产业深度路演)</p>
  186. </div>
  187. </div>
  188. </div>
  189. <div class="select-content" v-if="permissionList && permissionList.length > 0">
  190. <!-- 重点关注 -->
  191. <div class="checkbox-content">
  192. <div class="title-content-all">
  193. <div class="title-img">
  194. <img src="@/assets/cygx/img/FocusIcon.png" alt="" />
  195. 重点关注
  196. </div>
  197. <Checkbox v-model="followAll" @change="allHandleCheck($event, 'GZ')" icon-size="14" shape="square" checked-color="#E2C586">全选</Checkbox>
  198. </div>
  199. <div class="checkbox-item">
  200. <CheckboxGroup v-model="permissionList[activeTag].CheckListFollow">
  201. <Checkbox
  202. icon-size="14"
  203. shape="square"
  204. checked-color="#E2C586"
  205. :name="item.IndustrialManagementId"
  206. v-for="item in permissionList[activeTag].ListFollow"
  207. :key="item.IndustrialManagementId"
  208. >{{ item.IndustryName }}</Checkbox
  209. >
  210. </CheckboxGroup>
  211. </div>
  212. </div>
  213. <!-- 接受推送 -->
  214. <div class="checkbox-content">
  215. <div class="title-content-all">
  216. <div class="title-img">
  217. <img src="@/assets/cygx/img/AcceptIcon.png" alt="" />
  218. 接受推送
  219. </div>
  220. <Checkbox v-model="CheckListPushAll" @change="allHandleCheck($event, 'TS')" icon-size="14" shape="square" checked-color="#E2C586">全选</Checkbox>
  221. </div>
  222. <div class="checkbox-item">
  223. <CheckboxGroup v-model="permissionList[activeTag].CheckListPush" ref="acceptGroup">
  224. <Checkbox
  225. icon-size="14"
  226. shape="square"
  227. checked-color="#E2C586"
  228. :name="item.IndustrialManagementId"
  229. v-for="item in permissionList[activeTag].ListPush"
  230. :key="item.IndustrialManagementId"
  231. >{{ item.IndustryName }}</Checkbox
  232. >
  233. </CheckboxGroup>
  234. </div>
  235. </div>
  236. <!-- 不感兴趣 -->
  237. <div class="checkbox-content">
  238. <div class="title-content-all">
  239. <div class="title-img">
  240. <img src="@/assets/cygx/img/uninterested.png" alt="" />
  241. 不感兴趣
  242. </div>
  243. <Checkbox v-model="uninterestedAll" @change="allHandleCheck($event, 'XQ')" icon-size="14" shape="square" checked-color="#E2C586">全选</Checkbox>
  244. </div>
  245. <div class="checkbox-item">
  246. <CheckboxGroup v-model="permissionList[activeTag].CheckListUninterested">
  247. <Checkbox
  248. icon-size="14"
  249. shape="square"
  250. checked-color="#E2C586"
  251. :name="item.IndustrialManagementId"
  252. v-for="item in permissionList[activeTag].ListUninterested"
  253. :key="item.IndustrialManagementId"
  254. >{{ item.IndustryName }}</Checkbox
  255. >
  256. </CheckboxGroup>
  257. </div>
  258. </div>
  259. </div>
  260. <div class="confirm-box">
  261. <div>
  262. <Checkbox v-model="allCheck" @change="allInHandleCheck" icon-size="14" shape="square" checked-color="#E2C586">全选</Checkbox>
  263. </div>
  264. <div class="btn-content">
  265. <div class="btn-item" @click="btnConfirm(item)" v-for="item in confirmList" :key="item.key">
  266. <img :src="item.imgUrl" alt="" />
  267. <p>{{ item.name }}</p>
  268. </div>
  269. </div>
  270. </div>
  271. </template>
  272. </div>
  273. </template>
  274. <style lang="scss" scoped>
  275. .container-tag {
  276. min-height: 100vh;
  277. padding: 30px 25px 150px;
  278. background: url("@/assets/cygx/img/bg_icon.png") no-repeat;
  279. background-size: 100% 100%;
  280. .top-content {
  281. width: 100%;
  282. height: 438px;
  283. background: url("@/assets/cygx/img/tag_bg.png") no-repeat;
  284. background-size: 100% 100%;
  285. padding: 68px 25px;
  286. box-sizing: border-box;
  287. }
  288. .personal-details {
  289. display: flex;
  290. .head-portrait {
  291. width: 126px;
  292. height: 126px;
  293. border-radius: 50%;
  294. overflow: hidden;
  295. img {
  296. width: 100%;
  297. height: 100%;
  298. }
  299. }
  300. .details-item {
  301. margin-left: 30px;
  302. font-size: 28px;
  303. color: #fff;
  304. .name {
  305. font-size: 34px;
  306. font-weight: 500;
  307. color: #fff;
  308. }
  309. .phone {
  310. padding: 10px 0 5px;
  311. }
  312. }
  313. }
  314. .authority {
  315. width: 105%;
  316. overflow: hidden;
  317. padding-top: 10px;
  318. display: flex;
  319. flex-wrap: wrap;
  320. .item {
  321. padding: 0 30px;
  322. height: 50px;
  323. font-size: 24px;
  324. border-radius: 4px;
  325. background-color: #403f3e;
  326. margin: 20px 20px 0 0;
  327. border: 1px solid #e5cfb1;
  328. font-weight: 400;
  329. color: #e5cfb1;
  330. display: flex;
  331. align-items: center;
  332. justify-content: center;
  333. img {
  334. display: block;
  335. margin-left: 10px;
  336. width: 24px;
  337. height: 24px;
  338. }
  339. }
  340. .act-item {
  341. background-color: #e2c586;
  342. color: #6c4d08;
  343. }
  344. }
  345. .select-content {
  346. .checkbox-content {
  347. padding: 20px;
  348. background-color: #2b2a2a;
  349. border-radius: 16px;
  350. margin-top: 10px;
  351. overflow: hidden;
  352. .title-content-all {
  353. margin: 30px 0;
  354. color: #e2c586;
  355. display: flex;
  356. align-items: center;
  357. justify-content: space-between;
  358. .title-img {
  359. display: flex;
  360. align-items: center;
  361. img {
  362. width: 40px;
  363. height: 40px;
  364. margin-right: 8px;
  365. }
  366. }
  367. }
  368. }
  369. }
  370. .distinguish {
  371. .distinguish-content {
  372. border: 1px solid #e5cfb133;
  373. color: #e5efff;
  374. padding: 10px 20px;
  375. border-radius: 8px;
  376. margin-top: 20px;
  377. }
  378. .check-explain {
  379. font-size: 24px;
  380. color: #e5cfb1;
  381. text-indent: 1em;
  382. }
  383. }
  384. .confirm-box {
  385. position: fixed;
  386. bottom: 0px;
  387. left: 0;
  388. width: 100%;
  389. height: 112px;
  390. display: flex;
  391. justify-content: space-between;
  392. align-items: center;
  393. padding-left: 30px;
  394. padding-right: 30px;
  395. padding-bottom: calc(0px + constant(safe-area-inset-bottom));
  396. padding-bottom: calc(0px + env(safe-area-inset-bottom));
  397. background: linear-gradient(90deg, #242524 0%, #403e3d 100%);
  398. z-index: 9;
  399. .btn-content {
  400. display: flex;
  401. .btn-item {
  402. text-align: center;
  403. margin-left: 62px;
  404. font-size: 24px;
  405. color: #e2c58666;
  406. img {
  407. display: inline-block;
  408. margin-bottom: 5px;
  409. width: 40px;
  410. height: 40px;
  411. }
  412. }
  413. }
  414. }
  415. .checkbox-item {
  416. :deep(.CheckboxGroup) {
  417. display: flex;
  418. flex-wrap: wrap;
  419. }
  420. :deep(.van-checkbox) {
  421. width: 50%;
  422. }
  423. }
  424. .bottom-btn {
  425. position: relative; // 相对定位
  426. z-index: 0;
  427. width: 368px;
  428. height: 80px;
  429. background: #3385ff;
  430. line-height: 80px;
  431. text-align: center;
  432. margin: 0 auto;
  433. font-size: 34px;
  434. color: #fff;
  435. }
  436. .push-updates-content {
  437. .van-switch--on {
  438. background-color: #e2c586;
  439. }
  440. margin: 20px 0;
  441. padding: 20px;
  442. border-radius: 8px;
  443. background: linear-gradient(90deg, #242424 0%, #403f3e 100%);
  444. }
  445. .switch-content {
  446. color: #e2c586;
  447. span:nth-child(1) {
  448. font-weight: 600;
  449. font-size: 28px;
  450. padding-right: 12px;
  451. }
  452. span {
  453. color: #e2c586;
  454. font-size: 24px;
  455. }
  456. display: flex;
  457. align-items: center;
  458. justify-content: space-between;
  459. }
  460. .wx-app {
  461. position: absolute; // 绝对定位
  462. top: 0;
  463. left: 0;
  464. width: 100%;
  465. height: 100%;
  466. z-index: 100;
  467. opacity: 0;
  468. .btn {
  469. width: 100%;
  470. height: 100%;
  471. }
  472. }
  473. }
  474. </style>
  475. <style scoped>
  476. ::v-deep .van-checkbox__label {
  477. color: #e2c586 !important; /* 修改复选框标签的颜色 */
  478. font-size: 24px !important;
  479. font-weight: 600;
  480. }
  481. ::v-deep .van-checkbox__icon .van-icon {
  482. border: 1px solid #e2c586;
  483. }
  484. </style>