zhaojs
2023-07-13 5f5179811a778b6bd996ed64cae2a96f5ccc437f
no message
已添加1个文件
已修改6个文件
359 ■■■■ 文件已修改
uniapp/App.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
uniapp/components/indexPage.vue 158 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uniapp/pages.json 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uniapp/pages/rankinglist/compareprice.vue 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uniapp/pages/search/searchResult.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uniapp/utils/getClipboard.js 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uniapp/utils/http.api.js 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uniapp/App.vue
@@ -178,7 +178,7 @@
                var route = routes[routes.length - 1].route
            }
            // #ifdef APP-PLUS
            if (this.globalData.canlisten && route != 'pages/mine/tools/turnChain') {
            if (this.globalData.canlisten && route != 'pages/mine/tools/turnChain'&&route!='pages/rankinglist/compareprice') {
                getClipboard()
            }
uniapp/components/indexPage.vue
@@ -503,6 +503,8 @@
                dybanner:[],
                pddbanner:[],
                wphbanner:[],
                haspreference:false,
                preferData:{},
            }
        },
        watch: {
@@ -530,12 +532,13 @@
        },
        created() {
            this._freshing = false;
            this.changeRecommend();
            //this.changeRecommend();
            this.checkPreferenceGoods();
            uni.$emit('initpage')
            this.getBannerInfo();
            this.getHomeMenuList();
            this.getrecommendGoods();
            this.getbottomGoodsList(this.bottomType);
            //this.getbottomGoodsList(this.bottomType);
            this.getGOODSfalling();
            this.getRQList();
            //this.getPageImg();
@@ -548,6 +551,55 @@
            }, 1500)
        },
        methods: {
            checkPreferenceGoods()
            {//是否有推荐
                var that = this;
                var tmp_1 = {
                    mainTitle: '天猫',
                    subTitle: '天猫热销',
                    type: 5
                };
                var tmp_2 = {
                    mainTitle: '天猫',
                    subTitle: '为你推荐',
                    type: 1
                };
                var tmp_3= {
                    mainTitle: '推荐',
                    subTitle: '猜你喜欢',
                    type: 7
                };
                var open_like_recommend = uni.getStorageSync('open_like_recommend');
                if(this.typedataList.length == 5)this.typedataList.shift()
                if(open_like_recommend == 1){
                    this.typedataList.unshift(tmp_2);
                    this.bottomType = tmp_2.type;
                }else{
                    this.typedataList.unshift(tmp_1);
                    this.bottomType = tmp_1.type;
                }
                this.$u.api.checkPreferenceGoods({
                }).then(e => {
                    if(e.code != 0)
                    {
                        that.currentPage = 1;
                        that.getbottomGoodsList(that.bottomType);
                        return;
                    };
                    if(e.data&&e.data.p_cids)
                    {//有偏好
                        that.preferData=e.data;
                        that.typedataList.unshift(tmp_3);
                        that.bottomType = tmp_3.type;
                        //去除唯品会
                        that.typedataList = that.typedataList.filter(function(item) {return item.type !== 4});
                    }
                    that.currentPage = 1;
                    that.getbottomGoodsList(that.bottomType);
                }).catch(function (err) {
                    this.changeRecommend();
                })
            },
            changeRecommend(){
                var tmp_1 = {
                    mainTitle: '天猫',
@@ -555,7 +607,7 @@
                    type: 5
                };
                var tmp_2 = {
                    mainTitle: '推荐',
                    mainTitle: '天猫',
                    subTitle: '为你推荐',
                    type: 1
                };
@@ -742,39 +794,36 @@
            },
            getbottomGoodsList(type) {
                var that = this;
                this.$u.api.getGoodThing({
                    deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < 10 ?
                        'IMEI' : 'OAID') : 'IDFA',
                    deviceValue: getApp().globalData.equipmentNumber,
                    pageId: 1,
                    pageSize: 10,
                    type: type
                }).then(e => {
                    if (e.code != 0) return that.$alert(e.msg)
                    var res = e.data.list;
                    if (res.length < 10) {
                        that.loadingState = false
                        that.loadstatus = 'normal'
                    } else {
                        that.currentPage++
                        that.loadstatus = 'loading'
                        that.loadingState = true
                    }
                    that.bottomGoodsList = res
                }).catch(function(err) {})
            },
            getNextPage() {
                if (this.loadingState) {
                    this.loadingState = false
                    var that = this;
                if(type==7&&that.preferData)
                {//猜你喜欢
                    this.$u.api.gussessLikeGoods({
                        platefrom:that.preferData.p_platefrom,
                        cids:that.preferData.p_cids,
                        pageId:1,
                        pageSize:10
                    }).then(e=>{
                        console.log(e);
                        var res = e.data.list;
                        if (res.length < 10) {
                            that.loadingState = false
                            that.loadstatus = 'normal'
                        } else {
                            that.currentPage++
                            that.loadstatus = 'loading'
                            that.loadingState = true
                        }
                        that.bottomGoodsList = res
                    })
                }
                else
                {
                    this.$u.api.getGoodThing({
                        deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel <
                            10 ? 'IMEI' : 'OAID') : 'IDFA',
                        deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < 10 ?
                            'IMEI' : 'OAID') : 'IDFA',
                        deviceValue: getApp().globalData.equipmentNumber,
                        pageId: this.currentPage,
                        pageId: 1,
                        pageSize: 10,
                        type: this.bottomType
                        type: type
                    }).then(e => {
                        if (e.code != 0) return that.$alert(e.msg)
                        var res = e.data.list;
@@ -786,11 +835,52 @@
                            that.loadstatus = 'loading'
                            that.loadingState = true
                        }
                        that.bottomGoodsList = that.bottomGoodsList.concat(res)
                        that.bottomGoodsList = res
                    }).catch(function(err) {})
                }
            },
            getNextPage() {
                if (this.loadingState) {
                    this.loadingState = false
                    var that = this;
                    if(that.currentPage==7&&that.preferData)
                    {//猜你喜欢
                        this.$u.api.gussessLikeGoods({
                            platefrom:that.preferData.p_platefrom,
                            cids:that.preferData.p_cids,
                            pageId:this.currentPage,
                            pageSize:10
                        }).then(e=>{
                            console.log(e)
                        })
                    }
                    else{
                        this.$u.api.getGoodThing({
                            deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel <
                                10 ? 'IMEI' : 'OAID') : 'IDFA',
                            deviceValue: getApp().globalData.equipmentNumber,
                            pageId: this.currentPage,
                            pageSize: 10,
                            type: this.bottomType
                        }).then(e => {
                            if (e.code != 0) return that.$alert(e.msg)
                            var res = e.data.list;
                            if (res.length < 10) {
                                that.loadingState = false
                                that.loadstatus = 'normal'
                            } else {
                                that.currentPage++
                                that.loadstatus = 'loading'
                                that.loadingState = true
                            }
                            that.bottomGoodsList = that.bottomGoodsList.concat(res)
                        }).catch(function(err) {})
                    }
                }
            },
            switchtype(info, idx) {
                if (this.bottomCurrent != idx) {
                    this.currentPage = 1;
uniapp/pages.json
@@ -464,6 +464,16 @@
                }
            }
        },
        // æ¯”ä»·
        {
            "path": "pages/rankinglist/compareprice",
            "style": {
                "navigationStyle": "custom",
                "app-plus": {
                    "titleNView": false
                }
            }
        },
        // çº¿æŠ¥
        {
            "path": "pages/rankinglist/xianbao",
@@ -904,17 +914,23 @@
                "text": "疯抢榜"
            },
            {
                "pagePath": "pages/rankinglist/compareprice",
                "iconPath": "static/images/tabBar/ne_bend.png",
                "selectedIconPath": "static/images/tabBar/ne_bend_act.png",
                "text": "比价"
            },
            {
                "pagePath": "pages/rankinglist/xianbao",
                "iconPath": "static/images/tabBar/ne_xb.png",
                "selectedIconPath": "static/images/tabBar/ne_xb_act.png",
                "text": "线报"
            },
            {
            /* {
                "pagePath": "pages/community/community",
                "iconPath": "static/images/tabBar/ne_bend.png",
                "selectedIconPath": "static/images/tabBar/ne_bend_act.png",
                "text": "本地生活"
            },
            }, */
             
            {
                "pagePath": "pages/mine/mine",
uniapp/pages/rankinglist/compareprice.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,162 @@
<template>
    <view>
        <web-view v-if="webshow" :webview-styles="webviewStyles" :src="webviewUrl" @message='received'></web-view>
        <!-- taobao -->
        <u-popup v-model="empowerModel" mode="center" border-radius="12">
          <empowerModel @closemodel='closeMdl' @updataInfo='updataUser'></empowerModel>
        </u-popup>
    </view>
</template>
<script>
     import empowerModel from '../../components/empowerModel.vue'
    var wv;
    export default {
        components: {
          empowerModel
        },
        data() {
            return {
                webshow:true,
                empowerModel: false,
                webviewUrl: '',
                user:'',
                webviewStyles: {
                    progress: {
                        color: '#EE1B14'
                    }
                },
            }
        },
        onLoad(options) {
            if(!this.hasLogin){
                uni.reLaunch({
                    url:"/pages/login/wxlogin"
                })
            }
            else{
                const value = uni.getStorageSync('userInfo');
                console.log(value)
                this.webviewUrl = encodeURI('https://appapitest.ushopvip.com/html/compareprice.html?token='+value.token);
            }
        },
        onReady() {
          this.clearMuiBack();
        },
        methods: {
            received(e) {
                var res=e.detail.data[0];
                console.log(res);
                switch(res.action)
                {
                    case "back"://返回
                        this.backLast();
                        break;
                    case "tbauth"://淘宝授权
                        this.openTbMd();
                        break;
                    case "totb":
                        this.targetTb(res.tburl);
                        break;
                    case "copy":
                        this.getCopyTxt();
                        break;
                    case "getlike":
                        this.getLike();
                        break;
                }
            },
            getLike()
            {
                console.log('进来了');
                var postData={
                    deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < 10 ? 'IMEI' : 'OAID') :
                        'IDFA',
                    deviceValue: getApp().globalData.equipmentNumber
                };
                console.log(postData);
                var currentWebview = this.$scope.$getAppWebview().children()[0];
                currentWebview.evalJS(`likeDataGet(${JSON.stringify(postData)})`);
            },
            getCopyTxt()
            {
                uni.getClipboardData({
                    success: res => {
                      //调用页面里的方法
                      console.log(res, '======================================================');
                     var currentWebview = this.$scope.$getAppWebview().children()[0];
                      currentWebview.evalJS(`scanCode(${JSON.stringify(res)})`);
                    }
                  })
            },
            targetTb(tburl)
            {
                // #ifdef APP-PLUS
                if (plus.runtime.isApplicationExist({
                    pname: 'com.taobao.taobao',
                    action: 'taobao://'
                  })) {
                  const plug = uni.requireNativePlugin('xiguazhu-baichuan')
                  plug.detailPage({
                    url: tburl,
                    "openType": 0
                  }, result => {
                  });
                } else {
                  uni.navigateTo({
                      url:'@/webView/webView?url=' + tburl
                  })
                }
                // #endif
            },
            backLast()
            {
                console.log("返回")
                uni.navigateBack({
                    delta: 1
                });
            },
            closeMdl() {
              this.empowerModel = false;
              this.webshow=true;
            },
            openTbMd()
            {
                this.webshow=false;
                 this.empowerModel = true
            },
            updataUser() {
              var that = this;
              this.$u.api.getUserInfo({}).then(e => {
                utils.setCache('userInfo', e.data.userinfo)
                that.user = e.data.userinfo;
              }).catch(function(err) {})
            },
            // å…³é—­mui返回
              clearMuiBack() {
                // #ifdef APP-PLUS
             /*   var currentWebview = this.$scope.$getAppWebview().children()[0];
                //监听注入的js
                currentWebview.addEventListener("loaded", function() {
                  currentWebview.evalJS("mui.init({keyEventBind: {backbutton: false }});");
                }); */
                // #endif
              },
        },
        onNavigationBarButtonTap(e) {
            // #ifdef APP-PLUS
            const currentWebview = this.$scope.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效,非v3编译模式使用this.$mp.page.$getAppWebview()
            var wv = currentWebview.children()[0]
            wv.reload();
            // #endif
        },
    }
</script>
<style>
</style>
uniapp/pages/search/searchResult.vue
@@ -371,6 +371,7 @@
                    sort: this.sortType,
                    selectCoupon: this.selectCoupon == true ? 1 : 0
                }).then(e => {
                    console.log(e);
                    if (e.code != 0) return that.$alert(e.msg)
                    var res = e.data;
                    uni.stopPullDownRefresh();
uniapp/utils/getClipboard.js
@@ -17,6 +17,7 @@
            var res = e.data;
            callback(res)
          }).catch(function (err) {
              console.log(err)
          })
        }else{
          getApp().globalData.hasMode = false
@@ -48,7 +49,7 @@
    const viewContentWidth = parseInt(popupViewWidth - viewContentPadding * 2);
    // æ˜¾ç¤ºå¼¹çª—
    maskLayers.show();
    try{
    if (data.goodsId) {
      let sLeft = 0;
      let popupViewHeight = popupViewWidth + uni.upx2px(390);
@@ -742,6 +743,12 @@
        getApp().globalData.hasMode = false
      }
    });
    }
    catch(e)
    {
        console.log(e);
        maskLayers.hide();
    }
  }
  export default () => {
uniapp/utils/http.api.js
@@ -101,6 +101,9 @@
let getRecomInviterUrl="/api/user/getRecomInviter";
let updateFirstFreeBrowseUrl="/api/user/update_first_free_browse";
let updateCidUrl="/api/user/UpdateClientId";
let checkPreferenceGoodsUrl="/api/user/check_preference_goods";
let gussessLikeGoodsUrl="/api/taoke/gussess_like_goods";
// æ­¤å¤„第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
@@ -208,9 +211,11 @@
    let getRecomInviter=(params = {}) => vm.$u.post(getRecomInviterUrl, params); //获取推荐邀请人
    let updateFirstFreeBrowse=(params = {}) => vm.$u.post(updateFirstFreeBrowseUrl, params); //记录0元购
    let updateCid=(params={})=>vm.$u.post(updateCidUrl,params);//更新pushcid
    let checkPreferenceGoods=(params={})=>vm.$u.post(checkPreferenceGoodsUrl,params);//检测是否有偏好商品
    let gussessLikeGoods=(params={})=>vm.$u.post(gussessLikeGoodsUrl,params);//首页猜你喜欢
    
    // å°†å„个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
    vm.$u.api = {updateCid,updateFirstFreeBrowse,getRecomInviter,changeCode,getHdkCategoryList,eleStoreList,getPrivilegeShareLink,getDyGoodsDetail,bindMobileLogin,getTopMessId,changePwd,comminInt,wxapplogin,getTopCalss,getBanner,getHomeMenu,getSuperClass,getMQD,getGoodThing,login,sendSms,mobileLogin,setPwd,getUserInfo,getTalentInfo,getMessageList,getGoodsDetail,getPrivilegeLink,getSimilerGoods,getJdsDetail,getPddDetail,getM,getWphGoodsDetail,addCollect,delCollect,hotKey,suggestion,goodsSearch,activityLink,unionAct,singlePageLink,checkPddAuth,getPddAuth,getPineGoods,jdGoodsList,optimusMaterial,pddGoodsList,brandList,brandInfo,wphGoodsList,meituanAct,eleAct,eleShangjin,userHomemenu,getAppVersion,userBrowse,delBrowse,activitySingle,userCollect,bdHomemenu,getCity,coordinate,cityCate,searchDeals,getCityId,seckillShowinfo,seckillList,identifyGoods,changeMobile,bindInvitation,getInviteInfo,getEstimateAmount,fansList,getFansCount,getHelpType,getHelpList,getHelpDetail,getWpanurl,getChainTurning,superDiscountGoods,getHistory,getTbGoodsList,cateRankList,getUpgradeInfo,getEquityCard,levelApply,orderList,userProfit,bindZfb,withdraw,getBalanceLog,getPublisher,getAlbum,likeAlbum,albumDetail,anchorFollow,myFollowAlbum,feedback,userCancel,profile,bindWechat,unboundWechat};
    vm.$u.api = {gussessLikeGoods,checkPreferenceGoods,updateCid,updateFirstFreeBrowse,getRecomInviter,changeCode,getHdkCategoryList,eleStoreList,getPrivilegeShareLink,getDyGoodsDetail,bindMobileLogin,getTopMessId,changePwd,comminInt,wxapplogin,getTopCalss,getBanner,getHomeMenu,getSuperClass,getMQD,getGoodThing,login,sendSms,mobileLogin,setPwd,getUserInfo,getTalentInfo,getMessageList,getGoodsDetail,getPrivilegeLink,getSimilerGoods,getJdsDetail,getPddDetail,getM,getWphGoodsDetail,addCollect,delCollect,hotKey,suggestion,goodsSearch,activityLink,unionAct,singlePageLink,checkPddAuth,getPddAuth,getPineGoods,jdGoodsList,optimusMaterial,pddGoodsList,brandList,brandInfo,wphGoodsList,meituanAct,eleAct,eleShangjin,userHomemenu,getAppVersion,userBrowse,delBrowse,activitySingle,userCollect,bdHomemenu,getCity,coordinate,cityCate,searchDeals,getCityId,seckillShowinfo,seckillList,identifyGoods,changeMobile,bindInvitation,getInviteInfo,getEstimateAmount,fansList,getFansCount,getHelpType,getHelpList,getHelpDetail,getWpanurl,getChainTurning,superDiscountGoods,getHistory,getTbGoodsList,cateRankList,getUpgradeInfo,getEquityCard,levelApply,orderList,userProfit,bindZfb,withdraw,getBalanceLog,getPublisher,getAlbum,likeAlbum,albumDetail,anchorFollow,myFollowAlbum,feedback,userCancel,profile,bindWechat,unboundWechat};
}
export default {