Commit c6c9babc54790486f17d1cc9829c2bccfe83c83e

Authored by zhiyangdu
1 parent 26aab41c

分享参数设置

Showing 1 changed file with 56 additions and 43 deletions
src/pages/mall/mall.vue
... ... @@ -3,9 +3,14 @@
3 3 <!-- 下拉刷新 -->
4 4 <!-- <van-pull-refresh v-model="isLoading" pulling-text="下拉刷新..." loosing-text="释放刷新" loading-text="加载中..." success-text="刷新成功" @refresh="onRefresh"> -->
5 5 <!-- nav -->
6   - <!-- nav -->
7   - <back-box v-if="$parent.isBack && $parent.isCNLive.value" class="back-box" :style="'padding-top: ' + $parent.top.value + 'px'" @back="back"
8   - :backs="backs">
  6 + <!-- nav -->
  7 + <back-box
  8 + v-if="$parent.isBack && $parent.isCNLive.value"
  9 + class="back-box"
  10 + :style="'padding-top: ' + $parent.top.value + 'px'"
  11 + @back="back"
  12 + :backs="backs"
  13 + >
9 14 </back-box>
10 15 <!--轮播-->
11 16 <swiper
... ... @@ -120,27 +125,27 @@ export default {
120 125 this.activityAd();
121 126 // // 判断是否在App内
122 127 // 设置后退按钮组
123   - this.$set(this, "backs", {
124   - title: ""
125   - });
  128 + this.$set(this, "backs", {
  129 + title: ""
  130 + });
126 131  
127   - // 判断是否在App内
128   - if (this.$parent.isCNLive.value) {
129   - // 添加后退按钮组“后退”和“分享”按钮
130   - Object.assign(this.backs, {
131   - funcs: {
132   - back: {
133   - icon: "static/img/icon_back.png"
134   - },
135   - funcArray: [
136   - {
137   - icon: "static/img/icon_share.png",
138   - func: this.toShare
139   - }
140   - ]
141   - }
142   - });
143   - }
  132 + // 判断是否在App内
  133 + if (this.$parent.isCNLive.value) {
  134 + // 添加后退按钮组“后退”和“分享”按钮
  135 + Object.assign(this.backs, {
  136 + funcs: {
  137 + back: {
  138 + icon: "static/img/icon_back.png"
  139 + },
  140 + funcArray: [
  141 + {
  142 + icon: "static/img/icon_share.png",
  143 + func: this.toShare
  144 + }
  145 + ]
  146 + }
  147 + });
  148 + }
144 149 },
145 150 methods: {
146 151 // 下拉刷新
... ... @@ -155,27 +160,35 @@ export default {
155 160 /**
156 161 * 后退
157 162 */
158   - back() {
159   -
160   - // App内
161   - if (this.isCNLive.value) {
162   -
163   - // 调用App,返回按键
164   - if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.pop) {
165   -
166   - // App内,iOS销毁WebView
167   - window.webkit.messageHandlers.pop.postMessage({body: {}});
168   - } else if (window.obj && window.obj.finish) {
169   -
170   - // App内,Android销毁WebView
171   - window.obj.finish();
172   - }
173   - } else {
174   -
175   - // 后退
176   - window.history.go(-1);
  163 + back() {
  164 + // App内
  165 + if (this.isCNLive.value) {
  166 + // 调用App,返回按键
  167 + if (
  168 + window.webkit &&
  169 + window.webkit.messageHandlers &&
  170 + window.webkit.messageHandlers.pop
  171 + ) {
  172 + // App内,iOS销毁WebView
  173 + window.webkit.messageHandlers.pop.postMessage({ body: {} });
  174 + } else if (window.obj && window.obj.finish) {
  175 + // App内,Android销毁WebView
  176 + window.obj.finish();
177 177 }
178   - },
  178 + } else {
  179 + // 后退
  180 + window.history.go(-1);
  181 + }
  182 + },
  183 + /**
  184 + * 分享
  185 + */
  186 + toShare() {
  187 + // 判断分享
  188 + if (typeof this.$parent.toShare === "function") {
  189 + this.$parent.toShare(37, this.$route.query.id || 0);
  190 + }
  191 + },
179 192 /**
180 193 * 获取优选库精选活动
181 194 */
... ...