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