修改列表收藏与点赞图标、商品详情链接兼容病种id

master
chen 2022-03-14 18:28:35 +08:00
parent 701e1ef06d
commit 306949fc25
43 changed files with 145 additions and 139 deletions

View File

@ -10,7 +10,6 @@
toolAll.tools.currentContext(); toolAll.tools.currentContext();
// //
uni.setStorageSync('electric_nav_height',uni.getSystemInfoSync().statusBarHeight + 54); uni.setStorageSync('electric_nav_height',uni.getSystemInfoSync().statusBarHeight + 54);
toolAll.tools.isVedio(); toolAll.tools.isVedio();
uni.request({ uni.request({
url: `${uni.getStorageSync('hostapi')}index/mini-program-setting`, url: `${uni.getStorageSync('hostapi')}index/mini-program-setting`,
@ -32,14 +31,12 @@
}) })
}, },
onShow: function() { onShow: function() {
// uni.clearStorageSync()
if(uni.getStorageSync('token')!='') { if(uni.getStorageSync('token')!='') {
toolAll.tools.networkStatus();// toolAll.tools.networkStatus();//
toolAll.tools.updaX();// toolAll.tools.updaX();//
// token toolAll.tools.isLogin();//token
toolAll.tools.refrshTokenEv();
} }
toolAll.tools.checkQuan(); toolAll.tools.checkQuan(); //
}, },
onHide: function() { onHide: function() {
toolAll.tools.closeTimer();// toolAll.tools.closeTimer();//

View File

@ -1,6 +1,6 @@
<template> <template>
<view> <view>
<scroll-view scroll-x > <scroll-view scroll-x v-if="isaaaa==0">
<view class="" :class="isCenter?'disac':'disjb'"> <view class="" :class="isCenter?'disac':'disjb'">
<view @tap="choosecate(index)" v-if="item.title!='仿'" <view @tap="choosecate(index)" v-if="item.title!='仿'"
:style="{ :style="{
@ -13,6 +13,19 @@
v-for="(item,index) in newcateList" :key="index">{{item.title}}</view> v-for="(item,index) in newcateList" :key="index">{{item.title}}</view>
</view> </view>
</scroll-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> </view>
</template> </template>
@ -20,6 +33,10 @@
export default { export default {
name:"cate-pu", name:"cate-pu",
props:{ props:{
isaaaa:{
type:Number,
default:0
},
isCenter:{ isCenter:{
type:Boolean, type:Boolean,
default:true default:true

View File

@ -8,11 +8,11 @@
<image lazy-load :class="radiu?'radius15':'radius30'" class=" width100 list-min" :src="item.main_img" mode="widthFix"></image> <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 class="posia fon24 colf" style="right: 10rpx;bottom: 160rpx;z-index: 1;">
<view @tap.stop="praiseEv(index)" class="disjcac fc"> <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>{{item.likes>100 ? '99+':item.likes}}</view>
</view> </view>
<view @tap.stop="chooseLike(index)" class="disjcac fc mar-s10"> <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>{{item.collects>100 ? '99+':item.collects}}</view>
</view> </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> <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 class="posia fon24 colf" style="right: 10rpx;bottom: 160rpx;z-index: 1;">
<view @tap.stop="praiseEv(index)" class="disjcac fc"> <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>{{item.likes>100 ? '99+':item.likes}}</view>
</view> </view>
<view @tap.stop="chooseLike(index)" class="disjcac fc mar-s10"> <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>{{item.collects>100 ? '99+':item.collects}}</view>
</view> </view>
</view> </view>
@ -181,5 +181,5 @@
</script> </script>
<style> <style>
.img-box {border-radius: 100%;}
</style> </style>

View File

@ -1,39 +1,48 @@
// 统一给参数 // const ENV = process.env.NODE_ENV;
const dataObj = (url, params) => { const ENV = process.env;
let options = params console.log(ENV,2);
// #ifdef APP-PLUS
// DOTO:暂时没处理过,只是放在这里 // 清理所有缓存并前往授权页
let data = null; //业务数据
let terminal = 1 //终端类型web:0,app:1
options = {
...params,
data,
sign,
terminal
}
// #endif
return options
}
const goLogin = () => { const goLogin = () => {
// uni.clearStorageSync(); uni.clearStorageSync();
console.log('token失效'); uni.navigateTo({
// uni.reLaunch({ url: '/pages/login/login'
// url: '/pages/login/Login' })
// }) //未授权,请重新登录(401)
} }
// 请求错误处理 // 请求错误处理
const checkError = (e, reject) => { const checkError = (e) => {
// console.error("----接口错误----", e) // console.error("----接口错误----", e)
if (e.data) { if (e.data) {
if (e.data.code) { if (e.data.code) {
switch (Number(e.data.code)) { switch (Number(e.data.code)) {
case 4001: case 4003:
goLogin() // 参数错误
console.log('4003参数错误');
break; 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') || '' 'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
} }
break; 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) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
url: `${uni.getStorageSync('hostapi')}${url}`, url: `${uni.getStorageSync('hostapi')}${url}`,
method: methods, method: methods,
data: dataObj(url, options), data: options,
header: headers, header: headers,
success: res => { success: res => {
console.log(`${url}返的结果===>`,res); console.log(`${url}返的结果===>`,res);
@ -92,22 +88,14 @@ const request = (method, url, options) => {
title:res.data.msg, title:res.data.msg,
icon:'none' icon:'none'
}) })
resolve(res.data) checkError(res)
} }
} else { } else {
uni.showToast({ checkError(res)
title:'系统错误',
icon:'none'
})
reject(res.data)
} }
}, },
fail: e => { fail: e => {
uni.showToast({ checkError(e)
title:'系统错误',
icon:'none'
})
checkError(e, reject)
}, },
complete: rest => { complete: rest => {
// console.log(rest); // console.log(rest);
@ -120,7 +108,6 @@ const request = (method, url, options) => {
// 上传文件 封装请求 // 上传文件 封装请求
const uploadFile = (url, options) => { const uploadFile = (url, options) => {
let tempData = options || {} let tempData = options || {}
uni.showLoading({title: "上传中..."})
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
url: `${uni.getStorageSync('hostapi')}${url}`, url: `${uni.getStorageSync('hostapi')}${url}`,

View File

@ -344,34 +344,14 @@ const tools = {
// #endif // #endif
}, },
isLogin(){//是否已经登录 isLogin(){//是否已经登录
if(uni.getStorageSync('phone_active') !=0){ var date = new Date();
var date = new Date(); var timestamp = date.getTime();//精确到毫秒
var timestamp = date.getTime();//精确到毫秒 // 如果过期时间 减 10分钟 小于当前时间刷新token
// 如果过期时间 减 10分钟 小于当前时间刷新token if((uni.getStorageSync('expire')*1000 - 600000) < timestamp) {
if((uni.getStorageSync('expire')*1000 - 600000) < timestamp) { // 调用登录事件
// 调用登录事件 this.loginEv();
this.loginEv();
}
console.log('进入了检测是否登录过期事件');
} }
}, console.log('进入了检测是否登录过期事件');
// 定义刷新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)//五秒钟执行一次
}, },
// 登录事件 // 登录事件
loginEv(){ loginEv(){

View File

@ -1,6 +1,6 @@
{ {
"name" : "恒美植发", "name" : "恒美植发",
"appid" : "__UNI__02EF3E2", "appid" : "__UNI__0EFED76",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
@ -77,8 +77,19 @@
} }
}, },
"h5" : { "h5" : {
"sdkConfigs" : { "devServer" : {
"maps" : {} "port" : 8000,
"disableHostCheck" : true,
"proxy" : {
"/api" : {
"target" : "https://hengmei.scdxtc.cn", //
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"^/api" : ""
}
}
}
} }
}, },
"mp-baidu" : { "mp-baidu" : {

View File

@ -57,6 +57,14 @@
}; };
}, },
onLoad(options) { 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; // let ya = this;
// // , // // ,
// if (options && options.q) { // if (options && options.q) {
@ -77,7 +85,7 @@
refuse(){// refuse(){//
this.isShowP=false; this.isShowP=false;
this.$toolAll.tools.showToast('登录成功','success') this.$toolAll.tools.showToast('登录成功','success')
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'}) uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
}, },
getphonenumber(e){// getphonenumber(e){//
let ya = this; let ya = this;
@ -96,6 +104,8 @@
} else { } else {
// console.log('') // console.log('')
} }
}).catch(err=>{
console.log(err);
}) })
} }
}) })

