| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <template>
- <view>
- <!-- :class="specClass" :style="'top:' + contactTop + 'px;'" -->
- <view :class="[className,classNames]" :style="styles" @click="customerServiceChat" v-if="type == 2">
- <image lazy-load="true" :src="imgUrl" :mode="imageMode" v-if="imgUrl" :style="imgStyle"></image>
- <view v-if="buttonText">
- {{buttonText}}
- </view>
- </view>
- <button style="font-size: inherit;color: inherit;" open-type="contact" hover-class="none" :class="className" v-else>
- <image lazy-load="true" :src="imgUrl" v-if="imgUrl" :style="imgStyle"></image>
- <view v-if="buttonText">{{buttonText}}</view>
- </button>
- </view>
- </template>
- <script>
- const app = getApp();
- const req = require("../../utils/request.js");
- export default {
- data() {
- return {
- chatPrams: {},
- type: 1
- };
- },
- components: {},
- props: {
- imgUrl: String,
- buttonText: String,
- className: String,
- classNames: String,
- styles: String,
- imageMode: String,
- isUpdate: {
- type: Boolean,
- default: true
- },
- productType: {
- type: Number,
- default: 0
- },
- imgStyle: String
- },
- watch: {},
- mounted() {
- // console.log('ready');
- this.getChatPrams();
- // this.getChatList();
- },
- methods: {
- getChatPrams() {
- let that = this;
- let chatPrams = req.getStorage('chatService');
- if(chatPrams){
- that.chatPrams = chatPrams;
- that.type = chatPrams.type;
- console.log('type==', that.type)
- that.$forceUpdate();
- }
- },
- customerServiceChat() {
- let chatPrams = this.chatPrams;
- wx.openCustomerServiceChat({
- extInfo: {
- url: chatPrams.url
- },
- corpId: chatPrams.enterpriseId,
- success(res) {
- console.log('调用微信客服')
- }
- })
- },
- }
- };
- </script>
- <style>
- @import "./index.css";
- </style>
|