index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <v-container class="invite-user pa-0" fluid>
  3. <div class="box box1">
  4. <div class="box-header">参与步骤</div>
  5. <div class="box-main">
  6. <v-img
  7. class="cybz-content"
  8. src="~/assets/image/activity/invite-user/cybz-content@2x.png"
  9. />
  10. <div class="cybz-content-text">
  11. <div class="cybz-content-text-item">分享好友</div>
  12. <div class="cybz-content-text-item">邀请购买云机</div>
  13. <div class="cybz-content-text-item">返星币换现金</div>
  14. </div>
  15. <v-btn class="share-button" rounded @click="share()">
  16. <template v-if="$userAgent.isApp">分享好友赚星币</template>
  17. <template v-else>复制链接分享好友赚星币</template>
  18. </v-btn>
  19. <!-- <button @click="share()">邀请</button> -->
  20. </div>
  21. <!-- <div class="h-40">13</div> -->
  22. </div>
  23. <div class="box box2">
  24. <div class="box-header">收益明细</div>
  25. <div class="box-main">
  26. <div class="grid grid-cols-2 gap-x-4 gap-y-8">
  27. <div
  28. v-for="(item, index) in dataList"
  29. :key="index"
  30. :class="{
  31. 'col-span-2': index === 6,
  32. }"
  33. >
  34. <div class="label text-sm">
  35. <span>{{ item.label }}</span>
  36. </div>
  37. <div class="value text-2xl font-bold">
  38. <span>{{ item.value | formatNumber }}</span>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- <div class="box box3">
  45. <div class="box-header">返利套餐</div>
  46. <div class="box-main"></div>
  47. </div> -->
  48. <div class="box box4">
  49. <div class="box-header">活动规则</div>
  50. <div class="box-main text-sm" v-html="activityRules">
  51. <!-- <p>1、传播过程中有任何疑问,可直接咨询客服</p>
  52. <p>
  53. 2、用户可以通过分享页面或者套餐给想要分享的人,被分享人购买云机套餐后,分享人可获得套餐对应的星币
  54. </p>
  55. <p>
  56. 3、星币为双子星云手机平台唯一认可代币,仅能通过充值、赠送和分享获得,其它渠道途径非法获取的星币,不受平台认可
  57. </p>
  58. <p>4、星币可在双子星购买任一等价值套餐</p>
  59. <p>
  60. 5、请勿利用双子星传播或扩散任何有关于政治、情色等任何违法的信息,一经发现,取消资格,如果触犯任何法律相关问题,平台不负任何责任
  61. </p> -->
  62. </div>
  63. </div>
  64. <!-- <div class="">invite-user</div> -->
  65. <!-- <button>刷新数据</button> -->
  66. <!-- <div class="">{{ data }}</div> -->
  67. <!-- <div class="text-center">
  68. <span>分享好友购买云机套餐<br />返星币换现金</span>
  69. </div>
  70. <div class="text-center mt-4">
  71. <van-button type="primary" @click="share()">邀请好友</van-button>
  72. </div>
  73. <van-icon name="chat-o" />
  74. <van-icon name="shape-plus" class-prefix="mdi" />
  75. <van-button @click="$fetch()">刷新</van-button>
  76. <div class="ccc">{{ 36666666.123456 | formatNumber }}</div>
  77. <div class="ccc">{{ '2020-01-01' | formatDate }}</div> -->
  78. </v-container>
  79. </template>
  80. <script>
  81. // import qs from 'qs';
  82. // import clipboard from 'clipboardy/browser';
  83. import * as clipboard from 'clipboard-polyfill/text';
  84. import { getStarCoinOverview } from '~/api/activity/invite-user.js';
  85. import { getContentByType } from '~/api/public/agreement.js';
  86. export default {
  87. // auth: false,
  88. name: 'InviteUser',
  89. filters: {},
  90. data() {
  91. return {
  92. data: {
  93. todayIncomeStarCoin: 0,
  94. totalIncomeStarCoin: 0,
  95. todayBuyOrderCount: 0,
  96. totalBuyOrderCount: 0,
  97. todayBuyOrderSuccessCount: 0,
  98. totalBuyOrderSuccessCount: 0,
  99. withdrawStarCoinNum: 0,
  100. inviteUserName: null,
  101. activityId: null,
  102. status: 0,
  103. },
  104. activityRules: '',
  105. };
  106. },
  107. async fetch() {
  108. //
  109. try {
  110. this.getActivityRules();
  111. this.data = (await getStarCoinOverview(this)).data;
  112. } catch (error) {
  113. this.$toast.error(error.message);
  114. }
  115. },
  116. head: {
  117. title: '邀请好友',
  118. // share: {
  119. // title: '标题',
  120. // content: '内容',
  121. // gotoUrl: 'http://localhost',
  122. // shareImg: 'http://localhost',
  123. // },
  124. },
  125. computed: {
  126. dataList() {
  127. return [
  128. { label: '今日收益(星币)', value: this.data.todayIncomeStarCoin },
  129. { label: '总收益(星币)', value: this.data.totalIncomeStarCoin },
  130. { label: '今日购买订单数', value: this.data.todayBuyOrderSuccessCount },
  131. { label: '累计推广订单', value: this.data.totalBuyOrderCount },
  132. {
  133. label: '今日购买成功客户',
  134. value: this.data.todayBuyOrderSuccessCount,
  135. },
  136. {
  137. label: '累计购买成功客户',
  138. value: this.data.totalBuyOrderSuccessCount,
  139. },
  140. // { label: '可提现星币数量', value: this.data.withdrawStarCoinNum },
  141. ];
  142. },
  143. },
  144. mounted() {
  145. this.$userAgent.isMiniProgram &&
  146. this.$wx.miniProgram.postMessage({
  147. data: {
  148. action: 'updateAppMessageShareData',
  149. params: {
  150. title: '双子星云手机',
  151. path: '/pages/home/home',
  152. imageUrl:
  153. location.origin +
  154. require('~/assets/image/activity/invite-user/bg@2x.png'),
  155. // promise: null,
  156. },
  157. },
  158. });
  159. },
  160. methods: {
  161. async share() {
  162. // console.log(this);
  163. if (this.data.status !== 1) {
  164. throw new Error('当前活动已失效');
  165. }
  166. this.$tongji.trackEvent('活动', '分享', '', 0);
  167. const url =
  168. location.origin +
  169. this.$router.resolve({
  170. path: '/activity/invite-user/register',
  171. query: {
  172. invitationUserName: this.data.inviteUserName,
  173. activityId: this.data.activityId,
  174. },
  175. }).href;
  176. if (this.$userAgent.isMiniProgram) {
  177. // 小程序环境
  178. await clipboard.writeText(`${url} 唔即云手机`);
  179. this.$toast.success('链接复制成功');
  180. } else if (this.$userAgent.isApp) {
  181. // app环境
  182. this.$native.share({
  183. title: '双子星APP',
  184. content: '分享好友购买云机套餐,返星币换现金',
  185. gotoUrl: url,
  186. shareImg: 'sdsa.png',
  187. });
  188. } else {
  189. // 浏览器环境
  190. await clipboard.writeText(`${url} 唔即云手机`);
  191. // throw new Error('1231');
  192. this.$toast.success('链接复制成功');
  193. }
  194. },
  195. async getActivityRules() {
  196. const res = await getContentByType(this, 'iuserrules01');
  197. this.activityRules = res.data.content
  198. .replace(/[\d\D]*<body>([\d\D]+)<\/body>[\d\D]*/i, '$1')
  199. .replace(/<div class="phone-container">([\d\D]+)<\/div>/g, '$1');
  200. },
  201. },
  202. };
  203. </script>
  204. <style lang="scss" scoped>
  205. .invite-user {
  206. color: #333;
  207. background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
  208. background-size: 100% auto;
  209. // background-position-y: -44px;
  210. overflow: hidden;
  211. padding-bottom: 30px;
  212. }
  213. .box {
  214. width: 373px;
  215. box-sizing: border-box;
  216. margin: auto;
  217. border-image-source: url('~/assets/image/activity/invite-user/box@2x.png');
  218. border-image-slice: 38 * 2 20 * 2 30 * 2 fill;
  219. // border-image-width: 200px;
  220. // border-image-slice: 200%;
  221. border-width: 38px 15px 15px;
  222. // border-width: 1px;
  223. border-style: solid;
  224. position: relative;
  225. + .box {
  226. margin-top: 30px;
  227. }
  228. .box-header {
  229. position: absolute;
  230. top: -30px;
  231. // left: 141px;
  232. left: 0;
  233. right: 0;
  234. text-align: center;
  235. padding: 0 130px;
  236. color: #fff;
  237. }
  238. .box-main {
  239. padding: 30px 15px 20px;
  240. }
  241. }
  242. .box1 {
  243. margin-top: 275px;
  244. .box-main {
  245. // padding: 30px 15px 20px;
  246. padding-left: 0;
  247. padding-right: 0;
  248. }
  249. .cybz-content {
  250. width: 305px;
  251. height: 75px;
  252. margin: auto;
  253. display: block;
  254. // margin-top: 30px;
  255. }
  256. .cybz-content-text {
  257. // display: flex;
  258. display: grid;
  259. // width: 305px;
  260. // padding: 0 28px;
  261. // align-items: center;
  262. // margin: auto;
  263. // justify-content: space-between;
  264. grid-template-columns: 1fr 1fr 1fr;
  265. font-size: 12px;
  266. color: #333;
  267. .cybz-content-text-item {
  268. // width: 0;
  269. // flex: auto;
  270. text-align: center;
  271. }
  272. }
  273. .share-button {
  274. display: block;
  275. margin: auto;
  276. width: 302px !important;
  277. height: 62px !important;
  278. background-image: url('~/assets/image/activity/invite-user/share-button@2x.png');
  279. background-size: 100% 100%;
  280. margin-top: 24px;
  281. // margin-bottom: 24px;
  282. color: #dd1b0d;
  283. font-size: 22px;
  284. font-weight: bold;
  285. }
  286. }
  287. .box2 {
  288. .label {
  289. // font-size: 14px;
  290. }
  291. .value {
  292. color: #ff6600;
  293. // font-size: 24px;
  294. }
  295. .box-main {
  296. padding-left: 20px;
  297. padding-right: 20px;
  298. }
  299. }
  300. .box4 {
  301. .box-main {
  302. // padding-left: 20px;
  303. // padding-top: 0;
  304. }
  305. }
  306. </style>