AccountManage.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <!-- 经销商账号管理 -->
  3. <div class="upload_record">
  4. <div>自媒体/社交媒体账号开通情况</div>
  5. <div class="tableBox">
  6. <table class="accountTable">
  7. <thead>
  8. <tr class="theadStyle">
  9. <td v-for="(item, index) in tableHeader" :key="index">
  10. {{ item }}
  11. </td>
  12. </tr>
  13. </thead>
  14. <tbody>
  15. <tr
  16. class="tbodyStyle"
  17. v-for="(obj, index) in tableData"
  18. :key="index"
  19. :class="{ table_gray: index % 2 === 0 }"
  20. >
  21. <td>{{ obj.platformName || '-' }}</td>
  22. <td>{{ obj.accountCode }}</td>
  23. <td>{{ obj.authorizationName }}</td>
  24. <td>{{ obj.fansCount }}</td>
  25. <td class="operationStyle">
  26. <span @click="toggleModal(index)">编辑</span>
  27. <span @mouseenter="showImg(index)" @mouseleave="hiddenImg">示例</span>
  28. </td>
  29. </tr>
  30. </tbody>
  31. <td class="img" v-show="imgFlag">
  32. <img src="../../img/weChat.png" v-if="hoverImg === '微信订阅号'"/>
  33. <img src="../../img/weChat.png" v-if="hoverImg === '微信服务号'"/>
  34. <img src="../../img/toutiao.png" v-if="hoverImg === '抖音'" />
  35. <img src="../../img/douyin.png" v-if="hoverImg === '今日头条'"/>
  36. <img src="../../img/weChat_video.png" v-if="hoverImg === '微信视频号'"/>
  37. </td>
  38. </table>
  39. <div class="footerTip">
  40. <p>*编辑平台账号信息时,请按照示例提示填写账号ID</p>
  41. </div>
  42. </div>
  43. <Modal
  44. v-if="showModal"
  45. @closeme="closeme"
  46. @submit="editForm"
  47. :editData="editData"
  48. ></Modal>
  49. </div>
  50. </template>
  51. <script>
  52. import Modal from "./components/Modal2";
  53. export default {
  54. components: {
  55. Modal,
  56. },
  57. data() {
  58. return {
  59. showModal: false,
  60. imgFlag: false,
  61. tableHeader: ["平台名称", "平台账号", "是否认证", "粉丝数", "操作"],
  62. tableData: [],
  63. editData: {},
  64. accountId: "",
  65. hoverImg: ''
  66. };
  67. },
  68. methods: {
  69. editForm: function (account, fansNum, flag, editData) {
  70. console.log(account, fansNum, flag, editData);
  71. //alert("编辑");
  72. //this.addDataList(account, fansNum, flag, editData);
  73. let data = {
  74. id: editData["id"],
  75. authentication: flag === "是" ? true : false,
  76. // authentication: isAttesta === "是" ? true : false,
  77. fansCount: fansNum,
  78. accountCode: account,
  79. };
  80. this.updateMediaAccountInfo(data).then(() => {
  81. let req = {
  82. accountId: this.accountId,
  83. };
  84. this.selectMediaAccountPage(req);
  85. });
  86. },
  87. toggleModal: function (i) {
  88. this.editData = this.tableData[i];
  89. this.showModal = true;
  90. },
  91. closeme: function () {
  92. this.showModal = false;
  93. },
  94. showImg: function (i) {
  95. this.imgFlag = true;
  96. this.hoverImg = this.tableData[i].platformName || '微信视频号';
  97. console.log(this.hoverImg);
  98. },
  99. hiddenImg: function () {
  100. this.imgFlag = false;
  101. },
  102. // 获取列表数据 接口
  103. selectMediaAccountPage: function (data) {
  104. this.$http({
  105. method: "post",
  106. url: "/sys/mediaAccount/selectMediaAccountPage",
  107. data,
  108. })
  109. .then((res) => {
  110. if (res.data && res.data.code === 200) {
  111. this.tableData = res.data.data;
  112. console.log(res, "res");
  113. } else {
  114. console.log(res);
  115. }
  116. })
  117. .catch((err) => {
  118. console.log(err);
  119. });
  120. },
  121. updateMediaAccountInfo: function (data = {}) {
  122. return new Promise((resolve, reject) => {
  123. this.$http({
  124. method: "post",
  125. url: "sys/mediaAccount/updateMediaAccountInfo",
  126. data: data,
  127. })
  128. .then((res) => {
  129. console.log(res);
  130. if (res.data && res.data.code === 200) {
  131. console.log(res, "修改");
  132. resolve();
  133. } else {
  134. console.log(res);
  135. reject();
  136. }
  137. })
  138. .catch((err) => {
  139. console.log(err);
  140. reject();
  141. });
  142. });
  143. },
  144. },
  145. mounted() {
  146. let userId = localStorage.getItem("userId");
  147. if (userId) {
  148. this.accountId = userId;
  149. } else {
  150. this.accountId = "";
  151. }
  152. let data = {
  153. accountId: this.accountId,
  154. };
  155. this.selectMediaAccountPage(data);
  156. },
  157. };
  158. </script>
  159. <style scoped lang="less">
  160. .accountTable {
  161. width: 1030px;
  162. border-collapse: collapse;
  163. position: relative;
  164. .img {
  165. position: absolute;
  166. top: 0;
  167. right: 206px;
  168. width: 267px;
  169. height: 555px;
  170. z-index: 999;
  171. border: none;
  172. img {
  173. height: 100%;
  174. width: 100%;
  175. }
  176. }
  177. }
  178. .accountTable td {
  179. width: 20%;
  180. height: 35px;
  181. text-align: center;
  182. border: 1px solid #ccc;
  183. }
  184. .theadStyle {
  185. background-color: #8d9092;
  186. border: 1px 1px 0px 0px;
  187. text-align: center;
  188. }
  189. .theadStyle td {
  190. color: #fff;
  191. padding: 7px 5px;
  192. // border: 1px solid #797979;
  193. border: 1px solid #fff;
  194. }
  195. .operationStyle span {
  196. color: #0056a0;
  197. width: 100%;
  198. &:hover {
  199. cursor: pointer;
  200. }
  201. }
  202. .operationStyle span:nth-child(1) {
  203. margin-right: 32px;
  204. }
  205. .upload_record div:nth-child(1) {
  206. margin: 16px;
  207. margin-left: 0px;
  208. }
  209. .footerTip {
  210. p {
  211. color: red;
  212. text-align: right;
  213. }
  214. }
  215. .table_gray {
  216. background: #f5f5f5;
  217. }
  218. </style>