customer-service.vue 3.27 KB
Newer Older
xulili's avatar
xulili committed
1 2 3 4 5 6 7
<template>
  <div class="customer-service">
    <div class="nav">
      <van-icon
        name="arrow-left"
        size="20"
        class="nav-left"
leiqingsong's avatar
leiqingsong committed
8
        @click="handlerBack"
xulili's avatar
xulili committed
9 10 11 12
      />
      <span class="nav-title">专属客服</span>
    </div>
    <div class="panel-box">
leiqingsong's avatar
leiqingsong committed
13 14
      <div class="panel-content">
        <div class="title">客服二维码</div>
leiqingsong's avatar
leiqingsong committed
15
        <img :src="imageUrl" class="qrCode" alt="" />
leiqingsong's avatar
leiqingsong committed
16 17 18
        <div class="save-code">
          <p>保存二维码</p>
          <p>打开微信扫一扫添加客服</p>
leiqingsong's avatar
leiqingsong committed
19
          <!-- <p>请截图保存!</p> -->
xulili's avatar
xulili committed
20
        </div>
leiqingsong's avatar
leiqingsong committed
21
        <van-button @click="onSave">保存</van-button>
leiqingsong's avatar
leiqingsong committed
22
      </div>
xulili's avatar
xulili committed
23 24 25 26 27
    </div>
  </div>
</template>

<script>
leiqingsong's avatar
leiqingsong committed
28
import { getCustomer } from "@/api/customer";
xulili's avatar
xulili committed
29

xulili's avatar
xulili committed
30
export default {
leiqingsong's avatar
leiqingsong committed
31
  name: "CustomerService",
xulili's avatar
xulili committed
32
  data() {
leiqingsong's avatar
leiqingsong committed
33 34 35 36 37
    return {
      imageUrl: ""
    };
  },
  created() {
leiqingsong's avatar
leiqingsong committed
38 39 40
    setTimeout(() => {
      this.getCustomerData();
    }, 200);
xulili's avatar
xulili committed
41
  },
leiqingsong's avatar
leiqingsong committed
42
  mounted() {},
xulili's avatar
xulili committed
43
  methods: {
leiqingsong's avatar
leiqingsong committed
44 45 46 47
    onSave() {
      const url = this.imageUrl;
      this.$bridgeToAppFun.saveImage(url);
    },
leiqingsong's avatar
leiqingsong committed
48 49 50 51 52 53 54 55
    handlerBack() {
      try {
        this.$bridgeToAppFun.navigateBack();
      } catch {
        console.log("不能和App交互");
        this.$router.go(-1);
      }
    },
xulili's avatar
xulili committed
56 57
    handleUrl(urlName) {
      this.$router.push({ name: urlName });
leiqingsong's avatar
leiqingsong committed
58 59
    },
    getCustomerData() {
xulili's avatar
xulili committed
60
      let params = {
leiqingsong's avatar
leiqingsong committed
61
        userId: JSON.parse(localStorage.getItem("user")).userId
leiqingsong's avatar
leiqingsong committed
62
      };
xulili's avatar
xulili committed
63
      getCustomer(params).then(res => {
leiqingsong's avatar
leiqingsong committed
64
        if (res.code === 0) {
xulili's avatar
xulili committed
65
          this.imageUrl = process.env.VUE_APP_BASE_URL + res.data;
leiqingsong's avatar
leiqingsong committed
66
        }
xulili's avatar
xulili committed
67
      });
xulili's avatar
xulili committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
    }
  }
};
</script>

<style lang="scss" scoped>
$white: #ffffff;
.customer-service {
  width: 100%;
  height: 298px;
  background-image: url("../assets/images/森林状态.png");
  background-size: cover;
  .nav {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 46px;
    color: #fff;
    .nav-left {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 52px;
      height: 100%;
      line-height: 46px;
      text-align: center;
    }
    .nav-title {
      max-width: 60%;
      margin: 0 auto;
      font-weight: bold;
      font-size: 16px;
    }
  }
leiqingsong's avatar
leiqingsong committed
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
  .panel-box {
    height: calc(100vh - 86px);
    padding: 0 15px;
    margin-top: 15px;
    .panel-content {
      width: 100%;
      height: 100%;
      background-color: #ffffff;
      box-shadow: 0px 2px 12px 0px rgba(6, 0, 1, 0.04);
      border-radius: 4px;
      padding-top: 45px;
      box-sizing: border-box;
      .title {
        font-size: 18px;
        font-weight: normal;
        font-stretch: normal;
        line-height: 26px;
        letter-spacing: 0px;
        color: #333333;
        text-align: center;
      }
      .qrCode {
        width: 128px;
        height: 130px;
        margin: 80px auto 30px;
        display: block;
      }
      .save-code {
leiqingsong's avatar
leiqingsong committed
131
        text-align: center;
leiqingsong's avatar
leiqingsong committed
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
        font-size: 14px;
        font-weight: normal;
        font-stretch: normal;
        line-height: 16px;
        letter-spacing: 0px;
        color: #999999;
      }
      .van-button {
        width: 160px;
        height: 36px;
        background-color: #88c678;
        border-radius: 4px;
        font-size: 18px;
        color: #ffffff;
        margin: 85px auto 0;
        display: block;
      }
xulili's avatar
xulili committed
149 150 151 152
    }
  }
}
</style>