View File

@ -336,7 +336,9 @@
this.checkCate(this.category_id)// this.checkCate(this.category_id)//
} else { } else {
this.chooseCate(this.ccurrent); 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){ if(this.cateList.length!=0){
setTimeout(()=>{ setTimeout(()=>{

View File

@ -492,7 +492,7 @@
if(this.$toolAll.tools.judgeAuth()){ if(this.$toolAll.tools.judgeAuth()){
if(index==(this.gonggList.length-1)){ if(index==(this.gonggList.length-1)){
uni.navigateTo({ uni.navigateTo({
url:'/pages/tabbar/cate/cate' url:'/pages/tabbar/cate/cate?index=0'
}) })
} else { } else {
let existfx = this.gonggList[index].url.indexOf('/'); let existfx = this.gonggList[index].url.indexOf('/');

View File

@ -34,7 +34,7 @@
</view> </view>
<view id="daoh" :class="isTop?'isTop':''" class="isTops" :style="{top:(statusHNH-10)+'px'}"> <view id="daoh" :class="isTop?'isTop':''" class="isTops" :style="{top:(statusHNH-10)+'px'}">
<view class="bacf pad-zy32 mar-s20 pad-sx20"> <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> </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> <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=>{ this.$requst.post('archives/hot',params).then(res=>{
if(res.code==0){ if(res.code==0){
// //
this.cateList = [];
if(res.data.category.length!=0){ if(res.data.category.length!=0){
res.data.category.forEach((item,index)=>{ res.data.category.forEach((item,index)=>{
let cateObj = { let cateObj = {

View File

@ -2,10 +2,8 @@
<view> <view>
<!-- 状态栏 --> <!-- 状态栏 -->
<status-nav :titleVal="'我的分享人'" :statusTitle="true"></status-nav> <status-nav :titleVal="'我的分享人'" :statusTitle="true"></status-nav>
<!-- 输入框 -->
<view class="bacf posiszy navHeight" :style="{paddingTop: statusHNH+'px'}"> <view class="bacf posiszy navHeight" :style="{paddingTop: statusHNH+'px'}">
<view class="disja pad-sx30"> <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 @tap="chooseye(indexye)" :style="{color:flag==indexye?publicColor:''}" v-for="(itemye,indexye) in cateList" :key="indexye">{{itemye.title}}({{itemye.num}})</view>
</view> </view>
</view> </view>
@ -58,7 +56,7 @@
[], [],
[], [],
], ],
navH:uni.getStorageSync('navHeight'), navH:uni.getStorageSync('electric_nav_height') + 53,
page:1, page:1,
size:20, size:20,
total:'',// total:'',//
@ -69,7 +67,7 @@
e.scrollTop > 360 ? this.showTop = true : this.showTop = false e.scrollTop > 360 ? this.showTop = true : this.showTop = false
}, },
onReachBottom() {// onReachBottom() {//
if(this.total!=this.dataList.length){ if(this.total!=this.dataList[this.flag].length){
this.page++ this.page++
this.checkPeople() this.checkPeople()
} else { } else {
@ -102,22 +100,22 @@
if(res.code==0){ if(res.code==0){
this.cateList[0].num = res.data.user_count.first this.cateList[0].num = res.data.user_count.first
this.cateList[1].num = res.data.user_count.second this.cateList[1].num = res.data.user_count.second
} else this.$toolAll.tools.showToast(res.msg); }
},error=>{this.$toolAll.tools.showToast(error.msg);}) })
}, },
checkPeople(){// checkPeople(){//
this.$requst.post('user/share-users',{grade:this.cateList[this.flag].grade,page:this.page,size:this.size}).then(res=>{ this.$requst.post('user/share-users',{grade:this.cateList[this.flag].grade,page:this.page,size:this.size}).then(res=>{
if(this.flag){ if(this.flag){
this.dataList[1] = []; if(this.page==1) this.dataList[1] = [];
} else { } else {
this.dataList[0] = []; if(this.page==1) this.dataList[0] = [];
} }
if(res.code==0){ if(res.code==0){
if(res.data.list.length!=0){ if(res.data.list.length!=0){
res.data.list.forEach(item=>{ res.data.list.forEach(item=>{
let obj = { let obj = {
src:item.account.headimgurl, src:item.headimgurl,
name:item.account.nickname, name:item.nickname,
time:item.created_at, time:item.created_at,
action:item.invite_source, action:item.invite_source,
num:item.score num:item.score
@ -126,8 +124,8 @@
}) })
this.total = res.data.total this.total = res.data.total
} }
} else this.$toolAll.tools.showToast(res.msg); }
},error=>{}) })
}, },
backTop(){// backTop(){//
uni.pageScrollTo({ uni.pageScrollTo({
@ -136,6 +134,7 @@
}); });
}, },
chooseye(index){ chooseye(index){
this.page = 1;
this.flag = index; this.flag = index;
this.checkPeople(); this.checkPeople();
} }

View File

@ -526,8 +526,10 @@
} }
let newList = [params]; let newList = [params];
uni.setStorageSync('orderList',newList); uni.setStorageSync('orderList',newList);
// if(this.isNei!=3) {
uni.setStorageSync('payType',this.detailObj.pay_type); //
uni.setStorageSync('payType',this.detailObj.pay_type);
} else {uni.setStorageSync('payType','')}
uni.navigateTo({ uni.navigateTo({
url:`/pagesA/getReadyDan/getReadyDan?isNei=${this.isNei}&isVirtual=${this.detailObj.spu_type}` 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(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){ if(this.invite_code!='' && this.invite_code!=undefined){

Binary file not shown.

Before

Width:  |  Height:  |  Size: 690 B

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B

After

Width:  |  Height:  |  Size: 2.2 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long