Commit 9da91f4b9574ef7789527b08bb9127331cc8f643

Authored by zhiyangdu
1 parent 32ad49b7

解决设置css背景图片路径问题

build/utils.js
@@ -48,7 +48,7 @@ exports.cssLoaders = function (options) { @@ -48,7 +48,7 @@ exports.cssLoaders = function (options) {
48 return ExtractTextPlugin.extract({ 48 return ExtractTextPlugin.extract({
49 use: loaders, 49 use: loaders,
50 fallback: 'vue-style-loader', 50 fallback: 'vue-style-loader',
51 - publicPath: '../../' //解决css背景图路径错位问题 51 + publicPath: '../../' //解决css背景图路径获取不到问题
52 }) 52 })
53 } else { 53 } else {
54 return ['vue-style-loader'].concat(loaders) 54 return ['vue-style-loader'].concat(loaders)
src/components/receivingGiftsItem/receivingGiftsItem.less
@@ -144,7 +144,7 @@ @@ -144,7 +144,7 @@
144 .img { 144 .img {
145 width: 16px; 145 width: 16px;
146 height: 16px; 146 height: 16px;
147 - background: url("/static/img/spot_active.png") no-repeat 147 + background: url("../../../static/img/spot_active.png") no-repeat
148 top; 148 top;
149 background-size: 100%; 149 background-size: 100%;
150 } 150 }
src/pages/myGiftBox/myGiftBox.vue
1 <template> 1 <template>
2 <div class="my_gift_box"> 2 <div class="my_gift_box">
3 <!--tab切换--> 3 <!--tab切换-->
4 - <div class="top_box" :style="'padding-top: ' + ($parent.top.value) + 'px'">  
5 - <img src="static/img/icon_back.png" /> 4 + <div
  5 + class="top_box"
  6 + :style="'padding-top: ' + $parent.top.value + 'px'"
  7 + >
  8 + <img @click="$parent.back" src="static/img/icon_back.png" />
6 <div class="tabs"> 9 <div class="tabs">
7 <van-tabs @change="onTap" v-model="active"> 10 <van-tabs @change="onTap" v-model="active">
8 <van-tab title="收礼"></van-tab> 11 <van-tab title="收礼"></van-tab>
9 <van-tab title="送礼"></van-tab> 12 <van-tab title="送礼"></van-tab>
10 </van-tabs> 13 </van-tabs>
11 </div> 14 </div>
12 - <div class="desc">规则说明</div> 15 + <div class="desc" @click="giftRules">规则说明</div>
13 </div> 16 </div>
14 <!--内容--> 17 <!--内容-->
15 <div class="item_box"> 18 <div class="item_box">
16 - <div  
17 - infinite-scroll-immediate-check="true"  
18 - v-infinite-scroll="getorderGiftList"  
19 - infinite-scroll-disabled="loading"  
20 - :infinite-scroll-distance="50"  
21 - >  
22 - <!-- 收礼列表 -->  
23 - <receiving-gifts-item  
24 - v-show="active != 1 && active == 0"  
25 - @onUserInfo="onUserInfo"  
26 - @giftInReturn="giftInReturn"  
27 - @onReceivingGifts="onReceivingGifts"  
28 - :receivingGiftsInfo="receivingGiftsInfo"  
29 - ></receiving-gifts-item>  
30 - <!-- 送礼列表 -->  
31 - <giftGivingItem  
32 - @onGiftGiving="onGiftGiving"  
33 - v-show="active != 0 && active == 1"  
34 - :giftGivingItem="giftGivingItem" 19 + <div
  20 + infinite-scroll-immediate-check="true"
  21 + v-infinite-scroll="getorderGiftList"
  22 + infinite-scroll-disabled="loading"
  23 + :infinite-scroll-distance="50"
35 > 24 >
36 - </giftGivingItem>  
37 - </div> 25 + <!-- 收礼列表 -->
  26 + <receiving-gifts-item
  27 + v-show="active != 1 && active == 0"
  28 + @onUserInfo="onUserInfo"
  29 + @giftInReturn="giftInReturn"
  30 + @onReceivingGifts="onReceivingGifts"
  31 + :receivingGiftsInfo="receivingGiftsInfo"
  32 + ></receiving-gifts-item>
  33 + <!-- 送礼列表 -->
  34 + <giftGivingItem
  35 + @onGiftGiving="onGiftGiving"
  36 + v-show="active != 0 && active == 1"
  37 + :giftGivingItem="giftGivingItem"
  38 + >
  39 + </giftGivingItem>
  40 + </div>
38 </div> 41 </div>
39 </div> 42 </div>
40 </template> 43 </template>
@@ -55,6 +58,7 @@ export default { @@ -55,6 +58,7 @@ export default {
55 pages: 0 // 分页 58 pages: 0 // 分页
56 }, 59 },
57 giftGivingItem: null, // 送礼列表页数据 60 giftGivingItem: null, // 送礼列表页数据
  61 + giftsRuleUrl:null, // 礼物规则URL
58 giftGiving: { 62 giftGiving: {
59 loading: false, // 加载 63 loading: false, // 加载
60 pages: 0 // 分页 64 pages: 0 // 分页
@@ -70,33 +74,46 @@ export default { @@ -70,33 +74,46 @@ export default {
70 this.getorderGiftList(); 74 this.getorderGiftList();
71 // 送礼订单列表 75 // 送礼订单列表
72 this.getorderGiveGiftList(); 76 this.getorderGiveGiftList();
73 - // 调用im是否显示隐藏  
74 - this.setGiftBottomVisibleBySwitchTab(); 77 + // 赠礼规则
  78 + this.orderGiftContent()
75 }, 79 },
76 methods: { 80 methods: {
77 onTap(active) { 81 onTap(active) {
78 this.active = active; 82 this.active = active;
  83 + if (active === 1) {
  84 + // 调用im是否显示隐藏1显示im聊天弹窗0不显示
  85 + this.setGiftBottomVisibleBySwitchTab(1);
  86 + } else {
  87 + // 调用im是否显示隐藏1显示im聊天弹窗0不显示
  88 + this.setGiftBottomVisibleBySwitchTab(1);
  89 + }
79 }, 90 },
80 - /**  
81 - * 显示和隐藏聊天  
82 - */  
83 - setGiftBottomVisibleBySwitchTab() {  
84 -  
85 - // App内  
86 - if (this.isCNLive.value) {  
87 -  
88 - // 调用App,返回按键  
89 - if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.setGiftBottomVisibleBySwitchTab) {  
90 -  
91 - // App内,iOS销毁WebView  
92 - window.webkit.messageHandlers.setGiftBottomVisibleBySwitchTab.postMessage({body: {visible: 1}});  
93 - } else if (window.obj && window.obj.setGiftBottomVisibleBySwitchTab) {  
94 -  
95 - // App内,Android销毁WebView  
96 - window.obj.setGiftBottomVisibleBySwitchTab(1);  
97 - } 91 + /**
  92 + * 显示和隐藏聊天
  93 + */
  94 + setGiftBottomVisibleBySwitchTab() {
  95 + // App内
  96 + if (this.isCNLive.value) {
  97 + // 调用App,返回按键
  98 + if (
  99 + window.webkit &&
  100 + window.webkit.messageHandlers &&
  101 + window.webkit.messageHandlers
  102 + .setGiftBottomVisibleBySwitchTab
  103 + ) {
  104 + // App内,iOS销毁WebView
  105 + window.webkit.messageHandlers.setGiftBottomVisibleBySwitchTab.postMessage(
  106 + { body: { visible: 1 } }
  107 + );
  108 + } else if (
  109 + window.obj &&
  110 + window.obj.setGiftBottomVisibleBySwitchTab
  111 + ) {
  112 + // App内,Android销毁WebView
  113 + window.obj.setGiftBottomVisibleBySwitchTab(1);
98 } 114 }
99 - }, 115 + }
  116 + },
100 /** 117 /**
101 * 获取收礼礼物列表 118 * 获取收礼礼物列表
102 */ 119 */
@@ -165,7 +182,11 @@ export default { @@ -165,7 +182,11 @@ export default {
165 // 临时,设置跳转商品详情参数 182 // 临时,设置跳转商品详情参数
166 Object.assign(item, { 183 Object.assign(item, {
167 type: "43", 184 type: "43",
168 - to:JSON.stringify({"uid":item.user.uid,"username":item.user.username,"img":item.user.img}), 185 + to: JSON.stringify({
  186 + uid: item.user.uid,
  187 + username: item.user.username,
  188 + img: item.user.img
  189 + }),
169 shop_type: "" 190 shop_type: ""
170 }); 191 });
171 this.$parent.gotoDetail(item); 192 this.$parent.gotoDetail(item);
@@ -185,28 +206,28 @@ export default { @@ -185,28 +206,28 @@ export default {
185 this.$parent.gotoDetail(item); 206 this.$parent.gotoDetail(item);
186 } 207 }
187 }, 208 },
188 - // 收礼商品跳转到详情页 209 + // 收礼商品跳转到详情页
189 onReceivingGifts(item) { 210 onReceivingGifts(item) {
190 // 判断并调用通用跳转 211 // 判断并调用通用跳转
191 if (typeof this.$parent.gotoDetail === "function") { 212 if (typeof this.$parent.gotoDetail === "function") {
192 // 临时,设置跳转商品详情参数 213 // 临时,设置跳转商品详情参数
193 Object.assign(item, { 214 Object.assign(item, {
194 type: "26", 215 type: "26",
195 - to: "", 216 + to: item.id,
196 shop_type: "" 217 shop_type: ""
197 }); 218 });
198 219
199 this.$parent.gotoDetail(item); 220 this.$parent.gotoDetail(item);
200 } 221 }
201 }, 222 },
202 - // 送礼商品跳转到详情页 223 + // 送礼商品跳转到详情页
203 onGiftGiving(item) { 224 onGiftGiving(item) {
204 // 判断并调用通用跳转 225 // 判断并调用通用跳转
205 if (typeof this.$parent.gotoDetail === "function") { 226 if (typeof this.$parent.gotoDetail === "function") {
206 // 临时,设置跳转商品详情参数 227 // 临时,设置跳转商品详情参数
207 Object.assign(item, { 228 Object.assign(item, {
208 type: "36", 229 type: "36",
209 - to: "", 230 + to: item.id,
210 shop_type: "" 231 shop_type: ""
211 }); 232 });
212 233
@@ -274,6 +295,52 @@ export default { @@ -274,6 +295,52 @@ export default {
274 // 获取送礼订单列表失败 295 // 获取送礼订单列表失败
275 Toast("获取送礼订单列表失败"); 296 Toast("获取送礼订单列表失败");
276 } 297 }
  298 + },
  299 + /**
  300 + * 赠礼规则url
  301 + */
  302 + orderGiftContent() {
  303 + // 加载中提示
  304 + Indicator.open("加载中...");
  305 +
  306 + // 赠礼规则url列表接口
  307 + this.http(
  308 + "/Api/" + this.getApiVersion().index + "/orderGiftContent",
  309 + {},
  310 + this.orderGiftContentCallback,
  311 + {
  312 + method: "post"
  313 + }
  314 + );
  315 + },
  316 + /**
  317 + * 赠礼规则url列表接口回调
  318 + * @param {object} res [服务器返回数据]
  319 + * @param {object} ext [扩展参数]
  320 + */
  321 + orderGiftContentCallback(res, ext){
  322 + // 加载完成
  323 + Indicator.close();
  324 +
  325 + // 返回处理
  326 + if (res.code == 200) {
  327 + // 解构数据
  328 + let { data: datas } = res;
  329 + this.giftsRuleUrl = datas.content
  330 + }
  331 + },
  332 + // 送礼规则说明
  333 + giftRules(){
  334 + // 判断并调用通用跳转
  335 + if (typeof this.$parent.gotoDetail === "function") {
  336 + // 临时,设置跳转商品详情参数
  337 + Object.assign(item, {
  338 + type: "44",
  339 + to: this.giftsRuleUrl,
  340 + shop_type: ""
  341 + });
  342 + this.$parent.gotoDetail(item);
  343 + }
277 } 344 }
278 } 345 }
279 }; 346 };
src/router/index.js
@@ -128,7 +128,7 @@ const router = new Router({ @@ -128,7 +128,7 @@ const router = new Router({
128 }, 128 },
129 { 129 {
130 // 我的礼盒 130 // 我的礼盒
131 - path: "/ ", 131 + path: "/myGiftBox",
132 name: "myGiftBox", 132 name: "myGiftBox",
133 component: resolve => { 133 component: resolve => {
134 require(["@/pages/myGiftBox/myGiftBox"], resolve); 134 require(["@/pages/myGiftBox/myGiftBox"], resolve);