Commit 9da91f4b9574ef7789527b08bb9127331cc8f643

Authored by zhiyangdu
1 parent 32ad49b7

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

build/utils.js
... ... @@ -48,7 +48,7 @@ exports.cssLoaders = function (options) {
48 48 return ExtractTextPlugin.extract({
49 49 use: loaders,
50 50 fallback: 'vue-style-loader',
51   - publicPath: '../../' //解决css背景图路径错位问题
  51 + publicPath: '../../' //解决css背景图路径获取不到问题
52 52 })
53 53 } else {
54 54 return ['vue-style-loader'].concat(loaders)
... ...
src/components/receivingGiftsItem/receivingGiftsItem.less
... ... @@ -144,7 +144,7 @@
144 144 .img {
145 145 width: 16px;
146 146 height: 16px;
147   - background: url("/static/img/spot_active.png") no-repeat
  147 + background: url("../../../static/img/spot_active.png") no-repeat
148 148 top;
149 149 background-size: 100%;
150 150 }
... ...
src/pages/myGiftBox/myGiftBox.vue
1 1 <template>
2 2 <div class="my_gift_box">
3 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 9 <div class="tabs">
7 10 <van-tabs @change="onTap" v-model="active">
8 11 <van-tab title="收礼"></van-tab>
9 12 <van-tab title="送礼"></van-tab>
10 13 </van-tabs>
11 14 </div>
12   - <div class="desc">规则说明</div>
  15 + <div class="desc" @click="giftRules">规则说明</div>
13 16 </div>
14 17 <!--内容-->
15 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 41 </div>
39 42 </div>
40 43 </template>
... ... @@ -55,6 +58,7 @@ export default {
55 58 pages: 0 // 分页
56 59 },
57 60 giftGivingItem: null, // 送礼列表页数据
  61 + giftsRuleUrl:null, // 礼物规则URL
58 62 giftGiving: {
59 63 loading: false, // 加载
60 64 pages: 0 // 分页
... ... @@ -70,33 +74,46 @@ export default {
70 74 this.getorderGiftList();
71 75 // 送礼订单列表
72 76 this.getorderGiveGiftList();
73   - // 调用im是否显示隐藏
74   - this.setGiftBottomVisibleBySwitchTab();
  77 + // 赠礼规则
  78 + this.orderGiftContent()
75 79 },
76 80 methods: {
77 81 onTap(active) {
78 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 182 // 临时,设置跳转商品详情参数
166 183 Object.assign(item, {
167 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 190 shop_type: ""
170 191 });
171 192 this.$parent.gotoDetail(item);
... ... @@ -185,28 +206,28 @@ export default {
185 206 this.$parent.gotoDetail(item);
186 207 }
187 208 },
188   - // 收礼商品跳转到详情页
  209 + // 收礼商品跳转到详情页
189 210 onReceivingGifts(item) {
190 211 // 判断并调用通用跳转
191 212 if (typeof this.$parent.gotoDetail === "function") {
192 213 // 临时,设置跳转商品详情参数
193 214 Object.assign(item, {
194 215 type: "26",
195   - to: "",
  216 + to: item.id,
196 217 shop_type: ""
197 218 });
198 219  
199 220 this.$parent.gotoDetail(item);
200 221 }
201 222 },
202   - // 送礼商品跳转到详情页
  223 + // 送礼商品跳转到详情页
203 224 onGiftGiving(item) {
204 225 // 判断并调用通用跳转
205 226 if (typeof this.$parent.gotoDetail === "function") {
206 227 // 临时,设置跳转商品详情参数
207 228 Object.assign(item, {
208 229 type: "36",
209   - to: "",
  230 + to: item.id,
210 231 shop_type: ""
211 232 });
212 233  
... ... @@ -274,6 +295,52 @@ export default {
274 295 // 获取送礼订单列表失败
275 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 128 },
129 129 {
130 130 // 我的礼盒
131   - path: "/ ",
  131 + path: "/myGiftBox",
132 132 name: "myGiftBox",
133 133 component: resolve => {
134 134 require(["@/pages/myGiftBox/myGiftBox"], resolve);
... ...