AccountManage.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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" @mouseleave="hiddenImg">示例</span>
  28. </td>
  29. </tr>
  30. </tbody>
  31. <td class="img" v-show="imgFlag">
  32. <img src="" alt="aa" />
  33. </td>
  34. </table>
  35. <div class="footerTip">
  36. <p>*编辑平台账号信息时,请按照示例提示填写账号ID</p>
  37. </div>
  38. </div>
  39. <Modal
  40. v-if="showModal"
  41. @closeme="closeme"
  42. @submit="editForm"
  43. :editData="editData"
  44. ></Modal>
  45. </div>
  46. </template>
  47. <script>
  48. import Modal from "./components/Modal2";
  49. export default {
  50. props: {},
  51. components: {
  52. Modal,
  53. },
  54. data() {
  55. return {
  56. showModal: false,
  57. imgFlag: false,
  58. tableHeader: ["平台名称", "平台账号", "是否认证", "粉丝数", "操作"],
  59. tableData: [],
  60. editData: {},
  61. // dictList: [],
  62. // mediaPlatName: [],
  63. };
  64. },
  65. methods: {
  66. // addDataList: function (account, fansNum, flag, editData) {
  67. // console.log(account, fansNum, flag, editData);
  68. // this.$http({
  69. // url: "/sys/mediaAccount/addMediaAccountInfo",
  70. // method: "post",
  71. // data: {
  72. // accountId: account,
  73. // fansCount: fansNum,
  74. // },
  75. // })
  76. // .then((res) => {
  77. // console.log(res);
  78. // if (res.data.code === 200) {
  79. // // this.tableData = res.data.data;
  80. // }
  81. // })
  82. // .catch((err) => {
  83. // console.log(err);
  84. // });
  85. // },
  86. editForm: function (account, fansNum, flag, editData) {
  87. console.log(account, fansNum, flag, editData);
  88. //alert("编辑");
  89. //this.addDataList(account, fansNum, flag, editData);
  90. let data = {
  91. id: editData["id"],
  92. authentication: flag === "是" ? "1" : "0",
  93. fansCount: fansNum,
  94. accountCode: account
  95. };
  96. this.updateMediaAccountInfo(data).then(() => {
  97. this.selectMediaAccountPage();
  98. });
  99. },
  100. toggleModal: function (i) {
  101. this.editData = this.tableData[i];
  102. this.showModal = true;
  103. },
  104. closeme: function () {
  105. this.showModal = false;
  106. },
  107. showImg: function () {
  108. this.imgFlag = true;
  109. },
  110. hiddenImg: function () {
  111. this.imgFlag = false;
  112. },
  113. //
  114. /* getDataList: function () {
  115. this.$http({
  116. //url: "/sys/mediaAccount/selectMediaAccountPage",
  117. url: "/sys/mediaAccount/addMediaAccountInfo",
  118. method: "post",
  119. data: {},
  120. })
  121. .then((res) => {
  122. console.log(res);
  123. if (res.data.code === 200) {
  124. // this.tableData = res.data.data;
  125. }
  126. })
  127. .catch((err) => {
  128. console.log(err);
  129. });
  130. }, */
  131. // 获取内容分类、媒体平台、常用参数接口的标识,再调接口时需要用到
  132. // selectSysDataDictList: function () {
  133. // return new Promise((resolve, reject) => {
  134. // this.$http({
  135. // method: "post",
  136. // url: "/sys/dataDict/selectSysDataDictList",
  137. // data: {},
  138. // })
  139. // .then((res) => {
  140. // if (res.data && res.data.code === 200) {
  141. // this.dictList = res.data.data;
  142. // resolve();
  143. // } else {
  144. // console.log(res);
  145. // reject();
  146. // }
  147. // })
  148. // .catch((err) => {
  149. // console.log(err);
  150. // reject();
  151. // });
  152. // });
  153. // },
  154. // 获取列表数据 接口
  155. // getDateList: function () {
  156. // this.$http({
  157. // method: "post",
  158. // url: "/sys/dataDict/selectSysDataDictPage",
  159. // data: {
  160. // dictCode: this.dictList[3]["dictCode"],
  161. // parentId: this.dictList[3]["id"],
  162. // },
  163. // })
  164. // .then((res) => {
  165. // if (res.data && res.data.code === 200) {
  166. // this.mediaPlatName = res.data.data;
  167. // //console.log(this.mediaPlatName);
  168. // //取媒体平台名称
  169. // let arr = [];
  170. // let len1 = this.mediaPlatName.length;
  171. // let len2 = this.tableData.length;
  172. // for (let i = 0; i < len1; i++) {
  173. // arr.push(this.mediaPlatName[i].dictName);
  174. // }
  175. // //console.log(arr);
  176. // while(len1 > len2){
  177. // this.tableData.push({})
  178. // }
  179. // //渲染,传递到页面数组
  180. // for (let i = 0; i < this.tableData.length; i++) {
  181. // this.tableData[i].dlrName=arr[i];
  182. // }
  183. // } else {
  184. // console.log(res);
  185. // }
  186. // })
  187. // .catch((err) => {
  188. // console.log(err);
  189. // });
  190. // },
  191. //
  192. // 获取列表数据 接口
  193. selectMediaAccountPage: function () {
  194. this.$http({
  195. method: "post",
  196. url: "/sys/mediaAccount/selectMediaAccountPage",
  197. })
  198. .then((res) => {
  199. if (res.data && res.data.code === 200) {
  200. this.tableData = res.data.data;
  201. console.log(res, "res");
  202. } else {
  203. console.log(res);
  204. }
  205. })
  206. .catch((err) => {
  207. console.log(err);
  208. });
  209. },
  210. updateMediaAccountInfo: function (data = {}) {
  211. return new Promise((resolve, reject) => {
  212. this.$http({
  213. method: "post",
  214. url: "sys/mediaAccount/updateMediaAccountInfo",
  215. data: data,
  216. })
  217. .then((res) => {
  218. console.log(res);
  219. if (res.data && res.data.code === 200) {
  220. console.log(res, "修改");
  221. resolve();
  222. } else {
  223. console.log(res);
  224. reject();
  225. }
  226. })
  227. .catch((err) => {
  228. console.log(err);
  229. reject();
  230. });
  231. });
  232. },
  233. },
  234. mounted() {
  235. this.selectMediaAccountPage();
  236. // this.selectSysDataDictList()
  237. // .then(() => {
  238. // this.getDateList();
  239. // console.log(this.dictList);
  240. // })
  241. // .catch((err) => {
  242. // console.log(err);
  243. // });
  244. },
  245. };
  246. </script>
  247. <style scoped lang="less">
  248. .accountTable {
  249. width: 1030px;
  250. border-collapse: collapse;
  251. position: relative;
  252. .img {
  253. position: absolute;
  254. top: 0;
  255. right: 206px;
  256. width: 200px;
  257. height: 300px;
  258. z-index: 999;
  259. img {
  260. height: 100%;
  261. width: 100%;
  262. }
  263. }
  264. }
  265. .accountTable td {
  266. width: 20%;
  267. height: 35px;
  268. text-align: center;
  269. border: 1px solid #ccc;
  270. }
  271. .theadStyle {
  272. background-color: #8d9092;
  273. border: 1px 1px 0px 0px;
  274. text-align: center;
  275. }
  276. .theadStyle td {
  277. color: #fff;
  278. padding: 7px 5px;
  279. // border: 1px solid #797979;
  280. border: 1px solid #fff;
  281. }
  282. .operationStyle span {
  283. color: #0056a0;
  284. width: 100%;
  285. &:hover {
  286. cursor: pointer;
  287. }
  288. }
  289. .operationStyle span:nth-child(1) {
  290. margin-right: 32px;
  291. }
  292. .upload_record div:nth-child(1) {
  293. margin: 16px;
  294. margin-left: 0px;
  295. }
  296. .footerTip {
  297. p {
  298. color: red;
  299. text-align: right;
  300. }
  301. }
  302. .table_gray {
  303. background: #f5f5f5;
  304. }
  305. </style>