Commit c298f6ce3633a60a2673e53c7dd2eb017efc7c9e

Authored by 王强
1 parent 49afdc21

购好物,newDaren页面,页面返回显示优化,从刷新页面改为刷新接口,另外代码格式整理~

src/pages/newDaren/newDaren.less
1 @charset "UTF-8"; 1 @charset "UTF-8";
2 2
3 -.daren-list { 3 +.new-daren {
4 margin: 30px 0; 4 margin: 30px 0;
5 .call-app-box { 5 .call-app-box {
6 position: fixed; 6 position: fixed;
src/pages/newDaren/newDaren.vue
1 <template> 1 <template>
2 - <div class="daren-list"> 2 + <div class="new-daren">
3 3
4 <!-- H5唤起App组件 --> 4 <!-- H5唤起App组件 -->
5 <call-app-box class="call-app-box" ref="callApp" v-if="!isCNLive.value && $parent.isOpenApp.value" 5 <call-app-box class="call-app-box" ref="callApp" v-if="!isCNLive.value && $parent.isOpenApp.value"
@@ -91,8 +91,7 @@ @@ -91,8 +91,7 @@
91 :titles="{ 91 :titles="{
92 title: '已关注达人', 92 title: '已关注达人',
93 more: true 93 more: true
94 - }"  
95 - > 94 + }">
96 </text-title-box> 95 </text-title-box>
97 </daren-list-box> 96 </daren-list-box>
98 97
@@ -116,532 +115,561 @@ @@ -116,532 +115,561 @@
116 115
117 <script> 116 <script>
118 117
119 -// 引入组件  
120 -import { Toast, Indicator } from "mint-ui";  
121 -import callAppBox from "@/components/callAppBox/callAppBox";  
122 -import backBox from "@/components/backBox/backBox";  
123 -import swiper from "@/components/swiper/swiper";  
124 -import darenListBox from "@/components/darenListBox/darenListBox";  
125 -import textTitleBox from "@/components/textTitleBox/textTitleBox";  
126 -import shopDatenTop from "@/components/shopDatenTop/shopDatenTop";  
127 -import horizList from "@/components/horizList/horizList";  
128 -import dresserList from "@/components/dresserList/dresserList";  
129 -  
130 -export default {  
131 - name: "darenList",  
132 - data () {  
133 - return {  
134 - title: "", // 标题  
135 - backs: null, // 后退按钮组  
136 - isLoading: false, // 下拉刷新中  
137 - shopDatenTop: null, // 置顶达人信息  
138 - banner: [], // 轮播  
139 - // dresserList: null, // 已关注达人动态列表  
140 - dresserList: null, // 已关注达人列表  
141 - shopDarenHot: null, // 达人推荐列表  
142 - fansDaren: null, // 已关注达人动态  
143 - shopFnsDynamic: null, // 达人动态  
144 - loading: false, // 加载  
145 - pages: 0 // 分页  
146 - }  
147 - },  
148 - components: {  
149 - callAppBox,  
150 - backBox,  
151 - darenListBox,  
152 - textTitleBox,  
153 - swiper,  
154 - shopDatenTop,  
155 - horizList,  
156 - dresserList  
157 - },  
158 - created () {  
159 -  
160 - // 设置标题  
161 - this.$set(this, "title", "达人");  
162 -  
163 - // 判断是否在App内  
164 - if (this.isCNLive.value) {  
165 -  
166 - // 添加后退按钮组“后退”和“分享”按钮  
167 - this.$set(this, 'backs', {  
168 - title: this.title,  
169 - funcs: {  
170 - back: {  
171 - icon: "static/img/icon_back.png"  
172 - } 118 + // 引入组件
  119 + import { Toast, Indicator } from "mint-ui";
  120 + import callAppBox from "@/components/callAppBox/callAppBox";
  121 + import backBox from "@/components/backBox/backBox";
  122 + import swiper from "@/components/swiper/swiper";
  123 + import darenListBox from "@/components/darenListBox/darenListBox";
  124 + import textTitleBox from "@/components/textTitleBox/textTitleBox";
  125 + import shopDatenTop from "@/components/shopDatenTop/shopDatenTop";
  126 + import horizList from "@/components/horizList/horizList";
  127 + import dresserList from "@/components/dresserList/dresserList";
  128 +
  129 + export default {
  130 + name: "newDaren",
  131 + data () {
  132 + return {
  133 + title: "", // 标题
  134 + backs: null, // 后退按钮组
  135 + isLoading: false, // 下拉刷新中
  136 + shopDatenTop: null, // 置顶达人信息
  137 + banner: [], // 轮播
  138 + // dresserList: null, // 已关注达人动态列表
  139 + dresserList: null, // 已关注达人列表
  140 + shopDarenHot: null, // 达人推荐列表
  141 + fansDaren: null, // 已关注达人动态
  142 + shopFnsDynamic: null, // 达人动态
  143 + loading: false, // 加载
  144 + pages: 0 // 分页
  145 + }
  146 + },
  147 + components: {
  148 + callAppBox,
  149 + backBox,
  150 + darenListBox,
  151 + textTitleBox,
  152 + swiper,
  153 + shopDatenTop,
  154 + horizList,
  155 + dresserList
  156 + },
  157 + created () {
  158 +
  159 + // 设置标题
  160 + this.$set(this, "title", "达人");
  161 +
  162 + // 判断是否在App内
  163 + if (this.isCNLive.value) {
  164 +
  165 + // 添加后退按钮组“后退”和“分享”按钮
  166 + this.$set(this, 'backs', {
  167 + title: this.title,
  168 + funcs: {
  169 + back: {
  170 + icon: "static/img/icon_back.png"
  171 + }
  172 + }
  173 + });
173 } 174 }
174 - });  
175 - }  
176 175
177 - // 获取优选库精选活动  
178 - this.newDarenIndex();  
179 -  
180 - // 达人最新动态  
181 - this.getNewDynamicList();  
182 - },  
183 - methods: {  
184 - /**  
185 - * 达人最新动态  
186 - */  
187 - getNewDynamicList () {  
188 -  
189 - this.loading = true;  
190 - this.pages++  
191 -  
192 - // 加载中提示  
193 - Indicator.open("加载中...");  
194 -  
195 - // 获取证书请求接口  
196 - this.http("/Api/" + this.getApiVersion().dynamic + "/getNewDynamicList", {  
197 - uid: this.$route.query.uid,  
198 - page: this.pages,  
199 - type: 1  
200 - }, this.getNewDynamicListCallback, {  
201 - method: "post"  
202 - });  
203 - },  
204 -  
205 - /**  
206 - * 达人最新动态回调  
207 - * @param {object} res [服务器返回数据]  
208 - * @param {object} ext [扩展参数]  
209 - */  
210 - getNewDynamicListCallback (res, ext) {  
211 -  
212 - // 加载完成  
213 - Indicator.close();  
214 -  
215 - // 返回处理  
216 - if (res.code == 200) {  
217 -  
218 - // 解构数据  
219 - let { data: datas } = res; 176 + // 获取优选库精选活动
  177 + this.newDarenIndex();
220 178
221 - // 设置shopFnsDynamic达人动态数据 179 + // 达人最新动态
  180 + this.getNewDynamicList();
  181 + },
  182 + methods: {
222 183
223 - if (datas.list && datas.list.length) { 184 + /**
  185 + * 达人最新动态
  186 + */
  187 + getNewDynamicList() {
224 188
225 - // 隐藏加载圈  
226 - this.loading = false;  
227 - if (this.pages > 1) {  
228 - this.$set(this, "shopFnsDynamic", [...this.shopFnsDynamic, ...datas.list]);  
229 - } else {  
230 - this.$set(this, "shopFnsDynamic", datas.list);  
231 - }  
232 -  
233 - // 将视频地址加入到图片数组中  
234 - if (this.shopFnsDynamic && this.shopFnsDynamic.length > 0) {  
235 - for (let item of this.shopFnsDynamic) { 189 + // 设置加载中和页码
  190 + this.$set(this, 'loading', true);
  191 + this.$set(this, 'pages', ++this.pages);
  192 +
  193 + // 加载中提示
  194 + Indicator.open("加载中...");
  195 +
  196 + // 获取证书请求接口
  197 + this.http("/Api/" + this.getApiVersion().dynamic + "/getNewDynamicList", {
  198 + uid: this.$route.query.uid,
  199 + page: this.pages,
  200 + type: 1
  201 + }, this.getNewDynamicListCallback, {
  202 + method: "post"
  203 + });
  204 + },
  205 +
  206 + /**
  207 + * 达人最新动态回调
  208 + * @param {Object} res [服务器返回数据]
  209 + * @param {Object} ext [扩展参数]
  210 + */
  211 + getNewDynamicListCallback(res, ext) {
  212 +
  213 + // 加载完成
  214 + Indicator.close();
  215 +
  216 + // 返回处理
  217 + if (res.code == 200) {
  218 +
  219 + // 解构数据
  220 + let { data: datas } = res;
  221 +
  222 + /* 获取达人动态数据 开始 */
  223 +
  224 + if (datas.list && datas.list.length) {
236 225
237 - // 将视频图片加入图片数组,方便循环输出  
238 - if (item.video_img) {  
239 - this.$set(item, "img", [...[item.video_img], ...item.img]); 226 + // 隐藏加载圈
  227 + this.$set(this, 'loading', false);
  228 +
  229 + if (this.pages > 1) {
  230 + this.$set(this, "shopFnsDynamic", [...this.shopFnsDynamic, ...datas.list]);
  231 + } else {
  232 + this.$set(this, "shopFnsDynamic", datas.list);
  233 + }
  234 +
  235 + // 将视频地址加入到图片数组中
  236 + if (this.shopFnsDynamic && this.shopFnsDynamic.length > 0) {
  237 +
  238 + // 循环项目列表
  239 + for (let item of this.shopFnsDynamic) {
  240 +
  241 + // 将视频图片加入图片数组,方便循环输出
  242 + if (item.video_img) {
  243 + this.$set(item, "img", [...[item.video_img], ...item.img]);
  244 + }
  245 + }
240 } 246 }
241 } 247 }
  248 +
  249 + /* 获取达人动态数据 结束 */
  250 +
  251 + } else if (res.code == 400) {
  252 +
  253 + // 获取达人动态失败
  254 + Toast(res.message);
  255 + } else {
  256 +
  257 + // 获取优选库精选活动失败
  258 + Toast("获取达人动态失败");
242 } 259 }
243 - } 260 + },
244 261
245 - /* 获取达人动态数据 结束 */ 262 + // 下拉刷新
  263 + // onRefresh() {
246 264
247 - } else if (res.code == 400) {  
248 -  
249 - // 获取达人动态失败  
250 - Toast(res.message);  
251 - } else { 265 + // // 下拉刷新中
  266 + // this.$set(this, "isLoading", true);
  267 +
  268 + // },
  269 +
  270 + /**
  271 + * 获取优选库精选活动
  272 + */
  273 + newDarenIndex() {
252 274
253 - // 获取优选库精选活动失败  
254 - Toast("获取达人动态失败");  
255 - }  
256 - },  
257 -  
258 - // 下拉刷新  
259 - // onRefresh() {  
260 -  
261 - // // 下拉刷新中  
262 - // this.$set(this, "isLoading", true);  
263 -  
264 - // // 获取优选库精选活动  
265 - // this.activityAd();  
266 - // },  
267 -  
268 - /**  
269 - * 获取优选库精选活动  
270 - */  
271 - newDarenIndex () {  
272 - // 加载中提示  
273 - Indicator.open("加载中...");  
274 -  
275 - // 获取证书请求接口  
276 - this.http("/Api/" + this.getApiVersion().index + "/newDarenIndex", {  
277 - uid: this.$route.query.uid  
278 - }, this.newDarenIndexCallback, {  
279 - method: "post"  
280 - }  
281 - );  
282 - }, 275 + // 加载中提示
  276 + Indicator.open("加载中...");
283 277
284 - /**  
285 - * 获取优选库精选活动回调  
286 - * @param {object} res [服务器返回数据]  
287 - * @param {object} ext [扩展参数]  
288 - */  
289 - newDarenIndexCallback (res, ext) { 278 + // 获取证书请求接口
  279 + this.http("/Api/" + this.getApiVersion().index + "/newDarenIndex", {
  280 + uid: this.$route.query.uid
  281 + }, this.newDarenIndexCallback, {
  282 + method: "post"
  283 + });
  284 + },
290 285
291 - // 加载完成  
292 - Indicator.close(); 286 + /**
  287 + * 获取优选库精选活动回调
  288 + * @param {Object} res [服务器返回数据]
  289 + * @param {Object} ext [扩展参数]
  290 + */
  291 + newDarenIndexCallback(res, ext) {
293 292
294 - // 下拉刷新结束  
295 - this.$set(this, "isLoading", false); 293 + // 加载完成
  294 + Indicator.close();
296 295
297 - // 返回处理  
298 - if (res.code == 200) { 296 + // 下拉刷新结束
  297 + this.$set(this, "isLoading", false);
299 298
300 - // 解构数据  
301 - let { data: datas } = res; 299 + // 返回处理
  300 + if (res.code == 200) {
302 301
303 - /* 获取优选库精选活动数据 开始 */  
304 - if (datas.title) {  
305 - // 设置标题  
306 - this.$set(this, "title", datas.title);  
307 - } 302 + // 解构数据
  303 + let { data: datas } = res;
308 304
309 - // 获取“达人列表数据”  
310 - if (datas.list && datas.list.length) {  
311 -  
312 - // 设置“达人列表数据”数据  
313 - this.$set(this, "dresserList", datas.list.filter((item, index, arr) => { return index < 4 }));  
314 - } 305 + /* 获取优选库精选活动数据 开始 */
  306 +
  307 + if (datas.title) {
  308 +
  309 + // 设置标题
  310 + this.$set(this, "title", datas.title);
  311 + }
315 312
316 - // 设置banner数据 313 + // 获取“达人列表数据”
  314 + if (datas.list && datas.list.length) {
  315 +
  316 + // 设置“达人列表数据”数据
  317 + this.$set(this, "dresserList", datas.list.filter((item, index, arr) => { return index < 4 }));
  318 + }
317 319
318 - this.banner.push(datas.shop_daten_ads)  
319 - // 设置shopDatenTop置顶达人数据 320 + // 设置banner数据
  321 + this.banner.push(datas.shop_daten_ads)
  322 +
  323 + // 设置shopDatenTop置顶达人数据
  324 + if (datas.shop_daten_top) {
  325 + this.$set(this, "shopDatenTop", datas.shop_daten_top);
  326 + }
  327 +
  328 + // 设置shopDarenHot达人推荐数据
  329 + if (datas.shop_daren_hot && datas.shop_daren_hot.length) {
  330 + this.$set(this, "shopDarenHot", datas.shop_daren_hot);
  331 + }
320 332
321 - if (datas.shop_daten_top) {  
322 - this.$set(this, "shopDatenTop", datas.shop_daten_top);  
323 - }  
324 - // 设置shopDarenHot达人推荐数据 333 + // 设置fansDaren已关注达人动态数据
  334 + if (datas.shop_fans_dynamic && datas.shop_fans_dynamic.length) {
  335 + this.$set(this, "fansDaren", datas.shop_fans_dynamic);
  336 +
  337 + // 将视频地址加入到图片数组中
  338 + for (let item of this.fansDaren) {
  339 +
  340 + // 将视频图片加入图片数组,方便循环输出
  341 + if (item.video_img) {
  342 + this.$set(item, "img", [...[item.video_img], ...item.img]);
  343 + }
  344 + }
  345 + }
325 346
326 - if (datas.shop_daren_hot && datas.shop_daren_hot.length) {  
327 - this.$set(this, "shopDarenHot", datas.shop_daren_hot);  
328 - } 347 + /* 获取优选库精选活动数据 结束 */
329 348
330 - // 设置fansDaren已关注达人动态数据 349 + } else if (res.code == 400) {
  350 +
  351 + // 获取优选库精选活动失败
  352 + Toast(res.message);
  353 + } else {
331 354
332 - if (datas.shop_fans_dynamic && datas.shop_fans_dynamic.length) {  
333 - this.$set(this, "fansDaren", datas.shop_fans_dynamic);  
334 - // 将视频地址加入到图片数组中  
335 - for (let item of this.fansDaren) {  
336 - // 将视频图片加入图片数组,方便循环输出  
337 - if (item.video_img) {  
338 - this.$set(item, "img", [...[item.video_img], ...item.img]);  
339 - }  
340 - }  
341 - } 355 + // 获取优选库精选活动失败
  356 + Toast("获取优选库精选活动失败");
  357 + }
  358 + },
  359 +
  360 + /**
  361 + * 关注/取消关注达人
  362 + */
  363 + fansShop(item) {
342 364
343 - /* 获取优选库精选活动数据 结束 */ 365 + // 加载中
  366 + Indicator.open("加载中...");
  367 +
  368 + // 判断必要参数
  369 + if (item.id && this.$route.query.uid) {
  370 +
  371 + // 请求接口
  372 + this.http("/Api/" + this.getApiVersion().dynamic + "/fansShop", {
  373 + id: (item.shop_user ? item.shop_user.id : item.id) || 0,
  374 + uid: this.$route.query.uid || 0
  375 + }, this.fansShopCallback, {
  376 + method: "post",
  377 + item
  378 + });
  379 + }
  380 + },
  381 +
  382 + /**
  383 + * 关注/取消关注达人回调
  384 + * @param {Object} res [服务器返回数据]
  385 + * @param {Object} ext [扩展参数]
  386 + */
  387 + fansShopCallback(res, ext) {
  388 +
  389 + // 加载完成
  390 + Indicator.close();
344 391
345 - } else if (res.code == 400) { 392 + if (res.code == 200) {
  393 +
  394 + // 设置已关注
  395 + if (ext.item.is_fans) {
  396 +
  397 + // 判断关注结果
  398 + if (ext.item.is_fans == "0") {
  399 +
  400 + // 关注达人
  401 + this.$set(ext.item, "is_fans", "1");
  402 +
  403 + // 吐司提示
  404 + Toast("关注成功");
  405 + } else if (ext.item.is_fans == "1") {
  406 +
  407 + // 取消关注达人
  408 + this.$set(ext.item, "is_fans", "0");
346 409
347 - // 获取优选库精选活动失败  
348 - Toast(res.message);  
349 - } else { 410 + // 吐司提示
  411 + Toast("取消关注成功");
  412 + }
  413 + } else if (ext.item.shop_user) {
350 414
351 - // 获取优选库精选活动失败  
352 - Toast("获取优选库精选活动失败");  
353 - }  
354 - },  
355 - /**  
356 - * 关注/取消关注达人  
357 - */  
358 - fansShop (item) { 415 + if (ext.item.shop_user.is_fans == '0') {
359 416
360 - Indicator.open("加载中...");  
361 -  
362 - // 判断必要参数  
363 - if (item.id && this.$route.query.uid) {  
364 -  
365 - // 请求接口  
366 - this.http("/Api/" + this.getApiVersion().dynamic + "/fansShop", {  
367 - id: (item.shop_user ? item.shop_user.id : item.id) || 0,  
368 - uid: this.$route.query.uid || 0  
369 - }, this.fansShopCallback, {  
370 - method: "post",  
371 - item  
372 - });  
373 - }  
374 - },  
375 -  
376 - /**  
377 - * 关注/取消关注达人回调  
378 - * @param {object} res [服务器返回数据]  
379 - * @param {object} ext [扩展参数]  
380 - */  
381 - fansShopCallback (res, ext) {  
382 -  
383 - // 加载完成  
384 - Indicator.close();  
385 -  
386 - if (res.code) {  
387 -  
388 - // 设置已关注  
389 - if (ext.item.is_fans) {  
390 - if (ext.item.is_fans == "0") { 417 + // 关注达人
  418 + this.$set(ext.item.shop_user, "is_fans", "1");
  419 +
  420 + // 吐司提示
  421 + Toast("关注成功");
  422 + } else {
  423 +
  424 + // 取消关注达人
  425 + this.$set(ext.item.shop_user, "is_fans", "0");
  426 +
  427 + // 吐司提示
  428 + Toast("取消关注成功");
  429 + }
  430 + }
  431 + } else if (res.code == 400) {
  432 +
  433 + // 关注失败
  434 + Toast(res.data.message);
  435 + } else {
  436 +
  437 + // 关注失败
  438 + Toast("关注失败");
  439 + }
  440 + },
391 441
392 - // 关注达人  
393 - this.$set(ext.item, "is_fans", "1");  
394 - Toast("关注成功");  
395 - } else if (ext.item.is_fans == "1") { 442 + /**
  443 + * 已关注达人动态更多页跳转
  444 + */
  445 + moreDynamic() {
396 446
397 - // 取消关注达人  
398 - this.$set(ext.item, "is_fans", "0");  
399 - Toast("取消关注成功"); 447 + // 判断并调用通用跳转
  448 + if (typeof this.$parent.gotoDetail === "function") {
  449 +
  450 + // 设置跳转参数
  451 + let options = {
  452 + type: "5",
  453 + to: (window.location.href.split("#")[0] + "#/moreDynamic?uid=" + this.getStore("uid")),
  454 + shop_type: ""
  455 + }
  456 +
  457 + // 调用通用跳转
  458 + this.$parent.gotoDetail(options);
  459 + }
  460 + },
  461 +
  462 + /**
  463 + * 调用通用跳转
  464 + * @param {Object} item [通用跳转对象]
  465 + */
  466 + toDetail(item) {
  467 +
  468 + // 判断是否有通用跳转函数
  469 + if (typeof this.$parent.gotoDetail === "function") {
  470 +
  471 + // 设置跳转达人个人主页用户数据
  472 + Object.assign(item, {
  473 + type: "5",
  474 + to: (this.mode == "prod") ?
  475 + "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + (item.user_id) + (this.getStore("uid") ? "&uid=" + this.getStore("uid") : "") :
  476 + "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect"+ "&id=" + (item.user_id) + (this.getStore("uid") ? "&uid=" + this.getStore("uid") : ""),
  477 + shop_type: ""
  478 + });
  479 +
  480 + // 调用通用跳转
  481 + this.$parent.gotoDetail(item);
400 } 482 }
401 - } else if (ext.item.shop_user) { 483 + },
402 484
403 - if (ext.item.shop_user.is_fans == '0') { 485 + /**
  486 + * 推荐达人跳转到更多页
  487 + */
  488 + recommendedDaren() {
404 489
405 - // 关注达人  
406 - this.$set(ext.item.shop_user, "is_fans", "1");  
407 - Toast("关注成功");  
408 - } else { 490 + // 判断并调用通用跳转
  491 + if (typeof this.$parent.gotoDetail === "function") {
409 492
410 - // 取消关注达人  
411 - this.$set(ext.item.shop_user, "is_fans", "0");  
412 - Toast("取消关注成功"); 493 + // 设置跳转参数
  494 + let options = {
  495 + type: "5",
  496 + to: (window.location.href.split("#")[0] + "#/recommendMore?uid=" + this.getStore("uid")),
  497 + shop_type: ""
  498 + }
  499 +
  500 + // 调用通用跳转
  501 + this.$parent.gotoDetail(options);
413 } 502 }
414 - }  
415 - } else if (res.statusCode === 200 && res.data.code == 400) { 503 + },
416 504
417 - // 关注失败  
418 - Toast(res.data.message);  
419 - } else { 505 + /**
  506 + * 跳转到关注人列表数据
  507 + */
  508 + h5More () {
420 509
421 - // 关注失败  
422 - Toast("关注失败");  
423 - }  
424 - },  
425 -  
426 - /**  
427 - * 调用通用跳转  
428 - * @param {object} item [通用跳转对象]  
429 - */  
430 - /**  
431 - * 已关注达人动态更多页跳转  
432 - */  
433 - moreDynamic () {  
434 - // 判断并调用通用跳转  
435 - if (typeof this.$parent.gotoDetail === "function") {  
436 -  
437 - // 设置跳转参数  
438 - let options = {  
439 - type: "5",  
440 - to: (window.location.href.split("#")[0] + "#/moreDynamic?uid=" + this.getStore("uid")),  
441 - shop_type: ""  
442 - }  
443 - this.$parent.gotoDetail(options);  
444 - }  
445 - },  
446 - toDetail (item) {  
447 -  
448 - // 判断是否有通用跳转函数  
449 - if (typeof this.$parent.gotoDetail === "function") {  
450 -  
451 - // 设置跳转达人个人主页用户数据  
452 - Object.assign(item, {  
453 - type: "5",  
454 - to: (this.mode == "prod") ?  
455 - "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + (item.user_id) + (this.getStore("uid") ? "&uid=" + this.getStore("uid") : "") :  
456 - "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect"+ "&id=" + (item.user_id) + (this.getStore("uid") ? "&uid=" + this.getStore("uid") : ""),  
457 - shop_type: ""  
458 - });  
459 -  
460 - // 调用通用跳转  
461 - this.$parent.gotoDetail(item);  
462 - }  
463 - },  
464 -  
465 - /**  
466 - * 推荐达人跳转到更多页  
467 - */  
468 - recommendedDaren () {  
469 -  
470 - // 判断并调用通用跳转  
471 - if (typeof this.$parent.gotoDetail === "function") {  
472 -  
473 - // 设置跳转参数  
474 - let options = {  
475 - type: "5",  
476 - to: (window.location.href.split("#")[0] + "#/recommendMore?uid=" + this.getStore("uid")),  
477 - shop_type: ""  
478 - }  
479 - this.$parent.gotoDetail(options);  
480 - } 510 + // 判断并调用通用跳转
  511 + if (typeof this.$parent.gotoDetail === "function") {
481 512
482 - }, 513 + // 设置跳转参数
  514 + let options = {
  515 + type: "5",
  516 + to: (window.location.href.split("#")[0] + "#/fansShopMessageList?uid=" + this.getStore("uid")),
  517 + shop_type: ""
  518 + }
483 519
484 - /**  
485 - * 跳转到关注人列表数据  
486 - */  
487 - h5More () { 520 + // 调用通用跳转
  521 + this.$parent.gotoDetail(options);
  522 + }
  523 + },
488 524
489 - // 判断并调用通用跳转  
490 - if (typeof this.$parent.gotoDetail === "function") { 525 + /**
  526 + * 跳转达人动态详情
  527 + * @param {object} item [数据对象]
  528 + */
  529 + jump(item) {
  530 +
  531 + // 判断并调用通用跳转
  532 + if (typeof this.$parent.gotoDetail === "function") {
  533 +
  534 + // 临时,设置跳转参数,跳转达人动态详情页面
  535 + Object.assign(item, {
  536 + type: "5",
  537 + to: (this.mode == "prod") ?
  538 + "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfileDynamicDetail/darenProfileDynamicDetail?from=redirect" + "&id=" + item.id + "&uid=" + this.getStore("uid") :
  539 + "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfileDynamicDetail/darenProfileDynamicDetail?from=redirect" + "&id=" + item.id + "&uid=" + this.getStore("uid"),
  540 + shop_type: ""
  541 + });
  542 +
  543 + // 调用通用跳转
  544 + this.$parent.gotoDetail(item);
  545 + }
  546 + },
  547 +
  548 + /**
  549 + * 用户头像/昵称,点击跳转
  550 + * @param {Object} item [数据对象]
  551 + * type等于2属于达人跳转传uid,type=1传id
  552 + */
  553 + userJump(item) {
  554 +
  555 + // 判断并调用通用跳转
  556 + if (typeof this.$parent.gotoDetail === "function") {
  557 +
  558 + // 临时,设置跳转达人个人主页用户数据
  559 + Object.assign(item, {
  560 + type: "5",
  561 + to: (this.mode == "prod") ?
  562 + "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + (item.type == 2 ? item.uid : item.id) + "&uid=" + this.getStore("uid") :
  563 + "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + (item.type == 2 ? item.uid : item.id) + "&uid=" + this.getStore("uid"),
  564 + shop_type: ""
  565 + });
  566 +
  567 + // 调用通用跳转
  568 + this.$parent.gotoDetail(item);
  569 + }
  570 + },
  571 +
  572 + /**
  573 + * 点击跳转商品
  574 + * @param {Object} item [数据对象]
  575 + */
  576 + goodsJump(item) {
  577 +
  578 + // 判断并调用通用跳转
  579 + if (typeof this.$parent.gotoDetail === "function") {
  580 +
  581 + // 临时,设置跳转商品详情参数
  582 + Object.assign(item, {
  583 + type: "2",
  584 + to: item.id,
  585 + shop_type: "1"
  586 + });
  587 +
  588 + // 调用通用跳转
  589 + this.$parent.gotoDetail(item);
  590 + }
  591 + },
  592 +
  593 + /**
  594 + * 点击跳转商品购买
  595 + * @param {Object} item [数据对象]
  596 + */
  597 + goodsPrimary(item) {
  598 +
  599 + // 判断并调用通用跳转
  600 + if (typeof this.$parent.gotoDetail === "function") {
  601 +
  602 + // 临时,设置跳转商品详情参数
  603 + Object.assign(item, {
  604 + type: "2",
  605 + to: item.id,
  606 + shop_type: "1"
  607 + });
  608 +
  609 + // 调用通用跳转
  610 + this.$parent.gotoDetail(item);
  611 + }
  612 + },
491 613
492 - // 设置跳转参数  
493 - let options = {  
494 - type: "5",  
495 - to: (window.location.href.split("#")[0] + "#/fansShopMessageList?uid=" + this.getStore("uid")),  
496 - shop_type: ""  
497 - } 614 + /**
  615 + * 后退
  616 + */
  617 + back() {
  618 +
  619 + // 判断是否有处理函数
  620 + if (typeof this.$parent.back === 'function') {
498 621
499 - // 调用通用跳转  
500 - this.$parent.gotoDetail(options);  
501 - }  
502 - },  
503 -  
504 - /**  
505 - * 跳转达人动态详情  
506 - * @param {object} item [数据对象]  
507 - */  
508 - jump (item) {  
509 - // 判断并调用通用跳转  
510 - if (typeof this.$parent.gotoDetail === "function") {  
511 -  
512 -  
513 - // 临时,设置跳转参数,跳转达人动态详情页面  
514 - Object.assign(item, {  
515 - type: "5",  
516 - to: (this.mode == "prod") ?  
517 - "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfileDynamicDetail/darenProfileDynamicDetail?from=redirect" + "&id=" + item.id + "&uid=" + this.getStore("uid")  
518 - : "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfileDynamicDetail/darenProfileDynamicDetail?from=redirect" + "&id=" + item.id + "&uid=" + this.getStore("uid"),  
519 - shop_type: ""  
520 - });  
521 -  
522 - // 调用通用跳转  
523 - this.$parent.gotoDetail(item);  
524 - }  
525 - },  
526 -  
527 - /**  
528 - * 用户头像/昵称,点击跳转  
529 - * @param {object} item [数据对象]  
530 - * type等于2属于达人跳转传uid,type=1传id  
531 - */  
532 - userJump (item) {  
533 -  
534 - // 判断并调用通用跳转  
535 - if (typeof this.$parent.gotoDetail === "function") {  
536 -  
537 - // 临时,设置跳转达人个人主页用户数据  
538 - Object.assign(item, {  
539 - type: "5",  
540 - to: (this.mode == "prod") ?  
541 - "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + (item.type == 2 ? item.uid : item.id) + "&uid=" + this.getStore("uid") :  
542 - "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + (item.type == 2 ? item.uid : item.id) + "&uid=" + this.getStore("uid"),  
543 - shop_type: ""  
544 - });  
545 -  
546 - // 调用通用跳转  
547 - this.$parent.gotoDetail(item);  
548 - }  
549 - },  
550 -  
551 - /**  
552 - * 点击跳转商品  
553 - * @param {object} item [数据对象]  
554 - */  
555 - goodsJump (item) {  
556 -  
557 - // 判断并调用通用跳转  
558 - if (typeof this.$parent.gotoDetail === "function") {  
559 -  
560 - // 临时,设置跳转商品详情参数  
561 - Object.assign(item, {  
562 - type: "2",  
563 - to: item.id,  
564 - shop_type: "1"  
565 - });  
566 -  
567 - // 调用通用跳转  
568 - this.$parent.gotoDetail(item);  
569 - }  
570 - },  
571 -  
572 - /**  
573 - * 点击跳转商品购买  
574 - * @param {object} item [数据对象]  
575 - */  
576 - goodsPrimary (item) {  
577 -  
578 - // 判断并调用通用跳转  
579 - if (typeof this.$parent.gotoDetail === "function") {  
580 -  
581 - // 临时,设置跳转商品详情参数  
582 - Object.assign(item, {  
583 - type: "2",  
584 - to: item.id,  
585 - shop_type: "1"  
586 - });  
587 -  
588 - // 调用通用跳转  
589 - this.$parent.gotoDetail(item);  
590 - }  
591 - },  
592 -  
593 - /**  
594 - * 后退  
595 - */  
596 - back() {  
597 -  
598 - // 判断是否有处理函数  
599 - if (typeof this.$parent.back === 'function') { 622 + // 后退
  623 + this.$parent.back();
  624 + } else {
600 625
601 - // 后退  
602 - this.$parent.back();  
603 - } else { 626 + // 后退
  627 + window.history.go(-1);
  628 + }
  629 + }
  630 + },
  631 + head: {
  632 + title () {
  633 + return {
  634 + inner: this.title
  635 + }
  636 + }
  637 + },
  638 + watch: {
604 639
605 - // 后退  
606 - window.history.go(-1); 640 + // 设置页面标题
  641 + title (newVal) {
  642 + if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") {
  643 + this.$iFrame.insertIFrame(newVal);
  644 + } else {
  645 + this.$emit("updateHead");
  646 + }
  647 + }
  648 + },
  649 + mounted() {
  650 +
  651 + // 页面切换可见状态监听
  652 + document.addEventListener('visibilitychange', () => {
  653 +
  654 + // 页面显示出来了
  655 + if (document.hidden === false && this.$route.name == 'newDaren') {
  656 +
  657 + // 获取优选库精选活动
  658 + this.newDarenIndex();
  659 +
  660 + // 清除加载中状态和页码
  661 + this.$set(this, 'loading', false);
  662 + this.$set(this, 'pages', 0);
  663 +
  664 + // 达人最新动态
  665 + this.getNewDynamicList();
  666 + }
  667 + });
607 } 668 }
608 } 669 }
609 - },  
610 - head: {  
611 - title () {  
612 - return {  
613 - inner: this.title  
614 - }  
615 - }  
616 - },  
617 - watch: {  
618 -  
619 - // 设置页面标题  
620 - title (newVal) {  
621 - if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") {  
622 - this.$iFrame.insertIFrame(newVal);  
623 - } else {  
624 - this.$emit("updateHead");  
625 - }  
626 - }  
627 - },  
628 - mounted () {  
629 -  
630 - // 页面切换可见状态监听  
631 - document.addEventListener('visibilitychange', () => {  
632 -  
633 - // 页面显示出来了  
634 - if (document.hidden === false && this.$route.name == 'newDaren') {  
635 -  
636 - // 刷新页面  
637 - window.location.reload();  
638 - }  
639 - });  
640 - }  
641 -}  
642 </script> 670 </script>
643 671
644 <!-- Add "scoped" attribute to limit CSS to this component only --> 672 <!-- Add "scoped" attribute to limit CSS to this component only -->
645 <style rel="stylesheet/less" lang="less" scoped> 673 <style rel="stylesheet/less" lang="less" scoped>
646 -@import 'newDaren'; 674 + @import 'newDaren';
647 </style> 675 </style>