Browse Source

feat: 新增企业微信功能

cmy 1 day ago
parent
commit
93316f8f80
2 changed files with 40 additions and 8 deletions
  1. 40 8
      pages/userhome/user.vue
  2. BIN
      static/image/qyweichat.jpg

+ 40 - 8
pages/userhome/user.vue

@@ -86,7 +86,8 @@
 								<image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
 							</view>
 						</view> -->
-						<view class="flex listItem" @click="navTo('/pages/user/signing/mySig')" v-if="user.info_audit_status==-2">
+						<view class="flex listItem" @click="navTo('/pages/user/signing/mySig')"
+							v-if="user.info_audit_status==-2">
 							<view class="flex titleBox">
 								<image class="listIconImg" src="../../static/icon/myyy.png" mode="widthFix"></image>
 								<text class="title">我的预约</text>
@@ -168,7 +169,7 @@
 							</view>
 						</view>
 						<!-- #ifdef MP -->
-						<button hover-class="none" class="flex listItem" open-type='contact'>
+						<button hover-class="none" class="flex listItem" @click="openEnterpriseWechat">
 							<view class="flex titleBox">
 								<image class="listIconImg" src="../../static/icon/myserve.png" mode="widthFix"></image>
 								<text class="title">客服中心</text>
@@ -273,8 +274,8 @@
 					nickname: '', //昵称
 				},
 				shareData: {},
-				ggList: [] ,//弹窗广告列表
-				showGG:false,//判断是否已经显示广告
+				ggList: [], //弹窗广告列表
+				showGG: false, //判断是否已经显示广告
 			};
 		},
 		computed: {
@@ -297,17 +298,48 @@
 		onShow() {
 			console.log(112233);
 			this.getUser();
-			console.log(this.showGG,'this.showGG');
+			console.log(this.showGG, 'this.showGG');
 			// 判断是否要显示广告弹窗
-			if(!this.showGG&&this.hasLogin&&this.ggList.length>0){
-				this.showGG=true;
-				this.$nextTick(()=>{
+			if (!this.showGG && this.hasLogin && this.ggList.length > 0) {
+				this.showGG = true;
+				this.$nextTick(() => {
 					this.$refs.popup.open()
 				})
 			}
 		},
 		methods: {
 			...mapMutations('user', ['setUserInfo']),
+			// #ifdef MP-WEIXIN
+			openEnterpriseWechat() {
+				uni.showLoading({
+					title: '正在打开企业微信...'
+				});
+				wx.openCustomerServiceChat({
+					corpId: 'wwaff436832bc11deb', // 必填:企业微信的corpId,从企业微信管理后台获取
+					extInfo:{
+						url:'https://work.weixin.qq.com/kfid/kfc2e05cbe1de7cb887'
+					},
+					success: (res) => {
+						uni.hideLoading();
+						console.log('打开企业微信成功', res);
+						uni.showToast({
+							title: '已打开企业微信',
+							icon: 'success'
+						});
+					},
+					fail: (err) => {
+						uni.hideLoading();
+						console.error('打开企业微信失败', err);
+						// 常见失败原因:未安装企业微信、corpid错误、小程序未配置权限等
+						uni.showToast({
+							title: '打开失败,请检查是否安装企业微信',
+							icon: 'none',
+							duration: 3000
+						});
+					}
+				});
+			},
+			// #endif
 			getGG() {
 				getBannerList({
 					page_id: 73

BIN
static/image/qyweichat.jpg