Commit c66bcbcdbd192a9e516819425371e9f7b3ebfb70
1 parent
e9445e73
oa 小程序客服、首页红包
Showing
6 changed files
with
166 additions
and
3 deletions
app.json
| @@ -236,7 +236,8 @@ | @@ -236,7 +236,8 @@ | ||
| 236 | "name": "pack6", | 236 | "name": "pack6", |
| 237 | "pages": [ | 237 | "pages": [ |
| 238 | "pages/wuliu/wuliu", | 238 | "pages/wuliu/wuliu", |
| 239 | - "pages/free_delivery/free_delivery" | 239 | + "pages/free_delivery/free_delivery", |
| 240 | + "pages/xcxServiceChat/xcxServiceChat" | ||
| 240 | ] | 241 | ] |
| 241 | 242 | ||
| 242 | } | 243 | } |
packageF/pages/xcxServiceChat/xcxServiceChat.js
0 → 100644
| 1 | +// packageF/pages/xcxServiceChat/xcxServiceChat.js | ||
| 2 | +var t = getApp(), | ||
| 3 | +a = t.request, | ||
| 4 | +o = t.globalData.setting | ||
| 5 | +Page({ | ||
| 6 | + | ||
| 7 | + /** | ||
| 8 | + * 页面的初始数据 | ||
| 9 | + */ | ||
| 10 | + data: { | ||
| 11 | + url: o.imghost, | ||
| 12 | + imgUrl:'', | ||
| 13 | + userinfo:{}, | ||
| 14 | + window_info:{}, | ||
| 15 | + imgBoxOffw:true, | ||
| 16 | + imgBoxOffh:true, | ||
| 17 | + }, | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 生命周期函数--监听页面加载 | ||
| 21 | + */ | ||
| 22 | + onLoad(options) { | ||
| 23 | + let window_info = wx.getWindowInfo() | ||
| 24 | + console.error(window_info); | ||
| 25 | + console.log(window_info); | ||
| 26 | + this.getad() | ||
| 27 | + wx.setNavigationBarTitle({ | ||
| 28 | + title: '联系客服' | ||
| 29 | + }) | ||
| 30 | + this.setData({ | ||
| 31 | + userinfo: getApp().globalData.userInfo, | ||
| 32 | + window_info, | ||
| 33 | + }); | ||
| 34 | + | ||
| 35 | + }, | ||
| 36 | + //获取客服广告 | ||
| 37 | + async getad(){ | ||
| 38 | + //---首页广告------- | ||
| 39 | + await getApp().request.promiseGet("/api/weshop/ad/page?pids=1209&store_id=" + o.stoid, { | ||
| 40 | + data: {} | ||
| 41 | + }).then(res => { | ||
| 42 | + if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { | ||
| 43 | + let a = res.data.data.pageData[0]; | ||
| 44 | + let imgUrl = this.data.url + a.ad_code | ||
| 45 | + wx.getImageInfo({ | ||
| 46 | + src: imgUrl, | ||
| 47 | + success: res=>{ | ||
| 48 | + let imgBoxOffw = true | ||
| 49 | + let imgBoxOffh = true | ||
| 50 | + if (res.width > this.data.window_info.screenWidth) { | ||
| 51 | + imgBoxOffw = false | ||
| 52 | + } | ||
| 53 | + if (res.height > this.data.window_info.screenWidth) { | ||
| 54 | + imgBoxOffh = false | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + this.setData({ | ||
| 58 | + imgUrl, | ||
| 59 | + imgBoxOffw, | ||
| 60 | + imgBoxOffh | ||
| 61 | + }) | ||
| 62 | + } | ||
| 63 | + }) | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | + }) | ||
| 67 | + }, | ||
| 68 | + //联系客服 | ||
| 69 | + con_weixin () { | ||
| 70 | + console.log(123456); | ||
| 71 | + console.log(this.data.sys_switch); | ||
| 72 | + // getApp().con_wx(this); | ||
| 73 | + var url=this.data.sys_switch.weapp_customertype_url; | ||
| 74 | + var id=this.data.sys_switch.weapp_customertype_appid; | ||
| 75 | + wx.openCustomerServiceChat({ | ||
| 76 | + extInfo: {url: url}, | ||
| 77 | + corpId: id, | ||
| 78 | + success(res) {} | ||
| 79 | + }) | ||
| 80 | + }, | ||
| 81 | + /** | ||
| 82 | + * 生命周期函数--监听页面初次渲染完成 | ||
| 83 | + */ | ||
| 84 | + onReady() { | ||
| 85 | + | ||
| 86 | + }, | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 生命周期函数--监听页面显示 | ||
| 90 | + */ | ||
| 91 | + onShow() { | ||
| 92 | + | ||
| 93 | + }, | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * 生命周期函数--监听页面隐藏 | ||
| 97 | + */ | ||
| 98 | + onHide() { | ||
| 99 | + | ||
| 100 | + }, | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * 生命周期函数--监听页面卸载 | ||
| 104 | + */ | ||
| 105 | + onUnload() { | ||
| 106 | + | ||
| 107 | + }, | ||
| 108 | + | ||
| 109 | + /** | ||
| 110 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
| 111 | + */ | ||
| 112 | + onPullDownRefresh() { | ||
| 113 | + | ||
| 114 | + }, | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * 页面上拉触底事件的处理函数 | ||
| 118 | + */ | ||
| 119 | + onReachBottom() { | ||
| 120 | + | ||
| 121 | + }, | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * 用户点击右上角分享 | ||
| 125 | + */ | ||
| 126 | + onShareAppMessage() { | ||
| 127 | + | ||
| 128 | + } | ||
| 129 | +}) | ||
| 0 | \ No newline at end of file | 130 | \ No newline at end of file |
packageF/pages/xcxServiceChat/xcxServiceChat.json
0 → 100644
packageF/pages/xcxServiceChat/xcxServiceChat.wxml
0 → 100644
| 1 | +<!--packageF/pages/xcxServiceChat/xcxServiceChat.wxml--> | ||
| 2 | +<button open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}" class="imgBox" style="background-image: url({{imgUrl}});{{(imgBoxOffw && imgBoxOffh) ? ' object-fit: cover;' : ((!imgBoxOffw && !imgBoxOffh) ? 'background-size: 100% 100%;' : (!imgBoxOffw ? 'background-size: 100% ;' :'background-size: auto 100% ' ) ) }}"> | ||
| 3 | + | ||
| 4 | +</button> |
packageF/pages/xcxServiceChat/xcxServiceChat.wxss
0 → 100644
| 1 | +/* packageF/pages/xcxServiceChat/xcxServiceChat.wxss */ | ||
| 2 | + | ||
| 3 | +.mainBox{ | ||
| 4 | + width: 100vw; | ||
| 5 | + height: 100vh; | ||
| 6 | + position: absolute; | ||
| 7 | + left: 0; | ||
| 8 | + right: 0; | ||
| 9 | + top: 0; | ||
| 10 | + bottom: 0; | ||
| 11 | +} | ||
| 12 | +.imgBox{ | ||
| 13 | + height: 100vh; | ||
| 14 | + width: 100vw; | ||
| 15 | + background-position: 50%; | ||
| 16 | + background-repeat: no-repeat; | ||
| 17 | + background-attachment: fixed; | ||
| 18 | + position: relative; | ||
| 19 | + /* object-fit: contain; */ | ||
| 20 | + | ||
| 21 | + /* object-fit: cover; */ | ||
| 22 | +} | ||
| 23 | +image{ | ||
| 24 | + margin: auto; | ||
| 25 | +} | ||
| 0 | \ No newline at end of file | 26 | \ No newline at end of file |
pages/index/index/index.js
| @@ -208,8 +208,9 @@ Page({ | @@ -208,8 +208,9 @@ Page({ | ||
| 208 | getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, { | 208 | getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, { |
| 209 | data: {} | 209 | data: {} |
| 210 | }).then(function (data) { | 210 | }).then(function (data) { |
| 211 | - let code = data.data.code; | ||
| 212 | - if (code == 0) { | 211 | + let code = data.data.code; |
| 212 | + let resdata = data.data.data; | ||
| 213 | + if (code == 0 && resdata.is_index) { | ||
| 213 | 214 | ||
| 214 | th.setData({ | 215 | th.setData({ |
| 215 | showHongbao: true, | 216 | showHongbao: true, |