|
@ -0,0 +1,8 @@
|
|||
/vendor
|
||||
/node_modules
|
||||
/public/storage
|
||||
/unpackage
|
||||
Homestead.yaml
|
||||
Homestead.json
|
||||
.env
|
||||
.idea
|
|
@ -0,0 +1,20 @@
|
|||
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||
"version": "0.0",
|
||||
"configurations": [{
|
||||
"default" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"h5" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-weixin" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<script>
|
||||
import toolAll from '@/jsFile/tools.js';
|
||||
// import {checkSwip} from '@/jsFile/publicAPI.js'
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
toolAll.tools.clearClog()//去除体验版和正式版的所有输出日志
|
||||
},
|
||||
onShow: function() {
|
||||
toolAll.tools.zhuColorT()
|
||||
// uni.clearStorageSync()
|
||||
if(uni.getStorageSync('token')!='') {
|
||||
toolAll.tools.daoTime()
|
||||
toolAll.tools.networkStatus()//检查当前网络状态
|
||||
toolAll.tools.updaX()//检测版本更新
|
||||
}
|
||||
setTimeout(()=>{
|
||||
toolAll.tools.overdue()//查询是否第一次授权
|
||||
},3000)
|
||||
// checkSwip()//查询轮播图位置
|
||||
},
|
||||
onHide: function() {
|
||||
toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/*每个页面公共css */
|
||||
@import url("./commons/hengmei.css");
|
||||
@import url("./commons/animate.min.css");
|
||||
page {background-color: rgba(244, 244, 244, 1);}
|
||||
</style>
|
|
@ -0,0 +1,340 @@
|
|||
/* 首页 */
|
||||
.status-box{position: fixed;top: 0;left: 0;right: 0;z-index: 10;}
|
||||
.status-nav{width: 100%;position: relative;padding: 30rpx 0;display: flex;align-items: center;}
|
||||
.tab-title{font-size: 36rpx;font-weight: bold;color: #333333;width: 100%;}
|
||||
.tcenter{text-align: center;}
|
||||
.input-box{width: 100%;}
|
||||
.input-box>view{background-color: #FFFFFF;margin: 0 40rpx;height: 80rpx;border-radius: 10rpx;padding: 0 17rpx;}
|
||||
.searchImg{width: 28rpx;height: 28rpx;margin-right: 12rpx;}
|
||||
.linev{height: 39rpx;border: 2rpx dashed rgba(136, 136, 136, 1);}
|
||||
.searchT{font-size: 27rpx;margin: 0 23rpx 0 31rpx;}
|
||||
.gongg-box{width: 25%;color: #2C2C2C;}
|
||||
.gongg-box .img-box image{width: 108rpx;height: 108rpx;}
|
||||
.zou> image{height: auto;}
|
||||
.fawen-img{width: 335rpx;height: 400rpx;}
|
||||
.fawen-itemImg{height: 190rpx;}
|
||||
.kitemm{background-color: #E0E0E0;}
|
||||
.reitem-box{background: #F4F4F4;margin-right: 18rpx;padding: 20rpx;}
|
||||
.reitem-box>image{width: 20rpx;height: 23rpx;margin-right: 18rpx;}
|
||||
.reitem{width: 146rpx;height: 65rpx;border-radius: 20rpx;line-height: 65rpx;text-align: center;}
|
||||
.list-box{width: 48.4%;}
|
||||
.list-like-box{top: 18rpx;right: 18rpx;z-index: 1;}
|
||||
.list-like-box>image{width: 69rpx;height: 69rpx;}
|
||||
.list-cont-box{bottom: 10rpx;left: 0rpx;right: 0; padding-top: 100rpx; background:-webkit-linear-gradient(bottom,rgba(0,0,0,0.79),rgba(255,255,255,0));padding-left: 22rpx;padding-right: 22rpx;padding-bottom: 18rpx;border-bottom-left-radius: 30rpx;border-bottom-right-radius: 30rpx;}
|
||||
.list-cont-box15{bottom: 10rpx;left: 0rpx;right: 0; padding-top: 100rpx; background:-webkit-linear-gradient(bottom,rgba(0,0,0,0.79),rgba(255,255,255,0));padding-left: 22rpx;padding-right: 22rpx;padding-bottom: 18rpx;border-bottom-left-radius: 15rpx;border-bottom-right-radius: 15rpx;}
|
||||
.list-headimg{width: 28rpx;height: 28rpx;margin-right: 6rpx;border-radius: 100%;}
|
||||
/* 分类 */
|
||||
.catemo{color: #4D4D4D;padding: 20rpx 10rpx;text-align: center;margin-left: 10rpx;}
|
||||
.cateActive{background-color: #F5F5F5;border-radius: 10rpx 0rpx 0rpx 10rpx;padding: 20rpx 10rpx;text-align: center;margin-left: 10rpx;}
|
||||
.cate-tu-item{padding: 16rpx 20rpx;background-color: #DFDFDF;}
|
||||
.cate-box{position: fixed;top: 0;left: 0;bottom: 140rpx;background-color: #FFFFFF;}
|
||||
.list-min{min-height: 260rpx;}
|
||||
.cate-box .fon26 .mar-s20:first-child {margin-top: 50rpx;}
|
||||
/* 搜索 */
|
||||
.search-input-box{width: 100%;padding-bottom: 20rpx;}
|
||||
.tank-box{margin: 0 85rpx;}
|
||||
.tank-box-itemone{font-size: 32rpx;color: #343434;margin: 90rpx 0;}
|
||||
.tank-btn{width: 240rpx;}
|
||||
/* 我的页面 */
|
||||
|
||||
.icon-box>image:nth-child(1){width: 37rpx;height: 38rpx;}
|
||||
.icon-box>image:nth-child(2){width: 32rpx;height: 34rpx;}
|
||||
.icon-box>image:nth-child(3){width: 31rpx;height: 37rpx;}
|
||||
.icon-box>image:nth-child(4){width: 32rpx;height: 33rpx;}
|
||||
.icon-box>image:nth-child(5){width: 33rpx;height: 35rpx;}
|
||||
.icon-box>image:nth-child(6){width: 35rpx;height: 32rpx;}
|
||||
.icon-box>image:nth-child(7){width: 36rpx;height: 35rpx;}
|
||||
/* 暂无内容时,显示的图片大小 */
|
||||
.zanw-img{width: 474rpx;height: 273rpx;}
|
||||
/* 修改资料页面 */
|
||||
.head_img{width: 140rpx;height: 140rpx;border-radius: 100%;}
|
||||
.nic{color: #101010;}
|
||||
.head_next{width: 19rpx;height: 19rpx;}
|
||||
/* 自主预约 */
|
||||
.xiala{border: 2rpx solid #CECECE;height: 80rpx;line-height: 80rpx;}
|
||||
.xiala image{width: 35rpx;height: 24rpx;}
|
||||
.yutime{width: 160rpx;height: 130rpx;}
|
||||
.timed{width: 210rpx;height: 80rpx;line-height: 80rpx;}
|
||||
.titlel{width: 18%;}
|
||||
.height-68{height: 80rpx;}
|
||||
.btnl{margin: 50rpx 80rpx;height: 90rpx;line-height: 90rpx;}
|
||||
/* 客户列表 */
|
||||
.xialak{height: 60rpx;line-height: 60rpx;border: 2rpx solid #E0E0E0;}
|
||||
.xialak image{width: 35rpx;height: 24rpx;}
|
||||
.customer-btn{height: 60rpx;width: 143rpx;line-height: 60rpx;}
|
||||
/* 医生 */
|
||||
.qdoctor:before{
|
||||
content: '';
|
||||
display: block;
|
||||
width: 10rpx;height: 40rpx;
|
||||
border-radius: 10rpx;
|
||||
background-color: #3875F6;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.doctoritem:before{
|
||||
content: '';
|
||||
display: block;
|
||||
height: 20rpx;
|
||||
border-radius: 10rpx;
|
||||
border: 4rpx solid #3875F6;
|
||||
background-color: #3875F6;
|
||||
margin-right: 6rpx;
|
||||
}
|
||||
/* .zhuan{transition: all 1s;transform: rotate(90deg);} */
|
||||
.nozhuan{transition: all 1s;transform: rotate(0deg);}
|
||||
.xial-box{top: 100rpx;left: 0;right: 0;z-index: 4;border: 2rpx solid #E0E0E0;}
|
||||
.xial-item-box{max-height: 400rpx;overflow-y: scroll; overflow-x: hidden;}
|
||||
.doctorx{margin: 0 15rpx;height: 18rpx;border: 2rpx solid #E6E6E6;}
|
||||
.doctorImg{width: 345rpx;height: 285rpx;border-top-left-radius: 10rpx;border-top-right-radius: 10rpx;}
|
||||
.isTop{background-color: #FFFFFF;box-shadow: 0rpx 3rpx 10rpx rgba(0,0,0,.6);}
|
||||
.isTops{position: sticky;left: 0;right: 0;z-index: 2;}
|
||||
.isTopf{position: fixed;left: 0;right: 0;z-index: 2;}
|
||||
|
||||
/* 底部联系客服、分享、返回首页 */
|
||||
.btnBKS{height: 120rpx;}
|
||||
.lianShare{height: 90rpx;width: 220rpx;}
|
||||
.backH{width: 190rpx;height: 190rpx;top: -126rpx;}
|
||||
|
||||
/* 商城 */
|
||||
.activecate,.shopMo{width: 216rpx;height: 65rpx;border-radius: 20rpx;line-height: 65rpx;text-align: center;background-color: #f2f2f2;color: #333333;}
|
||||
.activecate{color: #FFFFFF;}
|
||||
.shopMo span::after,.activecate span::after{display: inline-block;content: '';width: 16rpx;height: 13rpx;margin-left: 6rpx;}
|
||||
.shopMo span::after{background: url(/static/public/shopSJ.png) no-repeat;background-size: 100% 90%;}
|
||||
.activecate span::after{background: url(/static/public/shopSJ-active.png) no-repeat;background-size: 100% 90%;transform: rotate(180deg);background-position: 0 2rpx;}
|
||||
.shop_list_box>view>view:last-child{margin-bottom: 200rpx;}
|
||||
|
||||
.activebcate,.shopBMo{border-radius: 20rpx;background-color: #f2f2f2;color: #333333;padding: 12rpx 24rpx;}
|
||||
.activebcate{color: #FFFFFF;}
|
||||
|
||||
|
||||
/* 商品详情 */
|
||||
.activelei,.molei{border-radius: 20rpx;padding: 10rpx 24rpx;color: #333333;margin-left: 20rpx;}
|
||||
.activelei{color: #FFFFFF;}
|
||||
|
||||
|
||||
/* 准备下单 */
|
||||
.activeT,.expressT{width: 124rpx;height: 60rpx;line-height: 60rpx;text-align: center;margin-left: 20rpx;border-radius: 20rpx;}
|
||||
.activeT{color: #FFFFFF;}
|
||||
.activeQuan::before{content: '';display: block;width: 50%;height: 8rpx;background: #3875F6;position: absolute;bottom: -20rpx;left: 50%;transform: translateX(-50%);}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.bottoc{margin-top: 6rpx;color: #414141;}
|
||||
.opc{opacity: 0.7;}
|
||||
.width100{width: 100%;}
|
||||
.width33{width: 33%;}
|
||||
|
||||
.posAll{position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(0,0,0,.45);z-index: 12;}
|
||||
.posir{position: relative;}
|
||||
.posia{position: absolute;}
|
||||
.posiszy{position: fixed;left: 0;right: 0;z-index: 5;}
|
||||
.posixzy{position: fixed;left: 0;right: 0;z-index: 2;bottom: 0;}
|
||||
.syxzo{top: 0;left: 0;right: 0;bottom: 0;opacity: 0;}
|
||||
|
||||
|
||||
.dis{display: flex;}
|
||||
.disac{display: flex;align-items: center;}
|
||||
.disja{display: flex;justify-content: space-around;}
|
||||
.disjb{display: flex;justify-content: space-between;}
|
||||
.disje{display: flex;justify-content: flex-end;}
|
||||
.disjbac{display: flex;justify-content: space-between;align-items: center;}
|
||||
.disjcac{display: flex;justify-content: center;align-items: center;}
|
||||
.fc{flex-direction: column;}
|
||||
.fw{flex-wrap: wrap;}
|
||||
.fe{justify-content: flex-end;}
|
||||
.flexs{flex-shrink: 0;}
|
||||
|
||||
|
||||
button:after{content: none!important;}
|
||||
.borbot{border-bottom: 2rpx solid #E6E6E6;}
|
||||
.borbot:last-child{border-bottom: none;}
|
||||
.bbot{border-bottom: 2rpx solid #E6E6E6;}
|
||||
.borbot-df{border: 2rpx solid #DFDFDF;}
|
||||
.borbot-cc{border: 2rpx solid #CCCCCC;}
|
||||
|
||||
|
||||
.clips1{display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;overflow: hidden;text-overflow: ellipsis;word-wrap: break-word;word-break:break-all;}
|
||||
.clips2{display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;text-overflow: ellipsis;word-wrap: break-word;word-break:break-all;}
|
||||
.clips3{display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 3;overflow: hidden;text-overflow: ellipsis;word-wrap: break-word;word-break:break-all;}
|
||||
|
||||
/* 上下左右---外边距 */
|
||||
.mar10{margin: 10rpx;}
|
||||
.mar20{margin: 20rpx;}
|
||||
.mar25{margin: 25rpx;}
|
||||
.mar30{margin: 30rpx;}
|
||||
.mar32{margin: 32rpx;}
|
||||
.mar36{margin: 36rpx;}
|
||||
.mar40{margin: 40rpx;}
|
||||
.mar50{margin: 50rpx;}
|
||||
/* 上下---外边距 */
|
||||
.mar-sx10{margin-top: 10rpx;margin-bottom: 10rpx;}
|
||||
.mar-sx20{margin-top: 20rpx;margin-bottom: 20rpx;}
|
||||
.mar-sx25{margin-top: 25rpx;margin-bottom: 25rpx;}
|
||||
.mar-sx30{margin-top: 30rpx;margin-bottom: 30rpx;}
|
||||
.mar-sx32{margin-top: 32rpx;margin-bottom: 32rpx;}
|
||||
.mar-sx36{margin-top: 36rpx;margin-bottom: 36rpx;}
|
||||
.mar-sx40{margin-top: 40rpx;margin-bottom: 40rpx;}
|
||||
.mar-sx50{margin-top: 50rpx;margin-bottom: 50rpx;}
|
||||
/* 左右---外边距 */
|
||||
.mar-zy10{margin-left: 10rpx;margin-right: 10rpx;}
|
||||
.mar-zy20{margin-left: 20rpx;margin-right: 20rpx;}
|
||||
.mar-zy25{margin-left: 25rpx;margin-right: 25rpx;}
|
||||
.mar-zy30{margin-left: 30rpx;margin-right: 30rpx;}
|
||||
.mar-zy32{margin-left: 32rpx;margin-right: 32rpx;}
|
||||
.mar-zy36{margin-left: 36rpx;margin-right: 36rpx;}
|
||||
.mar-zy40{margin-left: 40rpx;margin-right: 40rpx;}
|
||||
.mar-zy50{margin-left: 50rpx;margin-right: 50rpx;}
|
||||
/* 上---外边距 */
|
||||
.mar-s10{margin-top: 10rpx;}
|
||||
.mar-s20{margin-top: 20rpx;}
|
||||
.mar-s25{margin-top: 25rpx;}
|
||||
.mar-s30{margin-top: 30rpx;}
|
||||
.mar-s32{margin-top: 32rpx;}
|
||||
.mar-s36{margin-top: 36rpx;}
|
||||
.mar-s40{margin-top: 40rpx;}
|
||||
.mar-s50{margin-top: 50rpx;}
|
||||
/* 下---外边距 */
|
||||
.mar-x10{margin-bottom: 10rpx;}
|
||||
.mar-x20{margin-bottom: 20rpx;}
|
||||
.mar-x25{margin-bottom: 25rpx;}
|
||||
.mar-x30{margin-bottom: 30rpx;}
|
||||
.mar-x32{margin-bottom: 32rpx;}
|
||||
.mar-x36{margin-bottom: 36rpx;}
|
||||
.mar-x40{margin-bottom: 40rpx;}
|
||||
.mar-x50{margin-bottom: 50rpx;}
|
||||
/* 左---外边距 */
|
||||
.mar-z10{margin-left: 10rpx;}
|
||||
.mar-z20{margin-left: 20rpx;}
|
||||
.mar-z25{margin-left: 25rpx;}
|
||||
.mar-z30{margin-left: 30rpx;}
|
||||
.mar-z32{margin-left: 32rpx;}
|
||||
.mar-z36{margin-left: 36rpx;}
|
||||
.mar-z40{margin-left: 40rpx;}
|
||||
.mar-z50{margin-left: 50rpx;}
|
||||
/* 右---外边距 */
|
||||
.mar-y10{margin-right: 10rpx;}
|
||||
.mar-y20{margin-right: 20rpx;}
|
||||
.mar-y25{margin-right: 25rpx;}
|
||||
.mar-y30{margin-right: 30rpx;}
|
||||
.mar-y32{margin-right: 32rpx;}
|
||||
.mar-y36{margin-right: 36rpx;}
|
||||
.mar-y40{margin-right: 40rpx;}
|
||||
.mar-y50{margin-right: 50rpx;}
|
||||
|
||||
/* 上下左右---内边距 */
|
||||
.pad10{padding: 10rpx;}
|
||||
.pad20{padding: 20rpx;}
|
||||
.pad25{padding: 25rpx;}
|
||||
.pad30{padding: 30rpx;}
|
||||
.pad32{padding: 32rpx;}
|
||||
.pad36{padding: 36rpx;}
|
||||
.pad40{padding: 40rpx;}
|
||||
.pad50{padding: 50rpx;}
|
||||
/* 上下---内边距 */
|
||||
.pad-sx10{padding-top: 10rpx;padding-bottom: 10rpx;}
|
||||
.pad-sx20{padding-top: 20rpx;padding-bottom: 20rpx;}
|
||||
.pad-sx25{padding-top: 25rpx;padding-bottom: 25rpx;}
|
||||
.pad-sx30{padding-top: 30rpx;padding-bottom: 30rpx;}
|
||||
.pad-sx32{padding-top: 32rpx;padding-bottom: 32rpx;}
|
||||
.pad-sx36{padding-top: 36rpx;padding-bottom: 36rpx;}
|
||||
.pad-sx40{padding-top: 40rpx;padding-bottom: 40rpx;}
|
||||
.pad-sx50{padding-top: 50rpx;padding-bottom: 50rpx;}
|
||||
/* 左右---内边距 */
|
||||
.pad-zy10{padding-left: 10rpx;padding-right: 10rpx;}
|
||||
.pad-zy20{padding-left: 20rpx;padding-right: 20rpx;}
|
||||
.pad-zy25{padding-left: 25rpx;padding-right: 25rpx;}
|
||||
.pad-zy30{padding-left: 30rpx;padding-right: 30rpx;}
|
||||
.pad-zy32{padding-left: 32rpx;padding-right: 32rpx;}
|
||||
.pad-zy36{padding-left: 36rpx;padding-right: 36rpx;}
|
||||
.pad-zy40{padding-left: 40rpx;padding-right: 40rpx;}
|
||||
.pad-zy50{padding-left: 50rpx;padding-right: 50rpx;}
|
||||
/* 上---内边距 */
|
||||
.pad-s10{padding-top: 10rpx;}
|
||||
.pad-s20{padding-top: 20rpx;}
|
||||
.pad-s25{padding-top: 25rpx;}
|
||||
.pad-s30{padding-top: 30rpx;}
|
||||
.pad-s32{padding-top: 32rpx;}
|
||||
.pad-s36{padding-top: 36rpx;}
|
||||
.pad-s40{padding-top: 40rpx;}
|
||||
.pad-s50{padding-top: 50rpx;}
|
||||
/* 下---内边距 */
|
||||
.pad-x10{padding-bottom: 10rpx;}
|
||||
.pad-x20{padding-bottom: 20rpx;}
|
||||
.pad-x25{padding-bottom: 25rpx;}
|
||||
.pad-x30{padding-bottom: 30rpx;}
|
||||
.pad-x32{padding-bottom: 32rpx;}
|
||||
.pad-x36{padding-bottom: 36rpx;}
|
||||
.pad-x40{padding-bottom: 40rpx;}
|
||||
.pad-x50{padding-bottom: 50rpx;}
|
||||
.pad-x180{padding-bottom: 180rpx;}
|
||||
.pad-x260{padding-bottom: 260rpx;}
|
||||
/* 左---内边距 */
|
||||
.pad-z10{padding-left: 10rpx;}
|
||||
.pad-z20{padding-left: 20rpx;}
|
||||
.pad-z25{padding-left: 25rpx;}
|
||||
.pad-z30{padding-left: 30rpx;}
|
||||
.pad-z32{padding-left: 32rpx;}
|
||||
.pad-z36{padding-left: 36rpx;}
|
||||
.pad-z40{padding-left: 40rpx;}
|
||||
.pad-z50{padding-left: 50rpx;}
|
||||
/* 右---内边距 */
|
||||
.pad-y10{padding-right: 10rpx;}
|
||||
.pad-y20{padding-right: 20rpx;}
|
||||
.pad-y25{padding-right: 25rpx;}
|
||||
.pad-y30{padding-right: 30rpx;}
|
||||
.pad-y32{padding-right: 32rpx;}
|
||||
.pad-y36{padding-right: 36rpx;}
|
||||
.pad-y40{padding-right: 40rpx;}
|
||||
.pad-y50{padding-right: 50rpx;}
|
||||
|
||||
|
||||
|
||||
/* 字体大小 */
|
||||
.fon20{font-size: 20rpx;}
|
||||
.fon24{font-size: 24rpx;}
|
||||
.fon25{font-size: 25rpx;}
|
||||
.fon26{font-size: 26rpx;}
|
||||
.fon27{font-size: 27rpx;}
|
||||
.fon28{font-size: 28rpx;}
|
||||
.fon30{font-size: 30rpx;}
|
||||
.fon32{font-size: 32rpx;}
|
||||
.fon34{font-size: 34rpx;}
|
||||
.fon36{font-size: 36rpx;}
|
||||
.fon38{font-size: 38rpx;}
|
||||
.fon40{font-size: 40rpx;}
|
||||
|
||||
/* 字体颜色 */
|
||||
.colf{color: #FFFFFF;}
|
||||
.colb{color: #000000;}
|
||||
.colc{color: #CCCCCC;}
|
||||
.col3{color: #333333;}
|
||||
.col6{color: #666666;}
|
||||
.col9{color: #999999;}
|
||||
.pcol{color: #3875F6;}
|
||||
.col2c{color: #2C2C2C;}
|
||||
.col80{color: #808080;}
|
||||
/* 字体位置 */
|
||||
.tc{text-align: center;}
|
||||
.tright{text-align: right;}
|
||||
|
||||
/* 粗体 */
|
||||
.bold{font-weight: bold;}
|
||||
|
||||
|
||||
/* 背景颜色 */
|
||||
.pbackc{background-color: #3875F6;}
|
||||
.bacf{background-color: #FFFFFF;}
|
||||
.bcdb{background-color: #DBDBDB;}
|
||||
|
||||
/* 圆角 */
|
||||
.radius10{border-radius: 10rpx;}
|
||||
.radius15{border-radius: 15rpx;}
|
||||
.radius20{border-radius: 20rpx;}
|
||||
.radius30{border-radius: 30rpx;}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,411 @@
|
|||
<template>
|
||||
<view :class="modal?'show-qrcode':'hide-qrcode'">
|
||||
<view class="box-qrcode" :style="{'margin-left': marginLeft + 'px'}" @longtap="longtapCode">
|
||||
<!-- style="width: 550rpx;height: 550rpx;" -->
|
||||
|
||||
<canvas class="canvas-qrcode" :style="style_w_h" :canvas-id="qrcode_id">
|
||||
|
||||
<!-- #ifndef MP -->
|
||||
<view v-if="modal&&is_themeImg" :style="style_w_h" class="box-img-qrcode">
|
||||
<image :style="style_w_h_img" mode="scaleToFill" :src="themeImg"></image>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
|
||||
</canvas>
|
||||
|
||||
<!-- <image mode="scaleToFill" :src="imagePath"></image> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var qr_we = require("./qrcode_wx.js");
|
||||
const qrCode = require('./weapp-qrcode.js')
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isAndroid : false ,
|
||||
show: true,
|
||||
imagePath: '',
|
||||
// qrcode_id: 'qrcode_id',
|
||||
marginLeft: 0,
|
||||
//一般的安卓app只需加30就能显示全
|
||||
//苹果app的不加就能显示全,加了就要弄margin-left
|
||||
//有些安卓app显示不全
|
||||
add_num : 30 ,
|
||||
add_num_key : 'rectify_code_key',
|
||||
}
|
||||
},
|
||||
props: {
|
||||
modal: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 260
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
default: 260
|
||||
},
|
||||
themeColor: {
|
||||
type: String,
|
||||
default: '#333333',
|
||||
},
|
||||
qrcode_id: {
|
||||
type: String,
|
||||
default: 'qrcode_id',
|
||||
},
|
||||
is_themeImg: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
themeImg: {
|
||||
type: String,
|
||||
default: 'https://cdn.pixabay.com/photo/2016/11/29/13/24/balloons-1869816__340.jpg',
|
||||
},
|
||||
h_w_img: {
|
||||
type: Number,
|
||||
default: 30
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
watch:{
|
||||
|
||||
},
|
||||
computed: {
|
||||
style_w_h() {
|
||||
return this.set_style_w_h();
|
||||
},
|
||||
style_w_h_img() {
|
||||
let that = this;
|
||||
var height = parseInt(that.h_w_img);
|
||||
var width = parseInt(that.h_w_img);
|
||||
var style = '';
|
||||
if (height > 0) {
|
||||
style = `height:${height*2}rpx;`;
|
||||
}
|
||||
if (width > 0) {
|
||||
style += `width:${width*2}rpx;z-index: 2;`;
|
||||
}
|
||||
|
||||
return style;
|
||||
},
|
||||
},
|
||||
created: function() {
|
||||
let that = this;
|
||||
try {
|
||||
//app苹果二维码不居中
|
||||
//#ifndef MP
|
||||
let isAndroid = false ;
|
||||
const res = uni.getSystemInfoSync();
|
||||
if(res.platform == 'android'){
|
||||
isAndroid = true ;
|
||||
}else{
|
||||
isAndroid = false ;
|
||||
}
|
||||
|
||||
|
||||
if (!isAndroid) {
|
||||
that.marginLeft = 46;
|
||||
}
|
||||
|
||||
that.isAndroid = isAndroid ;
|
||||
try {
|
||||
const add_num = uni.getStorageSync(that.add_num_key);
|
||||
if (add_num) {
|
||||
that.add_num = add_num;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
// error
|
||||
|
||||
}
|
||||
// #endif
|
||||
|
||||
} catch (e) {
|
||||
// error
|
||||
}
|
||||
|
||||
//#ifdef MP
|
||||
//that.marginLeft = 40;
|
||||
// #endif
|
||||
|
||||
},
|
||||
methods: {
|
||||
set_style_w_h(){
|
||||
|
||||
let that = this;
|
||||
var height = parseInt(that.height);
|
||||
var width = parseInt(that.width);
|
||||
var style = '';
|
||||
var height = height*2 ;
|
||||
var width = width*2 ;
|
||||
|
||||
//#ifndef MP
|
||||
var add = that.add_num ;
|
||||
|
||||
height += add;
|
||||
width += add;
|
||||
// #endif
|
||||
|
||||
if (height > 0) {
|
||||
style = `height:${height}rpx;`;
|
||||
}
|
||||
if (width > 0) {
|
||||
style += `width:${width}rpx;`;
|
||||
}
|
||||
|
||||
return style;
|
||||
},
|
||||
hideQrcode() {
|
||||
this.$emit("hideQrcode")
|
||||
},
|
||||
// 二维码生成工具
|
||||
crtQrCode() {
|
||||
let that = this;
|
||||
//#ifndef MP
|
||||
new qrCode(that.qrcode_id, {
|
||||
text: this.url,
|
||||
width: that.width,
|
||||
height: that.height,
|
||||
colorDark: that.themeColor,//#333333
|
||||
colorLight: "#FFFFFF",
|
||||
correctLevel: qrCode.CorrectLevel.H,
|
||||
})
|
||||
// #endif
|
||||
//#ifdef MP
|
||||
that.createQrCode(this.url, that.qrcode_id, that.width, that.height,that.themeColor,that.is_themeImg,that.themeImg,that.h_w_img);
|
||||
// #endif
|
||||
|
||||
//that.createQrCode(this.url, that.qrcode_id, that.width, that.height);
|
||||
},
|
||||
//#ifdef MP
|
||||
|
||||
createQrCode: function(url, canvasId, cavW, cavH,cavColor,haveImg,imgurl,imgsize) {
|
||||
//调用插件中的draw方法,绘制二维码图片
|
||||
qr_we.api.draw(url, canvasId, cavW, cavH,cavColor,haveImg,imgurl,imgsize, this, this.canvasToTempImage);
|
||||
// setTimeout(() => { this.canvasToTempImage();},100);
|
||||
|
||||
},
|
||||
|
||||
// #endif
|
||||
//获取临时缓存照片路径,存入data中
|
||||
canvasToTempImage: function() {
|
||||
var that = this;
|
||||
},
|
||||
saveImage: function() {
|
||||
var that = this;
|
||||
uni.canvasToTempFilePath({
|
||||
canvasId: that.qrcode_id,
|
||||
success: function(res) {
|
||||
var tempFilePath = res.tempFilePath;
|
||||
// console.log(tempFilePath);
|
||||
that.imagePath = tempFilePath;
|
||||
|
||||
//保存到相册
|
||||
// uni.saveFile({
|
||||
// tempFilePath: tempFilePath,
|
||||
// success: function (res2) {
|
||||
// var savedFilePath = res2.savedFilePath;
|
||||
|
||||
|
||||
// }
|
||||
// });
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath : tempFilePath ,
|
||||
success: function (res3) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '保存成功',
|
||||
confirmText: '确定',
|
||||
showCancel: false,
|
||||
confirmColor: '#33CCCC',
|
||||
success(res4) {
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: function(res) {
|
||||
// console.log(res);
|
||||
}
|
||||
}, that);
|
||||
},
|
||||
//微信小程序支持:长按二维码,提示是否保存相册
|
||||
//安卓APP长按校正二维码
|
||||
longtapCode(){
|
||||
var that = this;
|
||||
|
||||
//#ifndef MP
|
||||
uni.showModal({
|
||||
title: '校正二维码',
|
||||
content: '二维码是否异常',
|
||||
confirmText: '确定',
|
||||
confirmColor: '#33CCCC',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
that.rectify_code();
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
||||
//#ifdef MP-WEIXIN
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否保存到相册',
|
||||
confirmText: '确定',
|
||||
confirmColor: '#33CCCC',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
that.saveImage();
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
//安卓有些手机不正常,长按可选择矫正
|
||||
rectify_code(){
|
||||
var that = this;
|
||||
let add_num = that.add_num ;
|
||||
add_num += 30 ;
|
||||
that.add_num = add_num;
|
||||
that.crtQrCode();//重新生成才会立即覆盖
|
||||
try {
|
||||
//第一次长按校正设置了就不用在设置
|
||||
uni.setStorage({
|
||||
key: that.add_num_key,
|
||||
data: add_num,
|
||||
success: function() {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
// error
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// .qrcode-box {
|
||||
// position: fixed;
|
||||
// left: 0;
|
||||
// top: 0;
|
||||
// right: 0;
|
||||
// bottom: 0;
|
||||
// height: 100vh;
|
||||
// width: 100vw;
|
||||
// background-color: rgba(59, 59, 59, 0.6);
|
||||
// // opacity: 0.8;
|
||||
// text-align: center;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// display: none;
|
||||
|
||||
// .qrcode-item {
|
||||
// flex: 1;
|
||||
// position: relative;
|
||||
// text-align: center;
|
||||
|
||||
// .item-box {
|
||||
// width: 90%;
|
||||
// margin: auto;
|
||||
// display: inline-block;
|
||||
// margin-top: 30%;
|
||||
// padding-bottom: 30rpx;
|
||||
|
||||
// // animation: show 0.7s;
|
||||
// .title {
|
||||
// font-size: 46rpx;
|
||||
// text-align: center;
|
||||
// margin-bottom: 24rpx;
|
||||
// }
|
||||
|
||||
// .canvas {
|
||||
// margin: auto;
|
||||
// display: inline-block;
|
||||
// margin: auto;
|
||||
// }
|
||||
|
||||
// background-color: #FFFFFF;
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
.box-qrcode{
|
||||
text-align: center;
|
||||
position: relative;
|
||||
.box-img-qrcode{
|
||||
position: absolute;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
image{
|
||||
width: 60upx;
|
||||
height: 60upx;
|
||||
border-radius: 50%;
|
||||
|
||||
}
|
||||
.canvas-qrcode {
|
||||
|
||||
margin: auto;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
.opacity-qrcode {
|
||||
opacity: 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.show-qrcode {
|
||||
display: block;
|
||||
animation: fade 0.7s;
|
||||
|
||||
// -moz-animation: fade 0.5s; /* Firefox */
|
||||
// -webkit-animation: fade 0.5s; /* Safari 和 Chrome */
|
||||
// -o-animation: fade 0.5s;
|
||||
}
|
||||
|
||||
.hide-qrcode {
|
||||
animation: hide 0.7s;
|
||||
}
|
||||
|
||||
@keyframes fade {
|
||||
from {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes hide {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,872 @@
|
|||
!(function() {
|
||||
|
||||
// alignment pattern
|
||||
var adelta = [
|
||||
0, 11, 15, 19, 23, 27, 31,
|
||||
16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24,
|
||||
26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28
|
||||
];
|
||||
|
||||
// version block
|
||||
var vpat = [
|
||||
0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d,
|
||||
0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9,
|
||||
0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75,
|
||||
0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64,
|
||||
0x541, 0xc69
|
||||
];
|
||||
|
||||
// final format bits with mask: level << 3 | mask
|
||||
var fmtword = [
|
||||
0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, //L
|
||||
0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, //M
|
||||
0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, //Q
|
||||
0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b //H
|
||||
];
|
||||
|
||||
// 4 per version: number of blocks 1,2; data width; ecc width
|
||||
var eccblocks = [
|
||||
1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17,
|
||||
1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28,
|
||||
1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22,
|
||||
1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16,
|
||||
1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22,
|
||||
2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28,
|
||||
2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26,
|
||||
2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26,
|
||||
2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24,
|
||||
2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28,
|
||||
4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24,
|
||||
2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28,
|
||||
4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22,
|
||||
3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24,
|
||||
5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24,
|
||||
5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30,
|
||||
1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28,
|
||||
5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28,
|
||||
3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26,
|
||||
3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28,
|
||||
4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30,
|
||||
2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24,
|
||||
4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30,
|
||||
6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30,
|
||||
8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30,
|
||||
10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30,
|
||||
8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30,
|
||||
3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30,
|
||||
7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30,
|
||||
5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30,
|
||||
13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30,
|
||||
17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30,
|
||||
17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30,
|
||||
13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30,
|
||||
12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30,
|
||||
6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30,
|
||||
17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30,
|
||||
4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30,
|
||||
20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30,
|
||||
19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30
|
||||
];
|
||||
|
||||
// Galois field log table
|
||||
var glog = [
|
||||
0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b,
|
||||
0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71,
|
||||
0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45,
|
||||
0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6,
|
||||
0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88,
|
||||
0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40,
|
||||
0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d,
|
||||
0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57,
|
||||
0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18,
|
||||
0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e,
|
||||
0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61,
|
||||
0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2,
|
||||
0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6,
|
||||
0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a,
|
||||
0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7,
|
||||
0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf
|
||||
];
|
||||
|
||||
// Galios field exponent table
|
||||
var gexp = [
|
||||
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26,
|
||||
0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0,
|
||||
0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23,
|
||||
0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1,
|
||||
0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0,
|
||||
0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2,
|
||||
0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce,
|
||||
0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc,
|
||||
0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54,
|
||||
0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73,
|
||||
0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff,
|
||||
0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41,
|
||||
0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6,
|
||||
0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09,
|
||||
0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16,
|
||||
0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00
|
||||
];
|
||||
|
||||
// Working buffers:
|
||||
// data input and ecc append, image working buffer, fixed part of image, run lengths for badness
|
||||
var strinbuf = [],
|
||||
eccbuf = [],
|
||||
qrframe = [],
|
||||
framask = [],
|
||||
rlens = [];
|
||||
// Control values - width is based on version, last 4 are from table.
|
||||
var version, width, neccblk1, neccblk2, datablkw, eccblkwid;
|
||||
var ecclevel = 2;
|
||||
// set bit to indicate cell in qrframe is immutable. symmetric around diagonal
|
||||
function setmask(x, y) {
|
||||
var bt;
|
||||
if (x > y) {
|
||||
bt = x;
|
||||
x = y;
|
||||
y = bt;
|
||||
}
|
||||
// y*y = 1+3+5...
|
||||
bt = y;
|
||||
bt *= y;
|
||||
bt += y;
|
||||
bt >>= 1;
|
||||
bt += x;
|
||||
framask[bt] = 1;
|
||||
}
|
||||
|
||||
// enter alignment pattern - black to qrframe, white to mask (later black frame merged to mask)
|
||||
function putalign(x, y) {
|
||||
var j;
|
||||
|
||||
qrframe[x + width * y] = 1;
|
||||
for (j = -2; j < 2; j++) {
|
||||
qrframe[(x + j) + width * (y - 2)] = 1;
|
||||
qrframe[(x - 2) + width * (y + j + 1)] = 1;
|
||||
qrframe[(x + 2) + width * (y + j)] = 1;
|
||||
qrframe[(x + j + 1) + width * (y + 2)] = 1;
|
||||
}
|
||||
for (j = 0; j < 2; j++) {
|
||||
setmask(x - 1, y + j);
|
||||
setmask(x + 1, y - j);
|
||||
setmask(x - j, y - 1);
|
||||
setmask(x + j, y + 1);
|
||||
}
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Reed Solomon error correction
|
||||
// exponentiation mod N
|
||||
function modnn(x) {
|
||||
while (x >= 255) {
|
||||
x -= 255;
|
||||
x = (x >> 8) + (x & 255);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
var genpoly = [];
|
||||
|
||||
// Calculate and append ECC data to data block. Block is in strinbuf, indexes to buffers given.
|
||||
function appendrs(data, dlen, ecbuf, eclen) {
|
||||
var i, j, fb;
|
||||
|
||||
for (i = 0; i < eclen; i++)
|
||||
strinbuf[ecbuf + i] = 0;
|
||||
for (i = 0; i < dlen; i++) {
|
||||
fb = glog[strinbuf[data + i] ^ strinbuf[ecbuf]];
|
||||
if (fb != 255) /* fb term is non-zero */
|
||||
for (j = 1; j < eclen; j++)
|
||||
strinbuf[ecbuf + j - 1] = strinbuf[ecbuf + j] ^ gexp[modnn(fb + genpoly[eclen - j])];
|
||||
else
|
||||
for (j = ecbuf; j < ecbuf + eclen; j++)
|
||||
strinbuf[j] = strinbuf[j + 1];
|
||||
strinbuf[ecbuf + eclen - 1] = fb == 255 ? 0 : gexp[modnn(fb + genpoly[0])];
|
||||
}
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Frame data insert following the path rules
|
||||
|
||||
// check mask - since symmetrical use half.
|
||||
function ismasked(x, y) {
|
||||
var bt;
|
||||
if (x > y) {
|
||||
bt = x;
|
||||
x = y;
|
||||
y = bt;
|
||||
}
|
||||
bt = y;
|
||||
bt += y * y;
|
||||
bt >>= 1;
|
||||
bt += x;
|
||||
return framask[bt];
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Apply the selected mask out of the 8.
|
||||
function applymask(m) {
|
||||
var x, y, r3x, r3y;
|
||||
|
||||
switch (m) {
|
||||
case 0:
|
||||
for (y = 0; y < width; y++)
|
||||
for (x = 0; x < width; x++)
|
||||
if (!((x + y) & 1) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
break;
|
||||
case 1:
|
||||
for (y = 0; y < width; y++)
|
||||
for (x = 0; x < width; x++)
|
||||
if (!(y & 1) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
break;
|
||||
case 2:
|
||||
for (y = 0; y < width; y++)
|
||||
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!r3x && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
||||
if (r3y == 3)
|
||||
r3y = 0;
|
||||
for (r3x = r3y, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!r3x && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (y = 0; y < width; y++)
|
||||
for (r3x = 0, r3y = ((y >> 1) & 1), x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3) {
|
||||
r3x = 0;
|
||||
r3y = !r3y;
|
||||
}
|
||||
if (!r3y && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
||||
if (r3y == 3)
|
||||
r3y = 0;
|
||||
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!((x & y & 1) + !(!r3x | !r3y)) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
||||
if (r3y == 3)
|
||||
r3y = 0;
|
||||
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!(((x & y & 1) + (r3x && (r3x == r3y))) & 1) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
for (r3y = 0, y = 0; y < width; y++, r3y++) {
|
||||
if (r3y == 3)
|
||||
r3y = 0;
|
||||
for (r3x = 0, x = 0; x < width; x++, r3x++) {
|
||||
if (r3x == 3)
|
||||
r3x = 0;
|
||||
if (!(((r3x && (r3x == r3y)) + ((x + y) & 1)) & 1) && !ismasked(x, y))
|
||||
qrframe[x + y * width] ^= 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Badness coefficients.
|
||||
var N1 = 3,
|
||||
N2 = 3,
|
||||
N3 = 40,
|
||||
N4 = 10;
|
||||
|
||||
// Using the table of the length of each run, calculate the amount of bad image
|
||||
// - long runs or those that look like finders; called twice, once each for X and Y
|
||||
function badruns(length) {
|
||||
var i;
|
||||
var runsbad = 0;
|
||||
for (i = 0; i <= length; i++)
|
||||
if (rlens[i] >= 5)
|
||||
runsbad += N1 + rlens[i] - 5;
|
||||
// BwBBBwB as in finder
|
||||
for (i = 3; i < length - 1; i += 2)
|
||||
if (rlens[i - 2] == rlens[i + 2] &&
|
||||
rlens[i + 2] == rlens[i - 1] &&
|
||||
rlens[i - 1] == rlens[i + 1] &&
|
||||
rlens[i - 1] * 3 == rlens[i]
|
||||
// white around the black pattern? Not part of spec
|
||||
&&
|
||||
(rlens[i - 3] == 0 // beginning
|
||||
||
|
||||
i + 3 > length // end
|
||||
||
|
||||
rlens[i - 3] * 3 >= rlens[i] * 4 || rlens[i + 3] * 3 >= rlens[i] * 4)
|
||||
)
|
||||
runsbad += N3;
|
||||
return runsbad;
|
||||
}
|
||||
|
||||
// Calculate how bad the masked image is - blocks, imbalance, runs, or finders.
|
||||
function badcheck() {
|
||||
var x, y, h, b, b1;
|
||||
var thisbad = 0;
|
||||
var bw = 0;
|
||||
|
||||
// blocks of same color.
|
||||
for (y = 0; y < width - 1; y++)
|
||||
for (x = 0; x < width - 1; x++)
|
||||
if ((qrframe[x + width * y] && qrframe[(x + 1) + width * y] &&
|
||||
qrframe[x + width * (y + 1)] && qrframe[(x + 1) + width * (y + 1)]) // all black
|
||||
||
|
||||
!(qrframe[x + width * y] || qrframe[(x + 1) + width * y] ||
|
||||
qrframe[x + width * (y + 1)] || qrframe[(x + 1) + width * (y + 1)])) // all white
|
||||
thisbad += N2;
|
||||
|
||||
// X runs
|
||||
for (y = 0; y < width; y++) {
|
||||
rlens[0] = 0;
|
||||
for (h = b = x = 0; x < width; x++) {
|
||||
if ((b1 = qrframe[x + width * y]) == b)
|
||||
rlens[h]++;
|
||||
else
|
||||
rlens[++h] = 1;
|
||||
b = b1;
|
||||
bw += b ? 1 : -1;
|
||||
}
|
||||
thisbad += badruns(h);
|
||||
}
|
||||
|
||||
// black/white imbalance
|
||||
if (bw < 0)
|
||||
bw = -bw;
|
||||
|
||||
var big = bw;
|
||||
var count = 0;
|
||||
big += big << 2;
|
||||
big <<= 1;
|
||||
while (big > width * width)
|
||||
big -= width * width, count++;
|
||||
thisbad += count * N4;
|
||||
|
||||
// Y runs
|
||||
for (x = 0; x < width; x++) {
|
||||
rlens[0] = 0;
|
||||
for (h = b = y = 0; y < width; y++) {
|
||||
if ((b1 = qrframe[x + width * y]) == b)
|
||||
rlens[h]++;
|
||||
else
|
||||
rlens[++h] = 1;
|
||||
b = b1;
|
||||
}
|
||||
thisbad += badruns(h);
|
||||
}
|
||||
return thisbad;
|
||||
}
|
||||
|
||||
function genframe(instring) {
|
||||
var x, y, k, t, v, i, j, m;
|
||||
|
||||
// find the smallest version that fits the string
|
||||
t = instring.length;
|
||||
version = 0;
|
||||
do {
|
||||
version++;
|
||||
k = (ecclevel - 1) * 4 + (version - 1) * 16;
|
||||
neccblk1 = eccblocks[k++];
|
||||
neccblk2 = eccblocks[k++];
|
||||
datablkw = eccblocks[k++];
|
||||
eccblkwid = eccblocks[k];
|
||||
k = datablkw * (neccblk1 + neccblk2) + neccblk2 - 3 + (version <= 9);
|
||||
if (t <= k)
|
||||
break;
|
||||
} while (version < 40);
|
||||
|
||||
// FIXME - insure that it fits insted of being truncated
|
||||
width = 17 + 4 * version;
|
||||
|
||||
// allocate, clear and setup data structures
|
||||
v = datablkw + (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
|
||||
for (t = 0; t < v; t++)
|
||||
eccbuf[t] = 0;
|
||||
strinbuf = instring.slice(0);
|
||||
|
||||
for (t = 0; t < width * width; t++)
|
||||
qrframe[t] = 0;
|
||||
|
||||
for (t = 0; t < (width * (width + 1) + 1) / 2; t++)
|
||||
framask[t] = 0;
|
||||
|
||||
// insert finders - black to frame, white to mask
|
||||
for (t = 0; t < 3; t++) {
|
||||
k = 0;
|
||||
y = 0;
|
||||
if (t == 1)
|
||||
k = (width - 7);
|
||||
if (t == 2)
|
||||
y = (width - 7);
|
||||
qrframe[(y + 3) + width * (k + 3)] = 1;
|
||||
for (x = 0; x < 6; x++) {
|
||||
qrframe[(y + x) + width * k] = 1;
|
||||
qrframe[y + width * (k + x + 1)] = 1;
|
||||
qrframe[(y + 6) + width * (k + x)] = 1;
|
||||
qrframe[(y + x + 1) + width * (k + 6)] = 1;
|
||||
}
|
||||
for (x = 1; x < 5; x++) {
|
||||
setmask(y + x, k + 1);
|
||||
setmask(y + 1, k + x + 1);
|
||||
setmask(y + 5, k + x);
|
||||
setmask(y + x + 1, k + 5);
|
||||
}
|
||||
for (x = 2; x < 4; x++) {
|
||||
qrframe[(y + x) + width * (k + 2)] = 1;
|
||||
qrframe[(y + 2) + width * (k + x + 1)] = 1;
|
||||
qrframe[(y + 4) + width * (k + x)] = 1;
|
||||
qrframe[(y + x + 1) + width * (k + 4)] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// alignment blocks
|
||||
if (version > 1) {
|
||||
t = adelta[version];
|
||||
y = width - 7;
|
||||
for (;;) {
|
||||
x = width - 7;
|
||||
while (x > t - 3) {
|
||||
putalign(x, y);
|
||||
if (x < t)
|
||||
break;
|
||||
x -= t;
|
||||
}
|
||||
if (y <= t + 9)
|
||||
break;
|
||||
y -= t;
|
||||
putalign(6, y);
|
||||
putalign(y, 6);
|
||||
}
|
||||
}
|
||||
|
||||
// single black
|
||||
qrframe[8 + width * (width - 8)] = 1;
|
||||
|
||||
// timing gap - mask only
|
||||
for (y = 0; y < 7; y++) {
|
||||
setmask(7, y);
|
||||
setmask(width - 8, y);
|
||||
setmask(7, y + width - 7);
|
||||
}
|
||||
for (x = 0; x < 8; x++) {
|
||||
setmask(x, 7);
|
||||
setmask(x + width - 8, 7);
|
||||
setmask(x, width - 8);
|
||||
}
|
||||
|
||||
// reserve mask-format area
|
||||
for (x = 0; x < 9; x++)
|
||||
setmask(x, 8);
|
||||
for (x = 0; x < 8; x++) {
|
||||
setmask(x + width - 8, 8);
|
||||
setmask(8, x);
|
||||
}
|
||||
for (y = 0; y < 7; y++)
|
||||
setmask(8, y + width - 7);
|
||||
|
||||
// timing row/col
|
||||
for (x = 0; x < width - 14; x++)
|
||||
if (x & 1) {
|
||||
setmask(8 + x, 6);
|
||||
setmask(6, 8 + x);
|
||||
}
|
||||
else {
|
||||
qrframe[(8 + x) + width * 6] = 1;
|
||||
qrframe[6 + width * (8 + x)] = 1;
|
||||
}
|
||||
|
||||
// version block
|
||||
if (version > 6) {
|
||||
t = vpat[version - 7];
|
||||
k = 17;
|
||||
for (x = 0; x < 6; x++)
|
||||
for (y = 0; y < 3; y++, k--)
|
||||
if (1 & (k > 11 ? version >> (k - 12) : t >> k)) {
|
||||
qrframe[(5 - x) + width * (2 - y + width - 11)] = 1;
|
||||
qrframe[(2 - y + width - 11) + width * (5 - x)] = 1;
|
||||
}
|
||||
else {
|
||||
setmask(5 - x, 2 - y + width - 11);
|
||||
setmask(2 - y + width - 11, 5 - x);
|
||||
}
|
||||
}
|
||||
|
||||
// sync mask bits - only set above for white spaces, so add in black bits
|
||||
for (y = 0; y < width; y++)
|
||||
for (x = 0; x <= y; x++)
|
||||
if (qrframe[x + width * y])
|
||||
setmask(x, y);
|
||||
|
||||
// convert string to bitstream
|
||||
// 8 bit data to QR-coded 8 bit data (numeric or alphanum, or kanji not supported)
|
||||
v = strinbuf.length;
|
||||
|
||||
// string to array
|
||||
for (i = 0; i < v; i++)
|
||||
eccbuf[i] = strinbuf.charCodeAt(i);
|
||||
strinbuf = eccbuf.slice(0);
|
||||
|
||||
// calculate max string length
|
||||
x = datablkw * (neccblk1 + neccblk2) + neccblk2;
|
||||
if (v >= x - 2) {
|
||||
v = x - 2;
|
||||
if (version > 9)
|
||||
v--;
|
||||
}
|
||||
|
||||
// shift and repack to insert length prefix
|
||||
i = v;
|
||||
if (version > 9) {
|
||||
strinbuf[i + 2] = 0;
|
||||
strinbuf[i + 3] = 0;
|
||||
while (i--) {
|
||||
t = strinbuf[i];
|
||||
strinbuf[i + 3] |= 255 & (t << 4);
|
||||
strinbuf[i + 2] = t >> 4;
|
||||
}
|
||||
strinbuf[2] |= 255 & (v << 4);
|
||||
strinbuf[1] = v >> 4;
|
||||
strinbuf[0] = 0x40 | (v >> 12);
|
||||
} else {
|
||||
strinbuf[i + 1] = 0;
|
||||
strinbuf[i + 2] = 0;
|
||||
while (i--) {
|
||||
t = strinbuf[i];
|
||||
strinbuf[i + 2] |= 255 & (t << 4);
|
||||
strinbuf[i + 1] = t >> 4;
|
||||
}
|
||||
strinbuf[1] |= 255 & (v << 4);
|
||||
strinbuf[0] = 0x40 | (v >> 4);
|
||||
}
|
||||
// fill to end with pad pattern
|
||||
i = v + 3 - (version < 10);
|
||||
while (i < x) {
|
||||
strinbuf[i++] = 0xec;
|
||||
// buffer has room if (i == x) break;
|
||||
strinbuf[i++] = 0x11;
|
||||
}
|
||||
|
||||
// calculate and append ECC
|
||||
|
||||
// calculate generator polynomial
|
||||
genpoly[0] = 1;
|
||||
for (i = 0; i < eccblkwid; i++) {
|
||||
genpoly[i + 1] = 1;
|
||||
for (j = i; j > 0; j--)
|
||||
genpoly[j] = genpoly[j] ?
|
||||
genpoly[j - 1] ^ gexp[modnn(glog[genpoly[j]] + i)] : genpoly[j - 1];
|
||||
genpoly[0] = gexp[modnn(glog[genpoly[0]] + i)];
|
||||
}
|
||||
for (i = 0; i <= eccblkwid; i++)
|
||||
genpoly[i] = glog[genpoly[i]]; // use logs for genpoly[] to save calc step
|
||||
|
||||
// append ecc to data buffer
|
||||
k = x;
|
||||
y = 0;
|
||||
for (i = 0; i < neccblk1; i++) {
|
||||
appendrs(y, datablkw, k, eccblkwid);
|
||||
y += datablkw;
|
||||
k += eccblkwid;
|
||||
}
|
||||
for (i = 0; i < neccblk2; i++) {
|
||||
appendrs(y, datablkw + 1, k, eccblkwid);
|
||||
y += datablkw + 1;
|
||||
k += eccblkwid;
|
||||
}
|
||||
// interleave blocks
|
||||
y = 0;
|
||||
for (i = 0; i < datablkw; i++) {
|
||||
for (j = 0; j < neccblk1; j++)
|
||||
eccbuf[y++] = strinbuf[i + j * datablkw];
|
||||
for (j = 0; j < neccblk2; j++)
|
||||
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
|
||||
}
|
||||
for (j = 0; j < neccblk2; j++)
|
||||
eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
|
||||
for (i = 0; i < eccblkwid; i++)
|
||||
for (j = 0; j < neccblk1 + neccblk2; j++)
|
||||
eccbuf[y++] = strinbuf[x + i + j * eccblkwid];
|
||||
strinbuf = eccbuf;
|
||||
|
||||
// pack bits into frame avoiding masked area.
|
||||
x = y = width - 1;
|
||||
k = v = 1; // up, minus
|
||||
/* inteleaved data and ecc codes */
|
||||
m = (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
|
||||
for (i = 0; i < m; i++) {
|
||||
t = strinbuf[i];
|
||||
for (j = 0; j < 8; j++, t <<= 1) {
|
||||
if (0x80 & t)
|
||||
qrframe[x + width * y] = 1;
|
||||
do { // find next fill position
|
||||
if (v)
|
||||
x--;
|
||||
else {
|
||||
x++;
|
||||
if (k) {
|
||||
if (y != 0)
|
||||
y--;
|
||||
else {
|
||||
x -= 2;
|
||||
k = !k;
|
||||
if (x == 6) {
|
||||
x--;
|
||||
y = 9;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (y != width - 1)
|
||||
y++;
|
||||
else {
|
||||
x -= 2;
|
||||
k = !k;
|
||||
if (x == 6) {
|
||||
x--;
|
||||
y -= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
v = !v;
|
||||
} while (ismasked(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
// save pre-mask copy of frame
|
||||
strinbuf = qrframe.slice(0);
|
||||
t = 0; // best
|
||||
y = 30000; // demerit
|
||||
// for instead of while since in original arduino code
|
||||
// if an early mask was "good enough" it wouldn't try for a better one
|
||||
// since they get more complex and take longer.
|
||||
for (k = 0; k < 8; k++) {
|
||||
applymask(k); // returns black-white imbalance
|
||||
x = badcheck();
|
||||
if (x < y) { // current mask better than previous best?
|
||||
y = x;
|
||||
t = k;
|
||||
}
|
||||
if (t == 7)
|
||||
break; // don't increment i to a void redoing mask
|
||||
qrframe = strinbuf.slice(0); // reset for next pass
|
||||
}
|
||||
if (t != k) // redo best mask - none good enough, last wasn't t
|
||||
applymask(t);
|
||||
|
||||
// add in final mask/ecclevel bytes
|
||||
y = fmtword[t + ((ecclevel - 1) << 3)];
|
||||
// low byte
|
||||
for (k = 0; k < 8; k++, y >>= 1)
|
||||
if (y & 1) {
|
||||
qrframe[(width - 1 - k) + width * 8] = 1;
|
||||
if (k < 6)
|
||||
qrframe[8 + width * k] = 1;
|
||||
else
|
||||
qrframe[8 + width * (k + 1)] = 1;
|
||||
}
|
||||
// high byte
|
||||
for (k = 0; k < 7; k++, y >>= 1)
|
||||
if (y & 1) {
|
||||
qrframe[8 + width * (width - 7 + k)] = 1;
|
||||
if (k)
|
||||
qrframe[(6 - k) + width * 8] = 1;
|
||||
else
|
||||
qrframe[7 + width * 8] = 1;
|
||||
}
|
||||
return qrframe;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var _canvas = null;
|
||||
|
||||
var api = {
|
||||
|
||||
get ecclevel() {
|
||||
return ecclevel;
|
||||
},
|
||||
|
||||
set ecclevel(val) {
|
||||
ecclevel = val;
|
||||
},
|
||||
|
||||
get size() {
|
||||
return _size;
|
||||
},
|
||||
|
||||
set size(val) {
|
||||
_size = val
|
||||
},
|
||||
|
||||
get canvas() {
|
||||
return _canvas;
|
||||
},
|
||||
|
||||
set canvas(el) {
|
||||
_canvas = el;
|
||||
},
|
||||
|
||||
getFrame: function(string) {
|
||||
return genframe(string);
|
||||
},
|
||||
//这里的utf16to8(str)是对Text中的字符串进行转码,让其支持中文
|
||||
utf16to8: function(str) {
|
||||
var out, i, len, c;
|
||||
|
||||
out = "";
|
||||
len = str.length;
|
||||
for (i = 0; i < len; i++) {
|
||||
c = str.charCodeAt(i);
|
||||
if ((c >= 0x0001) && (c <= 0x007F)) {
|
||||
out += str.charAt(i);
|
||||
} else if (c > 0x07FF) {
|
||||
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
|
||||
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
|
||||
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
|
||||
} else {
|
||||
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
|
||||
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
},
|
||||
/**
|
||||
* 新增$this参数,传入组件的this,兼容在组件中生成
|
||||
*/
|
||||
draw: function(str, canvas, cavW, cavH, cavColor, haveImg, imageUrl, imageSize, $this, cb = function() {}, ecc) {
|
||||
var that = this;
|
||||
ecclevel = ecc || ecclevel;
|
||||
canvas = canvas || _canvas;
|
||||
if (!canvas) {
|
||||
console.warn('No canvas provided to draw QR code in!')
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let pre_background = "#ffffff";
|
||||
var size = Math.min(cavW, cavH);
|
||||
str = that.utf16to8(str); //增加中文显示
|
||||
|
||||
var frame = that.getFrame(str);
|
||||
// 组件中生成qrcode需要绑定this
|
||||
var ctx = uni.createCanvasContext(canvas, $this);
|
||||
var px = Math.round(size / (width ));
|
||||
|
||||
var roundedSize = px * (width);
|
||||
// var px = 1 ;
|
||||
// var roundedSize = px * (width + 8) ;
|
||||
|
||||
//var roundedSize = 0 ;
|
||||
//var offset = Math.floor((size - roundedSize) / 2);
|
||||
var offset = 0 ;
|
||||
size = roundedSize;
|
||||
//ctx.clearRect(0, 0, cavW, cavW);
|
||||
ctx.setFillStyle(pre_background)
|
||||
ctx.fillRect(0, 0, cavW, cavW);
|
||||
ctx.setFillStyle(cavColor);
|
||||
for (var i = 0; i < width; i++) {
|
||||
for (var j = 0; j < width; j++) {
|
||||
if (frame[j * width + i]) {
|
||||
ctx.fillRect(px * ( i) + offset, px * ( j) + offset, px, px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//画图片
|
||||
if (haveImg) {
|
||||
try {
|
||||
var x = Number(((cavW - imageSize - 14) / 2).toFixed(2));
|
||||
var y = Number(((cavH - imageSize -14) / 2).toFixed(2));
|
||||
drawRoundedRect(ctx, x, y, imageSize, imageSize, imageSize / 2, 6, true, true)
|
||||
|
||||
let isNetImg = false;
|
||||
|
||||
isNetImg = imageUrl.substr(0, 4) == 'http' ? true : false;
|
||||
|
||||
if (isNetImg) {
|
||||
//网络图片下载到本地
|
||||
uni.getImageInfo({
|
||||
src: imageUrl,
|
||||
success: function(res) {
|
||||
ctx.drawImage(res.path, x, y, imageSize, imageSize);
|
||||
//--增加绘制完成回调
|
||||
ctx.draw(false, function() {
|
||||
cb();
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ctx.drawImage(imageUrl, x, y, imageSize, imageSize);
|
||||
//--增加绘制完成回调
|
||||
ctx.draw(false, function() {
|
||||
cb();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 画圆角矩形
|
||||
function drawRoundedRect(ctxi, x, y, width, height, r, lineWidth, fill, stroke) {
|
||||
ctxi.setLineWidth(lineWidth);
|
||||
ctxi.setFillStyle(pre_background);
|
||||
ctxi.setStrokeStyle(pre_background);
|
||||
ctxi.beginPath(); // draw top and top right corner
|
||||
ctxi.moveTo(x + r, y);
|
||||
ctxi.arcTo(x + width, y, x + width, y + r, r); // draw right side and bottom right corner
|
||||
ctxi.arcTo(x + width, y + height, x + width - r, y + height, r); // draw bottom and bottom left corner
|
||||
ctxi.arcTo(x, y + height, x, y + height - r, r); // draw left and top left corner
|
||||
ctxi.arcTo(x, y, x + r, y, r);
|
||||
ctxi.closePath();
|
||||
if (fill) {
|
||||
ctxi.fill();
|
||||
}
|
||||
if (stroke) {
|
||||
ctxi.stroke();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
} else {
|
||||
//--增加绘制完成回调
|
||||
ctx.draw(false, function() {
|
||||
cb();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
api
|
||||
}
|
||||
})();
|
|
@ -0,0 +1,424 @@
|
|||
//Core code comes from https://github.com/davidshimjs/qrcodejs
|
||||
|
||||
var QRCode;
|
||||
|
||||
(function () {
|
||||
/**
|
||||
* Get the type by string length
|
||||
*
|
||||
* @private
|
||||
* @param {String} sText
|
||||
* @param {Number} nCorrectLevel
|
||||
* @return {Number} type
|
||||
*/
|
||||
function _getTypeNumber(sText, nCorrectLevel) {
|
||||
var nType = 1;
|
||||
var length = _getUTF8Length(sText);
|
||||
|
||||
for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
|
||||
var nLimit = 0;
|
||||
|
||||
switch (nCorrectLevel) {
|
||||
case QRErrorCorrectLevel.L:
|
||||
nLimit = QRCodeLimitLength[i][0];
|
||||
break;
|
||||
case QRErrorCorrectLevel.M:
|
||||
nLimit = QRCodeLimitLength[i][1];
|
||||
break;
|
||||
case QRErrorCorrectLevel.Q:
|
||||
nLimit = QRCodeLimitLength[i][2];
|
||||
break;
|
||||
case QRErrorCorrectLevel.H:
|
||||
nLimit = QRCodeLimitLength[i][3];
|
||||
break;
|
||||
}
|
||||
|
||||
if (length <= nLimit) {
|
||||
break;
|
||||
} else {
|
||||
nType++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nType > QRCodeLimitLength.length) {
|
||||
throw new Error("Too long data");
|
||||
}
|
||||
|
||||
return nType;
|
||||
}
|
||||
|
||||
function _getUTF8Length(sText) {
|
||||
var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
|
||||
return replacedText.length + (replacedText.length != sText ? 3 : 0);
|
||||
}
|
||||
|
||||
function QR8bitByte(data) {
|
||||
this.mode = QRMode.MODE_8BIT_BYTE;
|
||||
this.data = data;
|
||||
this.parsedData = [];
|
||||
|
||||
// Added to support UTF-8 Characters
|
||||
for (var i = 0, l = this.data.length; i < l; i++) {
|
||||
var byteArray = [];
|
||||
var code = this.data.charCodeAt(i);
|
||||
|
||||
if (code > 0x10000) {
|
||||
byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
|
||||
byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
|
||||
byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
|
||||
byteArray[3] = 0x80 | (code & 0x3F);
|
||||
} else if (code > 0x800) {
|
||||
byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
|
||||
byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
|
||||
byteArray[2] = 0x80 | (code & 0x3F);
|
||||
} else if (code > 0x80) {
|
||||
byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
|
||||
byteArray[1] = 0x80 | (code & 0x3F);
|
||||
} else {
|
||||
byteArray[0] = code;
|
||||
}
|
||||
|
||||
this.parsedData.push(byteArray);
|
||||
}
|
||||
|
||||
this.parsedData = Array.prototype.concat.apply([], this.parsedData);
|
||||
|
||||
if (this.parsedData.length != this.data.length) {
|
||||
this.parsedData.unshift(191);
|
||||
this.parsedData.unshift(187);
|
||||
this.parsedData.unshift(239);
|
||||
}
|
||||
}
|
||||
|
||||
QR8bitByte.prototype = {
|
||||
getLength: function (buffer) {
|
||||
return this.parsedData.length;
|
||||
},
|
||||
write: function (buffer) {
|
||||
for (var i = 0, l = this.parsedData.length; i < l; i++) {
|
||||
buffer.put(this.parsedData[i], 8);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// QRCodeModel
|
||||
function QRCodeModel(typeNumber, errorCorrectLevel) {
|
||||
this.typeNumber = typeNumber;
|
||||
this.errorCorrectLevel = errorCorrectLevel;
|
||||
this.modules = null;
|
||||
this.moduleCount = 0;
|
||||
this.dataCache = null;
|
||||
this.dataList = [];
|
||||
}
|
||||
QRCodeModel.prototype = {
|
||||
addData: function (data) { var newData = new QR8bitByte(data); this.dataList.push(newData); this.dataCache = null; }, isDark: function (row, col) {
|
||||
if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { throw new Error(row + "," + col); }
|
||||
return this.modules[row][col];
|
||||
}, getModuleCount: function () { return this.moduleCount; }, make: function () { this.makeImpl(false, this.getBestMaskPattern()); }, makeImpl: function (test, maskPattern) {
|
||||
this.moduleCount = this.typeNumber * 4 + 17; this.modules = new Array(this.moduleCount); for (var row = 0; row < this.moduleCount; row++) { this.modules[row] = new Array(this.moduleCount); for (var col = 0; col < this.moduleCount; col++) { this.modules[row][col] = null; } }
|
||||
this.setupPositionProbePattern(0, 0); this.setupPositionProbePattern(this.moduleCount - 7, 0); this.setupPositionProbePattern(0, this.moduleCount - 7); this.setupPositionAdjustPattern(); this.setupTimingPattern(); this.setupTypeInfo(test, maskPattern); if (this.typeNumber >= 7) { this.setupTypeNumber(test); }
|
||||
if (this.dataCache == null) { this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); }
|
||||
this.mapData(this.dataCache, maskPattern);
|
||||
}, setupPositionProbePattern: function (row, col) { for (var r = -1; r <= 7; r++) { if (row + r <= -1 || this.moduleCount <= row + r) continue; for (var c = -1; c <= 7; c++) { if (col + c <= -1 || this.moduleCount <= col + c) continue; if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } }, getBestMaskPattern: function () {
|
||||
var minLostPoint = 0; var pattern = 0; for (var i = 0; i < 8; i++) { this.makeImpl(true, i); var lostPoint = QRUtil.getLostPoint(this); if (i == 0 || minLostPoint > lostPoint) { minLostPoint = lostPoint; pattern = i; } }
|
||||
return pattern;
|
||||
}, createMovieClip: function (target_mc, instance_name, depth) {
|
||||
var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); var cs = 1; this.make(); for (var row = 0; row < this.modules.length; row++) { var y = row * cs; for (var col = 0; col < this.modules[row].length; col++) { var x = col * cs; var dark = this.modules[row][col]; if (dark) { qr_mc.beginFill(0, 100); qr_mc.moveTo(x, y); qr_mc.lineTo(x + cs, y); qr_mc.lineTo(x + cs, y + cs); qr_mc.lineTo(x, y + cs); qr_mc.endFill(); } } }
|
||||
return qr_mc;
|
||||
}, setupTimingPattern: function () {
|
||||
for (var r = 8; r < this.moduleCount - 8; r++) {
|
||||
if (this.modules[r][6] != null) { continue; }
|
||||
this.modules[r][6] = (r % 2 == 0);
|
||||
}
|
||||
for (var c = 8; c < this.moduleCount - 8; c++) {
|
||||
if (this.modules[6][c] != null) { continue; }
|
||||
this.modules[6][c] = (c % 2 == 0);
|
||||
}
|
||||
}, setupPositionAdjustPattern: function () {
|
||||
var pos = QRUtil.getPatternPosition(this.typeNumber); for (var i = 0; i < pos.length; i++) {
|
||||
for (var j = 0; j < pos.length; j++) {
|
||||
var row = pos[i]; var col = pos[j]; if (this.modules[row][col] != null) { continue; }
|
||||
for (var r = -2; r <= 2; r++) { for (var c = -2; c <= 2; c++) { if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } }
|
||||
}
|
||||
}
|
||||
}, setupTypeNumber: function (test) {
|
||||
var bits = QRUtil.getBCHTypeNumber(this.typeNumber); for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; }
|
||||
for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; }
|
||||
}, setupTypeInfo: function (test, maskPattern) {
|
||||
var data = (this.errorCorrectLevel << 3) | maskPattern; var bits = QRUtil.getBCHTypeInfo(data); for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 6) { this.modules[i][8] = mod; } else if (i < 8) { this.modules[i + 1][8] = mod; } else { this.modules[this.moduleCount - 15 + i][8] = mod; } }
|
||||
for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 8) { this.modules[8][this.moduleCount - i - 1] = mod; } else if (i < 9) { this.modules[8][15 - i - 1 + 1] = mod; } else { this.modules[8][15 - i - 1] = mod; } }
|
||||
this.modules[this.moduleCount - 8][8] = (!test);
|
||||
}, mapData: function (data, maskPattern) {
|
||||
var inc = -1; var row = this.moduleCount - 1; var bitIndex = 7; var byteIndex = 0; for (var col = this.moduleCount - 1; col > 0; col -= 2) {
|
||||
if (col == 6) col--; while (true) {
|
||||
for (var c = 0; c < 2; c++) {
|
||||
if (this.modules[row][col - c] == null) {
|
||||
var dark = false; if (byteIndex < data.length) { dark = (((data[byteIndex] >>> bitIndex) & 1) == 1); }
|
||||
var mask = QRUtil.getMask(maskPattern, row, col - c); if (mask) { dark = !dark; }
|
||||
this.modules[row][col - c] = dark; bitIndex--; if (bitIndex == -1) { byteIndex++; bitIndex = 7; }
|
||||
}
|
||||
}
|
||||
row += inc; if (row < 0 || this.moduleCount <= row) { row -= inc; inc = -inc; break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
QRCodeModel.PAD0 = 0xEC;
|
||||
QRCodeModel.PAD1 = 0x11;
|
||||
QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) {
|
||||
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); var buffer = new QRBitBuffer(); for (var i = 0; i < dataList.length; i++) { var data = dataList[i]; buffer.put(data.mode, 4); buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber)); data.write(buffer); }
|
||||
var totalDataCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalDataCount += rsBlocks[i].dataCount; }
|
||||
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
||||
throw new Error("code length overflow. ("
|
||||
+ buffer.getLengthInBits()
|
||||
+ ">"
|
||||
+ totalDataCount * 8
|
||||
+ ")");
|
||||
}
|
||||
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { buffer.put(0, 4); }
|
||||
while (buffer.getLengthInBits() % 8 != 0) { buffer.putBit(false); }
|
||||
while (true) {
|
||||
if (buffer.getLengthInBits() >= totalDataCount * 8) { break; }
|
||||
buffer.put(QRCodeModel.PAD0, 8); if (buffer.getLengthInBits() >= totalDataCount * 8) { break; }
|
||||
buffer.put(QRCodeModel.PAD1, 8);
|
||||
}
|
||||
return QRCodeModel.createBytes(buffer, rsBlocks);
|
||||
};
|
||||
QRCodeModel.createBytes = function (buffer, rsBlocks) {
|
||||
var offset = 0; var maxDcCount = 0; var maxEcCount = 0; var dcdata = new Array(rsBlocks.length); var ecdata = new Array(rsBlocks.length); for (var r = 0; r < rsBlocks.length; r++) {
|
||||
var dcCount = rsBlocks[r].dataCount; var ecCount = rsBlocks[r].totalCount - dcCount; maxDcCount = Math.max(maxDcCount, dcCount); maxEcCount = Math.max(maxEcCount, ecCount); dcdata[r] = new Array(dcCount); for (var i = 0; i < dcdata[r].length; i++) { dcdata[r][i] = 0xff & buffer.buffer[i + offset]; }
|
||||
offset += dcCount; var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); var modPoly = rawPoly.mod(rsPoly); ecdata[r] = new Array(rsPoly.getLength() - 1); for (var i = 0; i < ecdata[r].length; i++) { var modIndex = i + modPoly.getLength() - ecdata[r].length; ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0; }
|
||||
}
|
||||
var totalCodeCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalCodeCount += rsBlocks[i].totalCount; }
|
||||
var data = new Array(totalCodeCount); var index = 0; for (var i = 0; i < maxDcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < dcdata[r].length) { data[index++] = dcdata[r][i]; } } }
|
||||
for (var i = 0; i < maxEcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < ecdata[r].length) { data[index++] = ecdata[r][i]; } } }
|
||||
return data;
|
||||
};
|
||||
var QRMode = { MODE_NUMBER: 1 << 0, MODE_ALPHA_NUM: 1 << 1, MODE_8BIT_BYTE: 1 << 2, MODE_KANJI: 1 << 3 };
|
||||
var QRErrorCorrectLevel = { L: 1, M: 0, Q: 3, H: 2 };
|
||||
var QRMaskPattern = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 };
|
||||
var QRUtil = {
|
||||
PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), getBCHTypeInfo: function (data) {
|
||||
var d = data << 10; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15))); }
|
||||
return ((data << 10) | d) ^ QRUtil.G15_MASK;
|
||||
}, getBCHTypeNumber: function (data) {
|
||||
var d = data << 12; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18))); }
|
||||
return (data << 12) | d;
|
||||
}, getBCHDigit: function (data) {
|
||||
var digit = 0; while (data != 0) { digit++; data >>>= 1; }
|
||||
return digit;
|
||||
}, getPatternPosition: function (typeNumber) { return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; }, getMask: function (maskPattern, i, j) { switch (maskPattern) { case QRMaskPattern.PATTERN000: return (i + j) % 2 == 0; case QRMaskPattern.PATTERN001: return i % 2 == 0; case QRMaskPattern.PATTERN010: return j % 3 == 0; case QRMaskPattern.PATTERN011: return (i + j) % 3 == 0; case QRMaskPattern.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0; case QRMaskPattern.PATTERN101: return (i * j) % 2 + (i * j) % 3 == 0; case QRMaskPattern.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 == 0; case QRMaskPattern.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 == 0; default: throw new Error("bad maskPattern:" + maskPattern); } }, getErrorCorrectPolynomial: function (errorCorrectLength) {
|
||||
var a = new QRPolynomial([1], 0); for (var i = 0; i < errorCorrectLength; i++) { a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0)); }
|
||||
return a;
|
||||
}, getLengthInBits: function (mode, type) { if (1 <= type && type < 10) { switch (mode) { case QRMode.MODE_NUMBER: return 10; case QRMode.MODE_ALPHA_NUM: return 9; case QRMode.MODE_8BIT_BYTE: return 8; case QRMode.MODE_KANJI: return 8; default: throw new Error("mode:" + mode); } } else if (type < 27) { switch (mode) { case QRMode.MODE_NUMBER: return 12; case QRMode.MODE_ALPHA_NUM: return 11; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 10; default: throw new Error("mode:" + mode); } } else if (type < 41) { switch (mode) { case QRMode.MODE_NUMBER: return 14; case QRMode.MODE_ALPHA_NUM: return 13; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 12; default: throw new Error("mode:" + mode); } } else { throw new Error("type:" + type); } }, getLostPoint: function (qrCode) {
|
||||
var moduleCount = qrCode.getModuleCount(); var lostPoint = 0; for (var row = 0; row < moduleCount; row++) {
|
||||
for (var col = 0; col < moduleCount; col++) {
|
||||
var sameCount = 0; var dark = qrCode.isDark(row, col); for (var r = -1; r <= 1; r++) {
|
||||
if (row + r < 0 || moduleCount <= row + r) { continue; }
|
||||
for (var c = -1; c <= 1; c++) {
|
||||
if (col + c < 0 || moduleCount <= col + c) { continue; }
|
||||
if (r == 0 && c == 0) { continue; }
|
||||
if (dark == qrCode.isDark(row + r, col + c)) { sameCount++; }
|
||||
}
|
||||
}
|
||||
if (sameCount > 5) { lostPoint += (3 + sameCount - 5); }
|
||||
}
|
||||
}
|
||||
for (var row = 0; row < moduleCount - 1; row++) { for (var col = 0; col < moduleCount - 1; col++) { var count = 0; if (qrCode.isDark(row, col)) count++; if (qrCode.isDark(row + 1, col)) count++; if (qrCode.isDark(row, col + 1)) count++; if (qrCode.isDark(row + 1, col + 1)) count++; if (count == 0 || count == 4) { lostPoint += 3; } } }
|
||||
for (var row = 0; row < moduleCount; row++) { for (var col = 0; col < moduleCount - 6; col++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) { lostPoint += 40; } } }
|
||||
for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount - 6; row++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) { lostPoint += 40; } } }
|
||||
var darkCount = 0; for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount; row++) { if (qrCode.isDark(row, col)) { darkCount++; } } }
|
||||
var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; lostPoint += ratio * 10; return lostPoint;
|
||||
}
|
||||
};
|
||||
var QRMath = {
|
||||
glog: function (n) {
|
||||
if (n < 1) { throw new Error("glog(" + n + ")"); }
|
||||
return QRMath.LOG_TABLE[n];
|
||||
}, gexp: function (n) {
|
||||
while (n < 0) { n += 255; }
|
||||
while (n >= 256) { n -= 255; }
|
||||
return QRMath.EXP_TABLE[n];
|
||||
}, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256)
|
||||
}; for (var i = 0; i < 8; i++) { QRMath.EXP_TABLE[i] = 1 << i; }
|
||||
for (var i = 8; i < 256; i++) { QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8]; }
|
||||
for (var i = 0; i < 255; i++) { QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; }
|
||||
function QRPolynomial(num, shift) {
|
||||
if (num.length == undefined) { throw new Error(num.length + "/" + shift); }
|
||||
var offset = 0; while (offset < num.length && num[offset] == 0) { offset++; }
|
||||
this.num = new Array(num.length - offset + shift); for (var i = 0; i < num.length - offset; i++) { this.num[i] = num[i + offset]; }
|
||||
}
|
||||
QRPolynomial.prototype = {
|
||||
get: function (index) { return this.num[index]; }, getLength: function () { return this.num.length; }, multiply: function (e) {
|
||||
var num = new Array(this.getLength() + e.getLength() - 1); for (var i = 0; i < this.getLength(); i++) { for (var j = 0; j < e.getLength(); j++) { num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j))); } }
|
||||
return new QRPolynomial(num, 0);
|
||||
}, mod: function (e) {
|
||||
if (this.getLength() - e.getLength() < 0) { return this; }
|
||||
var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)); var num = new Array(this.getLength()); for (var i = 0; i < this.getLength(); i++) { num[i] = this.get(i); }
|
||||
for (var i = 0; i < e.getLength(); i++) { num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio); }
|
||||
return new QRPolynomial(num, 0).mod(e);
|
||||
}
|
||||
};
|
||||
function QRRSBlock(totalCount, dataCount) { this.totalCount = totalCount; this.dataCount = dataCount; }
|
||||
QRRSBlock.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]];
|
||||
QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) {
|
||||
var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); if (rsBlock == undefined) { throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); }
|
||||
var length = rsBlock.length / 3; var list = []; for (var i = 0; i < length; i++) { var count = rsBlock[i * 3 + 0]; var totalCount = rsBlock[i * 3 + 1]; var dataCount = rsBlock[i * 3 + 2]; for (var j = 0; j < count; j++) { list.push(new QRRSBlock(totalCount, dataCount)); } }
|
||||
return list;
|
||||
};
|
||||
QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) { switch (errorCorrectLevel) { case QRErrorCorrectLevel.L: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; case QRErrorCorrectLevel.M: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; case QRErrorCorrectLevel.Q: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; case QRErrorCorrectLevel.H: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; default: return undefined; } };
|
||||
function QRBitBuffer() { this.buffer = []; this.length = 0; }
|
||||
QRBitBuffer.prototype = {
|
||||
get: function (index) { var bufIndex = Math.floor(index / 8); return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1; }, put: function (num, length) { for (var i = 0; i < length; i++) { this.putBit(((num >>> (length - i - 1)) & 1) == 1); } }, getLengthInBits: function () { return this.length; }, putBit: function (bit) {
|
||||
var bufIndex = Math.floor(this.length / 8); if (this.buffer.length <= bufIndex) { this.buffer.push(0); }
|
||||
if (bit) { this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); }
|
||||
this.length++;
|
||||
}
|
||||
};
|
||||
var QRCodeLimitLength = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]];
|
||||
|
||||
// QRCode object
|
||||
QRCode = function (canvasId, vOption) {
|
||||
this._htOption = {
|
||||
width: 256,
|
||||
height: 256,
|
||||
typeNumber: 4,
|
||||
colorDark: "#000000",
|
||||
colorLight: "#ffffff",
|
||||
correctLevel: QRErrorCorrectLevel.H
|
||||
};
|
||||
|
||||
if (typeof vOption === 'string') {
|
||||
vOption = {
|
||||
text: vOption
|
||||
};
|
||||
}
|
||||
|
||||
// Overwrites options
|
||||
if (vOption) {
|
||||
for (var i in vOption) {
|
||||
this._htOption[i] = vOption[i];
|
||||
}
|
||||
}
|
||||
|
||||
this._oQRCode = null;
|
||||
this.canvasId = canvasId
|
||||
|
||||
if (this._htOption.text && this.canvasId) {
|
||||
this.makeCode(this._htOption.text);
|
||||
}
|
||||
};
|
||||
|
||||
QRCode.prototype.makeCode = function (sText) {
|
||||
this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel);
|
||||
this._oQRCode.addData(sText);
|
||||
this._oQRCode.make();
|
||||
this.makeImage();
|
||||
};
|
||||
|
||||
QRCode.prototype.makeImage = function () {
|
||||
var _oContext
|
||||
if (this._htOption.usingIn) {
|
||||
_oContext = wx.createCanvasContext(this.canvasId, this._htOption.usingIn)
|
||||
}
|
||||
else {
|
||||
_oContext = wx.createCanvasContext(this.canvasId)
|
||||
}
|
||||
var _htOption = this._htOption;
|
||||
var oQRCode = this._oQRCode
|
||||
|
||||
var nCount = oQRCode.getModuleCount();
|
||||
var nWidth = _htOption.width / nCount;
|
||||
var nHeight = _htOption.height / nCount;
|
||||
var nRoundedWidth = Math.round(nWidth);
|
||||
var nRoundedHeight = Math.round(nHeight);
|
||||
|
||||
if (_htOption.image && _htOption.image != '') {
|
||||
_oContext.drawImage(_htOption.image, 0, 0, _htOption.width, _htOption.height)
|
||||
}
|
||||
|
||||
for (var row = 0; row < nCount; row++) {
|
||||
for (var col = 0; col < nCount; col++) {
|
||||
var bIsDark = oQRCode.isDark(row, col);
|
||||
var nLeft = col * nWidth;
|
||||
var nTop = row * nHeight;
|
||||
_oContext.setStrokeStyle(bIsDark ? _htOption.colorDark : _htOption.colorLight)
|
||||
// _oContext.setStrokeStyle('yellow')
|
||||
_oContext.setLineWidth(1)
|
||||
_oContext.setFillStyle(bIsDark ? _htOption.colorDark : _htOption.colorLight)
|
||||
// _oContext.setFillStyle('red')
|
||||
// if (bIsDark) {
|
||||
_oContext.fillRect(nLeft, nTop, nWidth, nHeight);
|
||||
// }
|
||||
|
||||
// 안티 앨리어싱 방지 처리
|
||||
// if (bIsDark) {
|
||||
_oContext.strokeRect(
|
||||
Math.floor(nLeft) + 0.5,
|
||||
Math.floor(nTop) + 0.5,
|
||||
nRoundedWidth,
|
||||
nRoundedHeight
|
||||
);
|
||||
|
||||
_oContext.strokeRect(
|
||||
Math.ceil(nLeft) - 0.5,
|
||||
Math.ceil(nTop) - 0.5,
|
||||
nRoundedWidth,
|
||||
nRoundedHeight
|
||||
);
|
||||
// }
|
||||
// _oContext.fillRect(
|
||||
// Math.floor(nLeft) + 0.5,
|
||||
// Math.floor(nTop) + 0.5,
|
||||
// nRoundedWidth,
|
||||
// nRoundedHeight
|
||||
// );
|
||||
// _oContext.fillRect(
|
||||
// Math.ceil(nLeft) - 0.5,
|
||||
// Math.ceil(nTop) - 0.5,
|
||||
// nRoundedWidth,
|
||||
// nRoundedHeight
|
||||
// );
|
||||
// _oContext.clearRect(
|
||||
// Math.floor(nLeft) + 0.5,
|
||||
// Math.floor(nTop) + 0.5,
|
||||
// nRoundedWidth,
|
||||
// nRoundedHeight
|
||||
// );
|
||||
// _oContext.clearRect(
|
||||
// Math.ceil(nLeft) - 0.5,
|
||||
// Math.ceil(nTop) - 0.5,
|
||||
// nRoundedWidth,
|
||||
// nRoundedHeight
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
_oContext.draw()
|
||||
};
|
||||
|
||||
// 保存为图片,将临时路径传给回调
|
||||
QRCode.prototype.exportImage = function (callback) {
|
||||
if (!callback) {
|
||||
return
|
||||
}
|
||||
wx.canvasToTempFilePath({
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: this._htOption.width,
|
||||
height: this._htOption.height,
|
||||
destWidth: this._htOption.width,
|
||||
destHeight: this._htOption.height,
|
||||
canvasId: this.canvasId,
|
||||
success: function (res) {
|
||||
// console.log(res.tempFilePath)
|
||||
callback(res.tempFilePath)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
QRCode.CorrectLevel = QRErrorCorrectLevel;
|
||||
})();
|
||||
|
||||
module.exports = QRCode
|
|
@ -0,0 +1,37 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="showTop" class="backTop-box">
|
||||
<image class="animated pulse infinite" @tap="backTop" src="/static/public/backTop.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"backTop",
|
||||
props:{
|
||||
showTop:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
onPageScroll(e) {
|
||||
// console.log(e);
|
||||
},
|
||||
methods:{
|
||||
backTop(){
|
||||
this.$emit('backTop')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.backTop-box{position: fixed;right: 20rpx;bottom: 160rpx;}
|
||||
.backTop-box>image{width: 60rpx;height: 50rpx;}
|
||||
</style>
|
|
@ -0,0 +1,97 @@
|
|||
<template>
|
||||
<view>
|
||||
<scroll-view scroll-x >
|
||||
<view class="" :class="isCenter?'disac':'disjb'">
|
||||
<view @tap="choosecate(index)"
|
||||
:style="{
|
||||
background : newCurrent==index ? activeb:newbmo,
|
||||
fontSize:newfmo+'px',
|
||||
borderRadius:newRadius+'px',
|
||||
minWidth:isMinW ? newMinWidth+'px':'',
|
||||
color : newCurrent==index ? activec:newcmo}"
|
||||
class="flexs cateitem" :class="(!isCenter && newcateList.length<=4)?'maright0':''"
|
||||
v-for="(item,index) in newcateList" :key="index">{{item.title}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"cate-pu",
|
||||
props:{
|
||||
isCenter:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
activeb:{//选中背景色
|
||||
type:String,
|
||||
default:'#3875F6'
|
||||
},
|
||||
activec:{//选中字体颜色
|
||||
type:String,
|
||||
default:'#FFFFFF'
|
||||
},
|
||||
newcateList:{//分类列表
|
||||
type:Array,
|
||||
default:function(){
|
||||
return [
|
||||
{title:'热门问题'},
|
||||
{title:'病种'},
|
||||
{title:'案例日记'},
|
||||
{title:'效果模拟'},
|
||||
{title:'效果模拟'},
|
||||
]
|
||||
}
|
||||
},
|
||||
newbmo:{//默认背景色
|
||||
type:String,
|
||||
default:'#FFFFFF'
|
||||
},
|
||||
newcmo:{//默认字体颜色
|
||||
type:String,
|
||||
default:'#333333'
|
||||
},
|
||||
newfmo:{//默认字体大小
|
||||
type:String,
|
||||
default:'15'
|
||||
},
|
||||
newRadius:{//圆角
|
||||
type:String,
|
||||
default:'10'
|
||||
},
|
||||
isMinW:{//是否使用最小宽度
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
newMinWidth:{//最小宽度
|
||||
type:String,
|
||||
default:'52'//49
|
||||
},
|
||||
newCurrent:{//默认选中
|
||||
type:Number,
|
||||
default:0
|
||||
}
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
current:0,
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
choosecate(index){//二级分类选择
|
||||
// console.log('二级分类:',index);
|
||||
this.$emit('choosecateEv',index)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.catetwomo{background-color: #FFFFFF;color: #4D4D4D;}
|
||||
.disac{display: flex;align-items: center;}
|
||||
.flexs{flex-shrink: 0;}
|
||||
.cateitem{padding: 16rpx 20rpx;text-align: center;margin-right: 20rpx;}
|
||||
.maright0{margin-right: 0!important;}
|
||||
</style>
|
|
@ -0,0 +1,65 @@
|
|||
<template>
|
||||
<view v-if="list.lenght!=0">
|
||||
<view v-for="(item,index) in list" :key="index">
|
||||
<!-- 一级title -->
|
||||
<view class="disjbac mar-x30 mar-s10">
|
||||
<view class="fon34 bold col3">{{item.title}}</view>
|
||||
<image class="mar-y50" @tap="delSearch" v-if="item.src!=''" :src="item.src" style="width: 30rpx;height: 30rpx;" mode="heightFix"></image>
|
||||
</view>
|
||||
<view class="fon24 col6 disac fw">
|
||||
<!-- 二级title -->
|
||||
<view @tap="choosetwo(index,indexo)"
|
||||
v-for="(itemo,indexo) in item.list" :key="indexo"
|
||||
class="radius10 mar-y20 flexs mar-x20 cate-tu-item">{{itemo.content}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"cate-tu",
|
||||
props:{
|
||||
list:{
|
||||
type:Array,
|
||||
default:function(){
|
||||
return []
|
||||
}
|
||||
},
|
||||
isDetail:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
choosetwo(e1,e2){
|
||||
// console.log('一级索引:',e1);
|
||||
// console.log('二级索引:',e2);
|
||||
// console.log(this.list[e1].list[e2].content);
|
||||
if(this.isDetail){
|
||||
uni.navigateTo({
|
||||
url:`/pagesB/problemDetail/problemDetail?id=${this.list[e1].list[e2].id}&category_id=${this.list[e1].list[e2].category_id}`
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url:`/pagesB/searchPage/searchPage?keyWorld=${this.list[e1].list[e2].content}`
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
delSearch(){
|
||||
// this.list = []
|
||||
this.$emit('delev')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,107 @@
|
|||
.lotus-address-picker {
|
||||
font-size: 26rpx;
|
||||
padding-top: 30rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
line-height: normal;
|
||||
padding-right: 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.lotus-address-picker-box {
|
||||
/*display: -webkit-box;
|
||||
display: -webkit-flex;*/
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
padding-top: 10rpx;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
.lotus-address-picker-box-item {
|
||||
height: 600upx;
|
||||
overflow-y: auto;
|
||||
width: 33.333%;
|
||||
padding-left: 20rpx;
|
||||
padding-right: 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.lotus-address-picker2 {
|
||||
color: #e93b3d;
|
||||
position: relative;
|
||||
}
|
||||
.lotus-address-picker2:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 65%;
|
||||
transform: translateY(-35%) rotate(-45deg);
|
||||
width: 20rpx;
|
||||
height: 10rpx;
|
||||
border-left-width: 4rpx;
|
||||
border-bottom-width: 4rpx;
|
||||
border-left-style: solid;
|
||||
border-bottom-style: solid;
|
||||
border-left-color: #e93b3d;
|
||||
border-bottom-color: #e93b3d;
|
||||
}
|
||||
.lotus-address-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.lotus-address-box {
|
||||
background: #fff;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.lotus-address-action {
|
||||
font-size: 30rpx;
|
||||
/*display: -webkit-box;
|
||||
display: -webkit-flex;*/
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: space-between;
|
||||
padding: 25rpx 30rpx;
|
||||
position: relative;
|
||||
}
|
||||
.lotus-address-action:after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
border-top: 1px solid #eee;
|
||||
color: #eee;
|
||||
transform-origin: 0 0;
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
.lotus-address-action:before {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
border-bottom: 1px solid #eee;
|
||||
color: #eee;
|
||||
transform-origin: 0 100%;
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
.lotus-address-action-cancel {
|
||||
color: #969696;
|
||||
}
|
||||
.lotus-address-action-affirm {
|
||||
color: #e93b3d;
|
||||
}
|
|
@ -0,0 +1,233 @@
|
|||
<template>
|
||||
<!--地址picker-->
|
||||
<view :status="checkStatus" v-if="lotusAddressData.visible" class="lotus-address-mask">
|
||||
<view :class="lotusAddressData.visible?'lotus-address-box':'lotus-address-box lotus-address-box-out'">
|
||||
<view class="lotus-address-action">
|
||||
<text @tap="cancelPicker" class="lotus-address-action-cancel">取消</text>
|
||||
<text @tap="chosedVal" class="lotus-address-action-affirm">确认</text>
|
||||
</view>
|
||||
<view class="lotus-address-picker-box">
|
||||
<!--省-->
|
||||
<scroll-view scroll-y :scroll-into-view="'pid'+pChoseIndex" class="lotus-address-picker-box-item">
|
||||
<view @tap="clickPicker(0,pIndex,pItem);" :id="'pid'+pIndex" :class="pIndex === pChoseIndex?'lotus-address-picker lotus-address-picker2':'lotus-address-picker'" v-for="(pItem,pIndex) in province" :key="pIndex">{{pItem}}</view>
|
||||
</scroll-view>
|
||||
<!--市-->
|
||||
<scroll-view scroll-y :scroll-into-view="'cid'+cChoseIndex" class="lotus-address-picker-box-item">
|
||||
<view @tap="clickPicker(1,cIndex,cItem);" :id="'cid'+cIndex" :class="cIndex === cChoseIndex?'lotus-address-picker lotus-address-picker2':'lotus-address-picker'" v-for="(cItem,cIndex) in city" :key="cIndex">{{cItem}}</view>
|
||||
</scroll-view>
|
||||
<!--区-->
|
||||
<scroll-view scroll-y :scroll-into-view="'tid'+tChoseIndex" class="lotus-address-picker-box-item">
|
||||
<view @tap="clickPicker(2,tIndex,tItem);" :id="'tid'+tIndex" :class="tIndex === tChoseIndex?'lotus-address-picker lotus-address-picker2':'lotus-address-picker'" v-for="(tItem,tIndex) in town" :key="tIndex">{{tItem}}</view>
|
||||
</scroll-view>
|
||||
<!--区END-->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--地址picker END-->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {lotusAddressJson} from "./city.js";
|
||||
export default {
|
||||
props:['lotusAddressData'],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
province:[],
|
||||
city:[],
|
||||
town:[],
|
||||
provinceName:'',
|
||||
cityName:'',
|
||||
townName:'',
|
||||
type:0,//0新增1编辑
|
||||
pChoseIndex:-1,
|
||||
cChoseIndex:-1,
|
||||
tChoseIndex:-1
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
//取消
|
||||
cancelPicker(){
|
||||
const provinceCode = this.getTarId(this.provinceName);
|
||||
const cityCode = this.getTarId(this.cityName);
|
||||
const townCode = this.getTarId(this.townName);
|
||||
this.visible = false;
|
||||
this.$emit("choseVal",{
|
||||
province:this.provinceName,
|
||||
provinceCode,
|
||||
city:this.cityName,
|
||||
cityCode,
|
||||
town:this.townName,
|
||||
townCode,
|
||||
isChose:0,
|
||||
visible:false
|
||||
});
|
||||
},
|
||||
//获取最后选择的省市区的值
|
||||
chosedVal() {
|
||||
this.type = 1;
|
||||
const provinceCode = this.getTarId(this.provinceName);
|
||||
const cityCode = this.getTarId(this.cityName);
|
||||
const townCode = this.getTarId(this.townName);
|
||||
this.visible = false;
|
||||
let isChose = 0;
|
||||
//已选省市区 isChose = 1
|
||||
if((this.provinceName&&this.cityName)||(this.provinceName&&this.cityName&&this.townName)){
|
||||
isChose = 1;
|
||||
}
|
||||
this.$emit("choseVal",{
|
||||
province:this.provinceName,
|
||||
provinceCode,
|
||||
city:this.cityName,
|
||||
cityCode,
|
||||
town:this.townName,
|
||||
townCode,
|
||||
isChose,
|
||||
visible:false
|
||||
});
|
||||
},
|
||||
//获取省市区value
|
||||
getTarId(name,type){
|
||||
let id = 0;
|
||||
lotusAddressJson.map((item,index)=>{
|
||||
if(item.name === name){
|
||||
id = item.value;
|
||||
}
|
||||
});
|
||||
return id;
|
||||
},
|
||||
//获取市数据
|
||||
getCityArr(parentId){
|
||||
let city = [];
|
||||
lotusAddressJson.map((item,index)=>{
|
||||
if(item.parent === parentId){
|
||||
city.push(item.name);
|
||||
}
|
||||
});
|
||||
return city;
|
||||
},
|
||||
//获取区数据
|
||||
getTownArr(parentId){
|
||||
let town = [];
|
||||
lotusAddressJson.map((item,index)=>{
|
||||
if(index>34&&item.parent === parentId){
|
||||
town.push(item.name);
|
||||
}
|
||||
});
|
||||
return town;
|
||||
},
|
||||
//初始化数据
|
||||
initFn(){
|
||||
if(!this.province.length){
|
||||
lotusAddressJson.map((item,index)=>{
|
||||
if(index<=34){
|
||||
this.province.push(item.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
//已选择省市区,高亮显示对应选择省市区
|
||||
const p = this._props.lotusAddressData.provinceName;
|
||||
const c = this._props.lotusAddressData.cityName;
|
||||
const t = this._props.lotusAddressData.townName;
|
||||
//已选省
|
||||
if(p){
|
||||
this.pChoseIndex = this.getTarIndex(this.province,p);
|
||||
}
|
||||
//已选市
|
||||
if(p&&c){
|
||||
const pid = this.getTarId(p);
|
||||
this.city = this.getCityArr(pid);
|
||||
this.cChoseIndex = this.getTarIndex(this.city,c);
|
||||
}
|
||||
//已选区
|
||||
if(p&&c&&t){
|
||||
const cid= this.getTarId(c);
|
||||
this.town = this.getTownArr(cid);
|
||||
this.tChoseIndex = this.getTarIndex(this.town,t);
|
||||
}
|
||||
//未选省市区
|
||||
if(!p&&!c&&!t){
|
||||
this.pChoseIndex = -1;
|
||||
this.cChoseIndex = -1;
|
||||
this.tChoseIndex = -1;
|
||||
this.city = [];
|
||||
this.town = [];
|
||||
}
|
||||
},
|
||||
//获取已选省市区
|
||||
getChosedData(){
|
||||
const pid = this.getTarId(this.provinceName,'province');
|
||||
this.city = this.getCityArr(pid);
|
||||
const cid= this.getTarId(this.cityName,'city');
|
||||
this.town = this.getTownArr(cid);
|
||||
//已选省市区获取对应index
|
||||
if(this.provinceName){
|
||||
this.pChoseIndex = this.getTarIndex(this.province,this.provinceName);
|
||||
}
|
||||
if(this.cityName){
|
||||
this.cChoseIndex = this.getTarIndex(this.city,this.cityName);
|
||||
}
|
||||
if(this.townName){
|
||||
this.tChoseIndex = this.getTarIndex(this.town,this.townName);
|
||||
}
|
||||
},
|
||||
//选择省市区交互
|
||||
clickPicker(type,index,name){
|
||||
//省
|
||||
if(type === 0){
|
||||
this.pChoseIndex = index;
|
||||
this.provinceName = name;
|
||||
this.cChoseIndex = -1;
|
||||
this.tChoseIndex = -1;
|
||||
this.cityName = '';
|
||||
this.townName = '';
|
||||
}
|
||||
//市
|
||||
if(type ===1){
|
||||
this.cChoseIndex = index;
|
||||
this.cityName = name;
|
||||
this.tChoseIndex = -1;
|
||||
this.townName = '';
|
||||
}
|
||||
//区
|
||||
if(type === 2){
|
||||
this.tChoseIndex = index;
|
||||
this.townName = name;
|
||||
}
|
||||
//获取省市区数据
|
||||
this.getChosedData();
|
||||
},
|
||||
//获取已选省市区index
|
||||
getTarIndex(arr,tarName){
|
||||
let cIndex = 0;
|
||||
arr.map((item,index)=>{
|
||||
if(item === tarName){
|
||||
cIndex = index;
|
||||
}
|
||||
});
|
||||
return cIndex;
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
checkStatus(){
|
||||
let t = null;
|
||||
const _this = this;
|
||||
if(!_this.visible){
|
||||
_this.visible = _this._props.lotusAddressData.visible;
|
||||
//获取省市区
|
||||
_this.provinceName = _this._props.lotusAddressData.provinceName;
|
||||
_this.cityName = _this._props.lotusAddressData.cityName;
|
||||
_this.townName = _this._props.lotusAddressData.townName;
|
||||
//生成初始化数据
|
||||
_this.initFn();
|
||||
t = _this.visible;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import "./city.css";
|
||||
</style>
|
|
@ -0,0 +1,151 @@
|
|||
<template>
|
||||
<view>
|
||||
<view @touchmove.stop.prevent="moveHandle" v-if="vision" style="position: fixed;top: 0;right: 0;left: 0;bottom: 0;display: flex;justify-content: center;align-items: center;z-index: 3;">
|
||||
<view style="background-color: #FFFFFF;border-radius: 10rpx;padding: 30rpx;box-shadow: 0rpx 0rpx 20rpx rgba(0,0,0,.5);margin: 0 100rpx;">
|
||||
<view style="display: flex;">
|
||||
<image :src="appletImg" style="width: 96rpx;height: 96rpx;flex-shrink: 0;" mode=""></image>
|
||||
<view style="margin-left: 20rpx;">
|
||||
<view style="font-size: 30rpx;font-weight: bold;">恒美植发客服代表提醒您:</view>
|
||||
<view style="font-size: 28rpx;margin-top: 20rpx;color: #999999;">您当前是游客身份</view>
|
||||
<view style="font-size: 28rpx;margin-top: 20rpx;color: #999999;">是否选择授权登录</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="font-size: 28rpx;margin: 30rpx 0;border-bottom: 1rpx solid #F5F5F5;border-top: 1rpx solid #F5F5F5;padding: 20rpx 0;">申请 获取你的昵称、头像、地区及性别</view>
|
||||
<view style="display: flex;justify-content: center;align-items: center;font-size: 24rpx;">
|
||||
<view @tap="chooseBtn(0)" :class="isNo?'isNyin':'noyin'" style="color: #07ad60;background-color: #FFFFFF;padding: 12rpx 40rpx;border-radius: 4rpx;border: 1rpx solid #CCCCCC;">暂不授权</view>
|
||||
<view @tap="chooseBtn(1)" :class="isOk?'isOyin':'noyin'" style="background-color: #07ad60;padding: 12rpx 40rpx;color: #FFFFFF;margin-left: 20rpx;border: 1rpx solid #07ad60;position: relative;">
|
||||
<text>立即授权</text>
|
||||
<button open-type="getUserInfo" @tap="shouq" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;opacity: 0;">立即授权</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"empower",
|
||||
props:{
|
||||
vision:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
appletImg:{//小程序头像
|
||||
type:String,
|
||||
default:'/static/public/like.png'
|
||||
},
|
||||
appletName:{//小程序名称
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
url:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
isWhere:{
|
||||
type:Number,
|
||||
default:0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isOk:false,
|
||||
isNo:false,
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
moveHandle(){
|
||||
return false
|
||||
},
|
||||
tiaoZ(){//跳转方式
|
||||
if(this.isWhere==0) uni.navigateBack({delta:1}) //返回上一页
|
||||
if(this.isWhere==1) uni.navigateTo({url:this.url})//跳转到指定页面
|
||||
if(this.isWhere!=0 && this.isWhere!=1) return//不跳转
|
||||
this.isOk = false
|
||||
},
|
||||
chooseBtn(index){//暂不授权、立即授权
|
||||
this.$emit('cancleEv',index)//继承事件
|
||||
if(index==0){//暂不授权
|
||||
// this.tiaoZ()
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
this.isOk = false
|
||||
} else {
|
||||
this.isOk = !this.isOk
|
||||
this.isNo = false
|
||||
}
|
||||
},
|
||||
shouq(){//立即授权事件
|
||||
let ya = this;
|
||||
this.$toolAll.tools.showToast('正在调起授权...')
|
||||
let code = ''//声明code
|
||||
uni.login({// 获取登录用户code
|
||||
provider: 'weixin',
|
||||
success: function(result) {
|
||||
uni.hideToast()
|
||||
code = result.code
|
||||
},
|
||||
});
|
||||
uni.getUserProfile({//调起微信授权弹框
|
||||
desc: '登录',
|
||||
lang: 'zh_CN',
|
||||
success: (res) => {
|
||||
ya.updateUserInfo(code,res.userInfo)
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log('用户拒绝授权');
|
||||
this.tiaoZ()
|
||||
this.$emit('cancleEv',0)
|
||||
this.isOk = false
|
||||
}
|
||||
});
|
||||
},
|
||||
//调用登录接口
|
||||
updateUserInfo(code,userInfo) {
|
||||
let ya = this;
|
||||
uni.showToast({title: '授权中...',icon:'loading',})
|
||||
var params = {
|
||||
code:code,
|
||||
nickname: userInfo.nickName,//用户昵称
|
||||
headimgurl: userInfo.avatarUrl,//用户头像
|
||||
country: userInfo.country,//用户所在国家
|
||||
province: userInfo.province,//用户所在省份
|
||||
city: userInfo.city,//用户所在城市
|
||||
gender: userInfo.gender,//用户性别
|
||||
language:userInfo.language,//语言
|
||||
is_active:1
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
console.log('第一次登录');
|
||||
uni.setStorageSync('params',params)
|
||||
uni.setStorageSync('userId',res.data.account_id)
|
||||
uni.setStorageSync('token',res.data.token)//缓存token
|
||||
uni.setStorageSync('expire',res.data.expire)//缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('is_active',res.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('invite_code',res.data.invite_code)
|
||||
ya.successAfterEv(userInfo)
|
||||
}
|
||||
},error => {})
|
||||
},
|
||||
successAfterEv(userInfo){//缓存信息
|
||||
let ya = this
|
||||
uni.hideToast()
|
||||
// console.log(uni.getStorageSync('headImg'));
|
||||
ya.$toolAll.tools.showToast('授权成功','success')
|
||||
ya.$emit('cancleEv',0)
|
||||
ya.$emit('buttonH',true)
|
||||
if(ya.url!=''){
|
||||
setTimeout(()=>{uni.navigateTo({url:ya.url})},1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.isNyin{box-shadow: 0rpx 3rpx 6rpx rgba(0,0,0,.5);}
|
||||
.isOyin{box-shadow: 0rpx 3rpx 6rpx rgba(0,0,0,1);}
|
||||
</style>
|
|
@ -0,0 +1,188 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 方案一 -->
|
||||
<!-- <view class="foot-box">
|
||||
<view @tap="choosefoot(index)" v-for="(item,index) in tabArr" :key="index" style="display: flex;justify-content: center;flex-direction: column;align-items: center;">
|
||||
<image class="moImg" v-if="newcurrent==index" :src="item.selectedIconPath"></image>
|
||||
<image class="moImg" v-else :src="item.iconPath"></image>
|
||||
<view :class="newcurrent==index?'footactive':'footmo'" style="margin-top: 8rpx;">{{item.text}}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 方案二 -->
|
||||
<view class="foot-boxtwo">
|
||||
<!-- 图片列表 -->
|
||||
<view class="item-box">
|
||||
<view v-for="(itemi,index) in imgList" :key="index" @tap="choosefoot(index)" :class="index==2 ? 'centerBox':''">
|
||||
<view class="posir" :class="index==2 ? 'centerBox-item':''">
|
||||
<image :class="index==2 ? 'centerImg':'moImg'" v-if="newcurrent==index" :src="itemi.selectedIconPath"></image>
|
||||
<image :class="index==2 ? 'centerImg':'moImg'" v-else :src="itemi.iconPath"></image>
|
||||
<button v-if="index==2 && isKef" class="fon24 posia" style="opacity: 0;top: 0;left: 0;right: 0;bottom: 0;" open-type="contact">客服</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 标题列表 -->
|
||||
<view class="item-box">
|
||||
<view @tap="choosefoot(index)" :class="newcurrent==index ? 'footactive':'footmo'"
|
||||
v-for="(itemt,index) in titleList" :key="index">{{itemt}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :comfrimVal="'好的'" :contentVal="'暂未开放此功能,请耐心等候'"
|
||||
:isCenter="true" @comfirmev="comfirmev"></pu-po>
|
||||
<!-- 弹框授权 -->
|
||||
<empower :vision="vision" @cancleEv="cancleEv"></empower>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import empower from '@/components/empower.vue';
|
||||
export default {
|
||||
components:{
|
||||
empower
|
||||
},
|
||||
name:'footTab',
|
||||
props:{
|
||||
newcurrent:{
|
||||
type:Number,
|
||||
default:0
|
||||
},
|
||||
titleList:{
|
||||
type:Array,
|
||||
default:function(){
|
||||
return uni.getStorageSync('footTitle')
|
||||
// return ['首页','分类','客服','商城','我的']
|
||||
}
|
||||
},
|
||||
imgList:{
|
||||
type:Array,
|
||||
default:function(){
|
||||
return uni.getStorageSync('imgList')
|
||||
// return [
|
||||
// {
|
||||
// iconPath: '/static/tabbar/homem.png',//默认icon
|
||||
// selectedIconPath: '/static/tabbar/homeAc.png',//选中icon
|
||||
// },
|
||||
// {
|
||||
// iconPath: '/static/tabbar/catem.png',//默认icon
|
||||
// selectedIconPath: '/static/tabbar/cates.png',//选中icon
|
||||
// },
|
||||
// {
|
||||
// iconPath: '/static/tabbar/customerm.png',//默认icon
|
||||
// selectedIconPath: '/static/tabbar/customerm.png',//选中icon
|
||||
// },
|
||||
// {
|
||||
// iconPath: '/static/tabbar/shopm.png',//默认icon
|
||||
// selectedIconPath: '/static/tabbar/shopa.png',//选中icon
|
||||
// },
|
||||
// {
|
||||
// iconPath: '/static/tabbar/mym.png',//默认icon
|
||||
// selectedIconPath: '/static/tabbar/mya.png',//选中icon
|
||||
// }
|
||||
// ]
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
vision:false,
|
||||
isShowT:false,
|
||||
isKef:true,
|
||||
jieDuan:false
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
if(uni.getStorageSync('is_active')==0) this.isKef = false
|
||||
},
|
||||
methods:{
|
||||
cancleEv(e){
|
||||
if(e==0) this.vision = false
|
||||
},
|
||||
choosefoot(index){
|
||||
// this.current = index
|
||||
switch (index){
|
||||
case 0:
|
||||
// console.log(this.imgList[index].selectedIcoPath);
|
||||
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
break;
|
||||
case 1:
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.reLaunch({url:'/pages/tabbar/cate/cate'})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
// uni.navigateTo({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:0}).then(res=>{},error=>{})
|
||||
let maiOjb = {
|
||||
e:5,//内容咨询
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
// uni.reLaunch({url:'/pages/tabbar/shop/shop'})
|
||||
this.isShowT = true
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
// uni.navigateTo({url:'/pages/tabbar/shop/shop'})
|
||||
break;
|
||||
case 4:
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.reLaunch({url:'/pages/tabbar/my/my'})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
comfirmev(){
|
||||
this.isShowT = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 方案一 */
|
||||
/* .foot-box{
|
||||
height: 140rpx;
|
||||
font-size: 24rpx;
|
||||
border-top: 1rpx solid #FFFFFF;
|
||||
background-color: #FFFFFF;
|
||||
position: fixed;bottom: 0;left: 0;right: 0;
|
||||
display: flex;justify-content: space-around;align-items: center;
|
||||
}*/
|
||||
|
||||
/* 方案二 */
|
||||
.foot-boxtwo{
|
||||
height: 140rpx;
|
||||
font-size: 24rpx;
|
||||
border-top: 1rpx solid #FFFFFF;
|
||||
background-color: #FFFFFF;
|
||||
position: fixed;bottom: 0;left: 0;right: 0;z-index: 10;
|
||||
display: flex;flex-direction: column;justify-content: center;
|
||||
}
|
||||
.item-box{display: flex;justify-content: space-around;align-items: center;}
|
||||
.item-box>view{width: 25%;text-align: center;}
|
||||
.centerBox{display: flex;justify-content: center;align-items: center;}
|
||||
/* .centerBox-item{width: 124rpx;height: 124rpx;background-color: rgba(244, 244, 244, 1);margin-top: -100rpx;border-radius: 100%;display: flex;justify-content: center;align-items: center;} */
|
||||
.centerBox-item{width: 124rpx;height: 124rpx;margin-top: -100rpx;border-radius: 100%;display: flex;justify-content: center;align-items: center;}
|
||||
.centerImg{width: 112rpx;height: 112rpx;}
|
||||
|
||||
/* 公共 */
|
||||
.moImg{width: 64rpx;height: 64rpx;}
|
||||
.footactive{color: #000000;}
|
||||
.footmo{color: #999999;}
|
||||
</style>
|
|
@ -0,0 +1,59 @@
|
|||
<template>
|
||||
<view class="disjbac fw">
|
||||
<view @tap="chooseDoctor(index)" class="radius10 disjb fc bacf mar-x20" v-for="(item,index) in list" :key="index">
|
||||
<image :src="item.imgSrc" class="doctorImg" mode="aspectFill"></image>
|
||||
<view class="col3 mar-s10 mar-x20 mar-z10">
|
||||
<view class="fon28 bold doctoritem disac">{{item.name}}</view>
|
||||
<view class="fon26 mar-sx10 disac">
|
||||
<view>从业{{item.cyear}}年</view>
|
||||
<view v-if="item.bmen!=''" class="doctorx"></view>
|
||||
<view>{{item.bmen}}</view>
|
||||
</view>
|
||||
<view class="fon26 mar-x10">职称:{{item.zcheng}}</view>
|
||||
<view class="fon24 disac">
|
||||
<view class="flexs">擅长:</view>
|
||||
<scroll-view scroll-x style="width: 250rpx;">
|
||||
<view class="disac">
|
||||
<view class="flexs" v-for="(itemt,indext) in item.goodAt" :key="indext">
|
||||
<text class="bold mar-y10 pcol">{{itemt.disease_name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"list-doctor",
|
||||
props:{
|
||||
list:{
|
||||
type:Array,
|
||||
default:function(){
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
chooseDoctor(index){//选择医生事件
|
||||
console.log(this.list[index].id);
|
||||
if(this.list[index].show_detail==1){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/doctorDetail/doctorDetail?doctor_id='+this.list[index].id
|
||||
})
|
||||
} else this.$toolAll.tools.showToast('禁止查看该医生信息')
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,169 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="disjb fw" v-if="list.length!=0">
|
||||
<!-- 左侧列表 -->
|
||||
<view class="list-box">
|
||||
<view @tap="goDetail(index)" v-if="index%2==0" :class="radiu?'radius15 mar-x10':'radius30 mar-x30'" class="posir colf zou" v-for="(item,index) in list" :key="index">
|
||||
<!-- 背景图 -->
|
||||
<image :class="radiu?'radius15':'radius30'" class=" width100 list-min" :src="item.main_img" mode="widthFix"></image>
|
||||
<view class="posia list-like-box" @tap.stop="chooseLike(index)">
|
||||
<!-- 不喜欢 -->
|
||||
<image v-if="item.is_collected!=1" src="/static/public/no-like.png" mode="aspectFill"></image>
|
||||
<!-- 喜欢 -->
|
||||
<image v-else :class="item.is_collected==1?'bounceIn':'bounceOut'" class="animated" src="/static/public/like.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view v-if="item.main_img!=''" :class="radiu?'list-cont-box15':'list-cont-box'" class="posia fon20">
|
||||
<!-- 视频标题 -->
|
||||
<view class="fon30 bold mar-x10 disac" :style="{fontSize:nFon+'px'}">
|
||||
<view class="clips1">{{item.title}}</view>
|
||||
<text v-if="item.isVideo" :style="{fontSize:(nFon-2)+'px',marginLeft:nmarz+'px'}" style="border-radius: 5rpx;padding: 0 6rpx;text-align: center;" class="pbackc flexs">视频</text></view>
|
||||
<!-- 视频描述 -->
|
||||
<view class="mar-x10 clips1 opc">{{item.content}}</view>
|
||||
<view class="disac">
|
||||
<!-- 发布者头像 -->
|
||||
<image class="list-headimg" :src="item.head_img" mode="aspectFill"></image>
|
||||
<!-- 发布者昵称 -->
|
||||
<view class="clips1 opc">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<image v-if="item.isVideo" :style="{width:nWidth+'rpx',height:nHeight+'rpx'}" class="posia" style="top: 50%;left: 50%;transform: translate(-50%,-50%);" src="/static/public/video.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 右侧列表 -->
|
||||
<view class="list-box">
|
||||
<view @tap="goDetail(index)" v-if="index%2!=0" :class="radiu?'radius15 mar-x10':'radius30 mar-x30'" class="posir colf zou" v-for="(item,index) in list" :key="index">
|
||||
<!-- 背景图 -->
|
||||
<image :class="radiu?'radius15':'radius30'" class="width100 list-min" :src="item.main_img" mode="widthFix"></image>
|
||||
<view class="posia list-like-box" @tap.stop="chooseLike(index)">
|
||||
<!-- 不喜欢 -->
|
||||
<image v-if="item.is_collected!=1" src="/static/public/no-like.png" mode="aspectFill"></image>
|
||||
<!-- 喜欢 -->
|
||||
<image v-else :class="item.is_collected==1?'bounceIn':'bounceOut'" class="animated" src="/static/public/like.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view v-if="item.main_img!=''" :class="radiu?'list-cont-box15':'list-cont-box'" class="posia fon20 ">
|
||||
<!-- 视频标题 -->
|
||||
<view class="fon30 bold mar-x10 disac" :style="{fontSize:nFon+'px'}">
|
||||
<view class="clips1">{{item.title}}</view>
|
||||
<text v-if="item.isVideo" :style="{fontSize:(nFon-2)+'px',marginLeft:nmarz+'px'}" style="border-radius: 5rpx;padding: 0 6rpx;text-align: center;" class="pbackc flexs">视频</text>
|
||||
</view>
|
||||
<!-- 视频描述 -->
|
||||
<view class="mar-x10 clips1 opc">{{item.content}}</view>
|
||||
<view class="disac">
|
||||
<!-- 发布者头像 -->
|
||||
<image class="list-headimg" :src="item.head_img" mode="aspectFill"></image>
|
||||
<!-- 发布者昵称 -->
|
||||
<view class="clips1 opc">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<image v-if="item.isVideo" :style="{width:nWidth+'rpx',height:nHeight+'rpx'}" class="posia" style="top: 50%;left: 50%;transform: translate(-50%,-50%);" src="/static/public/video.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="" style="display: flex;flex-direction: column;align-items: center;">
|
||||
<image src="/static/public/nothing.png" style="width: 474rpx;height: 273rpx;" mode="aspectFill"></image>
|
||||
<view class="fon24 col3" style="margin-bottom: 60rpx;">暂无内容</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :contentVal="pu_content" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
<!-- 弹框授权 -->
|
||||
<empower :vision="vision" :isWhere="2" @cancleEv="cancleEv"></empower>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import empower from '@/components/empower.vue';
|
||||
export default {
|
||||
components:{
|
||||
empower
|
||||
},
|
||||
name:"list-pu",
|
||||
props:{
|
||||
list:{//数据
|
||||
type:Array,
|
||||
default:function(){
|
||||
return []
|
||||
}
|
||||
},
|
||||
nWidth:{
|
||||
type:String,
|
||||
default:'120'
|
||||
},
|
||||
nHeight:{
|
||||
type:String,
|
||||
default:'120'
|
||||
},
|
||||
nFon:{
|
||||
type:String,
|
||||
default:'15'
|
||||
},
|
||||
nmarz:{
|
||||
type:String,
|
||||
default:'10'
|
||||
},
|
||||
radiu:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
vision:false,
|
||||
isShowT:false,
|
||||
pu_content:'是否需要取消收藏?',
|
||||
current:'-1',
|
||||
jieDuan:false
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
cancleEv(e){
|
||||
if(e==0) this.vision = false
|
||||
},
|
||||
goDetail(index){//查看详情
|
||||
if(this.jieDuan==false){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.navigateTo({
|
||||
// url:'/pagesB/problemDetail/problemDetail?isCate='+this.list[index].isCate
|
||||
url:'/pagesB/problemDetail/problemDetail?id='+this.list[index].id+'&category_id='+this.list[index].category_id
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
},
|
||||
chooseLike(index){//喜欢不喜欢事件
|
||||
// console.log('喜欢不喜欢:',index);
|
||||
if(this.jieDuan==false){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
// this.$emit('chooseLike',this.list[index].id)
|
||||
this.$emit('chooseLike',index)
|
||||
this.current = index
|
||||
if(this.list[index].is_collected==1) {
|
||||
this.isShowT = true
|
||||
} else {
|
||||
let maiOjb = {
|
||||
e:3,//内容收藏
|
||||
c:this.list[index].id,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
},
|
||||
comfirmev(){
|
||||
// console.log('取消收藏成功');
|
||||
// this.$emit('comfirmev',this.list[this.current].id)
|
||||
this.$emit('comfirmev',this.current)
|
||||
this.isShowT = false
|
||||
},
|
||||
cancleev(){
|
||||
// console.log('关闭弹框');
|
||||
this.isShowT = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,61 @@
|
|||
<template>
|
||||
<text :style="{ color: color, 'font-size': size + 'rpx' }" :class="{isTheme:isTheme}" class="lw-icons"
|
||||
@click="_onClick">{{icons[icon]}}</text>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import icons from './icons.js';
|
||||
// #ifdef APP-NVUE
|
||||
var domModule = weex.requireModule('dom');
|
||||
domModule.addRule('fontFace', {
|
||||
'fontFamily': 'iconfont',
|
||||
'src': 'url(\'https://at.alicdn.com/t/font_2294175_vq7ymlkpbtm.ttf\')',
|
||||
});
|
||||
// #endif
|
||||
export default {
|
||||
name: 'UniIcons',
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#333333'
|
||||
},
|
||||
size: {
|
||||
type: [Number, String],
|
||||
default: 50
|
||||
},
|
||||
isTheme: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
icons: icons
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
_onClick() {
|
||||
this.$emit('click')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* #ifndef APP-NVUE */
|
||||
@font-face {
|
||||
font-family: iconfont;
|
||||
src: url('https://at.alicdn.com/t/font_2294175_vq7ymlkpbtm.ttf')
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
.lw-icons {
|
||||
font-family: iconfont;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,6 @@
|
|||
export default {
|
||||
'aixin':'\ue8ab',
|
||||
'rules':'\ue909',
|
||||
'sound':'\ue8ea',
|
||||
'arrowright':'\uee02'
|
||||
}
|
|
@ -0,0 +1,373 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="contentBox" v-if="list.length" @click="toEmit()"
|
||||
:style="'color:' + color + ';background-color:' + backgroundColor + ';height:' + height+'rpx;'">
|
||||
<view v-if="showIcon" class="supBox">
|
||||
<lwIcon :size="32" :color="iconColor" icon="sound"></lwIcon>
|
||||
</view>
|
||||
<view v-if="list.length > 1" class="content">
|
||||
<view v-for="(item, index) in list" :key="index" @tap.stop="dangGao(index)">
|
||||
<view class="loopItemBase" :class="index==0&&firstIn?'fistInClass':''"
|
||||
:animation="realAnimation(index)" v-if="aindexArr.includes(index)"
|
||||
:style="'line-height:'+height+'rpx;'">
|
||||
{{ item }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="list.length == 1" class="content">
|
||||
<view :style="'line-height:'+height+'rpx;'" @tap.stop="dangGao(0)" class="loopItemBaseShow">{{ list[0] }}</view>
|
||||
</view>
|
||||
<view v-if="showMore" class="offBox">
|
||||
<lwIcon :size="32" :color="moreColor" icon="arrowright"></lwIcon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/*
|
||||
lw-notice公告上下轮询组件(组件内依赖了自有的字体图标组件,可自行替换为uni或自身项目的图标组件)
|
||||
color:字体颜色
|
||||
backgroundColor:背景色
|
||||
list:要循环的列表数据
|
||||
height:组件高度
|
||||
showScale:是否有缩放动画
|
||||
runTime:间隔切换时间
|
||||
showIcon:是否显示头部小喇叭
|
||||
iconColor:小喇叭的颜色
|
||||
showMore:是否显示尾部更多
|
||||
moreColor:显示更多的颜色
|
||||
*/
|
||||
import lwIcon from './iconFont.vue'
|
||||
export default {
|
||||
components: {
|
||||
lwIcon
|
||||
},
|
||||
props: {
|
||||
color: {
|
||||
type: String,
|
||||
default: '#666666'
|
||||
},
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default: '#f5f5f5'
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default: function(){
|
||||
return []
|
||||
}
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 80
|
||||
},
|
||||
showScale: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
runTime: {
|
||||
type: Number,
|
||||
default: 4000
|
||||
},
|
||||
showIcon: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showMore: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
iconColor: {
|
||||
type: String,
|
||||
default: '#aaaaaa'
|
||||
},
|
||||
moreColor: {
|
||||
type: String,
|
||||
default: '#aaaaaa'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 第一次展示
|
||||
firstIn: true,
|
||||
// 当前显示的项
|
||||
aindexArr: [],
|
||||
// 创建动画的实例
|
||||
animation: null,
|
||||
// 动画对象一
|
||||
animationData: null,
|
||||
// 动画对象二
|
||||
animationDataTwo: null,
|
||||
// 显示项和动画之间的映射关系
|
||||
indexLinkAnimationObj: {},
|
||||
setTimerOne: null,
|
||||
setTimerTwo: null,
|
||||
setTimerThree: null,
|
||||
setTimerFour: null,
|
||||
setTimerFive: null
|
||||
};
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.resetPage()
|
||||
},
|
||||
computed: {
|
||||
// 计算展示项应该展示的动画
|
||||
realAnimation() {
|
||||
return function(value) {
|
||||
if (this.indexLinkAnimationObj[value]) {
|
||||
return this[this.indexLinkAnimationObj[value]]
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 开始 按3000毫秒的运行示例图
|
||||
// 1.a显示 执行动画1 锁定动画1 0ms
|
||||
// 2.b显示 执行动画2 锁定动画2 200ms
|
||||
// 3.a隐藏 停止动画1 释放动画1 300ms
|
||||
// 4.c显示 执行动画1 锁定动画1 400ms
|
||||
// 5.b隐藏 停止动画2 释放动画2 500ms
|
||||
// 6.a显示 执行动画2 锁定动画2 600ms
|
||||
// 7.c隐藏 停止动画1 释放动画1 700ms
|
||||
// 8.b显示 执行动画1 锁定动画1 800ms
|
||||
// 9.a隐藏 停止动画2 释放动画2 900ms
|
||||
// 10.c显示 执行动画2 锁定动画2 1000ms
|
||||
initPage() {
|
||||
this.resetPage();
|
||||
if (this.list && this.list.length) {
|
||||
if (this.list.length > 1) {
|
||||
this.aindexArr.push(0);
|
||||
this.animation = uni.createAnimation({
|
||||
timingFunction: 'linear',
|
||||
})
|
||||
// #ifdef H5
|
||||
this.animationDataH5 = this.animation.translateY(-100).step({
|
||||
duration: 10000
|
||||
}).export()
|
||||
// #endif
|
||||
this.runAnimation(0, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 重置页面动画
|
||||
resetPage() {
|
||||
// 移除所有定时器
|
||||
clearTimeout(this.setTimerOne);
|
||||
clearTimeout(this.setTimerTwo);
|
||||
clearTimeout(this.setTimerThree);
|
||||
clearTimeout(this.setTimerFour);
|
||||
clearTimeout(this.setTimerFive);
|
||||
// 重置页面属性
|
||||
this.aindexArr = [];
|
||||
this.animation = null;
|
||||
this.animationData = null;
|
||||
this.animationDataTwo = null;
|
||||
this.indexLinkAnimationObj = {};
|
||||
},
|
||||
// 执行动画方法(此方法内不要清除赋值的定时器)
|
||||
runAnimation(value, firstIn) {
|
||||
let that = this;
|
||||
if (!firstIn) {
|
||||
that.aindexArr.push(value);
|
||||
}
|
||||
// 获取执行动画对象
|
||||
let lockText = that.createAni(firstIn);
|
||||
// 延迟50毫秒执行(等待dom渲染)
|
||||
that.setTimerOne = setTimeout(() => {
|
||||
// 创建执行动画和执行方之间的映射关系
|
||||
that.indexLinkAnimationObj[value] = lockText;
|
||||
// console.log('已经创建完成绑定关系')
|
||||
// console.log(that.indexLinkAnimationObj)
|
||||
// 获取基础执行时间单位
|
||||
let unitRunTime = (that.runTime - 50) / 6;
|
||||
let waitTime = firstIn ? unitRunTime * 4 : unitRunTime * 5;
|
||||
let waitTimeTwo = firstIn ? (that.runTime - unitRunTime) : that.runTime;
|
||||
// #ifdef H5
|
||||
waitTimeTwo = firstIn ? (that.runTime - (1.5 * unitRunTime)) : that.runTime;
|
||||
//H5重新刷新一下动画绑定关系
|
||||
if (firstIn) {
|
||||
that.aindexArr.splice(0, 1);
|
||||
that.aindexArr.push(0);
|
||||
}
|
||||
// #endif
|
||||
|
||||
// 开启下一个动画
|
||||
that.setTimerTwo = setTimeout(() => {
|
||||
let Index = value == that.list.length - 1 ? 0 : value + 1;
|
||||
that.runAnimation(Index)
|
||||
}, waitTime)
|
||||
// 释放上一个执行方
|
||||
that.setTimerThree = setTimeout(() => {
|
||||
let index = that.aindexArr.indexOf(value);
|
||||
that.aindexArr.splice(index, 1)
|
||||
that.firstIn = false;
|
||||
delete that.indexLinkAnimationObj[value]
|
||||
}, waitTimeTwo)
|
||||
}, 50)
|
||||
},
|
||||
// 创建动画方法
|
||||
createAni(firstIn) {
|
||||
let that = this;
|
||||
let unitRunTime = (that.runTime - 50) / 6;
|
||||
|
||||
let delayTime = unitRunTime * 4;
|
||||
let durationTime = unitRunTime;
|
||||
let dispairTime = unitRunTime;
|
||||
// #ifdef H5
|
||||
delayTime = unitRunTime * 3.5;
|
||||
dispairTime = unitRunTime * 1.5;
|
||||
// #endif
|
||||
|
||||
let showTransformHeight = -uni.upx2px(that.height);
|
||||
let hideTransformHeight = showTransformHeight * 2;
|
||||
// 创建动画
|
||||
if (that.showScale) {
|
||||
if (firstIn) {
|
||||
// that.animation.translateY(1).scale(1,1).step({ duration: 5 });
|
||||
that.animation.translateY(showTransformHeight).scale(0.5, 0.5).step({
|
||||
delay: delayTime,
|
||||
duration: dispairTime
|
||||
});
|
||||
} else {
|
||||
that.animation.translateY(showTransformHeight).scale(1, 1).step({
|
||||
duration: durationTime
|
||||
});
|
||||
that.animation.translateY(hideTransformHeight).scale(0.5, 0.5).step({
|
||||
delay: delayTime,
|
||||
duration: dispairTime
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (firstIn) {
|
||||
// that.animation.translateY(1).step({ duration: 5 });
|
||||
that.animation.translateY(showTransformHeight).step({
|
||||
delay: delayTime,
|
||||
duration: dispairTime
|
||||
});
|
||||
} else {
|
||||
that.animation.translateY(showTransformHeight).step({
|
||||
duration: durationTime
|
||||
});
|
||||
that.animation.translateY(hideTransformHeight).step({
|
||||
delay: delayTime,
|
||||
duration: dispairTime
|
||||
});
|
||||
}
|
||||
}
|
||||
// 判断动画赋值项并赋值
|
||||
if (!that.animationData) {
|
||||
that.animationData = that.animation.export()
|
||||
that.setTimerFour = setTimeout(() => {
|
||||
clearTimeout(that.setTimerFour)
|
||||
that.animationData = false;
|
||||
}, that.runTime)
|
||||
return 'animationData'
|
||||
} else {
|
||||
that.animationDataTwo = that.animation.export()
|
||||
that.setTimerFive = setTimeout(() => {
|
||||
clearTimeout(that.setTimerFive)
|
||||
that.animationDataTwo = false;
|
||||
}, that.runTime)
|
||||
return 'animationDataTwo'
|
||||
}
|
||||
},
|
||||
// 抛出点击事件
|
||||
toEmit() {
|
||||
let that = this
|
||||
if (that.list.length == 1) {
|
||||
that.$emit('itemClick', that.list[0])
|
||||
} else {
|
||||
that.$emit('itemClick', that.list[that.aindexArr[0]])
|
||||
}
|
||||
},
|
||||
dangGao(index){
|
||||
let that = this
|
||||
if (that.list.length != 0) {
|
||||
that.$emit('dangGao', index)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
// 判断list有值后开启动画
|
||||
// setTimeout()
|
||||
this.initPage()
|
||||
},
|
||||
watch: {
|
||||
list(value) {
|
||||
this.initPage()
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.contentBox {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
// padding: 0 20rpx;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
font-size: 24rpx;
|
||||
.supBox {
|
||||
width: 50rpx;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.offBox {
|
||||
width: 50rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
flex-grow: 1;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
justify-content: center;
|
||||
|
||||
.loopItemBase {
|
||||
left: 0;
|
||||
top: 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
font-size: 28rpx;
|
||||
text-align: left;
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
&.fistInClass {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.loopItemBaseShow {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
font-size: 28rpx;
|
||||
text-align: left;
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
align-items: center;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,36 @@
|
|||
<template>
|
||||
<view class="nothing">
|
||||
<view class="nothing-box">
|
||||
<image :src="imgSrc" mode="aspectFill"></image>
|
||||
<view class="nothing-con">{{content}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"nothing-page",
|
||||
props:{
|
||||
imgSrc:{
|
||||
type:String,
|
||||
default:'/static/public/nothing.png'
|
||||
},
|
||||
content:{
|
||||
type:String,
|
||||
default:'暂无内容'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.nothing{position: fixed;top: 0;right: 0;left: 0;bottom: 0;display: flex;justify-content: center;align-items: center;}
|
||||
.nothing-box{display: flex;justify-content: center;flex-direction: column;align-items: center;}
|
||||
.nothing-box>image{width: 474rpx;height: 273rpx;}
|
||||
.nothing-con{font-size: 24rpx;font-family: PingFang SC;font-weight: 500;line-height: 33rpx;color: #333333;text-align: center;}
|
||||
</style>
|
|
@ -0,0 +1,53 @@
|
|||
<template>
|
||||
<view>
|
||||
<view @tap="lianK" :style="{background:publicColor,right:nright+'rpx',bottom:nbottom+'rpx'}" :class="isSmall?'smallImg':''" class="fw posir" style="position: fixed;z-index: 2; width: 120rpx;height: 120rpx;border-radius: 100%;display: flex;justify-content: center;align-items: center;box-shadow: 0rpx 0rpx 20rpx rgba(0,0,0,.22);">
|
||||
<image class="posia" src="/static/public/btnKF.png" style="width: 50rpx;height: 50rpx;top: 20rpx;" mode=""></image>
|
||||
<view class="colf fon20 posia" style="bottom: 20rpx;">在线客服</view>
|
||||
<button class="fon24 posia" style="opacity: 0;top: 0;left: 0;right: 0;bottom: 0;" open-type="contact">客服</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"public-customer",
|
||||
props:{
|
||||
nright:{//距离右边多宽
|
||||
type:Number,
|
||||
default:30
|
||||
},
|
||||
nbottom:{//距离底部多高
|
||||
type:Number,
|
||||
default:260
|
||||
},
|
||||
isSmall:{//是否是大图
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
nid:{//内容id
|
||||
type:String,
|
||||
default:'0'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
lianK(){
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:this.nid}).then(res=>{},error=>{})
|
||||
let maiOjb = {
|
||||
e:5,//内容咨询
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.smallImg{transform: scale(.8);margin-right: -10rpx;}
|
||||
</style>
|
|
@ -0,0 +1,92 @@
|
|||
<template>
|
||||
<view v-if="isShowT" class="disjcac posAll">
|
||||
<view class="bacf radius20 width100 tank-box">
|
||||
<view v-if="isXiala" class="pad-x20">
|
||||
<view class="mar-s30 mar-x40 tc">请选择客服</view>
|
||||
<view @tap="openXia" class="disjbac radius10 pad-zy20 mar-zy20 xialak mar-x50 posir">
|
||||
<view class="col3">{{category[current].title}}</view>
|
||||
<image :class="isZhuan?'zhuan':'nozhuan'" src="/static/public/sanj.png" mode="aspectFill"></image>
|
||||
<!-- 下拉列表 -->
|
||||
<view v-if="isZhuan" class="posia bacf radius10 xial-box">
|
||||
<view class="pad-zy20 xial-item-box">
|
||||
<view @tap="chooseXia(index)" :class="current==index?'pcol':''" v-for="(item,index) in category" :key="index">{{item.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="tc tank-box-itemone">{{contentVal}}</view>
|
||||
<view :class="isCenter?'disjcac':'disjb'" class="fon28 colf pad-x30 pad-zy30 tc">
|
||||
<view @tap="cancleEv" v-if="!isCenter" class="pad-sx20 radius10 tank-btn" style="background-color: rgba(230, 230, 230,1);color: #000000;">{{clearVal}}</view>
|
||||
<view @tap="comfirEv" :style="{background:publicColor}" class="pad-sx20 radius10 tank-btn">{{comfrimVal}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"pupo",
|
||||
props:{
|
||||
isShowT:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
isCenter:{//按钮是否居中,或只显示蓝色按钮
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
contentVal:{
|
||||
type:String,
|
||||
default:'是否清除历史搜索?'
|
||||
},
|
||||
clearVal:{//取消文本
|
||||
type:String,
|
||||
default:'取消'
|
||||
},
|
||||
comfrimVal:{//确认文本
|
||||
type:String,
|
||||
default:'确认'
|
||||
},
|
||||
isXiala:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
category:{
|
||||
type:Array,
|
||||
default:function(){
|
||||
return ['许嵩']
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
isZhuan:false,
|
||||
current:0
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
comfirEv(){//确认事件
|
||||
this.isZhuan = false
|
||||
this.current = 0
|
||||
this.$emit('comfirmev')
|
||||
},
|
||||
cancleEv(){//取消事件
|
||||
this.isZhuan = false
|
||||
this.current = 0
|
||||
this.$emit('cancleev')
|
||||
},
|
||||
chooseXia(index){
|
||||
this.current = index
|
||||
this.$emit('chooseXiaT',this.category[index])
|
||||
},
|
||||
openXia(){
|
||||
this.isZhuan = !this.isZhuan
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,142 @@
|
|||
<template>
|
||||
<view class="htz-rate-main">
|
||||
<template v-for="(item,index) in count">
|
||||
<image @tap="checkItem((index+1))" class="htz-rate-image" :key="index"
|
||||
:style="{'width':size+'rpx','height':size+'rpx','padding-right':gutter+'rpx'}"
|
||||
:src="checkedVal<(index+1)?defImgSrc:selImgSrc"></image>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'htz-rate',
|
||||
props: {
|
||||
value: { //受控分值
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
count: { //数量
|
||||
type: Number,
|
||||
default: 5,
|
||||
},
|
||||
size: { //图标大小
|
||||
type: Number,
|
||||
default: 42,
|
||||
},
|
||||
gutter: { //图标间距
|
||||
type: Number,
|
||||
default: 15,
|
||||
},
|
||||
type: { //内置类型
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
disHref: { //自定义默认图片
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
checkedHref: { //自定义选中图片
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
readonly: { //是否只读
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ImgData: ['/static/img/rate/rate1_0.png', '/static/img/rate/rate2_0.png',
|
||||
'/static/img/rate/rate3_0.png', '/static/img/rate/rate4_0.png', '/static/img/rate/rate5_0.png',
|
||||
'/static/img/rate/rate6_0.png'
|
||||
],
|
||||
defImgSrc: '',
|
||||
selImgSrc: '',
|
||||
checkedVal: 0,
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.$nextTick(function() {
|
||||
this.checkedVal = this.value;
|
||||
if (this.disHref != '') {
|
||||
this.defImgSrc = this.disHref;
|
||||
this.selImgSrc = this.checkedHref;
|
||||
} else {
|
||||
//if (this.type != undefined) {
|
||||
this.defImgSrc = this.ImgData[this.type];
|
||||
this.selImgSrc = this.ImgData[this.type].replace('_0', '_1');
|
||||
//}
|
||||
}
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
value(val, oldVal) {
|
||||
this.checkedVal = this.value;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
checkItem(index) {
|
||||
if (!this.readonly) {
|
||||
this.checkedVal = index;
|
||||
this.$emit('input', index);
|
||||
this.$emit('change', index);
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.htz-rate-main {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.htz-rate-image {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
||||
.htz-image-upload-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.htz-image-upload-Item {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin: 13rpx;
|
||||
border-radius: 10rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.htz-image-upload-Item image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.htz-image-upload-Item-add {
|
||||
font-size: 105rpx;
|
||||
/* line-height: 160rpx; */
|
||||
text-align: center;
|
||||
border: 1px dashed #d9d9d9;
|
||||
color: #d9d9d9;
|
||||
}
|
||||
|
||||
.htz-image-upload-Item-del {
|
||||
background-color: #f5222d;
|
||||
font-size: 24rpx;
|
||||
position: absolute;
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
line-height: 35rpx;
|
||||
text-align: center;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,42 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="showShare" @tap="closeShare" style="position: fixed;top: 0;right: 0;left: 0;bottom: 0;background-color: rgba(0,0,0,.5);z-index: 10;">
|
||||
</view>
|
||||
<view v-if="showShare" style="display: flex;flex-direction: column;justify-content: space-around;
|
||||
position: fixed;bottom: 0;left: 0;right: 0;z-index: 100; background-color: #FFFFFF;padding: 40rpx;">
|
||||
<view class="posir" v-for="(item,index) in cateArr" :key="index" style="display: flex;justify-content: center;align-items: center;flex-direction: column;width: 25%;">
|
||||
<image style="width: 100rpx;height: 100rpx;margin-bottom: 10rpx;" :src="item.src" mode=""></image>
|
||||
<view class="fon28 color33">{{item.title}}</view>
|
||||
<button data-name="shareBtn" open-type="share" plain="true" class="posia" style="top: 0;left: 0;right: 0;bottom: 0;opacity: 0;">分享</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:'shareAll',
|
||||
props:{
|
||||
showShare:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cateArr:[
|
||||
{src:'/static/img/share/weix.png',title:'微信好友'},
|
||||
]
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
closeShare(){
|
||||
this.$emit('closeShare')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,121 @@
|
|||
<template>
|
||||
<view class="pad20 shop_list_box">
|
||||
<view style="width: 48.6%;float: left;">
|
||||
<view class="bacf radius15 mar-x20" @tap="goPage">
|
||||
<image src="../../../static/public/wen-one.png" mode="aspectFill" style="width: 100%;border-top-left-radius: 15rpx;border-top-right-radius: 15rpx;height: 325rpx;"></image>
|
||||
<view class="pad-zy20 pad-s10 pad-x30">
|
||||
<view class="fon28 bold col3 clips2">【99皮皮节】【种植发际 线】1000单位FUE技术...</view>
|
||||
<view class="disac fon20 mar-sx20">
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;margin-right: 10rpx;" :style="{background:publicColor}">秃顶种植</view>
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;background: #F85050;">团购</view>
|
||||
</view>
|
||||
<view class="disac">
|
||||
<view class="fon28 bold" style="color: #F85050;margin-right: 8rpx;">¥3888</view>
|
||||
<view class="fon24" style="text-decoration: line-through;color: #C7C7C7;">¥4205</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bacf radius15 mar-x20">
|
||||
<image src="../../../static/public/wen-one.png" mode="aspectFill" style="width: 100%;border-top-left-radius: 15rpx;border-top-right-radius: 15rpx;height: 325rpx;"></image>
|
||||
<view class="pad-zy20 pad-s10 pad-x30">
|
||||
<view class="fon28 bold col3 clips2">【99皮皮节】【种植发际 线】1000单位FUE技术...</view>
|
||||
<view class="disac fon20 mar-sx20">
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;margin-right: 10rpx;" :style="{background:publicColor}">秃顶种植</view>
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;background: #F85050;">团购</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="disjbac">
|
||||
<view class="fon28 bold" style="color: #F85050;margin-right: 8rpx;">拼团价¥3888</view>
|
||||
<view class="fon24" style="text-decoration: line-through;color: #C7C7C7;">¥4205</view>
|
||||
</view>
|
||||
<view class="disjbac mar-s20">
|
||||
<view class="fon24 col80">已拼团10组</view>
|
||||
<view class="disac">
|
||||
<image src="../../../static/tabbar/mya.png" mode="" style="width: 40rpx;height: 40rpx;border-radius: 100%;"></image>
|
||||
<image src="../../../static/tabbar/mym.png" mode="" style="width: 40rpx;height: 40rpx;border-radius: 100%;margin-left: -20rpx;"></image>
|
||||
<image src="../../../static/tabbar/homeAc.png" mode="" style="width: 40rpx;height: 40rpx;border-radius: 100%;margin-left: -20rpx;"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bacf radius15 mar-x20">
|
||||
<image src="../../../static/public/wen-one.png" mode="aspectFill" style="width: 100%;border-top-left-radius: 15rpx;border-top-right-radius: 15rpx;height: 325rpx;"></image>
|
||||
<view class="pad-zy20 pad-s10 pad-x30">
|
||||
<view class="fon28 bold col3 clips2">【99皮皮节】【种植发际 线】1000单位FUE技术...</view>
|
||||
<view class="disac fon20 mar-sx20">
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;margin-right: 10rpx;" :style="{background:publicColor}">秃顶种植</view>
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;background: #F85050;">团购</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="disjbac">
|
||||
<view class="fon28 bold" style="color: #F85050;margin-right: 8rpx;">促销价¥3888</view>
|
||||
<view class="fon24" style="text-decoration: line-through;color: #C7C7C7;">¥4205</view>
|
||||
</view>
|
||||
<view class="fon24 col80 mar-s20">结束时间:15小时00分00秒</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: 48.6%;float: right;">
|
||||
<view class="bacf radius15 mar-x20">
|
||||
<image src="../../../static/public/wen-one.png" mode="aspectFill" style="width: 100%;border-top-left-radius: 15rpx;border-top-right-radius: 15rpx;height: 325rpx;"></image>
|
||||
<view class="pad-zy20 pad-s10 pad-x30">
|
||||
<view class="fon28 bold col3 clips2">【99皮皮节】【种植发际 线】1000单位FUE技术...</view>
|
||||
<view class="disac fon20 mar-sx20">
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;margin-right: 10rpx;" :style="{background:publicColor}">秃顶种植</view>
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;background: #F85050;">团购</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="disjbac">
|
||||
<view class="fon28 bold" style="color: #F85050;margin-right: 8rpx;">拼团价¥3888</view>
|
||||
<view class="fon24" style="text-decoration: line-through;color: #C7C7C7;">¥4205</view>
|
||||
</view>
|
||||
<view class="disjbac">
|
||||
<view class="fon24 col80">已拼团10组</view>
|
||||
<view>
|
||||
<image src="" mode="" style="width: 40rpx;height: 40rpx;"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bacf radius15 mar-x20">
|
||||
<image src="../../../static/public/wen-one.png" mode="aspectFill" style="width: 100%;border-top-left-radius: 15rpx;border-top-right-radius: 15rpx;height: 325rpx;"></image>
|
||||
<view class="pad-zy20 pad-s10 pad-x30">
|
||||
<view class="fon28 bold col3 clips2">【99皮皮节】【种植发际 线】1000单位FUE技术...</view>
|
||||
<view class="disac fon20 mar-sx20">
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;margin-right: 10rpx;" :style="{background:publicColor}">秃顶种植</view>
|
||||
<view class="radius10 colf" style="padding: 6rpx 10rpx;background: #F85050;">团购</view>
|
||||
</view>
|
||||
<view class="disac">
|
||||
<view class="fon28 bold" style="color: #F85050;margin-right: 8rpx;">¥3888</view>
|
||||
<view class="fon24" style="text-decoration: line-through;color: #C7C7C7;">¥4205</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"shop-list",
|
||||
data() {
|
||||
return {
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
goPage(){//进入商品详情事件
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/shopDetail/shopDetail'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,143 @@
|
|||
/* eslint-disable */
|
||||
var provinceData = [{
|
||||
"label": "北京市",
|
||||
"value": "11"
|
||||
},
|
||||
{
|
||||
"label": "天津市",
|
||||
"value": "12"
|
||||
},
|
||||
{
|
||||
"label": "河北省",
|
||||
"value": "13"
|
||||
},
|
||||
{
|
||||
"label": "山西省",
|
||||
"value": "14"
|
||||
},
|
||||
{
|
||||
"label": "内蒙古自治区",
|
||||
"value": "15"
|
||||
},
|
||||
{
|
||||
"label": "辽宁省",
|
||||
"value": "21"
|
||||
},
|
||||
{
|
||||
"label": "吉林省",
|
||||
"value": "22"
|
||||
},
|
||||
{
|
||||
"label": "黑龙江省",
|
||||
"value": "23"
|
||||
},
|
||||
{
|
||||
"label": "上海市",
|
||||
"value": "31"
|
||||
},
|
||||
{
|
||||
"label": "江苏省",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"label": "浙江省",
|
||||
"value": "33"
|
||||
},
|
||||
{
|
||||
"label": "安徽省",
|
||||
"value": "34"
|
||||
},
|
||||
{
|
||||
"label": "福建省",
|
||||
"value": "35"
|
||||
},
|
||||
{
|
||||
"label": "江西省",
|
||||
"value": "36"
|
||||
},
|
||||
{
|
||||
"label": "山东省",
|
||||
"value": "37"
|
||||
},
|
||||
{
|
||||
"label": "河南省",
|
||||
"value": "41"
|
||||
},
|
||||
{
|
||||
"label": "湖北省",
|
||||
"value": "42"
|
||||
},
|
||||
{
|
||||
"label": "湖南省",
|
||||
"value": "43"
|
||||
},
|
||||
{
|
||||
"label": "广东省",
|
||||
"value": "44"
|
||||
},
|
||||
{
|
||||
"label": "广西壮族自治区",
|
||||
"value": "45"
|
||||
},
|
||||
{
|
||||
"label": "海南省",
|
||||
"value": "46"
|
||||
},
|
||||
{
|
||||
"label": "重庆市",
|
||||
"value": "50"
|
||||
},
|
||||
{
|
||||
"label": "四川省",
|
||||
"value": "51"
|
||||
},
|
||||
{
|
||||
"label": "贵州省",
|
||||
"value": "52"
|
||||
},
|
||||
{
|
||||
"label": "云南省",
|
||||
"value": "53"
|
||||
},
|
||||
{
|
||||
"label": "西藏自治区",
|
||||
"value": "54"
|
||||
},
|
||||
{
|
||||
"label": "陕西省",
|
||||
"value": "61"
|
||||
},
|
||||
{
|
||||
"label": "甘肃省",
|
||||
"value": "62"
|
||||
},
|
||||
{
|
||||
"label": "青海省",
|
||||
"value": "63"
|
||||
},
|
||||
{
|
||||
"label": "宁夏回族自治区",
|
||||
"value": "64"
|
||||
},
|
||||
{
|
||||
"label": "新疆维吾尔自治区",
|
||||
"value": "65"
|
||||
},
|
||||
{
|
||||
"label": "台湾",
|
||||
"value": "66"
|
||||
},
|
||||
{
|
||||
"label": "香港",
|
||||
"value": "67"
|
||||
},
|
||||
{
|
||||
"label": "澳门",
|
||||
"value": "68"
|
||||
},
|
||||
{
|
||||
"label": "钓鱼岛",
|
||||
"value": "69"
|
||||
}
|
||||
]
|
||||
export default provinceData;
|
|
@ -0,0 +1,420 @@
|
|||
<template>
|
||||
<view class="simple-address" v-if="showPopup" @touchmove.stop.prevent="clear">
|
||||
<!-- 遮罩层 -->
|
||||
<view
|
||||
class="simple-address-mask"
|
||||
@touchmove.stop.prevent="clear"
|
||||
v-if="maskClick"
|
||||
:class="[ani + '-mask', animation ? 'mask-ani' : '']"
|
||||
:style="{
|
||||
'background-color': maskBgColor
|
||||
}"
|
||||
@tap="hideMask(true)"
|
||||
></view>
|
||||
|
||||
<view class="simple-address-content simple-address--fixed" :class="[type, ani + '-content', animation ? 'content-ani' : '']">
|
||||
<view class="simple-address__header">
|
||||
<view class="simple-address__header-btn-box" @click="pickerCancel">
|
||||
<text class="simple-address__header-text" :style="{ color: cancelColor, fontSize: btnFontSize }">取消</text>
|
||||
</view>
|
||||
<view class="simple-address__header-btn-box" @click="pickerConfirm">
|
||||
<text class="simple-address__header-text" :style="{ color: confirmColor || themeColor, fontSize: btnFontSize }">确定</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="simple-address__box">
|
||||
<picker-view indicator-style="height: 70rpx;" class="simple-address-view" :value="pickerValue" @change="pickerChange">
|
||||
<picker-view-column>
|
||||
<!-- #ifndef APP-NVUE -->
|
||||
<view class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in provinceDataList" :key="index">{{ item.label }}</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef APP-NVUE -->
|
||||
<text class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in provinceDataList" :key="index">{{ item.label }}</text>
|
||||
<!-- #endif -->
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<!-- #ifndef APP-NVUE -->
|
||||
<view class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in cityDataList" :key="index">{{ item.label }}</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef APP-NVUE -->
|
||||
<text class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in cityDataList" :key="index">{{ item.label }}</text>
|
||||
<!-- #endif -->
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<!-- #ifndef APP-NVUE -->
|
||||
<view class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in areaDataList" :key="index">{{ item.label }}</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef APP-NVUE -->
|
||||
<text class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in areaDataList" :key="index">{{ item.label }}</text>
|
||||
<!-- #endif -->
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* Simple-addres 地址联动组件
|
||||
* @description 三级地址联动,支持(app)nvue、小程序、H5
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=1084
|
||||
* @property {String} animation 是否开启动画
|
||||
* @property {String} type = [bottom] 弹出层类型,暂时只支持底部弹出
|
||||
* @property {Boolean} maskClick = [true | false] 是否允许点击遮罩层关闭
|
||||
* @property {Boolean} show = [true | false] 显示或隐藏地址组件
|
||||
* @property {String} maskBgColor 遮罩层背景颜色
|
||||
* @property {String} cancelColor 取消按钮颜色,默认为:#1aad19
|
||||
* @property {String} confirmColor 确认按钮颜色,默认为:themeColor
|
||||
* @property {String} themeColor 主题颜色,后续会废弃该配置,建议使用`cancelColor`或`confirmColor`
|
||||
* @property {String} btnFontSize 取消、确认按钮字体大小,默认为`uni.scss里的 $uni-font-size-base `
|
||||
* @property {String} fontSize picker-item字体大小,默认为:28rpx
|
||||
* @property {Array} pickerValueDefault 默认值,可以通过function queryIndex 获取
|
||||
* @property {Function} queryIndex 根据自定义信息返回对应的index
|
||||
* @property {Function} open 打开
|
||||
* @example <simple-address ref="simpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm" themeColor='#007AFF'></simple-address>
|
||||
*/
|
||||
|
||||
import provinceData from './city-data/province.js';
|
||||
import cityData from './city-data/city.js';
|
||||
import areaData from './city-data/area.js';
|
||||
export default {
|
||||
name: 'simpleAddress',
|
||||
props: {
|
||||
mode: {
|
||||
// 地址类型
|
||||
// default 则代表老版本根据index索引获取数据
|
||||
//
|
||||
type: String,
|
||||
default: 'default'
|
||||
},
|
||||
// 开启动画
|
||||
animation: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
/* 弹出层类型,可选值;
|
||||
bottom:底部弹出层
|
||||
*/
|
||||
type: {
|
||||
type: String,
|
||||
default: 'bottom'
|
||||
},
|
||||
// maskClick
|
||||
maskClick: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
maskBgColor: {
|
||||
type: String,
|
||||
default: 'rgba(0, 0, 0, 0.4)' //背景颜色 rgba(0, 0, 0, 0.4) 为空则调用 uni.scss
|
||||
},
|
||||
themeColor: {
|
||||
type: String,
|
||||
default: '' // 确认按钮颜色(向下兼容)
|
||||
},
|
||||
cancelColor: {
|
||||
type: String,
|
||||
default: '' // 取消按钮颜色
|
||||
},
|
||||
confirmColor: {
|
||||
type: String,
|
||||
default: '' // 确认按钮颜色
|
||||
},
|
||||
fontSize: {
|
||||
type: String,
|
||||
default: '28rpx' // picker-item字体大小
|
||||
},
|
||||
btnFontSize: {
|
||||
type: String,
|
||||
default: '' // 按钮的字体大小
|
||||
},
|
||||
/* 默认值 */
|
||||
pickerValueDefault: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ani: '',
|
||||
showPopup: false,
|
||||
pickerValue: [0, 0, 0],
|
||||
provinceDataList: [],
|
||||
cityDataList: [],
|
||||
areaDataList: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
show(newValue) {
|
||||
if (newValue) {
|
||||
this.open();
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
pickerValueDefault() {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.handPickValueDefault(); // 对 pickerValueDefault 做兼容处理
|
||||
this.provinceDataList = provinceData;
|
||||
this.cityDataList = cityData[this.pickerValueDefault[0]];
|
||||
this.areaDataList = areaData[this.pickerValueDefault[0]][this.pickerValueDefault[1]];
|
||||
this.pickerValue = this.pickerValueDefault;
|
||||
},
|
||||
handPickValueDefault() {
|
||||
if (this.pickerValueDefault !== [0, 0, 0]) {
|
||||
if (this.pickerValueDefault[0] > provinceData.length - 1) {
|
||||
this.pickerValueDefault[0] = provinceData.length - 1;
|
||||
}
|
||||
if (this.pickerValueDefault[1] > cityData[this.pickerValueDefault[0]].length - 1) {
|
||||
this.pickerValueDefault[1] = cityData[this.pickerValueDefault[0]].length - 1;
|
||||
}
|
||||
if (this.pickerValueDefault[2] > areaData[this.pickerValueDefault[0]][this.pickerValueDefault[1]].length - 1) {
|
||||
this.pickerValueDefault[2] = areaData[this.pickerValueDefault[0]][this.pickerValueDefault[1]].length - 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
pickerChange(e) {
|
||||
let changePickerValue = e.detail.value;
|
||||
if (this.pickerValue[0] !== changePickerValue[0]) {
|
||||
// 第一级发生滚动
|
||||
this.cityDataList = cityData[changePickerValue[0]];
|
||||
this.areaDataList = areaData[changePickerValue[0]][0];
|
||||
changePickerValue[1] = 0;
|
||||
changePickerValue[2] = 0;
|
||||
} else if (this.pickerValue[1] !== changePickerValue[1]) {
|
||||
// 第二级滚动
|
||||
this.areaDataList = areaData[changePickerValue[0]][changePickerValue[1]];
|
||||
changePickerValue[2] = 0;
|
||||
}
|
||||
this.pickerValue = changePickerValue;
|
||||
this._$emit('onChange');
|
||||
},
|
||||
_$emit(emitName) {
|
||||
let pickObj = {
|
||||
label: this._getLabel(),
|
||||
value: this.pickerValue,
|
||||
cityCode: this._getCityCode(),
|
||||
areaCode: this._getAreaCode(),
|
||||
provinceCode: this._getProvinceCode(),
|
||||
labelArr: this._getLabel().split('-')
|
||||
};
|
||||
this.$emit(emitName, pickObj);
|
||||
},
|
||||
_getLabel() {
|
||||
let pcikerLabel =
|
||||
this.provinceDataList[this.pickerValue[0]].label + '-' + this.cityDataList[this.pickerValue[1]].label + '-' + this.areaDataList[this.pickerValue[2]].label;
|
||||
return pcikerLabel;
|
||||
},
|
||||
_getCityCode() {
|
||||
return this.cityDataList[this.pickerValue[1]].value;
|
||||
},
|
||||
_getProvinceCode() {
|
||||
return this.provinceDataList[this.pickerValue[0]].value;
|
||||
},
|
||||
_getAreaCode() {
|
||||
return this.areaDataList[this.pickerValue[2]].value;
|
||||
},
|
||||
queryIndex(params = [], type = 'value') {
|
||||
// params = [ 11 ,1101,110101 ];
|
||||
// 1.获取省份的index
|
||||
let provinceIndex = provinceData.findIndex(res => res[type] == params[0]);
|
||||
let cityIndex = cityData[provinceIndex].findIndex(res => res[type] == params[1]);
|
||||
let areaIndex = areaData[provinceIndex][cityIndex].findIndex(res => res[type] == params[2]);
|
||||
return {
|
||||
index: [provinceIndex, cityIndex, areaIndex],
|
||||
data: {
|
||||
province: provinceData[provinceIndex],
|
||||
city: cityData[provinceIndex][cityIndex],
|
||||
area: areaData[provinceIndex][cityIndex][areaIndex]
|
||||
}
|
||||
};
|
||||
},
|
||||
clear() {},
|
||||
hideMask() {
|
||||
this._$emit('onCancel');
|
||||
this.close();
|
||||
},
|
||||
pickerCancel() {
|
||||
this._$emit('onCancel');
|
||||
this.close();
|
||||
},
|
||||
pickerConfirm() {
|
||||
this._$emit('onConfirm');
|
||||
this.close();
|
||||
},
|
||||
open() {
|
||||
this.showPopup = true;
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.ani = 'simple-' + this.type;
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
close(type) {
|
||||
if (!this.maskClick && type) return;
|
||||
this.ani = '';
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.showPopup = false;
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.simple-address {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.simple-address-mask {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
|
||||
transition-property: opacity;
|
||||
transition-duration: 0.3s;
|
||||
opacity: 0;
|
||||
/* #ifndef APP-NVUE */
|
||||
z-index: 99;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.mask-ani {
|
||||
transition-property: opacity;
|
||||
transition-duration: 0.2s;
|
||||
}
|
||||
|
||||
.simple-bottom-mask {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.simple-center-mask {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.simple-address--fixed {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transition-property: transform;
|
||||
transition-duration: 0.3s;
|
||||
transform: translateY(460rpx);
|
||||
/* #ifndef APP-NVUE */
|
||||
z-index: 99;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.simple-address-content {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.simple-content-bottom {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transform: translateY(500rpx);
|
||||
}
|
||||
|
||||
.content-ani {
|
||||
transition-property: transform, opacity;
|
||||
transition-duration: 0.2s;
|
||||
}
|
||||
|
||||
.simple-bottom-content {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.simple-center-content {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.simple-address__header {
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
border-bottom-color: #f2f2f2;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1rpx;
|
||||
}
|
||||
|
||||
.simple-address--fixed-top {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
border-top-color: $uni-border-color;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1rpx;
|
||||
}
|
||||
|
||||
.simple-address__header-btn-box {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.simple-address__header-text {
|
||||
text-align: center;
|
||||
font-size: $uni-font-size-base;
|
||||
color: #1aad19;
|
||||
line-height: 70rpx;
|
||||
padding-left: 40rpx;
|
||||
padding-right: 40rpx;
|
||||
}
|
||||
|
||||
.simple-address__box {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.simple-address-view {
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
/* #endif */
|
||||
/* #ifdef APP-NVUE */
|
||||
width: 750rpx;
|
||||
/* #endif */
|
||||
height: 408rpx;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.picker-item {
|
||||
text-align: center;
|
||||
line-height: 70rpx;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,84 @@
|
|||
<template>
|
||||
<view class="status-box statusHNH">
|
||||
<view :style="{height:statusBarHeight+'px',background:backgroudColor}"></view>
|
||||
<view class="status-nav" :style="{background:backgroudColor}">
|
||||
<!-- 返回键 -->
|
||||
<view @tap="backEvent" v-if="statusBack" style="height: 33rpx;width: 80rpx;flex-shrink: 0;position: absolute;">
|
||||
<image class="tab-back" src="/static/public/backBlackm.png"></image>
|
||||
</view>
|
||||
<!-- 标题 -->
|
||||
<!-- <view v-if="statusTitle" :class="statusBack ? 'tcenter' : 'tleft'" class="tab-title" :style="{color:tabcolor}">{{titleVal}}</view> -->
|
||||
<view v-if="statusTitle" class="tab-title tcenter" :style="{color:tabcolor}">{{titleVal}}</view>
|
||||
<view v-else class="tab-title tcenter" :style="{color:tabcolor}"> </view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:'status-nav',
|
||||
props:{
|
||||
statusTitle:{//是否显示标题
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
statusBack:{//是否显示返回键
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
backgroudColor:{//标题栏背景颜色
|
||||
type:String,
|
||||
default:'#FFFFFF'
|
||||
},
|
||||
tabcolor:{//标题颜色
|
||||
type:String,
|
||||
default:'#333333'
|
||||
},
|
||||
titleVal:{//标题内容
|
||||
type:String,
|
||||
default:'恒美植发'
|
||||
},
|
||||
whereCome:{//来自哪个页面
|
||||
type:Number,
|
||||
default:0
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 缓存状态栏+标题栏的高度
|
||||
const query = wx.createSelectorQuery().in(this)
|
||||
query.select('.statusHNH').boundingClientRect((rect) => {
|
||||
// console.log('状态栏+标题栏:',rect.height);
|
||||
uni.setStorageSync('statusHNH',rect.height)
|
||||
}).exec()
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight:uni.getSystemInfoSync().statusBarHeight,//获取手机状态栏高度
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
backEvent(){//返回事件
|
||||
if(this.whereCome==1){
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
} else if(this.whereCome==2){
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/my/my'
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack({delta:1})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.status-box{position: fixed;top: 0;left: 0;right: 0;z-index: 10;}
|
||||
.status-nav{width: 100%;position: relative;padding: 30rpx 0;display: flex;align-items: center;}
|
||||
.tab-back{width: 33rpx;height: 33rpx;flex-shrink: 0;position: absolute;left: 20rpx;}
|
||||
.tab-title{font-size: 36rpx;font-weight: bold;color: #333333;width: 100%;}
|
||||
.tcenter{text-align: center;}
|
||||
.tleft{margin-left: 40rpx;}
|
||||
</style>
|
|
@ -0,0 +1,110 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="isDot" class="banner-box">
|
||||
<swiper :current="bcurrent" @change="changeBanner" :style="{height: newHeight+'px'}" :autoplay="true" :circular="true" :interval="3000" :duration="500">
|
||||
<swiper-item v-for="(item,index) in bannerList" :key="index">
|
||||
<view @tap="chooseImg(index)" class="posir">
|
||||
<image :style="{borderRadius:newRadius+'px',height:newHeight+'px'}" class="img" :src="item.imgSrc" mode="aspectFill"></image>
|
||||
<image @tap.stop="playVideo(index)" v-if="item.isVideo" class="posia" style="top: 50%;left: 50%;transform: translate(-50%,-50%);width: 126rpx;height: 126rpx;z-index: 1;" src="/static/public/video.png" mode=""></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<!-- 指示点 -->
|
||||
<view class="dot-box" :style="{bottom:newBottom+'px'}">
|
||||
<view :class="bcurrent==indexd ? 'dotActive' : 'dotMo'" v-for="(itemd,indexd) in bannerList.length" :key="indexd"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"swiper-pu",
|
||||
props:{
|
||||
isDot:{//是否显示指示点
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
bannerList:{//默认轮播图片
|
||||
type:Array,
|
||||
default:function(){
|
||||
return [
|
||||
{imgSrc:'/static/public/banner.png',url:'',isVideo:false,poster:''},
|
||||
{imgSrc:'/static/public/banner.png',url:'',isVideo:false,poster:''},
|
||||
]
|
||||
}
|
||||
},
|
||||
newHeight:{//swiper的高
|
||||
type:String,
|
||||
default:'200'
|
||||
},
|
||||
newWidth:{//swiper和图片的宽
|
||||
type:String,
|
||||
default:'100%'
|
||||
},
|
||||
newBottom:{//指示点距离底部位置
|
||||
type:String,
|
||||
default:'18'
|
||||
},
|
||||
newRadius:{//图片圆角
|
||||
type:String,
|
||||
default:'0'
|
||||
},
|
||||
browseP:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
bcurrent:0,
|
||||
isShowVideo:false,
|
||||
autoplay:false,
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
chooseImg(index){
|
||||
// console.log('当前banner图',index);
|
||||
this.bcurrent = index
|
||||
if(this.browseP){
|
||||
let imgList = []
|
||||
this.bannerList.forEach(item=>{
|
||||
let nurl = ''
|
||||
item.url=='' ? nurl = item.imgSrc : nurl = item.url
|
||||
let obj = {
|
||||
url:nurl,
|
||||
type:item.isVideo?'video':'image',
|
||||
poster:item.poster
|
||||
}
|
||||
imgList.push(obj)
|
||||
})
|
||||
uni.previewMedia({
|
||||
current:this.bcurrent,
|
||||
sources:imgList
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url:this.bannerList[index].url
|
||||
})
|
||||
}
|
||||
},
|
||||
changeBanner(e){
|
||||
this.bcurrent = e.detail.current//当前的指示点下标
|
||||
},
|
||||
playVideo(index){
|
||||
// console.log('播放视频');
|
||||
uni.navigateTo({
|
||||
url:`/pagesB/video/playVideo?src=${this.bannerList[index].url}&posterSrc=${this.bannerList[index].poster}`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.banner-box{position: relative;}
|
||||
.img{width:100%;}
|
||||
.dot-box{position: absolute;bottom: 36rpx;display: flex;justify-content: center;width: 100%;}
|
||||
.dotActive{width: 22rpx;height: 12rpx;margin-right: 10rpx;border-radius: 20rpx; background-color: rgba(56, 117, 246, 1);}
|
||||
.dotMo{width: 12rpx;height: 12rpx;margin-right: 10rpx;border-radius: 100%;background-color: rgba(191, 191, 191, 1);}
|
||||
</style>
|
|
@ -0,0 +1,160 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="list.length==0" class="" style="display: flex;flex-direction: column;align-items: center;">
|
||||
<image src="/static/public/nothing.png" style="width: 474rpx;height: 273rpx;" mode="aspectFill"></image>
|
||||
<view class="fon24 col3" style="margin-bottom: 60rpx;">暂无内容</view>
|
||||
</view>
|
||||
<view class="list-container">
|
||||
<view id="wf-list" class="list" v-for="(list,listIndex) of viewList" :key="listIndex">
|
||||
<view @tap="goDetail(listIndex,index)" class="item" style="position: relative;" v-for="(item,index) of list.list" :key="index">
|
||||
<image style="border-radius: 30rpx;min-height: 260rpx;" @load="handleViewRender(listIndex,index)" @error="handleViewRender(listIndex,index)" :src="item.main_img" mode="widthFix"></image>
|
||||
<view style="position: absolute;top: 18rpx;right: 18rpx;z-index: 3;" @tap.stop="chooseLike(listIndex,index)">
|
||||
<!-- <image src="/static/public/like.png" style="width: 69rpx;height: 69rpx;border-radius: 100%;" mode=""></image> -->
|
||||
<!-- 不喜欢 -->
|
||||
<image v-if="item.is_collected!=1" style="width: 69rpx;height: 69rpx;border-radius: 100%;" src="/static/public/no-like.png"></image>
|
||||
<!-- 喜欢 -->
|
||||
<image v-if="item.is_collected==1" :class="item.is_collected==1?'bounceIn':'bounceOut'" style="width: 69rpx;height: 69rpx;border-radius: 100%;" class="animated" src="/static/public/like.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view style="position: absolute;z-index: 1;bottom: 8rpx;color: #FFFFFF;background: -webkit-linear-gradient(bottom,rgba(0,0,0,0.79),rgba(255,255,255,0));width: 100%;padding-top: 100rpx;border-bottom-left-radius: 30rpx;border-bottom-right-radius: 30rpx;">
|
||||
<view style="margin: 20rpx;font-size: 22rpx;line-height: 40rpx;">
|
||||
<view style="display: flex;align-items: center;font-size: 30rpx;">
|
||||
<view class="clips1 mar-y10">{{item.title}}</view>
|
||||
<text v-if="item.isVideo" :style="{fontSize:(nFon-2)+'px',marginLeft:nmarz+'px'}" style="border-radius: 5rpx;padding: 0 6rpx;text-align: center;" class="pbackc flexs fon30">视频</text>
|
||||
</view>
|
||||
<view class="clips1" style="opacity: .7;">{{item.content}}</view>
|
||||
<view style="display: flex;align-items: center;">
|
||||
<image :src="item.head_img" style="width: 28rpx;height: 28rpx;border-radius: 100%;" mode=""></image>
|
||||
<view class="mar-z10" style="opacity: .7;">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<image v-if="item.isVideo" :style="{width:nWidth+'rpx',height:nHeight+'rpx'}" class="posia" style="top: 50%;left: 50%;transform: translate(-50%,-50%);z-index: 3;" src="/static/public/video.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :contentVal="pu_content" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props:{
|
||||
list:{
|
||||
type:Array, //实际请求获取的列表数据
|
||||
},
|
||||
nWidth:{
|
||||
type:String,
|
||||
default:'120'
|
||||
},
|
||||
nHeight:{
|
||||
type:String,
|
||||
default:'120'
|
||||
},
|
||||
nFon:{
|
||||
type:String,
|
||||
default:'15'
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
viewList:[{list:[]},{list:[]}], //展示到视图的列表数据
|
||||
everyNum:2,
|
||||
jieDuan:false,
|
||||
pu_content:'是否需要取消收藏?',
|
||||
isShowT:false,
|
||||
current:{}
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
list(oldVal,newVal){
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
comfirmev(){
|
||||
// console.log('取消收藏成功');
|
||||
this.$emit('comfirmev',this.current)
|
||||
this.isShowT = false
|
||||
},
|
||||
cancleev(){
|
||||
// console.log('关闭弹框');
|
||||
this.isShowT = false
|
||||
},
|
||||
chooseLike(index,indext){//喜欢不喜欢事件
|
||||
// console.log('喜欢不喜欢:',index);
|
||||
if(this.jieDuan==false){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
this.$emit('chooseLike',this.viewList[index].list[indext].id)
|
||||
this.current = this.viewList[index].list[indext].id
|
||||
if(this.viewList[index].list[indext].is_collected==1) {
|
||||
this.isShowT = true
|
||||
} else {
|
||||
let maiOjb = {
|
||||
e:3,//内容收藏
|
||||
c:this.viewList[index].list[indext].id,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
},
|
||||
goDetail(index,indext){//查看详情
|
||||
if(this.jieDuan==false){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.navigateTo({
|
||||
// url:'/pagesB/problemDetail/problemDetail?isCate='+this.list[index].isCate
|
||||
url:'/pagesB/problemDetail/problemDetail?id='+this.viewList[index].list[indext].id+'&category_id='+this.viewList[index].list[indext].category_id
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
},
|
||||
init(){
|
||||
this.viewList = [{list:[]},{list:[]}];
|
||||
setTimeout(()=>{
|
||||
this.handleViewRender(0,0)
|
||||
},0)
|
||||
},
|
||||
handleViewRender(x,y){
|
||||
const index = this.viewList.reduce((total,current)=>total + current.list.length,0)
|
||||
if(index>this.list.length-1) {
|
||||
// 加载完成触发事件并返回加载过的图片数
|
||||
return
|
||||
};
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
let listFlag = 0;
|
||||
query.selectAll('#wf-list').boundingClientRect(data => {
|
||||
listFlag = data[0].bottom - data[1].bottom<=0?0:1;
|
||||
this.viewList[listFlag].list.push(this.list[index])
|
||||
}).exec()
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if(this.list.length){
|
||||
this.init()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.list-container
|
||||
display flex
|
||||
justify-content space-between
|
||||
align-items:flex-start
|
||||
padding-top 20rpx
|
||||
.list
|
||||
width calc(48%)
|
||||
display flex
|
||||
flex-direction column
|
||||
.item
|
||||
margin-bottom 30rpx
|
||||
image
|
||||
width 100%
|
||||
.desc
|
||||
padding 20rpx
|
||||
font-size 22rpx
|
||||
</style>
|
|
@ -0,0 +1,201 @@
|
|||
function getLocalFilePath(path) {
|
||||
if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf(
|
||||
'_downloads') === 0) {
|
||||
return path
|
||||
}
|
||||
if (path.indexOf('file://') === 0) {
|
||||
return path
|
||||
}
|
||||
if (path.indexOf('/storage/emulated/0/') === 0) {
|
||||
return path
|
||||
}
|
||||
if (path.indexOf('/') === 0) {
|
||||
var localFilePath = plus.io.convertAbsoluteFileSystem(path)
|
||||
if (localFilePath !== path) {
|
||||
return localFilePath
|
||||
} else {
|
||||
path = path.substr(1)
|
||||
}
|
||||
}
|
||||
return '_www/' + path
|
||||
}
|
||||
|
||||
function dataUrlToBase64(str) {
|
||||
var array = str.split(',')
|
||||
return array[array.length - 1]
|
||||
}
|
||||
|
||||
var index = 0
|
||||
|
||||
function getNewFileId() {
|
||||
return Date.now() + String(index++)
|
||||
}
|
||||
|
||||
function biggerThan(v1, v2) {
|
||||
var v1Array = v1.split('.')
|
||||
var v2Array = v2.split('.')
|
||||
var update = false
|
||||
for (var index = 0; index < v2Array.length; index++) {
|
||||
var diff = v1Array[index] - v2Array[index]
|
||||
if (diff !== 0) {
|
||||
update = diff > 0
|
||||
break
|
||||
}
|
||||
}
|
||||
return update
|
||||
}
|
||||
|
||||
export function pathToBase64(path) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (typeof window === 'object' && 'document' in window) {
|
||||
if (typeof FileReader === 'function') {
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.open('GET', path, true)
|
||||
xhr.responseType = 'blob'
|
||||
xhr.onload = function() {
|
||||
if (this.status === 200) {
|
||||
let fileReader = new FileReader()
|
||||
fileReader.onload = function(e) {
|
||||
resolve(e.target.result)
|
||||
}
|
||||
fileReader.onerror = reject
|
||||
fileReader.readAsDataURL(this.response)
|
||||
}
|
||||
}
|
||||
xhr.onerror = reject
|
||||
xhr.send()
|
||||
return
|
||||
}
|
||||
var canvas = document.createElement('canvas')
|
||||
var c2x = canvas.getContext('2d')
|
||||
var img = new Image
|
||||
img.onload = function() {
|
||||
canvas.width = img.width
|
||||
canvas.height = img.height
|
||||
c2x.drawImage(img, 0, 0)
|
||||
resolve(canvas.toDataURL())
|
||||
canvas.height = canvas.width = 0
|
||||
}
|
||||
img.onerror = reject
|
||||
img.src = path
|
||||
return
|
||||
}
|
||||
if (typeof plus === 'object') {
|
||||
plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function(entry) {
|
||||
entry.file(function(file) {
|
||||
var fileReader = new plus.io.FileReader()
|
||||
fileReader.onload = function(data) {
|
||||
resolve(data.target.result)
|
||||
}
|
||||
fileReader.onerror = function(error) {
|
||||
reject(error)
|
||||
}
|
||||
fileReader.readAsDataURL(file)
|
||||
}, function(error) {
|
||||
reject(error)
|
||||
})
|
||||
}, function(error) {
|
||||
reject(error)
|
||||
})
|
||||
return
|
||||
}
|
||||
if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
|
||||
wx.getFileSystemManager().readFile({
|
||||
filePath: path,
|
||||
encoding: 'base64',
|
||||
success: function(res) {
|
||||
resolve('data:image/png;base64,' + res.data)
|
||||
},
|
||||
fail: function(error) {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
reject(new Error('not support'))
|
||||
})
|
||||
}
|
||||
|
||||
export function base64ToPath(base64) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (typeof window === 'object' && 'document' in window) {
|
||||
base64 = base64.split(',')
|
||||
var type = base64[0].match(/:(.*?);/)[1]
|
||||
var str = atob(base64[1])
|
||||
var n = str.length
|
||||
var array = new Uint8Array(n)
|
||||
while (n--) {
|
||||
array[n] = str.charCodeAt(n)
|
||||
}
|
||||
return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], {
|
||||
type: type
|
||||
})))
|
||||
}
|
||||
var extName = base64.split(',')[0].match(/data\:\S+\/(\S+);/)
|
||||
if (extName) {
|
||||
extName = extName[1]
|
||||
} else {
|
||||
reject(new Error('base64 error'))
|
||||
}
|
||||
var fileName = getNewFileId() + '.' + extName
|
||||
if (typeof plus === 'object') {
|
||||
var basePath = '_doc'
|
||||
var dirPath = 'uniapp_temp'
|
||||
var filePath = basePath + '/' + dirPath + '/' + fileName
|
||||
if (!biggerThan(plus.os.name === 'Android' ? '1.9.9.80627' : '1.9.9.80472', plus.runtime
|
||||
.innerVersion)) {
|
||||
plus.io.resolveLocalFileSystemURL(basePath, function(entry) {
|
||||
entry.getDirectory(dirPath, {
|
||||
create: true,
|
||||
exclusive: false,
|
||||
}, function(entry) {
|
||||
entry.getFile(fileName, {
|
||||
create: true,
|
||||
exclusive: false,
|
||||
}, function(entry) {
|
||||
entry.createWriter(function(writer) {
|
||||
writer.onwrite = function() {
|
||||
resolve(filePath)
|
||||
}
|
||||
writer.onerror = reject
|
||||
writer.seek(0)
|
||||
writer.writeAsBinary(dataUrlToBase64(base64))
|
||||
}, reject)
|
||||
}, reject)
|
||||
}, reject)
|
||||
}, reject)
|
||||
return
|
||||
}
|
||||
var bitmap = new plus.nativeObj.Bitmap(fileName)
|
||||
bitmap.loadBase64Data(base64, function() {
|
||||
bitmap.save(filePath, {}, function() {
|
||||
bitmap.clear()
|
||||
resolve(filePath)
|
||||
}, function(error) {
|
||||
bitmap.clear()
|
||||
reject(error)
|
||||
})
|
||||
}, function(error) {
|
||||
bitmap.clear()
|
||||
reject(error)
|
||||
})
|
||||
return
|
||||
}
|
||||
if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
|
||||
var filePath = wx.env.USER_DATA_PATH + '/' + fileName
|
||||
wx.getFileSystemManager().writeFile({
|
||||
filePath: filePath,
|
||||
data: dataUrlToBase64(base64),
|
||||
encoding: 'base64',
|
||||
success: function() {
|
||||
resolve(filePath)
|
||||
},
|
||||
fail: function(error) {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
reject(new Error('not support'))
|
||||
})
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
const ENV = process.env.NODE_ENV;
|
||||
console.log('当前环境', process.env.NODE_ENV)
|
||||
|
||||
const apiHub = {
|
||||
//开发环境
|
||||
development: {
|
||||
BASE_URL: "https://hm.hmzfyy.cn/api/",
|
||||
IMG_URL: "https://xx",
|
||||
BASE_UPLOAD_URL: "",
|
||||
},
|
||||
|
||||
//测试环境
|
||||
test: {
|
||||
BASE_URL: "https://xxx",
|
||||
IMG_URL: "https://xxx",
|
||||
BASE_UPLOAD_URL: "",
|
||||
},
|
||||
|
||||
//生产环境
|
||||
production: {
|
||||
BASE_URL: "https://xx",
|
||||
IMG_URL: "https://xx",
|
||||
BASE_UPLOAD_URL: "",
|
||||
}
|
||||
}
|
||||
|
||||
// 导出配置
|
||||
export default {
|
||||
ENV: ENV,
|
||||
...apiHub[ENV]
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
import requst from './requst.js';
|
||||
import toolAll from './tools.js';
|
||||
|
||||
export function collectionEV(data){//收藏事件
|
||||
return requst.post('archives/record',data).then(res=>{
|
||||
if(res.code==0) {
|
||||
let newMsg = '点赞成功'
|
||||
let num = 2
|
||||
if(data.action=='collect'){
|
||||
num = 3
|
||||
newMsg = '收藏成功'
|
||||
}
|
||||
let maiOjb = {
|
||||
e:num,//内容收藏
|
||||
c:data.archive_id*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
toolAll.tools.maiDian(maiOjb)
|
||||
toolAll.tools.showToast(newMsg,'none',1500)
|
||||
}
|
||||
},error=>{})
|
||||
}
|
||||
export function cancleCollectionEV(data){//取消收藏事件
|
||||
return requst.post('archives/un-record',data).then(res=>{
|
||||
if(res.code==0) {
|
||||
let newMsg = '已取消点赞'
|
||||
if(data.action=='collect'){
|
||||
newMsg = '已取消收藏'
|
||||
}
|
||||
toolAll.tools.showToast(newMsg,'none',1500)
|
||||
}
|
||||
},error=>{})
|
||||
}
|
||||
export function buriedPoint(){//查询埋点类型事件
|
||||
return requst.post('statistics/event').then(res=>{
|
||||
// console.log('查询所有需要埋点的类型:',res);
|
||||
if(res.code==0) uni.setStorageSync('buriedPoint',res.data)
|
||||
},error=>{})
|
||||
}
|
||||
export function reportBuriedPoint(data){//上报埋点事件
|
||||
// console.log('埋点的数据:',data);
|
||||
return requst.post('statistics/report',data).then(res=>{},error=>{})
|
||||
}
|
||||
export function zhuColor(){//查询主题色
|
||||
return requst.post('index/mini-program-setting').then(res=>{
|
||||
if(res.code==0){
|
||||
uni.setStorageSync('publicColor', res.data.mainColor) //#3875F6 #2E8B57
|
||||
// uni.setStorageSync('publicColor', '#2E8B57') //#3875F6 #2E8B57
|
||||
}
|
||||
},error=>{})
|
||||
}
|
||||
export function checkSwip(){//查询主题色
|
||||
return requst.post('common/slide-positions').then(res=>{
|
||||
if(res.code==0){
|
||||
console.log(res);
|
||||
}
|
||||
},error=>{})
|
||||
}
|
||||
export function checkBanner(data){//查询主题色
|
||||
return requst.post('common/slides',data)
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
const domainName = 'https://hm.hmzfyy.cn/api/'//域名配置
|
||||
// 统一给参数
|
||||
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 goLogin = () => {
|
||||
// uni.clearStorageSync();
|
||||
console.log('token失效');
|
||||
// uni.reLaunch({
|
||||
// url: '/pages/login/Login'
|
||||
// }) //未授权,请重新登录(401)
|
||||
}
|
||||
// 请求错误处理
|
||||
const checkError = (e, reject) => {
|
||||
// console.error("----接口错误----", e)
|
||||
if (e.data) {
|
||||
if (e.data.code) {
|
||||
switch (Number(e.data.code)) {
|
||||
case 4001:
|
||||
goLogin()
|
||||
break;
|
||||
}
|
||||
}
|
||||
reject(e.data)
|
||||
} else reject({msg:'接口错误'})
|
||||
}
|
||||
|
||||
// 封装请求
|
||||
const request = (method, url, options) => {
|
||||
let methods = '';
|
||||
let headers = {};
|
||||
switch (method) {
|
||||
case 'get':
|
||||
methods = 'GET'
|
||||
headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
}
|
||||
break;
|
||||
case 'post':
|
||||
methods = 'POST'
|
||||
headers = {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
}
|
||||
break;
|
||||
case 'postForm':
|
||||
methods = 'POST'
|
||||
headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'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: `${domainName}${url}`,
|
||||
method: methods,
|
||||
data: dataObj(url, options),
|
||||
header: headers,
|
||||
success: res => {
|
||||
// console.log('反的结果===>',res);
|
||||
if (res.statusCode == 200) {
|
||||
if (res.data.code == 0) {
|
||||
resolve(res.data)
|
||||
} else {
|
||||
resolve(res.data)
|
||||
}
|
||||
} else {
|
||||
reject(res.data)
|
||||
}
|
||||
},
|
||||
fail: e => {
|
||||
checkError(e, reject)
|
||||
},
|
||||
complete: () => {
|
||||
!hideLoading && uni.hideToast()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 上传文件 封装请求
|
||||
const uploadFile = (url, options) => {
|
||||
let tempData = options || {}
|
||||
uni.showLoading({title: "上传中..."})
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: `${domainName}${url}`,
|
||||
filePath: tempData.file,
|
||||
name: 'image',
|
||||
fileType:'image',
|
||||
formData: tempData,
|
||||
header: {
|
||||
'Content-Type': 'multipart/form-data;charset=UTF-8',
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: res => {
|
||||
if (res.statusCode == 200) {
|
||||
let temp = JSON.parse(res.data)
|
||||
if (temp.code == 0) {
|
||||
resolve(temp)
|
||||
} else {
|
||||
reject(temp)
|
||||
uni.showToast({
|
||||
title: temp.msg || '接口错误(' + temp.code + ')',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: `未知错误(${res.statusCode})`,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
// uni.showToast({
|
||||
// title: '接口请求超时',
|
||||
// icon: 'none'
|
||||
// })
|
||||
// reject(e.data)
|
||||
},
|
||||
complete: () => {
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
get: (url, options) => {
|
||||
return request('get', url, options)
|
||||
},
|
||||
// JOSN格式
|
||||
post: (url, options) => {
|
||||
return request('post', url, options)
|
||||
},
|
||||
// form-data格式
|
||||
postForm: (url, options) => {
|
||||
return request('postForm', url, options)
|
||||
},
|
||||
// 上传
|
||||
upload: (url, options) => {
|
||||
return uploadFile(url, options)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,338 @@
|
|||
import {buriedPoint,reportBuriedPoint,zhuColor} from './publicAPI.js';
|
||||
const tools = {
|
||||
timer:'',
|
||||
timerNot:'',
|
||||
// 埋点倒计时
|
||||
daoTime(){
|
||||
let daoTime = uni.getStorageSync('daoTime')
|
||||
if(daoTime==''){//初次判断倒计时是否为空
|
||||
uni.setStorageSync('daoTime',600)//设置倒计时
|
||||
daoTime = uni.getStorageSync('daoTime')
|
||||
this.timer = setInterval(()=>{
|
||||
uni.setStorageSync('daoTime',daoTime--)//设置倒计时
|
||||
// console.log('埋点倒计时初次:',daoTime);
|
||||
// console.log('埋点长度初次:',uni.getStorageSync('maiList').length);
|
||||
if(uni.getStorageSync('daoTime')<=0 || uni.getStorageSync('maiList').length==20){
|
||||
uni.removeStorageSync('daoTime')//清空倒计时
|
||||
clearInterval(this.timer)//关闭倒计时
|
||||
// console.log('上/报,埋点');
|
||||
reportBuriedPoint(uni.getStorageSync('maiList'))//上报事件
|
||||
uni.removeStorageSync('maiList')//清空上报参数
|
||||
this.daoTime()//重新倒计时
|
||||
}
|
||||
},1000)
|
||||
} else {//继续当前倒计时倒计
|
||||
this.timer = setInterval(()=>{
|
||||
uni.setStorageSync('daoTime',daoTime--)//设置倒计时
|
||||
// console.log('埋点倒计时:',daoTime);
|
||||
// console.log('埋点长度:',uni.getStorageSync('maiList').length);
|
||||
if(uni.getStorageSync('daoTime')<=0 || uni.getStorageSync('maiList').length==20){
|
||||
uni.removeStorageSync('daoTime')//清空倒计时
|
||||
clearInterval(this.timer)//关闭倒计时
|
||||
// console.log('上报,埋点');
|
||||
reportBuriedPoint(uni.getStorageSync('maiList'))//上报事件
|
||||
uni.removeStorageSync('maiList')//清空上报参数
|
||||
this.daoTime()//重新倒计时
|
||||
}
|
||||
},1000)
|
||||
}
|
||||
},
|
||||
zhuColorT(){//调用主色调
|
||||
zhuColor()
|
||||
},
|
||||
networkStatus(){//检查网络状态
|
||||
uni.getNetworkType({
|
||||
success: function (res) {
|
||||
console.log('当前网络状态:',res.networkType);//none:当前无网络连接
|
||||
if(res.networkType=='none'){
|
||||
uni.setStorageSync('isNet',false)
|
||||
} else {
|
||||
uni.setStorageSync('isNet',true)
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
closeTimer(){
|
||||
clearInterval(this.timer)//关闭倒计时
|
||||
console.log('倒计时清空了');
|
||||
clearInterval(this.timerNot)//关闭倒计时
|
||||
},
|
||||
buriedPointAll(){//查询埋点类型事件
|
||||
buriedPoint()
|
||||
},
|
||||
maiDian(data){//埋点事件
|
||||
let maiList = uni.getStorageSync('maiList')
|
||||
// console.log(maiList);
|
||||
if(maiList==''){
|
||||
maiList = [data]
|
||||
} else maiList.push(data)
|
||||
uni.setStorageSync('maiList',maiList)
|
||||
},
|
||||
weekDate(){//获取未来七天星期几,几号
|
||||
let date = new Date()
|
||||
let year = date.getFullYear()
|
||||
let month = date.getMonth()+1
|
||||
let day = date.getDate()
|
||||
let nth = date.getDay()//星期几
|
||||
// console.log(year,month,day);
|
||||
let xingq = ['周一','周二','周三','周四','周五','周六','周日']
|
||||
|
||||
},
|
||||
// 手机号验证
|
||||
isPhone:function(phone){
|
||||
// 手机号正则表达式
|
||||
let reg_tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
|
||||
if(!reg_tel.test(phone)){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
// 手机号中间四位用"****"带替
|
||||
hideMPhone(phone){
|
||||
return `${phone.substr(0, 3)}****${phone.substr(7)}`
|
||||
},
|
||||
// 只显示姓,名使用"*"代替
|
||||
// hideName(name,num){//苹果手机运行不起
|
||||
// let hname = ''
|
||||
// let reg = /(?<=.)./g;
|
||||
// if(num==1) hname = name.replace(reg, '*')
|
||||
// if(num==2) hname = `${name.substr(0, 1)}****${name.substr(name.length-1)}`
|
||||
// return hname
|
||||
// },
|
||||
hideName(name,num){
|
||||
let hname = ''
|
||||
hname = `${name.substr(0, 1)}****${name.substr(name.length-1)}`
|
||||
return hname
|
||||
},
|
||||
// 时间戳===>日期
|
||||
timestampToTime(timestamp) {
|
||||
var date = timestamp.toString().length==13 ? new Date(timestamp*1) : new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
|
||||
var Y = date.getFullYear();
|
||||
var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1);
|
||||
var D = date.getDate() < 10 ? '0'+date.getDate() : date.getDate();
|
||||
var h = date.getHours() < 10 ? '0'+date.getHours() : date.getHours();
|
||||
var m = date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes();
|
||||
var s = date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds();
|
||||
return Y + '-' + M + '-' + D + ' ' + h + ':' + m + ':' +s;
|
||||
},
|
||||
// 日期===>时间戳
|
||||
timeToTimestamp(time){
|
||||
var date = new Date(time);
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
return timestamp
|
||||
// var date = new Date('2014-04-23 18:55:49:123');
|
||||
// 有三种方式获取
|
||||
// var time1 = date.getTime();//精确到毫秒
|
||||
// var time2 = date.valueOf();//精确到毫秒
|
||||
// var time3 = Date.parse(date);//只能精确到秒,毫秒用000替代
|
||||
// console.log(time1);//1398250549123
|
||||
// console.log(time2);//1398250549123
|
||||
// console.log(time3);//1398250549000
|
||||
},
|
||||
// 随机数生成
|
||||
randomStr(){
|
||||
var strData = "";
|
||||
//如果觉得12个数太少也可以多放点,将i<4修改即可
|
||||
for(var i=0;i<4;i++){
|
||||
var num = random(0,9); //数字
|
||||
var upper = String.fromCharCode(random(65,90)); //大写字母
|
||||
var lower = String.fromCharCode(random(97,122)); //小写字母
|
||||
strData = strData+num+upper+lower; //将所有结果放进strData中
|
||||
|
||||
}
|
||||
var str = "";
|
||||
for (var i = 0; i < 4; i++) {
|
||||
str += strData[random(0,strData.length-1)]; //在strData里面随机抽取四个数
|
||||
}
|
||||
return str;
|
||||
},
|
||||
// 金额输入框验证
|
||||
checkPrice(number,zong){
|
||||
let reg = /^[0-9]*$/;//数字正则表达式
|
||||
let newObj = {}
|
||||
zong = parseInt(zong).toString()//取小数点左边的整数
|
||||
if(!reg.test(number)){//不是数字时
|
||||
newObj = {
|
||||
len:zong.length,//动态设置长度
|
||||
val:zong//动态设置值正整数的总金额
|
||||
}
|
||||
} else {//是数字时
|
||||
newObj = {
|
||||
len:zong.length,
|
||||
val:number//动态设置当前输入的值
|
||||
}
|
||||
if(number*1 > zong*1){//输入的金额大于总金额
|
||||
newObj.val = zong//赋值总金额
|
||||
}
|
||||
}
|
||||
return newObj
|
||||
},
|
||||
// 提示方法
|
||||
showToast: function(msg, icon,time) {
|
||||
// 弹框图标:none默认无图标、loading、success
|
||||
var newIncon = 'none';
|
||||
if (icon) {newIncon = icon;}
|
||||
// 弹框显示时间:默认2秒
|
||||
var newTime = 2000
|
||||
if (time) {newTime = time;}
|
||||
return uni.showToast({
|
||||
title: msg,
|
||||
icon: newIncon,
|
||||
duration:newTime
|
||||
})
|
||||
},
|
||||
formatDuring: function(mss) {
|
||||
// let dangTime = Math.round(new Date()/1000)//获取当前时间戳
|
||||
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
|
||||
var seconds = (mss % (1000 * 60)) / 1000;
|
||||
hours = hours < 10 ? ('0' + hours) : hours;
|
||||
minutes = minutes < 10 ? ('0' + minutes) : minutes;
|
||||
seconds = seconds < 10 && seconds >= 1 ? ('0' + seconds) : seconds;
|
||||
return hours + ' : ' + minutes + ' : ' + seconds;
|
||||
},
|
||||
escape2Html(str) {//富文本
|
||||
var arrEntities = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"' };
|
||||
return str.replace(/&(lt|gt|nbsp|amp|quot|src);/ig, function (all, t) { return arrEntities[t]; }).replace('<section', '<div').replace(/\<img/g, '<img @tap="pre" style="max-width:100%;height:auto" ').replace(/src=\"/g,'src="https://oss.hmzfyy.cn');
|
||||
},
|
||||
setTime(url,title,time){
|
||||
// console.log(url,title,time);
|
||||
if(url=='' && title==''){
|
||||
setTimeout(function(){uni.navigateBack({delta:1,})},time)
|
||||
} else if(title==''){
|
||||
setTimeout(function(){
|
||||
uni.navigateTo({
|
||||
url:url
|
||||
})
|
||||
},time)
|
||||
}
|
||||
},
|
||||
updaX(){//检测小程序版本以及更新小程序
|
||||
// 获取小程序的运行环境、版本号、appId 注意:线上小程序版本号仅支持在正式版小程序中获取,开发版和体验版中无法获取。
|
||||
const accountInfo = wx.getAccountInfoSync();//使用详情:https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html
|
||||
var version = accountInfo.miniProgram.version
|
||||
console.log(version);
|
||||
// 检测小程序的更新
|
||||
const updateManager = wx.getUpdateManager()//以下使用详情:https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81
|
||||
updateManager.onCheckForUpdate(function (res) {
|
||||
// 请求完新版本信息的回调
|
||||
// console.log('检测是否有更新:',res.hasUpdate)
|
||||
})
|
||||
updateManager.onUpdateReady(function (res) {
|
||||
wx.showModal({
|
||||
title: '恒美植发客服代表提醒您',
|
||||
content: '新版本已经准备就绪,是否重启应用',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
updateManager.onUpdateFailed(function (res) {
|
||||
// 新版本下载失败
|
||||
// console.log('新版本下载失败:',res);
|
||||
})
|
||||
},
|
||||
clearClog(){//去除某环境下的所有console.log()//输出信息
|
||||
// uniapp性能优化
|
||||
// #ifdef APP-PLUS
|
||||
if(uni.getSystemInfoSync().platform != "devtool"){//devtools:开发版 值域为:ios、android、mac(3.1.10+)、windows(3.1.10+)、linux(3.1.10+)
|
||||
console.log = () =>{}
|
||||
}
|
||||
// #endif
|
||||
// 微信小程序原生API性能优化
|
||||
// #ifdef MP-WEIXIN
|
||||
let hInfo = wx.getAccountInfoSync();
|
||||
// console.log(hInfo.envVersion);//develop:开发版 trial:体验版 release:正式版
|
||||
if(hInfo.miniProgram.envVersion != "develop"){
|
||||
console.log = () =>{}
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
overdue(){//查询过期时间和是否有token,并调用登录事件
|
||||
var date = new Date();
|
||||
var timestamp = date.getTime();//精确到毫秒
|
||||
if((uni.getStorageSync('expire')*1000) - 10000 < timestamp){
|
||||
this.loginEv()
|
||||
} else if(uni.getStorageSync('token')==''){
|
||||
this.loginEv()
|
||||
} else if(uni.getStorageSync('is_active')=='' || uni.getStorageSync('is_active')==0){
|
||||
this.loginEv()
|
||||
}
|
||||
},
|
||||
loginEv(){//执行登录事件
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: function(res) {
|
||||
if (res.code) {
|
||||
let code = res.code;
|
||||
let obj = uni.getStorageSync('params')
|
||||
var params = {
|
||||
invite_code:'',
|
||||
code:code,
|
||||
nickname: obj.nickname,
|
||||
avatar: obj.avatarUrl,
|
||||
country: obj.country,
|
||||
province: obj.province,
|
||||
city: obj.city,
|
||||
gender: obj.gender,
|
||||
language:obj.language
|
||||
}
|
||||
uni.request({
|
||||
url: `https://hm.hmzfyy.cn/api/user/login`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
header: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
// "content-type": "application/x-www-form-urlencoded;charset=UTF-8",
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: res => {
|
||||
if(res.data.data.token!=''){
|
||||
uni.removeStorageSync('ninvite_code')
|
||||
uni.setStorageSync('token',res.data.data.token)//缓存token
|
||||
uni.setStorageSync('openid',res.data.data.openid)//缓存Openid
|
||||
uni.setStorageSync('expire',res.data.data.expire)//缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('is_active',res.data.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('userId',res.data.data.account_id)
|
||||
uni.setStorageSync('invite_code',res.data.data.invite_code)
|
||||
// console.log('is_active',uni.getStorageSync('is_active'));
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
returnAuth(){//是否第一次授权
|
||||
let auth = false
|
||||
if(uni.getStorageSync('is_active')==0) {
|
||||
this.showToast('您目前是游客,请授权登录')
|
||||
setTimeout(()=>{
|
||||
uni.navigateTo({url:'/pages/login/login'})
|
||||
},1500)
|
||||
auth = true
|
||||
}
|
||||
return auth
|
||||
},
|
||||
isLogin(){//是否已经登录
|
||||
if(uni.getStorageSync('is_active')!='' && uni.getStorageSync('is_active') !=0 ){
|
||||
this.overdue()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
tools
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
import statusNav from './components/status-nav.vue';//引入状态栏组件
|
||||
Vue.component('status-nav',statusNav)//全局注册状态栏组件
|
||||
import footTab from './components/foot-tab.vue';//引入底部tab组件
|
||||
Vue.component('foot-tab',footTab)//全局注册底部tab组件
|
||||
import backTop from './components/backTop.vue';//引入返回顶部组件
|
||||
Vue.component('back-top',backTop)//全局注册返回顶部组件
|
||||
import catePu from './components/cate-items/cate-pu.vue';//引入分类组件
|
||||
Vue.component('cate-pu',catePu)//全局注册分类组件
|
||||
import listPu from './components/list-pu.vue';//引入视频、图片列表组件
|
||||
Vue.component('list-pu',listPu)//全局注册视频、图片列表组件
|
||||
import pupo from './components/pupo.vue';//引入弹框组件
|
||||
Vue.component('pu-po',pupo)//全局注册弹框组件
|
||||
import nothingPage from './components/nothing-page.vue'//引入无内容组件
|
||||
Vue.component('nothing-page',nothingPage)//全局注册无内容组件
|
||||
import publicCustomer from './components/public-customer.vue'//引入客服组件
|
||||
Vue.component('public-customer',publicCustomer)//全局注册客服组件
|
||||
|
||||
|
||||
|
||||
// 常用工具
|
||||
import tools from '@/jsFile/tools.js'
|
||||
Vue.prototype.$toolAll = tools;
|
||||
// 响应数据
|
||||
import requst from '@/jsFile/requst.js'
|
||||
Vue.prototype.$requst = requst;
|
||||
// 域名,专治后台仔没有返回http/https的图片
|
||||
// Vue.prototype.$http = 'https://hm.hmzfyy.cn'
|
||||
Vue.prototype.$http = 'https://oss.hmzfyy.cn'
|
||||
|
||||
const {log} = console;
|
||||
Vue.prototype.$log = log
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
App.mpType = 'app'
|
||||
|
||||
const app = new Vue({
|
||||
...App
|
||||
})
|
||||
app.$mount()
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"name" : "恒美植发",
|
||||
"appid" : "__UNI__02EF3E2",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"compilerVersion" : 3,
|
||||
/* 5+App特有相关 */
|
||||
"modules" : {
|
||||
"Payment" : {}
|
||||
},
|
||||
/* 模块配置 */
|
||||
"distribute" : {
|
||||
/* 应用发布信息 */
|
||||
"android" : {
|
||||
/* android打包配置 */
|
||||
"permissions" : [
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
"ios" : {},
|
||||
/* ios打包配置 */
|
||||
"sdkConfigs" : {
|
||||
"maps" : {},
|
||||
"payment" : {
|
||||
"weixin" : {
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appid" : "wxa02e44170bc722cd",
|
||||
"UniversalLinks" : ""
|
||||
}
|
||||
},
|
||||
"push" : {},
|
||||
"geolocation" : {}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* SDK配置 */
|
||||
"quickapp" : {},
|
||||
/* 快应用特有相关 */
|
||||
"mp-weixin" : {
|
||||
/* 小程序特有相关 */
|
||||
"appid" : "wx987dc41899f719e8",
|
||||
"setting" : {
|
||||
"urlCheck" : true,
|
||||
"es6" : false
|
||||
},
|
||||
"usingComponents" : true,
|
||||
"permission" : {
|
||||
"scope.userLocation" : {
|
||||
"desc" : "您的位置信息将用于小程序位置接口的效果展示"
|
||||
}
|
||||
}
|
||||
},
|
||||
"h5" : {
|
||||
"sdkConfigs" : {
|
||||
"maps" : {}
|
||||
}
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"appid" : "24346353"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"id": "zhuge-swiper",
|
||||
"name": "轮播视频和图片",
|
||||
"version": "1.0.1",
|
||||
"description": "自动轮播视频和图片组件。播放视频时停止轮播,手动滑动swiper时视频停止播放",
|
||||
"keywords": [
|
||||
"vue",
|
||||
"swiper",
|
||||
"zhuge"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
{
|
||||
"pages": [
|
||||
{
|
||||
"path" : "pages/tabbar/pagehome/pagehome",
|
||||
"style" :{}
|
||||
},{
|
||||
"path" : "pages/login/login",
|
||||
"style" :{
|
||||
"navigationBarTextStyle":"black" //状态栏字体颜色
|
||||
}
|
||||
},{
|
||||
"path" : "pages/tabbar/my/my",
|
||||
"style" :{}
|
||||
},
|
||||
{
|
||||
"path" : "pages/tabbar/shop/shop",
|
||||
"style" :{}
|
||||
},
|
||||
{
|
||||
"path" : "pages/tabbar/cate/cate",
|
||||
"style" : {}
|
||||
},
|
||||
|
||||
{
|
||||
"path":"pages/login/xiey",
|
||||
"style" :{}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
{//A包
|
||||
"root": "pagesA",
|
||||
"pages": [
|
||||
{
|
||||
"path" : "nodifyData/nodifyData",//修改资料
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "makeAnPppointment/makeAnPppointment",//自主预约列表
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "ppointmentEv/ppointmentEv",//提交自主预约
|
||||
"style" :{}
|
||||
}
|
||||
,{
|
||||
"path" : "suggestions/suggestions",//投诉及建议
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "shopCart/shopCart",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
,{
|
||||
"path" : "getReadyDan/getReadyDan",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
,{
|
||||
"path" : "immediatePayment/immediatePayment",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
},
|
||||
{//B包
|
||||
"root": "pagesB",
|
||||
"pages": [
|
||||
{
|
||||
"path" : "searchPage/searchPage",//搜索页
|
||||
"style" :{}
|
||||
}
|
||||
,{
|
||||
"path" : "mysharer/mysharer",//我的分享人
|
||||
"style" :{}
|
||||
}
|
||||
,{
|
||||
"path" : "messagecenter/messagecenter",//消息中心
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "myCollection/myCollection",//我的收藏
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "customerList/customerList",//客户列表
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "userFootprint/userFootprint",//用户足迹
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "personalPoster/personalPoster",//二维码海报
|
||||
"style" : {}
|
||||
},{
|
||||
"path" : "sharingCenter/sharingCenter",//分享中心
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "aboutUs/aboutUs",//关于我们
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "articleDetail/articleDetail",//详情
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "doctor/doctor",//医生列表
|
||||
"style" : {}
|
||||
}
|
||||
,{
|
||||
"path" : "doctorDetail/doctorDetail",//医生详情
|
||||
"style" :{}
|
||||
}
|
||||
,{
|
||||
"path" : "problemDetail/problemDetail",//问题分类详情
|
||||
"style" : {}
|
||||
},
|
||||
{
|
||||
"path":"video/playVideo",
|
||||
"style":{}
|
||||
},
|
||||
{
|
||||
"path":"customer/customer",
|
||||
"style":{}
|
||||
}
|
||||
,{
|
||||
"path" : "shopDetail/shopDetail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
,{
|
||||
"path" : "orderDetail/orderDetail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"preloadRule": {
|
||||
"pages/tabbar/pagehome/pagehome": {
|
||||
"network": "all",
|
||||
"packages": ["pagesA"]
|
||||
}
|
||||
},
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "恒美",
|
||||
"navigationBarBackgroundColor": "#FFFFFF",//导航栏背景色
|
||||
"backgroundColor": "#FFFFFF",//窗口背景色
|
||||
"navigationStyle":"custom"//去掉所有原生导航栏
|
||||
}
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
<template>
|
||||
<view>
|
||||
<status-nav :titleVal="'登录'" :tabcolor="'rgba(244, 244, 244,1)'" :whereCome="1*1" :statusTitle="true" :backgroudColor="'rgba(244, 244, 244,1)'"></status-nav>
|
||||
<view class='login-header'>
|
||||
<image class="infoImg" :style="{boxShadow: '0px 0px 20px '+ publicColor}" mode="aspectFit" :src="userInfo.avatarUrl || imgSrc"></image>
|
||||
<view class="logo-name">恒美植发</view>
|
||||
</view>
|
||||
<view class="login-box">
|
||||
<button class='login-btn' :style="{background:publicColor}" type='primary' @click="bindGetUserInfo">微信授权</button>
|
||||
<!--新版登录方式-->
|
||||
<!-- <button v-if="canIGetUserProfile" class='login-btn' type='primary' @click="bindGetUserInfo">授权登录</button> -->
|
||||
<!--旧版登录方式-->
|
||||
<!-- <button v-else class='login-btn' type='primary' open-type="getUserInfo" withCredentials="true" lang="zh_CN" @getuserinfo="bindGetUserInfo">授权登录</button> -->
|
||||
<view class="xie-box">登录代表您已同意<text @tap="goXie" class="xieCon">《用户服务协议》</text></view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<view v-if="isShowP" class="disjcac posAll">
|
||||
<view class="bacf radius20 width100 tank-box">
|
||||
<view class="tc tank-box-itemone">请授权绑定手机号</view>
|
||||
<view class="fon28 colf pad-x30 pad-zy30 tc disjb">
|
||||
<view @tap="refuse" class="pad-sx10 radius10 tank-btn" style="background-color: rgba(230, 230, 230,1);color: #000000;">暂不绑定</view>
|
||||
<view :style="{background:publicColor}" class="pad-sx10 radius10 tank-btn posir">
|
||||
立即绑定
|
||||
<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="posia syxzo">立即绑定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userInfo: {},//用户信息
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
canIGetUserProfile: false,
|
||||
imgSrc: '/static/public/logo.png',//默认logo头像
|
||||
isShowP:false
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
// let ya = this;
|
||||
// // 微信扫码后会自动编码,所以需要解码
|
||||
// if (options && options.q) {
|
||||
// let arr = decodeURIComponent(options.q).split('?')[1].split('&')
|
||||
// let obj = {}
|
||||
// arr.forEach(item => {
|
||||
// let brr = item.split('=')
|
||||
// obj[brr[0]] = brr[1]
|
||||
// })
|
||||
// // console.log(obj) //得到参数组成的对象
|
||||
// ya.invite_code = obj.invite_code
|
||||
// }
|
||||
if (uni.getUserProfile) {
|
||||
this.canIGetUserProfile = true;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
refuse(){
|
||||
this.isShowP=false
|
||||
this.$toolAll.tools.showToast('登录成功','success')
|
||||
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
},
|
||||
getphonenumber(e){//授权绑定手机号
|
||||
console.log(e);
|
||||
if(e.detail.errMsg=="getPhoneNumber:ok"){
|
||||
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
|
||||
console.log('手机号信息:',res);
|
||||
if(res.code==0){
|
||||
this.isShowP = false
|
||||
this.$toolAll.tools.showToast('手机号绑定成功','success')
|
||||
uni.setStorageSync('bindPhone',false)
|
||||
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
}
|
||||
},error=>{})
|
||||
} else {
|
||||
this.isShowP = false
|
||||
this.$toolAll.tools.showToast('登录成功','success')
|
||||
uni.reLaunch({url:'/pages/tabbar/pagehome/pagehome'})
|
||||
}
|
||||
},
|
||||
goXie(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/login/xiey'
|
||||
})
|
||||
},
|
||||
//调起登录授权
|
||||
bindGetUserInfo(e) {
|
||||
let ya = this;
|
||||
//新版登录方式
|
||||
uni.getUserProfile({
|
||||
desc: '登录',
|
||||
lang: 'zh_CN',
|
||||
success: (res) => {
|
||||
// console.log('res',res);
|
||||
ya.userInfo = res.userInfo;
|
||||
// console.log('可用用户信息:',ya.userInfo);
|
||||
try {
|
||||
ya.login();
|
||||
} catch (e) {}
|
||||
},
|
||||
fail: (res) => {}
|
||||
});
|
||||
},
|
||||
login() {
|
||||
let ya = this;
|
||||
// 获取登录用户code
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: function(res) {
|
||||
if (res.code) {
|
||||
let code = res.code;
|
||||
ya.updateUserInfo(code);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '登录失败!',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
//调用登录接口
|
||||
updateUserInfo(code) {
|
||||
let ya = this;
|
||||
uni.showToast({
|
||||
title: '登录中...',
|
||||
icon:'loading',
|
||||
duration:10000
|
||||
})
|
||||
var params = {
|
||||
code:code,
|
||||
nickname: ya.userInfo.nickName,//用户昵称
|
||||
headimgurl: ya.userInfo.avatarUrl,//用户头像
|
||||
country: ya.userInfo.country,//用户所在国家
|
||||
province: ya.userInfo.province,//用户所在省份
|
||||
city: ya.userInfo.city,//用户所在城市
|
||||
gender: ya.userInfo.gender,//用户性别
|
||||
language:ya.userInfo.language,//语言
|
||||
is_active:1
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
// console.log(res);
|
||||
if(res.data.token!=''){
|
||||
uni.setStorageSync('params',params)
|
||||
uni.setStorageSync('userId',res.data.account_id)
|
||||
uni.setStorageSync('token',res.data.token)//缓存token
|
||||
uni.setStorageSync('expire',res.data.expire)//缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('is_active',res.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('invite_code',res.data.invite_code)
|
||||
uni.hideToast()
|
||||
this.isShowP = true
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
@tcolor:#333333;
|
||||
@tcolorp:#3875F6;
|
||||
.login-header {display: flex;justify-content: center;align-items: center;flex-direction: column;margin-top: 40%;}
|
||||
.infoImg {width: 192rpx;height: 192rpx;border-radius: 100%;}
|
||||
.logo-name {font-size: 30rpx;font-weight: bold;margin-top: 20rpx;color: @tcolor;}
|
||||
.login-box {margin-top: 60rpx;text-align: center;}
|
||||
.login-btn {width: 80%;margin-top: 50%;}
|
||||
.xie-box{display: flex;justify-content: center;align-items: center;color: @tcolor;margin-top: 30rpx;}
|
||||
.xieCon{color: @tcolorp;}
|
||||
</style>
|
|
@ -0,0 +1,26 @@
|
|||
<template>
|
||||
<view>
|
||||
<status-nav :titleVal="'协议'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="mar20">
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
content:'<p>1.用户协议谢谢洗诶诶黑货币的宁波</p>'
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.$toolAll.tools.escape2Html(this.content)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,306 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :statusBack="false" :titleVal="'分类'" :statusTitle="true"></status-nav>
|
||||
<view class="disje mar-zy20" :style="{paddingTop: (statusHNH+10)+'px'}">
|
||||
<template v-if="cateList.length!=0">
|
||||
<view class="cate-box" :style="{paddingTop:statusHNH+'px'}" style="overflow: hidden;overflow-y: scroll;">
|
||||
<view class="fon26">
|
||||
<view class="mar-s20 flexs" :style="{color : ccurrent==indexc ? publicColor:''}"
|
||||
:class="ccurrent==indexc?'bold cateActive':'catemo'"
|
||||
v-for="(itemc,indexc) in cateList" :key="indexc"
|
||||
@tap="chooseCate(indexc)">{{itemc.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view :style="{width:cateW+'px'}" class="flexs" style="height: 10px;"></view>
|
||||
<view v-show="isLoading" class="width100 pad-x260">
|
||||
<!-- 热门推荐 -->
|
||||
<template v-if="ccurrent==0">
|
||||
<!-- 自定义轮播 -->
|
||||
<swiper-pu :bannerList="bannerList" :newHeight="'154'" :newRadius="'10'" :newBottom="'10'"></swiper-pu>
|
||||
<!-- 自定义二级分类 -->
|
||||
<view class="mar-x20 mar-s40">
|
||||
<cate-pu :newCurrent="newCurrent*1" :activeb="publicColor" @choosecateEv="chooseTwo" :newcateList="cateListTwo"></cate-pu>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<view v-if="dataList.length!=0">
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :nFon="'14'" :radiu="true" :nmarz="'6'" :nWidth="'90'" :nHeight="'90'" :list="dataList"></list-pu>
|
||||
</view>
|
||||
<view v-else style="padding-top: 150rpx;">
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="dataList"></list-pu>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 秃顶种植 -->
|
||||
<template v-if="ccurrent!=0">
|
||||
<view v-if="tuList.length!=0">
|
||||
<cate-tu :isDetail="true" :list="tuList"></cate-tu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 60%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无内容</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<!-- 底部tab -->
|
||||
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='1'></foot-tab>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import swiperPu from '@/components/swiper-pu.vue';
|
||||
import cateTu from '@/components/cate-items/cate-tu.vue';
|
||||
import {collectionEV,cancleCollectionEV,checkBanner} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{
|
||||
swiperPu,
|
||||
cateTu
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
ccurrent:0,
|
||||
cateList:[],
|
||||
cateListTwo:[//二级分类
|
||||
|
||||
],
|
||||
dataList:[//小课堂数据列表
|
||||
|
||||
],
|
||||
showTop:false,//是否显示返回顶部
|
||||
tuList:[],
|
||||
newCurrent:0,
|
||||
cateW:'',//分类宽度
|
||||
isLoading:false,
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
category_id:'',//栏目ID
|
||||
disease_id:'',//一级病种ID 可不填
|
||||
bannerList:[],
|
||||
titleList:[],
|
||||
imgList:[],
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkCate(this.category_id)//调用自主预约列表事件
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.checkBZ()//调用病种列表事件
|
||||
let maiOjb = {
|
||||
e:7,//进入分类
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
this.checkSwi()
|
||||
},
|
||||
onShow() {
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
this.$toolAll.tools.isLogin()
|
||||
// console.log(this.category_id);
|
||||
if(this.category_id!='') this.checkCate(this.category_id)//调用左侧列表点击事件
|
||||
},
|
||||
methods: {
|
||||
checkSwi(){
|
||||
checkBanner({position:'category-hot-banner'}).then(res=>{
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
res.data.forEach(item=>{
|
||||
let isVideo = false
|
||||
if(item.type!='img') isVideo = true
|
||||
let banObj = {
|
||||
imgSrc:this.$http + item.src,
|
||||
url:item.url,
|
||||
isVideo:isVideo,
|
||||
poster:this.$http + item.src,
|
||||
}
|
||||
this.bannerList.push(banObj)
|
||||
})
|
||||
}
|
||||
//
|
||||
}
|
||||
})
|
||||
},
|
||||
chooseLike(e){//收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_collected==0){
|
||||
this.dataList[e].is_collected = 1
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
comfirmev(e){//确认取消收藏事件
|
||||
this.dataList[e].is_collected = 0
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
},
|
||||
checkBZ(){//病种列表
|
||||
this.$requst.post('archives/disease').then(res=>{
|
||||
// console.log('病种列表:',res);
|
||||
if(res.code==0 && res.data.length!=0){
|
||||
this.cateList=[]
|
||||
res.data.forEach(item=>{
|
||||
let obj = {
|
||||
id:item.id,
|
||||
title:item.name,
|
||||
pid:item.pid,
|
||||
sort:item.sort
|
||||
}
|
||||
this.cateList.push(obj)
|
||||
})
|
||||
let reObj = {
|
||||
id:this.cateList[0].id,
|
||||
title:'热门推荐',
|
||||
pid:this.cateList[0].pid,
|
||||
sort:this.cateList[0].sort
|
||||
}
|
||||
this.cateList.unshift(reObj)
|
||||
this.checkCate(this.category_id)//调用分类列表事件
|
||||
if(this.cateList.length!=0){
|
||||
setTimeout(()=>{
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.cate-box').boundingClientRect((rect) => {
|
||||
// console.log('分类宽度:',rect.width);
|
||||
this.cateW = rect.width
|
||||
}).exec()
|
||||
},300)
|
||||
}
|
||||
setTimeout(()=>{this.isLoading = true},500)
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
checkCate(category_id){//分类列表事件
|
||||
// this.$toolAll.tools.showToast('加载中...')
|
||||
this.$requst.post('archives/hot',{category_id:category_id,page:this.page,size:this.size}).then(res=>{
|
||||
// console.log('分类列表:',res);
|
||||
if(res.code==0){
|
||||
if(this.category_id==''){
|
||||
if(res.data.category.length!=0){
|
||||
this.cateListTwo = []
|
||||
res.data.category.forEach(item=>{
|
||||
let cateObj = {
|
||||
id:item.id,
|
||||
model:item.model,
|
||||
model_id:item.model_id,
|
||||
sort:item.sort,
|
||||
title:item.title
|
||||
}
|
||||
this.cateListTwo.push(cateObj)
|
||||
})
|
||||
this.cateListTwo.push({title:'筛选'})
|
||||
this.category_id = this.cateListTwo[0].id
|
||||
}
|
||||
}
|
||||
// 获取列表
|
||||
if(this.page==1) this.dataList = []
|
||||
if(res.data.list.list.length!=0){
|
||||
this.total = res.data.list.total
|
||||
res.data.list.list.forEach(item=>{
|
||||
let tObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img:'/static/public/logo.png',//发布者头像
|
||||
name:'恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
}
|
||||
if(this.newCurrent==0 && item.category_id==32) this.dataList.push(tObj)
|
||||
if(this.newCurrent==1 && item.category_id==33) this.dataList.push(tObj)
|
||||
if(this.newCurrent==2 && item.category_id==34) this.dataList.push(tObj)
|
||||
if(this.newCurrent==3 && item.category_id==38) this.dataList.push(tObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
checkData(disease_id){//一级病种列表事件
|
||||
this.$requst.post('archives/disease-question',{disease_id:disease_id}).then(res=>{
|
||||
// console.log('一级病种列表内容:',res);
|
||||
if(res.code==0){
|
||||
this.tuList = []
|
||||
if(res.data.list.length!=0){
|
||||
res.data.list.forEach(item=>{
|
||||
let arr = []
|
||||
if(item.children.length!=0){
|
||||
item.children.forEach(itemt=>{
|
||||
let objt = {
|
||||
category_id:itemt.category_id,
|
||||
content:itemt.title,
|
||||
id:itemt.id,
|
||||
disease_id:itemt.disease_id,//一级病种ID 1
|
||||
disease_second_id:itemt.disease_second_id,//二级病种ID 12
|
||||
subtitle:itemt.subtitle//内容副标题
|
||||
}
|
||||
arr.push(objt)
|
||||
})
|
||||
}
|
||||
let obj = {
|
||||
title:item.name,
|
||||
src:'',
|
||||
list:arr
|
||||
// {content:'秃顶种植保养周期'},
|
||||
// {content:'秃顶种植保养手册'},
|
||||
// {content:'秃顶种植保养项目'},
|
||||
// {content:'那些人需要保养'},
|
||||
// ]
|
||||
}
|
||||
this.tuList.push(obj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
chooseCate(index){//分类选中事件
|
||||
this.ccurrent = index
|
||||
this.checkData(this.cateList[index].id)
|
||||
// console.log('分类选中:',index);
|
||||
},
|
||||
chooseTwo(index){//二级分类选择
|
||||
this.newCurrent = index
|
||||
this.isZanw = true
|
||||
this.page = 1
|
||||
this.category_id = this.cateListTwo[index].id
|
||||
// console.log('二级分类:',this.cateListTwo[index].title);
|
||||
if(this.cateListTwo[index].title=='筛选'){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/searchPage/searchPage'
|
||||
})
|
||||
} else {
|
||||
this.checkCate(this.cateListTwo[index].id)
|
||||
}
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,350 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<navigator open-type="navigateBack"/>
|
||||
<status-nav :backgroudColor="publicColor" :tabcolor="publicColor" :statusTitle="true" :statusBack="false"></status-nav>
|
||||
<view class="mar-zy32 posir pad-x260" :style="{paddingTop:statusHNH+'px'}">
|
||||
<view class="bacf radius20 posir gao" style="box-shadow: 0px 16rpx 30rpx rgba(141, 141, 141, 0.26);">
|
||||
<view class="posia" :style="{top:`-${gaoh*0.4}px`,height:gaoh+'px',background:publicColor}" style="left: -32rpx;right: -32rpx;z-index: -1;"></view>
|
||||
<view class="disjbac">
|
||||
<view class="disac">
|
||||
<!-- 头像 -->
|
||||
<image class="mar-sx30" :src="userInfo.headimgurl || ''" style="width:120rpx;height: 120rpx;border-radius: 100%;margin-left: 15rpx;z-index: 1;" mode="aspectFill"></image>
|
||||
<view class="mar-z30">
|
||||
<!-- 昵称 -->
|
||||
<view class="fon36 bold">{{userInfo.nickname || ''}}</view>
|
||||
<view class="disac mar-s10" v-if="userInfo.mobile!==''">
|
||||
<image src="/static/public/phone.png" style="width: 14rpx;height: 20rpx;" mode=""></image>
|
||||
<!-- 手机号 -->
|
||||
<view class="fon24 col3 mar-z10">{{userInfo.mobile}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mar-y25 disac">
|
||||
<!-- 二维码 -->
|
||||
<image @tap="isQrcode=true" src="/static/public/eqr.png" style="width: 43rpx;height: 43rpx;z-index: 1;" mode=""></image>
|
||||
<!-- 前进键 -->
|
||||
<view @tap="goNodifyData" style="width: 50rpx;position: relative;z-index: 1;justify-content: flex-end;" class="disac">
|
||||
<image class="" src="/static/public/nextM.png" style="width: 35rpx;height: 35rpx;z-index: 1;" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="disja posir" style="z-index: 1;">
|
||||
<view @tap="choosesjf(indext)" class="disac fc flexs" style="width: 33%;" v-for="(itemt,indext) in tongList" :key="indext">
|
||||
<view class="fon28 bold mar-sx20 clips1">{{itemt.num}}<text v-if="indext==2">人</text></view>
|
||||
<view class="fon28 mar-x25">{{itemt.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<image class="posia" style="top: 0;left: 0;right: 0;bottom: 0;width: 100%;height: 100%;z-index: 0;" src="/static/public/mybt.png" mode=""></image>
|
||||
</view>
|
||||
<!-- 员工功能 v-if="userInfo.is_staff && yuanList.length!=0" -->
|
||||
<view v-if="userInfo.is_staff==1" class="bacf radius20 mar-s20 pad20">
|
||||
<view class="mar-x30 fon28 bold col3">员工功能</view>
|
||||
<view class="disac yuan-box">
|
||||
<view @tap="chooseYitem(indexy)" style="width: 33%;display: flex;justify-content: center;align-items: center;position: relative;" v-for="(itemy,indexy) in yuanList" :key="indexy">
|
||||
<view class="disac fc">
|
||||
<image :src="itemy.src" style="width: 54rpx;height: 54rpx;" mode="aspectFill"></image>
|
||||
<view class="fon28 mar-s20 mar-x10">{{itemy.title}}</view>
|
||||
</view>
|
||||
<view v-if="indexy<(yuanList.length-1)" style="height: 58rpx;border: 2rpx solid #E6E6E6;position: absolute;right: 0;"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 广告 -->
|
||||
<image @tap="goPage" class="width100 radius20 mar-sx20" :src="guangImg" style="height: 160rpx;" mode="aspectFill"></image>
|
||||
<!-- 功能列表 -->
|
||||
<view class="bacf radius20 pad-zy30">
|
||||
<view @tap="chooseItem(indexl)" class="disjbac pad-sx30 borbot" v-for="(iteml,indexl) in toolsList" :key="indexl">
|
||||
<view class="icon-box disac">
|
||||
<image class="mar-y20" :src="iteml.src" mode=""></image>
|
||||
<view class="fon26">{{iteml.title}}</view>
|
||||
</view>
|
||||
<view class="disac">
|
||||
<view v-if="iteml.num!='' && iteml.num!=0" style="width: 40rpx;height: 40rpx;border-radius: 100%;background-color: #F96969;font-size: 18rpx;text-align: center;line-height: 40rpx;color: #FFFFFF;">{{iteml.num}}</view>
|
||||
<image class="mar-z10" src="/static/public/nexth.png" style="width: 18rpx;height: 18rpx;" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 我的二维码弹框 -->
|
||||
<view v-if="isQrcode" class="posAll disjcac">
|
||||
<view>
|
||||
<view class="bacf radius20" style="margin: 0 130rpx;">
|
||||
<view class="fon28 col3 tc pad-s40">我的二维码</view>
|
||||
<image :src="myqr" style="width: 325rpx;height: 325rpx;margin: 30rpx 86rpx 68rpx 86rpx;" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="disjcac">
|
||||
<image @tap="isQrcode=false" class="mar-s50" src="/static/public/qrcodec.png" style="width: 96rpx;height: 96rpx;border-radius: 100%;" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部tab -->
|
||||
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='4'></foot-tab>
|
||||
<!-- 弹框授权 -->
|
||||
<empower :vision="vision" @cancleEv="cancleEv"></empower>
|
||||
<view v-if="isQian" style="position: fixed;top: 50%;left: 50%;transform: translate(-50%,-50%);">
|
||||
<view style="padding: 20rpx 40rpx;background-color: rgba(0,0,0,.6);color: #FFFFFF;border-radius: 6rpx;">签到成功</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {base64ToPath} from '@/jsFile/base64-src.js';
|
||||
import empower from '@/components/empower.vue';
|
||||
import {checkBanner} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{empower},
|
||||
data() {
|
||||
return {
|
||||
vision:false,
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
tongList:[
|
||||
{num:'0',title:'文章收藏'},
|
||||
{num:'0',title:'积分'},
|
||||
{num:'0',title:'我的分享'}
|
||||
],
|
||||
yuanList:[], //'customer-list','footmarks','scan'
|
||||
zanCyuanList:[
|
||||
{src:'/static/public/keh.png',title:'客户列表',rule:'customer-list'},
|
||||
{src:'/static/public/zu.png',title:'用户足迹',rule:'footmarks'},
|
||||
{src:'/static/public/scan.png',title:'扫码签到',rule:'scan'},
|
||||
],
|
||||
toolsList:[
|
||||
{src:'/static/public/zyuy.png',title:'自助预约',num:''},
|
||||
{src:'/static/public/hb.png',title:'个人海报',num:''},
|
||||
{src:'/static/public/wsc.png',title:'文章收藏',num:''},
|
||||
{src:'/static/public/fx.png',title:'分享中心',num:''},
|
||||
{src:'/static/public/message.png',title:'消息通知',num:''},
|
||||
{src:'/static/public/ts.png',title:'投诉与建议',num:''},
|
||||
{src:'/static/public/aboutus.png',title:'关于我们',num:''},
|
||||
],
|
||||
isQrcode:false,//是否显示我的二维码
|
||||
userInfo:{},//用户信息
|
||||
gaoh:uni.getStorageSync('gao'),
|
||||
myqr:'/static/public/qrcode.png',
|
||||
is_worker:'',//是否为职工账号,0否(客户), 1是
|
||||
is_doctor:'',//是否为医生,0否,1是
|
||||
is_servicer:'',//是否为客服,0否,1是
|
||||
is_staff:'',//是否为普通员工,0否,1是
|
||||
titleList:[],
|
||||
imgList:[],
|
||||
isQian:false,
|
||||
bannerList:[],
|
||||
guangImg:'',
|
||||
isAuth:'',
|
||||
guanggao:''
|
||||
}
|
||||
},
|
||||
onUnload: function() {
|
||||
//相当于监听返回按钮
|
||||
let pages = getCurrentPages();
|
||||
// console.log('pages:',pages);
|
||||
},
|
||||
onShow() {
|
||||
uni.removeStorageSync('uinfo')//清空用户缓存信息
|
||||
this.$toolAll.tools.isLogin()
|
||||
this.checkInfo()
|
||||
uni.removeStorageSync('shareAll')//清空分享中心里的统计信息
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
}
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
onLoad() {
|
||||
if(uni.getStorageSync('gao')==''){
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.gao').boundingClientRect((rect) => {
|
||||
uni.setStorageSync('gao',rect.height)
|
||||
this.gaoh = rect.height
|
||||
}).exec()
|
||||
}
|
||||
this.checkSwi()
|
||||
this.checkGM()
|
||||
},
|
||||
methods: {
|
||||
goPage(){
|
||||
uni.navigateTo({
|
||||
url:this.guanggao
|
||||
})
|
||||
},
|
||||
checkSwi(){
|
||||
checkBanner({position:'personal-center-banner'}).then(res=>{
|
||||
// console.log('res',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
this.guangImg = this.$http + res.data[0].src
|
||||
this.guanggao = res.data[0].url
|
||||
// res.data.forEach(item=>{
|
||||
// let isVideo = false
|
||||
// if(item.type!='img') isVideo = true
|
||||
// let banObj = {
|
||||
// imgSrc:this.$http + item.src,
|
||||
// url:item.url,
|
||||
// isVideo:isVideo,
|
||||
// poster:this.$http + item.src,
|
||||
// }
|
||||
// this.bannerList.push(banObj)
|
||||
// })
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
cancleEv(e){
|
||||
if(e==0) this.vision = false
|
||||
},
|
||||
checkGM(){//查询个人二维码事件
|
||||
this.$requst.post('user/personal-qr').then(res=>{
|
||||
// console.log('个人二维码:',res);
|
||||
if(res.code==0){
|
||||
base64ToPath(res.data.qr).then(path => {
|
||||
this.myqr = path
|
||||
uni.setStorageSync('imgSrc',path)
|
||||
}).catch(error => {})
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
checkInfo(){
|
||||
this.$requst.post('user/info').then(res=>{
|
||||
// console.log('用户信息:',res);
|
||||
if(res.code==0 && res.data.length!=0) {
|
||||
this.userInfo = res.data;
|
||||
this.tongList[1].num = res.data.score//个人积分
|
||||
this.tongList[0].num = res.data.collects//收藏总数
|
||||
this.tongList[2].num = res.data.share_users.total//分享人总数
|
||||
this.toolsList[4].num = res.data.unread_messages//分享人总数
|
||||
this.is_worker = res.data.is_worker//是否为职工账号,0否(客户), 1是
|
||||
this.is_doctor = res.data.is_doctor//是否为医生,0否,1是
|
||||
this.is_servicer = res.data.is_servicer//是否为客服,0否,1是
|
||||
this.is_staff = res.data.is_staff//是否为普通员工,0否,1是
|
||||
if(res.data.is_staff==1){
|
||||
if(this.toolsList.length!=8){
|
||||
this.toolsList.push({src:'/static/public/aboutus.png',title:'客服二维码',num:''})
|
||||
}
|
||||
}
|
||||
uni.setStorageSync('shareAll',res.data)
|
||||
if(res.data.rules.length!=0){
|
||||
let result = this.zanCyuanList.filter(item => res.data.rules.some(itemt => itemt===item.rule))
|
||||
this.yuanList = result
|
||||
uni.setStorageSync('rules',res.data.rules)
|
||||
} else this.yuanList = []
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
chooseItem(index){//列表事件
|
||||
// console.log('当前选项:',this.toolsList[index].title);
|
||||
let newUrl = ''
|
||||
if(index==0) newUrl = '/pagesA/makeAnPppointment/makeAnPppointment'
|
||||
if(index==1) newUrl = '/pagesB/personalPoster/personalPoster'
|
||||
if(index==2) newUrl = '/pagesB/myCollection/myCollection'
|
||||
if(index==3) newUrl = '/pagesB/sharingCenter/sharingCenter'
|
||||
if(index==4) newUrl = '/pagesB/messagecenter/messagecenter'
|
||||
if(index==5) newUrl = '/pagesA/suggestions/suggestions'
|
||||
if(index==6) newUrl = '/pagesB/aboutUs/aboutUs'
|
||||
if(index==7) newUrl = '/pagesB/customer/customer'
|
||||
uni.navigateTo({
|
||||
url:newUrl
|
||||
})
|
||||
},
|
||||
chooseYitem(index){//员工功能事件
|
||||
// console.log('当前选项:',this.yuanList[index].title);
|
||||
switch (index){
|
||||
case 0:
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/customerList/customerList'
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/userFootprint/userFootprint'
|
||||
})
|
||||
break;
|
||||
case 2:
|
||||
wx.scanCode({ // 微信扫码 调起客户端扫码界面进行扫码
|
||||
complete: (res) => {}, //接口调用结束的回调函数(调用成功、失败都会执行)
|
||||
fail: (res) => {}, //接口调用失败的回调函数
|
||||
onlyFromCamera: false, //是否只能从相机扫码,不允许从相册选择图片,这里是只允许相机扫码
|
||||
scanType: ['qrCode'], // scanType:扫码类型 : 二维码
|
||||
success: (rt) => { // 接口调用成功的回调函数
|
||||
let uc = JSON.parse(rt.result).user_coding
|
||||
this.$requst.post('user/sign-in',{user_coding:uc}).then(res=>{
|
||||
// console.log('执行扫码事件:',res);
|
||||
if(res.code==0){
|
||||
this.isQian = true
|
||||
setTimeout(()=>{
|
||||
this.isQian = false
|
||||
},2000)
|
||||
}
|
||||
},error=>{})
|
||||
}
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
choosesjf(index){//文章收藏事件、积分、我的分享
|
||||
// console.log('当前选项:',this.tongList[index].title);
|
||||
switch (index){
|
||||
case 0:
|
||||
uni.navigateTo({//我的收藏
|
||||
url:'/pagesB/myCollection/myCollection'
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
uni.navigateTo({//客户列表
|
||||
url:'/pagesB/mysharer/mysharer'
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
goNodifyData(){//去修改资料页面
|
||||
uni.setStorageSync('uinfo',this.userInfo)
|
||||
uni.navigateTo({
|
||||
url:'/pagesA/nodifyData/nodifyData'
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,510 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<view class="status-box statusHNH">
|
||||
<view :style="{height:statusBarHeight+'px',background:publicColor}"></view>
|
||||
<view class="status-nav" :style="{background:publicColor}">
|
||||
<!-- 标题 -->
|
||||
<view class="tab-title tcenter" style="color: #FFFFFF;">首页<text v-if="!isNet" class="mar-z20">(正在尝试连接网络...)</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="isNet">
|
||||
<!-- <status-nav :titleVal="'首页'" :backgroudColor="publicColor" :tabcolor="'#FFFFFF'" :statusBack="false" :statusTitle="true"></status-nav> -->
|
||||
<!-- 输入框 -->
|
||||
<view class="input-box posiszy" :style="{top: statusHNH+'px',background:publicColor}" style="height: 60px;display: flex;align-items: center;">
|
||||
<view class="disac width100">
|
||||
<image class="searchImg flexs" src="/static/public/search.png" mode="aspectFill"></image>
|
||||
<!-- 输入框 -->
|
||||
<input @confirm="searchEv" class="width100 fon34" type="text" v-model="searchVal" placeholder="请输入问题/病种/医生姓名"/>
|
||||
<!-- 竖线 -->
|
||||
<view class="linev"></view>
|
||||
<!-- 搜索 -->
|
||||
<view @tap="searchEv" class="searchT flexs fon34" :style="{color:publicColor}">搜索</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pad-x180">
|
||||
<!-- 自定义轮播 -->
|
||||
<view :style="{marginTop: (statusHNH+60)+'px'}">
|
||||
<swiper-pu :bannerList="bannerList"></swiper-pu>
|
||||
</view>
|
||||
<!-- 宫格 -->
|
||||
<view v-if="gonggList.length>1" class="mar-zy30 bacf radius10 pad-s25 mar-s10 disac fw">
|
||||
<view class="disac fc gongg-box mar-x25" style="width: 25%;" @tap="chooseGon(indexgg)" v-for="(itemgg,indexgg) in gonggList" :key="indexgg">
|
||||
<view class="img-box">
|
||||
<image :src="itemgg.src" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="fon24">{{itemgg.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 发问 -->
|
||||
<view class="mar-zy30 mar-sx20 disjb">
|
||||
<image class="flexs mar-y20 radius30 fawen-img" @tap="tapChoose(0)" :src="gaoone.imgSrc" mode="aspectFill"></image>
|
||||
<view class="disjb fc width100">
|
||||
<image class="radius30 width100 fawen-itemImg" @tap="tapChoose(1)" :src="gaotwo.imgSrc" mode=""></image>
|
||||
<image class="radius30 width100 fawen-itemImg" @tap="tapChoose(2)" :src="gaothree.imgSrc" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 热门搜索 -->
|
||||
<view v-if="isLoading" class="mar-zy30 mar-s50">
|
||||
<view class="col2c fon36 bold mar-x36">热门搜索</view>
|
||||
<view class="bacf fon24 disac fw radius20 pad-zy20 pad-s20">
|
||||
<view @tap="chooseReEv(indexf)" v-for="(itemf,indexf) in fwList" :key="indexf" class="disac radius10 mar-x20 reitem-box">
|
||||
<image src="/static/public/hot.png" mode="aspectFill"></image>
|
||||
<view class="">{{itemf.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 恒美小课堂 -->
|
||||
<view v-if="isLoading" class="mar-zy30 mar-s40">
|
||||
<view class="col2c fon36 bold">恒美小课堂</view>
|
||||
<!-- 自定义二级分类 -->
|
||||
<view class="mar-s50 mar-x30">
|
||||
<cate-pu :activeb="publicColor" :newcateList="ktList" :isMinW="true" :newCurrent="newCurrent*1" @choosecateEv="choosecateEv" :newbmo="'#E0E0E0'"></cate-pu>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<!-- <wfalls-flow @chooseLike="chooseLike" @comfirmev="comfirmev" :list="dataList" ref="wfalls"></wfalls-flow> -->
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="dataList"></list-pu>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="disjcac fc" style="height: 100vh;">
|
||||
<view class="fon24 col3">{{wuNet}}<text @tap="refresh" style="color: #007AFF;margin-left: 20rpx;">刷新</text></view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 底部tab -->
|
||||
<foot-tab :titleList="titleList" :imgList="imgList"></foot-tab>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 底部客服 -->
|
||||
<!-- <public-customer></public-customer> -->
|
||||
<!-- 弹框优惠券 -->
|
||||
<!-- <view class="" v-if="isQuan" style="background: rgba(0,0,0,.54);position: fixed;top: 0;left: 0;right: 0;bottom: 0;z-index: 11;display: flex;justify-content: center;flex-direction: column;align-items: center;">
|
||||
<image src="../../../static/public/yquan.png" style="width: 542rpx;height: 600rpx;" mode="aspectFill"></image>
|
||||
<image @tap="closeEv" src="../../../static/public/closequan.png" style="width: 96rpx;height: 96rpx;margin-top: 56rpx;" mode=""></image>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const {log} = console;
|
||||
import swiperPu from '@/components/swiper-pu.vue';
|
||||
import wfallsFlow from '@/components/wfalls-flow'
|
||||
import {collectionEV,cancleCollectionEV,checkBanner} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{
|
||||
swiperPu,
|
||||
wfallsFlow
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight:uni.getSystemInfoSync().statusBarHeight,
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
searchVal:'',//输入框的值
|
||||
publicColor:'',//主题颜色
|
||||
gonggList:[//九宫格列表
|
||||
],
|
||||
fwList:[//热搜关键词
|
||||
],
|
||||
kcurrent:0,//默认选中第一项
|
||||
ktList:[//恒美小课堂
|
||||
],
|
||||
dataList:[//小课堂数据列表
|
||||
],
|
||||
showTop:false,
|
||||
newCurrent:0,
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
course_id:0,
|
||||
isLoading:false,
|
||||
isShowT:true,
|
||||
titleList:[],//底部导航文字
|
||||
imgList:[],//底部导航图标
|
||||
gaoone:{},
|
||||
gaotwo:{},
|
||||
gaothree:{},
|
||||
isNet:true,
|
||||
wuNet:'当前无网络连接',
|
||||
refTime:'',
|
||||
reNum:0,
|
||||
bannerList:[],//轮播图
|
||||
jieDuan:false,
|
||||
isNewRenderDone:false ,//锁的作用
|
||||
isQuan:true
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkKT()//调用自主预约列表事件
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
log('输出的解构')
|
||||
this.checkNet()
|
||||
this.$toolAll.tools.overdue()
|
||||
this.$toolAll.tools.isLogin()
|
||||
let maiOjb = {
|
||||
e:6,//进入首页
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
if(uni.getStorageSync('token')!='' && uni.getStorageSync('chu')=='') {
|
||||
this.$toolAll.tools.daoTime()
|
||||
uni.setStorageSync('chu',1)
|
||||
}
|
||||
this.checkKT()//恒美课堂列表
|
||||
},
|
||||
onShareAppMessage(res) {},
|
||||
onLoad(options) {
|
||||
// 模拟首次加载列表数据
|
||||
// setTimeout(()=>{
|
||||
// // this.list = list;
|
||||
// this.$refs.wfalls.init();
|
||||
// },1000)
|
||||
if (options && options.q) {
|
||||
let arr = decodeURIComponent(options.q).split('?')[1].split('&')
|
||||
let obj = {}
|
||||
arr.forEach(item => {
|
||||
let brr = item.split('=')
|
||||
obj[brr[0]] = brr[1]
|
||||
})
|
||||
console.log(obj);
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
var params = ''
|
||||
if(obj.channel!='' && obj.channel!=undefined){
|
||||
params = {
|
||||
code:res.code,
|
||||
channel:obj.channel,
|
||||
source_code:obj.source_code
|
||||
}
|
||||
}
|
||||
if(obj.invite_code!='' && obj.invite_code!=undefined){
|
||||
params = {
|
||||
code:res.code,
|
||||
invite_code:obj.invite_code,//用户邀请码
|
||||
}
|
||||
}
|
||||
if(obj.coding!='' && obj.coding!=undefined){
|
||||
params = {service_coding:obj.coding}
|
||||
this.$requst.post('user/bind-service',params).then(res => {console.log('调用成功');},error => {})
|
||||
} else {
|
||||
this.$requst.post('user/login',params).then(res => {console.log('调用成功');},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.statusHNH').boundingClientRect((rect) => {
|
||||
// log('状态栏+标题栏:',rect.height);
|
||||
uni.setStorageSync('statusHNH',rect.height)
|
||||
this.statusHNH = rect.height
|
||||
}).exec()
|
||||
this.checkBCate()
|
||||
this.checkKey()
|
||||
this.checkSwi()//查询轮播图
|
||||
// this.checkBanner()//调用轮播图查询事件
|
||||
this.$toolAll.tools.buriedPointAll()//查询需要埋点的事件id
|
||||
},
|
||||
methods: {
|
||||
closeEv(){
|
||||
this.isQuan = false;
|
||||
},
|
||||
checkSwi(){
|
||||
checkBanner({position:'home-banner'}).then(res=>{
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
res.data.forEach(item=>{
|
||||
let isVideo = false
|
||||
if(item.type!='img') isVideo = true
|
||||
let banObj = {
|
||||
imgSrc:this.$http + item.src,
|
||||
url:item.url,
|
||||
isVideo:isVideo,
|
||||
poster:this.$http + item.src,
|
||||
}
|
||||
this.bannerList.push(banObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
checkNet(){
|
||||
uni.getNetworkType({
|
||||
success: (res)=> {
|
||||
if(res.networkType=='none'){
|
||||
uni.setStorageSync('isNet',false)
|
||||
this.isNet = false
|
||||
if((this.reNum++)==5){
|
||||
clearInterval(this.refTime)
|
||||
this.wuNet = '刷新失败'
|
||||
this.reNum = 0
|
||||
}
|
||||
this.publicColor = uni.getStorageSync('publicColor')
|
||||
} else {
|
||||
uni.setStorageSync('isNet',true)
|
||||
this.isNet = true
|
||||
clearInterval(this.refTime)
|
||||
if(this.wuNet == '正在刷新...') {
|
||||
getCurrentPages()[getCurrentPages().length - 1].onLoad()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
refresh(){
|
||||
this.wuNet = '正在刷新...'
|
||||
this.refTime = setInterval(()=>{
|
||||
this.checkNet()
|
||||
},1000)
|
||||
},
|
||||
bangd(){//绑定客服事件
|
||||
this.$requst.post('').then(res=>{log('绑定客服:',res);},error=>{})
|
||||
},
|
||||
tapChoose(index){//宫格下的,三张图点击事件
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
let newUrl = ''
|
||||
if(index==0) newUrl = this.gaoone.url
|
||||
if(index==1) newUrl = this.gaotwo.url
|
||||
if(index==2) newUrl = this.gaothree.url
|
||||
uni.navigateTo({
|
||||
url:newUrl
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
},
|
||||
checkKey(){//查询热搜关键词事件
|
||||
this.$requst.get('index/hot-keywords').then(res=>{
|
||||
// log('关键词列表:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
res.data.forEach(item=>{
|
||||
let reObj = {title:item.keyword}
|
||||
this.fwList.push(reObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
checkBCate(){//查询底部事件、八宫格、
|
||||
this.$requst.post('index/mini-program-setting').then(res=>{
|
||||
// log('数据:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
if(res.data.recommend.length!=0){//宫格
|
||||
res.data.recommend.forEach(item=>{
|
||||
let bcObj = {
|
||||
src:this.$http + item.icon,
|
||||
url:item.link,
|
||||
title:item.name
|
||||
}
|
||||
this.gonggList.push(bcObj)
|
||||
})
|
||||
this.gonggList.push({src:this.$http + res.data.recommendMore,title:'更多'})
|
||||
}
|
||||
if(res.data.footBar.length!=0){//底部导航
|
||||
res.data.footBar.forEach(item=>{
|
||||
let newName = item.name
|
||||
let newObj = {
|
||||
iconPath:this.$http + item.icon[0],
|
||||
selectedIconPath:this.$http + item.icon[1],
|
||||
}
|
||||
if(item.key=="home"){
|
||||
this.imgList[0] = newObj
|
||||
this.titleList[0] = newName
|
||||
}
|
||||
if(item.key=="category"){
|
||||
this.imgList[1] = newObj
|
||||
this.titleList[1] = newName
|
||||
}
|
||||
if(item.key=="service"){
|
||||
this.imgList[2] = newObj
|
||||
this.titleList[2] = newName
|
||||
}
|
||||
if(item.key=="shop"){
|
||||
this.imgList[3] = newObj
|
||||
this.titleList[3] = newName
|
||||
}
|
||||
if(item.key=="my"){
|
||||
this.imgList[4] = newObj
|
||||
this.titleList[4] = newName
|
||||
}
|
||||
})
|
||||
uni.setStorageSync('footTitle',this.titleList)
|
||||
uni.setStorageSync('footimg',this.imgList)
|
||||
}
|
||||
if(res.data.ad.length!=0){//三张图
|
||||
this.gaoone = {
|
||||
imgSrc:this.$http + res.data.ad[0].img,
|
||||
url:res.data.ad[0].link,
|
||||
}
|
||||
this.gaotwo = {
|
||||
imgSrc:this.$http + res.data.ad[1].img,
|
||||
url:res.data.ad[1].link,
|
||||
}
|
||||
this.gaothree = {
|
||||
imgSrc:this.$http + res.data.ad[2].img,
|
||||
url:res.data.ad[2].link,
|
||||
}
|
||||
}
|
||||
// this.publicColor = res.data.mainColor
|
||||
this.publicColor = uni.getStorageSync('publicColor')
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
checkKT(){//查询恒美小课堂
|
||||
let parmas = {
|
||||
course_id:this.course_id,//课堂ID
|
||||
page:this.page,
|
||||
size:this.size
|
||||
}
|
||||
this.$requst.post('archives/course',parmas).then(res=>{
|
||||
// log('恒美小课堂列表:',res);
|
||||
if(res.code==0){
|
||||
// 课堂栏目
|
||||
if(res.data.course.length!=0){
|
||||
this.ktList = []
|
||||
res.data.course.forEach(item=>{
|
||||
let lObj = {
|
||||
id:item.id,
|
||||
title:item.title,
|
||||
active:item.active
|
||||
}
|
||||
this.ktList.push(lObj)
|
||||
})
|
||||
}
|
||||
// 课堂列表
|
||||
if(this.page==1) this.dataList = []
|
||||
if(res.data.list.list.length!=0){
|
||||
this.total = res.data.list.total
|
||||
res.data.list.list.forEach(item=>{
|
||||
let ktObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏数量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//内容标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img:'/static/public/logo.png',//用户头像
|
||||
name:'恒美植发',//用户昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
}
|
||||
this.dataList.push(ktObj)
|
||||
})
|
||||
}
|
||||
this.isLoading = true
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
chooseLike(e){//收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_collected==0){
|
||||
this.dataList[e].is_collected = 1
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
comfirmev(e){//确认取消收藏事件
|
||||
this.dataList[e].is_collected = 0
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
},
|
||||
// chooseLike(e){//收藏事件
|
||||
// // log(this.dataList[e].is_collected);
|
||||
// let active = ''
|
||||
// this.dataList.forEach((item,index)=>{
|
||||
// if(e==item.id){
|
||||
// active = index
|
||||
// }
|
||||
// })
|
||||
// if(this.dataList[active].is_collected==0){
|
||||
// this.dataList[active].is_collected = 1
|
||||
// // 调用收藏事件
|
||||
// collectionEV({action:'collect',archive_id:e})
|
||||
// }
|
||||
// },
|
||||
// comfirmev(e){//确认取消收藏事件
|
||||
// let active = ''
|
||||
// this.dataList.forEach((item,index)=>{
|
||||
// if(e==item.id){
|
||||
// active = index
|
||||
// }
|
||||
// })
|
||||
// this.dataList[active].is_collected = 0
|
||||
// this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// // 调用取消收藏事件
|
||||
// cancleCollectionEV({action:'collect',archive_id:e})
|
||||
// },
|
||||
chooseGon(index){//宫格事件
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
if(index==(this.gonggList.length-1)){
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/cate/cate'
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({url:this.gonggList[index].url})
|
||||
}
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
},
|
||||
choosecateEv(e){//恒美小课堂选择事件
|
||||
// log('恒美小课堂:',e);
|
||||
this.newCurrent = e
|
||||
this.isZanw = true
|
||||
this.page = 1
|
||||
this.course_id = this.ktList[e].id
|
||||
this.checkKT()
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
searchEv(){//搜索事件
|
||||
// log(this.searchVal);
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/searchPage/searchPage?keyWorld='+this.searchVal
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
},
|
||||
chooseReEv(index){
|
||||
if(!this.jieDuan){
|
||||
let isAuth = this.$toolAll.tools.returnAuth()
|
||||
if(!isAuth){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/searchPage/searchPage?keyWorld='+this.fwList[index].title
|
||||
})
|
||||
} else this.jieDuan = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,145 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'商城'" :statusBack="false" :statusTitle="true"></status-nav>
|
||||
<!-- 搜索输入框 -->
|
||||
<view class="search-input-box bacf" :style="{top: statusHNH+'px'}" style="position: fixed;left: 0;right: 0;">
|
||||
<view class="disac pad-zy30 mar-s20">
|
||||
<!-- 输入框 -->
|
||||
<input style="border: 2rpx solid #E0E0E0;padding: 0rpx 20rpx;height: 80rpx;line-height: 80rpx;" class="width100 fon34 radius10" type="text" v-model="searchVal" placeholder="请输入商品名称"/>
|
||||
<!-- 搜索 -->
|
||||
<view class="flexs mar-z30 radius10 pad-zy40 fon34 colf" style="height: 80rpx;line-height: 80rpx;" :style="{background:publicColor}">搜索</view>
|
||||
</view>
|
||||
<!-- 分类标题 -->
|
||||
<view style="background: #FFFFFF;font-size: 24rpx;" class="disjbac pad-zy20 pad-s20">
|
||||
<view v-for="(item,index) in shopCate" @tap="chooseShopCate(index)" :class="activeIndex==index?'activecate':'shopMo'" :style="{background:activeIndex==index?publicColor:'#F2F2F2'}" :key="index"><span>{{item}}</span></view>
|
||||
</view>
|
||||
<!-- 筛选结果 -->
|
||||
<view v-if="isClick" class="pad-zy50 disac fw pad-x20">
|
||||
<view class="col3 fon28 mar-s30">筛选:</view>
|
||||
<view v-for="(item,indexx) in shaiList" :key="indexx" style="background: #3875F6;color: #FFFFFF;border-radius: 30rpx;padding: 8rpx 20rpx;font-size: 24rpx;display: flex;align-items: center;margin-right: 20rpx;margin-top: 30rpx;">{{item}} <view class="mar-z10" @tap="deleteSX(indexx)">×</view></view>
|
||||
</view>
|
||||
<view v-if="isXiao">
|
||||
<view class="pad-zy30">
|
||||
<view class="mar-s50 mar-x20 fon28 bold">{{cateTitle}}</view>
|
||||
<view class="disac fw">
|
||||
<view @tap="chooseBing(indexb)" v-for="(itemb,indexb) in bingzList" class="mar-y30 fon26 mar-s30" :key="indexb" :class="bingIndex==indexb?'activebcate':'shopBMo'" :style="{background:bingIndex==indexb?publicColor:'#F2F2F2'}">{{itemb}}</view>
|
||||
</view>
|
||||
<view v-if="activeIndex==1">
|
||||
<view class="fon28 bold mar-sx40">医生选择</view>
|
||||
<input type="text" class="mar-x40" value="" style="height: 60rpx;border: 2rpx solid #E0E0E0;border-radius: 10rpx;width: 100%;box-sizing: border-box;padding-left: 20rpx;font-size: 24rpx;" placeholder="请输入医生姓名并选择" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 重置、筛选 -->
|
||||
<view class="disjbac pad-zy20 mar-s50 mar-x30 pad-s20">
|
||||
<view @tap="chongz" style="font-size: 28rpx;width: 294rpx;height: 60rpx;border-radius: 10rpx;text-align: center;line-height: 60rpx; background: #E6E6E6;color: #4D4D4D;">重置</view>
|
||||
<view @tap="shaix" style="font-size: 28rpx;width: 294rpx;height: 60rpx;border-radius: 10rpx;text-align: center;line-height: 60rpx; background: #3875F6;color: #FFFFFF;">筛选</view>
|
||||
</view>
|
||||
<view @tap="isXiao=false" style="background: rgba(0,0,0,.54);width: 100%;height: 600rpx;float: left;position: relative;"></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 数据列表 -->
|
||||
<view :style="{marginTop:statusHNH+titleHeight+'px'}">
|
||||
<shopList></shopList>
|
||||
</view>
|
||||
<!-- 底部tab -->
|
||||
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='3'></foot-tab>
|
||||
<!-- 购物车 -->
|
||||
<navigator url="/pagesA/shopCart/shopCart" hover-class="none">
|
||||
<view style="position: fixed;right: 30rpx;bottom: 200rpx;">
|
||||
<view class="posir" style="width: 112rpx;height: 112rpx;">
|
||||
<image src="/static/public/cart.png" mode="aspectFill" style="width: 112rpx;height: 112rpx;"></image>
|
||||
<view class="posia" style="background: #F85050;width: 28rpx;height: 28rpx;border-radius: 100%;color: #FFFFFF;font-size: 24rpx;text-align: center;line-height: 28rpx;top: 20rpx;right: 20rpx;"><view style="transform: scale(.8);">99</view></view>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import shopList from '@/components/shop-list.vue';
|
||||
export default {
|
||||
components:{
|
||||
shopList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
titleList:[],
|
||||
imgList:[],
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),
|
||||
activeIndex:'-1',
|
||||
shopCate:['全部病种','全部医生','全部活动'],
|
||||
cateTitle:'',
|
||||
bingIndex:0,
|
||||
bingzList:[],//小分类列表
|
||||
isXiao:false,//
|
||||
titleHeight:'',//标题高度
|
||||
shaiList:[],//筛选后的结果列表
|
||||
isClick:false,//是否点击了筛选
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.titleList = uni.getStorageSync('footTitle')
|
||||
this.imgList = uni.getStorageSync('footimg')
|
||||
// 缓存状态栏+标题栏的高度
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.search-input-box').boundingClientRect((rect) => {
|
||||
// console.log('状态栏+标题栏:',rect.height);
|
||||
this.titleHeight = rect.height
|
||||
}).exec()
|
||||
},
|
||||
methods: {
|
||||
chooseShopCate(index){//大分类选择事件
|
||||
this.activeIndex = index;
|
||||
this.isClick = false;
|
||||
this.bingIndex = 0;
|
||||
if(!this.isXiao) {
|
||||
this.isXiao = true;
|
||||
}
|
||||
if(this.activeIndex==0) {
|
||||
this.cateTitle = '病种选择';
|
||||
this.bingzList = ['全部','秃顶植发','眉毛种植','发际线种植','耳发种植','胡须种植','植发失败修复','其他'];
|
||||
}
|
||||
if(this.activeIndex==1) {
|
||||
this.cateTitle = '职位选择';
|
||||
this.bingzList = ['全部','植发','医师','主任'];
|
||||
}
|
||||
if(this.activeIndex==2) {
|
||||
this.cateTitle = '活动选择';
|
||||
this.bingzList = ['全部','拼团活动','团购活动','限时促销'];
|
||||
}
|
||||
},
|
||||
chooseBing(index){//小分类选择事件
|
||||
this.bingIndex = index;
|
||||
let cun = this.shaiList.indexOf(this.bingzList[index]);
|
||||
if(cun==-1){
|
||||
this.shaiList.push(this.bingzList[index]);
|
||||
}
|
||||
console.log(this.shaiList);
|
||||
},
|
||||
chongz(){//重置
|
||||
this.bingIndex = 0
|
||||
this.isClick = false;
|
||||
this.shaiList = []
|
||||
},
|
||||
shaix(){//筛选
|
||||
this.isXiao = false
|
||||
this.isClick = true;
|
||||
},
|
||||
deleteSX(index){//删除筛选
|
||||
this.shaiList.splice(index,1);
|
||||
if(this.shaiList.length==0){
|
||||
this.isClick = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page{background: #F5F5F5;}
|
||||
</style>
|
|
@ -0,0 +1,187 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'购物车'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30" style="padding-bottom: 150rpx;">
|
||||
<view class="bacf radius20 mar-s20 disjbac" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">配送方式</view>
|
||||
<view class="fon26 col3 disac">
|
||||
<view @tap="isExpress=true" :class="isExpress?'activeT':'expressT'" :style="{background:isExpress?publicColor:''}">快递</view>
|
||||
<view @tap="isExpress=false" :class="!isExpress?'activeT':'expressT'" :style="{background:isExpress?'':publicColor}">自提</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 地址信息 -->
|
||||
<view v-if="isExpress" class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">收件人信息</view>
|
||||
<view class="fon26 col3 disjbac">
|
||||
<view>
|
||||
<view class="fon28 col3 bold" style="margin: 52rpx 0 20rpx 0;">蒋灰灰 <span>188****0362</span></view>
|
||||
<view class="fon24 col9">四川省成都市成华区中环路双店路段奥园广场</view>
|
||||
</view>
|
||||
<image src="/static/public/nextM.png" style="width: 16px;height: 16px;flex-shrink: 0;" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 自提地址 -->
|
||||
<view v-else class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">自提地址</view>
|
||||
<view class="fon26 col3 disjbac" style="margin-top: 50rpx;">
|
||||
<view>
|
||||
<view class="fon28 col3 bold" style="margin-bottom: 20rpx;">恒美植发</view>
|
||||
<view class="fon24 col9">四川省成都市青羊区青羊大道213号</view>
|
||||
</view>
|
||||
<image @tap="goThere" src="/static/public/daoh.png" style="width: 96rpx;height: 93rpx;flex-shrink: 0;" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 订单信息 -->
|
||||
<view class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">订单信息</view>
|
||||
<view class="fon26 col3 disjbac pad-sx50 disjbac bbot">
|
||||
<image src="/static/public/banner.png" class="flexs" style="width: 166rpx;height: 166rpx;border-radius: 15rpx;margin-right: 12rpx;" mode="aspectFill"></image>
|
||||
<view class="width100">
|
||||
<view class="fon28 col3 bold clips2">【99皮皮节】【种植发际线】1000单位FUE技术案例招募门美人</view>
|
||||
<view style="font-size: 22rpx;color: #808080;font-weight: 500;">试用</view>
|
||||
<view class="disjbac mar-s10">
|
||||
<view style="color: #F85050;font-size: 32rpx;font-weight: bold;">¥3888</view>
|
||||
<view class="fon28 col6">x2</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 优惠 -->
|
||||
<view class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">优惠</view>
|
||||
<view @tap="showQuan=true" class="fon28 col3 disjbac mar-sx40">
|
||||
<view>优惠券</view>
|
||||
<view class="disac">
|
||||
<view style="color: #F85050;font-weight: bold;">-¥99.00</view>
|
||||
<image src="/static/public/nextM.png" style="width: 16px;height: 16px;flex-shrink: 0;" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fon28 col3 disjbac">
|
||||
<view>立减优惠</view>
|
||||
<view style="color: #F85050;font-weight: bold;">-¥99.00</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 快递费用 -->
|
||||
<view class="bacf radius20 mar-s20 disjbac" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">快递费用</view>
|
||||
<view class="fon28" style="color: #F85050;font-weight: bold;">¥10.00</view>
|
||||
</view>
|
||||
<view class="disjbac posixzy bacf" style="height: 124rpx;line-height: 124rpx;padding: 0 32rpx;">
|
||||
<!-- 去支付 -->
|
||||
<view class="fon40 bold" style="color: #F85050;">合计:¥7166.00</view>
|
||||
<view @tap="goPayment" style="color: #FFFFFF;font-size: 28rpx;font-weight: bold;width: 170rpx;height: 70rpx;line-height: 70rpx;text-align: center;background: #3875F6;border-radius: 35rpx;margin-left: 10rpx;">去支付</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="showQuan" @tap.stop="showQuan=false" class="posAll">
|
||||
<view class="bacf posixzy" style="border-radius: 40rpx 40rpx 0rpx 0rpx;" @tap.stop="showQuan=true">
|
||||
<view style="padding: 20rpx 50rpx;">
|
||||
<view class="disjbac">
|
||||
<view class="fon28 bold col3">优惠券</view>
|
||||
<image @tap.stop="showQuan=false" src="/static/public/cha-close.png" style="width: 30rpx;height: 30rpx;" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="fon28 bold col3" style="display: flex;justify-content: space-around;align-items: center;padding: 50rpx 0 16rpx 0;">
|
||||
<view class="posir" :class="switchQuan?'activeQuan':''" @tap="switchQuan=true">可用优惠券(1)</view>
|
||||
<view class="posir" :class="!switchQuan?'activeQuan':''" @tap="switchQuan=false">失效优惠券(0)</view>
|
||||
</view>
|
||||
<view class="mar-s40">
|
||||
<view style="height: 200rpx;" class="disjbac">
|
||||
<view class="posir" style="width: 218rpx;height: 200rpx;flex-shrink: 0;text-align: center;color: #FFFFFF;">
|
||||
<image class="posia" src="/static/public/quan-left.png" style="width: 218rpx;height: 200rpx;left: 0;top: 0;" mode=""></image>
|
||||
<view class="posir" style="z-index: 1;">
|
||||
<view style="margin: 40rpx 0 30rpx 0rpx;" class="fon28">¥<span style="font-size: 56rpx;font-weight: bold;">10</span></view>
|
||||
<view class="fon24">满300元可使用</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;height: 200rpx;padding: 0 20rpx;background-color: #F5F5F5;">
|
||||
<view class="fon28 col3 mar-s20">黄金会员专属优惠券</view>
|
||||
<view>
|
||||
<image src="/static/public/chooseQuan.png" style="width: 40rpx;height: 40rpx;border-radius: 100%;float: right;"></image>
|
||||
</view>
|
||||
<view class="fon20 col3 mar-x20">有效期:2021-09-06至2021-09-15</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mar-s40">
|
||||
<view style="height: 200rpx;" class="disjbac">
|
||||
<view class="posir" style="width: 218rpx;height: 200rpx;flex-shrink: 0;text-align: center;color: #FFFFFF;">
|
||||
<image class="posia" src="/static/public/quan-left.png" style="width: 218rpx;height: 200rpx;left: 0;top: 0;" mode=""></image>
|
||||
<view class="posir" style="z-index: 1;">
|
||||
<view style="margin: 40rpx 0 30rpx 0rpx;" class="fon28">¥<span style="font-size: 56rpx;font-weight: bold;">10</span></view>
|
||||
<view class="fon24">满300元可使用</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;height: 200rpx;padding: 0 20rpx;background-color: #F5F5F5;">
|
||||
<view class="fon28 col3 mar-s20">黄金会员专属优惠券</view>
|
||||
<view>
|
||||
<image src="/static/public/cancleQuan.png" style="width: 40rpx;height: 40rpx;border-radius: 100%;float: right;"></image>
|
||||
</view>
|
||||
<view class="fon20 col3 mar-x20">有效期:2021-09-06至2021-09-15</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 领取优惠券按钮 -->
|
||||
<view @tap.stop="showQuan=false" style="font-size: 36rpx;color: #FFFFFF;font-weight: bold;margin: 0 auto;background: #3875F6;border-radius: 20rpx;height: 90rpx;line-height: 90rpx;text-align: center;margin-top: 156rpx;margin-bottom: 20rpx;">领取优惠券</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 确认兑换弹框 -->
|
||||
<view v-if="isDui" @tap.stop="isDui=false" class="posAll" style="display: flex;justify-content: center;align-items: center;padding: 0 85rpx;">
|
||||
<view class="bacf radius20 width100 tc fon28 col3 pad20" @tap.stop="isDui=true">
|
||||
<view class="bold" style="margin: 0rpx 0 56rpx 0;">兑换商品</view>
|
||||
<view style="margin: 0rpx 0 66rpx 0;">您确定使用7666积分兑换吗?</view>
|
||||
<view class="disjbac mar-x20 pad-zy20">
|
||||
<view @tap.stop="isDui=false" style="width: 196rpx;height: 60rpx;line-height: 60rpx;text-align: center;font-size: 28rpx;font-weight: 500;border-radius: 10rpx;background: #C8C8C8;color: #FFFFFF;">暂不兑换</view>
|
||||
<view @tap.stop="isDui=false" style="width: 196rpx;height: 60rpx;line-height: 60rpx;text-align: center;font-size: 28rpx;font-weight: 500;border-radius: 10rpx;background: #3875F6;color: #FFFFFF;">立即兑换</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isExpress:true,
|
||||
switchQuan:true,
|
||||
showQuan:false,
|
||||
isDui:false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
goThere(){
|
||||
wx.getLocation({//获取当前经纬度
|
||||
type: 'wgs84', //返回可以用于wx.openLocation的经纬度,官方提示bug: iOS 6.3.30 type 参数不生效,只会返回 wgs84 类型的坐标信息
|
||||
success: function (res) {
|
||||
wx.openLocation({//使用微信内置地图查看位置。
|
||||
latitude: 22.5542080000,//要去的纬度-地址
|
||||
longitude: 113.8878770000,//要去的经度-地址
|
||||
name: "宝安中心A地铁口",
|
||||
address:'宝安中心A地铁口'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goPayment(){
|
||||
uni.navigateTo({
|
||||
url:'/pagesA/immediatePayment/immediatePayment'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,95 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'立即支付'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30" style="padding-bottom: 150rpx;">
|
||||
<view v-if="!isSuccess">
|
||||
<!-- 订单信息 -->
|
||||
<view class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold fon28">订单支付</view>
|
||||
<view class="fon26 col3 disjbac pad-sx50 disjbac bbot">
|
||||
<image src="/static/public/banner.png" class="flexs" style="width: 166rpx;height: 166rpx;border-radius: 15rpx;margin-right: 12rpx;" mode="aspectFill"></image>
|
||||
<view class="width100">
|
||||
<view class="fon28 col3 bold clips2">【99皮皮节】【种植发际线】1000单位FUE技术案例招募门美人</view>
|
||||
<view style="font-size: 22rpx;color: #808080;font-weight: 500;">试用</view>
|
||||
<view class="disjbac mar-s10">
|
||||
<view style="color: #F85050;font-size: 32rpx;font-weight: bold;">¥3888</view>
|
||||
<view class="fon28 col6">x2</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fon28 disjbac" style="margin: 60rpx 0 20rpx 0;">
|
||||
<view class="col6">共4件</view>
|
||||
<view style="font-weight: bold;color: #F85050;">应付款:3888.00+300孔雀币</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 支付方式 -->
|
||||
<view class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;font-size: 28rpx;color: #333333;">
|
||||
<view class="disac">
|
||||
<image src="/static/public/chooseFS.png" style="width: 40rpx;height: 40rpx;border-radius: 100%;" mode=""></image>
|
||||
<view style="margin-left: 26rpx;">微信支付</view>
|
||||
</view>
|
||||
<view class="disjbac" style="margin-top: 30rpx;">
|
||||
<view class="disac">
|
||||
<image src="/static/public/cancle-FS.png" style="width: 40rpx;height: 40rpx;border-radius: 100%;" mode=""></image>
|
||||
<view style="margin-left: 26rpx;">孔雀币</view>
|
||||
</view>
|
||||
<view>余3000</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fon28 col3" style="padding: 55rpx 0 64rpx 0;text-align: center;">请在<span style="color: #F85050;font-weight: bold;">23时25分36秒</span>完成支付</view>
|
||||
<!-- 确认支付 -->
|
||||
<view @tap="payment" style="margin: 0 auto;color: #FFFFFF;font-weight: bold;font-size: 36rpx;text-align: center;width: 546rpx;height: 90rpx;line-height: 90rpx;background-color: #3875F6;border-radius: 20rpx;">确认支付</view>
|
||||
</view>
|
||||
<!-- 支付成功 -->
|
||||
<view v-if="isSuccess" class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;text-align: center;">
|
||||
<image src="/static/public/pay-success.png" style="width: 194rpx;height: 194rpx;" mode=""></image>
|
||||
<view class="fon28 col3" style="margin: 20rpx 0 40rpx 0;">支付成功</view>
|
||||
<view class="" style="font-size: 46rpx;margin-bottom: 120rpx;color: #F85050;">¥3888.00</view>
|
||||
<view class="disja" style="margin-bottom: 150rpx;">
|
||||
<view @tap="goDetail" style="width: 244rpx;height: 70rpx;border-radius: 10rpx;text-align: center;line-height: 70rpx;background: #E9E9E9;color: #333333;">查看订单</view>
|
||||
<view @tap="goShop" style="width: 244rpx;height: 70rpx;border-radius: 10rpx;text-align: center;line-height: 70rpx;background: #3875F6;color: #FFFFFF;">再逛一逛</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isSuccess:false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
payment(){
|
||||
this.isSuccess = true
|
||||
},
|
||||
goDetail(){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/orderDetail/orderDetail'
|
||||
})
|
||||
},
|
||||
goShop(){
|
||||
uni.reLaunch({
|
||||
url:'/pages/tabbar/shop/shop'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,148 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'自主预约'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view v-if="isLoading" :style="{paddingTop: statusHNH+'px'}" class="pad-zy30" style="padding-bottom: 160rpx;">
|
||||
<view v-if="dataList.length!=0" class="mar-s30 bacf pad20" v-for="(item,index) in dataList" :key="index" style="border-radius: 28rpx;">
|
||||
<view class="disjbac">
|
||||
<view class="disac">
|
||||
<image class="radius20 mar-y20 flexs" src="/static/public/logo.png" style="width: 98rpx;height: 98rpx;" mode=""></image>
|
||||
<view>
|
||||
<view class="fon36 col3 bold clips1">{{item.name}}</view>
|
||||
<view class="fon24 col3 mar-s10">{{item.content}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view :style="{background:[ingColor,publicColor,failColor,failColor,failColor][item.status]}" class="fon24 colf radius10 flexs" style="padding: 14rpx 24rpx;">{{['审核中...','预约成功','预约失败','预约取消','预约完成'][item.status]}}</view>
|
||||
</view>
|
||||
<view class="mar-s36 fon24 col3">预约时间:{{item.yuTime}}</view>
|
||||
<view class="disjbac fon24 col3 mar-s30">
|
||||
<!-- <view>联系人:{{item.lname}}</view> -->
|
||||
<view>联系电话:{{item.lphone}}</view>
|
||||
</view>
|
||||
<view @tap="quyuy(index)" class="disjcac mar-s40 width100 colf fon30 radius10 posir" :style="{background:[quColor,quColor,publicColor,publicColor,publicColor][item.status]}" style="height: 90rpx;line-height: 90rpx;">
|
||||
{{['取消预约','取消预约','重新预约','再次预约','再次预约'][item.status]}}
|
||||
<!-- <button :disabled="(item.status==2 || item.status==3 || item.status==4)?true:false" class="posia"
|
||||
style="top: 0;left: 0;right: 0;bottom: 0;background-color: #000000;opacity: 0;">{{['取消预约','取消预约','重新预约','再次预约','再次预约'][item.status]}}</button> -->
|
||||
</view>
|
||||
</view>
|
||||
<nothing-page v-if="dataList.length==0" :content="'暂无更多预约内容'"></nothing-page>
|
||||
</view>
|
||||
<!-- 底部按钮 -->
|
||||
<view class="posixzy bacf pad-sx25">
|
||||
<view @tap="goYu" class="fon30 radius20 tc colf bold" style="margin: 0 83rpx;height: 90rpx;line-height: 90rpx;" :style="{background:publicColor}">我要预约</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :contentVal="'是否取消当前预约?'" :clearVal="'否'" :comfrimVal="'是'" @comfirmev="comfirmev" @cancleev="isShowT=false"></pu-po>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
failColor:'#CCCCCC',//失败背景颜色
|
||||
ingColor:'#FFBE4D',//审核中背景颜色
|
||||
quColor:'#FF4D4D',//取消预约背景色
|
||||
dataList:[
|
||||
// {status:0,imgSrc:'',name:'陈高医生',content:'植发',yuTime:'2021年07月08日 14:30至15:30',lname:'甄先生',lphone:'18888888888'},
|
||||
// {status:1,imgSrc:'',name:'陈高医生',content:'植发',yuTime:'2021年07月08日 14:30至15:30',lname:'甄先生',lphone:'18888888888'},
|
||||
// {status:2,imgSrc:'',name:'陈高医生',content:'植发',yuTime:'2021年07月08日 14:30至15:30',lname:'甄先生',lphone:'18888888888'},
|
||||
],
|
||||
btnCon:'取消预约',//取消预约/重新预约
|
||||
page:1,
|
||||
size:20,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
isLoading:false,
|
||||
isShowT:false,
|
||||
zzId:''//自主预约ID
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkPoint()//调用自主预约列表事件
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多预约记录','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
this.checkPoint()//调用自主预约列表事件
|
||||
this.$toolAll.tools.showToast('加载中...','loading')
|
||||
},
|
||||
methods: {
|
||||
checkPoint(){//查询自主预约列表事件
|
||||
this.$requst.post('user/appointment-list',{page:this.page,size:this.size}).then(res=>{
|
||||
// console.log('查询自主预约列表:',res);
|
||||
if(res.code==0){
|
||||
if(this.page==1) this.dataList = []
|
||||
if(res.data.list.length!=0){
|
||||
this.total = res.data.total
|
||||
res.data.list.forEach(item=>{
|
||||
let timeStr = item.appointment_at.slice(0,10).split('-')
|
||||
let timeZui = item.period.name.split('-')
|
||||
let newStatus = ''
|
||||
if(item.status_text=='审核中') newStatus = 0
|
||||
if(item.status_text=='预约成功') newStatus = 1
|
||||
if(item.status_text=='预约失败') newStatus = 2
|
||||
if(item.status_text=='预约取消') newStatus = 3
|
||||
if(item.status_text=='预约完成') newStatus = 4
|
||||
let obj = {
|
||||
id:item.id,
|
||||
status:newStatus,
|
||||
imgSrc: uni.getStorageSync('userLogo'),//缓存token,
|
||||
name:item.name,
|
||||
content:item.typeInfo.title,
|
||||
yuTime:`${timeStr[0]}年${timeStr[1]}月${timeStr[2]}日 ${timeZui[0]}至${timeZui[1]}`,
|
||||
lname:item.name,
|
||||
lphone:item.phone
|
||||
}
|
||||
this.dataList.push(obj)
|
||||
})
|
||||
}
|
||||
this.isLoading = true
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
goYu(){//去预约
|
||||
uni.navigateTo({
|
||||
url:'/pagesA/ppointmentEv/ppointmentEv'
|
||||
})
|
||||
},
|
||||
quyuy(index){//取消预约事件
|
||||
if(this.dataList[index].status==0 || this.dataList[index].status==1){
|
||||
this.zzId = this.dataList[index].id
|
||||
this.isShowT = true
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url:'/pagesA/ppointmentEv/ppointmentEv'
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
comfirmev(){
|
||||
this.isShowT = false
|
||||
this.$requst.post('user/appointment-cancel',{appointment_id:this.zzId}).then(res=>{
|
||||
// console.log('取消预约成功返回:',res);
|
||||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('取消预约成功')
|
||||
setTimeout(()=>{
|
||||
this.checkPoint()
|
||||
},1500)
|
||||
}
|
||||
},error=>{})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,283 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'修改资料'" :whereCome="whereCome" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="fon28 pad-x20">
|
||||
<view v-for="(itemd,indexd) in dataList" :key="indexd"
|
||||
class="disjbac borbot mar-zy40" :class="(indexd!=1 && indexd!=5 && indexd!=6) ? 'pad-sx40':''">
|
||||
<!-- 标题 -->
|
||||
<view class="col9 flexs" style="width: 17.8%;">
|
||||
<view v-if="indexd!=2 && indexd!=3 && indexd!=7">{{itemd.title}}:</view>
|
||||
<!-- 恒美ID -->
|
||||
<view v-if="indexd==2" class="disjb">
|
||||
<view class="disjb width100">
|
||||
<view>{{itemd.title.charAt(0)}}</view>
|
||||
<view>{{itemd.title.charAt(1)}}</view>
|
||||
<view>{{itemd.title.charAt(2)}}{{itemd.title.charAt(3)}}</view>
|
||||
</view>
|
||||
<view>:</view>
|
||||
</view>
|
||||
<!-- 性别、地址 -->
|
||||
<view v-if="indexd==3 || indexd==7" class="disjb">
|
||||
<view class="disjb width100">
|
||||
<view>{{itemd.title.charAt(0)}}</view>
|
||||
<view>{{itemd.title.charAt(1)}}</view>
|
||||
</view>
|
||||
<view>:</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="disac fe width100 tright">
|
||||
<!-- 内容 -->
|
||||
<view v-if="itemd.content!='' && (indexd!=1 && indexd!=5 && indexd!=6)" :class="indexd==1?'nic':'col3'" class="mar-y20 width100" :style="{marginRight:indexd==2?'39rpx':''}">{{itemd.content}}</view>
|
||||
<!-- 性别下拉弹框 -->
|
||||
<picker v-if="indexd==3" class="col3 mar-y20 width100" @change="changePicker" :value="current" :range="pickerData">
|
||||
<view>{{pickerData[current]}}</view>
|
||||
</picker>
|
||||
<!-- 出生日期下拉框 -->
|
||||
<picker v-if="indexd==4" mode="date" class="col3 mar-y20 width100" @change="changeTime" :value="currentt" :range="pickerTime">
|
||||
<view>{{pickerTime[currentt]}}</view>
|
||||
</picker>
|
||||
<!-- 地址下拉框 -->
|
||||
<!-- <picker v-if="indexd==7" mode="multiSelector" class="col3 mar-y20 width100" @change="changeAddress" :value="currenta" :range="pickerAddress">
|
||||
<view>{{pickerAddress[0]}}{{pickerAddress[1]}}{{pickerAddress[2]}}</view>
|
||||
</picker> -->
|
||||
<!-- <view v-if="indexd==7" @tap="openPicker" class="width100 mar-y20">{{region}}</view> -->
|
||||
<view v-if="indexd==7" @tap="openAddres2" class="width100 mar-y20">{{pickerText}}</view>
|
||||
<!-- 用户昵称、真实姓名、联系电话输入框 -->
|
||||
<input @focus="inputFo(indexd)" @blur="inputB(indexd)" v-if="indexd==1 || indexd==5 || indexd==6" :type="(indexd==1 || indexd==5)?'text':'number'" :maxlength="indexd==6?11:10" v-model="itemd.content" class="mar-y20 tright pad-sx40 width100" style="border: none;" :placeholder="itemd.fcon"/>
|
||||
<!-- 用户头像 -->
|
||||
<image v-if="indexd==0" :src="itemd.imgSrc || moHead" :class="indexd==0?'head_img':'head_next'" class="" mode="aspectFill"></image>
|
||||
<!-- <image @tap="chooseHead" v-if="itemd.imgSrc!=''" :src="itemd.imgSrc" :class="indexd==0?'head_img':'head_next'" class="" mode="aspectFill"></image> -->
|
||||
<!-- 前进键 -->
|
||||
<image v-if="indexd!=0 && indexd!=2" src="/static/public/nexth.png" class="head_next flexs"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" @tap="updataInfo" style="height: 90rpx;line-height: 90rpx;margin: 80rpx 100rpx 120rpx 100rpx;" class="radius20 fon40 bold colf tc" :style="{background:publicColor}">{{btnCon}}</view>
|
||||
<!-- 底部弹框 -->
|
||||
<!-- <city @choseVal="choseValue" :lotusAddressData="lotusAddressData"></city> -->
|
||||
<simple-address ref="simpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm" themeColor="#007AFF"></simple-address>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import city from '@/components/city/city.vue';
|
||||
import simpleAddress from '@/components/simple-address/simple-address.vue';
|
||||
export default {
|
||||
components:{
|
||||
// city,
|
||||
simpleAddress
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
moHead:'/static/public/logo.png',
|
||||
dataList:[
|
||||
{title:'用户头像',content:'',imgSrc:'',fcon:''},
|
||||
{title:'用户昵称',content:'',imgSrc:'',fcon:'请输入用户昵称'},
|
||||
{title:'恒美ID',content:'',imgSrc:'',fcon:''},
|
||||
{title:'性别',content:'',imgSrc:'',fcon:''},
|
||||
{title:'出生日期',content:'',imgSrc:'',fcon:''},
|
||||
{title:'真实姓名',content:'',imgSrc:'',fcon:'请输入真实姓名'},
|
||||
{title:'联系电话',content:'',imgSrc:'',fcon:'请输入联系电话'},
|
||||
{title:'地址',content:'',imgSrc:'',fcon:''},
|
||||
],
|
||||
isKuang:true,
|
||||
current:0,
|
||||
pickerData:['未知','男','女'],
|
||||
currentt:0,
|
||||
pickerTime:['1997-01-01'],
|
||||
currenta:0,
|
||||
// pickerAddress:['四川省 ','成都市 ','青羊区'],
|
||||
// lotusAddressData:{
|
||||
// visible:false,
|
||||
// provinceName:'',
|
||||
// cityName:'',
|
||||
// townName:'',
|
||||
// },
|
||||
// region:'四川省成都市成华区',
|
||||
cityPickerValueDefault: [0, 0, 1],
|
||||
pickerText: '四川省成都市成华区',
|
||||
btnCon:'保存',
|
||||
uinfo:{},
|
||||
addressInfo:[],
|
||||
newProvice:'',//当前省份
|
||||
newCity:'',//当前城市
|
||||
newDistrict:'',//当前区县
|
||||
whereCome:0,
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onUnload() {
|
||||
uni.removeStorageSync('firstInfo')
|
||||
},
|
||||
onLoad(options) {
|
||||
if(options.whereNum==2){
|
||||
this.whereCome = options.whereNum
|
||||
}
|
||||
let chuo = new Date().getTime()// 获取当前时间戳
|
||||
let time = this.$toolAll.tools.timestampToTime(chuo)// 转换日期格式为XXXX-XX-XX
|
||||
// 获取当前位置的经纬度
|
||||
wx.getLocation({
|
||||
success:(res)=> {
|
||||
// 逆解析经纬度
|
||||
this.getDistrict(res.latitude, res.longitude)
|
||||
},
|
||||
})
|
||||
let firstObj = uni.getStorageSync('firstInfo')
|
||||
if(firstObj==''){
|
||||
let obj = uni.getStorageSync('uinfo')
|
||||
if(obj!='') this.uinfo = obj
|
||||
this.dataList[0].imgSrc = obj.headimgurl//用户头像
|
||||
this.dataList[1].content = obj.nickname//用户昵称
|
||||
this.dataList[2].content = obj.coding//恒美ID
|
||||
this.current = obj.gender//性别1男,2女,0未知
|
||||
obj.birthday!='' ? this.pickerTime = [obj.birthday.slice(0,10)] : this.pickerTime = [time.slice(0,10)]//出生日期
|
||||
obj.real_name!=null && obj.real_name !='' ? this.dataList[5].content = obj.real_name : this.dataList[5].fcon = '未知'//真实姓名
|
||||
obj.mobile!='' ? this.dataList[6].content = obj.mobile : this.dataList[6].fcon = '未知'//电话
|
||||
if(obj.county!='') this.pickerText = obj.province + obj.city + obj.county//省市区县
|
||||
} else {
|
||||
this.dataList[0].imgSrc = firstObj.headimgurl//用户头像
|
||||
this.dataList[1].content = firstObj.nickname//用户昵称
|
||||
this.dataList[2].content = firstObj.coding//恒美ID
|
||||
this.current = firstObj.gender//性别1男,2女,0未知
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancleEv(){
|
||||
uni.setStorageSync('bindPhone',false)
|
||||
},
|
||||
updataInfo(){//修改资料事件
|
||||
let params = {
|
||||
real_name:this.dataList[5].content,//姓名
|
||||
nickname:this.dataList[1].content,//昵称
|
||||
mobile:this.dataList[6].content,//手机号
|
||||
gender:this.current,//性别,0未知,1男,2女
|
||||
province:this.addressInfo[0],//省份
|
||||
city:this.addressInfo[1],//市
|
||||
county:this.addressInfo[2],//区县
|
||||
birthday:this.pickerTime[0]//生日(出生年月),日期格式:2021-08-10
|
||||
}
|
||||
this.$requst.post('user/edit-info',params).then(res=>{
|
||||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('资料修改成功')
|
||||
setTimeout(()=>{
|
||||
if(this.whereCome==2){
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/my/my'
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack({delta:1})
|
||||
}
|
||||
},1000)
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
getDistrict(latitude, longitude) {//获取当前位置的省市区县
|
||||
let ya = this
|
||||
wx.request({
|
||||
url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${latitude},${longitude}&key=B2ABZ-SIDKS-WD2O3-6CJ2U-CDZOT-U3FKF`,
|
||||
header: {
|
||||
'Content-Type':'application/json'
|
||||
},
|
||||
success:function(res) {
|
||||
// console.log('地址数据:',res)
|
||||
ya.newProvice = res.data.result.address_component.province
|
||||
ya.newCity = res.data.result.address_component.city
|
||||
ya.newDistrict = res.data.result.address_component.district
|
||||
if(ya.pickerText=='') ya.pickerText = ya.newProvice + ya.newCity + ya.newDistrict
|
||||
}
|
||||
})
|
||||
},
|
||||
openAddres2() {//地址弹框事件
|
||||
// 根据 label 获取
|
||||
var index = this.$refs.simpleAddress.queryIndex([this.newProvice, this.newCity, this.newDistrict], 'label');
|
||||
this.cityPickerValueDefault = index.index;
|
||||
this.$refs.simpleAddress.open();
|
||||
},
|
||||
onConfirm(e) {//地址确认事件
|
||||
this.pickerText = e.labelArr[0]+e.labelArr[1]+e.labelArr[2];
|
||||
this.addressInfo = [e.labelArr[0],e.labelArr[1],e.labelArr[2]]
|
||||
},
|
||||
chooseHead(){//选择头像事件
|
||||
uni.chooseImage({
|
||||
count:1,
|
||||
success: (res) => {
|
||||
this.dataList[0].imgSrc = res.tempFilePaths[0]
|
||||
}
|
||||
})
|
||||
},
|
||||
changePicker(e){//性别选择
|
||||
this.current = e.detail.value
|
||||
},
|
||||
changeTime(e){//出生日期选择
|
||||
this.pickerTime = [e.detail.value]
|
||||
},
|
||||
changeAddress(e){
|
||||
|
||||
},
|
||||
inputFo(index){//输入框获取焦点
|
||||
if(this.dataList[index].content!=''){
|
||||
this.dataList[index].fcon = this.dataList[index].content//将当前输入框的实际值赋值给当前输入框的placeholder属性
|
||||
this.dataList[index].content = ''//清空当前输入框的实际值
|
||||
}
|
||||
},
|
||||
inputB(index){//输入框失去焦点
|
||||
if(index==1){
|
||||
if(this.dataList[1].content==''){
|
||||
this.dataList[1].content = this.uinfo.nickname
|
||||
}
|
||||
}
|
||||
if(index==5){
|
||||
if(this.dataList[5].content==''){
|
||||
this.dataList[5].content = this.uinfo.real_name
|
||||
}
|
||||
}
|
||||
if(index==6){
|
||||
if(this.dataList[6].content==''){
|
||||
this.dataList[6].content = this.uinfo.mobile
|
||||
}
|
||||
}
|
||||
}
|
||||
//打开picker
|
||||
// openPicker() {
|
||||
// this.lotusAddressData.visible = true;
|
||||
// this.lotusAddressData.provinceName = this.newProvice;
|
||||
// this.lotusAddressData.cityName = this.newCity;
|
||||
// this.lotusAddressData.townName = this.newDistrict;
|
||||
// },
|
||||
//回传已选的省市区的值
|
||||
// choseValue(res){
|
||||
// //res数据源包括已选省市区与省市区code
|
||||
// // console.log(res);
|
||||
// this.lotusAddressData.visible = res.visible;//visible为显示与关闭组件标识true显示false隐藏
|
||||
// //res.isChose = 1省市区已选 res.isChose = 0;未选
|
||||
// if(res.isChose){
|
||||
// this.lotusAddressData.provinceName = res.province;//省
|
||||
// this.lotusAddressData.cityName = res.city;//市
|
||||
// this.lotusAddressData.townName = res.town;//区
|
||||
// this.region = `${res.province} ${res.city} ${res.town}`; //region为已选的省市区的值
|
||||
// this.regionObj = {
|
||||
// province:res.province,
|
||||
// provinceCode:res.provinceCode,
|
||||
// city:res.city,
|
||||
// cityCode:res.cityCode,
|
||||
// town:res.town,
|
||||
// townCode:res.townCode
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page{background-color: #FFFFFF;}
|
||||
</style>
|
|
@ -0,0 +1,300 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'自主预约'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy20">
|
||||
<view class="bacf mar-s25 pad-zy20 radius20 fon28 col3 pad-x40">
|
||||
<view class="disac pad-s32">
|
||||
<view class="flexs mar-y20">预约类别</view>
|
||||
<view @tap="openXial(0)" class="disjbac width100 radius10 pad-zy20 xiala posir">
|
||||
<view>{{category}}</view>
|
||||
<image :class="isZhuan?'zhuan':'nozhuan'" src="/static/public/sanj.png" mode="aspectFill"></image>
|
||||
<view v-if="isZhuan" class="posia bacf radius10 xial-box">
|
||||
<view class="pad-zy20 xial-item-box">
|
||||
<view @tap="chooseXia(indexl)" :class="xialCurrent==indexl?'pcol pbord':''" v-for="(iteml,indexl) in xialone" :key="indexl">{{iteml.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class=" disac pad-s32">
|
||||
<view class="flexs mar-y20">选择医生</view>
|
||||
<view @tap="openXial(1)" class="disjbac width100 radius10 pad-zy20 xiala posir">
|
||||
<view>{{categoryT}}</view>
|
||||
<image :class="isZhuanT?'zhuan':'nozhuan'" src="/static/public/sanj.png" mode="aspectFill"></image>
|
||||
<view v-if="isZhuanT" class="posia bacf radius10 xial-box">
|
||||
<view class="pad-zy20 xial-item-box">
|
||||
<view @tap="chooseXiaT(indext)" :class="xialCT==indext?'pcol':''" v-for="(itemt,indext) in xialTwo" :key="indext">{{itemt}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 预约日期 -->
|
||||
<view class="mar-s20 mar-x30">预约日期</view>
|
||||
<scroll-view scroll-x >
|
||||
<view class="disac">
|
||||
<view @tap="chooseTime(index)" class="disjcac fc flexs radius20 mar-y20 yutime borbot-df" :class="item.status==0?'bcdb col3':'colc'" :style="{background:timeCurrent==index?publicColor:'',border:timeCurrent==index?`2rpx solid ${publicColor}`:''}" v-for="(item,index) in dataList" :key="index">
|
||||
<view :class="timeCurrent==index?'colf':'col3'" class="bold fon28">{{item.title}}</view>
|
||||
<view :class="timeCurrent==index?'colf':''" class="fon26 mar-s10">{{item.time}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 时间段 -->
|
||||
<view class="mar-s20 mar-x10">时 间 段</view>
|
||||
<view class="disjb fw">
|
||||
<view @tap="chooseTD(indextd)" :style="{background:itemtd.tdStatus?publicColor:'',border:itemtd.tdStatus?`2rpx solid ${publicColor}`:''}" :class="itemtd.num==0?'bcdb':''" class="tc radius10 mar-x30 col3 timed borbot-df" v-for="(itemtd,indextd) in dataTD" :key="indextd">
|
||||
<view :class="itemtd.tdStatus?'colf':''">{{itemtd.ttime}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 联系人 -->
|
||||
<view class="disac mar-s30">
|
||||
<view class="mar-y20 flexs titlel">联 系 人</view>
|
||||
<view class="width100 radius10 pad-zy20 borbot-cc height-68">
|
||||
<input v-model="lname" maxlength="10" class="fon28 height-68" type="text" placeholder="请填写联系人姓名"/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 联系方式 -->
|
||||
<view class="disac mar-s20">
|
||||
<view class="mar-y20 flexs titlel">联系方式</view>
|
||||
<view class="width100 radius10 pad-zy20 borbot-cc height-68">
|
||||
<input v-model="lphone" maxlength="11" class="fon28 height-68" type="text" placeholder="请输入联系电话"/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 留言信息 -->
|
||||
<view class="dis mar-s20">
|
||||
<view class="mar-y20 flexs mar-s20 titlel">留言信息</view>
|
||||
<view class="width100 radius10 pad20 borbot-cc" style="height: 300rpx;">
|
||||
<textarea v-model="lmsg" class="fon28" maxlength="500" style="height: 300rpx;width: auto;" placeholder="请填写内容"/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 立即提交底部按钮 -->
|
||||
<view @tap="submit" class="fon30 radius20 tc colf bold0 btnl" :style="{background:publicColor}">{{btnCon}}</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :isCenter="true" :contentVal="'提交成功!等待审核'" :comfrimVal="'好的'" @comfirmev="comfirmev"></pu-po>
|
||||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nright="20"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
timeCurrent:0,
|
||||
dataList:[],//日期
|
||||
dataTD:[],//时间段
|
||||
isShowT:false,
|
||||
category:'',
|
||||
lname:'',//联系人姓名
|
||||
lphone:'',//联系方式
|
||||
lmsg:'',//留言信息
|
||||
isZhuan:false,
|
||||
xialCurrent:0,
|
||||
xialone:['植发','脱发'],
|
||||
categoryT:'',
|
||||
isZhuanT:false,
|
||||
xialCT:0,
|
||||
xialTwo:['杨幂','周星驰'],
|
||||
type_id:'',//预约类别ID
|
||||
gday:'',//日期
|
||||
dtId:[],//暂存禁选时间段ID
|
||||
zanTimeD:[],//暂存时间段
|
||||
zanDay:[],//暂存日期
|
||||
dangId:'',//当前预约时间段ID
|
||||
btnCon:'立即提交'
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.category = this.xialone[0]
|
||||
this.categoryT = this.xialTwo[0]
|
||||
this.checkZParmas()
|
||||
// this.$toolAll.tools.weekDate()
|
||||
},
|
||||
methods: {
|
||||
gtimeD(id,gday){
|
||||
this.$requst.post('user/appointment-period-full',{type_id:id,day:gday}).then(res=>{
|
||||
// console.log('查询预约分类某天已约满的时间段:',res);
|
||||
if(res.code==0){
|
||||
this.dtId = res.data
|
||||
this.dataTD = []
|
||||
if(this.dtId.length!=0){
|
||||
this.zanTimeD.forEach((item,index)=>{
|
||||
let newNum = 1
|
||||
let newTdStatus = false
|
||||
this.dtId.forEach(item1=>{
|
||||
if(item.id==item1.id){
|
||||
newNum = 0
|
||||
newTdStatus = false
|
||||
}
|
||||
})
|
||||
let tdObj = {
|
||||
id:item.id,
|
||||
ttime:item.ttime,
|
||||
num:newNum,
|
||||
status:item.status,
|
||||
tdStatus:newTdStatus
|
||||
}
|
||||
this.dataTD.push(tdObj)
|
||||
})
|
||||
} else {
|
||||
this.zanTimeD.forEach(item=>{
|
||||
let tdObj = {
|
||||
id:item.id,
|
||||
ttime:item.ttime,
|
||||
num:1,
|
||||
status:item.status,
|
||||
tdStatus:false
|
||||
}
|
||||
this.dataTD.push(tdObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
checkZParmas(){//查询参数
|
||||
this.$requst.post('user/appointment-parameters',{page:1,size:20}).then(res=>{
|
||||
// console.log('查询自主预约列表:',res);
|
||||
if(res.code==0){
|
||||
this.gtimeD(res.data.types[0].id,res.data.days[0].day)
|
||||
// 预约类别
|
||||
if(res.data.types.length!=0){
|
||||
this.type_id = res.data.types[0].id
|
||||
res.data.types.forEach(item=>{
|
||||
let ycateObj = {
|
||||
id:item.id,
|
||||
title:item.title,
|
||||
max:item.max
|
||||
}
|
||||
this.xialone.push(ycateObj)
|
||||
})
|
||||
this.category = this.xialone[0].title
|
||||
}
|
||||
//预约日期
|
||||
if(res.data.days.length!=0){
|
||||
this.gday = res.data.days[0].day
|
||||
this.zanDay = res.data.days
|
||||
res.data.days.forEach(item=>{
|
||||
let arr = item.day.split('-')
|
||||
let newDay = arr[1]+'月'+arr[2]+'日'
|
||||
let dayObj = {
|
||||
title:item.week,
|
||||
time:newDay,
|
||||
status:item.status
|
||||
}
|
||||
this.dataList.push(dayObj)
|
||||
})
|
||||
}
|
||||
// 时间段
|
||||
if(res.data.times.length!=0){
|
||||
res.data.times.forEach((item,index)=>{
|
||||
let tdObj = {
|
||||
id:item.id,
|
||||
ttime:item.name,
|
||||
status:item.status,
|
||||
}
|
||||
// this.dataTD.push(tdObj)
|
||||
this.zanTimeD.push(tdObj)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
submit(){
|
||||
if(!this.lname){
|
||||
this.$toolAll.tools.showToast('请输入联系人姓名')
|
||||
} else if(!this.lphone){
|
||||
this.$toolAll.tools.showToast('请输入联系电话')
|
||||
} else if(this.$toolAll.tools.isPhone(this.lphone)){
|
||||
this.$toolAll.tools.showToast('请输入正确的联系电话')
|
||||
} else if(!this.dangId){
|
||||
this.$toolAll.tools.showToast('请选择时间段')
|
||||
} else {
|
||||
let parmas = {
|
||||
type_id:this.type_id,//预约类型ID
|
||||
day:this.gday,//预约日期,如:2021-08-11
|
||||
period_id:this.dangId,//预约时间段ID
|
||||
user_name:this.lname,//联系人姓名
|
||||
user_phone:this.lphone,//联系人电话
|
||||
remarks:this.lmsg//预约留言信息,(500字以内)
|
||||
}
|
||||
if(this.btnCon=='立即提交'){
|
||||
this.btnCon = "正在提交..."
|
||||
this.$requst.post('user/appointment-apply',parmas).then(res=>{
|
||||
// console.log('提交预约申请:',res);
|
||||
if(res.code==0){
|
||||
this.isShowT = true
|
||||
wx.requestSubscribeMessage({
|
||||
tmplIds: ['uvGd7RqaegheGU-uVxR-uM3y2MadZeMOHdQaNiiWm8U'],
|
||||
success: (res)=> {
|
||||
console.log('res',res);
|
||||
this.isShowT = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.btnCon = "立即提交"
|
||||
this.$toolAll.tools.showToast(res.msg)
|
||||
}
|
||||
},error=>{})
|
||||
}
|
||||
}
|
||||
},
|
||||
comfirmev(){
|
||||
this.isShowT = false
|
||||
uni.navigateBack({delta:1})
|
||||
},
|
||||
goYu(){//去预约
|
||||
uni.navigateTo({
|
||||
url:''
|
||||
})
|
||||
},
|
||||
chooseTime(index){
|
||||
if(this.dataList[index].status!=0){
|
||||
this.timeCurrent = index
|
||||
this.gday = this.zanDay[index].day
|
||||
this.gtimeD(this.type_id,this.gday)
|
||||
}
|
||||
},
|
||||
chooseTD(index){//时间段选择事件
|
||||
if(this.dataTD[index].num!=0){
|
||||
this.dangId = this.zanTimeD[index].id
|
||||
this.dataTD.forEach(item=>{//发现为true的改为false,即控制单选,注释就表示多选
|
||||
if(item.tdStatus==true) item.tdStatus = false
|
||||
})
|
||||
this.dataTD[index].tdStatus = !this.dataTD[index].tdStatus
|
||||
}
|
||||
},
|
||||
openXial(index){
|
||||
if(index==0) {
|
||||
this.isZhuanT = false
|
||||
this.isZhuan = !this.isZhuan
|
||||
}
|
||||
if(index==1) {
|
||||
this.isZhuan = false
|
||||
this.isZhuanT = !this.isZhuanT
|
||||
}
|
||||
},
|
||||
chooseXia(index){//预约类别选择事件
|
||||
this.xialCurrent = index
|
||||
this.category = this.xialone[index].title
|
||||
this.type_id = this.xialone[index].id
|
||||
this.gtimeD(this.type_id,this.gday)
|
||||
},
|
||||
chooseXiaT(index){
|
||||
this.xialCT = index
|
||||
this.categoryT = this.xialTwo[index]
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,120 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'购物车'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30">
|
||||
<view class="bacf radius20 mar-s20 pad20">
|
||||
<view class="fon28 col3 disjbac" style="height: 43rpx;">
|
||||
<view class="bold">订单信息</view>
|
||||
<view v-if="!cancle_del" @tap="cancle_del=true">管理</view>
|
||||
<view v-else @tap="cancle_del=false" style="width: 113rpx;height: 43rpx;border-radius: 20rpx;background: #3875F6;text-align: center;color: #FFFFFF;line-height: 43rpx;">管理 ×</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="disjbac pad-sx40 bbot posir" style="overflow: hidden;" @touchstart="moveStart" @touchend="moveEnd">
|
||||
<view class="disjbac" :style="{marginLeft:showDel?'-70px':'',paddingRight:showDel?'70px':''}">
|
||||
<!-- 圈 -->
|
||||
<image src="/static/public/chooseFS.png" style="width: 40rpx;height: 40rpx;flex-shrink: 0;" mode=""></image>
|
||||
<image src="/static/tabbar/mya.png" style="width: 166rpx;height: 166rpx;border-radius: 15rpx;flex-shrink: 0;margin: 0 12rpx 0 24rpx;" mode=""></image>
|
||||
<view>
|
||||
<view class="fon28 col3 bold clips2">【99皮皮节】【种植发际线】1000单位FUE技术案例招募门美人</view>
|
||||
<view style="font-size: 22rpx;color: #808080;">试用</view>
|
||||
<view class="disjbac mar-s10">
|
||||
<view style="font-size: 32rpx;color: #F85050;font-weight: bold;">¥3888</view>
|
||||
<view class="fon26 col3 disac bold" style="border-radius: 4rpx;overflow: hidden;">
|
||||
<image src="/static/public/del.png" mode="" style="width: 46rpx;height: 26px;"></image>
|
||||
<input type="text" value="1" style="width: 60rpx;height: 24px;text-align: center;border-top: 2rpx solid #3875F6;border-bottom: 2rpx solid #3875F6;"/>
|
||||
<image src="/static/public/add.png" mode="" style="width: 46rpx;height: 26px;"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="showDel" style="width: 117rpx;height: 205rpx;background: #F85050;line-height: 205rpx;text-align: center;color: #FFFFFF;font-size: 24rpx;flex-shrink: 0;position: absolute;right: 0;bottom: 40rpx;top: 2rpx;">删除</view>
|
||||
</view>
|
||||
<view class="disjbac pad-sx40 bbot posir" style="overflow: hidden;" @touchstart="moveStart" @touchend="moveEnd">
|
||||
<view class="disjbac" :style="{marginLeft:showDel?'-70px':'',paddingRight:showDel?'70px':''}">
|
||||
<!-- 圈 -->
|
||||
<image src="/static/public/cancle-FS.png" style="width: 40rpx;height: 40rpx;flex-shrink: 0;" mode=""></image>
|
||||
<image src="/static/tabbar/mya.png" style="width: 166rpx;height: 166rpx;border-radius: 15rpx;flex-shrink: 0;margin: 0 12rpx 0 24rpx;" mode=""></image>
|
||||
<view>
|
||||
<view class="fon28 col3 bold clips2">【99皮皮节】【种植发际线】1000单位FUE技术案例招募门美人</view>
|
||||
<view style="font-size: 22rpx;color: #808080;">试用</view>
|
||||
<view class="disjbac mar-s10">
|
||||
<view style="font-size: 32rpx;color: #F85050;font-weight: bold;">¥3888</view>
|
||||
<view class="fon26 col3 disac bold" style="border-radius: 4rpx;overflow: hidden;">
|
||||
<image src="/static/public/del.png" mode="" style="width: 46rpx;height: 26px;"></image>
|
||||
<input type="text" value="1" style="width: 60rpx;height: 24px;text-align: center;border-top: 2rpx solid #3875F6;border-bottom: 2rpx solid #3875F6;"/>
|
||||
<image src="/static/public/add.png" mode="" style="width: 46rpx;height: 26px;"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="showDel" style="width: 117rpx;height: 205rpx;background: #F85050;line-height: 205rpx;text-align: center;color: #FFFFFF;font-size: 24rpx;flex-shrink: 0;position: absolute;right: 0;bottom: 40rpx;top: 2rpx;">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="disjbac posixzy bacf" style="height: 124rpx;line-height: 124rpx;padding: 0 32rpx;">
|
||||
<view class="disac">
|
||||
<view style="width: 40rpx;height: 40rpx;border-radius: 100%;border: 2rpx solid #3875F6;flex-shrink: 0;display: flex;justify-content: center;align-items: center;">
|
||||
<!-- <view style="width: 24rpx;height: 24rpx;background-color: #3875F6;border-radius: 100%;"></view> -->
|
||||
</view>
|
||||
<view class="fon28 col3 mar-z10">全选</view>
|
||||
</view>
|
||||
<!-- 去支付 -->
|
||||
<view v-if="!cancle_del" class="disjbac">
|
||||
<view>
|
||||
<view class="fon28">合计:<span class="fon40 bold" style="color: #F85050;">¥7166.00</span></view>
|
||||
</view>
|
||||
<view @tap="goGetReadyDan" style="color: #FFFFFF;font-size: 28rpx;font-weight: bold;width: 170rpx;height: 70rpx;line-height: 70rpx;text-align: center;background: #3875F6;border-radius: 35rpx;margin-left: 10rpx;">去支付</view>
|
||||
</view>
|
||||
<!-- 删除 -->
|
||||
<view v-else style="color: #FFFFFF;font-size: 28rpx;font-weight: bold;width: 170rpx;height: 70rpx;line-height: 70rpx;text-align: center;background: #F85050;border-radius: 35rpx;">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
showDel:false,
|
||||
startX:'',//开始位置
|
||||
endX:'',//结束位置
|
||||
cancle_del:false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
clickGL(){
|
||||
console.log('管理');
|
||||
},
|
||||
moveStart(e){
|
||||
this.startX = e.touches[0].pageX
|
||||
},
|
||||
moveEnd(e){
|
||||
this.endX = e.changedTouches[0].pageX
|
||||
if(this.startX-this.endX>0){
|
||||
this.showDel = true;
|
||||
} else this.showDel = false;
|
||||
},
|
||||
goGetReadyDan(){
|
||||
uni.navigateTo({
|
||||
url:'/pagesA/getReadyDan/getReadyDan'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,157 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'投诉与建议'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy20">
|
||||
<view class="bacf mar-s25 pad-zy20 radius20 fon28 col3 pad-x40">
|
||||
<!-- 问题类型 -->
|
||||
<view class="disac pad-s32">
|
||||
<view class="flexs mar-y20 titlel">问题类型</view>
|
||||
<view @tap="openXial" class="disjbac width100 radius10 pad-zy20 xiala posir">
|
||||
<view>{{category}}</view>
|
||||
<image :class="isZhuan?'zhuan':'nozhuan'" src="/static/public/sanj.png" mode="aspectFill"></image>
|
||||
<!-- 下拉列表 -->
|
||||
<view v-if="isZhuan" class="posia bacf radius10 xial-box">
|
||||
<view class="pad-zy20 xial-item-box">
|
||||
<view @tap="chooseXia(indexl)" :class="xialCurrent==indexl?'pcol':''" v-for="(iteml,indexl) in xialone" :key="indexl">{{iteml.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 建议意见 -->
|
||||
<view class="dis mar-s20">
|
||||
<view class="mar-y20 flexs mar-s20 titlel">建议意见</view>
|
||||
<view class="width100 radius10 pad20 borbot-cc" style="height: 300rpx;">
|
||||
<textarea v-model="tmsg" class="fon28" maxlength="500" style="height: 300rpx;width: auto;" placeholder="请把您的意见及意见填写在这里" placeholder-style="color:#999999;"/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 姓 名 -->
|
||||
<view class="disac mar-s30">
|
||||
<view class="mar-y20 flexs titlel disjb">
|
||||
<view>姓</view>
|
||||
<view class="mar-y10">名</view>
|
||||
</view>
|
||||
<view class="width100 radius10 pad-zy20 borbot-cc height-68">
|
||||
<input v-model="tname" class="fon28 height-68" type="text" value="" placeholder="请输入姓名" placeholder-style="color:#999999;"/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 联系电话 -->
|
||||
<view class="disac mar-s20">
|
||||
<view class="mar-y20 flexs titlel">联系电话</view>
|
||||
<view class="width100 radius10 pad-zy20 borbot-cc height-68">
|
||||
<input v-model="tphone" maxlength="11" class="fon28 height-68" type="text" value="" placeholder="请输入联系电话" placeholder-style="color:#999999;"/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部按钮 -->
|
||||
<view @tap="submit" class="fon30 radius20 tc colf bold0 btnl" :style="{background:publicColor}">{{btnCon}}</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :isCenter="true" :contentVal="'提交成功!等待审核'" :comfrimVal="'好的'" @comfirmev="comfirmev"></pu-po>
|
||||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nright="20" :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isShowT:false,
|
||||
category:'',
|
||||
tname:'',//联系人姓名
|
||||
tphone:'',//联系方式
|
||||
tmsg:'',//留言信息
|
||||
touId:'',
|
||||
isZhuan:false,
|
||||
xialCurrent:0,
|
||||
xialone:[],
|
||||
btnCon:'立即提交'
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.checkCate()
|
||||
},
|
||||
methods: {
|
||||
checkCate(){
|
||||
this.$requst.post('user/feedback-types').then(res=>{
|
||||
// console.log('问题类型列表:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
res.data.forEach(item=>{
|
||||
let obj = {
|
||||
id:item.id,
|
||||
title:item.title
|
||||
}
|
||||
this.xialone.push(obj)
|
||||
})
|
||||
this.category = this.xialone[0].title
|
||||
this.touId = this.xialone[0].id
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
submit(){
|
||||
if(!this.tmsg){
|
||||
this.$toolAll.tools.showToast('请输入意见及建议')
|
||||
} else {
|
||||
if(this.tphone!=''){
|
||||
if(this.$toolAll.tools.isPhone(this.tphone)){
|
||||
this.$toolAll.tools.showToast('请输入正确的手机号')
|
||||
} else {
|
||||
this.eventEv()
|
||||
}
|
||||
} else {
|
||||
this.eventEv()
|
||||
}
|
||||
}
|
||||
},
|
||||
eventEv(){
|
||||
let parmas = {
|
||||
type_id:this.touId,
|
||||
content:this.tmsg,
|
||||
user_name:this.tname,
|
||||
user_phone:this.tphone
|
||||
}
|
||||
if(this.btnCon == '立即提交'){
|
||||
// this.$toolAll.tools.showToast('正在提交...')
|
||||
this.btnCon = '正在提交...'
|
||||
this.$requst.post('user/add-feedback',parmas).then(res=>{
|
||||
// uni.hideToast()
|
||||
if(res.code==0){
|
||||
this.isShowT = true
|
||||
} else {
|
||||
this.btnCon = '返回'
|
||||
this.$toolAll.tools.showToast(res.msg)
|
||||
}
|
||||
},error=>{})
|
||||
} else {
|
||||
uni.navigateBack({delta:1})
|
||||
}
|
||||
},
|
||||
comfirmev(){
|
||||
uni.navigateBack({delta:1})
|
||||
},
|
||||
openXial(){
|
||||
this.isZhuan = !this.isZhuan
|
||||
// console.log('开启下拉');
|
||||
},
|
||||
chooseXia(index){
|
||||
this.xialCurrent = index
|
||||
this.btnCon = '立即提交'
|
||||
this.category = this.xialone[index].title
|
||||
this.touId = this.xialone[index].id
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,178 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'关于我们'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy32">
|
||||
<!-- 自定义轮播 -->
|
||||
<view class="mar-s20">
|
||||
<swiper-pu :bannerList="bannerList" :newHeight="'200'" :newRadius="'10'" :newBottom="'5'"></swiper-pu>
|
||||
</view>
|
||||
<!-- 导航 -->
|
||||
<view class="mar-s50 pad-s10">
|
||||
<cate-pu :newCurrent="newCurrent*1" :activeb="publicColor" :isCenter="cateListTwo.length<=4?false:true" :newbmo="'#F5F5F5'" @choosecateEv="chooseTwo" :newcateList="cateListTwo"></cate-pu>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<view v-if="dataList.length!=0" class="mar-x20">
|
||||
<view @tap="goDetail(index)" class="pad-sx30 width100 disjb bbot" v-for="(item,index) in dataList" :key="index">
|
||||
<view class="disjb fc">
|
||||
<view class="fon30 col3 clips2" style="height: 84rpx;">{{item.title}}</view>
|
||||
<view class="fon24 col9 mar-s25">{{item.time}}</view>
|
||||
</view>
|
||||
<image v-if="item.imgSrc!=''" class="flexs mar-z30" style="width: 140rpx;height: 140rpx;" :src="item.imgSrc" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="dataList.length==0" class="disjcac fc" style="margin-top: 20%;">
|
||||
<image class="zanw-img" src="/static/public/zanwn.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无内容</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import swiperPu from '@/components/swiper-pu.vue';
|
||||
import {checkBanner} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{
|
||||
swiperPu
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
cateListTwo:[
|
||||
// {title:'热门问题'},
|
||||
// {title:'公司新闻'},
|
||||
// {title:'热点资讯'},
|
||||
// {title:'热点资讯'},
|
||||
],
|
||||
dataList:[
|
||||
// {title:'网红水果排毒真的减脂排毒吗?',time:'2021-07-08 10:30',imgSrc:'/static/public/like.png'},
|
||||
// {title:'网红水果排毒真的减脂排毒吗?美食创作人',time:'2021-07-08 10:30',imgSrc:'/static/public/like.png'},
|
||||
// {title:'网红水果排毒真的减脂排毒吗?美食创作人',time:'2021-07-08 10:30',imgSrc:'/static/public/like.png'},
|
||||
// {title:'网红水果排毒真的减脂排毒吗?美食创作人',time:'2021-07-08 10:30',imgSrc:'/static/public/like.png'},
|
||||
// {title:'网红水果排毒真的减脂排毒吗?美食创作人',time:'2021-07-08 10:30',imgSrc:'/static/public/like.png'},
|
||||
// {title:'网红水果排毒真的减脂排毒吗?美食创作人',time:'2021-07-08 10:30',imgSrc:'/static/public/like.png'},
|
||||
// {title:'网红水果排毒真的减脂排毒吗?美食创作人',time:'2021-07-08 10:30',imgSrc:'/static/public/like.png'},
|
||||
],
|
||||
showTop:false,
|
||||
newCurrent:0,
|
||||
category_id:'',
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
bannerList:[]
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkAbout(this.category_id)//调用自主预约列表事件
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.checkAbout(this.category_id)
|
||||
this.checkSwi()
|
||||
},
|
||||
methods: {
|
||||
checkSwi(){
|
||||
checkBanner({position:'about-banner'}).then(res=>{
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
res.data.forEach(item=>{
|
||||
let isVideo = false
|
||||
if(item.type!='img') isVideo = true
|
||||
let haveImg = ''
|
||||
if(item.src!='') haveImg = this.$http + item.src
|
||||
let banObj = {
|
||||
imgSrc:haveImg,
|
||||
url:item.url,
|
||||
isVideo:isVideo,
|
||||
poster:this.$http + item.src,
|
||||
}
|
||||
this.bannerList.push(banObj)
|
||||
})
|
||||
}
|
||||
//
|
||||
}
|
||||
})
|
||||
},
|
||||
checkAbout(category_id){
|
||||
let params = {
|
||||
category_id:category_id,
|
||||
page:this.page,
|
||||
size:this.size
|
||||
}
|
||||
this.$requst.post('archives/about',params).then(res=>{
|
||||
// console.log('关于我们:',res);
|
||||
if(res.code==0){
|
||||
if(this.cateListTwo.length==0){
|
||||
if(res.data.category.length!=0){
|
||||
res.data.category.forEach(item=>{
|
||||
let cateObj = {
|
||||
id:item.id,
|
||||
mode_id:item.mode_id,
|
||||
title:item.title
|
||||
}
|
||||
this.cateListTwo.push(cateObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
if(this.page==1) this.dataList = []
|
||||
if(res.data.list.list.length!=0){
|
||||
this.total = res.data.list.total
|
||||
res.data.list.list.forEach(item=>{
|
||||
let newImg = ''
|
||||
if(item.cover=='') newImg = '/static/public/logo.png'
|
||||
else newImg = this.$http + item.cover
|
||||
let aobj = {
|
||||
id:item.id,
|
||||
title:item.title,
|
||||
time:item.published_at,
|
||||
imgSrc:newImg
|
||||
}
|
||||
this.dataList.push(aobj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
chooseTwo(index){//二级分类选择
|
||||
this.newCurrent = index
|
||||
console.log('二级分类:',index);
|
||||
this.isZanw = true
|
||||
this.page = 1
|
||||
this.category_id = this.cateListTwo[index].id
|
||||
this.checkAbout(this.cateListTwo[index].id)
|
||||
},
|
||||
goDetail(index){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/articleDetail/articleDetail?id='+this.dataList[index].id +"&category_id="+this.category_id
|
||||
})
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,291 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'详情'" :statusTitle="true"></status-nav>
|
||||
<view v-if="isLoading" :style="{paddingTop: statusHNH+'px'}" class="pad-zy32 pad-x180">
|
||||
<view class="fon36 col3 bold mar-sx20" style="line-height: 50rpx;">{{detailObj.title}}</view>
|
||||
<view class="disac mar-x20">
|
||||
<image :src="headImg" style="width: 60rpx;height: 60rpx;border-radius: 100%;" mode="aspectFill"></image>
|
||||
<view class="mar-z10">
|
||||
<view class="fon28 col3">{{name}}</view>
|
||||
<view class="fon20 col9" style="margin-top: 6rpx;">{{detailObj.published_at}}发布</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 内容详情 -->
|
||||
<view class="fon28" style="color: #1A1A1A; line-height: 40rpx;">
|
||||
<!-- <image class="mar-x20" src="/static/public/banner.png" style="height: 400rpx;width: 100%;" mode=""></image> -->
|
||||
<!-- <view style="margin-bottom:50rpx;">屋基寨位于阿坝茂县松坪沟,是典型的羌族聚居区,有着鲜明的价值观和民族文化屋基寨美景屋基寨美景。</view>
|
||||
<view style="margin-bottom:50rpx;">山寨海拔3000米以上,有川西独特的自然景色,但是海拔高、地势陡,各类资源匮乏,居民收入单一屋基寨地貌屋基寨地貌。</view>
|
||||
<view style="margin-bottom:50rpx;">成都恒美毛发医疗美容总经理徐军挺,了解到当地居民希望发展旅游增加收入时,便立即驱车前往屋基寨村民着盛装迎接恒美一行村民着盛装迎接恒美一行。</view>
|
||||
<view style="margin-bottom:50rpx;">徐军挺总经理建议:做强乡村旅游,要完善基础设施,同时要保持乡村建筑风貌和地域文化特色;还要完善服务标准,提升消防安全水平;</view>
|
||||
<view style="margin-bottom:50rpx;">打造乡村旅游品牌,形成示范带动作用参观了解村民居住环境参观了解村民居住环境了解村民们的生活习俗风土人情了解村民们的生活习俗风土人情。</view> -->
|
||||
<rich-text :nodes="content"></rich-text>
|
||||
</view>
|
||||
<!-- 导航 -->
|
||||
<view class="mar-s50 pad-s10">
|
||||
<cate-pu :newCurrent="newCurrent*1" :activeb="publicColor" :isCenter="cateListTwo.length<=4?false:true" :newbmo="'#F5F5F5'" @choosecateEv="chooseTwo" :newcateList="cateListTwo"></cate-pu>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<view v-if="dataList.length!=0" class="mar-x20">
|
||||
<view @tap="goDetail(index)" class="pad-sx30 width100 disjb bbot" v-for="(item,index) in dataList" :key="index">
|
||||
<view class="disjb fc">
|
||||
<view class="fon30 col3 clips2" style="height: 84rpx;">{{item.title}}</view>
|
||||
<view class="fon24 col9 mar-s25">{{item.time}}</view>
|
||||
</view>
|
||||
<image v-if="item.imgSrc!=''" class="flexs mar-z30" style="width: 140rpx;height: 140rpx;" :src="item.imgSrc" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="dataList.length==0" class="disjcac fc" style="margin-top: 20%;">
|
||||
<image class="zanw-img" src="/static/public/zanwn.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无内容</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="posixzy disjbac bacf pad-zy32 btnBKS">
|
||||
<view class="posir">
|
||||
<image @tap="backHome" class="posia backH" src="/static/public/back-home.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="disac fon28 colf">
|
||||
<view @tap="lianK" class="disac posir lianShare" style="background-color: #3875F6; border-top-left-radius: 51rpx;border-bottom-left-radius: 51rpx;">
|
||||
<image src="/static/public/bottom-customer.png" class="mar-zy20" style="width: 47rpx;height: 47rpx;" mode="aspectFill"></image>
|
||||
<view>联系客服</view>
|
||||
<button v-if="haveImg" class="fon24 posia" style="opacity: 0;top: 0;left: 0;right: 0;bottom: 0;" open-type="contact">客服</button>
|
||||
</view>
|
||||
<view @tap="shareEv" class="disac posir lianShare" style="background-color: #38CE51;border-top-right-radius: 51rpx;border-bottom-right-radius: 51rpx;">
|
||||
<image src="/static/public/bottom-shear.png" style="width: 47rpx;height: 47rpx;margin-left: 15rpx;margin-right: 8rpx;" mode="aspectFill"></image>
|
||||
<view>分享给好友</view>
|
||||
<button v-if="haveImg" class="posia" open-type="share" style="top: 0;right: 0;left: 0;bottom: 0;opacity: 0;">分享</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2" @cancleEv="cancleEv"></empower>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="140"></public-customer>
|
||||
<!-- 弹框 -->
|
||||
<view v-if="isShowP" @touchmove.stop.prevent="moveHandle" class="disjcac posAll">
|
||||
<view class="bacf radius20 width100 tank-box">
|
||||
<view class="tc tank-box-itemone">请授权绑定手机号</view>
|
||||
<view class="fon28 colf pad-x30 pad-zy30 tc disjb">
|
||||
<view @tap="isShowP=false" class="pad-sx10 radius10 tank-btn" style="background-color: rgba(230, 230, 230,1);color: #000000;">暂不绑定</view>
|
||||
<view class="pad-sx10 radius10 tank-btn posir pbackc">
|
||||
立即绑定
|
||||
<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="posia syxzo">立即绑定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import empower from '@/components/empower.vue';
|
||||
export default {
|
||||
components:{
|
||||
empower
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
headImg:'/static/public/like.png',
|
||||
name:'恒美植发',
|
||||
time:'2021-07-14 08:22',
|
||||
showTop:false,
|
||||
detailObj:{},//详情
|
||||
content:'',//富文本详情
|
||||
isLoading:false,
|
||||
haveImg:true,
|
||||
detailId:'',//当前关于我们新闻ID
|
||||
invite_code:'',
|
||||
vision:false,
|
||||
isShowP:false,
|
||||
newCurrent:0,
|
||||
cateListTwo:[],
|
||||
dataList:[],
|
||||
category_id:0,
|
||||
size:10,
|
||||
page:1,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
}
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
this.$requst.post('user/record',{type:'content',action:'share',id:this.detailObj.id}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
c:this.detailObj.id*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
var shareObj = {
|
||||
title: `${ya.detailObj.title}`, // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pagesB/articleDetail/articleDetail?id=${this.detailId}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
imageUrl: ''//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad(options) {
|
||||
this.checkDetail(options.id)
|
||||
this.detailId = options.id
|
||||
this.category_id = options.category_id
|
||||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:options.invite_code,//用户邀请码
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.vision = true
|
||||
this.haveImg = false
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
this.checkAbout(this.category_id)
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkAbout(this.category_id)//调用自主预约列表事件
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkAbout(category_id){
|
||||
let params = {
|
||||
category_id:category_id,
|
||||
page:this.page,
|
||||
size:this.size
|
||||
}
|
||||
this.$requst.post('archives/about',params).then(res=>{
|
||||
// console.log('关于我们:',res);
|
||||
if(res.code==0){
|
||||
if(this.cateListTwo.length==0){
|
||||
if(res.data.category.length!=0){
|
||||
res.data.category.forEach((item,index)=>{
|
||||
let cateObj = {
|
||||
id:item.id,
|
||||
mode_id:item.mode_id,
|
||||
title:item.title
|
||||
}
|
||||
this.cateListTwo.push(cateObj)
|
||||
if(this.category_id==item.id) this.newCurrent = index
|
||||
})
|
||||
}
|
||||
}
|
||||
if(this.page==1) this.dataList = []
|
||||
if(res.data.list.list.length!=0){
|
||||
this.total = res.data.list.total
|
||||
res.data.list.list.forEach(item=>{
|
||||
let newImg = ''
|
||||
if(item.cover=='') newImg = '/static/public/logo.png'
|
||||
else newImg = this.$http + item.cover
|
||||
let aobj = {
|
||||
id:item.id,
|
||||
title:item.title,
|
||||
time:item.published_at,
|
||||
imgSrc:newImg
|
||||
}
|
||||
if(this.detailId!=item.id) this.dataList.push(aobj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
chooseTwo(index){//二级分类选择
|
||||
this.newCurrent = index
|
||||
// console.log('二级分类:',index);
|
||||
this.isZanw = true
|
||||
this.page = 1
|
||||
this.category_id = this.cateListTwo[index].id
|
||||
this.checkAbout(this.cateListTwo[index].id)
|
||||
},
|
||||
goDetail(index){
|
||||
uni.navigateTo({
|
||||
url:'/pagesB/articleDetail/articleDetail?id='+this.dataList[index].id +"&category_id="+this.category_id
|
||||
})
|
||||
},
|
||||
moveHandle(){//禁止底层滑动
|
||||
return false
|
||||
},
|
||||
getphonenumber(e){//授权绑定手机号
|
||||
if(e.detail.errMsg=="getPhoneNumber:ok"){
|
||||
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
|
||||
// console.log('手机号信息:',res);
|
||||
if(res.code==0){
|
||||
this.isShowP = false
|
||||
this.$toolAll.tools.showToast('手机号绑定成功','success')
|
||||
}
|
||||
},error=>{})
|
||||
} else {
|
||||
this.isShowP = false
|
||||
}
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
cancleEv(e){//取消授权
|
||||
if(e==0) this.vision = false
|
||||
},
|
||||
backHome(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
},
|
||||
lianK(){//客服
|
||||
// if(!this.jieDuan){
|
||||
// let isAuth = this.$toolAll.tools.returnAuth()
|
||||
// if(!isAuth){
|
||||
if(this.haveImg == false) {
|
||||
this.vision = true
|
||||
} else {
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:0}).then(res=>{},error=>{})
|
||||
let maiOjb = {
|
||||
e:5,//内容咨询
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
// } else this.jieDuan = true
|
||||
// }
|
||||
},
|
||||
shareEv(){
|
||||
if(this.haveImg == false) {
|
||||
this.vision = true
|
||||
}
|
||||
},
|
||||
checkDetail(id){
|
||||
this.$requst.post('archives/detail',{id:id}).then(res=>{
|
||||
// console.log('详情:',res);
|
||||
if(res.code==0){
|
||||
this.detailObj = res.data.detail
|
||||
this.content = this.$toolAll.tools.escape2Html(res.data.detail.content)
|
||||
uni.hideToast()
|
||||
this.isLoading = true
|
||||
}
|
||||
},error=>{})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,53 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'我的二维码'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy32">
|
||||
<image :src="imgSrc" class="mar-s32" style="width: 100%;" mode="widthFix"></image>
|
||||
<view v-if="isBtn" @tap="sendImg" class="fon40 bold colf mar-z10 radius20 tc" style="height: 90rpx;margin: 80rpx;background-color: #38CE51;line-height: 90rpx;">发送二维码</view>
|
||||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {base64ToPath} from '@/jsFile/base64-src.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
imgSrc:'',
|
||||
isBtn:false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.checkImg()
|
||||
},
|
||||
methods: {
|
||||
checkImg(){
|
||||
this.$requst.post('user/service-qr').then(res=>{
|
||||
// console.log('二维码:',res);
|
||||
if(res.code==0){
|
||||
base64ToPath(res.data.qr).then(path => {
|
||||
this.imgSrc = path
|
||||
this.isBtn = true
|
||||
}).catch(error => {})
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
sendImg(){
|
||||
wx.showShareImageMenu({
|
||||
path: this.imgSrc
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,213 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'客户列表'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30 pad-x20">
|
||||
<view class="radius20 fon28 col3 mar-sx20">
|
||||
<view class="disac">
|
||||
<view @tap="openXial" class="disjbac width100 radius10 pad-zy20 xialak posir">
|
||||
<view class="" style="color: #B3B3B3;">{{category}}</view>
|
||||
<image :class="isZhuan?'zhuan':'nozhuan'" src="/static/public/sanj.png" mode="aspectFill"></image>
|
||||
<!-- 下拉列表 -->
|
||||
<view v-if="isZhuan" class="posia bacf radius10 xial-box">
|
||||
<view class="pad-zy20 xial-item-box">
|
||||
<view @tap="chooseXia(indexl)" :class="xialCurrent==indexl?'pcol':''" v-for="(iteml,indexl) in xialone" :key="indexl">{{iteml.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view @tap="searchEv" class="flexs tc mar-z30 colf radius10 customer-btn" :style="{background:publicColor}">搜索</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<view v-if="dataList.length!=0" class="dis bacf radius10 pad20 mar-x20 posir" v-for="(item,index) in dataList" :key="index">
|
||||
<image class="mar-y20 flexs" :src="item.imgSrc" style="width: 98rpx;height: 98rpx;" mode="aspectFill"></image>
|
||||
<view class="fon24 col3 width100">
|
||||
<view class="bold disjbac">
|
||||
<view class="fon28 clips1">{{item.name}}</view>
|
||||
<view class="flexs">来源:{{item.come}}</view>
|
||||
</view>
|
||||
<view style="margin: 15rpx 0;">联系方式:{{item.phone || '暂无'}}</view>
|
||||
<view>客服:{{item.customer || '暂无'}}</view>
|
||||
<view class="col80 disjbac" style="margin: 15rpx 0 0 0;">
|
||||
<view>{{item.time}}</view>
|
||||
<view class="col3">{{item.qudao}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view @tap="fenCustomer(index)" class="posia colf fon24 radius10 tc customer-btn"
|
||||
style="right: 20rpx;bottom: 70rpx;" v-if="item.customer=='' || item.customer==null" :style="{background:publicColor}">分配客服</view>
|
||||
</view>
|
||||
<view v-if="dataList.length==0" class="disjcac fc" style="margin-top: 50%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">您搜索的内容暂无结果,换个关键词试试吧</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :category="xialtList" @chooseXiaT="chooseXiaT" :isXiala="true" :isShowT="isShowT" :clearVal="'暂不分配'" :comfrimVal="'立即分配'" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
category:'',
|
||||
dataList:[],
|
||||
showTop:false,
|
||||
isShowT:false,
|
||||
isXiala:true,
|
||||
isZhuan:false,
|
||||
xialCurrent:0,
|
||||
xialone:['全部'],
|
||||
xialtList:[],
|
||||
staff_id:'',//员工ID
|
||||
customer_id:'',//客户ID
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',
|
||||
isZanw:true,
|
||||
ntype:''
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
// for (let i = 0; i < 4; i++) {
|
||||
// let obj = {imgSrc:'/static/public/like.png',name:'USER',come:'顾客分享',phone:'18888888888',customer:'恒美植发客服-01',time:'2021-07-15 14:25',qudao:'第二渠道'}
|
||||
// this.dataList.push(obj)
|
||||
// }
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkCL()
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表数据')
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.checkKF()//查询客服列表
|
||||
this.checkCL()//客户列表
|
||||
this.checkLY()//渠道来源
|
||||
},
|
||||
methods: {
|
||||
checkKF(){//查看客户列表
|
||||
this.$requst.post('user/servicer-list').then(res=>{
|
||||
// console.log('查询客户列表:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
res.data.forEach(item=>{
|
||||
let obj = {
|
||||
title:item.name,
|
||||
id:item.id
|
||||
}
|
||||
this.xialtList.push(obj)
|
||||
})
|
||||
this.staff_id = this.xialtList[0].id
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
searchEv(){//搜索事件
|
||||
this.page = 1
|
||||
this.isZanw = true
|
||||
this.checkCL(this.ntype)
|
||||
},
|
||||
checkLY(){//查询来源渠道事件
|
||||
this.$requst.post('user/channel').then(res=>{
|
||||
// console.log('来源渠道:',res);
|
||||
if(res.code==0){
|
||||
for (let key in res.data) {
|
||||
let lyObj = {
|
||||
title:res.data[key],
|
||||
name:key
|
||||
}
|
||||
this.xialone.push(lyObj)
|
||||
}
|
||||
this.xialone.unshift({title:"全部",name:'all'})
|
||||
this.category = this.xialone[0].title
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
checkCL(ntype){//查询客户列表事件
|
||||
this.$requst.post('user/customer',{page:this.page,size:this.size,type:ntype}).then(res=>{
|
||||
// console.log('客户列表:',res);
|
||||
if(res.code==0){
|
||||
if(this.page==1) this.dataList = []
|
||||
this.total = res.data.total
|
||||
if(res.data.list.length!=0){
|
||||
res.data.list.forEach(item=>{
|
||||
let cuObj = {
|
||||
id:item.id,
|
||||
imgSrc:item.headimgurl,
|
||||
name:item.nickname,
|
||||
come:item.channel_text,
|
||||
phone:item.mobile,
|
||||
customer:item.service[0],
|
||||
time:item.created_at,
|
||||
qudao:item.tag[0],
|
||||
service:item.service
|
||||
}
|
||||
this.dataList.push(cuObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
fenCustomer(index){//分配弹框调起事件
|
||||
// console.log('分配客服调起弹框');
|
||||
this.isShowT = true
|
||||
// 客服列表
|
||||
this.customer_id = this.dataList[index].id//客户ID
|
||||
if(this.xialtList.length==0) this.xialtList = ['暂无可分配客服']
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
comfirmev(){//立即分配执行事件
|
||||
// console.log('立即分配');
|
||||
this.isShowT = false
|
||||
this.$requst.post('user/customer-allot',{staff_id:this.staff_id,customer_id:this.customer_id}).then(res=>{
|
||||
// console.log('分配客服:',res);
|
||||
if(res.code==0){
|
||||
this.page = 1
|
||||
this.$toolAll.tools.showToast('分配成功')
|
||||
this.checkCL(this.ntype)//客户列表
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
cancleev(){
|
||||
this.isShowT = false
|
||||
},
|
||||
openXial(){
|
||||
this.isZhuan = !this.isZhuan
|
||||
// console.log('开启下拉');
|
||||
},
|
||||
chooseXia(index){
|
||||
this.xialCurrent = index
|
||||
this.ntype = this.xialone[index].name
|
||||
this.category = this.xialone[index].title
|
||||
},
|
||||
chooseXiaT(e){
|
||||
this.staff_id = e.id
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,123 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'医生'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30">
|
||||
<view class="radius20 fon28 col3 mar-s20">
|
||||
<view class="disac">
|
||||
<view class="disjbac width100 radius10 pad-zy20 xialak bacf">
|
||||
<input class="fon28 width100" @confirm="searchEv" type="text" v-model="keyword" placeholder="请输入问题/病种/医生姓名" placeholder-style="color: #B3B3B3;" />
|
||||
</view>
|
||||
<view @tap="searchEv" class="flexs tc mar-z30 colf radius10 customer-btn" :style="{background:publicColor}">搜索</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pad-zy20 mar-sx30">
|
||||
<!-- 列表 -->
|
||||
<view class="fon28 col3 bold qdoctor disac">全部医生</view>
|
||||
<view class="mar-s30" v-if="dataList.length!=0">
|
||||
<!-- 医生列表 -->
|
||||
<list-doctor :list="dataList"></list-doctor>
|
||||
</view>
|
||||
<view v-if="dataList.length==0" class="disjcac fc" style="margin-top: 50%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view v-if="keyword!=''" class="fon24 col3">您搜索的内容暂无结果,换个关键词试试吧</view>
|
||||
<view v-if="keyword==''" class="fon24 col3">暂无医生列表</view>
|
||||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import listDoctor from '@/components/list-doctor.vue';
|
||||
export default {
|
||||
components:{
|
||||
listDoctor
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
dataList:[
|
||||
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
|
||||
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
|
||||
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
|
||||
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
|
||||
// {imgSrc:'/static/public/doctor.png',name:'廖恒利医生',cyear:'16',bmen:'美容门诊部',zcheng:'主任医师',goodAt:'毛发种植'},
|
||||
],
|
||||
showTop:false,
|
||||
page:1,
|
||||
size:20,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
keyword:''
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkDor()//调用自主预约列表事件
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.checkDor()
|
||||
},
|
||||
methods: {
|
||||
checkDor(){//查询医生列表事件
|
||||
this.$requst.post('user/doctor-list',{page:this.page,size:this.size,keyword:this.keyword}).then(res=>{
|
||||
// console.log('医生列表:',res);
|
||||
if(res.code==0){
|
||||
if(this.page==1) this.dataList = []
|
||||
if(res.data.list.length!=0){
|
||||
this.total = res.data.total
|
||||
res.data.list.forEach(item=>{
|
||||
let newG = item.diseases
|
||||
let ndeptName = ''
|
||||
if(item.doctor_extra.dept_name==undefined || item.doctor_extra.dept_name=='') ndeptName = item.dept_name
|
||||
else ndeptName = item.doctor_extra.dept_name
|
||||
let dObj = {
|
||||
id:item.id,
|
||||
imgSrc:item.doctor_extra.headimg,//医生头像
|
||||
name:item.doctor_extra.name,//医生姓名
|
||||
cyear:parseFloat(item.doctor_extra.work_time),//工作年限
|
||||
bmen:ndeptName,//部门
|
||||
zcheng:'主任医师',
|
||||
goodAt:item.diseases,
|
||||
show_detail:item.doctor_extra.show_detail//是否可查看详情1是,0否
|
||||
}
|
||||
this.dataList.push(dObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
searchEv(){
|
||||
this.checkDor()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,212 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'医生'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}">
|
||||
<view v-if="isLoading" class="bacf mar-s20 pad-s20 pad-y32 pad-x40">
|
||||
<view class="disjb">
|
||||
<view class="pad-z40">
|
||||
<view class="fon28 bold col3">{{doctorObj.doctor_extra.name}}</view>
|
||||
<view class="disac col80 fon24" style="margin: 6rpx 0;">
|
||||
<view>{{['未知','男','女'][doctorObj.gender]}}</view>
|
||||
<view class="doctorx"></view>
|
||||
<view>从业{{parseFloat(doctorObj.doctor_extra.work_time)}}年</view>
|
||||
<view v-if="doctorObj.doctor_extra.dept_name!='' && doctorObj.doctor_extra.dept_name!=undefined" class="doctorx"></view>
|
||||
<view>{{doctorObj.doctor_extra.dept_name}}</view>
|
||||
</view>
|
||||
<view class="col80 fon24 disac">
|
||||
<view class="flexs">擅长领域:</view>
|
||||
<scroll-view scroll-x style="width: 250rpx;">
|
||||
<view class="disac">
|
||||
<view class="flexs" v-for="(item,index) in doctorObj.diseases" :key="index">
|
||||
<text class="bold mar-y10 pcol">{{item.disease_name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<image class="radius10" :src="doctorObj.doctor_extra.headimg || moImg" style="width: 246rpx;height: 188rpx;" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="mar-z32">
|
||||
<view class="bbot mar-s30"></view>
|
||||
<view class="fon28 bold col3 mar-sx20">个人简介</view>
|
||||
<view class="fon26 col3" style="line-height: 37rpx;">{{doctorObj.doctor_extra.summary}}</view>
|
||||
</view>
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mar-zy32 mar-s20" v-if="dataList.length!=0"><list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="dataList"></list-pu></view>
|
||||
<view style="margin-top: 30%;" v-if="dataList.length==0"><list-pu :list="dataList"></list-pu></view>
|
||||
</view>
|
||||
<view class="pad-zy20 mar-sx30">
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {collectionEV,cancleCollectionEV} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
cateList:[
|
||||
// {title:'问题'},
|
||||
// {title:'案例日记'},
|
||||
// {title:'效果模拟'},
|
||||
// {title:'科普视频'},
|
||||
],
|
||||
dataList:[
|
||||
|
||||
],
|
||||
showTop:false,
|
||||
newCurrent:0,
|
||||
category_id:0,//栏目ID
|
||||
moImg:'/static/public/logo.png',
|
||||
doctorObj:{},//医生详情
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
chuTop:'',
|
||||
isTop:false,
|
||||
isLoading:false
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
if((this.chuTop - this.statusHNH) - e.scrollTop*1 <= 0) this.isTop = true
|
||||
else this.isTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
// console.log(this.total,this.dataList.length);
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
if(this.category_id==0) this.category_id = this.cateList[0].id
|
||||
this.checkConList(this.category_id)//调用自主预约列表事件
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
this.checkConList(this.category_id)
|
||||
},
|
||||
onLoad(options) {
|
||||
this.checkDoD(options.doctor_id)
|
||||
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('#daoh').boundingClientRect((rect) => {
|
||||
this.chuTop = rect.top
|
||||
}).exec()
|
||||
},
|
||||
methods: {
|
||||
chooseLike(e){//收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_collected==0){
|
||||
this.dataList[e].is_collected = 1
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
comfirmev(e){//确认取消收藏事件
|
||||
this.dataList[e].is_collected = 0
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
},
|
||||
checkDoD(doctor_id){
|
||||
this.$requst.post('user/doctor-info',{doctor_id:doctor_id}).then(res=>{
|
||||
// console.log('医生详情:',res);
|
||||
if(res.code==0){
|
||||
this.doctorObj = res.data
|
||||
this.isLoading = true
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
checkConList(category_id){//查询收藏列表
|
||||
let params = {
|
||||
category_id:category_id,
|
||||
page:this.page,
|
||||
size:this.size
|
||||
}
|
||||
this.$requst.post('archives/hot',params).then(res=>{
|
||||
if(res.code==0){
|
||||
// 栏目类别
|
||||
if(uni.getStorageSync('cateList')==''){//首次渲染栏目
|
||||
if(res.data.category.length!=0){
|
||||
res.data.category.forEach((item,index)=>{
|
||||
let cateObj = {
|
||||
id:item.id,//栏目ID
|
||||
title:item.title,//栏目名称
|
||||
active:item.active,//是否选中
|
||||
model_id:item.model_id,//模型ID
|
||||
model_name:item.model_name,//模型标识
|
||||
sort:item.sort,
|
||||
|
||||
}
|
||||
this.cateList.push(cateObj)
|
||||
})
|
||||
uni.setStorageSync('cateList',this.cateList)
|
||||
}
|
||||
} else {
|
||||
//获取缓存中的栏目
|
||||
this.cateList = uni.getStorageSync('cateList')
|
||||
}
|
||||
// 获取列表
|
||||
if(this.page==1) this.dataList = []
|
||||
this.total = res.data.list.total
|
||||
if(res.data.list.list.length!=0){
|
||||
res.data.list.list.forEach(item=>{
|
||||
let tObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img:'/static/public/logo.png',//发布者头像
|
||||
name:'恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
}
|
||||
if(this.newCurrent==0 && item.category_id==32) this.dataList.push(tObj)
|
||||
if(this.newCurrent==1 && item.category_id==33) this.dataList.push(tObj)
|
||||
if(this.newCurrent==2 && item.category_id==34) this.dataList.push(tObj)
|
||||
if(this.newCurrent==3 && item.category_id==38) this.dataList.push(tObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
chooseTwo(index){
|
||||
this.newCurrent = index
|
||||
this.isZanw = true
|
||||
this.page = 1
|
||||
this.category_id = this.cateList[index].id
|
||||
this.checkConList(this.category_id)
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,121 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'消息中心'" :statusTitle="true"></status-nav>
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy32">
|
||||
<view v-if="dataList.length!=0">
|
||||
<view v-for="(item,index) in dataList" :key="index">
|
||||
<view class="fon24 col6 tc mar-sx50">{{item.time}}</view>
|
||||
<view class="radius10 bacf pad20 mar-x20" v-for="(iteml,indexl) in item.list" :key="indexl">
|
||||
<view class="disac">
|
||||
<image v-if="iteml.is_read==0" style="width:46rpx;height:56rpx;" src="/static/public/unread.png" mode=""></image>
|
||||
<image v-if="iteml.is_read==1" style="width:46rpx;height:56rpx;" src="/static/public/read.png" mode=""></image>
|
||||
<view class="fon28 col3 bold mar-zy10">{{iteml.title}}</view>
|
||||
<view :style="{background:iteml.is_read==1?'rgba(204, 204, 204,1)':'#FF4D4D'}" style="border-radius: 5rpx;font-size: 24rpx;color: #FFFFFF;padding: 2rpx 8rpx 4rpx 6rpx;transform: scale(.8);">{{iteml.is_read==1?'已读':'未读'}}</view>
|
||||
</view>
|
||||
<view v-if="iteml.content!=''" class="fon26 col3 mar-s20">{{iteml.content}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 50%;">
|
||||
<image src="/static/public/nothingm.png" style="width: 474rpx;height: 273rpx;" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无消息</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
searchVal:'',//输入框的值
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
dataList:[
|
||||
// {
|
||||
// time:'2021-07-15 14:25',
|
||||
// list:[
|
||||
// {is_read:0,title:'系统消息',content:''},
|
||||
// {is_read:0,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// {is_read:0,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// time:'2021-07-10 22:36',
|
||||
// list:[
|
||||
// {is_read:1,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// {is_read:1,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// {is_read:1,title:'系统消息',content:'尊敬的用户XX您好,您预约已成功,请与2021年7月28 日14:30分准时到达“恒美植发”门店进行检查。'},
|
||||
// ]
|
||||
// }
|
||||
],
|
||||
showTop:false,//是否显示返回顶部
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
// for (let i = 0; i < 4; i++) {
|
||||
// let obj = {
|
||||
// status:false,
|
||||
// main_img:'/static/public/main_img.png',
|
||||
// title:'恒美小课堂',
|
||||
// content:'饺子会吃肉?',
|
||||
// head_img:'/static/public/like.png',
|
||||
// name:'吃肉的饺子'
|
||||
// }
|
||||
// this.dataList.push(obj)
|
||||
// }
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.checkMsg()
|
||||
},
|
||||
methods: {
|
||||
checkMsg(){
|
||||
this.$requst.post('user/messages').then(res=>{
|
||||
// console.log('消息列表:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.list.length!=0){
|
||||
res.data.list.forEach(item=>{
|
||||
let titleMsg = ''
|
||||
if(item.type=='notice') titleMsg = "通知"
|
||||
if(item.type=='system') titleMsg = "系统消息"
|
||||
let msgObj = {
|
||||
time:item.send_at,
|
||||
list:[
|
||||
{
|
||||
is_read:item.is_read,
|
||||
title:titleMsg,
|
||||
content:item.content,
|
||||
}
|
||||
]
|
||||
}
|
||||
this.dataList.push(msgObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,165 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'文章收藏'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view>
|
||||
<view id="daoh" class="bacf pad-zy30 pad-sx20 isTopf" :style="{top:statusHNH+'px'}">
|
||||
<cate-pu :newCurrent="newCurrent*1" :activeb="publicColor" :isCenter="false" :newbmo="'#E0E0E0'" @choosecateEv="chooseTwo" :newcateList="cateList"></cate-pu>
|
||||
</view>
|
||||
<view :style="{paddingTop:(statusHNH+chuTop+30)+'px'}">
|
||||
<view v-if="dataList.length!=0" class="pad-zy20 pad-s20">
|
||||
<list-pu :radiu="true" @comfirmev="comfirmev" :list="dataList"></list-pu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 50%;">
|
||||
<image class="zanw-img" src="/static/public/collection.png" style="" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">您还没有收藏,快去收藏吧</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {cancleCollectionEV} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
dataList:[],
|
||||
showTop:false,//是否显示返回顶部
|
||||
newCurrent:0,
|
||||
cateList:[//所以二级分类
|
||||
|
||||
],
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
category_id:0,//栏目ID
|
||||
chuTop:'',
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkConList(this.category_id)//调用自主预约列表事件
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
uni.removeStorageSync('cateList')
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
this.checkConList(this.category_id)
|
||||
},
|
||||
onLoad() {
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('#daoh').boundingClientRect((rect) => {
|
||||
// console.log('状态栏+标题栏:',rect);
|
||||
this.chuTop = rect.height
|
||||
}).exec()
|
||||
},
|
||||
methods: {
|
||||
checkConList(category_id){//查询收藏列表
|
||||
// this.$toolAll.tools.showToast('加载中...')
|
||||
let params = {
|
||||
category_id:category_id,
|
||||
page:this.page,
|
||||
size:this.size
|
||||
}
|
||||
this.$requst.post('archives/collects',params).then(res=>{
|
||||
if(res.code==0){
|
||||
// 栏目类别
|
||||
if(uni.getStorageSync('cateList')==''){//首次渲染栏目
|
||||
if(res.data.category.length!=0){
|
||||
res.data.category.forEach((item,index)=>{
|
||||
let cateObj = {
|
||||
id:item.id,//栏目ID
|
||||
title:item.title,//栏目名称
|
||||
active:item.active,//是否选中
|
||||
model_id:item.model_id,//模型ID
|
||||
model_name:item.model_name,//模型标识
|
||||
sort:item.sort,
|
||||
|
||||
}
|
||||
this.cateList.push(cateObj)
|
||||
})
|
||||
uni.setStorageSync('cateList',this.cateList)
|
||||
this.category_id = this.cateList[0].id
|
||||
}
|
||||
} else {
|
||||
//获取缓存中的栏目
|
||||
this.cateList = uni.getStorageSync('cateList')
|
||||
}
|
||||
// 获取列表
|
||||
if(this.page==1) this.dataList = []
|
||||
this.total = res.data.list.total
|
||||
if(res.data.list.list.length!=0){
|
||||
uni.hideToast()
|
||||
res.data.list.list.forEach(item=>{
|
||||
let tObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:1,//是否已收藏
|
||||
collects:item.collects,//收藏量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img:'/static/public/logo.png',//发布者头像
|
||||
name:'恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
}
|
||||
if(this.newCurrent==0 && item.category_id==32) this.dataList.push(tObj)
|
||||
if(this.newCurrent==1 && item.category_id==33) this.dataList.push(tObj)
|
||||
if(this.newCurrent==2 && item.category_id==34) this.dataList.push(tObj)
|
||||
if(this.newCurrent==3 && item.category_id==38) this.dataList.push(tObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
comfirmev(e){//确认取消收藏事件
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
setTimeout(()=>{
|
||||
this.checkConList(this.category_id)
|
||||
},300)
|
||||
this.dataList[e].is_collected = 0
|
||||
},
|
||||
chooseTwo(index){//二级分类选择
|
||||
this.newCurrent = index
|
||||
this.isZanw = true
|
||||
this.page = 1
|
||||
this.category_id = this.cateList[index].id
|
||||
this.checkConList(this.cateList[index].id)
|
||||
// console.log('二级分类:',index);
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,139 @@
|
|||
<template>
|
||||
<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>
|
||||
<view :style="{paddingTop: navH+'px'}">
|
||||
<view v-if="dataList[flag].length!=0">
|
||||
<view class="disjbac bbot pad-sx40 mar-zy50" v-for="(iteml,indexl) in dataList[flag]" :key="indexl">
|
||||
<view class="disac">
|
||||
<!-- 头像 -->
|
||||
<image class="radius20" :src="iteml.src" style="width: 100rpx;height: 100rpx;" mode="aspectFill"></image>
|
||||
<view class="mar-z25">
|
||||
<!-- 昵称 -->
|
||||
<view class="fon32 bold">{{iteml.name}}</view>
|
||||
<!-- 时间 -->
|
||||
<view class="fon24 col80 mar-s10">{{iteml.time}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tright">
|
||||
<!-- 方式 -->
|
||||
<view class="fon24 col80">{{iteml.action}}</view>
|
||||
<!-- 收益 -->
|
||||
<view class="fon28 bold mar-s10" style="color: #EB5929;">+{{iteml.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 40%;">
|
||||
<image src="/static/public/nothing.png" style="width: 474rpx;height: 273rpx;" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">您还没有分享人,快去分享吧</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
flag:0,
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
cateList:[
|
||||
{title:'一级',num:0,grade:'first'},
|
||||
{title:'二级',num:0,grade:'second'},
|
||||
],
|
||||
showTop:false,//是否显示返回顶部
|
||||
dataList:[
|
||||
[],
|
||||
[],
|
||||
],
|
||||
navH:uni.getStorageSync('navHeight'),
|
||||
page:1,
|
||||
size:20,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkPeople()
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多分享人','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
if(uni.getStorageSync('navHeight')==''){
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.navHeight').boundingClientRect((rect) => {
|
||||
uni.setStorageSync('navHeight',rect.height)
|
||||
this.navH = rect.height
|
||||
}).exec()
|
||||
}
|
||||
this.checkShare()//查询一二级分享总人数
|
||||
this.checkPeople()//查询分享一二级列表人数
|
||||
},
|
||||
methods: {
|
||||
checkShare(){//查询一二级分享总人数
|
||||
this.$requst.post('user/share-count').then(res=>{
|
||||
// console.log('查询用户的分享统计记录:',res);
|
||||
if(res.code==0){
|
||||
this.cateList[0].num = res.data.user_count.first
|
||||
this.cateList[1].num = res.data.user_count.second
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
checkPeople(){//查询分享一二级列表人数
|
||||
this.$requst.post('user/share-users',{grade:this.cateList[this.flag].grade,page:this.page,size:this.size}).then(res=>{
|
||||
console.log('查询分享一二级列表人数列表:',res);
|
||||
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,
|
||||
time:item.created_at,
|
||||
action:item.invite_source,
|
||||
num:item.score
|
||||
}
|
||||
this.dataList[this.flag].push(obj)
|
||||
})
|
||||
this.total = res.data.total
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
chooseye(index){
|
||||
this.flag = index
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,185 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'订单详情'" :statusTitle="true"></status-nav>
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30" style="padding-bottom: 150rpx;">
|
||||
<!-- 订单类型 -->
|
||||
<view class="bacf radius20 mar-s20 fon28" style="padding: 27rpx 20rpx;">
|
||||
<view class="disjbac">
|
||||
<view class="bold">商城订单</view>
|
||||
<view style="color: #F85050;font-weight: bold;">待付款</view>
|
||||
</view>
|
||||
<view class="bold col3 mar-s40 mar-x20">订单号:1234567890</view>
|
||||
<view class="fon24 col9">2021-09-06 10:30</view>
|
||||
</view>
|
||||
<!-- 物流信息 -->
|
||||
<view class="bacf radius20 mar-s20 fon28" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">物流信息</view>
|
||||
<view class="bold col3 mar-s40 fon26 disjbac">
|
||||
<view>韵达快递:2983625984729</view>
|
||||
<view>复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 地址信息 -->
|
||||
<view v-if="isExpress" class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">收件人信息</view>
|
||||
<view class="fon26 col3">
|
||||
<view class="fon28 col3 bold" style="margin: 52rpx 0 20rpx 0;">蒋灰灰 <span>188****0362</span></view>
|
||||
<view class="fon24 col9">四川省成都市成华区中环路双店路段奥园广场</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 订单信息 -->
|
||||
<view class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||||
<view class="fon26 col3 disjbac pad-sx50 disjbac bbot">
|
||||
<image src="/static/public/banner.png" class="flexs" style="width: 166rpx;height: 166rpx;border-radius: 15rpx;margin-right: 12rpx;" mode="aspectFill"></image>
|
||||
<view class="width100">
|
||||
<view class="fon28 col3 bold clips2">【99皮皮节】【种植发际线】1000单位FUE技术案例招募门美人</view>
|
||||
<view style="font-size: 22rpx;color: #808080;font-weight: 500;">试用</view>
|
||||
<view class="disjbac mar-s10">
|
||||
<view style="color: #F85050;font-size: 32rpx;font-weight: bold;">¥3888</view>
|
||||
<view class="fon28 col6">x2</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fon28 disjbac" style="margin: 60rpx 0 20rpx 0;">
|
||||
<view class="col6">共4件</view>
|
||||
<view style="font-weight: bold;color: #F85050;">应付款:3888.00+300孔雀币</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 优惠 -->
|
||||
<view class="bacf radius20 mar-s20" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">优惠</view>
|
||||
<view @tap="showQuan=true" class="fon28 col3 disjbac mar-sx40">
|
||||
<view>优惠券</view>
|
||||
<view class="disac">
|
||||
<view style="color: #F85050;font-weight: bold;">-¥99.00</view>
|
||||
<image src="/static/public/nextM.png" style="width: 16px;height: 16px;flex-shrink: 0;" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fon28 col3 disjbac">
|
||||
<view>立减优惠</view>
|
||||
<view style="color: #F85050;font-weight: bold;">-¥99.00</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 快递费用 -->
|
||||
<view class="bacf radius20 mar-s20 disjbac" style="padding: 27rpx 20rpx;">
|
||||
<view class="bold">快递费用</view>
|
||||
<view class="fon28" style="color: #F85050;font-weight: bold;">¥10.00</view>
|
||||
</view>
|
||||
<!-- 消费 -->
|
||||
<view class="fon28 col3" style="margin: 40rpx 0 40rpx 0;text-align: right;">消费:<span style="font-size: 36rpx;font-weight: bold;color: #F85050;">¥3898+300孔雀币</span></view>
|
||||
<view class="disjbac posixzy bacf" style="height: 124rpx;padding: 0 32rpx;display: flex;align-items: center;">
|
||||
<view class="posir">
|
||||
<image src="/static/public/weix.png" style="width: 56rpx;height: 56rpx;" mode=""></image>
|
||||
<view class="fon28 col3">分享</view>
|
||||
<button open-type="share" class="posia" style="top: 0;left: 0;right: 0;bottom: 0;opacity: 0;"></button>
|
||||
</view>
|
||||
<!-- 待收货 -->
|
||||
<!-- <view class="disac">
|
||||
<view style="width: 249rpx;height: 70rpx;border-radius: 35rpx;line-height: 70rpx;text-align: center;font-size: 28rpx;font-weight: bold;background: #E9E9E9;color: #808080;">取消订单</view>
|
||||
<view style="width: 249rpx;height: 70rpx;border-radius: 35rpx;line-height: 70rpx;text-align: center;font-size: 28rpx;font-weight: bold;background: #3875F6;color: #FFFFFF;margin-left: 20rpx;">立即支付</view>
|
||||
</view> -->
|
||||
<!-- 确认收货 -->
|
||||
<view style="width: 249rpx;height: 70rpx;border-radius: 35rpx;line-height: 70rpx;text-align: center;font-size: 28rpx;font-weight: bold;background: #3875F6;color: #FFFFFF;margin-left: 20rpx;">确认收货</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="showQuan" @tap.stop="showQuan=false" class="posAll">
|
||||
<view class="bacf posixzy" style="border-radius: 40rpx 40rpx 0rpx 0rpx;" @tap.stop="showQuan=true">
|
||||
<view style="padding: 20rpx 50rpx;">
|
||||
<view class="disjbac">
|
||||
<view class="fon28 bold col3">优惠券</view>
|
||||
<image @tap.stop="showQuan=false" src="/static/public/cha-close.png" style="width: 30rpx;height: 30rpx;" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="fon28 bold col3" style="display: flex;justify-content: space-around;align-items: center;padding: 50rpx 0 16rpx 0;">
|
||||
<view class="posir" :class="switchQuan?'activeQuan':''" @tap="switchQuan=true">可用优惠券(1)</view>
|
||||
<view class="posir" :class="!switchQuan?'activeQuan':''" @tap="switchQuan=false">失效优惠券(0)</view>
|
||||
</view>
|
||||
<view class="mar-s40">
|
||||
<view style="height: 200rpx;" class="disjbac">
|
||||
<view class="posir" style="width: 218rpx;height: 200rpx;flex-shrink: 0;text-align: center;color: #FFFFFF;">
|
||||
<image class="posia" src="/static/public/quan-left.png" style="width: 218rpx;height: 200rpx;left: 0;top: 0;" mode=""></image>
|
||||
<view class="posir" style="z-index: 1;">
|
||||
<view style="margin: 40rpx 0 30rpx 0rpx;" class="fon28">¥<span style="font-size: 56rpx;font-weight: bold;">10</span></view>
|
||||
<view class="fon24">满300元可使用</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;height: 200rpx;padding: 0 20rpx;background-color: #F5F5F5;">
|
||||
<view class="fon28 col3 mar-s20">黄金会员专属优惠券</view>
|
||||
<view>
|
||||
<image src="/static/public/chooseQuan.png" style="width: 40rpx;height: 40rpx;border-radius: 100%;float: right;"></image>
|
||||
</view>
|
||||
<view class="fon20 col3 mar-x20">有效期:2021-09-06至2021-09-15</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mar-s40">
|
||||
<view style="height: 200rpx;" class="disjbac">
|
||||
<view class="posir" style="width: 218rpx;height: 200rpx;flex-shrink: 0;text-align: center;color: #FFFFFF;">
|
||||
<image class="posia" src="/static/public/quan-left.png" style="width: 218rpx;height: 200rpx;left: 0;top: 0;" mode=""></image>
|
||||
<view class="posir" style="z-index: 1;">
|
||||
<view style="margin: 40rpx 0 30rpx 0rpx;" class="fon28">¥<span style="font-size: 56rpx;font-weight: bold;">10</span></view>
|
||||
<view class="fon24">满300元可使用</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: flex;flex-direction: column;justify-content: space-between;width: 100%;height: 200rpx;padding: 0 20rpx;background-color: #F5F5F5;">
|
||||
<view class="fon28 col3 mar-s20">黄金会员专属优惠券</view>
|
||||
<view>
|
||||
<image src="/static/public/cancleQuan.png" style="width: 40rpx;height: 40rpx;border-radius: 100%;float: right;"></image>
|
||||
</view>
|
||||
<view class="fon20 col3 mar-x20">有效期:2021-09-06至2021-09-15</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 领取优惠券按钮 -->
|
||||
<view @tap.stop="showQuan=false" style="font-size: 36rpx;color: #FFFFFF;font-weight: bold;margin: 0 auto;background: #3875F6;border-radius: 20rpx;height: 90rpx;line-height: 90rpx;text-align: center;margin-top: 156rpx;margin-bottom: 20rpx;">领取优惠券</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isExpress:true,
|
||||
switchQuan:true,
|
||||
showQuan:false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
goThere(){
|
||||
wx.getLocation({//获取当前经纬度
|
||||
type: 'wgs84', //返回可以用于wx.openLocation的经纬度,官方提示bug: iOS 6.3.30 type 参数不生效,只会返回 wgs84 类型的坐标信息
|
||||
success: function (res) {
|
||||
wx.openLocation({//使用微信内置地图查看位置。
|
||||
latitude: 22.5542080000,//要去的纬度-地址
|
||||
longitude: 113.8878770000,//要去的经度-地址
|
||||
name: "宝安中心A地铁口",
|
||||
address:'宝安中心A地铁口'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
goPayment(){
|
||||
uni.navigateTo({
|
||||
url:'/pagesA/immediatePayment/immediatePayment'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,94 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'二维码海报'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy36 pad-x20">
|
||||
<view v-show="imgSrc!=''">
|
||||
<view class="mar-s20">
|
||||
<image class="width100 radius20" :src="imgSrc" mode="widthFix" lazy-load></image>
|
||||
</view>
|
||||
<!-- 分享按钮 -->
|
||||
<view v-if="showBtn" @tap="shareEv" class="disjcac radius20 posir" style="height: 90rpx;margin: 20rpx 80rpx 0 80rpx;background-color: #38CE51;line-height: 90rpx;">
|
||||
<view class="disac">
|
||||
<image src="/static/public/sharef.png" style="width: 54rpx;height: 54rpx;" mode=""></image>
|
||||
<view class="fon40 bold colf mar-z10">分享给好友</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-show="imgSrc==''" class="disjcac fc" style="margin-top: 50%;">
|
||||
<image class="zanw-img mar-x50" src="/static/public/zanwn.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3 mar-s50" style="margin-top: 30%;">暂无内容</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="imgSrc==''" :contentVal="'立即生成创意海报'" :clearVal="'暂不生成'" :comfrimVal="'立即生成'" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {base64ToPath} from '@/jsFile/base64-src.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isShowT:true,
|
||||
imgSrc:uni.getStorageSync('imgSrcP'),
|
||||
isHaib:false,
|
||||
showBtn:false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
//如果还没有生成海报
|
||||
this.imgSrc = uni.getStorageSync('imgSrcP')//弹框关闭
|
||||
if(this.imgSrc!='') {
|
||||
setTimeout(()=>{
|
||||
this.showBtn = true
|
||||
},500)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
shareEv(){
|
||||
wx.showShareImageMenu({
|
||||
path: this.imgSrc
|
||||
})
|
||||
this.$requst.post('user/record',{type:'other',action:'share',id:''}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
},
|
||||
comfirmev(){//立即生成事件
|
||||
this.$toolAll.tools.showToast('生成中...')
|
||||
this.isShowT = false
|
||||
this.$requst.get('user/personal-poster').then(res=>{
|
||||
// console.log('生成个人海报成功:',res);
|
||||
if(res.code==0){
|
||||
this.imgSrc = res.data.poster
|
||||
uni.hideToast()
|
||||
this.$toolAll.tools.showToast('生成海报成功')
|
||||
base64ToPath(this.imgSrc).then(path => {
|
||||
this.imgSrc = path
|
||||
this.showBtn = true
|
||||
uni.setStorageSync('imgSrcP',path)
|
||||
}).catch(error => {})
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
cancleev(){//暂不生成事件
|
||||
uni.navigateBack({delta:1})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,599 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav v-if="invite_code==''" :titleVal="'分类'" :statusTitle="true"></status-nav>
|
||||
<view v-if="invite_code!=''" class="status-box statusHNH" style="background-color: #FFFFFF;">
|
||||
<view :style="{height:statusBarHeight+'px'}"></view>
|
||||
<view class="status-nav">
|
||||
<!-- 标题 -->
|
||||
<view class="tab-title tcenter" style="color: #000000;">分类</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<view :style="{top: statusHNH+'px'}" class="posiszy" style="height: 50px;">
|
||||
<view class="bacf pad-zy32 pad-sx20">
|
||||
<cate-pu @choosecateEv="choosecateEv" :activeb="invite_code!=''?'#3875F6':publicColor" :newCurrent="cateCurrent*1" :newbmo="'#F2F2F2'" :isCenter="false" :newcateList="cateList"></cate-pu>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pad-x180" :style="{paddingTop: (statusHNH+50)+'px'}">
|
||||
<view v-if="isLoading" class="pad-s30">
|
||||
<view v-show="cateCurrent==isNum">
|
||||
<view class="pad-zy32">
|
||||
<!-- 自定义轮播 -->
|
||||
<swiper-pu :browseP="true" :bannerList="bannerList" :newHeight="'250'" :newRadius="'10'" :newBottom="'5'"></swiper-pu>
|
||||
<!-- 标题 -->
|
||||
<view class="fon36 col3 bold mar-sx20 clips2" style="line-height: 50rpx;">{{detailObj.title}}</view>
|
||||
<view class="disjbac">
|
||||
<view class="disac">
|
||||
<!-- 发布者头像 -->
|
||||
<image class="flexs" src="/static/public/logo.png" style="width: 60rpx;height: 60rpx;border-radius: 100%;" mode="aspectFill"></image>
|
||||
<view class="mar-z10">
|
||||
<!-- 发布者昵称 -->
|
||||
<view class="fon28 col3 clips1">恒美植发</view>
|
||||
<!-- 发布时间 -->
|
||||
<view class="fon20 col9" style="margin-top: 6rpx;">{{detailObj.published_at}}发布</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="disac flexs">
|
||||
<view class="disac fc" @tap="tapLike" style="width: 60rpx;">
|
||||
<image v-if="isDetailLike" src="/static/public/detail-like.png" style="width: 42rpx;height: 42rpx;" mode=""></image>
|
||||
<image v-else src="/static/public/detail-nlike.png" style="width: 42rpx;height: 42rpx;" mode=""></image>
|
||||
<view class="fon24 col9 tc">{{likeCon}}</view>
|
||||
</view>
|
||||
<view @tap="shareEv" class="disac fc mar-zy36 posir">
|
||||
<image src="/static/public/weix.png" style="width: 42rpx;height: 42rpx;" mode=""></image>
|
||||
<view class="fon24 col9">分享</view>
|
||||
<button class="posia" open-type="share" style="top: 0;right: 0;left: 0;bottom: 0;opacity: 0;">分享</button>
|
||||
<!-- <button v-if="haveImg" class="posia" open-type="share" style="top: 0;right: 0;left: 0;bottom: 0;opacity: 0;">分享</button> -->
|
||||
</view>
|
||||
<view class="disac fc" @tap="tapConllection">
|
||||
<image v-if="isDetailConllection" src="/static/public/yconllection.png" style="width: 44rpx;height: 44rpx;" mode=""></image>
|
||||
<image v-else src="/static/public/conllection.png" style="width: 44rpx;height: 44rpx;" mode=""></image>
|
||||
<view class="fon24 col9">收藏</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 内容详情 -->
|
||||
<view class="fon28 mar-s20" style="color: #1A1A1A; line-height: 40rpx;">
|
||||
<rich-text :nodes="detailInfo"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pad-zy20" v-show="cateCurrent==1">
|
||||
<view class="fon30 bold tc mar-sx40" :style="{color:publicColor}">相关推荐</view>
|
||||
<!-- 相关推荐列表 -->
|
||||
<list-pu @chooseLike="chooseLikex" @comfirmev="comfirmevx" :list="xgList"></list-pu>
|
||||
</view>
|
||||
<view class="pad-zy20">
|
||||
<view class="fon30 bold tc mar-sx40" :style="{color:publicColor}">推荐医生</view>
|
||||
<!-- 推荐医生列表 -->
|
||||
<list-doctor v-if="dataList.length!=0" :list="dataList"></list-doctor>
|
||||
<view v-if="dataList.length==0" class="disjcac fc" style="margin-top: 10%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无推荐医生</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 案例日记 -->
|
||||
<view v-show="cateCurrent==0 && isNum!=0" class="pad-zy20">
|
||||
<view v-if="listArrone.length!=0">
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="listArrone"></list-pu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 40%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无内容</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 案例日记 -->
|
||||
<view v-show="cateCurrent==1 && isNum!=1" class="pad-zy20">
|
||||
<view v-if="listArrtwo.length!=0">
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="listArrtwo"></list-pu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 40%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无内容</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 效果模拟 -->
|
||||
<view v-show="cateCurrent==2 && isNum!=2" class="pad-zy20">
|
||||
<view v-if="listArrthree.length!=0">
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="listArrthree"></list-pu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 40%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无内容</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 科普视频 -->
|
||||
<view v-show="cateCurrent==3 && isNum!=3" class="pad-zy20">
|
||||
<view v-if="listArrfour.length!=0">
|
||||
<list-pu @chooseLike="chooseLike" @comfirmev="comfirmev" :list="listArrfour"></list-pu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 40%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">暂无内容</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="posixzy disjbac bacf pad-zy32 btnBKS">
|
||||
<view class="posir">
|
||||
<image @tap="backHome" class="posia backH" src="/static/public/back-home.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="disac fon26 colf">
|
||||
<view @tap="lianK" class="disac posir lianShare" style="background-color: #3875F6; border-top-left-radius: 51rpx;border-bottom-left-radius: 51rpx;">
|
||||
<image src="/static/public/bottom-customer.png" class="mar-zy20" style="width: 47rpx;height: 47rpx;" mode="aspectFill"></image>
|
||||
<view>联系客服</view>
|
||||
<button v-if="haveImg" class="fon24 posia" style="opacity: 0;top: 0;left: 0;right: 0;bottom: 0;" open-type="contact">客服</button>
|
||||
</view>
|
||||
<view @tap="shareEv" class="disac posir lianShare" style="background-color: #38CE51;border-top-right-radius: 51rpx;border-bottom-right-radius: 51rpx;">
|
||||
<image src="/static/public/bottom-shear.png" style="width: 47rpx;height: 47rpx;margin-left: 15rpx;margin-right: 8rpx;" mode="aspectFill"></image>
|
||||
<view>分享给好友</view>
|
||||
<button v-if="haveImg" class="posia" open-type="share" style="top: 0;right: 0;left: 0;bottom: 0;opacity: 0;">分享</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2" @cancleEv="cancleEv"></empower>
|
||||
<!-- 弹框 -->
|
||||
<view v-if="isShowP" @touchmove.stop.prevent="moveHandle" class="disjcac posAll">
|
||||
<view class="bacf radius20 width100 tank-box">
|
||||
<view class="tc tank-box-itemone">请授权绑定手机号</view>
|
||||
<view class="fon28 colf pad-x30 pad-zy30 tc disjb">
|
||||
<view @tap="isShowP=false" class="pad-sx10 radius10 tank-btn" style="background-color: rgba(230, 230, 230,1);color: #000000;">暂不绑定</view>
|
||||
<view class="pad-sx10 radius10 tank-btn posir pbackc">
|
||||
立即绑定
|
||||
<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="posia syxzo">立即绑定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import listDoctor from '@/components/list-doctor.vue';
|
||||
import swiperPu from '@/components/swiper-pu.vue';
|
||||
import {collectionEV,cancleCollectionEV} from '@/jsFile/publicAPI.js';
|
||||
import empower from '@/components/empower.vue';
|
||||
export default {
|
||||
components:{
|
||||
listDoctor,
|
||||
swiperPu,
|
||||
empower
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight:uni.getSystemInfoSync().statusBarHeight,
|
||||
isLoading:false,
|
||||
vision:false,
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor') || '#3875F6',//主题颜色
|
||||
cateCurrent:0,
|
||||
haveImg:true,
|
||||
cateList:[],
|
||||
bannerList:[],//轮播
|
||||
xgList:[//相关推荐
|
||||
],
|
||||
dataList:[//推荐医生
|
||||
],
|
||||
showTop:false,
|
||||
isDetailLike:false,//是否喜欢
|
||||
likeCon:'点赞',
|
||||
isDetailConllection:false,//是否已收藏
|
||||
isNum:0,
|
||||
listArrone:[],//问题
|
||||
listArrtwo:[//案例日记
|
||||
],
|
||||
listArrthree:[//效果模拟
|
||||
],
|
||||
listArrfour:[//科普视频
|
||||
],
|
||||
detailObj:{},//详情
|
||||
detailInfo:'',//富文本
|
||||
category_id:'',//栏目ID
|
||||
active:'',//是否是详情页
|
||||
// jieDuan:false,
|
||||
share_id:0,
|
||||
invite_code:'',
|
||||
isShowP:false
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
// for (let i = 0; i < 4; i++) {
|
||||
// if(this.cateCurrent==0) {
|
||||
// let obj = {status:false,main_img:'',title:'恒美小课堂',content:'饺子会吃肉?',head_img:'/static/public/like.png',name:'吃肉的饺子',isCate:0}
|
||||
// this.listArrone.push(obj)
|
||||
// }
|
||||
// if(this.cateCurrent==1) {
|
||||
// let obj = {status:false,main_img:'',title:'恒美小课堂',content:'饺子会吃肉?',head_img:'/static/public/like.png',name:'吃肉的饺子',isCate:1}
|
||||
// this.listArrtwo.push(obj)
|
||||
// }
|
||||
// if(this.cateCurrent==2) {
|
||||
// let obj = {status:false,main_img:'',title:'恒美小课堂',content:'饺子会吃肉?',head_img:'/static/public/like.png',name:'吃肉的饺子',isCate:2}
|
||||
// this.listArrthree.push(obj)
|
||||
// }
|
||||
// if(this.cateCurrent==3) {
|
||||
// let obj = {status:false,main_img:'',title:'恒美小课堂',content:'饺子会吃肉?',head_img:'/static/public/like.png',name:'吃肉的饺子',isCate:3}
|
||||
// this.listArrfour.push(obj)
|
||||
// }
|
||||
// }
|
||||
},
|
||||
onShareTimeline() {},
|
||||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
this.$requst.post('user/record',{type:'content',action:'share',id:this.detailObj.id}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
c:this.detailObj.id*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
var shareObj = {
|
||||
title: `${ya.detailObj.title}`, // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pagesB/problemDetail/problemDetail?id=${this.detailObj.id}&category_id=${this.category_id}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
imageUrl: ya.$http + ya.detailObj.share_img//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
onLoad(options) {
|
||||
if(options.category_id!=undefined) {
|
||||
this.category_id = options.category_id
|
||||
this.conid = options.id
|
||||
this.invite_code = options.invite_code
|
||||
uni.setStorageSync('ninvite_code',this.invite_code)
|
||||
if(this.invite_code!='' && this.invite_code!=undefined){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:this.invite_code,//用户邀请码
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false
|
||||
this.vision = true
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.$toolAll.tools.overdue()
|
||||
this.$toolAll.tools.isLogin()
|
||||
}
|
||||
}
|
||||
this.checkDetail(this.conid)
|
||||
if(options.share_id!=undefined) this.share_id = options.share_id
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
c:this.conid*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
},
|
||||
methods: {
|
||||
moveHandle(){//禁止底层滑动
|
||||
return false
|
||||
},
|
||||
getphonenumber(e){//授权绑定手机号
|
||||
if(e.detail.errMsg=="getPhoneNumber:ok"){
|
||||
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
|
||||
// console.log('手机号信息:',res);
|
||||
if(res.code==0){
|
||||
this.isShowP = false
|
||||
this.$toolAll.tools.showToast('手机号绑定成功','success')
|
||||
}
|
||||
},error=>{})
|
||||
} else {
|
||||
this.isShowP = false
|
||||
}
|
||||
},
|
||||
chooseLike(e){//收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
let cateId = ''
|
||||
let newArr = []
|
||||
if(this.cateCurrent==0) {
|
||||
newArr = this.listArrone
|
||||
cateId = newArr[e].id
|
||||
}
|
||||
if(this.cateCurrent==1) {
|
||||
newArr = this.listArrtwo
|
||||
cateId = newArr[e].id
|
||||
}
|
||||
if(this.cateCurrent==2) {
|
||||
newArr = this.listArrthree
|
||||
cateId = newArr[e].id
|
||||
}
|
||||
if(this.cateCurrent==3) {
|
||||
newArr = this.listArrfour
|
||||
cateId = newArr[e].id
|
||||
}
|
||||
if(newArr[e].is_collected==0){
|
||||
newArr[e].is_collected = 1
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'collect',archive_id:cateId})
|
||||
}
|
||||
},
|
||||
comfirmev(e){//确认取消收藏事件
|
||||
let cateId = ''
|
||||
if(this.cateCurrent==0) {
|
||||
this.listArrone[e].is_collected = 0
|
||||
cateId = this.listArrone[e].id
|
||||
}
|
||||
if(this.cateCurrent==1) {
|
||||
this.listArrtwo[e].is_collected = 0
|
||||
cateId = this.listArrtwo[e].id
|
||||
}
|
||||
if(this.cateCurrent==2) {
|
||||
this.listArrthree[e].is_collected = 0
|
||||
cateId = this.listArrthree[e].id
|
||||
}
|
||||
if(this.cateCurrent==3) {
|
||||
this.listArrfour[e].is_collected = 0
|
||||
cateId = this.listArrfour[e].id
|
||||
}
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:cateId})
|
||||
},
|
||||
chooseLikex(e){//收藏事件
|
||||
if(this.xgList[e].is_collected==0){
|
||||
this.xgList[e].is_collected = 1
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'collect',archive_id:this.xgList[e].id})
|
||||
}
|
||||
},
|
||||
comfirmevx(e){//确认取消收藏事件
|
||||
this.xgList[e].is_collected = 0
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:this.xgList[e].id})
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
cancleEv(e){//取消授权
|
||||
if(e==0) this.vision = false
|
||||
},
|
||||
backHome(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
},
|
||||
lianK(){//客服
|
||||
// if(!this.jieDuan){
|
||||
// let isAuth = this.$toolAll.tools.returnAuth()
|
||||
// if(!isAuth){
|
||||
if(this.haveImg == false) {
|
||||
this.vision = true
|
||||
} else {
|
||||
this.$toolAll.tools.closeTimer()//清空埋点倒计时
|
||||
this.$requst.post('user/record',{type:'other',action:'ask',id:0}).then(res=>{},error=>{})
|
||||
let maiOjb = {
|
||||
e:5,//内容咨询
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
// } else this.jieDuan = true
|
||||
// }
|
||||
},
|
||||
shareEv(){
|
||||
if(this.haveImg == false) {
|
||||
this.vision = true
|
||||
}
|
||||
},
|
||||
checkDetail(newId){
|
||||
this.$requst.post('archives/detail',{id:newId,share_id:this.share_id}).then(res=>{
|
||||
// console.log('详情数据:',res);
|
||||
if(res.code==0){
|
||||
this.isLoading=true
|
||||
// 栏目类别
|
||||
if(res.data.category.length!=0){
|
||||
res.data.category.forEach((item,index)=>{
|
||||
let cateObj = {
|
||||
id:item.id,//栏目ID
|
||||
title:item.title,//栏目名称
|
||||
active:item.active,//是否选中
|
||||
model_id:item.model_id,//模型ID
|
||||
model_name:item.model_name,//模型标识
|
||||
sort:item.sort
|
||||
}
|
||||
this.cateList.push(cateObj)
|
||||
// 默认选中的栏目
|
||||
if(item.active==1) this.active = this.cateCurrent = index
|
||||
// 默认展示栏目详情
|
||||
if(this.category_id==item.id) this.isNum = index
|
||||
})
|
||||
}
|
||||
if(this.invite_code!='' && this.invite_code!=undefined){
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('.statusHNH').boundingClientRect((rect) => {
|
||||
// console.log('状态栏+标题栏:',rect);
|
||||
this.statusHNH = rect.height
|
||||
// console.log(this.statusHNH );
|
||||
}).exec()
|
||||
}
|
||||
// 详情
|
||||
this.detailObj = res.data.detail
|
||||
let maiOjb = {
|
||||
e:1,//内容访问
|
||||
c:this.detailObj.id*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
if(this.detailObj.is_liked==1) {
|
||||
if(this.detailObj.likes >= 1000) this.likeCon = '999+'
|
||||
else this.likeCon = this.detailObj.likes
|
||||
}
|
||||
// 轮播
|
||||
// 图片字符串转数组
|
||||
let arrImg = this.detailObj.images.split(',')
|
||||
arrImg.forEach(item=>{
|
||||
let newImgObj = {
|
||||
imgSrc:this.$http + item,
|
||||
url:'',
|
||||
isVideo:false,
|
||||
poster:'',
|
||||
}
|
||||
// 存图片
|
||||
this.bannerList.push(newImgObj)
|
||||
})
|
||||
// 存视频
|
||||
if(this.detailObj.video!=''){
|
||||
this.bannerList[0] = {
|
||||
imgSrc:this.$http + arrImg[0],
|
||||
url:this.$http + this.detailObj.video,
|
||||
isVideo:true,
|
||||
poster:'',
|
||||
}
|
||||
}
|
||||
// 默认显示是否收藏
|
||||
if(this.detailObj.is_collected==0) this.isDetailConllection = false
|
||||
if(this.detailObj.is_collected==1) this.isDetailConllection = true
|
||||
if(this.detailObj.is_liked==0) this.isDetailLike = false
|
||||
if(this.detailObj.is_liked==1) this.isDetailLike = true
|
||||
// 富文本
|
||||
this.detailInfo = this.$toolAll.tools.escape2Html(this.detailObj.content)
|
||||
// 相关推荐xgList
|
||||
if(res.data.diary.length!=0){
|
||||
res.data.diary.forEach(item=>{
|
||||
let tObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img:'/static/public/logo.png',//发布者头像
|
||||
name:'恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
}
|
||||
if(item.cover!='' && item.video==''){
|
||||
this.xgList.push(tObj)
|
||||
}
|
||||
})
|
||||
}
|
||||
// 推荐医生
|
||||
if(res.data.doctor.length!=0){
|
||||
res.data.doctor.forEach(item=>{
|
||||
let doObj = {
|
||||
id:item.id,
|
||||
imgSrc: item.headimg!=null ? item.headimg : '',
|
||||
name:item.name,
|
||||
cyear:parseFloat(item.work_time),
|
||||
bmen:item.dept_name,
|
||||
zcheng:'主任医师',
|
||||
goodAt:item.diseases,
|
||||
show_detail:item.show_detail
|
||||
}
|
||||
this.dataList.push(doObj)
|
||||
})
|
||||
}
|
||||
this.choosecateEv(this.cateCurrent)
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
choosecateEv(e){
|
||||
this.cateCurrent = e
|
||||
this.$requst.post('archives/category',{category_id:this.cateList[e].id,keyword:''}).then(res=>{
|
||||
// console.log('该分类下的列表:',res);
|
||||
if(res.code==0){
|
||||
if(e==0 && this.active!=e) this.listArrone = []
|
||||
if(e==1 && this.active!=e) this.listArrtwo = []
|
||||
if(e==2 && this.active!=e) this.listArrthree = []
|
||||
if(e==3 && this.active!=e) this.listArrfour = []
|
||||
if(res.data.list.list.length!=0){
|
||||
res.data.list.list.forEach(item=>{
|
||||
let num = item.video.search(".mp4")
|
||||
let isVideo = false
|
||||
if(num!='-1') isVideo = true
|
||||
let arrObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img:'/static/public/logo.png',//发布者头像
|
||||
name:'恒美植发',//发布者昵称
|
||||
isVideo:isVideo//是否是视频
|
||||
}
|
||||
if(item.cover!=''){
|
||||
if(e==0 && this.active!=e) this.listArrone.push(arrObj)
|
||||
if(e==1 && this.active!=e) this.listArrtwo.push(arrObj)
|
||||
if(e==2 && this.active!=e) this.listArrthree.push(arrObj)
|
||||
if(e==3 && this.active!=e) this.listArrfour.push(arrObj)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
tapLike(){//喜欢、不喜欢事件
|
||||
// if(!this.jieDuan){
|
||||
// let isAuth = this.$toolAll.tools.returnAuth()
|
||||
// if(!isAuth){
|
||||
this.isDetailLike = !this.isDetailLike
|
||||
if(this.isDetailLike){
|
||||
this.detailObj.likes++
|
||||
this.likeCon = this.detailObj.likes
|
||||
if(this.likeCon >= 1000) this.likeCon = '999+'
|
||||
}else{
|
||||
this.detailObj.likes--
|
||||
this.likeCon = '喜欢'
|
||||
}
|
||||
let isLikeCon = 'like'
|
||||
//调用点赞事件
|
||||
if(this.isDetailLike) collectionEV({action:isLikeCon,archive_id:this.detailObj.id})
|
||||
//调用取消点赞事件
|
||||
else cancleCollectionEV({action:isLikeCon,archive_id:this.detailObj.id})
|
||||
// } else this.jieDuan = true
|
||||
// }
|
||||
},
|
||||
tapConllection(){//收藏、取消收藏事件
|
||||
let isLikeCon = 'collect'
|
||||
// if(!this.jieDuan){
|
||||
// let isAuth = this.$toolAll.tools.returnAuth()
|
||||
// if(!isAuth){
|
||||
// 调用收藏事件
|
||||
if(!this.isDetailConllection) collectionEV({action:isLikeCon,archive_id:this.detailObj.id})
|
||||
// 调用取消收藏事件
|
||||
else cancleCollectionEV({action:isLikeCon,archive_id:this.detailObj.id})
|
||||
this.isDetailConllection = !this.isDetailConllection
|
||||
// } else this.jieDuan = true
|
||||
// }
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,256 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'搜索'" :statusTitle="true"></status-nav>
|
||||
<!-- 输入框 -->
|
||||
<view class="search-input-box bacf" :style="{paddingTop: statusHNH+'px'}">
|
||||
<view class="disac pad-zy30 mar-s20">
|
||||
<!-- 输入框 -->
|
||||
<input @confirm="searchEv" style="border: 2rpx solid #E0E0E0;padding: 0rpx 20rpx;height: 80rpx;line-height: 80rpx;" class="width100 fon34 radius10" type="text" v-model="searchVal" placeholder="请输入问题/病种/医生姓名"/>
|
||||
<!-- 搜索 -->
|
||||
<view @tap="searchEv" class="flexs mar-z30 radius10 pad-zy40 fon34 colf" style="height: 80rpx;line-height: 80rpx;" :style="{background:publicColor}">搜索</view>
|
||||
</view>
|
||||
<!-- 自定义二级分类 -->
|
||||
<view class=" pad-zy20 mar-s40" v-if="!isList">
|
||||
<cate-pu :newCurrent="newCurrent*1" :activeb="publicColor" :isCenter="false" :newbmo="'#E0E0E0'" @choosecateEv="chooseTwo" :newcateList="cateList"></cate-pu>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 历史搜索和热门搜索 -->
|
||||
<view class="pad-z30 mar-s30" v-if="isList">
|
||||
<cate-tu :list="reSearchList" @delev='delev'></cate-tu>
|
||||
</view>
|
||||
<view v-else class="pad-zy20 mar-s20">
|
||||
<!-- 列表 -->
|
||||
<view v-if="dataList.length!=0">
|
||||
<list-pu :radiu="true" @chooseLike="chooseLike" @comfirmev="comfirmevl" :list="dataList"></list-pu>
|
||||
</view>
|
||||
<view v-else class="disjcac fc" style="margin-top: 40%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">您搜索的内容暂无结果,换个关键词试试吧</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import cateTu from '@/components/cate-items/cate-tu.vue';
|
||||
import {collectionEV,cancleCollectionEV} from '@/jsFile/publicAPI.js';
|
||||
export default {
|
||||
components:{
|
||||
cateTu
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
searchVal:'',//输入框的值
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
reSearchList:[//历史记录列表
|
||||
{
|
||||
title:'历史搜索',
|
||||
src:'/static/public/del-icon.png',
|
||||
list:[]
|
||||
},
|
||||
{
|
||||
title:'热门搜索',
|
||||
src:'',
|
||||
list:[
|
||||
// {content:'秃顶种植需要的条件'},
|
||||
// {content:'眉毛种植的是什么'},
|
||||
// {content:'那些人能种植'},
|
||||
// {content:'眉毛种植需要多少钱'},
|
||||
// {content:'那些人能种植'},
|
||||
]
|
||||
},
|
||||
],
|
||||
isShowT:false,//是否显示弹框
|
||||
isList:true,//是否显示默认显示
|
||||
cateList:[//所以二级分类
|
||||
|
||||
],
|
||||
dataList:[//小课堂数据列表
|
||||
|
||||
],
|
||||
showTop:false,//是否显示返回顶部
|
||||
newCurrent:0,
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true,
|
||||
category_id:''//栏目ID
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.searchEv()//调用自主预约列表事件
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
uni.removeStorageSync('cateList')
|
||||
},
|
||||
onLoad(options) {
|
||||
if(options.keyWorld!=undefined && options.keyWorld!='') {
|
||||
this.searchVal = options.keyWorld
|
||||
this.searchEv()
|
||||
}
|
||||
this.checkSearchHistory()
|
||||
this.checkKey()
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
if(this.searchVal!=undefined && this.searchVal!='') this.searchEv()
|
||||
},
|
||||
methods: {
|
||||
checkKey(){//查询热搜关键词事件
|
||||
this.$requst.get('index/hot-keywords').then(res=>{
|
||||
// console.log('关键词列表:',res);
|
||||
if(res.code==0){
|
||||
if(res.data.length!=0){
|
||||
res.data.forEach(item=>{
|
||||
let reObj = {
|
||||
id:item.id,
|
||||
content:item.keyword
|
||||
}
|
||||
this.reSearchList[1].list.push(reObj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
chooseLike(e){//收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
if(this.dataList[e].is_collected==0){
|
||||
this.dataList[e].is_collected = 1
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
}
|
||||
},
|
||||
comfirmevl(e){//确认取消收藏事件
|
||||
this.dataList[e].is_collected = 0
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:this.dataList[e].id})
|
||||
},
|
||||
checkSearchHistory(){//查询历史搜索的搜索记录
|
||||
this.$requst.post('user/search-history',{page:this.page,size:this.size}).then(res=>{
|
||||
// console.log(res);
|
||||
if(res.code==0){
|
||||
if(res.data.list.length!=0){
|
||||
res.data.list.forEach(item=>{
|
||||
if(item.keyword!=null){
|
||||
let searchObj = {
|
||||
id:item.id,
|
||||
content:item.keyword
|
||||
}
|
||||
this.reSearchList[0].list.push(searchObj)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
searchEv(){//搜索事件
|
||||
// console.log('栏目ID:',this.category_id,'关键词:',this.searchVal);
|
||||
this.$toolAll.tools.showToast('搜索中...')
|
||||
this.$requst.post('archives/category',{page:this.page,size:this.size,category_id:this.category_id,keyword:this.searchVal}).then(res=>{
|
||||
// console.log('搜索提交:',res);
|
||||
if(res.code==0){
|
||||
uni.hideToast()
|
||||
if(uni.getStorageSync('cateList')==''){//首次渲染栏目
|
||||
if(res.data.category.length!=0){
|
||||
res.data.category.forEach((item,index)=>{
|
||||
let cateObj = {
|
||||
id:item.id,//栏目ID
|
||||
title:item.title,//栏目名称
|
||||
active:item.active,//是否选中
|
||||
model_id:item.model_id,//模型ID
|
||||
model_name:item.model_name,//模型标识
|
||||
sort:item.sort
|
||||
}
|
||||
this.cateList.push(cateObj)
|
||||
})
|
||||
uni.setStorageSync('cateList',this.cateList)
|
||||
}
|
||||
} else {
|
||||
//获取缓存中的栏目
|
||||
this.cateList = uni.getStorageSync('cateList')
|
||||
}
|
||||
// 获取列表
|
||||
if(this.page==1) this.dataList = []
|
||||
this.total = res.data.list.total
|
||||
if(res.data.list.list.length!=0){
|
||||
res.data.list.list.forEach(item=>{
|
||||
let tObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img:'/static/public/logo.png',//发布者头像
|
||||
name:'恒美植发',//发布者昵称
|
||||
isVideo:item.video.includes(".mp4")//是否是视频
|
||||
}
|
||||
if(this.newCurrent==0 && item.category_id==32) this.dataList.push(tObj)
|
||||
if(this.newCurrent==1 && item.category_id==33) this.dataList.push(tObj)
|
||||
if(this.newCurrent==2 && item.category_id==34) this.dataList.push(tObj)
|
||||
if(this.newCurrent==3 && item.category_id==38) this.dataList.push(tObj)
|
||||
})
|
||||
}
|
||||
let obj = {
|
||||
content:this.searchVal
|
||||
}
|
||||
this.reSearchList[0].list.push(obj)
|
||||
this.isList = false
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
delev(){//删除事件
|
||||
this.isShowT = true
|
||||
},
|
||||
comfirmev(){//清空历史搜索确认事件
|
||||
this.isShowT = false
|
||||
this.$requst.post('user/clear-search').then(res=>{
|
||||
if(res.code==0){
|
||||
this.$toolAll.tools.showToast('已清空')
|
||||
this.reSearchList[0].list = []//清空搜索历史
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
cancleev(){//取消事件
|
||||
this.isShowT = false
|
||||
},
|
||||
chooseTwo(index){//二级分类选择
|
||||
// console.log('二级分类:',index);
|
||||
this.isZanw = true
|
||||
this.page = 1
|
||||
this.newCurrent = index
|
||||
this.category_id = this.cateList[index].id
|
||||
this.searchEv()
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,114 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'分享中心'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy32">
|
||||
<view class="radius20 pad20 bacf mar-s20 col3">
|
||||
<view class="fon28 bold mar-x40 pad-z10">我的分享</view>
|
||||
<view class="disja">
|
||||
<view @tap="goPage(index)" class="disac fc flexs width33" v-for="(item,index) in dataList" :key="index">
|
||||
<view class="fon36 bold clips1">{{item.num}}</view>
|
||||
<view class="fon26 mar-s25">{{item.title}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 分享按钮 -->
|
||||
<view @tap="shareEv" class="disjcac radius20 posir" style="height: 90rpx;margin: 70rpx 80rpx;background-color: #38CE51;line-height: 90rpx;">
|
||||
<view class="disac">
|
||||
<image src="/static/public/sharef.png" style="width: 54rpx;height: 54rpx;" mode=""></image>
|
||||
<view class="fon40 bold colf mar-z10">分享给好友</view>
|
||||
</view>
|
||||
<!-- <button open-type="share" class="posia width100" style="opacity: 0;">分享给好友</button> -->
|
||||
<!-- <button @tap="shareEv" class="posia width100" style="opacity: 0;">分享给好友</button> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 弹框 -->
|
||||
<pu-po :isShowT="isShowT" :contentVal="'暂未开放此功能,请耐心等候'" :isCenter="true" :comfrimVal="'好的'" @comfirmev="isShowT=false"></pu-po>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
isShowT:false,
|
||||
imgSrc:'/static/public/shareh.png',
|
||||
dataList:[
|
||||
{num:'0',title:'积分'},
|
||||
{num:'0',title:'分享人'},
|
||||
{num:'0',title:'分享订单'},
|
||||
],
|
||||
imgSrcP:uni.getStorageSync('imgSrcP')
|
||||
}
|
||||
},
|
||||
onShareAppMessage(options) {
|
||||
var ya = this;
|
||||
var shareObj = {
|
||||
title: '恒美植发', // 默认是小程序的名称(可以写slogan等)
|
||||
path: '', // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
imageUrl: ya.imgSrc, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
success: function(res){
|
||||
// 转发成功之后的回调
|
||||
if(res.errMsg == 'shareAppMessage:ok'){
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
},
|
||||
fail: function(res){
|
||||
// 转发失败之后的回调
|
||||
if(res.errMsg == 'shareAppMessage:fail cancel'){
|
||||
// 用户取消转发
|
||||
}else if(res.errMsg == 'shareAppMessage:fail'){
|
||||
// 转发失败,其中 detail message 为详细失败信息
|
||||
}
|
||||
}
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
uni.getStorageSync('shareAll')!='' ? this.dataList[1].num = uni.getStorageSync('shareAll').share_users.total : this.dataList[1].num = 0
|
||||
},
|
||||
methods: {
|
||||
shareEv(){//分享事件
|
||||
if(this.imgSrcP==''){
|
||||
this.$toolAll.tools.showToast('请先前往个人海报申请海报')
|
||||
} else {
|
||||
wx.showShareImageMenu({
|
||||
path: this.imgSrcP
|
||||
})
|
||||
this.$requst.post('user/record',{type:'other',action:'share',id:''}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
}
|
||||
},
|
||||
goPage(index){
|
||||
let newUrl = ''
|
||||
if(index==1) newUrl = '/pagesB/mysharer/mysharer'
|
||||
uni.navigateTo({
|
||||
url:newUrl
|
||||
})
|
||||
},
|
||||
// shareEv(){
|
||||
// this.isShowT = true
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,719 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav v-if="invite_code==''" :titleVal="'商品详情'" :statusTitle="true"></status-nav>
|
||||
<!-- 列表 -->
|
||||
<view :style="{top: statusHNH+'px'}" class="posiszy" style="height: 50px;">
|
||||
<view class="bacf pad-zy32 pad-sx20">
|
||||
<cate-pu @choosecateEv="choosecateEv" :activeb="invite_code!=''?'#3875F6':publicColor" :newCurrent="cateCurrent*1" :newbmo="'#F2F2F2'" :isCenter="false" :newcateList="cateList"></cate-pu>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pad-x180" :style="{paddingTop: (statusHNH+50)+'px'}">
|
||||
<!-- 自定义轮播 -->
|
||||
<swiper-pu :browseP="true" :bannerList="bannerList" :newHeight="'250'" :newRadius="'0'" :newBottom="'5'"></swiper-pu>
|
||||
<view v-if="isLoading">
|
||||
<view v-show="cateCurrent==isNum">
|
||||
<view class="pad20 bacf mar-zy20 radius20 mar-s20">
|
||||
<!-- 标题 -->
|
||||
<view class="mar-x20 fon36 col3 bold clips3">
|
||||
<span class="radius15 colf fon20" style="padding: 6rpx 10rpx;" :style="{background:publicColor}">秃顶种植</span>
|
||||
<span class="radius15 colf fon20 mar-z10" style="padding: 6rpx 10rpx;background: #F85050;">团购</span>
|
||||
<span class="radius15 colf fon20 mar-z10" style="padding: 6rpx 10rpx;background: #F85050;">拼团活动</span>
|
||||
<span class="radius15 colf fon20 mar-z10" style="padding: 6rpx 10rpx;background: #F85050;">促销活动</span>
|
||||
<span style="line-height: 50rpx;">【99皮皮节】【种植发际线】1000单位FUE技术案例招募门美人尖/头顶加密/微针/纤维/脱发</span>
|
||||
</view>
|
||||
<view class="fon24" style="color: #7D7D7D;">无任何额外消费</view>
|
||||
<!-- 团购商品详情时显示 -->
|
||||
<view class="disjbac fon24 mar-s20" style="color: #7D7D7D;">
|
||||
<view>团购累计参与人员:300人</view>
|
||||
<view>还剩余:60人</view>
|
||||
</view>
|
||||
<view class="mar-s20" style="color: #F85050;font-size: 40rpx;font-weight: bold;"><span>团购价:</span>¥3888 <span style="color: #B3B3B3;font-size: 24rpx;text-decoration: line-through;font-weight: 400;margin-left: 20rpx;">¥4205</span></view>
|
||||
<view class="mar-s20" style="color: #F85050;font-size: 40rpx;font-weight: bold;"><span>拼团价:</span>¥3888 <span style="color: #B3B3B3;font-size: 24rpx;text-decoration: line-through;font-weight: 400;margin-left: 20rpx;">¥4205</span></view>
|
||||
<view class="disjbac" style="align-items: flex-end;margin-top: -20rpx;padding-bottom: 20rpx;">
|
||||
<view class="disac">
|
||||
<image class="flexs" src="/static/public/huiy.png" style="width: 42rpx;height: 30rpx;" mode="aspectFill"></image>
|
||||
<view class="fon24 col9">黄金会员可购买</view>
|
||||
</view>
|
||||
<view class="disac flexs">
|
||||
<view @tap="shareEv" class="disac fc mar-zy36 posir">
|
||||
<image src="/static/public/weix.png" style="width: 42rpx;height: 42rpx;" mode=""></image>
|
||||
<view class="fon24 col9">分享</view>
|
||||
<button class="posia" open-type="share" style="top: 0;right: 0;left: 0;bottom: 0;opacity: 0;">分享</button>
|
||||
<!-- <button v-if="haveImg" class="posia" open-type="share" style="top: 0;right: 0;left: 0;bottom: 0;opacity: 0;">分享</button> -->
|
||||
</view>
|
||||
<view class="disac fc" @tap="tapConllection">
|
||||
<image v-if="isDetailConllection" src="/static/public/yconllection.png" style="width: 44rpx;height: 44rpx;" mode=""></image>
|
||||
<image v-else src="/static/public/conllection.png" style="width: 44rpx;height: 44rpx;" mode=""></image>
|
||||
<view class="fon24 col9">收藏</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pad-x30 pad-s10" style="border-bottom: 2rpx solid #E6E6E6;">
|
||||
<view class="fon36 colf bold pbackc tc pad-sx20" style="border-radius: 45rpx;">倒计时:25小时35分26秒</view>
|
||||
</view>
|
||||
<!-- 规格 -->
|
||||
<view class="disjbac tc mar-s20">
|
||||
<view class="disjcac fon28 col3">规格:</view>
|
||||
<view>
|
||||
<view class="fon26 col3 mar-x20">上市时间</view>
|
||||
<view class="fon24" style="color: #B3B3B3;">2021.02.01</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="fon26 col3 mar-x20">有效期</view>
|
||||
<view class="fon24" style="color: #B3B3B3;">三个月</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="fon26 col3 mar-x20">可用时间</view>
|
||||
<view class="fon24" style="color: #B3B3B3;">正常使用</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="fon26 col3 mar-x20">术前须知</view>
|
||||
<view class="fon24" style="color: #B3B3B3;">无</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 销量,库存 -->
|
||||
<view class="pad20 bacf mar-zy20 radius20 mar-s20">
|
||||
<view class="fon28 disjbac">
|
||||
<view class="col3">销量:</view>
|
||||
<view style="color: #B3B3B3;">已售30件</view>
|
||||
</view>
|
||||
<view class="fon28 disjbac mar-s40">
|
||||
<view class="col3">库存:</view>
|
||||
<view style="color: #B3B3B3;">剩余3000件</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 拼团 -->
|
||||
<view class="pad20 bacf mar-zy20 radius20 mar-s20">
|
||||
<view class="fon28 col3">2人正在拼团,可以直接参与</view>
|
||||
<swiper :autoplay="true" :interval="3000" :duration="1000" circular="true" vertical="true" style="height: 176px;">
|
||||
<swiper-item>
|
||||
<view class="disjbac posir pad-sx20">
|
||||
<image src="/static/public/like.png" mode="aspectFill" class="flexs" style="width: 70rpx;height: 70rpx; border-radius: 100%;"></image>
|
||||
<view class="disjbac width100 mar-z20 pad-sx20">
|
||||
<view class="fon28 col3" style="width: 45%;">廖恒利</view>
|
||||
<view class="fon28 disjbac" style="color: #7D7D7D;width: 55%;">
|
||||
<view>
|
||||
<view>还差1人拼成</view>
|
||||
<view style="margin-top: 7rpx;">剩余19:47:28</view>
|
||||
</view>
|
||||
<view @tap="comeTuan" class="colf bold" style="width: 140rpx;height: 80rpx;line-height: 80rpx;text-align: center;background: #F85050;border-radius: 20rpx;">去拼单</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="border-bottom: 2rpx solid #E6E6E6;position: absolute;bottom: 0;width: 87%;right: 0;"></view>
|
||||
</view>
|
||||
<view class="disjbac posir pad-sx20">
|
||||
<image src="/static/public/like.png" mode="aspectFill" class="flexs" style="width: 70rpx;height: 70rpx; border-radius: 100%;"></image>
|
||||
<view class="disjbac width100 mar-z20 pad-sx20">
|
||||
<view class="fon28 col3" style="width: 45%;">廖恒利</view>
|
||||
<view class="fon28 disjbac" style="color: #7D7D7D;width: 55%;">
|
||||
<view>
|
||||
<view>还差1人拼成</view>
|
||||
<view style="margin-top: 7rpx;">剩余19:47:28</view>
|
||||
</view>
|
||||
<view @tap="comeTuan" class="colf bold" style="width: 140rpx;height: 80rpx;line-height: 80rpx;text-align: center;background: #F85050;border-radius: 20rpx;">去拼单</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view style="border-bottom: 2rpx solid #E6E6E6;position: absolute;bottom: 0;width: 87%;right: 0;"></view> -->
|
||||
</view>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<view class="disjbac posir pad-sx20">
|
||||
<image src="/static/public/like.png" mode="aspectFill" class="flexs" style="width: 70rpx;height: 70rpx; border-radius: 100%;"></image>
|
||||
<view class="disjbac width100 mar-z20 pad-sx20">
|
||||
<view class="fon28 col3" style="width: 45%;">廖恒利</view>
|
||||
<view class="fon28 disjbac" style="color: #7D7D7D;width: 55%;">
|
||||
<view>
|
||||
<view>还差1人拼成</view>
|
||||
<view style="margin-top: 7rpx;">剩余19:47:28</view>
|
||||
</view>
|
||||
<view @tap="comeTuan" class="colf bold" style="width: 140rpx;height: 80rpx;line-height: 80rpx;text-align: center;background: #F85050;border-radius: 20rpx;">去拼单</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- 详情 -->
|
||||
<view class="pad20 bacf mar-zy20 radius20 mar-s20">
|
||||
<view class="fon28 col3 bold">产品详情</view>
|
||||
<view class="fon28 mar-s20" style="color: #1A1A1A; line-height: 40rpx;">
|
||||
<rich-text :nodes="detailInfo"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 医生 -->
|
||||
<view class="pad20 bacf mar-zy20 radius20 mar-s20">
|
||||
<view class="fon28 col3 bold">医生</view>
|
||||
<view class="disjbac posir pad-sx20">
|
||||
<image src="/static/public/like.png" mode="aspectFill" class="flexs" style="width: 70rpx;height: 70rpx; border-radius: 100%;"></image>
|
||||
<view class="disjbac width100 mar-z20 pad-sx20">
|
||||
<view class="fon28 col3" style="width: 50%;">廖恒利医生</view>
|
||||
<view class="fon24" style="color: #7D7D7D;width: 50%;">擅长:毛发种植</view>
|
||||
</view>
|
||||
<view style="border-bottom: 2rpx solid #E6E6E6;position: absolute;bottom: 0;width: 87%;right: 0;"></view>
|
||||
</view>
|
||||
<view class="disjbac pad-sx20">
|
||||
<image src="/static/public/like.png" mode="aspectFill" class="flexs" style="width: 70rpx;height: 70rpx; border-radius: 100%;"></image>
|
||||
<view class="disjbac width100 mar-z20 pad-sx20">
|
||||
<view class="fon28 col3" style="width: 50%;">廖恒利医生</view>
|
||||
<view class="fon24" style="color: #7D7D7D;width: 50%;">擅长:毛发种植</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 产品推荐 -->
|
||||
<view class="fon30 bold mar-s40 mar-x10 pad-zy50" style="color: #3875F6;">产品推荐</view>
|
||||
<shopList></shopList>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部导航 -->
|
||||
<view class="posixzy disjbac bacf pad-zy32 btnBKS">
|
||||
<view class="posir">
|
||||
<image @tap="backHome" class="posia backH" src="/static/public/back-home.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="disac fon26 colf">
|
||||
<view @tap="showTK=true" class="disjcac lianShare" style="background-color: #3875F6; border-top-left-radius: 51rpx;border-bottom-left-radius: 51rpx;">加入购物车</view>
|
||||
<view @tap="showTK=true" class="disjcac lianShare" style="background-color: #F85050;border-top-right-radius: 51rpx;border-bottom-right-radius: 51rpx;">立即购买</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 购物车 -->
|
||||
<navigator url="/pagesA/shopCart/shopCart" hover-class="none">
|
||||
<view style="position: fixed;right: 30rpx;bottom: 300rpx;">
|
||||
<view class="posir" style="width: 112rpx;height: 112rpx;">
|
||||
<image src="/static/public/cart.png" mode="aspectFill" style="width: 112rpx;height: 112rpx;"></image>
|
||||
<view class="posia" style="background: #F85050;width: 28rpx;height: 28rpx;border-radius: 100%;color: #FFFFFF;font-size: 24rpx;text-align: center;line-height: 28rpx;top: 20rpx;right: 20rpx;"><view style="transform: scale(.8);">99</view></view>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
<!-- 客服 -->
|
||||
<view style="position: fixed;right: 16rpx;bottom: 140rpx;">
|
||||
<view class="posir" style="width: 142rpx;height: 142rpx;">
|
||||
<image src="/static/public/kf-logo.png" mode="aspectFill" style="width: 142rpx;height: 142rpx;"></image>
|
||||
<button open-type="share" class="posia syxzo"></button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 立即购买,加入购物车弹框 -->
|
||||
<view v-if="showTK" class="posAll" @tap="showTK=false">
|
||||
<view class="bacf posixzy" @tap.stop="showTK=true" style="border-radius: 40rpx 40rpx 0rpx 0rpx;">
|
||||
<view class="disjb pad-zy50">
|
||||
<image src="/static/public/like.png" mode="aspectFill" style="width: 214rpx;height: 214rpx;border-radius: 15rpx;bottom: 0;flex-shrink: 0;margin-top: -107rpx;margin-right: 30rpx;"></image>
|
||||
<view class="disjb width100">
|
||||
<view>
|
||||
<view class="fon40 mar-sx10" style="color: #F85050;">¥3888</view>
|
||||
<view><span style="color: #B3B3B3;font-size: 24rpx;text-decoration: line-through;font-weight: 400;">¥4205</span></view>
|
||||
</view>
|
||||
<image @tap.stop="showTK=false" src="../../static/public/cha-close.png" style="width: 24px;height: 24px;margin-top: 20rpx;" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 标题 -->
|
||||
<view class="fon36 col3 bold clips3 pad-zy30 mar-s20">
|
||||
<span class="radius10 colf fon20" style="padding: 6rpx 10rpx;" :style="{background:publicColor}">秃顶种植</span>
|
||||
<span class="radius10 colf fon20 mar-z10" style="padding: 6rpx 10rpx;background: #F85050;">团购</span>
|
||||
<span class="radius10 colf fon20 mar-z10" style="padding: 6rpx 10rpx;background: #F85050;">拼团活动</span>
|
||||
<span class="radius10 colf fon20 mar-z10" style="padding: 6rpx 10rpx;background: #F85050;">促销活动</span>
|
||||
<span style="line-height: 50rpx;">【99皮皮节】【种植发际线】1000单位FUE技术案例招募门美人尖/头顶加密/微针/纤维/脱发</span>
|
||||
</view>
|
||||
<view class="disjbac mar-sx40 pad-zy30 col3">
|
||||
<view class="fon28">类型:</view>
|
||||
<view class="fon26 disac">
|
||||
<view @tap="chooselei(indexl)" v-for="(item,indexl) in leiList" :key="indexl" :class="leiIndex==indexl?'activelei':'molei'" :style="{background:leiIndex==indexl?publicColor:'#F2F2F2'}">{{item}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="disjbac mar-sx40 pad-zy30 fon28">
|
||||
<view class="col3">库存:</view>
|
||||
<view class="fon26 col3" style="color: #5B5B5B;">1000件</view>
|
||||
</view>
|
||||
<view class="disjbac mar-sx40 pad-zy30 fon28">
|
||||
<view class="col3">购买数量:</view>
|
||||
<view class="fon26 col3 disac bold">
|
||||
<image src="../../static/public/del.png" mode="" style="width: 65rpx;height: 30px;"></image>
|
||||
<input type="text" value="1" style="width: 100rpx;height: 28px;text-align: center;border-top: 2rpx solid #3875F6;border-bottom: 2rpx solid #3875F6;"/>
|
||||
<image src="../../static/public/add.png" mode="" style="width: 65rpx;height: 30px;"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 加入购物车,立即购买 -->
|
||||
<view class="disjbac pad-zy30 colf fon28 mar-x20">
|
||||
<view style="width: 294rpx;height: 70rpx;line-height: 70rpx;text-align: center;border-radius: 10rpx; background: #3875F6;">加入购物车</view>
|
||||
<view style="width: 294rpx;height: 70rpx;line-height: 70rpx;text-align: center;border-radius: 10rpx; background: #F85050;">立即购买</view>
|
||||
</view>
|
||||
<!-- 单独购买,立即拼团 -->
|
||||
<view class="disjbac pad-zy30 colf fon28 mar-x20">
|
||||
<view style="width: 294rpx;height: 70rpx;line-height: 70rpx;text-align: center;border-radius: 10rpx; background: #C8C8C8;">单独购买</view>
|
||||
<view style="width: 294rpx;height: 70rpx;line-height: 70rpx;text-align: center;border-radius: 10rpx; background: #F85050;">立即拼团</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 去拼单弹框 -->
|
||||
<view v-if="showPD" @tap.stop="showPD=false" style="position: fixed;top: 0;left: 0;right: 0;bottom: 0;z-index: 6;background: rgba(0,0,0,.54);display: flex;justify-content: center;align-items: center;">
|
||||
<view class="bacf radius20 width100 posir" @tap.stop="showPD=true" style="font-weight: 500;text-align: center;margin: 0 85rpx;height: 458rpx;">
|
||||
<view class="fon28 col3" style="margin: 34rpx 0 27rpx 0;">参与廖恒利的拼单</view>
|
||||
<view class="fon24 col3" style="margin-bottom: 63rpx;">仅剩1个名额,19:05:28后结束</view>
|
||||
<view class="disjcac" style="margin-bottom: 77rpx;">
|
||||
<image src="/static/public/like.png" mode="" style="width: 100rpx;height: 100rpx;border-radius: 100%;"></image>
|
||||
<image src="/static/public/pin-jie.png" mode="" style="width: 42rpx;height: 42rpx;margin: 0 47rpx;"></image>
|
||||
<image src="/static/public/weiz.png" mode="" style="width: 100rpx;height: 100rpx;border-radius: 100%;"></image>
|
||||
</view>
|
||||
<view style="width: 464rpx;height: 60rpx;line-height: 60rpx;color: #FFFFFF;background: #F85050;border-radius: 10rpx;margin: 0 auto;font-size: 28rpx;">参与拼单</view>
|
||||
<image @tap.stop="showPD=false" src="../../static/public/pin-close.png" class="posia" style="width: 77rpx;height: 77rpx;right: -30rpx;top: -30rpx;" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
|
||||
<!-- 弹框授权 -->
|
||||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2" @cancleEv="cancleEv"></empower>
|
||||
<!-- 弹框 -->
|
||||
<view v-if="isShowP" @touchmove.stop.prevent="moveHandle" class="disjcac posAll">
|
||||
<view class="bacf radius20 width100 tank-box">
|
||||
<view class="tc tank-box-itemone">请授权绑定手机号</view>
|
||||
<view class="fon28 colf pad-x30 pad-zy30 tc disjb">
|
||||
<view @tap="isShowP=false" class="pad-sx10 radius10 tank-btn" style="background-color: rgba(230, 230, 230,1);color: #000000;">暂不绑定</view>
|
||||
<view class="pad-sx10 radius10 tank-btn posir pbackc">
|
||||
立即绑定
|
||||
<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="posia syxzo">立即绑定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import listDoctor from '@/components/list-doctor.vue';
|
||||
import swiperPu from '@/components/swiper-pu.vue';
|
||||
import {collectionEV,cancleCollectionEV} from '@/jsFile/publicAPI.js';
|
||||
import empower from '@/components/empower.vue';
|
||||
import shopList from '@/components/shop-list.vue';
|
||||
export default {
|
||||
components:{
|
||||
listDoctor,
|
||||
swiperPu,
|
||||
empower,
|
||||
shopList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight:uni.getSystemInfoSync().statusBarHeight,
|
||||
isLoading:true,
|
||||
vision:false,
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor') || '#3875F6',//主题颜色
|
||||
cateCurrent:0,
|
||||
haveImg:true,
|
||||
cateList:[
|
||||
{
|
||||
id:1,
|
||||
title:'商品详情',
|
||||
pid:11,
|
||||
sort:4
|
||||
},{
|
||||
id:2,
|
||||
title:'问题',
|
||||
pid:22,
|
||||
sort:4
|
||||
},{
|
||||
id:3,
|
||||
title:'案例日记',
|
||||
pid:33,
|
||||
sort:4
|
||||
},{
|
||||
id:4,
|
||||
title:'效果模拟',
|
||||
pid:33,
|
||||
sort:4
|
||||
},{
|
||||
id:5,
|
||||
title:'科普视频',
|
||||
pid:33,
|
||||
sort:4
|
||||
}],
|
||||
bannerList:[
|
||||
{imgSrc:'/static/public/banner.png',url:'',isVideo:true,poster:''},
|
||||
{imgSrc:'/static/public/banner.png',url:'',isVideo:false,poster:''}
|
||||
],//轮播
|
||||
xgList:[//相关推荐
|
||||
],
|
||||
dataList:[//推荐医生
|
||||
],
|
||||
showTop:false,
|
||||
isDetailConllection:false,//是否已收藏
|
||||
isNum:0,
|
||||
listArrone:[],//问题
|
||||
listArrtwo:[//案例日记
|
||||
],
|
||||
listArrthree:[//效果模拟
|
||||
],
|
||||
listArrfour:[//科普视频
|
||||
],
|
||||
detailObj:{},//详情
|
||||
detailInfo:'',//富文本
|
||||
category_id:'',//栏目ID
|
||||
active:'',//是否是详情页
|
||||
// jieDuan:false,
|
||||
share_id:0,
|
||||
invite_code:'',
|
||||
isShowP:false,
|
||||
showTK:false,
|
||||
leiIndex:0,
|
||||
leiList:['体验装','正式装'],
|
||||
showPD:false
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
// for (let i = 0; i < 4; i++) {
|
||||
// if(this.cateCurrent==0) {
|
||||
// let obj = {status:false,main_img:'',title:'恒美小课堂',content:'饺子会吃肉?',head_img:'/static/public/like.png',name:'吃肉的饺子',isCate:0}
|
||||
// this.listArrone.push(obj)
|
||||
// }
|
||||
// if(this.cateCurrent==1) {
|
||||
// let obj = {status:false,main_img:'',title:'恒美小课堂',content:'饺子会吃肉?',head_img:'/static/public/like.png',name:'吃肉的饺子',isCate:1}
|
||||
// this.listArrtwo.push(obj)
|
||||
// }
|
||||
// if(this.cateCurrent==2) {
|
||||
// let obj = {status:false,main_img:'',title:'恒美小课堂',content:'饺子会吃肉?',head_img:'/static/public/like.png',name:'吃肉的饺子',isCate:2}
|
||||
// this.listArrthree.push(obj)
|
||||
// }
|
||||
// if(this.cateCurrent==3) {
|
||||
// let obj = {status:false,main_img:'',title:'恒美小课堂',content:'饺子会吃肉?',head_img:'/static/public/like.png',name:'吃肉的饺子',isCate:3}
|
||||
// this.listArrfour.push(obj)
|
||||
// }
|
||||
// }
|
||||
},
|
||||
onShareTimeline() {},
|
||||
onShareAppMessage(res) {
|
||||
var ya = this;
|
||||
this.$requst.post('user/record',{type:'content',action:'share',id:this.detailObj.id}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
c:this.detailObj.id*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
var shareObj = {
|
||||
title: `${ya.detailObj.title}`, // 默认是小程序的名称(可以写slogan等)
|
||||
path: `/pagesB/problemDetail/problemDetail?id=${this.detailObj.id}&category_id=${this.category_id}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
||||
imageUrl: ya.$http + ya.detailObj.share_img//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||||
};
|
||||
return shareObj;
|
||||
},
|
||||
onShow() {
|
||||
},
|
||||
onLoad(options) {
|
||||
if(options.category_id!=undefined) {
|
||||
this.category_id = options.category_id
|
||||
this.conid = options.id
|
||||
this.invite_code = options.invite_code
|
||||
uni.setStorageSync('ninvite_code',this.invite_code)
|
||||
if(this.invite_code!='' && this.invite_code!=undefined){
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res)=> {
|
||||
if (res.code) {
|
||||
var params = {
|
||||
code:res.code,
|
||||
invite_code:this.invite_code,//用户邀请码
|
||||
}
|
||||
this.$requst.post('user/login',params).then(res => {
|
||||
if(res.data.token!=''){
|
||||
if(res.data.is_active==0) {
|
||||
this.haveImg = false
|
||||
this.vision = true
|
||||
}
|
||||
}
|
||||
},error => {})
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.$toolAll.tools.overdue()
|
||||
this.$toolAll.tools.isLogin()
|
||||
}
|
||||
}
|
||||
// this.checkDetail(this.conid)
|
||||
if(options.share_id!=undefined) this.share_id = options.share_id
|
||||
let maiOjb = {
|
||||
e:4,//内容分享
|
||||
c:this.conid*1,
|
||||
t:new Date().getTime()//当前时间戳
|
||||
}
|
||||
this.$toolAll.tools.maiDian(maiOjb)
|
||||
},
|
||||
methods: {
|
||||
comeTuan(){//去拼单
|
||||
this.showPD = true;
|
||||
},
|
||||
chooselei(index){//类型选择
|
||||
this.leiIndex = index
|
||||
},
|
||||
moveHandle(){//禁止底层滑动
|
||||
return false
|
||||
},
|
||||
getphonenumber(e){//授权绑定手机号
|
||||
if(e.detail.errMsg=="getPhoneNumber:ok"){
|
||||
this.$requst.post('user/bind-phone',{iv:e.detail.iv,encryptedData:e.detail.encryptedData}).then(res=>{
|
||||
// console.log('手机号信息:',res);
|
||||
if(res.code==0){
|
||||
this.isShowP = false
|
||||
this.$toolAll.tools.showToast('手机号绑定成功','success')
|
||||
}
|
||||
},error=>{})
|
||||
} else {
|
||||
this.isShowP = false
|
||||
}
|
||||
},
|
||||
chooseLike(e){//收藏事件
|
||||
// console.log(this.dataList[e].is_collected);
|
||||
let cateId = ''
|
||||
let newArr = []
|
||||
if(this.cateCurrent==0) {
|
||||
newArr = this.listArrone
|
||||
cateId = newArr[e].id
|
||||
}
|
||||
if(this.cateCurrent==1) {
|
||||
newArr = this.listArrtwo
|
||||
cateId = newArr[e].id
|
||||
}
|
||||
if(this.cateCurrent==2) {
|
||||
newArr = this.listArrthree
|
||||
cateId = newArr[e].id
|
||||
}
|
||||
if(this.cateCurrent==3) {
|
||||
newArr = this.listArrfour
|
||||
cateId = newArr[e].id
|
||||
}
|
||||
if(newArr[e].is_collected==0){
|
||||
newArr[e].is_collected = 1
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'collect',archive_id:cateId})
|
||||
}
|
||||
},
|
||||
comfirmev(e){//确认取消收藏事件
|
||||
let cateId = ''
|
||||
if(this.cateCurrent==0) {
|
||||
this.listArrone[e].is_collected = 0
|
||||
cateId = this.listArrone[e].id
|
||||
}
|
||||
if(this.cateCurrent==1) {
|
||||
this.listArrtwo[e].is_collected = 0
|
||||
cateId = this.listArrtwo[e].id
|
||||
}
|
||||
if(this.cateCurrent==2) {
|
||||
this.listArrthree[e].is_collected = 0
|
||||
cateId = this.listArrthree[e].id
|
||||
}
|
||||
if(this.cateCurrent==3) {
|
||||
this.listArrfour[e].is_collected = 0
|
||||
cateId = this.listArrfour[e].id
|
||||
}
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:cateId})
|
||||
},
|
||||
chooseLikex(e){//收藏事件
|
||||
if(this.xgList[e].is_collected==0){
|
||||
this.xgList[e].is_collected = 1
|
||||
// 调用收藏事件
|
||||
collectionEV({action:'collect',archive_id:this.xgList[e].id})
|
||||
}
|
||||
},
|
||||
comfirmevx(e){//确认取消收藏事件
|
||||
this.xgList[e].is_collected = 0
|
||||
this.$toolAll.tools.showToast('正在取消...','loading')
|
||||
// 调用取消收藏事件
|
||||
cancleCollectionEV({action:'collect',archive_id:this.xgList[e].id})
|
||||
},
|
||||
buttonH(e){//授权成功
|
||||
this.haveImg = e
|
||||
if(e) {
|
||||
this.vision = false
|
||||
this.isShowP = true
|
||||
}
|
||||
},
|
||||
cancleEv(e){//取消授权
|
||||
if(e==0) this.vision = false
|
||||
},
|
||||
backHome(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/tabbar/pagehome/pagehome'
|
||||
})
|
||||
},
|
||||
shareEv(){
|
||||
if(this.haveImg == false) {
|
||||
this.vision = true
|
||||
}
|
||||
},
|
||||
// checkDetail(newId){
|
||||
// this.$requst.post('archives/detail',{id:newId,share_id:this.share_id}).then(res=>{
|
||||
// // console.log('详情数据:',res);
|
||||
// if(res.code==0){
|
||||
// this.isLoading=true
|
||||
// // 栏目类别
|
||||
// if(res.data.category.length!=0){
|
||||
// res.data.category.forEach((item,index)=>{
|
||||
// let cateObj = {
|
||||
// id:item.id,//栏目ID
|
||||
// title:item.title,//栏目名称
|
||||
// active:item.active,//是否选中
|
||||
// model_id:item.model_id,//模型ID
|
||||
// model_name:item.model_name,//模型标识
|
||||
// sort:item.sort
|
||||
// }
|
||||
// this.cateList.push(cateObj)
|
||||
// // 默认选中的栏目
|
||||
// if(item.active==1) this.active = this.cateCurrent = index
|
||||
// // 默认展示栏目详情
|
||||
// if(this.category_id==item.id) this.isNum = index
|
||||
// })
|
||||
// }
|
||||
// if(this.invite_code!='' && this.invite_code!=undefined){
|
||||
// const query = wx.createSelectorQuery()
|
||||
// query.select('.statusHNH').boundingClientRect((rect) => {
|
||||
// // console.log('状态栏+标题栏:',rect);
|
||||
// this.statusHNH = rect.height
|
||||
// // console.log(this.statusHNH );
|
||||
// }).exec()
|
||||
// }
|
||||
// // 详情
|
||||
// this.detailObj = res.data.detail
|
||||
// let maiOjb = {
|
||||
// e:1,//内容访问
|
||||
// c:this.detailObj.id*1,
|
||||
// t:new Date().getTime()//当前时间戳
|
||||
// }
|
||||
// this.$toolAll.tools.maiDian(maiOjb)
|
||||
// // 轮播
|
||||
// // 图片字符串转数组
|
||||
// let arrImg = this.detailObj.images.split(',')
|
||||
// arrImg.forEach(item=>{
|
||||
// let newImgObj = {
|
||||
// imgSrc:this.$http + item,
|
||||
// url:'',
|
||||
// isVideo:false,
|
||||
// poster:'',
|
||||
// }
|
||||
// // 存图片
|
||||
// this.bannerList.push(newImgObj)
|
||||
// })
|
||||
// // 存视频
|
||||
// if(this.detailObj.video!=''){
|
||||
// this.bannerList[0] = {
|
||||
// imgSrc:this.$http + arrImg[0],
|
||||
// url:this.$http + this.detailObj.video,
|
||||
// isVideo:true,
|
||||
// poster:'',
|
||||
// }
|
||||
// }
|
||||
// // 默认显示是否收藏
|
||||
// if(this.detailObj.is_collected==0) this.isDetailConllection = false
|
||||
// if(this.detailObj.is_collected==1) this.isDetailConllection = true
|
||||
// // 富文本
|
||||
// this.detailInfo = this.$toolAll.tools.escape2Html(this.detailObj.content)
|
||||
// // 相关推荐xgList
|
||||
// if(res.data.diary.length!=0){
|
||||
// res.data.diary.forEach(item=>{
|
||||
// let tObj = {
|
||||
// category_id:item.category_id,//栏目ID
|
||||
// id:item.id,
|
||||
// is_collected:item.is_collected,//是否已收藏
|
||||
// collects:item.collects,//收藏量
|
||||
// views:item.views,//查看量
|
||||
// main_img:this.$http + item.cover,//封面图
|
||||
// video:this.$http + item.video,//视频地址
|
||||
// title:item.title,//标题
|
||||
// content:item.subtitle,//副标题
|
||||
// head_img:'/static/public/logo.png',//发布者头像
|
||||
// name:'恒美植发',//发布者昵称
|
||||
// isVideo:item.video.includes(".mp4")//是否是视频
|
||||
// }
|
||||
// if(item.cover!='' && item.video==''){
|
||||
// this.xgList.push(tObj)
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// // 推荐医生
|
||||
// if(res.data.doctor.length!=0){
|
||||
// res.data.doctor.forEach(item=>{
|
||||
// let doObj = {
|
||||
// id:item.id,
|
||||
// imgSrc: item.headimg!=null ? item.headimg : '',
|
||||
// name:item.name,
|
||||
// cyear:parseFloat(item.work_time),
|
||||
// bmen:item.dept_name,
|
||||
// zcheng:'主任医师',
|
||||
// goodAt:item.diseases,
|
||||
// show_detail:item.show_detail
|
||||
// }
|
||||
// this.dataList.push(doObj)
|
||||
// })
|
||||
// }
|
||||
// this.choosecateEv(this.cateCurrent)
|
||||
// }
|
||||
// },error=>{})
|
||||
// },
|
||||
choosecateEv(e){
|
||||
this.cateCurrent = e
|
||||
this.$requst.post('archives/category',{category_id:this.cateList[e].id,keyword:''}).then(res=>{
|
||||
// console.log('该分类下的列表:',res);
|
||||
if(res.code==0){
|
||||
if(e==0 && this.active!=e) this.listArrone = []
|
||||
if(e==1 && this.active!=e) this.listArrtwo = []
|
||||
if(e==2 && this.active!=e) this.listArrthree = []
|
||||
if(e==3 && this.active!=e) this.listArrfour = []
|
||||
if(res.data.list.list.length!=0){
|
||||
res.data.list.list.forEach(item=>{
|
||||
let num = item.video.search(".mp4")
|
||||
let isVideo = false
|
||||
if(num!='-1') isVideo = true
|
||||
let arrObj = {
|
||||
category_id:item.category_id,//栏目ID
|
||||
id:item.id,
|
||||
is_collected:item.is_collected,//是否已收藏
|
||||
collects:item.collects,//收藏量
|
||||
views:item.views,//查看量
|
||||
main_img:this.$http + item.cover,//封面图
|
||||
video:this.$http + item.video,//视频地址
|
||||
title:item.title,//标题
|
||||
content:item.subtitle,//副标题
|
||||
head_img:'/static/public/logo.png',//发布者头像
|
||||
name:'恒美植发',//发布者昵称
|
||||
isVideo:isVideo//是否是视频
|
||||
}
|
||||
if(item.cover!=''){
|
||||
if(e==0 && this.active!=e) this.listArrone.push(arrObj)
|
||||
if(e==1 && this.active!=e) this.listArrtwo.push(arrObj)
|
||||
if(e==2 && this.active!=e) this.listArrthree.push(arrObj)
|
||||
if(e==3 && this.active!=e) this.listArrfour.push(arrObj)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
tapConllection(){//收藏、取消收藏事件
|
||||
let isLikeCon = 'collect'
|
||||
// if(!this.jieDuan){
|
||||
// let isAuth = this.$toolAll.tools.returnAuth()
|
||||
// if(!isAuth){
|
||||
// 调用收藏事件
|
||||
if(!this.isDetailConllection) collectionEV({action:isLikeCon,archive_id:this.detailObj.id})
|
||||
// 调用取消收藏事件
|
||||
else cancleCollectionEV({action:isLikeCon,archive_id:this.detailObj.id})
|
||||
this.isDetailConllection = !this.isDetailConllection
|
||||
// } else this.jieDuan = true
|
||||
// }
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,129 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 状态栏 -->
|
||||
<status-nav :titleVal="'用户足迹'" :statusTitle="true"></status-nav>
|
||||
<!-- 自定义二级分类 -->
|
||||
<!-- 列表 -->
|
||||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30">
|
||||
<view class="radius20 fon28 col3 mar-sx20">
|
||||
<view class="disac">
|
||||
<view class="disjbac width100 radius10 pad-zy20 xialak bacf">
|
||||
<input class="fon28 width100" type="text" v-model="keyword" placeholder="请输入姓名/电话查找" placeholder-style="color: #B3B3B3;" />
|
||||
</view>
|
||||
<view @tap="searchEv" class="flexs tc mar-z30 colf radius10 customer-btn" :style="{background:publicColor}">搜索</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 列表 -->
|
||||
<view @tap="chooseId(item.id)" class="bacf radius10 pad20 mar-x20 fon28" v-for="(item,index) in dataList" :key="index">
|
||||
<view style="color: #B3B3B3;">{{item.time}}</view>
|
||||
<view class="mar-s20">
|
||||
<text class="bold col3">{{item.name}}</text>
|
||||
<text style="color: #B3B3B3;">{{item.action}}</text>
|
||||
<text class="bold col3" v-if="item.title!=null && item.title!=''">【{{item.title}}】</text>
|
||||
<text style="color: #B3B3B3;" v-if="item.zwhat!=null && item.zwhat!=''">{{item.zwhat}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="dataList.length==0" class="disjcac fc" style="margin-top: 50%;">
|
||||
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
|
||||
<view class="fon24 col3">您搜索的内容暂无结果,换个关键词试试吧</view>
|
||||
</view>
|
||||
<!-- 返回顶部 -->
|
||||
<back-top :showTop="showTop" @backTop="backTop"></back-top>
|
||||
</view>
|
||||
<!-- 底部客服 -->
|
||||
<public-customer :nbottom="100"></public-customer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||||
dataList:[],//数据列表
|
||||
showTop:false,//是否显示返回顶部的箭头
|
||||
customer_id:'',//客户ID
|
||||
keyword:'',//关键词
|
||||
page:1,
|
||||
size:10,
|
||||
total:'',//总数
|
||||
isZanw:true
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
|
||||
},
|
||||
onReachBottom() {//触底事件
|
||||
if(this.total!=this.dataList.length){
|
||||
this.page++
|
||||
this.checkList()
|
||||
} else {
|
||||
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多足迹内容')
|
||||
this.isZanw = false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.$toolAll.tools.isLogin()
|
||||
},
|
||||
onLoad() {
|
||||
this.checkList()
|
||||
},
|
||||
methods: {
|
||||
chooseId(id){
|
||||
this.backTop()
|
||||
this.page = 1
|
||||
this.isZanw = true
|
||||
this.customer_id = id
|
||||
this.keyword = ''
|
||||
this.checkList()
|
||||
},
|
||||
searchEv(){//搜索事件
|
||||
if(this.keyword!='') this.customer_id = ''
|
||||
this.page = 1
|
||||
this.isZanw = true
|
||||
this.checkList()
|
||||
},
|
||||
checkList(){//查询列表事件
|
||||
let params = {
|
||||
page:this.page,
|
||||
size:this.size,
|
||||
customer_id:this.customer_id,//客户ID
|
||||
keyword:this.keyword
|
||||
}
|
||||
this.$requst.post('user/footmarks',params).then(res=>{
|
||||
// console.log('足迹列表查询:',res);
|
||||
if(res.code==0){
|
||||
if(this.page==1) this.dataList = []
|
||||
this.total = res.data.total
|
||||
if(res.data.list.length!=0){
|
||||
res.data.list.forEach(item=>{
|
||||
let newCate = ''
|
||||
if(item.content_id > 0) newCate = item.category
|
||||
else newCate = ''
|
||||
let obj = {
|
||||
id:item.account_id,
|
||||
name:item.nickname,
|
||||
action:item.action,
|
||||
title:item.title,
|
||||
time:item.created_at,
|
||||
zwhat:newCate,
|
||||
}
|
||||
this.dataList.push(obj)
|
||||
})
|
||||
}
|
||||
}
|
||||
},error=>{})
|
||||
},
|
||||
backTop(){//回到顶部事件
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 300
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,64 @@
|
|||
<template>
|
||||
<div class="">
|
||||
<image class="" @tap="backEv" :style="{top:statusHNH/2+'px'}" src="/static/public/videoBack.png" style="width: 33rpx;height: 33rpx;position: fixed;z-index: 10;left: 20rpx;" mode="aspectFill"></image>
|
||||
<video id="myVideo" style="width: 100%;" :style="{height:newHeight+'px'}"
|
||||
:src="videoSrc" :enable-play-gesture="dans" :poster="posterSrc"
|
||||
:controls="isControls" :show-center-play-btn="isCenterImg" :show-play-btn="isBottomImg" :show-fullscreen-btn="isFull"
|
||||
@play="comePlay" @pause="comePause"></video>
|
||||
<!-- 封面图 -->
|
||||
<image v-if="isPlayImg" @tap="playEv" src="/static/public/video.png" style="position: fixed;top: 50%;left: 50%;
|
||||
width: 126rpx;height: 126rpx;transform: translate(-50%, -50%);" mode="aspectFill"></image>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
statusHNH:uni.getStorageSync('statusHNH'),
|
||||
newHeight:uni.getSystemInfoSync().windowHeight,
|
||||
videoSrc:'',
|
||||
isPlayImg:true,
|
||||
autoplay:true,
|
||||
videoContext:'',
|
||||
title:'',//视频的标题,全屏时在顶部展示
|
||||
posterSrc:'',//视频封面的图片网络资源地址,如果 controls 属性值为 false 则设置 poster 无效
|
||||
isControls: false,//是否显示默认播放控件(播放/暂停按钮、播放进度、时间)
|
||||
dans:false,//是否开启播放手势,即双击切换播放/暂停
|
||||
isCenterImg:false,//是否显示视频中间的播放按钮
|
||||
isBottomImg:true,//是否显示视频底部控制栏的播放按钮
|
||||
isFull:true//是否显示全屏按钮
|
||||
}
|
||||
},
|
||||
onReady: function (res) {
|
||||
this.videoContext = uni.createVideoContext('myVideo', this)
|
||||
},
|
||||
onLoad(options) {
|
||||
this.videoSrc = options.src
|
||||
this.posterSrc = options.posterSrc
|
||||
},
|
||||
methods:{
|
||||
backEv(){
|
||||
uni.navigateBack({
|
||||
delta:1
|
||||
})
|
||||
},
|
||||
playEv(){
|
||||
this.isPlayImg = false
|
||||
this.autoplay = false
|
||||
this.videoContext.play()
|
||||
},
|
||||
comePlay(){//当开始/继续播放时触发play事件
|
||||
this.isControls = true
|
||||
},
|
||||
comePause(){
|
||||
this.isPlayImg = true
|
||||
this.isControls = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 383 B |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 783 B |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 976 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 297 B |
After Width: | Height: | Size: 998 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 1.6 KiB |