修改列表收藏与点赞图标、商品详情链接兼容病种id
7
App.vue
|
@ -10,7 +10,6 @@
|
|||
toolAll.tools.currentContext();
|
||||
// 设置电量栏和导航栏的高度
|
||||
uni.setStorageSync('electric_nav_height',uni.getSystemInfoSync().statusBarHeight + 54);
|
||||
|
||||
toolAll.tools.isVedio();
|
||||
uni.request({
|
||||
url: `${uni.getStorageSync('hostapi')}index/mini-program-setting`,
|
||||
|
@ -32,14 +31,12 @@
|
|||
})
|
||||
},
|
||||
onShow: function() {
|
||||
// uni.clearStorageSync()
|
||||
if(uni.getStorageSync('token')!='') {
|
||||
toolAll.tools.networkStatus();//检查当前网络状态
|
||||
toolAll.tools.updaX();//检测版本更新
|
||||
// 刷新token
|
||||
toolAll.tools.refrshTokenEv();
|
||||
toolAll.tools.isLogin();//刷新token
|
||||
}
|
||||
toolAll.tools.checkQuan();
|
||||
toolAll.tools.checkQuan(); // 查询首页活动券
|
||||
},
|
||||
onHide: function() {
|
||||
toolAll.tools.closeTimer();//清空埋点倒计时
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<view>
|
||||
<scroll-view scroll-x >
|
||||
<scroll-view scroll-x v-if="isaaaa==0">
|
||||
<view class="" :class="isCenter?'disac':'disjb'">
|
||||
<view @tap="choosecate(index)" v-if="item.title!='仿真设计'"
|
||||
:style="{
|
||||
|
@ -13,6 +13,19 @@
|
|||
v-for="(item,index) in newcateList" :key="index">{{item.title}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<scroll-view scroll-x v-else>
|
||||
<view class="disac">
|
||||
<view @tap="choosecate(index)" v-if="item.title!='仿真设计'"
|
||||
:style="{
|
||||
background : newCurrent==index ? activeb:newbmo,
|
||||
fontSize:newfmo+'px',
|
||||
borderRadius:newRadius+'px',
|
||||
minWidth:isMinW ? newMinWidth+'px':'',
|
||||
color : newCurrent==index ? activec:newcmo}"
|
||||
class="flexs cateitem"
|
||||
v-for="(item,index) in newcateList" :key="index">{{item.title}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -20,6 +33,10 @@
|
|||
export default {
|
||||
name:"cate-pu",
|
||||
props:{
|
||||
isaaaa:{
|
||||
type:Number,
|
||||
default:0
|
||||
},
|
||||
isCenter:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
<image lazy-load :class="radiu?'radius15':'radius30'" class=" width100 list-min" :src="item.main_img" mode="widthFix"></image>
|
||||
<view class="posia fon24 colf" style="right: 10rpx;bottom: 160rpx;z-index: 1;">
|
||||
<view @tap.stop="praiseEv(index)" class="disjcac fc">
|
||||
<image lazy-load :style="{width: radiu ?'40rpx':'60rpx',height: radiu ?'40rpx':'60rpx'}" :src="['/static/public/list-nlike.png','/static/public/detail-like.png'][item.is_liked]" mode="aspectFill"></image>
|
||||
<image class="img-box" lazy-load :style="{width: radiu ?'40rpx':'60rpx',height: radiu ?'40rpx':'60rpx'}" :src="['/static/public/list-nlike.png','/static/public/detail-like.png'][item.is_liked]" mode="aspectFill"></image>
|
||||
<view>{{item.likes>100 ? '99+':item.likes}}</view>
|
||||
</view>
|
||||
<view @tap.stop="chooseLike(index)" class="disjcac fc mar-s10">
|
||||
<image lazy-load :style="{width: radiu ?'40rpx':'60rpx',height: radiu ?'40rpx':'60rpx'}" :src="['/static/public/cnllection-no.png','/static/public/yconllection.png'][item.is_collected]" mode="aspectFill"></image>
|
||||
<image class="img-box" lazy-load :style="{width: radiu ?'40rpx':'60rpx',height: radiu ?'40rpx':'60rpx'}" :src="['/static/public/cnllection-no.png','/static/public/yconllection.png'][item.is_collected]" mode="aspectFill"></image>
|
||||
<view>{{item.collects>100 ? '99+':item.collects}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -50,11 +50,11 @@
|
|||
<image lazy-load :class="radiu?'radius15':'radius30'" class="width100 list-min" :src="item.main_img" mode="widthFix"></image>
|
||||
<view class="posia fon24 colf" style="right: 10rpx;bottom: 160rpx;z-index: 1;">
|
||||
<view @tap.stop="praiseEv(index)" class="disjcac fc">
|
||||
<image lazy-load :style="{width: radiu ?'40rpx':'60rpx',height: radiu ?'40rpx':'60rpx'}" :src="['/static/public/list-nlike.png','/static/public/detail-like.png'][item.is_liked]" mode="aspectFill"></image>
|
||||
<image class="img-box" lazy-load :style="{width: radiu ?'40rpx':'60rpx',height: radiu ?'40rpx':'60rpx'}" :src="['/static/public/list-nlike.png','/static/public/detail-like.png'][item.is_liked]" mode="aspectFill"></image>
|
||||
<view>{{item.likes>100 ? '99+':item.likes}}</view>
|
||||
</view>
|
||||
<view @tap.stop="chooseLike(index)" class="disjcac fc mar-s10">
|
||||
<image lazy-load :style="{width: radiu ?'40rpx':'60rpx',height: radiu ?'40rpx':'60rpx'}" :src="['/static/public/cnllection-no.png','/static/public/yconllection.png'][item.is_collected]" mode="aspectFill"></image>
|
||||
<image class="img-box" lazy-load :style="{width: radiu ?'40rpx':'60rpx',height: radiu ?'40rpx':'60rpx'}" :src="['/static/public/cnllection-no.png','/static/public/yconllection.png'][item.is_collected]" mode="aspectFill"></image>
|
||||
<view>{{item.collects>100 ? '99+':item.collects}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -181,5 +181,5 @@
|
|||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.img-box {border-radius: 100%;}
|
||||
</style>
|
||||
|
|
|
@ -1,39 +1,48 @@
|
|||
// 统一给参数
|
||||
const dataObj = (url, params) => {
|
||||
let options = params
|
||||
// #ifdef APP-PLUS
|
||||
// DOTO:暂时没处理过,只是放在这里
|
||||
let data = null; //业务数据
|
||||
let terminal = 1 //终端类型,web:0,app:1
|
||||
options = {
|
||||
...params,
|
||||
data,
|
||||
sign,
|
||||
terminal
|
||||
}
|
||||
// #endif
|
||||
return options
|
||||
}
|
||||
// const ENV = process.env.NODE_ENV;
|
||||
const ENV = process.env;
|
||||
console.log(ENV,2);
|
||||
|
||||
// 清理所有缓存并前往授权页
|
||||
const goLogin = () => {
|
||||
// uni.clearStorageSync();
|
||||
console.log('token失效');
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/login/Login'
|
||||
// }) //未授权,请重新登录(401)
|
||||
uni.clearStorageSync();
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
// 请求错误处理
|
||||
const checkError = (e, reject) => {
|
||||
const checkError = (e) => {
|
||||
// console.error("----接口错误----", e)
|
||||
if (e.data) {
|
||||
if (e.data.code) {
|
||||
switch (Number(e.data.code)) {
|
||||
case 4001:
|
||||
goLogin()
|
||||
case 4003:
|
||||
// 参数错误
|
||||
console.log('4003参数错误');
|
||||
break;
|
||||
case 4004:
|
||||
// 记录不存在
|
||||
console.log('4004记录不存在');
|
||||
break;
|
||||
case 5001:
|
||||
// xxx错误
|
||||
console.log('5001xxx错误');
|
||||
break;
|
||||
case 5050:
|
||||
// 服务器错误,请稍后重试
|
||||
console.log('5050服务器错误,请稍后重试');
|
||||
break;
|
||||
case 5051:
|
||||
// 未知错误
|
||||
console.log('5051未知错误');
|
||||
break;
|
||||
case 6001:
|
||||
// token验证失败或已失效
|
||||
console.log('6001token验证失败或已失效');
|
||||
goLogin();
|
||||
break;
|
||||
}
|
||||
}
|
||||
reject(e.data)
|
||||
} else reject({msg:'接口错误'})
|
||||
}
|
||||
}
|
||||
|
||||
// 封装请求
|
||||
|
@ -62,25 +71,12 @@ const request = (method, url, options) => {
|
|||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
}
|
||||
break;
|
||||
}
|
||||
let obj = {},
|
||||
hideLoading = false,
|
||||
loadingText = 'loading...';
|
||||
if (options) { //如果有options
|
||||
if (options.hideLoading) {
|
||||
hideLoading = options.hideLoading
|
||||
delete options.hideLoading
|
||||
}
|
||||
if (options.loadingText) {
|
||||
loadingText = options.loadingText
|
||||
delete options.loadingText
|
||||
}
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: `${uni.getStorageSync('hostapi')}${url}`,
|
||||
method: methods,
|
||||
data: dataObj(url, options),
|
||||
data: options,
|
||||
header: headers,
|
||||
success: res => {
|
||||
console.log(`${url}返的结果===>`,res);
|
||||
|
@ -92,22 +88,14 @@ const request = (method, url, options) => {
|
|||
title:res.data.msg,
|
||||
icon:'none'
|
||||
})
|
||||
resolve(res.data)
|
||||
checkError(res)
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title:'系统错误',
|
||||
icon:'none'
|
||||
})
|
||||
reject(res.data)
|
||||
checkError(res)
|
||||
}
|
||||
},
|
||||
fail: e => {
|
||||
uni.showToast({
|
||||
title:'系统错误',
|
||||
icon:'none'
|
||||
})
|
||||
checkError(e, reject)
|
||||
checkError(e)
|
||||
},
|
||||
complete: rest => {
|
||||
// console.log(rest);
|
||||
|
@ -120,7 +108,6 @@ const request = (method, url, options) => {
|
|||
// 上传文件 封装请求
|
||||
const uploadFile = (url, options) => {
|
||||
let tempData = options || {}
|
||||
uni.showLoading({title: "上传中..."})
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: `${uni.getStorageSync('hostapi')}${url}`,
|
||||
|
|
|
@ -344,34 +344,14 @@ const tools = {
|
|||
// #endif
|
||||
},
|
||||
isLogin(){//是否已经登录
|
||||
if(uni.getStorageSync('phone_active') !=0){
|
||||
var date = new Date();
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
// 如果过期时间 减 10分钟 小于当前时间,刷新token
|
||||
if((uni.getStorageSync('expire')*1000 - 600000) < timestamp) {
|
||||
// 调用登录事件
|
||||
this.loginEv();
|
||||
}
|
||||
console.log('进入了检测是否登录过期事件');
|
||||
var date = new Date();
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
// 如果过期时间 减 10分钟 小于当前时间,刷新token
|
||||
if((uni.getStorageSync('expire')*1000 - 600000) < timestamp) {
|
||||
// 调用登录事件
|
||||
this.loginEv();
|
||||
}
|
||||
},
|
||||
// 定义刷新token定时器
|
||||
refreshToken:null,
|
||||
// 刷新token事件
|
||||
refrshTokenEv(){
|
||||
// 清除token定时器
|
||||
clearInterval(this.refreshToken);
|
||||
// 开启定时器
|
||||
this.refreshToken = setInterval(()=>{
|
||||
var date = new Date();
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
// 如果过期时间 减 10分钟 小于当前时间,刷新token
|
||||
if((uni.getStorageSync('expire')*1000 - 600000) < timestamp) {
|
||||
// 调用登录事件
|
||||
this.loginEv();
|
||||
}
|
||||
},300000)//五分钟执行一次
|
||||
// },5000)//五秒钟执行一次
|
||||
console.log('进入了检测是否登录过期事件');
|
||||
},
|
||||
// 登录事件
|
||||
loginEv(){
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name" : "恒美植发",
|
||||
"appid" : "__UNI__02EF3E2",
|
||||
"appid" : "__UNI__0EFED76",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
|
@ -77,8 +77,19 @@
|
|||
}
|
||||
},
|
||||
"h5" : {
|
||||
"sdkConfigs" : {
|
||||
"maps" : {}
|
||||
"devServer" : {
|
||||
"port" : 8000,
|
||||
"disableHostCheck" : true,
|
||||
"proxy" : {
|
||||
"/api" : {
|
||||
"target" : "https://hengmei.scdxtc.cn", // 需要跨域的域名
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"^/api" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mp-baidu" : {
|
||||
|
|
|
@ -57,6 +57,14 @@
|
|||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
// 检测当前运行环境并缓存域名
|
||||
this.$toolAll.tools.currentContext();
|
||||
// 设置电量栏和导航栏的高度
|
||||
uni.setStorageSync('electric_nav_height',uni.getSystemInfoSync().statusBarHeight + 54);
|
||||
this.$toolAll.tools.isVedio();
|
||||
this.$requst.get(`index/mini-program-setting`).then(res=>{
|
||||
uni.setStorageSync('publicColor', res.data.mainColor) //#3875F6 #2E8B57
|
||||
})
|
||||
// let ya = this;
|
||||
// // 微信扫码后会自动编码,所以需要解码
|
||||
// if (options && options.q) {
|
||||
|
@ -77,7 +85,7 @@
|
|||
refuse(){//暂不绑定事件
|
||||
this.isShowP=false;
|
||||
this.$toolAll.tools.showToast('登录成功','success')
|
||||
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
},
|
||||
getphonenumber(e){//授权绑定手机号
|
||||
let ya = this;
|
||||
|
@ -96,6 +104,8 @@
|
|||
} else {
|
||||
// console.log('取消授权手机号')
|
||||
}
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -336,7 +336,9 @@
|
|||
this.checkCate(this.category_id)//调用热门分类列表事件
|
||||
} else {
|
||||
this.chooseCate(this.ccurrent);
|
||||
this.otherEv(this.cateList[this.ccurrent].children[0].id);//调用其他分类列表事件
|
||||
if(this.cateList[this.ccurrent].length) {
|
||||
this.otherEv(this.cateList[this.ccurrent].children[0].id);//调用其他分类列表事件
|
||||
}
|
||||
}
|
||||
if(this.cateList.length!=0){
|
||||
setTimeout(()=>{
|
||||
|
|
|
@ -492,7 +492,7 @@
|
|||
if(this.$toolAll.tools.judgeAuth()){
|
||||
if(index==(this.gonggList.length-1)){
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/cate/cate'
|
||||
url:'/pages/tabbar/cate/cate?index=0'
|
||||
})
|
||||
} else {
|
||||
let existfx = this.gonggList[index].url.indexOf('/');
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</view>
|
||||
<view id="daoh" :class="isTop?'isTop':''" class="isTops" :style="{top:(statusHNH-10)+'px'}">
|
||||
<view class="bacf pad-zy32 mar-s20 pad-sx20">
|
||||
<cate-pu :newCurrent="newCurrent*1" :activeb="publicColor" @choosecateEv="chooseTwo" :newbmo="'#F2F2F2'" :isCenter="false" :newcateList="cateList"></cate-pu>
|
||||
<cate-pu :isaaaa="1" :newCurrent="newCurrent*1" :activeb="publicColor" @choosecateEv="chooseTwo" :newbmo="'#F2F2F2'" :isCenter="false" :newcateList="cateList"></cate-pu>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mar-zy32 mar-s20" v-if="dataList.length!=0"><list-pu @chooseLike="chooseLike" @praise="praiseEv" @comfirmev="comfirmev" :list="dataList"></list-pu></view>
|
||||
|
@ -165,6 +165,7 @@
|
|||
this.$requst.post('archives/hot',params).then(res=>{
|
||||
if(res.code==0){
|
||||
// 栏目类别
|
||||
this.cateList = [];
|
||||
if(res.data.category.length!=0){
|
||||
res.data.category.forEach((item,index)=>{
|
||||
let cateObj = {
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'我的分享人'" :statusTitle="true"></status-nav>
|
||||
<!-- 输入框 -->
|
||||
<view class="bacf posiszy navHeight" :style="{paddingTop: statusHNH+'px'}">
|
||||
<view class="disja pad-sx30">
|
||||
<!-- <view @tap="chooseye(indexye)" :style="{color:flag==indexye?publicColor:''}" v-for="(itemye,indexye) in cateList" :key="indexye">{{itemye.title}}({{dataList[indexye].length}})</view> -->
|
||||
<view @tap="chooseye(indexye)" :style="{color:flag==indexye?publicColor:''}" v-for="(itemye,indexye) in cateList" :key="indexye">{{itemye.title}}({{itemye.num}})</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -58,7 +56,7 @@
|
|||
[],
|
||||
[],
|
||||
],
|
||||
navH:uni.getStorageSync('navHeight'),
|
||||
navH:uni.getStorageSync('electric_nav_height') + 53,
|
||||
page:1,
|
||||
size:20,
|
||||
total:'',//总数
|
||||
|
@ -69,7 +67,7 @@
|
|||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
if(this.total!=this.dataList[this.flag].length){
|
||||
this.page++
|
||||
this.checkPeople()
|
||||
} else {
|
||||
|
@ -102,22 +100,22 @@
|
|||
if(res.code==0){
|
||||
this.cateList[0].num = res.data.user_count.first
|
||||
this.cateList[1].num = res.data.user_count.second
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
||||
}
|
||||
})
|
||||
},
|
||||
checkPeople(){//查询分享一二级列表人数
|
||||
this.$requst.post('user/share-users',{grade:this.cateList[this.flag].grade,page:this.page,size:this.size}).then(res=>{
|
||||
if(this.flag){
|
||||
this.dataList[1] = [];
|
||||
if(this.page==1) this.dataList[1] = [];
|
||||
} else {
|
||||
this.dataList[0] = [];
|
||||
if(this.page==1) this.dataList[0] = [];
|
||||
}
|
||||
if(res.code==0){
|
||||
if(res.data.list.length!=0){
|
||||
res.data.list.forEach(item=>{
|
||||
let obj = {
|
||||
src:item.account.headimgurl,
|
||||
name:item.account.nickname,
|
||||
src:item.headimgurl,
|
||||
name:item.nickname,
|
||||
time:item.created_at,
|
||||
action:item.invite_source,
|
||||
num:item.score
|
||||
|
@ -126,8 +124,8 @@
|
|||
})
|
||||
this.total = res.data.total
|
||||
}
|
||||
} else this.$toolAll.tools.showToast(res.msg);
|
||||
},error=>{})
|
||||
}
|
||||
})
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
|
@ -136,6 +134,7 @@
|
|||
});
|
||||
},
|
||||
chooseye(index){
|
||||
this.page = 1;
|
||||
this.flag = index;
|
||||
this.checkPeople();
|
||||
}
|
||||
|
|
|
@ -526,8 +526,10 @@
|
|||
}
|
||||
let newList = [params];
|
||||
uni.setStorageSync('orderList',newList);
|
||||
// 缓存支付方式
|
||||
uni.setStorageSync('payType',this.detailObj.pay_type);
|
||||
if(this.isNei!=3) {
|
||||
// 缓存支付方式
|
||||
uni.setStorageSync('payType',this.detailObj.pay_type);
|
||||
} else {uni.setStorageSync('payType','')}
|
||||
uni.navigateTo({
|
||||
url:`/pagesA/getReadyDan/getReadyDan?isNei=${this.isNei}&isVirtual=${this.detailObj.spu_type}`
|
||||
})
|
||||
|
@ -660,7 +662,7 @@
|
|||
// 默认选中的栏目
|
||||
if(item.active==1) this.active = this.cateCurrent = index
|
||||
// 默认展示栏目详情
|
||||
if(this.category_id==item.id) this.isNum = index
|
||||
// if(this.category_id==item.id) this.isNum = index
|
||||
})
|
||||
}
|
||||
if(this.invite_code!='' && this.invite_code!=undefined){
|
||||
|
|
Before Width: | Height: | Size: 690 B After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 998 B After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 677 B After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 992 B After Width: | Height: | Size: 2.2 KiB |