Merge branch 'dev' into chenxuelian

This commit is contained in:
”chenxuelian“
2023-01-12 22:08:33 +08:00
17 changed files with 330 additions and 192 deletions

View File

@@ -55,8 +55,12 @@
<text>{{detailList.pub_time}}</text>
</view>
<u-parse :content="detailList.desc" @preview="preview" @navigate="navigate"></u-parse>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view>
</view>
</view>
</template>
@@ -64,49 +68,87 @@
import {
dateFormatDetail
} from '../../../utills/date.js'
import login from 'pages/my/login/login'
export default {
components: {
login
},
data() {
return {
id: '',
imgUrl: '',
tagsArray: [],
showHeart: false,
detailList: []
detailList: [],
isLoad: true
}
},
onLoad(option) {
this.id = option.id
this.getProductDetail()
this.imgUrl = uni.getStorageSync('img_url')
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
console.log(uni.getStorageSync('token'))
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
methods: {
//获取详情信息
getProductDetail() {
this.$apiServe.getProductDetail(this.id).then(res => {
console.log('详情页', res.data.data)
console.log('产品详情页', res.data)
if (res.data.data.thumb) {
this.isThumb = true
}
let detail = res.data.data
detail.pub_time = dateFormatDetail(detail.pub_time)
let tag = detail.tags
this.tagsArray = tag.split(',')
detail.tags = this.tagsArray
this.detailList = res.data.data
if (res.data.data) {
let detail = res.data.data
detail.pub_time = dateFormatDetail(detail.pub_time)
let tag = detail.tags
this.tagsArray = tag.split(',')
detail.tags = this.tagsArray
this.detailList = res.data.data
} else {
this.$toast.warn('没有更多详情了')
}
}).finally(_ => {})
},
//收藏按钮
starTap() {
this.detailList.type = !this.detailList.type
// this.$apiServe.collect(this.id).then(res => {
// console.log('收藏成功', res.data)
// this.detailList.type = 1
// }).finally(_ => {})
this.$apiServe.collect(this.id).then(res => {
console.log('收藏成功', res.data)
if (res.data.code == 1) {
this.detailList.type = 1
this.$toast.warn('收藏成功')
} else {
this.$toast.warn('收藏失败')
}
}).finally(_ => {})
},
//点赞按钮
heartTap() {
this.showHeart = !this.showHeart
},
reOnLoad() {
console.log('----------------true')
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试')
}
}
}

View File

@@ -105,8 +105,10 @@
</template>
<script>
import { apiService } from '../../service/request'
import login from '../my/login/login.vue'
import {
apiService
} from '../../service/request'
import login from '../my/login/login.vue'
export default {
components: {
login
@@ -152,9 +154,9 @@ import login from '../my/login/login.vue'
},
onLoad(options) {
console.log(options)
if (options.index == 0) {
if (options.index == 1) {
this.tabCurrent = 0
} else if (options.index == 1) {
} else if (options.index == 2) {
this.tabCurrent = 1
}
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
@@ -230,7 +232,7 @@ import login from '../my/login/login.vue'
},
getPositionValue(data) {
this.showPositionPicker = false
const obj = this.positionPickerList.find(item => {
return item.name === data.value[0]
})
@@ -238,7 +240,7 @@ import login from '../my/login/login.vue'
if (obj) {
this.needsPublishForm.tagids = obj.id
}
},
getCategoryValue(data) {
this.showCategoryPicker = false
@@ -322,13 +324,15 @@ import login from '../my/login/login.vue'
http.open('GET', blodurl, true);
http.responseType = 'blob';
http.onload = function(e) {
if (this.status == 200 || this.status === 0) {
// console.log('blod数据',this.response);
// 在将blod数据转为file
let files = new window.File([this.response], 'file.name', { type: 'image' });
// console.log('blod数据转换file',files);
resolve(files);
}
if (this.status == 200 || this.status === 0) {
// console.log('blod数据',this.response);
// 在将blod数据转为file
let files = new window.File([this.response], 'file.name', {
type: 'image'
});
// console.log('blod数据转换file',files);
resolve(files);
}
};
http.send();
});

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 {

View File

@@ -22,10 +22,10 @@
@click="showModal()">
</u-cell>
</u-cell-group>
<u-modal :show="showM" showCancelButton closeOnClickOverlay confirmText="是" cancelText="否"
<u-modal :show="showM" showCancelButton closeOnClickOverlay="false" confirmText="是" cancelText="否"
@confirm="confirm" @cancel="cancel" @close="close">
<view>
<text>{{phone}}</text>
<view>{{phone}}</view>
<text>是否拨打客服电话</text>
</view>
</u-modal>
@@ -101,6 +101,10 @@
</script>
<style lang="scss">
.u-navbar__content__left {
display: none !important;
}
.table {
background-color: #fff;
margin-top: 50rpx;