You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 8.2 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <div class="ui container">
  3. <div class="title">
  4. <div class="title-1"><span>邀请好友</span></div>
  5. <div class="title-2"><span>复制二维码或者邀请注册链接分享给好友</span></div>
  6. </div>
  7. <div class="content-1">
  8. <div class="img-c">
  9. <img class="img" :src="bannerImg" />
  10. <div class="txt">{{ bannerTitle }}</div>
  11. </div>
  12. <div class="descr">
  13. <span>{{ pageLinkDesc }}</span>
  14. <a :href="pageLink" target="_blank">点击查看活动详情</a>
  15. </div>
  16. </div>
  17. <div class="content-2">
  18. <div class="txt-c">
  19. <div class="txt-1">
  20. <span>{{ pageOpeniDesc }}</span>
  21. </div>
  22. <div class="txt-2"><span>{{ invitationLink + invitationCode }}</span></div>
  23. <div class="txt-3"><span>推荐人:</span><span>{{ invitationCode }}</span></div>
  24. <el-button class="__copy_link_btn__" type="primary">复制注册邀请链接</el-button>
  25. </div>
  26. <div class="qr-code">
  27. <div id="__qr-code__" style="width:120px;height:120px;"></div>
  28. </div>
  29. </div>
  30. <div class="table-container">
  31. <div>
  32. <el-table border :data="tableData" style="width:100%" v-loading="loading" stripe>
  33. <el-table-column prop="ID" label="已邀请好友" align="left" header-align="center">
  34. <template slot-scope="scope">
  35. <div style="display:flex;align-items:center;padding-left:20px;">
  36. <img src="" alt="" style="height:45px;width:45px;margin-right:10px;" />
  37. <a :href="scope.row.userLink" style="font-weight:500;font-size:15px;">{{ scope.row.userName }}</a>
  38. </div>
  39. </template>
  40. </el-table-column>
  41. <el-table-column prop="statusStr" label="状态" align="center" header-align="center">
  42. <template slot-scope="scope">
  43. <span :style="{ color: scope.row.statusColor }">{{ scope.row.statusStr }}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="regTime" label="注册时间" align="center" header-align="center"></el-table-column>
  47. <template slot="empty">
  48. <span style="font-size: 12px">{{
  49. loading ? $t('loading') : $t('noData')
  50. }}</span>
  51. </template>
  52. </el-table>
  53. </div>
  54. <div class="__r_p_pagination">
  55. <div style="margin-top: 2rem">
  56. <div class="center">
  57. <el-pagination background @current-change="currentChange" :current-page="pageInfo.curpage"
  58. :page-sizes="pageInfo.pageSizes" :page-size="pageInfo.pageSize"
  59. layout="total, sizes, prev, pager, next, jumper" :total="pageInfo.total">
  60. </el-pagination>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import Clipboard from 'clipboard';
  69. import QRCode from 'qrcodejs2';
  70. import { formatDate } from 'element-ui/lib/utils/date-util';
  71. import { getUserInvitationCode } from '~/apis/modules/userinvite';
  72. export default {
  73. data() {
  74. return {
  75. bannerImg: '',
  76. bannerTitle: '',
  77. pageLink: '',
  78. pageLinkDesc: '',
  79. invitationLink: window.origin + '/user/sign_up?sharedUser=',
  80. invitationCode: '',
  81. pageOpeniDesc: '',
  82. loading: false,
  83. tableData: [],
  84. pageInfo: {
  85. curpage: 1,
  86. pageSize: 10,
  87. pageSizes: [10],
  88. total: 0,
  89. },
  90. };
  91. },
  92. components: {},
  93. methods: {
  94. initCopy() {
  95. const clipboard = new Clipboard('.__copy_link_btn__', {
  96. text: () => {
  97. return this.invitationLink + this.invitationCode;
  98. },
  99. });
  100. clipboard.on('success', (e) => {
  101. this.$message({
  102. type: 'success',
  103. message: '分享内容已复制到剪切板'
  104. });
  105. });
  106. clipboard.on('error', (e) => {
  107. this.$message({
  108. type: 'error',
  109. message: '复制错误'
  110. });
  111. });
  112. },
  113. initData() {
  114. getUserInvitationCode().then(res => {
  115. res = res.data;
  116. if (res) {
  117. this.bannerImg = res.page_banner_img;
  118. this.bannerTitle = res.page_banner_title;
  119. this.pageLink = res.page_link;
  120. this.pageLinkDesc = res.page_link_desc;
  121. this.invitationCode = res.invitation_code;
  122. this.pageOpeniDesc = res.page_openi_desc;
  123. this.tableData = res.invitation_users || [];
  124. const qrCode = new QRCode("__qr-code__", {
  125. text: this.invitationLink + this.invitationCode,
  126. width: 120,
  127. height: 120,
  128. colorDark: '#000000',
  129. colorLight: '#ffffff',
  130. correctLevel: QRCode.CorrectLevel.H
  131. });
  132. }
  133. }).catch(err => {
  134. console.log(err);
  135. });
  136. },
  137. getTableData() {
  138. const data = new Array(10).fill(0).map((item, index) => {
  139. const status = Math.random() > 0.5 ? '1' : '2';
  140. return {
  141. userName: 'userName-' + index + '-' + Math.random().toFixed(2),
  142. userLink: 'userLink-' + index + '-' + Math.random().toFixed(2),
  143. status: status,
  144. statusStr: status == '1' ? '已激活' : '未激活',
  145. statusColor: status == '1' ? 'rgb(82, 196, 26)' : 'rgb(245, 34, 45)',
  146. regTime: 'regTime' + index + Math.random().toFixed(2),
  147. }
  148. });
  149. this.tableData = data;
  150. return;
  151. const params = {
  152. page: this.pageInfo.curpage,
  153. pagesize: this.pageInfo.pageSize,
  154. };
  155. this.loading = true;
  156. getResSceneList(params).then(res => {
  157. this.loading = false;
  158. res = res.data;
  159. if (res.Code === 0) {
  160. const list = res.Data.List;
  161. const data = list.map((item) => {
  162. return {
  163. }
  164. });
  165. this.tableData = data;
  166. this.pageInfo.total = res.Data.TotalSize;
  167. }
  168. }).catch(err => {
  169. console.log(err);
  170. this.loading = false;
  171. });
  172. },
  173. currentChange(val) {
  174. this.pageInfo.curpage = val;
  175. this.getTableData();
  176. },
  177. },
  178. mounted() {
  179. // this.getTableData();
  180. this.initData();
  181. this.initCopy();
  182. },
  183. beforeDestroy() {
  184. },
  185. };
  186. </script>
  187. <style scoped lang="less">
  188. .title {
  189. margin-top: 15px;
  190. margin-bottom: 15px;
  191. .title-1 {
  192. font-weight: 500;
  193. font-size: 20px;
  194. color: rgba(16, 16, 16, 1);
  195. margin-bottom: 10px;
  196. }
  197. .title-2 {
  198. font-weight: 400;
  199. font-size: 14px;
  200. color: rgba(136, 136, 136, 1);
  201. }
  202. }
  203. .content-1 {
  204. margin-bottom: 32px;
  205. .img-c {
  206. height: 80px;
  207. position: relative;
  208. .img {
  209. width: 100%;
  210. height: 100%;
  211. }
  212. .txt {
  213. position: absolute;
  214. width: 100%;
  215. height: 100%;
  216. left: 0;
  217. top: 0;
  218. line-height: 80px;
  219. padding-left: 25px;
  220. font-weight: 500;
  221. font-size: 24px;
  222. color: rgb(255, 255, 255);
  223. }
  224. }
  225. .descr {
  226. font-weight: 300;
  227. font-size: 16px;
  228. color: rgb(16, 16, 16);
  229. padding: 25px;
  230. border-left: 1px solid rgba(0, 0, 0, 0.1);
  231. border-right: 1px solid rgba(0, 0, 0, 0.1);
  232. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  233. border-radius: 0px 0px 4px 4px;
  234. }
  235. }
  236. .content-2 {
  237. display: flex;
  238. background-color: rgb(228, 242, 255);
  239. border-color: rgb(228, 242, 255);
  240. border-width: 1px;
  241. border-style: solid;
  242. border-radius: 5px;
  243. padding: 25px;
  244. margin-bottom: 32px;
  245. .txt-c {
  246. flex: 1;
  247. font-weight: 300;
  248. font-size: 16px;
  249. color: rgb(16, 16, 16);
  250. span {
  251. line-height: 24px;
  252. }
  253. div {
  254. margin-bottom: 6px;
  255. }
  256. .txt-3 {
  257. margin-bottom: 15px;
  258. }
  259. }
  260. .qr-code {
  261. width: 150px;
  262. display: flex;
  263. flex-direction: column;
  264. align-items: end;
  265. }
  266. }
  267. .table-container {
  268. margin-bottom: 16px;
  269. /deep/ .el-table__header {
  270. th {
  271. background: rgb(245, 245, 246);
  272. font-size: 12px;
  273. color: rgb(36, 36, 36);
  274. }
  275. }
  276. /deep/ .el-table__body {
  277. td {
  278. font-size: 12px;
  279. }
  280. }
  281. .op-btn {
  282. cursor: pointer;
  283. font-size: 12px;
  284. color: rgb(25, 103, 252);
  285. margin: 0 5px;
  286. }
  287. }
  288. .center {
  289. display: flex;
  290. justify-content: center;
  291. }
  292. </style>