index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view style="height: 100vh;margin: 32upx;">
  3. <view style="text-align: center;background: #FFFFFF;padding: 40upx;border-radius: 32upx;">
  4. <view style="font-size: 38upx;">添加客服咨询</view>
  5. <!-- <view style="font-size: 32upx;margin-top: 32upx;">{{weixin}}</view>
  6. <view v-if="weixin" @click="copyHref"
  7. style="background: #557EFD;width:200upx;margin-top: 32upx;font-size: 30upx;margin-left: 36%;color: #FFFFFF;padding: 4upx 20upx;border-radius: 24upx;">
  8. 一键复制</view> -->
  9. <image @click="saveImg" mode="aspectFit" style="margin-top: 32upx" :src="image"></image>
  10. <view style="font-size: 28upx;margin-top: 32upx" v-if="isWeiXin">{{ isWeiXin ? '长按识别上方二维码' : '' }}</view>
  11. <!-- <view @click="goChat"
  12. style="width:260upx;margin-top: 32upx;font-size: 30upx;margin-left: 28%;color: #557EFD;padding: 4upx 20upx;border-radius: 24upx;">
  13. 联系在线客服</view>
  14. -->
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. image: '',
  23. isWeiXin: false,
  24. weixin: '',
  25. webviewStyles: {
  26. progress: {
  27. color: '#1A1929 '
  28. }
  29. }
  30. };
  31. },
  32. onLoad() {
  33. // #ifdef H5
  34. let ua = navigator.userAgent.toLowerCase();
  35. if (ua.indexOf('micromessenger') !== -1) {
  36. this.isWeiXin = true;
  37. }
  38. // #endif
  39. //获取客服二维码
  40. this.$Request.getT('/app/common/type/1').then(res => {
  41. if (res.code == 0) {
  42. if (res.data && res.data.value) {
  43. console.log(res.data.value)
  44. this.image = res.data.value;
  45. }
  46. }
  47. });
  48. this.$Request.getT('/app/common/type/274').then(res => {
  49. if (res.code == 0) {
  50. if (res.data && res.data.value) {
  51. this.weixin = res.data.value;
  52. }
  53. }
  54. });
  55. },
  56. onPullDownRefresh: function() {
  57. uni.stopPullDownRefresh(); // 停止刷新
  58. },
  59. methods: {
  60. //邀请码复制
  61. copyHref() {
  62. uni.setClipboardData({
  63. data: this.weixin,
  64. success: r => {
  65. this.$queue.showToast('复制成功');
  66. }
  67. });
  68. },
  69. saveImg() {
  70. let that = this;
  71. let imgArr = []
  72. imgArr.push(that.image);
  73. //预览图片
  74. uni.previewImage({
  75. urls: imgArr,
  76. current: imgArr[0]
  77. });
  78. // uni.saveImageToPhotosAlbum({
  79. // filePath: that.image,
  80. // success(res) {
  81. // that.$queue.showToast('保存成功');
  82. // }
  83. // });
  84. },
  85. rests() {
  86. uni.showToast({
  87. title: '已刷新请再次长按识别',
  88. mask: false,
  89. duration: 1500,
  90. icon: 'none'
  91. });
  92. window.location.reload();
  93. },
  94. // 在线客服
  95. goChat() {
  96. let token = this.$queue.getData('token');
  97. if (token) {
  98. uni.navigateTo({
  99. url: '/my/setting/chat'
  100. });
  101. } else {
  102. this.goLoginInfo();
  103. }
  104. },
  105. //统一登录跳转
  106. goLoginInfo() {
  107. uni.navigateTo({
  108. url: '/pages/public/loginphone'
  109. });
  110. },
  111. }
  112. };
  113. </script>
  114. <style>
  115. /* @import '../../static/css/index.css'; */
  116. page {
  117. background: #F5F5F5;
  118. }
  119. </style>