dengjie commit : 代码完善

This commit is contained in:
clay
2023-01-09 18:03:51 +08:00
parent 9c0477da5c
commit c906a7d33a
16 changed files with 198 additions and 173 deletions

View File

@@ -13,7 +13,8 @@
<!-- 分类模块 -->
<view class="classify">
<u-grid :border="false" col="5">
<u-grid-item v-for="(listItem,listIndex) in classifyList" :key="listIndex" @click="toClassify(listItem.id)">
<u-grid-item v-for="(listItem,listIndex) in classifyList" :key="listIndex"
@click="toClassify(listItem.id)">
<u--image :src="imgUrl+listItem.icon" width="86rpx" height="86rpx" :lazy-load="true">
</u--image>
<!-- <u-icon size="86rpx" :name="listItem.icon"></u-icon> -->
@@ -26,11 +27,6 @@
<u-swiper :list="swiperList" keyName="img" indicatorMode="line" radius="0" circular></u-swiper>
</view>
<!-- <view style="width: 100px; height: 100px; z-index: 999;">
<u-button type="primary" open-type="getPhoneNumber" size="medium" @getphonenumber="getphonenumber">
获取电话号码</u-button>
</view> -->
<!-- 选项卡: 上架时间和点赞量 -->
<view>
<u-tabs :list="tabList" lineColor="#15CA65" scrollable="false"
@@ -49,7 +45,6 @@
import {
serverHost
} from '@/service/request.js'
import loginVue from '../my/login/login.vue'
export default {
data() {
return {
@@ -80,7 +75,6 @@
this.getCategories()
this.getBanner()
this.getImgUrl()
this.getToken()
this.imgUrl = uni.getStorageSync('img_url')
},
methods: {
@@ -114,42 +108,6 @@
this.$refs.getProductsByTime.productList.push(...res.data.data)
})
},
//获取token
getToken() {
var that = this
uni.login({
"provider": "weixin",
"onlyAuthorize": true, // 微信登录仅请求授权认证
success: function(event) {
const {
code
} = event
that.$apiServe.login({
code: code
}).then(res => {
var data = res.data.data
// console.log('登录code换取的信息', data);
uni.setStorageSync('token', data.token);
})
},
fail: function(err) {
// 登录授权失败
// err.code是错误码
}
})
},
//获取手机code
getphonenumber(e) {
let that = this
// const {
// code
// } = e.detail;
// console.log("手机code : ", code);
},
//获取子组件的getProducts方法返回数据的length用于当length为0时取消发送请求
// getChild(e) {
// this.reachBottomLength = e
// },
//获取一级分类
getCategories() {
this.$apiServe.getCategories().then(res => {
@@ -178,6 +136,7 @@
url: '../../packageSearch/goods-category-search/category-index?categoryId=' + id
})
},
//获取图片url
getImgUrl() {
this.$apiServe.getImgUrl().then(res => {
try {