customer.vue 2.2 KB

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