智造团版1
|
|
@ -0,0 +1,16 @@
|
|||
{ // 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"
|
||||
},
|
||||
"mp-weixin" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<script>
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
console.log('App Launch', )
|
||||
this.$store.dispatch('getHomeContent', {
|
||||
appid: uni.getStorageSync('appid')
|
||||
})
|
||||
},
|
||||
onShow: function() {
|
||||
console.log('App Show')
|
||||
},
|
||||
onHide: function() {
|
||||
console.log('App Hide')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@import url("@/uni_modules/u-parse/u-parse.css");
|
||||
|
||||
/*每个页面公共css */
|
||||
.content {
|
||||
/* display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center; */
|
||||
padding: 10px;
|
||||
min-height: calc(100vh - 20px);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,953 @@
|
|||
|
||||
page {
|
||||
font-family: "Microsoft YaHei";
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
.f-r{
|
||||
float: right !important;
|
||||
}
|
||||
.bgfff{
|
||||
background: #fff !important;
|
||||
}
|
||||
.c666{
|
||||
color: #666 !important;
|
||||
}
|
||||
.c999{
|
||||
color: #999 !important;
|
||||
}
|
||||
.size12 {
|
||||
font-size: 12px !important
|
||||
}
|
||||
.size16 {
|
||||
font-size: 32rpx !important
|
||||
}
|
||||
|
||||
.size18 {
|
||||
font-size: 36rpx !important
|
||||
}
|
||||
|
||||
.size20 {
|
||||
font-size: 40rpx !important
|
||||
}
|
||||
|
||||
.mt-5 {
|
||||
margin-top: 5px !important;
|
||||
}
|
||||
|
||||
.mt-10 {
|
||||
margin-top: 10px !important;
|
||||
}
|
||||
|
||||
.mt-15 {
|
||||
margin-top: 15px !important;
|
||||
}
|
||||
|
||||
.mb-5 {
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
|
||||
.mb-10 {
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.mr-5 {
|
||||
margin-right: 5px !important;
|
||||
}
|
||||
|
||||
.mr-10 {
|
||||
margin-right: 10px !important;
|
||||
}
|
||||
|
||||
.ml-5 {
|
||||
margin-left: 5px !important;
|
||||
}
|
||||
|
||||
.ml-10 {
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
.ml-15 {
|
||||
margin-left: 15px !important;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.strong {
|
||||
// font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.overflow {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.box_shadow {
|
||||
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #f7f7f7;
|
||||
}
|
||||
.closeBtn{
|
||||
color: #666 !important;
|
||||
background-color: #f5f5f5 !important;
|
||||
border: 1px solid #d9d9d9;
|
||||
}
|
||||
.orangeBtn {
|
||||
color: #333;
|
||||
background: #F5CC87;
|
||||
}
|
||||
|
||||
.greenBtn {
|
||||
color: #52c41a;
|
||||
background: #f6ffed;
|
||||
border: 1px solid #b7eb8f;
|
||||
}
|
||||
|
||||
.redBtn {
|
||||
color: #f5222d;
|
||||
background: #fff1f0;
|
||||
border: 1px solid #ffa39e;
|
||||
}
|
||||
|
||||
.blueBtn {
|
||||
color: #1890ff;
|
||||
background: #dbebf9;
|
||||
border: 1px solid #8cc8ff;
|
||||
}
|
||||
|
||||
.orangecolor {
|
||||
color: $orange !important;
|
||||
}
|
||||
|
||||
.redcolor {
|
||||
color: $red !important;
|
||||
}
|
||||
|
||||
.bluecolor {
|
||||
color: $blue !important;
|
||||
}
|
||||
|
||||
.nolist {
|
||||
margin-top: 40%;
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
|
||||
image {
|
||||
width: 100px !important;
|
||||
height: 100px !important;
|
||||
}
|
||||
|
||||
text {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin-top: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.endtext {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
padding: 15px 0;
|
||||
}
|
||||
|
||||
// 遮罩层
|
||||
.wrapper {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 999;
|
||||
|
||||
|
||||
.bg {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
z-index: 99;
|
||||
}
|
||||
// 弹框
|
||||
.edit {
|
||||
padding-bottom: 15px;
|
||||
background-color: #fff;
|
||||
width: 264px;
|
||||
margin: 20% auto;
|
||||
border-radius: 5px;
|
||||
|
||||
.bgcolor {
|
||||
height: 110px;
|
||||
background: #41629E;
|
||||
border-radius: 5px 5px 0 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.bgcolor::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 5px;
|
||||
bottom: 10px;
|
||||
background-color: $red;
|
||||
}
|
||||
|
||||
.bgcolor::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 10px;
|
||||
bottom: 0;
|
||||
background-color: $orange;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-top: -88px;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ercode {
|
||||
width: 100%;
|
||||
margin: 15px auto;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
|
||||
image {
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
border: 1px solid #dfdfdf;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
view {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
text {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
.groupBtn {
|
||||
display: flex;
|
||||
.btn {
|
||||
background-color: $blue;
|
||||
width: 45%;
|
||||
margin: 10px auto 15px;
|
||||
text-align: center;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
.toolsList {
|
||||
width: calc(100% - 30px);
|
||||
margin:0 15px;
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
margin-right: 15px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #f7f7f7;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.t-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
float: left;
|
||||
align-items: center;
|
||||
margin: 0 10px;
|
||||
opacity: 0.75;
|
||||
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
padding: 0 10px
|
||||
}
|
||||
}
|
||||
}
|
||||
// 企业名录头部
|
||||
.phonetop {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
border-top: 50px solid #345A9B;
|
||||
|
||||
.headbox {
|
||||
position: absolute;
|
||||
background: #fff;
|
||||
left: 10px;
|
||||
right: 10px;
|
||||
top: -40px;
|
||||
border-radius: 15px 15px 5px 5px;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.head {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
.image {
|
||||
width: 85px;
|
||||
height: 110px;
|
||||
margin-right: 15px;
|
||||
border: 1px solid #dfdfdf;
|
||||
float: left;
|
||||
border-radius: 5px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
width: calc(100% - 100px);
|
||||
height: 110px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.name {
|
||||
font-size: 16px;
|
||||
|
||||
text {
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
background-color: #F7B133;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
padding: 2px 10px;
|
||||
border-radius: 5px;
|
||||
color: #fff;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.post {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.call {
|
||||
width: 80%;
|
||||
color: #FFD195;
|
||||
background-color: #2C2C34;
|
||||
border-radius: 5px;
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
font-size: 16px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 10px;
|
||||
|
||||
icon {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 资讯详情
|
||||
.newsDetail {
|
||||
background: #fff;
|
||||
padding: 15px;
|
||||
border-radius: 5px;
|
||||
|
||||
|
||||
view {
|
||||
width: 100%;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 324px;
|
||||
height: 166px;
|
||||
margin:10px auto;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.address {
|
||||
width: calc(100% - 22px) !important;
|
||||
margin:15px 0;
|
||||
border: 1px solid #dfdfdf;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
// from表单样式
|
||||
.inputClass {
|
||||
padding: 10px 0;
|
||||
|
||||
|
||||
input {
|
||||
border: none;
|
||||
background: inherit;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
background: #f7f7f7;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.lan {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
font-size: 14px;
|
||||
margin: 0px 15px;
|
||||
|
||||
.left {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: left;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
position: relative;
|
||||
border: 1px solid #dfdfdf;
|
||||
border-radius: 5px;
|
||||
background-color: #fff;
|
||||
|
||||
picker {
|
||||
width: 100%;
|
||||
border: none;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
color: #999;
|
||||
font-size: 26px;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.textarea {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
padding: 5px;
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.zhizhao {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
|
||||
text {
|
||||
font-size: 30px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.touxiang {
|
||||
width: 85px;
|
||||
height: 110px;
|
||||
padding: 0;
|
||||
justify-content: center;
|
||||
|
||||
text {
|
||||
font-size: 30px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 90%;
|
||||
color: #fff;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 5px;
|
||||
background-color: $blue;
|
||||
margin: 20px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
}
|
||||
// from表单
|
||||
.fromClass {
|
||||
padding-bottom: 20px;
|
||||
|
||||
input {
|
||||
border: none;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
.lan {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
font-size: 14px;
|
||||
margin: 0px 15px;
|
||||
|
||||
.left {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: left;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
position: relative;
|
||||
border: 1px solid #dfdfdf;
|
||||
border-radius: 5px;
|
||||
padding: 0 10px;
|
||||
background-color: #fff;
|
||||
|
||||
picker {
|
||||
width: 100%;
|
||||
border: none;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
}
|
||||
|
||||
uni-icons {
|
||||
color: #999;
|
||||
font-size: 26px;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: -2px;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.textarea {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
padding: 5px;
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.zhizhao {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
padding: 0;
|
||||
|
||||
text {
|
||||
font-size: 30px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.touxiang {
|
||||
width: 85px;
|
||||
height: 110px;
|
||||
padding: 0;
|
||||
justify-content: center;
|
||||
|
||||
text {
|
||||
font-size: 30px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 90%;
|
||||
color: #fff;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 5px;
|
||||
background-color: $blue;
|
||||
margin: 20px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pass {
|
||||
padding: 5px 10px;
|
||||
background: #F9CD90;
|
||||
color: #D8001B;
|
||||
line-height: 25px
|
||||
}
|
||||
}
|
||||
// 搜索样式
|
||||
.serachBox {
|
||||
height: 35px;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 0 10px 10px;
|
||||
z-index: 9;
|
||||
background-color: $blue;
|
||||
|
||||
.serach-box {
|
||||
height: 35px;
|
||||
border-radius: 15px;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
border: 1px solid $blue;
|
||||
}
|
||||
|
||||
.searchInput {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 40px;
|
||||
height: 35px;
|
||||
|
||||
uni-icons {
|
||||
position: absolute;
|
||||
right: 2px;
|
||||
top: 5px;
|
||||
display: flex;
|
||||
width: auto;
|
||||
z-index: 9999;
|
||||
}
|
||||
}
|
||||
|
||||
.searchBtn {
|
||||
position: absolute;
|
||||
width: 40px;
|
||||
right: 0px;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
background: $orange;
|
||||
border-radius: 0 10px 10px 0;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
|
||||
uni-icons {
|
||||
width: 50px;
|
||||
height: 35px;
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
height: 35px;
|
||||
padding: 0 5px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
font-size: 14px;
|
||||
border-radius: 10px;
|
||||
|
||||
}
|
||||
}
|
||||
// 商品列表样式
|
||||
.productList {
|
||||
border-radius: 5px;
|
||||
margin-bottom: 15px;
|
||||
padding:10px 10px;
|
||||
border-bottom: 1px solid #f7f7f7;
|
||||
background-color: #fff;
|
||||
|
||||
.name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.post {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #f7f7f7;
|
||||
}
|
||||
|
||||
text {
|
||||
color: #333;
|
||||
background: #F5CC87;
|
||||
padding: 3px 8px;
|
||||
font-size: 12px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.call {
|
||||
padding:5px 10px;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.info {
|
||||
padding-top: 5px;
|
||||
|
||||
view {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
text {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.state {
|
||||
font-size: 14px;
|
||||
color: $orange;
|
||||
}
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
// justify-content: space-between;
|
||||
|
||||
image {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #f7f7f7;
|
||||
}
|
||||
}
|
||||
|
||||
.address {
|
||||
margin-top: 10px;
|
||||
|
||||
text {
|
||||
font-size: 12px;
|
||||
background-color: #f7f7f7;
|
||||
border-radius: 5px;
|
||||
padding: 2px 3px;
|
||||
}
|
||||
}
|
||||
.money {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
}
|
||||
.call {
|
||||
color: #000;
|
||||
padding: 0 10px;
|
||||
border-radius: 5px;
|
||||
margin-left: 10px;
|
||||
float: right;
|
||||
background-color: #E6C8A2;
|
||||
|
||||
}
|
||||
}
|
||||
// 资讯列表样式
|
||||
.newslist {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
padding: 15px 0 5px;
|
||||
border-bottom: 1px solid #f7f7f7;
|
||||
|
||||
.left {
|
||||
width: calc(100% - 115px);
|
||||
height: 70px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-flow: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
width: 100%;
|
||||
font-size: 32rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
line-height: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 105px;
|
||||
height: 70px;
|
||||
border:1px solid #f7f7f7;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.time {
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
|
||||
icon {
|
||||
width: 20px;
|
||||
display: block;
|
||||
margin-right: 3px;
|
||||
margin-top: -5px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.icon-icon-test1 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
view {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
width: 48%;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
float: left;
|
||||
// display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 通讯录列表样式
|
||||
.phonelist {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #f7f7f7;
|
||||
|
||||
.left {
|
||||
width: 200rpx;
|
||||
height: 100rpx;
|
||||
border: 1px solid #dfdfdf;
|
||||
}
|
||||
|
||||
.right {
|
||||
margin-left: 10px;
|
||||
width: calc(100% - 200rpx);
|
||||
height: 100rpx;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
view{
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
text {
|
||||
color: #000;
|
||||
font-size: 16px;
|
||||
margin-right: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.tell {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
image {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
@font-face {
|
||||
font-family: 'iconfont';
|
||||
/* Project id 4209383 */
|
||||
src: url('https://at.alicdn.com/t/c/font_4209383_trk0ap2c0n.woff2?t=1692064993104') format('woff2'),
|
||||
url('https://at.alicdn.com/t/c/font_4209383_trk0ap2c0n.woff?t=1692064993104') format('woff'),
|
||||
url('https://at.alicdn.com/t/c/font_4209383_trk0ap2c0n.ttf?t=1692064993104') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 18px;
|
||||
display: flex;
|
||||
font-style: normal;
|
||||
justify-content: center;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-tongxunlu_huaban:before {
|
||||
content: "\e65d";
|
||||
}
|
||||
|
||||
.icon-n:before {
|
||||
content: "\e64b";
|
||||
}
|
||||
|
||||
.icon-shouye:before {
|
||||
content: "\e645";
|
||||
}
|
||||
|
||||
.icon-shouye2:before {
|
||||
content: "\e600";
|
||||
}
|
||||
|
||||
.icon-gerenzhongxin:before {
|
||||
content: "\e623";
|
||||
}
|
||||
|
||||
.icon-gerenzhongxin1:before {
|
||||
content: "\e709";
|
||||
}
|
||||
|
||||
.icon-dianhua1:before {
|
||||
content: "\e646";
|
||||
}
|
||||
|
||||
.icon-fabuhuoyuan:before {
|
||||
content: "\e602";
|
||||
}
|
||||
|
||||
.icon-yuanxingweixuanzhong:before {
|
||||
content: "\e72f";
|
||||
}
|
||||
|
||||
.icon-yuanxingxuanzhongfill:before {
|
||||
content: "\e730";
|
||||
}
|
||||
|
||||
.icon-kefufill:before {
|
||||
content: "\e740";
|
||||
}
|
||||
|
||||
.icon-yonghu:before {
|
||||
content: "\e788";
|
||||
}
|
||||
|
||||
.icon-zantongfill:before {
|
||||
content: "\e793";
|
||||
}
|
||||
|
||||
.icon-zantong:before {
|
||||
content: "\e794";
|
||||
}
|
||||
|
||||
.icon-icon-test:before {
|
||||
content: "\e633";
|
||||
}
|
||||
|
||||
.icon-icon-test1:before {
|
||||
content: "\e638";
|
||||
}
|
||||
|
||||
.icon-icon-test2:before {
|
||||
content: "\e63c";
|
||||
}
|
||||
|
||||
.icon-icon-test3:before {
|
||||
content: "\e63e";
|
||||
}
|
||||
|
||||
.icon-icon-test4:before {
|
||||
content: "\e641";
|
||||
}
|
||||
|
||||
.icon-icon-test5:before {
|
||||
content: "\e644";
|
||||
}
|
||||
|
||||
.icon-icon-test6:before {
|
||||
content: "\e651";
|
||||
}
|
||||
|
||||
.icon-icon-test7:before {
|
||||
content: "\e657";
|
||||
}
|
||||
|
||||
.icon-icon-test8:before {
|
||||
content: "\e658";
|
||||
}
|
||||
|
||||
.icon-icon-test9:before {
|
||||
content: "\e659";
|
||||
}
|
||||
|
||||
.icon-icon-test10:before {
|
||||
content: "\e65a";
|
||||
}
|
||||
|
||||
.icon-icon-test11:before {
|
||||
content: "\e65b";
|
||||
}
|
||||
|
||||
.icon-icon-test12:before {
|
||||
content: "\e65c";
|
||||
}
|
||||
|
||||
.icon-chuangzuo:before {
|
||||
content: "\e8ad";
|
||||
}
|
||||
|
||||
.icon-fenxiang:before {
|
||||
content: "\e8b0";
|
||||
}
|
||||
|
||||
.icon-remen:before {
|
||||
content: "\e8c9";
|
||||
}
|
||||
|
||||
.icon-zhufangxinxi:before {
|
||||
content: "\e620";
|
||||
}
|
||||
|
||||
.icon-dadianhua:before {
|
||||
content: "\e673";
|
||||
}
|
||||
|
||||
.icon-zhanghuxiugai:before {
|
||||
content: "\f900";
|
||||
}
|
||||
|
||||
.icon-daishouhuo:before {
|
||||
content: "\f94a";
|
||||
}
|
||||
|
||||
.icon-huiyuanquanyi:before {
|
||||
content: "\f974";
|
||||
}
|
||||
|
||||
.icon-guahao:before {
|
||||
content: "\f97f";
|
||||
}
|
||||
|
||||
.icon-liuyan:before {
|
||||
content: "\f9a8";
|
||||
}
|
||||
|
||||
.icon-fengxianpinggu:before {
|
||||
content: "\f9eb";
|
||||
}
|
||||
|
||||
.icon-dianzimingpian:before {
|
||||
content: "\fa0b";
|
||||
}
|
||||
|
||||
.icon-yuangongfankui:before {
|
||||
content: "\fa25";
|
||||
}
|
||||
|
||||
.icon-huati1:before {
|
||||
content: "\fa40";
|
||||
}
|
||||
|
||||
.icon-shiyexinxi:before {
|
||||
content: "\e607";
|
||||
}
|
||||
|
||||
.icon-huiyuan:before {
|
||||
content: "\e6f6";
|
||||
}
|
||||
|
||||
.icon-dingwei:before {
|
||||
content: "\e61f";
|
||||
}
|
||||
|
||||
.icon-a-ziyuan94:before {
|
||||
content: "\e60b";
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<template>
|
||||
<view class="message" @click="handleServiceChat">
|
||||
<view class="info-msg">
|
||||
<image src="@/static/mmm.png"></image>
|
||||
<text>客服</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(["HomeContent"]),
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
handleServiceChat() {
|
||||
let that = this
|
||||
if (!that.HomeContent.qyappid) {
|
||||
that.$tools.msg("小程序还未配置微信客服")
|
||||
return
|
||||
}
|
||||
wx.openCustomerServiceChat({
|
||||
extInfo: { //客服链接
|
||||
url: that.HomeContent.qyserviceurl
|
||||
},
|
||||
corpId: that.HomeContent.qyappid, //企业ID
|
||||
success(res) {}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.message {
|
||||
position: fixed;
|
||||
bottom: 50px;
|
||||
z-index: 9999;
|
||||
right: 10px;
|
||||
background: $blue;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
padding: 2px;
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
|
||||
.info-msg {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
icon {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
margin-top: 3px;
|
||||
|
||||
}
|
||||
|
||||
text {
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
<template>
|
||||
<view class="product">
|
||||
<view class="newslist" v-for="(item,index) in list" :key="index" @click="handleActive(item.id)">
|
||||
<view class="right">
|
||||
<image :src="item.headimg" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="left">
|
||||
<view class="title">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="time" v-if="isAddress!=4">
|
||||
<view class="size14 c999" style="width:60%">
|
||||
<icon class="iconfont icon-icon-test1"></icon>
|
||||
{{item.createdtime}}
|
||||
</view>
|
||||
<view class="size14 c999 " style="width:40%">
|
||||
<icon class="iconfont icon-icon-test"></icon>
|
||||
{{item.browsecnt}}次浏览
|
||||
</view>
|
||||
</view>
|
||||
<view class="time isAddress" v-if="isAddress==4">
|
||||
<view class="size14 c999">
|
||||
<uni-icons type="location-filled" size="20" class="location"></uni-icons>
|
||||
{{item.province}}{{item.city}}{{item.area}}{{item.address}}
|
||||
</view>
|
||||
<view class="size14 c999 ml-10">
|
||||
<icon class="iconfont icon-icon-test1"></icon>
|
||||
{{item.starttime}}至{{item.endtime}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
name: "productList",
|
||||
props: {
|
||||
isAddress: {
|
||||
type: Number,
|
||||
default: 1 //1资讯4活动,7党建
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleActive(id) {
|
||||
let that = this
|
||||
// if (!uni.getStorageSync('token')) {
|
||||
// that.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
let type = that.isAddress
|
||||
let account = {
|
||||
id: id,
|
||||
type: type
|
||||
}
|
||||
let https = ""
|
||||
if (type == 1 || type == 5 || type == 6 || type == 7) {
|
||||
https = that.$model.getInfoDetail(account)
|
||||
} else if (type == 4) {
|
||||
https = that.$model.getCampaignDetail(account)
|
||||
}
|
||||
return https.then((res) => {
|
||||
if (res.code != 0) return
|
||||
res.data.type = type
|
||||
if (type == 4) {
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/news/detail?id=" + res.data.id + "&type=" + res.data.type
|
||||
})
|
||||
} else {
|
||||
that.$tools.NewsPtype(res.data)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.location {
|
||||
float: left;
|
||||
display: block;
|
||||
margin-top: 0px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
<template>
|
||||
<view class="product">
|
||||
<view class="productList" v-for="(item,index) in list" :key="index" @click="handleActive(item)">
|
||||
<view class="name" v-if="isName">
|
||||
<view class="post" :style="{'width':!isMoney?'60%':'100%'}">
|
||||
<image :src="item.userinfo.avatar" class="mr-10" mode="aspectFit"></image>
|
||||
<view class="bold size16 mr-10">{{item.userinfo.name}}</view>
|
||||
<text>{{item.userinfo.posname}}</text>
|
||||
</view>
|
||||
<text class="call" v-if="!isMoney" @click="$tools.getCall(user.authlist,item.userinfo.phone)"
|
||||
@click.stop>
|
||||
<icon class="iconfont icon-dianhua1 mr-10"></icon>
|
||||
拨打电话
|
||||
</text>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="bold size16 title">
|
||||
<text class="" :style="{'width':isState?'80%':'100%'}">{{item.title}}</text>
|
||||
<text class="state" v-if="isState">
|
||||
{{item.status==4?'待审核':item.status==5?'已驳回':'审核通过'}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="mt-5 c999 size14">{{item.desc}}</view>
|
||||
<view class="image" v-if="isMoney&&item.pics.length">
|
||||
<image v-for="(img,ind) in item.pics" :key="ind" :src="img.url" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="address" v-if="isMoney">
|
||||
<text class="mr-10" v-if="item.industryname">行业:{{item.industryname}}</text>
|
||||
<text v-if="item.province">地址:{{item.province}}{{item.city}}{{item.area}}{{item.address}}</text>
|
||||
</view>
|
||||
<view v-if="item.type!=9">
|
||||
<view class="money mt-10" v-if="isMoney">
|
||||
<text class="redcolor size16 mr-5 bold" v-if="item.vipprice">会员价:¥{{item.vipprice}}</text>
|
||||
<text class="size12 c999" v-if="item.price">市场价:¥{{item.price}}</text>
|
||||
<text class="call" @click.stop v-if="isPhone"
|
||||
@click="$tools.getCall(user.authlist,item.userinfo.phone)">
|
||||
<icon class="iconfont icon-dianhua1 mr-10"></icon>
|
||||
拨打电话
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 秘书处弹框 -->
|
||||
<secratary></secratary>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
name: "productList",
|
||||
props: {
|
||||
isName: { //是否显示头部个人信息
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isPhone: { //是否显示电话
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isState: { //是否显示审核状态
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isMoney: { //是否显示价格
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
list: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user"]),
|
||||
},
|
||||
methods: {
|
||||
handleActive(item) {
|
||||
this.$emit("handleDetail", item)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.image {
|
||||
:nth-child(2) {
|
||||
margin: 0 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
<template>
|
||||
<!-- 搜索 -->
|
||||
<view class="serachBox">
|
||||
<view class="serach-box" :style="{'width':width+'%'}">
|
||||
<view class="searchInput">
|
||||
<input :placeholder="placeholder" class="city-serach-input" v-model="name" />
|
||||
<uni-icons v-if="name" @click="handlecolse(1)" type="close" size="26px"></uni-icons>
|
||||
</view>
|
||||
<view class="searchBtn" @click="handleSerach">
|
||||
<icon class="iconfont icon-icon-test2"></icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="address" v-if="isAddress">
|
||||
<view class="item">
|
||||
<picker mode="selector" :range="industrylist" range-key="name" :value="industryname"
|
||||
@change="changeIndustry">
|
||||
<view class="uni-input">{{industryname?industryname:"所属行业"}}</view>
|
||||
<icon class="iconfont icon-icon-test11" v-if="!industryname"></icon>
|
||||
</picker>
|
||||
<uni-icons v-if="industryname" @click="handlecolse(2)" type="close" size="26px"></uni-icons>
|
||||
</view>
|
||||
<view class="item">
|
||||
<pickRegions @getRegion="handleGetRegion" class="regions" :isArea="false">
|
||||
<view class="city" v-if="province">
|
||||
{{province}}{{city}}
|
||||
</view>
|
||||
<view v-else>所属地区</view>
|
||||
<icon class="iconfont icon-icon-test11" v-if="!province"></icon>
|
||||
</pickRegions>
|
||||
<uni-icons v-if="province" @click="handlecolse(3)" type="close" size="26px" @click.stop></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import pickRegions from "@/uni_modules/pick-regions/pick-regions.vue"
|
||||
export default {
|
||||
name: "search",
|
||||
props: {
|
||||
isPost: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isWork: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100'
|
||||
},
|
||||
isAddress: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: "",
|
||||
industryname: "",
|
||||
industryid: "",
|
||||
posname: "",
|
||||
posid: "",
|
||||
province: "",
|
||||
city: ""
|
||||
}
|
||||
},
|
||||
components: {
|
||||
pickRegions
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user", "HomeContent"]),
|
||||
endDate() {
|
||||
return this.$tools.getDate('start')
|
||||
},
|
||||
industrylist() {
|
||||
return this.HomeContent.industrylist
|
||||
},
|
||||
poslist() {
|
||||
return this.HomeContent.poslist
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 搜索
|
||||
handleSerach() {
|
||||
if (!this.name) {
|
||||
this.$tools.msg('请输入关键字进行搜索')
|
||||
return
|
||||
}
|
||||
this.$emit("handleSearch", this.name, this.province, this.city, this.industryid)
|
||||
},
|
||||
//取消搜索
|
||||
handlecolse(ind) {
|
||||
this.name = ind == 1 ? "" : this.name
|
||||
this.province = ind == 3 ? "" : this.province
|
||||
this.city = ind == 3 ? "" : this.city
|
||||
this.industryname = ind == 2 ? "" : this.industryname
|
||||
this.industryid = ind == 2 ? "" : this.industryid
|
||||
this.$emit("handleSearch", this.name, this.province, this.city, this.industryid)
|
||||
},
|
||||
// 所属地区
|
||||
handleGetRegion(ite) {
|
||||
this.province = ite[0].name
|
||||
this.city = ite[1].name == '全部' ? '' : ite[1].name
|
||||
this.$emit("handleSearch", this.name, this.province, this.city, this.industryid)
|
||||
},
|
||||
// 所属行业
|
||||
changeIndustry(e) {
|
||||
this.industryname = this.HomeContent.industrylist[e.target.value].name
|
||||
this.industryid = this.HomeContent.industrylist[e.target.value].id
|
||||
this.$emit("handleSearch", this.name, this.province, this.city, this.industryid)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.address {
|
||||
position: fixed;
|
||||
top: 45px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
background: $blue;
|
||||
|
||||
.item {
|
||||
width: 47%;
|
||||
margin-left: 10px;
|
||||
background: #fff;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
text-align: center;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
|
||||
.uni-input {
|
||||
width: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
icon,
|
||||
uni-icons {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 0
|
||||
}
|
||||
|
||||
/deep/picker {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.searchInput {
|
||||
uni-icons {
|
||||
z-index: 999;
|
||||
top: 6px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<template>
|
||||
<view class="wrapper" v-if="isSecratary">
|
||||
<view class="bg" @click="onTap">
|
||||
<view class="edit" @click.stop>
|
||||
<view class="bgcolor"></view>
|
||||
<view class="title">联系秘书处</view>
|
||||
<view class="ercode">
|
||||
<image :src="HomeContent.secrataryqrcode" show-menu-by-longpress="true"></image>
|
||||
<text>扫码添加秘书处微信</text>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="mt-15" @click="getCall(HomeContent.secrataryphone)">
|
||||
<uni-icons type="phone-filled" size="40"></uni-icons>
|
||||
</view>
|
||||
<view @click="getCall(HomeContent.secrataryphone)">
|
||||
<text class="bold size16 mb-5 mt-10">{{HomeContent.secrataryphone}}</text>
|
||||
(点击拨打)
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
name: "secratary",
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["HomeContent", 'isSecratary']),
|
||||
},
|
||||
methods: {
|
||||
onTap() {
|
||||
this.$store.commit("changeSecratary", false);
|
||||
},
|
||||
getCall(num) {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: num //仅为示例
|
||||
}).catch((e) => {
|
||||
console.log(e) //用catch(e)来捕获错误{makePhoneCall:fail cancel}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"tools": [{
|
||||
"src": "../../static/02.png",
|
||||
"text": "智造团概况",
|
||||
"path": "/pageTwo/index/detail"
|
||||
},
|
||||
{
|
||||
"src": "../../static/03.png",
|
||||
"text": "资讯列表",
|
||||
"path": "/pageTwo/news/list?type=1"
|
||||
},
|
||||
{
|
||||
"src": "../../static/04.png",
|
||||
"text": "活动信息",
|
||||
"path": "/pageTwo/news/list?type=4"
|
||||
},
|
||||
{
|
||||
"src": "../../static/05.png",
|
||||
"text": "企业名录",
|
||||
"path": "/pages/phoneList/phoneList"
|
||||
},
|
||||
{
|
||||
"src": "../../static/06.png",
|
||||
"text": "商品展示",
|
||||
"path": "/pageTwo/product/list?type=3"
|
||||
},
|
||||
{
|
||||
"src": "../../static/07.png",
|
||||
"text": "党建专栏",
|
||||
"path": "/pageTwo/news/list?type=7"
|
||||
},
|
||||
{
|
||||
"src": "../../static/08.png",
|
||||
"text": "供求信息",
|
||||
"path": "/pageTwo/product/list?type=8"
|
||||
},
|
||||
{
|
||||
"src": "../../static/09.png",
|
||||
"text": "申请加入",
|
||||
"path": "/pageTwo/login/add"
|
||||
}
|
||||
],
|
||||
"addNeeds":[
|
||||
"找客户资源",
|
||||
"扩大人脉圈子",
|
||||
"能力提升",
|
||||
"为企业做品牌宣传",
|
||||
"直播",
|
||||
"个人IP打造",
|
||||
"拍摄剪辑",
|
||||
"学习新媒体运营",
|
||||
"老板思维",
|
||||
"团队打造",
|
||||
"销售话术",
|
||||
"外贸平台搭建",
|
||||
"其他"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||
CSS.supports('top: constant(a)'))
|
||||
document.write(
|
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<title></title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"><!--app-html--></div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
import App from './App'
|
||||
import './uni.scss';
|
||||
import './assets/common.scss'
|
||||
import './assets/iconfont-weapp-icon.css'
|
||||
import './assets/iconfont.css'
|
||||
|
||||
import store from './store'
|
||||
Vue.prototype.$store = store;
|
||||
// js
|
||||
import tools from '@/tools/tools.js'
|
||||
Vue.prototype.$tools = tools;
|
||||
//请求
|
||||
import http from '@/tools/https.js'
|
||||
Vue.prototype.$http = http;
|
||||
//接口
|
||||
import model from '@/tools/model.js'
|
||||
Vue.prototype.$model = model;
|
||||
//模拟数据
|
||||
import json from '@/data.json'
|
||||
Vue.prototype.$json = json;
|
||||
// 秘书处弹框
|
||||
import secratary from '@/components/secratary.vue'
|
||||
Vue.component('secratary', secratary)
|
||||
//微信客服
|
||||
import message from '@/components/message.vue'
|
||||
Vue.component('message', message)
|
||||
|
||||
// #ifndef VUE3
|
||||
import Vue from 'vue'
|
||||
import './uni.promisify.adaptor'
|
||||
Vue.config.productionTip = false
|
||||
App.mpType = 'app'
|
||||
const app = new Vue({
|
||||
...App
|
||||
})
|
||||
app.$mount()
|
||||
// #endif
|
||||
|
||||
// #ifdef VUE3
|
||||
import {
|
||||
createSSRApp
|
||||
} from 'vue'
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
return {
|
||||
app
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"name" : "intelligentGroup",
|
||||
"appid" : "__UNI__8CF31FA",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wxbbddd1888da43ab0",
|
||||
"setting" : {
|
||||
"urlCheck" : true,
|
||||
"postcss" : true,
|
||||
"minified" : true
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
},
|
||||
"vueVersion" : "2"
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<u-parse :content="content"></u-parse>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import uParse from '@/uni_modules/u-parse/u-parse.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
content: ""
|
||||
}
|
||||
},
|
||||
components: {
|
||||
uParse
|
||||
},
|
||||
computed: {
|
||||
...mapState(["HomeContent"]),
|
||||
},
|
||||
onLoad(option) {
|
||||
console.log("content", option)
|
||||
let that = this
|
||||
this.content = option.content == 1 ? this.HomeContent.privacydesc : this.HomeContent.appdesc
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import url("@/uni_modules/u-parse/u-parse.css");
|
||||
</style>
|
||||
|
|
@ -0,0 +1,391 @@
|
|||
<template>
|
||||
<view class="box fromClass">
|
||||
<view class="lanBox">
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">所属行业</view>
|
||||
<view class="right">
|
||||
<picker mode="selector" :range="industrylist" range-key="name" :value="content.industryname"
|
||||
@change="changeIndustry">
|
||||
<view class="uni-input">{{content.industryname?content.industryname:"请选择"}}</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">姓名</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="content.name" placeholder="姓名" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">手机号</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="content.phone" placeholder="手机号" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">个人照片</view>
|
||||
<view class="right touxiang" v-if="content.avatar">
|
||||
<image :src="content.avatarurl" mode="aspectFit" @click="handleimage(1)" />
|
||||
<uni-icons type="close" size="22" class="uni-icons" @click="content.avatarurl='',content.avatar=''"
|
||||
@click.stop></uni-icons>
|
||||
</view>
|
||||
<view class="right touxiang size20 bold" v-else @click="handleimage(1)">+</view>
|
||||
<text class="size12 c999 desc">请上传1寸蓝底照片,大小不超过2M</text>
|
||||
</view>
|
||||
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">性别</view>
|
||||
<view class="right">
|
||||
<picker mode="selector" :range="sexItem" @change="onsexArr">
|
||||
<view class="uni-input">{{content.sex==0?'请选择':content.sex==1?'男':'女'}}</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">出生年月</view>
|
||||
<view class="right">
|
||||
<picker class="picker" mode="date" :end="endDate" :value="birthday" @change="bindDateChange">
|
||||
<view class="uni-input">{{content.birthday?content.birthday:"请选择"}}</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">企业全称</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="content.comName" placeholder="企业全称" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">公司职位</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="content.comPos" placeholder="公司职位" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">营业执照</view>
|
||||
<view class="right zhizhao" v-if="content.license">
|
||||
<image :src="content.licenseurl" class="headimage" @click="handleimage(2)" mode="aspectFit" />
|
||||
<uni-icons type="close" size="22" class="uni-icons"
|
||||
@click="content.licenseurl='',content.license=''" @click.stop></uni-icons>
|
||||
</view>
|
||||
<view class="right zhizhao size20 bold" v-else @click="handleimage(2)">+</view>
|
||||
<text class="size12 c999 desc">点击上传企业营业执照,仅用于资质审核</text>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">通过什么途径了解智造团?</view>
|
||||
<view class="radio">
|
||||
<label @click="radioChange('抖音')">
|
||||
<icon class="iconfont radioimg"
|
||||
:class="[source=='抖音'?'icon-yuanxingxuanzhongfill':'icon-yuanxingweixuanzhong']">
|
||||
</icon>
|
||||
抖 音
|
||||
</label>
|
||||
<label @click="radioChange('朋友圈')">
|
||||
<icon class="iconfont radioimg"
|
||||
:class="[source=='朋友圈'?'icon-yuanxingxuanzhongfill':'icon-yuanxingweixuanzhong']">
|
||||
</icon>
|
||||
朋友圈
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<view @click="radioChange('介绍人')">
|
||||
<icon class="iconfont radioimg"
|
||||
:class="[source=='介绍人'?'icon-yuanxingxuanzhongfill':'icon-yuanxingweixuanzhong']">
|
||||
</icon>
|
||||
介绍人
|
||||
</view>
|
||||
<input type="text" v-model="sourceName" />
|
||||
</label>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">加入智照团想收获什么?</view>
|
||||
<checkbox-group @change="checkboxChange" class="checkbox">
|
||||
<label>
|
||||
<checkbox value="找客户资源" style="transform:scale(0.8)" />找客户资源
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="扩大人脉圈子" style="transform:scale(0.8)" />扩大人脉圈子
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="能力提升" style="transform:scale(0.8)" />能力提升
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="为企业做品牌宣传" style="transform:scale(0.8)" />为企业做品牌宣传
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="直播" style="transform:scale(0.8)" />直播
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="个人IP打造" style="transform:scale(0.8)" />个人IP打造
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="拍摄剪辑" style="transform:scale(0.8)" />拍摄剪辑
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="学习新媒体运营" style="transform:scale(0.8)" />学习新媒体运营
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="老板思维" style="transform:scale(0.8)" />老板思维
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="团队打造" style="transform:scale(0.8)" />团队打造
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="销售话术" style="transform:scale(0.8)" />销售话术
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="外贸平台搭建" style="transform:scale(0.8)" />外贸平台搭建
|
||||
</label>
|
||||
<label>
|
||||
<checkbox value="其他" style="transform:scale(0.8)" />其他
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">能给平台带来什么?</view>
|
||||
<view class="right textarea">
|
||||
<textarea v-model="content.provide" name="content" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan c999 size12 mt-15">
|
||||
所有上传的资料信息同意公开展示,最终解释权归智造团平台所有。
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="btn" @click="confirmInfo">申请加入</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
sexItem: [
|
||||
"男",
|
||||
"女"
|
||||
],
|
||||
source: "",
|
||||
sourceName: "",
|
||||
content: {
|
||||
sex: "",
|
||||
name: "",
|
||||
name: "",
|
||||
avatar: "",
|
||||
avatarurl: "",
|
||||
source: "",
|
||||
birthday: "",
|
||||
industryid: "",
|
||||
industryname: "",
|
||||
comName: "",
|
||||
comPos: "",
|
||||
provide: "",
|
||||
demand: "",
|
||||
license: "",
|
||||
licenseurl: ""
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["HomeContent"]),
|
||||
endDate() {
|
||||
return this.$tools.getDate("start")
|
||||
},
|
||||
industrylist() {
|
||||
return this.HomeContent.industrylist
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 提交
|
||||
confirmInfo() {
|
||||
let that = this
|
||||
if (!this.content.industryname) {
|
||||
this.$tools.msg("请选择所属行业")
|
||||
return;
|
||||
}
|
||||
if (!this.content.name) {
|
||||
this.$tools.msg("请输入姓名")
|
||||
return;
|
||||
}
|
||||
if (!this.content.phone) {
|
||||
this.$tools.msg("请输入手机号")
|
||||
return;
|
||||
}
|
||||
if (!this.content.avatarurl) {
|
||||
this.$tools.msg("请上传个人照片")
|
||||
return;
|
||||
}
|
||||
if (!this.content.sex) {
|
||||
this.$tools.msg("请选择性别")
|
||||
return;
|
||||
}
|
||||
if (!this.content.birthday) {
|
||||
this.$tools.msg("请选择出生日期")
|
||||
return;
|
||||
}
|
||||
if (!this.content.comName) {
|
||||
this.$tools.msg("请输入公司全称")
|
||||
return;
|
||||
}
|
||||
if (!this.content.comPos) {
|
||||
this.$tools.msg("请输入公司职位")
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.source == '介绍人' && !this.sourceName) {
|
||||
this.$tools.msg("请输入介绍人姓名")
|
||||
return;
|
||||
}
|
||||
this.content.source = this.sourceName ? this.sourceName : this.source
|
||||
console.log('content', this.content)
|
||||
that.$model.getApplyfor(this.content).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: "提交成功",
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(function() {
|
||||
uni.switchTab({
|
||||
url: "/pages/index/index"
|
||||
})
|
||||
}, 2000)
|
||||
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleimage(ind) {
|
||||
let that = this
|
||||
uni.chooseImage({
|
||||
count: 1, //默认9
|
||||
sourceType: ['album', 'camera'], //从相册选择
|
||||
success: function(res) {
|
||||
uni.showLoading({
|
||||
title: '识别中...'
|
||||
})
|
||||
that.$model.getUpLoadimg({
|
||||
uploadpath: res.tempFilePaths[0]
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res.code == 0) {
|
||||
if (ind == 1) {
|
||||
that.content.avatar = res.data.path
|
||||
that.content.avatarurl = res.data.url
|
||||
} else {
|
||||
that.content.license = res.data.path
|
||||
that.content.licenseurl = res.data.url
|
||||
}
|
||||
} else {
|
||||
that.$tools.msg("不支持该图像")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//确定年龄
|
||||
bindDateChange(e) {
|
||||
this.content.birthday = e.target.value
|
||||
},
|
||||
//确定性别
|
||||
onsexArr(e) {
|
||||
this.content.sex = this.sexItem[e.target.value] == "男" ? 1 : 2
|
||||
},
|
||||
// 所属行业
|
||||
changeIndustry(e) {
|
||||
this.content.industryname = this.HomeContent.industrylist[e.target.value].name
|
||||
this.content.industryid = this.HomeContent.industrylist[e.target.value].id
|
||||
},
|
||||
// 途径
|
||||
radioChange(e) {
|
||||
this.source = this.source == e ? '' : e
|
||||
this.sourceName = this.source == '介绍人' ? this.sourceName : '';
|
||||
},
|
||||
// 收获
|
||||
checkboxChange(e) {
|
||||
this.content.demand = e.detail.value.join(',')
|
||||
},
|
||||
},
|
||||
onLoad(options) {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped="scoped" lang="scss">
|
||||
.zhizhao,
|
||||
.touxiang {
|
||||
justify-content: center;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.lan {
|
||||
margin: 0 10px !important;
|
||||
}
|
||||
|
||||
.right {
|
||||
/deep/input {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.radio {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
label {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
icon {
|
||||
color: #dfdfdf;
|
||||
font-size: 22px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.icon-yuanxingxuanzhongfill {
|
||||
color: $uni-color-success;
|
||||
}
|
||||
|
||||
:nth-child(3) {
|
||||
width: 50%;
|
||||
|
||||
view {
|
||||
width: 50%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/deep/input {
|
||||
width: 50% !important;
|
||||
border-bottom: 1px solid #dfdfdf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
label {
|
||||
width: 33%;
|
||||
display: flex;
|
||||
font-size: 12px;
|
||||
margin: 5px 0;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
<template>
|
||||
<view class="content inputClass bgfff">
|
||||
<view class="lanBox">
|
||||
<view class="lan">
|
||||
<view class="left">旧密码</view>
|
||||
<view class="right">
|
||||
<input type="text" v-model="oldPassword" placeholder="请输入您的旧密码" />
|
||||
<uni-icons type="close" v-if="oldPassword" size="22" @click="oldPassword=' ' " />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan">
|
||||
<view class="left">新密码</view>
|
||||
<view class="right">
|
||||
<input type="text" v-model="newPassword" placeholder="请输入您的新密码" />
|
||||
<uni-icons type="close" size="22" v-if="newPassword" @click="newPassword=' ' " />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn mt-15" @click="confirmInfo">确定</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
oldPassword: "",
|
||||
newPassword: ""
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 提交
|
||||
confirmInfo() {
|
||||
let that = this
|
||||
if (!this.oldPassword) {
|
||||
this.$tools.msg("请输入旧密码")
|
||||
return;
|
||||
}
|
||||
if (!this.newPassword) {
|
||||
this.$tools.msg("请输入新密码")
|
||||
return;
|
||||
}
|
||||
that.$model.getChangePassword({
|
||||
oldPassword: this.oldPassword,
|
||||
newPassword: this.newPassword
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
that.$tools.msg("密码修改成功,请重新登录");
|
||||
setTimeout(function() {
|
||||
uni.redirectTo({
|
||||
url: "/pageTwo/login/login"
|
||||
})
|
||||
}, 1500)
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.left {
|
||||
margin-top: 20px;
|
||||
font-weight: bold;
|
||||
width: 85px !important;
|
||||
}
|
||||
|
||||
.right {
|
||||
width: calc(100% - 95px) !important;
|
||||
background-color: #f7f7f7;
|
||||
margin-top: 20px;
|
||||
border: none !important;
|
||||
|
||||
uni-icons {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
color: #dfdfdf;
|
||||
z-index: 9999;
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin-top: 50px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,264 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<image src="../../static/011.png" class="bg" mode="scaleToFill"></image>
|
||||
<!-- -->
|
||||
<view class="ts">
|
||||
<view class="mb-5">欢迎登录</view>
|
||||
<view>智造团资源共享数据库平台</view>
|
||||
</view>
|
||||
<view class="edit">
|
||||
<image src="../../static/logo.png" class="logo" mode="widthFix"></image>
|
||||
<view class="editem">
|
||||
<view class="input">
|
||||
<icon class="iconfont icon-gerenzhongxin1 mr-10"></icon>
|
||||
<input class="uni-input input100" v-model="account" placeholder="请输入账号" />
|
||||
</view>
|
||||
<view class="input">
|
||||
<icon class="iconfont icon-icon-test5 mr-10"></icon>
|
||||
<input type="password" class="uni-input" v-model="password" placeholder="请输入密码" />
|
||||
</view>
|
||||
<view class="tips size12" @click="$store.commit('changeSecratary', true)">
|
||||
如忘记密码,请联系秘书处修改重置
|
||||
</view>
|
||||
</view>
|
||||
<view class="btnlogin" @click="handleTelLogin">登录</view>
|
||||
<view class="wxbtn" @click="handleAdd">
|
||||
<text>没有账号,我要加入智造团</text>
|
||||
</view>
|
||||
<view class="xieyi">
|
||||
<checkbox-group @change="checkboxChange">
|
||||
<checkbox :value="1" style="transform:scale(0.8)" />勾选同意智造团<text @click="handlexieyi "
|
||||
class="bluecolor">《个人信息保护政策》</text>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 秘书处弹框 -->
|
||||
<secratary></secratary>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
value: 0,
|
||||
sessionid: "",
|
||||
account: "",
|
||||
password: "",
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(["HomeContent"]),
|
||||
},
|
||||
async onLoad() {
|
||||
let that = this
|
||||
that.sessionid = uni.getStorageSync('sessionid')
|
||||
console.log("sessionid", that.sessionid)
|
||||
if (!that.sessionid) {
|
||||
await that.$store.dispatch('getsessionId')
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 登录、
|
||||
handleTelLogin() {
|
||||
let that = this
|
||||
if (!that.account) {
|
||||
that.$tools.msg("请输入账号")
|
||||
return
|
||||
}
|
||||
if (!that.password) {
|
||||
that.$tools.msg("请输入密码")
|
||||
return
|
||||
}
|
||||
if (that.password.length < 6) {
|
||||
that.$tools.msg("密码长度不能小于6位数")
|
||||
return
|
||||
}
|
||||
if (this.value == 0) {
|
||||
this.$tools.msg("请先勾选同意智造团《个人信息保护政策》")
|
||||
return
|
||||
}
|
||||
this.$model.getlogin({
|
||||
account: that.account,
|
||||
password: that.password,
|
||||
sessionId: uni.getStorageSync('sessionid'),
|
||||
}).then(res => {
|
||||
if (res.code != 0) {
|
||||
that.$tools.msg(res.message)
|
||||
return
|
||||
}
|
||||
uni.setStorageSync('token', res.data.token)
|
||||
uni.setStorageSync('refreshtoken', res.data.refreshtoken)
|
||||
uni.setStorageSync('sessionid', res.data.sessionid)
|
||||
uni.reLaunch({
|
||||
url: "/pages/index/index"
|
||||
})
|
||||
}).catch(err => {})
|
||||
},
|
||||
//
|
||||
handleAdd() {
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/login/add"
|
||||
})
|
||||
},
|
||||
checkboxChange(e) {
|
||||
this.value = e.detail.value.length ? e.detail.value[0] : "0"
|
||||
console.log(e.detail, e.detail.value)
|
||||
},
|
||||
handlexieyi() {
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/index/detail?content=1"
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
// display: flex;
|
||||
overflow: hidden;
|
||||
flex-wrap: wrap;
|
||||
padding: 0 !important;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.bg {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.ts {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
color: #fff;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
margin-top: 200rpx;
|
||||
left: 20px;
|
||||
height: 150rpx;
|
||||
}
|
||||
|
||||
.edit {
|
||||
margin: 40rpx auto 0;
|
||||
width: calc(82% - 30px);
|
||||
position: relative;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
background-color: rgba(255, 255, 255, 0.8);
|
||||
max-height: 780rpx;
|
||||
|
||||
.logo {
|
||||
width: 260rpx;
|
||||
height: 90rpx;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.tips {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.editem {
|
||||
margin-top: 28px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 28upx;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 100%;
|
||||
padding: 0 10px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
|
||||
icon {
|
||||
color: #666;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
input {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: absolute;
|
||||
left: 35px;
|
||||
right: 0px;
|
||||
z-index: 88;
|
||||
}
|
||||
}
|
||||
|
||||
.btnlogin {
|
||||
width: 100%;
|
||||
margin: 40rpx 0 20px;
|
||||
height: 38px;
|
||||
line-height: 38px;
|
||||
background: $blue;
|
||||
font-weight: 700;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.code {
|
||||
width: 110px;
|
||||
background: #dfdfdf;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
right: 2.5px;
|
||||
top: 2.5px;
|
||||
z-index: 99;
|
||||
}
|
||||
}
|
||||
|
||||
.wxbtn {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: $blue;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
|
||||
text {
|
||||
border-bottom: 1px solid $blue;
|
||||
}
|
||||
}
|
||||
|
||||
.xieyi {
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin-top: 40rpx;
|
||||
|
||||
checkbox-group {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
text {
|
||||
border-bottom: 1px solid #333;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,359 @@
|
|||
<template>
|
||||
<view class="box fromClass">
|
||||
<view class="pass" v-if="active==5">
|
||||
驳回原因:{{content.statusremark}}
|
||||
</view>
|
||||
<view class="lanBox">
|
||||
<view class="lan">
|
||||
<view class="left">产品名称(标题)</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="content.title" placeholder="标题" :disabled="disabled" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="lan" v-if="type!=9">
|
||||
<view class="left">产品图片</view>
|
||||
<view class="right pics mr-10" v-for="(img,ind) in urlList" v-if="urlList.length">
|
||||
<image :src="img" mode="aspectFill" @click="handleimage(ind)" />
|
||||
<uni-icons type="close" size="22" class="uni-icons" @click="handleDel(ind)" @click.stop
|
||||
v-if="!disabled"></uni-icons>
|
||||
</view>
|
||||
<view v-if="!disabled&&urlList.length<3" @click="handleimage()" class="right pics size20">+</view>
|
||||
<text class="size12 c999 desc">最多可上传3张,大小不超过2M</text>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="lan" v-if="type!=9">
|
||||
<view class="left">所属行业</view>
|
||||
<view class="right" v-if="!disabled">
|
||||
<picker mode="selector" :range="industrylist" range-key="name" :value="content.industryname"
|
||||
@change="changeIndustry">
|
||||
<view class="uni-input">{{content.industryname?content.industryname:"请选择"}}</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="right" v-else>
|
||||
{{content.industryname}}
|
||||
</view>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="lan" v-if="type!=9">
|
||||
<view class="left">配送范围</view>
|
||||
<view class="right" v-if="!disabled">
|
||||
<pickRegions @getRegion="handleGetRegion" class="regions" :isArea="true">
|
||||
<view class="city" v-if="content.province">
|
||||
{{content.province}}{{content.city}}{{content.area}}
|
||||
</view>
|
||||
<view v-else>请选择省/市/区</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</pickRegions>
|
||||
</view>
|
||||
<view class="right" v-else>
|
||||
{{content.province}}{{content.city}}{{content.area}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan" v-if="type!=9">
|
||||
<view class="left">详细地址</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="content.address" placeholder="单元楼栋" :disabled="disabled" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan" v-if="type!=9">
|
||||
<view class="left">市场价</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="content.price" placeholder="市场价" :disabled="disabled" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan" v-if="type!=9">
|
||||
<view class="left">会员价</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="content.vipprice" placeholder="会员价" :disabled="disabled" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan">
|
||||
<view class="left">产品规格及介绍</view>
|
||||
<view class="right textarea">
|
||||
<textarea v-model="content.desc" name="content" :disabled="disabled" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn" @click="confirmInfo" v-if="!disabled">提交</view>
|
||||
<!-- <view class="wrapper" v-if="showModal">
|
||||
<view class="bg" @click="showModal=false">
|
||||
<view class="all">
|
||||
<icon class="iconfont icon-yuanxingxuanzhongfill"></icon>
|
||||
<view class="bold size20">提交成功</view>
|
||||
<view>在“个人中心”查看审核进度</view>
|
||||
<view>如有疑问请联系秘书处</view>
|
||||
</view>
|
||||
<view class="greenBtn">
|
||||
<view class="btn">确认</view>
|
||||
<view class="btn">取消</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import pickRegions from "@/uni_modules/pick-regions/pick-regions.vue"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
content: {
|
||||
type: "",
|
||||
title: "",
|
||||
province: "",
|
||||
city: "",
|
||||
area: "",
|
||||
address: "",
|
||||
industryid: "",
|
||||
industryname: "",
|
||||
price: "",
|
||||
vipprice: "",
|
||||
desc: '',
|
||||
pics: [],
|
||||
},
|
||||
urlList: [],
|
||||
pathList: [],
|
||||
showModal: false,
|
||||
type: 3,
|
||||
status: "",
|
||||
disabled: false,
|
||||
active: 0,
|
||||
imageStyles: {
|
||||
width: 100,
|
||||
height: 100,
|
||||
},
|
||||
imgArr: []
|
||||
|
||||
};
|
||||
},
|
||||
components: {
|
||||
pickRegions
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user", "HomeContent"]),
|
||||
industrylist() {
|
||||
return this.HomeContent.industrylist
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
this.status = options.status
|
||||
if (this.status == 'add') {
|
||||
this.type = options.type
|
||||
this.content.type = this.type
|
||||
this.disabled = false
|
||||
} else {
|
||||
this.content = JSON.parse(options.item)
|
||||
this.type = this.content.type
|
||||
this.content.industryid = this.type != 9 ? this.industrylist[this.industrylist.findIndex(ite => ite
|
||||
.name === this.content.industryname)].id : ''
|
||||
this.active = this.content.active //审核中、已驳回、已发布的状态
|
||||
this.disabled = this.active == 4 ? true : false
|
||||
let url = []
|
||||
let path = []
|
||||
|
||||
this.content.pics.forEach(item => {
|
||||
url.push(item.url)
|
||||
path.push(item.path)
|
||||
})
|
||||
this.urlList = url
|
||||
this.pathList = path
|
||||
console.log(this.urlList, this.pathList)
|
||||
}
|
||||
console.log("options", options)
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.type == 3 ? "商品信息" : this.active == 8 ? '发布供货' : '我的需求'
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 提交
|
||||
confirmInfo() {
|
||||
let that = this
|
||||
if (this.type == 9) {
|
||||
if (!this.content.title) {
|
||||
this.$tools.msg("请填写产品名称")
|
||||
return;
|
||||
}
|
||||
if (!this.content.desc) {
|
||||
this.$tools.msg("请填写产品规格及介绍")
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!this.content.title) {
|
||||
this.$tools.msg("请填写产品名称")
|
||||
return;
|
||||
}
|
||||
if (!this.content.pics) {
|
||||
this.$tools.msg("请上传产品图片")
|
||||
return;
|
||||
}
|
||||
if (!this.content.industryid) {
|
||||
this.$tools.msg("请选择所属行业")
|
||||
return;
|
||||
}
|
||||
if (!this.content.province) {
|
||||
this.$tools.msg("请选择配送范围")
|
||||
return;
|
||||
}
|
||||
if (!this.content.address) {
|
||||
this.$tools.msg("请填写详细地址")
|
||||
return;
|
||||
}
|
||||
if (!this.pathList) {
|
||||
this.$tools.msg("请输入市场价")
|
||||
return;
|
||||
}
|
||||
if (!this.content.vipprice) {
|
||||
this.$tools.msg("请输入会员价")
|
||||
return;
|
||||
}
|
||||
if (!this.content.desc) {
|
||||
this.$tools.msg("请填写产品规格及介绍")
|
||||
return;
|
||||
}
|
||||
this.content.pics = this.pathList
|
||||
}
|
||||
if (that.status == 'add') {
|
||||
that.subInfo(that.content);
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: that.active == 6 ? "本产品已发布成功," : '' + "一经修改,将重新审核发布",
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.EditInfo(that.content)
|
||||
} else if (res.cancel) {
|
||||
that.$tools.msg('您已取消操作')
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
console.log("提交", this.content)
|
||||
},
|
||||
subInfo(data) {
|
||||
let that = this
|
||||
that.$model.getProductAdd(data).then(res => {
|
||||
if (res.code == 0) {
|
||||
that.$tools.msg("提交成功");
|
||||
uni.showToast({
|
||||
title: "提交成功",
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(function() {
|
||||
uni.switchTab({
|
||||
url: "/pages/me/me"
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
EditInfo(data) {
|
||||
let that = this
|
||||
that.$model.getProductEdit(data).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: "提交成功",
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(function() {
|
||||
uni.switchTab({
|
||||
url: "/pages/me/me"
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleimage(ind) {
|
||||
let that = this
|
||||
let imgArr = []
|
||||
if (this.disabled) return
|
||||
uni.chooseImage({
|
||||
count: 3, //默认9
|
||||
sourceType: ['album', 'camera'], //从相册选择
|
||||
success: function(res) {
|
||||
imgArr.push(res.tempFilePaths)
|
||||
imgArr.forEach(ele => {
|
||||
ele.forEach(item => {
|
||||
that.$model.getUpLoadimg({
|
||||
uploadpath: item
|
||||
}).then(ress => {
|
||||
if (ress.code == 0) {
|
||||
that.urlList.push(ress.data.url)
|
||||
that.pathList.push(ress.data.path)
|
||||
} else {
|
||||
that.$tools.msg("不支持该图像")
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
handleDel(ind) {
|
||||
let that = this
|
||||
that.urlList.splice(ind, 1)
|
||||
that.pathList.splice(ind, 1)
|
||||
console.log("ind", ind)
|
||||
},
|
||||
handleGetRegion(ite) {
|
||||
console.log("省市区", ite)
|
||||
this.content.province = ite[0].name
|
||||
this.content.city = ite[1].name
|
||||
this.content.area = ite[2].name
|
||||
},
|
||||
// 所属行业
|
||||
changeIndustry(e) {
|
||||
this.content.industryname = this.HomeContent.industrylist[e.target.value].name
|
||||
this.content.industryid = this.HomeContent.industrylist[e.target.value].id
|
||||
},
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped="scoped" lang="scss">
|
||||
.right {
|
||||
|
||||
/deep/picker,
|
||||
.regions {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/deep/.is-add {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.pics {
|
||||
width: 100px !important;
|
||||
height: 100px !important;
|
||||
justify-content: center;
|
||||
padding: 0 !important;
|
||||
float: left;
|
||||
// border: none !important;
|
||||
// background-color: inherit !important;
|
||||
|
||||
.uni-icons {
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
font-size: inherit !important;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,294 @@
|
|||
<template>
|
||||
<view class="box fromClass">
|
||||
<view class="lanBox">
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">公司名称<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="userInfo.name" placeholder="公司名称" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">公司所在地区<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<pickRegions @getRegion="handleGetRegion" class="regions" :isArea="true">
|
||||
<view class="city" v-if="userInfo.province">
|
||||
{{userInfo.province}}{{userInfo.city}}{{userInfo.area}}
|
||||
</view>
|
||||
<view v-else>请选择省/市/区</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</pickRegions>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">详细地址<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="userInfo.address" placeholder="单元楼栋" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">公司职位<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="userInfo.pos" placeholder="公司职位" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">公司logo<text class="redcolor">*</text></view>
|
||||
<view class="right logo" v-if="userInfo.logourl">
|
||||
<image :src="userInfo.logourl" class="headimage" mode="aspectFit" @click="handleimage(1)" />
|
||||
<uni-icons type="close" size="26" class="uni-icons" @click="userInfo.logourl=''"
|
||||
@click.stop></uni-icons>
|
||||
</view>
|
||||
<view class="right logo size20 bold" v-else @click="handleimage(1)">+</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">公司电话<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="userInfo.mobile" placeholder="请输入" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">企业年营收(万元)</view>
|
||||
<view class="right">
|
||||
<input name="name" type="digit" v-model="userInfo.yearlyincome" placeholder="请输入" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">企业年税收(万元)</view>
|
||||
<view class="right">
|
||||
<input name="name" type="digit" v-model="userInfo.yearlytax" placeholder="请输入" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">员工人数(人)</view>
|
||||
<view class="right">
|
||||
<input name="name" type="number" v-model="userInfo.staffcnt" placeholder="请输入" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">企业介绍</view>
|
||||
<view class="right textarea">
|
||||
<textarea v-model="userInfo.desc" name="content" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">企业照片</view>
|
||||
<view class="picsImg">
|
||||
<view class="pics" v-for="(img,ind) in urlList" v-if="urlList.length">
|
||||
<image :src="img" mode="aspectFill" @click="handleimage(2)" />
|
||||
<uni-icons type="close" size="26" class="uni-icons" @click="handleDel(ind)"
|
||||
@click.stop></uni-icons>
|
||||
</view>
|
||||
<view v-if="urlList.length<4" @click="handleimage(2)" class="right pics size20">+</view>
|
||||
<text class="size12 c999 desc">最多可上传4张,大小不超过2M</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="btn" @click="confirmInfo">保存</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import pickRegions from "@/uni_modules/pick-regions/pick-regions.vue"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userInfo: {
|
||||
address: "",
|
||||
area: "",
|
||||
city: "",
|
||||
desc: "",
|
||||
logo: "",
|
||||
logourl: "",
|
||||
mobile: "",
|
||||
name: "",
|
||||
pics: [],
|
||||
pos: "",
|
||||
province: "",
|
||||
staffcnt: "",
|
||||
yearlyincome: "",
|
||||
yearlytax: ""
|
||||
},
|
||||
urlList: [],
|
||||
pathList: [],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
pickRegions
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user'])
|
||||
},
|
||||
onLoad() {
|
||||
let url = []
|
||||
let path = []
|
||||
this.userInfo = this.user.cominfo ? this.user.cominfo : {}
|
||||
if (this.user.cominfo && this.user.cominfo.pics.length) {
|
||||
this.user.cominfo.pics.forEach(item => {
|
||||
url.push(item.url)
|
||||
path.push(item.path)
|
||||
})
|
||||
}
|
||||
this.urlList = url
|
||||
this.pathList = path
|
||||
console.log("this.user", this.user)
|
||||
},
|
||||
methods: {
|
||||
// 提交
|
||||
confirmInfo() {
|
||||
let that = this
|
||||
if (!this.userInfo.name) {
|
||||
this.$tools.msg("请输入公司名称")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.province) {
|
||||
this.$tools.msg("请选择公司所在地")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.address) {
|
||||
this.$tools.msg("请输入公司详细地址")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.pos) {
|
||||
this.$tools.msg("请输入公司职位")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.logourl) {
|
||||
this.$tools.msg("请上传公司logo")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.mobile) {
|
||||
this.$tools.msg("请输入公司电话")
|
||||
return;
|
||||
}
|
||||
this.userInfo.pics = this.pathList
|
||||
console.log("提交", this.userInfo)
|
||||
that.$model.getSubmitCom(this.userInfo).then(res => {
|
||||
if (res.code == 0) {
|
||||
that.$tools.msg("提交成功");
|
||||
that.$store.dispatch("getUserInfo")
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleimage(ind) {
|
||||
let that = this
|
||||
let imgArr = []
|
||||
uni.chooseImage({
|
||||
count: ind == 1 ? 1 : 6, //默认9
|
||||
sourceType: ['album', 'camera'], //从相册选择
|
||||
success: function(res) {
|
||||
uni.showLoading({
|
||||
title: '识别中...'
|
||||
})
|
||||
imgArr.push(res.tempFilePaths)
|
||||
imgArr.forEach(ele => {
|
||||
ele.forEach(item => {
|
||||
that.$model.getUpLoadimg({
|
||||
uploadpath: item
|
||||
}).then(ress => {
|
||||
uni.hideLoading()
|
||||
if (ress.code == 0) {
|
||||
if (ind == 1) { //公司logo
|
||||
that.userInfo.logo = ress.data.path
|
||||
that.userInfo.logourl = ress.data.url
|
||||
} else { //企业照片
|
||||
that.urlList.push(ress.data.url)
|
||||
that.pathList.push(ress.data.path)
|
||||
}
|
||||
} else {
|
||||
that.$tools.msg("不支持该图像")
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDel(ind) {
|
||||
let that = this
|
||||
that.urlList.splice(ind, 1)
|
||||
that.pathList.splice(ind, 1)
|
||||
},
|
||||
handleGetRegion(ite) {
|
||||
console.log("省市区", ite)
|
||||
this.userInfo.province = ite[0].name
|
||||
this.userInfo.city = ite[1].name
|
||||
this.userInfo.area = ite[2].name
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped="scoped" lang="scss">
|
||||
.right {
|
||||
|
||||
/deep/picker,
|
||||
.regions {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 145px !important;
|
||||
height: 52px !important;
|
||||
padding: 10px !important;
|
||||
justify-content: center;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
uni-icons {
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
top: -15px !important;
|
||||
font-size: inherit !important;
|
||||
}
|
||||
}
|
||||
|
||||
.picsImg {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.pics {
|
||||
// width: 330rpx !important;
|
||||
// height: 147rpx !important;
|
||||
width: 208rpx !important;
|
||||
height: 208rpx !important;
|
||||
justify-content: center;
|
||||
padding: 0 !important;
|
||||
margin-top: 10px;
|
||||
float: left;
|
||||
border: 1px solid #dfdfdf;
|
||||
border-radius: 5px;
|
||||
position: relative;
|
||||
|
||||
.uni-icons {
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: -10px !important;
|
||||
font-size: inherit !important;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view class="tabbar">
|
||||
<view :class="[active==4?'active':'']" @click="handleActive(4)">审核中</view>
|
||||
<view :class="[active==5?'active':'']" @click="handleActive(5)">已驳回</view>
|
||||
<view :class="[active==6?'active':'']" @click="handleActive(6)">已发布</view>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="list">
|
||||
<list :isName="false" :isPhone="false" :isState='true' :list="list" @handleDetail="handleDetail"
|
||||
v-if="list.length"></list>
|
||||
<view class="nolist" v-else>
|
||||
<image src="../../static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import list from "@/components/productList.vue"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type: 3,
|
||||
active: 4,
|
||||
page: 1,
|
||||
list: [],
|
||||
lastPage: 1,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
list
|
||||
},
|
||||
onLoad(options) {
|
||||
let that = this
|
||||
this.type = options.type
|
||||
this.handleList()
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.type == 3 ? "我的商品" : '我的供需'
|
||||
});
|
||||
},
|
||||
onReachBottom() {
|
||||
let that = this
|
||||
console.log("this.lastPage", this.lastPage)
|
||||
if (!this.lastPage || this.page >= this.lastPage) {
|
||||
uni.showToast({
|
||||
title: '没有更多数据!',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.page++
|
||||
this.handleList()
|
||||
},
|
||||
methods: {
|
||||
handleList() {
|
||||
let that = this
|
||||
that.$model.getProductListbyuser({
|
||||
status: that.active,
|
||||
pageNo: that.page,
|
||||
pageSize: 10,
|
||||
type: this.type == 3 ? 3 : 9
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
that.list = this.list.concat(res.data.rows)
|
||||
that.lastPage = res.data.totalpage
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleActive(ind) {
|
||||
this.active = ind
|
||||
this.list = []
|
||||
this.page = 1
|
||||
this.handleList()
|
||||
},
|
||||
handleDetail(item) {
|
||||
console.log("详情", item)
|
||||
let that = this
|
||||
that.$model.getProductDetailbyuser({
|
||||
id: item.id,
|
||||
type: item.type
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
res.data.active = that.active
|
||||
res.data.type = item.type
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/me/addNeeds?status=edit&item=" + JSON.stringify(res.data)
|
||||
})
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tabbar {
|
||||
position: fixed;
|
||||
background: #fff;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
view {
|
||||
width: 20%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: $orange;
|
||||
font-weight: bold;
|
||||
border-bottom: 2px solid $orange;
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
margin-top: 50px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,328 @@
|
|||
<template>
|
||||
<view class="box fromClass">
|
||||
<view class="lanBox">
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">所属行业<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<picker mode="selector" :range="industrylist" range-key="name" :value="userInfo.industryname"
|
||||
@change="changeIndustry">
|
||||
<view class="uni-input">{{userInfo.industryname?userInfo.industryname:"请选择"}}</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">所属委员会<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<picker mode="selector" :range="orglist" range-key="name" :value="userInfo.orgname"
|
||||
@change="changeOrg">
|
||||
<view class="uni-input">{{userInfo.orgname?userInfo.orgname:"请选择"}}</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">智造团职务<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<picker mode="selector" :range="poslist" range-key="name" :value="userInfo.posname"
|
||||
@change="changePos">
|
||||
<view class="uni-input">{{userInfo.posname?userInfo.posname:"请选择"}}</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">姓名<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="userInfo.name" placeholder="姓名" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">手机号<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="userInfo.phone" placeholder="手机号" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">个人照片<text class="redcolor">*</text></view>
|
||||
<view class="right touxiang" v-if="userInfo.avatarurl">
|
||||
<image :src="userInfo.avatarurl" mode="aspectFit" @click="handleimage(1)" />
|
||||
<uni-icons type="close" size="26" class="uni-icons" @click="userInfo.avatarurl=''"
|
||||
@click.stop></uni-icons>
|
||||
</view>
|
||||
<view class="right touxiang size20 bold" v-else @click="handleimage(1)">+</view>
|
||||
<text class="size12 c999 desc">请上传1寸蓝底照片,大小不超过2M</text>
|
||||
</view>
|
||||
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">性别<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<picker mode="selector" :range="sexItem" @change="onsexArr">
|
||||
<view class="uni-input">{{userInfo.sex==0?'请选择':userInfo.sex==1?'男':userInfo.sex==2?'女':'未知'}}
|
||||
</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">出生年月<text class="redcolor">*</text></view>
|
||||
<view class="right">
|
||||
<picker class="picker" mode="date" :end="endDate" :value="userInfo.birthday"
|
||||
@change="bindDateChange">
|
||||
<view class="uni-input">{{userInfo.birthday?userInfo.birthday.substring(0,10):"请选择"}}</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">籍贯</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="userInfo.place" placeholder="籍贯" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">邮箱</view>
|
||||
<view class="right">
|
||||
<input name="name" type="text" v-model="userInfo.email" placeholder="请输入邮箱" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">个人爱好</view>
|
||||
<view class="right textarea">
|
||||
<textarea v-model="userInfo.interests" name="content" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">加入智照团想收获什么</view>
|
||||
<checkbox-group @change="checkboxChange" class="checkbox">
|
||||
<label v-for="(ite,ind) in addNeeds" :key="ind">
|
||||
<checkbox :value="ite" style="transform:scale(0.8)" :checked="checkbox.indexOf(ite)!== -1 " />
|
||||
{{ite}}
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
<view class="lan border-bottom">
|
||||
<view class="left">能给平台带来什么</view>
|
||||
<view class="right textarea">
|
||||
<textarea v-model="userInfo.provide" name="content" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="btn" @click="confirmInfo">保存</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
sexItem: [
|
||||
"男",
|
||||
"女"
|
||||
],
|
||||
userInfo: {
|
||||
name: "",
|
||||
phone: "",
|
||||
place: "",
|
||||
provide: "",
|
||||
orgname: "",
|
||||
orgid: "",
|
||||
posname: "",
|
||||
posid: "",
|
||||
birthday: "",
|
||||
industryid: "",
|
||||
industryname: "",
|
||||
sex: "",
|
||||
avatar: "",
|
||||
avatarurl: "",
|
||||
birthday: "",
|
||||
demand: "",
|
||||
email: "",
|
||||
interests: ""
|
||||
},
|
||||
checkbox: [],
|
||||
addNeeds: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user", "HomeContent"]),
|
||||
endDate() {
|
||||
return this.$tools.getDate('start')
|
||||
},
|
||||
industrylist() {
|
||||
return this.HomeContent.industrylist
|
||||
},
|
||||
poslist() {
|
||||
return this.HomeContent.poslist
|
||||
},
|
||||
orglist() {
|
||||
return this.HomeContent.orglist
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
let that = this
|
||||
this.addNeeds = this.$json.addNeeds
|
||||
this.userInfo = this.user.name ? this.user : {}
|
||||
this.userInfo.industryname = this.user.industryid ? this.industrylist[that.industrylist.findIndex(ite => ite
|
||||
.id === that.userInfo.industryid)].name : ''
|
||||
this.checkbox = this.userInfo.demand ? this.userInfo.demand.split(',') : []
|
||||
},
|
||||
methods: {
|
||||
// 提交
|
||||
confirmInfo() {
|
||||
if (!this.userInfo.industryname) {
|
||||
this.$tools.msg("请选择所属行业")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.orgname) {
|
||||
this.$tools.msg("请选择所属委员会")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.posname) {
|
||||
this.$tools.msg("请选择智造团职务")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.name) {
|
||||
this.$tools.msg("请输入姓名")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.phone) {
|
||||
this.$tools.msg("请输入手机号")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.avatarurl) {
|
||||
this.$tools.msg("请上传个人照片")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.sex) {
|
||||
this.$tools.msg("请选择性别")
|
||||
return;
|
||||
}
|
||||
if (!this.userInfo.birthday) {
|
||||
this.$tools.msg("请选择出生日期")
|
||||
return;
|
||||
}
|
||||
console.log("提交", this.userInfo)
|
||||
this.subInfo(this.userInfo);
|
||||
},
|
||||
subInfo(data) {
|
||||
let that = this
|
||||
that.$model.getUserSubmit(data).then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.showToast({
|
||||
title: "修改成功",
|
||||
duration: 2000
|
||||
});
|
||||
that.$store.dispatch("getUserInfo")
|
||||
setTimeout(function() {
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleimage(ind) {
|
||||
let that = this
|
||||
uni.chooseImage({
|
||||
count: 1, //默认9
|
||||
sourceType: ['album', 'camera'], //从相册选择
|
||||
success: function(res) {
|
||||
console.log(res.tempFilePaths[0])
|
||||
uni.showLoading({
|
||||
title: '识别中...'
|
||||
})
|
||||
that.$model.getUpLoadimg({
|
||||
uploadpath: res.tempFilePaths[0]
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res.code == 0) {
|
||||
that.userInfo.avatarurl = res.data.url
|
||||
that.userInfo.avatar = res.data.path
|
||||
} else {
|
||||
that.$tools.msg("不支持该图像")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//确定年龄
|
||||
bindDateChange(e) {
|
||||
this.userInfo.birthday = e.target.value
|
||||
},
|
||||
//确定性别
|
||||
onsexArr(e) {
|
||||
this.userInfo.sex = this.sexItem[e.target.value] == "男" ? 1 : 2
|
||||
},
|
||||
// 所属行业
|
||||
changeIndustry(e) {
|
||||
this.userInfo.industryname = this.HomeContent.industrylist[e.target.value].name
|
||||
this.userInfo.industryid = this.HomeContent.industrylist[e.target.value].id
|
||||
console.log("e", e.target.value)
|
||||
},
|
||||
// 所属委员会
|
||||
changeOrg(e) {
|
||||
this.userInfo.orgname = this.HomeContent.orglist[e.target.value].name
|
||||
this.userInfo.orgid = this.HomeContent.orglist[e.target.value].id
|
||||
console.log("e", e.target.value)
|
||||
},
|
||||
// 制造团职务
|
||||
changePos(e) {
|
||||
this.userInfo.posname = this.HomeContent.poslist[e.target.value].name
|
||||
this.userInfo.posid = this.HomeContent.poslist[e.target.value].id
|
||||
console.log("e", e.target.value, this.HomeContent.poslist[e.target.value])
|
||||
},
|
||||
// 收获
|
||||
checkboxChange(e) {
|
||||
this.userInfo.demand = e.detail.value.join(',')
|
||||
console.log("demand", this.userInfo.demand)
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped="scoped" lang="scss">
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.right {
|
||||
|
||||
/deep/input,
|
||||
/deep/picker,
|
||||
.regions {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
label {
|
||||
width: 33%;
|
||||
display: flex;
|
||||
font-size: 12px;
|
||||
margin: 5px 0;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.touxiang {
|
||||
uni-icons {
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
top: -10px !important;
|
||||
font-size: inherit !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
<template>
|
||||
<view class="content bgfff">
|
||||
<view v-if="content">
|
||||
<!-- 文本 -->
|
||||
<view v-if="content.ptype!=2">
|
||||
<image :src="content.headimg" mode="scaleToFill" class="topimg" v-if="content.headimg"
|
||||
@click="previewImage"></image>
|
||||
<!-- -->
|
||||
<view class="box newsDetail">
|
||||
<view class="title">
|
||||
{{content.title}}
|
||||
</view>
|
||||
<view class="c999 size12">
|
||||
<text class="mr-10">浏览量:{{content.browsecnt}}次</text>
|
||||
<text>点赞:{{content.likecnt}}次</text>
|
||||
</view>
|
||||
<view class="c999 size12">
|
||||
<text>发布时间:{{content.createdtime}}</text>
|
||||
<text class="f-r bold size14" v-if="content.status"
|
||||
:class="[content.status==1?'orangecolor':content.status==2?'bluecolor':'redcolor']">{{content.status==1?'未开始':content.status==2?'进行中':'已结束'}}</text>
|
||||
</view>
|
||||
|
||||
<view class="address" v-if="type==4">
|
||||
<view>活动地点:{{content.province}}{{content.city}}{{content.area}}{{content.address}}</view>
|
||||
<view>活动时间:{{content.starttime}} -{{content.endtime}}</view>
|
||||
<!-- <view>报名形式:这里是文字文字</view> -->
|
||||
<!-- <view>参会人数:200人</view> -->
|
||||
</view>
|
||||
<view class="con">
|
||||
<u-parse :content="content.content"></u-parse>
|
||||
</view>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="foot">
|
||||
<button open-type="share" class="share">
|
||||
<uni-icons type="paperplane" size="22"></uni-icons>
|
||||
<text>分享</text>
|
||||
</button>
|
||||
<view v-if="!content.islike" @click="handleZan">
|
||||
<icon class="iconfont icon-zantong"></icon>
|
||||
<text>点赞</text>
|
||||
</view>
|
||||
<view v-else>
|
||||
<icon class="iconfont icon-zantongfill"></icon>
|
||||
<text>点赞</text>
|
||||
</view>
|
||||
<view class="call" v-if="type==4" @click="$tools.getCall(user.authlist,content.phone)">
|
||||
<icon class="iconfont icon-dianhua1 mr-5"></icon>拨打电话
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- H5 -->
|
||||
<view class="" v-if="content.ptype==2">
|
||||
<web-view :src="content.content"></web-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nolist" v-else>
|
||||
<image src="@/static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
<!-- 秘书处弹框 -->
|
||||
<secratary></secratary>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import uParse from '@/uni_modules/u-parse/u-parse.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type: 1,
|
||||
content: null
|
||||
}
|
||||
},
|
||||
components: {
|
||||
uParse
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user"]),
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log("资讯", options)
|
||||
this.type = options.type
|
||||
this.handleActive(options.id)
|
||||
uni.showShareMenu({
|
||||
withShareTicket: true,
|
||||
menus: ["shareAppMessage"]
|
||||
})
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
let that = this
|
||||
return {
|
||||
title: that.content.title,
|
||||
path: '/pageTwo/news/detail?id=' + that.content.id + '&type=' + that.type,
|
||||
imageUrl: that.content.headimg,
|
||||
success: function(res) {
|
||||
console.log("分享到朋友成功")
|
||||
},
|
||||
fail: function(res) {
|
||||
console.log("分享到朋友失败")
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleActive(id) {
|
||||
let that = this
|
||||
let account = {
|
||||
id: id,
|
||||
type: that.type
|
||||
}
|
||||
let https = ""
|
||||
if (that.type == 1 || that.type == 5 || that.type == 6 || that.type == 7) {
|
||||
https = that.$model.getInfoDetail(account)
|
||||
} else if (that.type == 4) {
|
||||
https = that.$model.getCampaignDetail(account)
|
||||
}
|
||||
return https.then((res) => {
|
||||
if (res.code != 0) return
|
||||
this.content = res.data
|
||||
})
|
||||
},
|
||||
previewImage() {
|
||||
let that = this
|
||||
let image = []
|
||||
image.push(that.content.headimg)
|
||||
uni.previewImage({
|
||||
urls: image,
|
||||
current: 0,
|
||||
}).catch((e) => {
|
||||
console.log(e) //用catch(e)来捕获错误{makePhoneCall:fail cancel}
|
||||
});
|
||||
},
|
||||
handleZan() {
|
||||
console.log("点赞")
|
||||
this.$model.getLike({
|
||||
id: this.content.id,
|
||||
type: this.type
|
||||
}).then(res => {
|
||||
this.content.islike = true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.nolist {
|
||||
padding-top: 40%;
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding-bottom: 70px;
|
||||
}
|
||||
|
||||
.topimg {
|
||||
width: 750rpx;
|
||||
height: 381rpx;
|
||||
}
|
||||
|
||||
.icon-zantongfill {
|
||||
color: $red;
|
||||
}
|
||||
|
||||
.foot {
|
||||
height: 50px;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 0 15px;
|
||||
padding-bottom: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
justify-content: space-between;
|
||||
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
||||
|
||||
icon {
|
||||
font-size: 20px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
view {
|
||||
width: 30%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
text {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.call {
|
||||
width: 120px !important;
|
||||
color: #000;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
margin-left: 10px;
|
||||
float: right;
|
||||
background-color: #E6C8A2;
|
||||
}
|
||||
|
||||
/deep/button {
|
||||
width: 30%;
|
||||
padding: 0;
|
||||
line-height: 20px;
|
||||
font-size: 14px;
|
||||
background: #fff;
|
||||
margin: 0;
|
||||
|
||||
}
|
||||
|
||||
button:after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
<template>
|
||||
<view class="content bgfff">
|
||||
|
||||
<!-- 列表 -->
|
||||
<view class="box">
|
||||
<list :isAddress="type" :list="newsList" v-if="newsList.length"></list>
|
||||
<view class="nolist" style="margin-top: 15px;" v-if="!newsList.length">
|
||||
<image src="@/static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import list from "@/components/newsList.vue"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type: 1, //1资讯列表,4活动列表,6党建专栏
|
||||
page: 1,
|
||||
lastPage: 1,
|
||||
newsList: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(["InfoList"]),
|
||||
},
|
||||
components: {
|
||||
list,
|
||||
},
|
||||
onLoad(options) {
|
||||
let that = this
|
||||
this.type = options.type
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.type == 1 ? "资讯列表" : this.type == 4 ? '活动列表' : '党建专栏'
|
||||
});
|
||||
this.handleInfoList(that.page)
|
||||
},
|
||||
onReachBottom() {
|
||||
let that = this
|
||||
console.log("this.lastPage", this.lastPage)
|
||||
if (!this.lastPage || this.page >= this.lastPage) {
|
||||
uni.showToast({
|
||||
title: '没有更多数据!',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.page++
|
||||
this.handleInfoList(that.page)
|
||||
},
|
||||
methods: {
|
||||
handleInfoList(searchValue, page) {
|
||||
let that = this
|
||||
let account = {
|
||||
pageNo: page,
|
||||
pageSize: 10,
|
||||
}
|
||||
let https = this.type == 1 ? that.$model.getinfolist(account) : this.type == 4 ? that.$model
|
||||
.getCampaignList(account) : that.$model.getPartyList(account)
|
||||
return https.then((res) => {
|
||||
// console.log("资讯列表", res)
|
||||
if (res.code != 0) return
|
||||
that.newsList = this.newsList.concat(res.data.rows)
|
||||
that.lastPage = res.data.totalpage
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.box {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.marginTop {
|
||||
margin-top: 85px;
|
||||
}
|
||||
|
||||
.tabbar {
|
||||
width: 100%;
|
||||
margin-top: 75px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
|
||||
view {
|
||||
font-size: 16px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding: 0 25px;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
.active {
|
||||
color: $blue;
|
||||
font-weight: bold;
|
||||
border-bottom: 2px solid $blue;
|
||||
}
|
||||
}
|
||||
|
||||
.tabbar::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
height: 40px;
|
||||
width: 1px;
|
||||
background-color: #dfdfdf;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view v-if="content">
|
||||
<view class="info">
|
||||
<view class="name">
|
||||
<image :src="content.userinfo.avatar" class="mr-10" mode="aspectFit"></image>
|
||||
<view class="bold size16 mr-10">{{content.userinfo.name}}</view>
|
||||
<text class="post">{{content.userinfo.posname}}</text>
|
||||
</view>
|
||||
<view class="call" @click="$tools.getCall(user.authlist,content.userinfo.phone)">
|
||||
<icon class="iconfont icon-dianhua1 mr-10"></icon>
|
||||
拨打电话
|
||||
</view>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="newsDetail box">
|
||||
<view class="title">
|
||||
{{content.title}}
|
||||
</view>
|
||||
<view v-if="type!=9">
|
||||
<text class="redcolor size14 mr-10 bold">会员价:¥{{content.vipprice}}</text>
|
||||
<text class="c999 size12">市场价:¥{{content.price}}</text>
|
||||
</view>
|
||||
<view class="c999 size12" v-if="type!=9">
|
||||
地址:{{content.province}}{{content.city}}{{content.area}}{{content.address}}</view>
|
||||
<view class="c999 size12">
|
||||
浏览量:{{content.browsecnt}}次
|
||||
</view>
|
||||
<view class="image" v-if="type!=9" v-for="(ite,ind) in content.pics">
|
||||
<image :src="ite.url" mode="widthFix" @click="previewImage(ind)"></image>
|
||||
</view>
|
||||
<view class="con mt-15">
|
||||
{{content.desc}}
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- 秘书处弹框 -->
|
||||
<secratary></secratary>
|
||||
</view>
|
||||
<view class="nolist" v-else>
|
||||
<image src="@/static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
content: null,
|
||||
type: 3,
|
||||
id: "",
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.id = options.id
|
||||
this.type = options.type
|
||||
this.handleDetail(options.id, options.type)
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user"]),
|
||||
},
|
||||
methods: {
|
||||
previewImage(ind) {
|
||||
let that = this
|
||||
console.log("pics", that.content.pics.map(item => item.url))
|
||||
uni.previewImage({
|
||||
urls: that.content.pics.map(item => item.url),
|
||||
current: ind
|
||||
}).catch((e) => {
|
||||
console.log(e) //用catch(e)来捕获错误{makePhoneCall:fail cancel}
|
||||
});
|
||||
},
|
||||
// 详情
|
||||
handleDetail(id, type) {
|
||||
let that = this
|
||||
that.$model.getProductDetail({
|
||||
id: id,
|
||||
type: type
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
that.content = res.data
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.newsDetail {
|
||||
width: calc(100% - 30px);
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
height:auto;
|
||||
text-align: center;
|
||||
margin-top: 5px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.info {
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 5px 10px;
|
||||
margin-bottom: 15px;
|
||||
border-radius: 10px;
|
||||
|
||||
.name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.post {
|
||||
color: #fff;
|
||||
background: $orange;
|
||||
padding: 2px 10px;
|
||||
border-radius: 5px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.call {
|
||||
height: 35px;
|
||||
display: flex;
|
||||
background: #E6C8A2;
|
||||
padding: 0px 10px;
|
||||
border-radius: 5px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #f7f7f7;
|
||||
padding: 5px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,249 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<!-- 搜索 -->
|
||||
<piker-search @handleSearch="handleSearch" :placeholder='type==3?"找商品":"找供应"' :width="'100'"
|
||||
:isAddress="true"></piker-search>
|
||||
|
||||
<!-- 供求信息 -->
|
||||
<view class="tabbar" v-if="type!=3">
|
||||
<view :class="[active==1?'active':'']" @click="handleActive(1)">供货大厅</view>
|
||||
<view :class="[active==2?'active':'']" @click="handleActive(2)">采购大厅</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表 -->
|
||||
<view class="box" :class="[type==3?'marginTop':'']">
|
||||
<list :isName="true" :list="list" :isMoney="isMoney" @handleDetail="handleDetail" v-if="list.length"></list>
|
||||
<view class="nolist" v-else>
|
||||
<image src="../../static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 发布 -->
|
||||
<view class="fabu" @click="handlefabu">
|
||||
<uni-icons type="paperplane" color="#fff" size="30"></uni-icons>
|
||||
<text>发布</text>
|
||||
</view>
|
||||
<!-- 秘书处弹框 -->
|
||||
<secratary></secratary>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import pikerSearch from "../../components/search.vue"
|
||||
import list from "@/components/productList.vue"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type: 1, //1商品展示,2供求信息
|
||||
page: 1,
|
||||
list: [],
|
||||
lastPage: 1,
|
||||
active: 1,
|
||||
isMoney: true,
|
||||
name: "",
|
||||
province: "",
|
||||
city: "",
|
||||
industryid: "",
|
||||
token: ""
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user"]),
|
||||
},
|
||||
components: {
|
||||
list,
|
||||
pikerSearch
|
||||
},
|
||||
onLoad(options) {
|
||||
let that = this
|
||||
this.type = options.type
|
||||
this.handleList()
|
||||
that.token = uni.getStorageSync('token')
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.type == 3 ? "商品展示" : '供求信息'
|
||||
});
|
||||
},
|
||||
onReachBottom() {
|
||||
let that = this
|
||||
console.log("this.lastPage", this.lastPage)
|
||||
if (!this.lastPage || this.page >= this.lastPage) {
|
||||
uni.showToast({
|
||||
title: '没有更多数据!',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.page++
|
||||
this.handleList()
|
||||
},
|
||||
methods: {
|
||||
handleActive(ind) {
|
||||
this.active = ind
|
||||
this.list = []
|
||||
this.isMoney = ind == 1 ? true : false
|
||||
this.handleList()
|
||||
},
|
||||
// 列表
|
||||
handleList() {
|
||||
let that = this
|
||||
that.$model.getProductList({
|
||||
name: that.name,
|
||||
province: that.province,
|
||||
city: that.city,
|
||||
industryid: that.industryid,
|
||||
pageNo: that.page,
|
||||
pageSize: 10,
|
||||
type: this.type == 3 ? 3 : this.active == 1 ? 8 : 9
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
that.list = this.list.concat(res.data.rows)
|
||||
that.lastPage = res.data.totalpage
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 发布
|
||||
handlefabu() {
|
||||
let that = this
|
||||
let type = this.type == 3 ? 3 : this.active == 1 ? 8 : 9
|
||||
if (!uni.getStorageSync('token')) {
|
||||
that.$tools.msg("登录后查看更多")
|
||||
return
|
||||
}
|
||||
if (type == 3 || type == 8) {
|
||||
if (that.user.authlist.length) {
|
||||
for (var i = 0; i < that.user.authlist.length; i++) {
|
||||
let ite = that.user.authlist[i]
|
||||
if (ite.code.indexOf('product:submit') != -1 || ite.code.indexOf('supply:submit') != -1) {
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/me/addNeeds?status=add&type=" + type
|
||||
})
|
||||
}
|
||||
break
|
||||
}
|
||||
} else {
|
||||
that.$store.commit("changeSecratary", true);
|
||||
}
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/me/addNeeds?status=add&type=" + type
|
||||
})
|
||||
}
|
||||
console.log("发布")
|
||||
},
|
||||
// 详情
|
||||
handleDetail(item) {
|
||||
let that = this
|
||||
let type = this.type == 3 ? 3 : this.active == 1 ? 8 : 9
|
||||
console.log("详情", this.active)
|
||||
// if (!uni.getStorageSync('token')) {
|
||||
// that.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
that.$model.getProductDetail({
|
||||
id: item.id,
|
||||
type: type
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
res.data.type = type
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/product/detail?type=" + type + '&id=' + item.id
|
||||
})
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
// 搜索
|
||||
handleSearch(name, province, city, industryid) {
|
||||
let that = this
|
||||
// if (!uni.getStorageSync('token')) {
|
||||
// that.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
this.name = name
|
||||
this.province = province
|
||||
this.city = city
|
||||
this.industryid = industryid
|
||||
this.list = []
|
||||
this.page = 1
|
||||
console.log("搜索返回", this.name, this.province, this.city, this.industryid)
|
||||
this.handleList()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.box {
|
||||
width: 100%;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.marginTop {
|
||||
margin-top: 85px;
|
||||
}
|
||||
|
||||
.tabbar {
|
||||
width: 100%;
|
||||
margin-top: 75px;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
|
||||
view {
|
||||
font-size: 16px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding: 0 25px;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
.active {
|
||||
color: $blue;
|
||||
font-weight: bold;
|
||||
border-bottom: 2px solid $blue;
|
||||
}
|
||||
}
|
||||
|
||||
.fabu {
|
||||
position: fixed;
|
||||
right: 15px;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
color: #E8CDA9;
|
||||
background: #2C2C34;
|
||||
bottom: 20%;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0px 1px 5px 2px #383a39fc;
|
||||
|
||||
text {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-top: -15px;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.tabbar::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
height: 40px;
|
||||
width: 1px;
|
||||
background-color: #dfdfdf;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
{
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "智造团线上平台"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/me/me",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "pages/phoneList/phoneList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "企业名录",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "pages/phoneList/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "企业名录",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "pages/index/fengCai",
|
||||
"style": {
|
||||
"navigationBarTitleText": "领导风采",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "pages/index/searchList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "搜索",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [{
|
||||
"root": "pageTwo",
|
||||
"pages": [{
|
||||
"path": "login/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "login/add",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我要加入智造团",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "login/editPassword",
|
||||
"style": {
|
||||
"navigationBarTitleText": "修改密码",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "index/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "详情",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "product/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品展示",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}, {
|
||||
"path": "product/list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "news/list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "news/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "详情",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "me/company",
|
||||
"style": {
|
||||
"navigationBarTitleText": "企业简介",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "me/user",
|
||||
"style": {
|
||||
"navigationBarTitleText": "个人简介",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "me/needs",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的需求",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}, {
|
||||
"path": "me/addNeeds",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品添加",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}]
|
||||
}],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarTitleText": "uni-app",
|
||||
"navigationBarBackgroundColor": "#345A9B",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#333",
|
||||
"selectedColor": "#345A9B",
|
||||
"backgroundColor": "#fff",
|
||||
"list": [{
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "static/index.png",
|
||||
"selectedIconPath": "static/index01.png",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/phoneList/phoneList",
|
||||
"iconPath": "static/phone.png",
|
||||
"selectedIconPath": "static/phone01.png",
|
||||
"text": "通讯录"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/me/me",
|
||||
"iconPath": "static/me.png",
|
||||
"selectedIconPath": "static/me01.png",
|
||||
"text": "我的"
|
||||
}
|
||||
]
|
||||
},
|
||||
"uniIdRouter": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<!-- 搜索 -->
|
||||
<piker-search @handleSearch="handleSearch" :placeholder='"找领导"' :width="'100'" :isAddress="false" :isPost="true"
|
||||
:isWork="false"></piker-search>
|
||||
|
||||
<!-- -->
|
||||
<view class="box">
|
||||
<view class="list" v-for="(ite,ind) in list" :key="ind" @click="handledetail(ite)" v-if="list.length">
|
||||
<view class="left">
|
||||
<image :src="ite.avatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>
|
||||
<text class="name">{{ite.name}}</text>
|
||||
<text class="post">{{ite.posname}}</text>
|
||||
</view>
|
||||
<view class="c999 place">{{ite.composname}}<text v-if="ite.place" class="ml-5 mr-5">|</text>{{ite.place}}</view>
|
||||
<view class="c999">{{ite.mobile}}</view>
|
||||
<view class="c999">{{ite.province}}{{ite.city}}{{ite.area}}{{ite.address}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nolist" v-if="!list.length">
|
||||
<image src="../../static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pikerSearch from "../../components/search.vue"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
name: "",
|
||||
province: "",
|
||||
city: "",
|
||||
industryid: "",
|
||||
list: [],
|
||||
page: 1,
|
||||
lastPage: 1,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
pikerSearch
|
||||
},
|
||||
onLoad() {
|
||||
this.handleVipList()
|
||||
},
|
||||
onReachBottom() {
|
||||
let that = this
|
||||
if (!this.lastPage || this.page >= this.lastPage) {
|
||||
uni.showToast({
|
||||
title: '没有更多数据!',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.page++
|
||||
this.handleVipList()
|
||||
},
|
||||
methods: {
|
||||
// 领导风采
|
||||
handleVipList() {
|
||||
let that = this
|
||||
that.$model.getVipList({
|
||||
name: that.name,
|
||||
pageNo: that.page,
|
||||
pageSize: 10,
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.list = this.list.concat(res.data.rows)
|
||||
that.lastPage = res.data.totalpage
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSearch(name) {
|
||||
let that = this
|
||||
// if (!uni.getStorageSync('token')) {
|
||||
// that.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
this.name = name
|
||||
this.list = []
|
||||
this.page = 1
|
||||
this.handleVipList()
|
||||
},
|
||||
// 详情
|
||||
handledetail(ite) {
|
||||
let that = this
|
||||
// if (!uni.getStorageSync('token')) {
|
||||
// that.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url: "/pages/phoneList/detail?id=" + ite.id
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
.box {
|
||||
margin-top: 35px;
|
||||
width: 100%;
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #dfdfdf;
|
||||
|
||||
.left {
|
||||
width: 85px;
|
||||
height: 110px;
|
||||
border: 1px solid #dfdfdf;
|
||||
|
||||
}
|
||||
|
||||
.right {
|
||||
margin-left: 10px;
|
||||
width: calc(100% - 100px);
|
||||
height: 112px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
view {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.name {
|
||||
color: #000;
|
||||
font-size: 16px;
|
||||
margin-right: 10px;
|
||||
font-weight: bold;
|
||||
max-width: 50%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.post {
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
background-color: #F7B133;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
padding: 2px 10px;
|
||||
border-radius: 5px;
|
||||
color: #fff;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.place {
|
||||
text {
|
||||
position: inherit;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,503 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<!-- 搜索 -->
|
||||
<view class="head" v-if="token">
|
||||
<piker-search @handleSearch="handleSearch" :placeholder='"找客户/找产品/找供应"' :width="'60'"></piker-search> -->
|
||||
<view class="fangke">
|
||||
<icon class="iconfont icon-remen"></icon>
|
||||
<text>今日访客:{{todayviewer}}人</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="login" @click="handleLogin">
|
||||
登录后查看更多内容资讯,点击此处<text>登录</text>
|
||||
</view>
|
||||
<!-- banner -->
|
||||
<view class="tips" :style="{'margin':!token?'0':'110rpx 0 10px'}">
|
||||
<text v-if="token&&!mobile" @click="navTo('/pageTwo/me/company')">请尽快完善企业信息</text>
|
||||
</view>
|
||||
<view class="f_banner">
|
||||
<view v-if="fimages.length">
|
||||
<swiper class="swiper" indicator-dots="true" autoplay="true">
|
||||
<swiper-item v-for="(image, index) in fimages" :key="index" @click="detail(image.id,5)">
|
||||
<image :src="image.headimg" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 公告 -->
|
||||
<view class="notice">
|
||||
<text>头条</text>
|
||||
<!-- -->
|
||||
<swiper class="swiper" vertical="true" autoplay="true">
|
||||
<swiper-item v-for="(item,index) in notices" :key="index" @click="detail(item.id,6)">
|
||||
<view class='overflow'>{{item.title}}</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
</view>
|
||||
<!-- 工具 -->
|
||||
<view class="tools">
|
||||
<view class="item" v-for="(item,index) in tools" :key="index" @click="handlePath(index,item.path)">
|
||||
<image :src="item.src"></image>
|
||||
<text>{{item.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 简介 -->
|
||||
<view class="f_banner" style="margin-top: 15px;">
|
||||
<view v-if="HomeContent&¢erList.length">
|
||||
<swiper class="swiper" autoplay="true">
|
||||
<swiper-item v-for="(image, index) in centerList" :key="index" @click="detail(image.id,5)">
|
||||
<image :src="image.headimg" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 风采 -->
|
||||
<view class="tools fengcai" v-if="list.length">
|
||||
<view class="title" @click="navTo('/pages/index/fengCai')">
|
||||
<text class="ml-10">领导风采</text>
|
||||
<text class="mr-10">查看更多></text>
|
||||
</view>
|
||||
<view class="item mt-15" v-for="(item,index) in list" :key="index" @click="handleDetail(item)">
|
||||
<image :src="item.avatar"></image>
|
||||
<view class="name">{{item.name}}</view>
|
||||
<view class="post">{{item.posname}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 资讯活动 -->
|
||||
<view class="zixun">
|
||||
<view class="title mt-10" @click="navTo('/pageTwo/news/list?type=1')">
|
||||
<text>资讯活动</text>
|
||||
<text v-if="newsList.length">查看更多></text>
|
||||
</view>
|
||||
<list :isAddress="1" :list="newsList" v-if="newsList.length"></list>
|
||||
<view class="nolist" style="margin-top: 15px;" v-if="!newsList.length">
|
||||
<image src="@/static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 客服 -->
|
||||
<message></message>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import list from "@/components/newsList.vue"
|
||||
import pikerSearch from "../../components/search.vue"
|
||||
import UniNoticeBar from "../../uni_modules/uni-notice-bar/uni-notice-bar.vue"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
token: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user", "HomeContent", 'InfoList']),
|
||||
mobile() {
|
||||
return this.user.name ? this.user.cominfo.mobile : ''
|
||||
},
|
||||
centerList() {
|
||||
return this.HomeContent ? this.HomeContent.centerbannerlist : []
|
||||
},
|
||||
todayviewer() {
|
||||
return this.HomeContent ? this.HomeContent.todayviewer : []
|
||||
},
|
||||
fimages() {
|
||||
return this.HomeContent ? this.HomeContent.bannerlist : []
|
||||
},
|
||||
notices() {
|
||||
return this.HomeContent ? this.HomeContent.noticelist : []
|
||||
},
|
||||
newsList() {
|
||||
return this.InfoList.rows ? this.InfoList.rows : []
|
||||
},
|
||||
tools() {
|
||||
return this.$json.tools
|
||||
},
|
||||
},
|
||||
components: {
|
||||
list,
|
||||
pikerSearch,
|
||||
UniNoticeBar
|
||||
},
|
||||
async onLoad() {
|
||||
let that = this
|
||||
await that.login()
|
||||
that.token = uni.getStorageSync('token')
|
||||
that.$store.dispatch('getInfoList', {
|
||||
searchValue: "",
|
||||
pageNo: 1,
|
||||
pageSize: 3,
|
||||
})
|
||||
that.handleVipList()
|
||||
},
|
||||
methods: {
|
||||
login() {
|
||||
let that = this
|
||||
uni.login({
|
||||
success(res) {
|
||||
if (res.code) {
|
||||
if (res.errMsg = "login:ok") {
|
||||
that.$model.onlogin({
|
||||
code: res.code,
|
||||
}).then(res => {
|
||||
if (res.code == 2) {
|
||||
that.token = null
|
||||
uni.clearStorageSync()
|
||||
uni.setStorageSync('sessionid', res.data.sessionid)
|
||||
return
|
||||
}
|
||||
if (res.code == 0) {
|
||||
that.token = res.data.token
|
||||
uni.setStorageSync('token', res.data.token)
|
||||
uni.setStorageSync('refreshtoken', res.data.refreshtoken)
|
||||
uni.setStorageSync('sessionid', res.data.sessionid)
|
||||
that.$store.dispatch("getUserInfo")
|
||||
}
|
||||
}).catch(e => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 领导风采
|
||||
handleVipList() {
|
||||
let that = this
|
||||
that.$model.getVipList({
|
||||
pageNo: 1,
|
||||
pageSize: 6,
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.list = res.data.rows
|
||||
}
|
||||
})
|
||||
},
|
||||
// 领导风采详情
|
||||
handleDetail(ite) {
|
||||
let that = this
|
||||
// if (!that.token) {
|
||||
// that.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url: "/pages/phoneList/detail?id=" + ite.id
|
||||
})
|
||||
},
|
||||
|
||||
// 全局搜索
|
||||
handleSearch(ite) {
|
||||
let that = this
|
||||
console.log("搜索信息返回", ite)
|
||||
// if (!that.token) {
|
||||
// that.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url: "/pages/index/searchList?ite=" + ite
|
||||
})
|
||||
},
|
||||
// 工具栏跳转
|
||||
handlePath(ind, url) {
|
||||
let that = this
|
||||
if (ind == 3) {
|
||||
uni.switchTab({
|
||||
url: url
|
||||
})
|
||||
} else if (ind == 2) {
|
||||
uni.navigateTo({
|
||||
url: url + "?content=2"
|
||||
})
|
||||
} else {
|
||||
this.navTo(url)
|
||||
}
|
||||
},
|
||||
// 轮播、公告、资讯详情
|
||||
detail(id, type) {
|
||||
let that = this
|
||||
// if (!that.token) {
|
||||
// that.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
return that.$model.getInfoDetail({
|
||||
id: id,
|
||||
type: type
|
||||
}).then((res) => {
|
||||
console.log("资讯列表", res)
|
||||
if (res.code != 0) return
|
||||
res.data.type = type
|
||||
that.$tools.NewsPtype(res.data)
|
||||
|
||||
})
|
||||
},
|
||||
// 登录
|
||||
handleLogin() {
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/login/login"
|
||||
})
|
||||
},
|
||||
navTo(url, ) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.head {
|
||||
height: 35px;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 0 10px 10px;
|
||||
z-index: 9;
|
||||
background-color: $blue;
|
||||
}
|
||||
|
||||
.login {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
border-radius: 5px;
|
||||
|
||||
text {
|
||||
color: $blue;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-left: 5px;
|
||||
padding: 0 3px;
|
||||
border-bottom: 1px solid $blue;
|
||||
}
|
||||
}
|
||||
|
||||
.fangke {
|
||||
position: fixed;
|
||||
z-index: 9;
|
||||
color: #fff;
|
||||
right: 10px;
|
||||
top: 0px;
|
||||
font-size: 12px;
|
||||
line-height: 35px;
|
||||
display: flex;
|
||||
|
||||
icon {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
// banner
|
||||
.f_banner {
|
||||
width: 100%;
|
||||
height: 240rpx;
|
||||
|
||||
/deep/swiper {
|
||||
height: 240rpx;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-size: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.notice {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
margin-top: 10px;
|
||||
border-radius: 10px;
|
||||
|
||||
text {
|
||||
width: 60px;
|
||||
font-size: 18px;
|
||||
color: $red;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
border-right: 1px solid #dfdfdf;
|
||||
}
|
||||
|
||||
/deep/swiper {
|
||||
width: calc(100% - 15px);
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
margin-left: 15px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.tools {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
border-radius: 10px;
|
||||
background-color: #fff;
|
||||
|
||||
.item {
|
||||
width: 25%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
padding-bottom: 10px;
|
||||
|
||||
text {
|
||||
width: 100%;
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
}
|
||||
}
|
||||
|
||||
.jianjie {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
height: 100px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-size: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
width: 100%;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
color: #000;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.fengcai {
|
||||
.item {
|
||||
width: 20%;
|
||||
|
||||
image {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.name,
|
||||
.post {
|
||||
width: 90%;
|
||||
margin-top: 5px;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.post {
|
||||
background-color: #F7B133;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
padding: 2px 0;
|
||||
border-radius: 5px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.zixun {
|
||||
width: calc(100% - 20px);
|
||||
background: #fff;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 15px;
|
||||
padding: 0 10px;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 15px 10px 0;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #f7f7f7;
|
||||
|
||||
.left {
|
||||
width: calc(100% - 115px);
|
||||
height: 70px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-flow: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.time {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
|
||||
view {
|
||||
display: flex;
|
||||
font-size: 12px;
|
||||
align-items: center;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 105px;
|
||||
height: 70px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
width: 100%;
|
||||
|
||||
text {
|
||||
width: 100%;
|
||||
color: #f5222d;
|
||||
background: #fff1f0;
|
||||
border: 1px solid #ffa39e;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
border-radius: 5px;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,327 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<!-- 搜索 -->
|
||||
<view class="serachBox">
|
||||
<view class="serach-box">
|
||||
<view class="searchInput">
|
||||
<input placeholder="请输入关键字进行搜索 " class="city-serach-input" v-model="name" />
|
||||
<uni-icons v-if="name" @click="handlecolse()" type="close" size="26px"></uni-icons>
|
||||
</view>
|
||||
<view class="searchBtn" @click="handleSerach">
|
||||
<icon class="iconfont icon-icon-test2 size20"></icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="box" v-if="name">
|
||||
为您展示包含“<text class="bold orangecolor">{{name}}</text>”的内容
|
||||
</view>
|
||||
<view class="list" v-for="(ite,ind) in list" @click="handledetail(ite)" v-if="list.length">
|
||||
<!-- 资讯 -->
|
||||
<view class="newslist" v-if="ite.ptype==1||ite.ptype==4||ite.ptype==7">
|
||||
<view class="right">
|
||||
<image :src="ite.data.headimg" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="left">
|
||||
<view class="title">
|
||||
{{ite.data.title}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="time" v-if="ite.ptype!=4">
|
||||
<view class="mr-10 size12 c999">
|
||||
<icon class="iconfont icon-icon-test1"></icon>
|
||||
{{ite.data.createdtime}}
|
||||
</view>
|
||||
<view class="size12 c999">
|
||||
<icon class="iconfont icon-icon-test"></icon>
|
||||
{{ite.data.browsecnt}}次浏览
|
||||
</view>
|
||||
</view>
|
||||
<view class="time" v-if="ite.ptype==4">
|
||||
<view class="mr-10">
|
||||
<uni-icons type="location-filled" size="20"></uni-icons>
|
||||
{{ite.data.province}}{{ite.data.city}}{{ite.data.area}}{{ite.data.address}}
|
||||
</view>
|
||||
<view>
|
||||
<icon class="iconfont icon-icon-test1"></icon>
|
||||
{{ite.data.starttime}}至{{ite.data.endtime}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品、供需 -->
|
||||
<view class="productList" v-if="ite.ptype==3||ite.ptype==8||ite.ptype==9">
|
||||
<view class="name">
|
||||
<view class="post">
|
||||
<image :src="ite.data.userinfo.avatar" class="mr-10"></image>
|
||||
<view class="bold size16 mr-10">{{ite.data.userinfo.name}}</view>
|
||||
<text>{{ite.data.userinfo.posname}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="bold size16 title">
|
||||
{{ite.data.title}}
|
||||
</view>
|
||||
<view class="mt-5 c999 size12">{{ite.data.desc}}</view>
|
||||
<view class="image" v-if="ite.ptype!=9">
|
||||
<image v-for="(it,id) in ite.data.pics" :src="it.url" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="address" v-if="ite.ptype!=9">
|
||||
<text class="mr-10">行业:{{ite.data.industryname}}</text>
|
||||
<text>地址:{{ite.data.province}}{{ite.data.city}}{{ite.data.area}}{{ite.data.address}}</text>
|
||||
</view>
|
||||
<view class="money mt-10" v-if="ite.ptype!=9">
|
||||
<text class="redcolor size16 mr-5 bold">会员价:¥{{ite.data.vipprice}}</text>
|
||||
<text class="size12 c999">市场价:¥{{ite.data.price}}</text>
|
||||
<text class="call" @click="$tools.getCall(user.authlist,ite.data.userinfo.phone)">
|
||||
<icon class="iconfont icon-dianhua1 mr-10"></icon>
|
||||
拨打电话
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 企业名录 -->
|
||||
<view class="phonelist" v-if="ite.ptype==2">
|
||||
<view class="left">
|
||||
<image src="../../static/logo.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="name">
|
||||
<text>{{ite.data.username}}</text>{{ite.data.pos}}
|
||||
</view>
|
||||
<view class="corporate c999">{{ite.data.name}}</view>
|
||||
</view>
|
||||
<view class="tell" @click="$tools.getCall(user.authlist,ite.data.mobile)">
|
||||
<image src="../../static/tall.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 领导风采 -->
|
||||
<view class="fenglist" v-if="ite.ptype==10">
|
||||
<view class="left">
|
||||
<image :src="ite.data.avatar" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>
|
||||
<text class="name">{{ite.data.name}}</text>
|
||||
<text class="post">{{ite.data.posname}}</text>
|
||||
</view>
|
||||
<view class="c999 place">{{ite.data.composname}}<text v-if="ite.place"
|
||||
class="ml-5 mr-5">|</text>{{ite.place}}</view>
|
||||
<view class="c999">{{ite.data.mobile}}</view>
|
||||
<view class="c999">{{ite.data.province}}{{ite.data.city}}{{ite.data.area}}{{ite.data.address}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nolist" v-if="!list.length">
|
||||
<image src="../../static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
<!-- 秘书处弹框 -->
|
||||
<secratary></secratary>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
page: 1,
|
||||
lastPage: 1,
|
||||
name: "",
|
||||
image: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user"]),
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log(options.ite)
|
||||
this.name = options.ite
|
||||
this.handleList()
|
||||
},
|
||||
onReachBottom() {
|
||||
let that = this
|
||||
if (!this.lastPage || this.page >= this.lastPage) {
|
||||
uni.showToast({
|
||||
title: '没有更多数据!',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.page++
|
||||
this.handleList()
|
||||
},
|
||||
methods: {
|
||||
// 搜索
|
||||
handleSerach() {
|
||||
let that = this
|
||||
that.page = 1
|
||||
that.list = []
|
||||
that.handleList()
|
||||
},
|
||||
//取消搜索
|
||||
handlecolse() {
|
||||
let that = this
|
||||
that.name = ""
|
||||
that.page = 1
|
||||
that.list = []
|
||||
that.handleList()
|
||||
},
|
||||
// 列表
|
||||
handleList() {
|
||||
let that = this
|
||||
return that.$model.getSearchList({
|
||||
keyword: that.name,
|
||||
pageNo: that.page,
|
||||
pageSize: 10,
|
||||
}).then((res) => {
|
||||
console.log("搜索列表", res)
|
||||
if (res.code != 0) return
|
||||
that.list = this.list.concat(res.data.rows)
|
||||
that.lastPage = res.data.totalpage
|
||||
|
||||
})
|
||||
},
|
||||
// 详情
|
||||
handledetail(ite) {
|
||||
let that = this
|
||||
// 资讯,活动,党建
|
||||
if (ite.ptype == 1 || ite.ptype == 4 || ite.ptype == 7) {
|
||||
that.handleActive(ite.ptype, ite.sid)
|
||||
return
|
||||
}
|
||||
// 商品,供货,需求
|
||||
if (ite.ptype == 3 || ite.ptype == 8 || ite.ptype == 9) {
|
||||
that.handleDetail(ite.ptype, ite.sid)
|
||||
return
|
||||
}
|
||||
//企业名录,领导风采
|
||||
if (ite.ptype == 2 || ite.ptype == 10) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/phoneList/detail?id=" + ite.sid
|
||||
})
|
||||
return
|
||||
}
|
||||
},
|
||||
// 资讯详情
|
||||
handleActive(type, id) {
|
||||
let that = this
|
||||
return that.$model.getInfoDetail({
|
||||
id: id,
|
||||
type: type
|
||||
}).then((res) => {
|
||||
console.log("资讯列表", res)
|
||||
if (res.code != 0) return
|
||||
res.data.type = type
|
||||
that.$tools.NewsPtype(res.data)
|
||||
|
||||
})
|
||||
},
|
||||
// 商品详情
|
||||
handleDetail(type, id) {
|
||||
let that = this
|
||||
that.$model.getProductDetail({
|
||||
id: id,
|
||||
type: type
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
res.data.type = type
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/product/detail?type=" + type + '&id=' + id
|
||||
})
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.box {
|
||||
margin-top: 45px;
|
||||
}
|
||||
|
||||
.fenglist {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #dfdfdf;
|
||||
|
||||
.left {
|
||||
width: 85px;
|
||||
height: 110px;
|
||||
border: 1px solid #dfdfdf;
|
||||
|
||||
}
|
||||
|
||||
.right {
|
||||
margin-left: 10px;
|
||||
width: calc(100% - 100px);
|
||||
height: 112px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
view {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.name {
|
||||
color: #000;
|
||||
font-size: 16px;
|
||||
margin-right: 10px;
|
||||
font-weight: bold;
|
||||
max-width: 50%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.post {
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
background-color: #F7B133;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
padding: 2px 10px;
|
||||
border-radius: 5px;
|
||||
color: #fff;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.place {
|
||||
text {
|
||||
position: inherit;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.productList {
|
||||
margin-bottom: 15px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,507 @@
|
|||
<template>
|
||||
<view class="content bgfff">
|
||||
<!-- -->
|
||||
<view class="phonetop" v-if="token">
|
||||
<view class="headbox">
|
||||
<view class="head">
|
||||
<view class="image">
|
||||
<image :src="userInfo.avatarurl" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="name">
|
||||
{{userInfo.name}}<text>{{userInfo.posname}}</text>
|
||||
</view>
|
||||
<view class="post">{{userInfo.orgname}}<text v-if="userInfo.place"
|
||||
class="ml-5 mr-5">|</text>{{userInfo.place}}
|
||||
</view>
|
||||
<view class="phone">电话:{{userInfo.phone}}</view>
|
||||
<view class="phone" v-if="userInfo.email">
|
||||
{{userInfo.email}}
|
||||
</view>
|
||||
<view class="phone" @click="navTo('/pageTwo/me/user')" v-if="!userInfo.email"
|
||||
:class="[!userInfo.email?'redcolor':'']">
|
||||
请尽快完善个人资料
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="login" @click="handleLogin">
|
||||
登录后查看更多内容资讯,点击此处<text>登录</text>
|
||||
</view>
|
||||
<!-- vip -->
|
||||
<view class="vip" :class="[!token?'marginTop':'']">
|
||||
<view>
|
||||
<image src="../../static/me1.png"></image>
|
||||
<text v-if="!userInfo.vipname">开通会员,尊享多重特权</text>
|
||||
<text v-else>会员有效期至:{{userInfo.vipendtime.substring(0,10)}}</text>
|
||||
</view>
|
||||
<view class="btn" v-if="!userInfo.vipname" @tap="handleisVIP">开通会员</view>
|
||||
</view>
|
||||
<!-- 资料 -->
|
||||
<view class="tools">
|
||||
<view class="item" @click="navTo('/pageTwo/me/user')">
|
||||
<image src="../../static/me3.png"></image>
|
||||
<view class="ml-15">
|
||||
<text class="size18 bold">个人资料</text>
|
||||
Personal Data
|
||||
</view>
|
||||
</view>
|
||||
<view class="item" @click="navTo('/pageTwo/me/company')">
|
||||
<image src="../../static/me2.png"></image>
|
||||
<view class="ml-15">
|
||||
<text class="size18 bold">企业信息</text>
|
||||
Company
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 更多功能 -->
|
||||
<view class="tools tools2">
|
||||
<view class="title">更多功能</view>
|
||||
<view @click="navTo('/pageTwo/me/needs?type=9')">
|
||||
<image src="../../static/me4.png"></image>
|
||||
<text>我的供需</text>
|
||||
</view>
|
||||
<view @click="navTo('/pageTwo/me/needs?type=3')">
|
||||
<image src="../../static/me5.png"></image>
|
||||
<text>我的商品</text>
|
||||
</view>
|
||||
<view @click="navTo('/pageTwo/login/editPassword')">
|
||||
<image src="../../static/me6.png"></image>
|
||||
<text>修改密码</text>
|
||||
</view>
|
||||
<view @tap="handleisVIP">
|
||||
<image src="../../static/me7.png"></image>
|
||||
<text>联系秘书处</text>
|
||||
</view>
|
||||
<view @tap="handleisCare">
|
||||
<image src="../../static/me8.png"></image>
|
||||
<text>身份卡</text>
|
||||
</view>
|
||||
<view @click="handleOutLogin" v-if="token">
|
||||
<image src="../../static/me10.png"></image>
|
||||
<text>退出</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="foot">
|
||||
<view class="logo">
|
||||
<image src="../../static/logo.png"></image>
|
||||
</view>
|
||||
<view class="ercode">
|
||||
<image :src="HomeContent.officialqrcode" show-menu-by-longpress="true"></image>
|
||||
</view>
|
||||
<view>
|
||||
<text>长按识别二维码</text>
|
||||
<text>关注智造团公众号接收最新动态</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 身份卡 -->
|
||||
<view class="wrapper" v-if="isCard">
|
||||
<view class="bg" @click="handleisCare">
|
||||
<view class="edit Card" @click.stop>
|
||||
<view class="Cardbg">
|
||||
<image src="../../static/bg.jpg" mode="aspectFit"></image>
|
||||
<view class="logo">
|
||||
<image :src="userInfo.cominfo.logourl" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="title">
|
||||
{{userInfo.cominfo.name}}
|
||||
</view>
|
||||
<view class="address" v-if="userInfo.cominfo.province">
|
||||
{{userInfo.cominfo.province}}{{userInfo.cominfo.city}}{{userInfo.cominfo.area}}{{userInfo.cominfo.address}}
|
||||
</view>
|
||||
<view class="address redcolor" v-else @click="navTo('/pageTwo/me/company')">
|
||||
请尽快完善企业资料
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="box">
|
||||
<view class="mt-15 name">
|
||||
<view class="size16">{{userInfo.name}}<text class="text">{{userInfo.posname}}</text></view>
|
||||
<view class="c999 size12 mt-5">
|
||||
<text>{{userInfo.orgname}}</text>
|
||||
<text v-if="userInfo.place" class="ml-5 mr-5">|</text>{{userInfo.place}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="ercode">
|
||||
<view class="left">
|
||||
<text class="mb-5">电话:{{userInfo.phone}}</text>
|
||||
<text v-if="userInfo.email">
|
||||
{{userInfo.email}}
|
||||
</text>
|
||||
<text @click="navTo('/pageTwo/me/user')" v-if="!userInfo.email"
|
||||
:class="[!userInfo.email?'redcolor':'']">
|
||||
请尽快完善个人资料
|
||||
</text>
|
||||
</view>
|
||||
<view class="right">
|
||||
<!-- https://izzt.jt-sky.com/qr/get?appid=wxbbddd1888da43ab0&id=142307070910553 -->
|
||||
<image :src="'https://izzt.jt-sky.com/qr/get?appid='+appid+'&id='+userInfo.id"
|
||||
show-menu-by-longpress="true"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 秘书处 -->
|
||||
<secratary></secratary>
|
||||
<!-- 客服 -->
|
||||
<message></message>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isCard: false,
|
||||
token: "",
|
||||
appid: ""
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user', "HomeContent"]),
|
||||
userInfo() {
|
||||
return this.user.name ? this.user : uni.getStorageSync('UserInfo')
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
let that = this
|
||||
that.appid = uni.getStorageSync('appid')
|
||||
that.token = uni.getStorageSync('token')
|
||||
},
|
||||
methods: {
|
||||
handleOutLogin() {
|
||||
let that = this
|
||||
uni.showModal({
|
||||
title: '友情提示',
|
||||
content: '是否退出登录?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
that.$model.getoutlogin({
|
||||
sessionid: uni.getStorageSync('sessionid')
|
||||
}).then((res) => {
|
||||
if (res.code != 0) return
|
||||
console.log('确定退出', res)
|
||||
uni.clearStorageSync()
|
||||
uni.reLaunch({
|
||||
url: "/pageTwo/login/login"
|
||||
})
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
that.$tools.msg("您已取消操作!");
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
handleisVIP() {
|
||||
this.$store.commit("changeSecratary", true);
|
||||
},
|
||||
handleisCare() {
|
||||
if (!this.token) {
|
||||
this.$tools.msg("登录后查看更多")
|
||||
return
|
||||
}
|
||||
this.isCard = !this.isCard
|
||||
},
|
||||
// 登录
|
||||
handleLogin() {
|
||||
let that = this
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/login/login"
|
||||
})
|
||||
},
|
||||
navTo(url) {
|
||||
if (!this.token) {
|
||||
this.$tools.msg("登录后查看更多")
|
||||
return
|
||||
}
|
||||
this.isCard = false
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
padding: 0;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.vip {
|
||||
font-size: 32rpx;
|
||||
color: #F2D59C;
|
||||
background-color: #2C2C34;
|
||||
margin: 100px 10px 0;
|
||||
border-radius: 5px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 15px 10px;
|
||||
align-items: center;
|
||||
|
||||
view {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
padding: 5px 10px;
|
||||
border-radius: 5px;
|
||||
background-color: #E6C8A2;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.tools {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 15px 10px;
|
||||
justify-content: space-between;
|
||||
|
||||
.item {
|
||||
width: 43%;
|
||||
padding: 15px 2%;
|
||||
border-radius: 10px;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
||||
|
||||
image {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
view {
|
||||
color: #999;
|
||||
width: calc(100% - 50px);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
text {
|
||||
width: 100%;
|
||||
color: #333;
|
||||
text-align: left;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.login {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
border-radius: 5px;
|
||||
|
||||
text {
|
||||
color: $blue;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-left: 5px;
|
||||
padding: 0 3px;
|
||||
border-bottom: 1px solid $blue;
|
||||
}
|
||||
}
|
||||
|
||||
.tools2 {
|
||||
justify-content: left;
|
||||
|
||||
view {
|
||||
width: 25%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
text {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
width: 100%;
|
||||
justify-content: left;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.foot {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
padding-bottom: 50px;
|
||||
|
||||
.logo {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
||||
image {
|
||||
width: 166rpx;
|
||||
height: 54rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.ercode {
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
text-align: center;
|
||||
|
||||
image {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border: 1px solid #dfdfdf;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
text {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.marginTop {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.Card {
|
||||
width: 560rpx;
|
||||
height: 800rpx;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.Cardbg {
|
||||
width: 560rpx;
|
||||
height: 488rpx;
|
||||
|
||||
image {
|
||||
border-radius: 5px 5px 0 0;
|
||||
background-color: rgba(225, 225, 255, 0.5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 100%;
|
||||
margin-top: -440rpx;
|
||||
margin-bottom: 10px;
|
||||
|
||||
image {
|
||||
width: 55px;
|
||||
height: 55px;
|
||||
padding: 5px;
|
||||
border-radius: 50%;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.address {
|
||||
color: #fff;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.box {
|
||||
position: absolute;
|
||||
top: 489rpx;
|
||||
|
||||
.name {
|
||||
width: auto;
|
||||
text-align: left;
|
||||
margin-left: 15px;
|
||||
|
||||
view {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
.text {
|
||||
width: auto;
|
||||
font-size: 12px;
|
||||
background: $orange;
|
||||
padding: 3px 10px;
|
||||
border-radius: 5px;
|
||||
color: #fff;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
text {
|
||||
display: inherit;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ercode {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 15px;
|
||||
width: auto;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.left {
|
||||
width: calc(100% - 100rpx);
|
||||
font-size: 12px;
|
||||
margin-top: 20px;
|
||||
|
||||
text {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 30px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,369 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view v-if="con">
|
||||
<view class="phonetop">
|
||||
<view class="headbox">
|
||||
<view class="head">
|
||||
<view class="image">
|
||||
<image :src='con.avatarurl' mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="name">
|
||||
{{con.name}}<text>{{con.posname}}</text>
|
||||
</view>
|
||||
<view class="post">{{con.orgname}}<text v-if="con.place" class="ml-5 mr-5">|</text>{{con.place}}</view>
|
||||
<view class="phone">电话:{{con.phone}}</view>
|
||||
<view class="phone" v-if="con.email">邮箱:{{con.email}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="call" @click="$tools.getCall(user.authlist,con.phone)" v-if="con.phone">
|
||||
<icon class="iconfont icon-dianhua1 mr-10"></icon>
|
||||
合作联系
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- -->
|
||||
<view class="box">
|
||||
<view class="tabbar">
|
||||
<view :class="[active==1?'active':'']" @click="active=1">企业简介</view>
|
||||
<view :class="[active==2?'active':'']" @click="active=2">产品展示</view>
|
||||
<view :class="[active==3?'active':'']" @click="active=3">个人简介</view>
|
||||
</view>
|
||||
<!-- 企业简介 -->
|
||||
<view class="title">
|
||||
<image src="../../static/title.png"></image>
|
||||
{{active==1?'企业简介':active==2?'产品展示':'个人简介'}}
|
||||
</view>
|
||||
<view class="show" v-if="active==1">
|
||||
<view class="logo">
|
||||
<image :src="con.cominfo.logourl" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="postName">{{con.cominfo.name}}</view>
|
||||
<view class="mt-15">
|
||||
<text class="text ml-15">企业所在片区:</text>{{con.cominfo.area}}
|
||||
</view>
|
||||
<view class="mt-10 ml-15">
|
||||
<text
|
||||
class="text">公司地址:</text>{{con.cominfo.province}}{{con.cominfo.city}}{{con.cominfo.area}}{{con.cominfo.address}}
|
||||
</view>
|
||||
<view class="mt-10 ml-15">
|
||||
<text class="text">公司电话:</text>{{con.cominfo.mobile}}
|
||||
</view>
|
||||
<view class="mt-10 ml-15">
|
||||
<text class="text">企业年营收(万元):</text>{{con.cominfo.yearlyincome}}
|
||||
</view>
|
||||
<view class="mt-10 ml-15">
|
||||
<text class="text">企业年税收(万元):</text>{{con.cominfo.yearlytax}}
|
||||
</view>
|
||||
<view class="mt-10 ml-15">
|
||||
<text class="text">员工人数:</text>{{con.cominfo.staffcnt}}人
|
||||
</view>
|
||||
<view class="con">
|
||||
{{con.cominfo.desc}}
|
||||
</view>
|
||||
<view class="image mt-10" v-for="(ite,ind) in con.cominfo.pics" :key="ind">
|
||||
<image :src="ite.url" @click="previewImage(ind)" mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 产品展示 -->
|
||||
<view class="show " v-if="active==2">
|
||||
<list :isName="false" :list="list" @handleDetail="handleDetail" v-if="list.length"></list>
|
||||
<view class="nolist" v-else>
|
||||
<image src="@/static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
<!--个人简介 -->
|
||||
<view class="show" v-if="active==3">
|
||||
<view class="headimage">
|
||||
<image :src='con.avatarurl' mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="name">
|
||||
{{con.name}}<text>{{con.posname}}</text>
|
||||
</view>
|
||||
<view class="post">{{con.orgname}}<text v-if="con.place" class="ml-5 mr-5">|</text>{{con.place}}
|
||||
</view>
|
||||
<view class="mt-10"><text>性别:</text>{{con.sex==1?'男':con.sex==2?'女':'未知'}}</view>
|
||||
<view class="mt-10"><text>出生年月:</text>{{con.birthday.substring(0,10)}}</view>
|
||||
<view class="mt-10"><text>籍贯:</text>{{con.place}}</view>
|
||||
<view class="mt-10 ml-15" v-if="con.interests">
|
||||
<text class="text">爱好:</text>{{con.interests}}
|
||||
</view>
|
||||
<view class="mt-10 ml-15" v-if="con.provide">
|
||||
<text class="text">能给平台带来什么:</text>{{con.provide}}
|
||||
</view>
|
||||
<view class="mt-10 ml-15" v-if="con.demand">
|
||||
<text class="text">加入智照团想收获什么:</text>{{con.demand}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 秘书处弹框 -->
|
||||
<secratary></secratary>
|
||||
</view>
|
||||
<view class="nolist" v-else>
|
||||
<image src="@/static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import list from "@/components/productList.vue"
|
||||
import uParse from '@/uni_modules/u-parse/u-parse.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 1,
|
||||
page: 1,
|
||||
list: [],
|
||||
lastPage: 1,
|
||||
con: null,
|
||||
id: ""
|
||||
|
||||
}
|
||||
},
|
||||
components: {
|
||||
list,
|
||||
uParse
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user"]),
|
||||
},
|
||||
onLoad(options) {
|
||||
this.id = options.id
|
||||
this.handleInfo(options.id)
|
||||
this.handleList()
|
||||
},
|
||||
onReachBottom() {
|
||||
let that = this
|
||||
if (this.active != 2) return
|
||||
console.log("this.lastPage", this.lastPage)
|
||||
if (!this.lastPage || this.page >= this.lastPage) {
|
||||
uni.showToast({
|
||||
title: '没有更多数据!',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.page++
|
||||
this.handleList()
|
||||
},
|
||||
methods: {
|
||||
handleInfo(id) {
|
||||
let that = this
|
||||
return that.$model.getVipDetail({
|
||||
id: id,
|
||||
}).then((res) => {
|
||||
console.log("详情", res)
|
||||
that.con = res.data
|
||||
})
|
||||
},
|
||||
handleList() {
|
||||
let that = this
|
||||
that.$model.getProductList({
|
||||
pageNo: that.page,
|
||||
pageSize: 10,
|
||||
type: 3,
|
||||
userId: that.id
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
that.list = that.list.concat(res.data.rows)
|
||||
that.lastPage = res.data.totalpage
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDetail(item) {
|
||||
console.log("详情", item)
|
||||
let that = this
|
||||
that.$model.getProductDetail({
|
||||
id: item.id,
|
||||
type: 3
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
res.data.type = 3
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/product/detail?type=3" + '&id=' + item.id
|
||||
})
|
||||
} else {
|
||||
that.$tools.msg(res.message);
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
previewImage(ind) {
|
||||
let that = this
|
||||
console.log("pics", that.con.cominfo.pics.map(item => item.url))
|
||||
uni.previewImage({
|
||||
urls: that.con.cominfo.pics.map(item => item.url),
|
||||
current: ind
|
||||
}).catch((e) => {
|
||||
console.log(e) //用catch(e)来捕获错误{makePhoneCall:fail cancel}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
padding: 0;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.box {
|
||||
margin-top: 170px;
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
border-radius: 5px;
|
||||
|
||||
.tabbar {
|
||||
display: flex;
|
||||
height: 45px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin: 0 15px;
|
||||
border-bottom: 1px solid #dfdfdf;
|
||||
|
||||
view {
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
width: 33%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: $blue;
|
||||
|
||||
border-bottom: 2px solid $blue;
|
||||
}
|
||||
}
|
||||
|
||||
.show {
|
||||
padding: 10px 15px 15px;
|
||||
|
||||
.logo {
|
||||
width: 145px;
|
||||
height: 52px;
|
||||
padding: 10px;
|
||||
border: 1px solid #dfdfdf;
|
||||
margin: auto;
|
||||
margin: 15px auto;
|
||||
}
|
||||
|
||||
.postName {
|
||||
margin: 20px 0;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
text,
|
||||
.text {
|
||||
color: #999;
|
||||
padding-left: 13px;
|
||||
position: relative;
|
||||
left: -15px;
|
||||
}
|
||||
|
||||
.text::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
left: 0;
|
||||
background-color: $orange;
|
||||
border-radius: 50%;
|
||||
top: 6px;
|
||||
}
|
||||
|
||||
.con {
|
||||
margin-top: 15px;
|
||||
color: #666;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
text-align: center;
|
||||
margin-top: 5px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
object-fit: scale-down;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
.headimage {
|
||||
width: 85px;
|
||||
height: 110px;
|
||||
border: 1px solid #dfdfdf;
|
||||
border-radius: 5px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.name {
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
margin-top: 15px;
|
||||
|
||||
text {
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
background-color: #F7B133;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
padding: 2px 10px;
|
||||
border-radius: 5px;
|
||||
color: #fff;
|
||||
margin-left: 15px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.post {
|
||||
color: #999;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
|
||||
text {
|
||||
position: inherit;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.productList {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<!-- 搜索 -->
|
||||
<piker-search @handleSearch="handleSearch" :placeholder='"找企业"' :width="'100'"
|
||||
:isAddress="true"></piker-search>
|
||||
|
||||
<!-- -->
|
||||
<view class="box">
|
||||
<view class="phonelist" v-for="(ite,ind) in list" :key="ind" @click="handledetail(ite)" v-if="list.length">
|
||||
<view class="left">
|
||||
<image :src="ite.logo" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="name">
|
||||
<text>{{ite.username}}</text>{{ite.pos}}
|
||||
</view>
|
||||
<view class="c999">{{ite.name}}</view>
|
||||
</view>
|
||||
<view class="tell" v-if="token" @click="$tools.getCall(user.authlist,ite.mobile)" @click.stop>
|
||||
<image src="../../static/tall.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nolist" v-if="!list.length">
|
||||
<image src="../../static/none.png"></image>
|
||||
<text>暂无数据</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 秘书处弹框 -->
|
||||
<secratary></secratary>
|
||||
<!-- 客服 -->
|
||||
<message></message>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState
|
||||
} from "vuex";
|
||||
import pikerSearch from "../../components/search.vue"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
page: 1,
|
||||
lastPage: 1,
|
||||
token: "",
|
||||
name: "",
|
||||
province: "",
|
||||
city: "",
|
||||
industryid: "",
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user"]),
|
||||
},
|
||||
components: {
|
||||
pikerSearch
|
||||
},
|
||||
onLoad() {
|
||||
let that = this
|
||||
this.handleList()
|
||||
that.token = uni.getStorageSync('token')
|
||||
},
|
||||
onReachBottom() {
|
||||
let that = this
|
||||
if (!this.lastPage || this.page >= this.lastPage) {
|
||||
uni.showToast({
|
||||
title: '没有更多数据!',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.page++
|
||||
this.handleList()
|
||||
},
|
||||
methods: {
|
||||
handleList() {
|
||||
let that = this
|
||||
return that.$model.getUserConList({
|
||||
name: that.name,
|
||||
province: that.province,
|
||||
city: that.city,
|
||||
industryid: that.industryid,
|
||||
pageNo: that.page,
|
||||
pageSize: 10,
|
||||
}).then((res) => {
|
||||
console.log("通讯录", res)
|
||||
if (res.code != 0) return
|
||||
that.list = this.list.concat(res.data.rows)
|
||||
that.lastPage = res.data.totalpage
|
||||
})
|
||||
},
|
||||
handleSearch(name, province, city, industryid) {
|
||||
// if (!this.token) {
|
||||
// this.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
this.name = name
|
||||
this.province = province
|
||||
this.city = city
|
||||
this.industryid = industryid
|
||||
this.list = []
|
||||
this.page = 1
|
||||
console.log("搜索返回", this.name, this.province, this.city, this.industryid)
|
||||
this.handleList()
|
||||
},
|
||||
// 详情
|
||||
handledetail(ite) {
|
||||
// if (!this.token) {
|
||||
// this.$tools.msg("登录后查看更多")
|
||||
// return
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url: "/pages/phoneList/detail?id=" + ite.id
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.content {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
.box {
|
||||
margin-top: 75px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
After Width: | Height: | Size: 620 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
|
@ -0,0 +1,120 @@
|
|||
import model from "../tools/model.js"
|
||||
import tools from '@/tools/tools.js'
|
||||
// Action 包含异步操作(请求API方法)、回调函数提交mutaions更改state数据状态,使之可以异步
|
||||
export default {
|
||||
//sessionId
|
||||
getsessionId({
|
||||
commit
|
||||
}) {
|
||||
return uni.login({
|
||||
success(res) {
|
||||
if (res.code) {
|
||||
if (res.errMsg = "login:ok") {
|
||||
model.onlogin({
|
||||
code: res.code
|
||||
}).then(ress => {
|
||||
uni.setStorageSync('sessionid', ress.data.sessionid)
|
||||
return ress
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 首页信息
|
||||
getHomeContent({
|
||||
commit
|
||||
},
|
||||
account) {
|
||||
return model.getHomeContent(account).then(res => {
|
||||
if (res.code != 0) false
|
||||
commit('changeHomeContent', res.data)
|
||||
}).catch(e => {})
|
||||
},
|
||||
|
||||
// 用户信息
|
||||
getUserInfo({
|
||||
commit
|
||||
}) {
|
||||
return model.getuserinfo({}).then(res => {
|
||||
if (res.code != 0) false
|
||||
commit('changeUserInfo', res.data)
|
||||
uni.setStorageSync('UserInfo', res.data)
|
||||
});
|
||||
},
|
||||
// 资讯列表
|
||||
getInfoList({
|
||||
commit
|
||||
},
|
||||
account) {
|
||||
return model.getinfolist(account).then(res => {
|
||||
if (res.code != 0) false
|
||||
commit('changeInfoList', res.data)
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 获取历史记录
|
||||
gethistoryList({
|
||||
commit
|
||||
}, account) {
|
||||
return model.getList(account).then((res) => {
|
||||
if (res.data && res.data.items) {
|
||||
commit('changehistoryList', res.data.items)
|
||||
} else {
|
||||
commit('changehistoryList', null)
|
||||
}
|
||||
return res
|
||||
})
|
||||
},
|
||||
// 宠物列表
|
||||
getPetList({
|
||||
commit
|
||||
}) {
|
||||
return model.getPetList({
|
||||
pagenum: 20,
|
||||
pagesize: 1
|
||||
}).then((res) => {
|
||||
if (res.data) {
|
||||
commit("changePetList", res.data)
|
||||
} else {
|
||||
commit("changePetList", null)
|
||||
}
|
||||
|
||||
return res
|
||||
})
|
||||
},
|
||||
//养护提醒
|
||||
getAlertList({
|
||||
commit
|
||||
}, account) {
|
||||
return model.getAlertList(account).then(res => {
|
||||
if (res.data && res.data.rows) {
|
||||
commit('changeAlertList', res.data.rows)
|
||||
} else {
|
||||
commit('changeAlertList', null)
|
||||
}
|
||||
return res
|
||||
})
|
||||
},
|
||||
//通知提醒
|
||||
getNoticelist({
|
||||
commit
|
||||
}) {
|
||||
return model.getnoticelist({}).then(res => {
|
||||
if (res.data) {
|
||||
commit('changeNoticelist', res.data)
|
||||
} else {
|
||||
commit('changeNoticelist', null)
|
||||
}
|
||||
return res
|
||||
})
|
||||
},
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import actions from './actions.js'
|
||||
Vue.use(Vuex)
|
||||
export default new Vuex.Store({
|
||||
// state: 存储基本数据
|
||||
state: {
|
||||
user: {
|
||||
avatarurl: "",
|
||||
name: "",
|
||||
sex: 1,
|
||||
birthday: "",
|
||||
id: "",
|
||||
industryid: "",
|
||||
industryname: null,
|
||||
interests: "",
|
||||
orgid: "",
|
||||
orgname: "",
|
||||
phone: "",
|
||||
place: "",
|
||||
posid: "",
|
||||
posname: "",
|
||||
provide: "",
|
||||
vipendtime: "",
|
||||
vipname: null,
|
||||
email: "",
|
||||
codeurl: "",
|
||||
codeurl: "",
|
||||
authlist: [],
|
||||
cominfo: {
|
||||
pics: []
|
||||
}
|
||||
},
|
||||
HomeContent: {
|
||||
appdesc: "",
|
||||
appimg: "",
|
||||
qyappid: "",
|
||||
qyserviceurl: "",
|
||||
centerbannerlist: [],
|
||||
bannerlist: [],
|
||||
noticelist: [],
|
||||
todayviewer: 0,
|
||||
orgList: [],
|
||||
poslist: [],
|
||||
industrylist: [],
|
||||
officialqrcode: "",
|
||||
secrataryphone: "",
|
||||
secrataryqrcode: "",
|
||||
privacydesc: ""
|
||||
},
|
||||
InfoList: {},
|
||||
isLogout: true,
|
||||
isSecratary: false,
|
||||
},
|
||||
// mutations: Store中更改state数据状态的唯一方法(必须是同步函数)
|
||||
mutations: {
|
||||
/* 用户信息 */
|
||||
changeUserInfo(state, newData) {
|
||||
state.user = newData
|
||||
},
|
||||
// 首页信息
|
||||
changeHomeContent(state, newData) {
|
||||
state.HomeContent = newData
|
||||
},
|
||||
// 资讯列表
|
||||
changeInfoList(state, newData) {
|
||||
state.InfoList = newData
|
||||
},
|
||||
// 秘书处弹框
|
||||
changeSecratary(state, newData) {
|
||||
state.isSecratary = newData
|
||||
},
|
||||
// 退出登录
|
||||
changeLogout(state, newData) {
|
||||
if (newData == false) {
|
||||
state.user = {
|
||||
avatarurl: "",
|
||||
name: "",
|
||||
sex: 1,
|
||||
birthday: "",
|
||||
id: "",
|
||||
industryid: "",
|
||||
industryname: null,
|
||||
interests: "",
|
||||
orgid: "",
|
||||
orgname: "",
|
||||
phone: "",
|
||||
place: "",
|
||||
posid: "",
|
||||
posname: "",
|
||||
provide: "",
|
||||
vipendtime: "",
|
||||
vipname: null,
|
||||
email: "",
|
||||
codeurl: "",
|
||||
codeurl: "",
|
||||
authlist: [],
|
||||
cominfo: {
|
||||
pics: []
|
||||
}
|
||||
}
|
||||
}
|
||||
state.isLogout = newData
|
||||
},
|
||||
|
||||
},
|
||||
// 模块化vuex
|
||||
modules: {},
|
||||
actions
|
||||
})
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
import store from '../store'
|
||||
import tools from '@/tools/tools.js'
|
||||
const accountInfo = wx.getAccountInfoSync();
|
||||
const appid = accountInfo.miniProgram.appId
|
||||
uni.setStorageSync('appid', appid)
|
||||
let baseUrl = "https://izzt.jt-sky.com"
|
||||
|
||||
const httpRequest = (url, method = "get", data) => {
|
||||
let httpDefaultOpts = {
|
||||
url: baseUrl + url,
|
||||
data: data,
|
||||
method: method,
|
||||
header: {
|
||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||
'X-Authorization': "Bearer " + uni.getStorageSync('refreshtoken'),
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'content-type': 'application/json;charset=UTF-8',
|
||||
}
|
||||
}
|
||||
let promise = new Promise(function(resolve, reject) {
|
||||
uni.request(httpDefaultOpts).then(
|
||||
(res) => {
|
||||
// console.log("https", res)
|
||||
// uni.hideLoading()
|
||||
if (res.data.code == 401) {
|
||||
uni.clearStorageSync()
|
||||
store.commit("changeLogout", false);
|
||||
uni.setStorageSync('token', null)
|
||||
uni.setStorageSync('sessionid', null)
|
||||
uni.setStorageSync('refreshtoken', null)
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "登录后查看更多",
|
||||
duration: 2000
|
||||
});
|
||||
setTimeout(function() {
|
||||
uni.switchTab({
|
||||
url: "/pages/index/index"
|
||||
})
|
||||
}, 2000)
|
||||
return
|
||||
}
|
||||
// if (res[1].statusCode != 200) {
|
||||
// tools.msg(res[1].data.message)
|
||||
// return
|
||||
// }
|
||||
resolve(res.data)
|
||||
}
|
||||
).catch(
|
||||
(response) => {
|
||||
uni.hideLoading()
|
||||
reject(response)
|
||||
}
|
||||
)
|
||||
})
|
||||
return promise
|
||||
};
|
||||
|
||||
function uploadFile(url, filePath) {
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: baseUrl + url,
|
||||
filePath: filePath.uploadpath,
|
||||
name: 'file',
|
||||
header: {
|
||||
'Authorization': "Bearer " + uni.getStorageSync('token'),
|
||||
'X-Authorization': "Bearer " + uni.getStorageSync('refreshtoken'),
|
||||
},
|
||||
}).then(res => {
|
||||
if (res.statusCode == 200) {
|
||||
var json = JSON.parse(res.data)
|
||||
if (json.code != 0) {
|
||||
tools.msg(json.message)
|
||||
return
|
||||
}
|
||||
resolve(json)
|
||||
}
|
||||
})
|
||||
});
|
||||
return promise
|
||||
};
|
||||
const get = (url, data) => {
|
||||
data.appid = appid
|
||||
data.sessionid = uni.getStorageSync('sessionid')
|
||||
return httpRequest(url, 'get', data)
|
||||
}
|
||||
|
||||
const post = (url, data) => {
|
||||
data.appid = appid
|
||||
data.sessionid = uni.getStorageSync('sessionid')
|
||||
return httpRequest(url, 'post', data)
|
||||
}
|
||||
const upload = (url, filePath) => {
|
||||
return uploadFile(url, filePath)
|
||||
}
|
||||
export default {
|
||||
baseUrl,
|
||||
get,
|
||||
post,
|
||||
upload
|
||||
}
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
import http from './https.js'
|
||||
import tools from './tools.js'
|
||||
import store from '@/store'
|
||||
export default {
|
||||
// 小程序管理
|
||||
onlogin(param) { // 微信小程序登录
|
||||
return http.post("/api/app/wxopen/onlogin", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getlogin(param) { // 账号密码登录
|
||||
return http.post("/api/app/wxopen/login", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getoutlogin(param) { // 退出登录
|
||||
return http.post("/api/app/wxopen/logout", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getuserinfo(param) { // 获取用户信息资料
|
||||
return http.post("/api/app/wxopen/userinfo", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getApplyfor(param) { // 申请加入智造团
|
||||
return http.post("/api/app/wxopen/applyfor", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
|
||||
// 内容管理
|
||||
getHomeContent(param) { // 获取首页内容
|
||||
return http.post("/api/app/home/content", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getinfolist(param) { // 资讯列表
|
||||
return http.post("/api/app/info/list", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getInfoDetail(param) { // 获取详情(资讯、轮播、公告、党建)
|
||||
return http.post("/api/app/info/detail", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getCampaignList(param) { // 活动列表
|
||||
return http.post("/api/app/campaign/list", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getCampaignDetail(param) { // 活动详情
|
||||
return http.post("/api/app/campaign/detail", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getPartyList(param) { // 建档列表
|
||||
return http.post("/api/app/party/list", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
// 会员管理
|
||||
getUserConList(param) { // 会员企业列表
|
||||
return http.post("/api/app/user/com/list", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getVipDetail(param) { // 会员详情
|
||||
return http.post("/api/app/user/detail", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getVipList(param) { // 会员列表
|
||||
return http.post("/api/app/user/list", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getLike(param) { // 用户点赞
|
||||
return http.post("/api/app/user/like", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getUserSubmit(param) { // 用户资料修改
|
||||
return http.post("/api/app/user/submit", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getSubmitCom(param) { // 企业信息修改
|
||||
return http.post("/api/app/user/submitcom", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getChangePassword(param) { // 密码修改
|
||||
return http.post("/api/app/user/changepassword", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
|
||||
// 产品管理
|
||||
getProductAdd(param) { // 添加产品
|
||||
return http.post("/api/app/product/add", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getProductEdit(param) { // 编辑产品
|
||||
return http.post("/api/app/product/edit", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getProductList(param) { // 产品列表
|
||||
return http.post("/api/app/product/list", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getProductDetail(param) { // 产品详情
|
||||
return http.post("/api/app/product/detailaysnc", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getProductListbyuser(param) { // 账户下产品列表
|
||||
return http.post("/api/app/product/listbyuser", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
getProductDetailbyuser(param) { // 自有产品详情
|
||||
return http.post("/api/app/product/detailbyuser", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
|
||||
// 文件上传
|
||||
|
||||
getUpLoadimg(param) { // 图片上传
|
||||
return http.upload("/api/common/uploadimg", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
// 全局搜索
|
||||
|
||||
getSearchList(param) { // 全局搜索
|
||||
return http.post("/api/app/search/list", param).then(res => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
import $store from '@/store'
|
||||
export default {
|
||||
msg,
|
||||
getCall,
|
||||
getTime,
|
||||
getDate,
|
||||
NewsPtype,
|
||||
GetDateStr,
|
||||
|
||||
}
|
||||
|
||||
function NewsPtype(con) {
|
||||
//1小程序,2H5,3内练,4文本
|
||||
if (con.ptype == 1) {
|
||||
uni.navigateToMiniProgram({
|
||||
appId: con.appid,
|
||||
path: con.content,
|
||||
extraData: {},
|
||||
})
|
||||
return
|
||||
}
|
||||
if (con.ptype == 3) {
|
||||
uni.navigateTo({
|
||||
url: con.content
|
||||
})
|
||||
return
|
||||
}
|
||||
if (con.ptype == 4 || con.ptype == 2) {
|
||||
uni.navigateTo({
|
||||
url: "/pageTwo/news/detail?id=" + con.id + "&type=" + con.type
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
function getCall(authlist, num) {
|
||||
console.log("authlist", authlist,)
|
||||
if (!authlist.length) {
|
||||
$store.commit("changeSecratary", true);
|
||||
} else {
|
||||
authlist.forEach(ite => {
|
||||
if (ite.code.indexOf('phone:show') != -1) {
|
||||
console.log("包含")
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: num //仅为示例
|
||||
}).catch((e) => {
|
||||
console.log(e) //用catch(e)来捕获错误{makePhoneCall:fail cancel}
|
||||
});
|
||||
} else {
|
||||
console.log("不包含")
|
||||
$store.commit("changeSecratary", true);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function msg(str) {
|
||||
uni.showToast({
|
||||
title: str,
|
||||
duration: 3000,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
function getDate(type) {
|
||||
const date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
month = month > 9 ? month : '0' + month;;
|
||||
day = day > 9 ? day : '0' + day;
|
||||
if (type === 'start') {
|
||||
year = year;
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
if (type === 'end') {
|
||||
year = year + 7;
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
if (type === 'month') {
|
||||
return month + '月' + day + '日'
|
||||
}
|
||||
}
|
||||
|
||||
function GetDateStr(AddDayCount) {
|
||||
var dd = new Date();
|
||||
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
|
||||
var y = dd.getFullYear();
|
||||
var m = (dd.getMonth() + 1) < 10 ? "0" + (dd.getMonth() + 1) : (dd.getMonth() + 1); //获取当前月份的日期,不足10补0
|
||||
var d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate(); //获取当前几号,不足10补0
|
||||
return y + "-" + m + "-" + d;
|
||||
}
|
||||
|
||||
function getTime() {
|
||||
var date = new Date()
|
||||
var y = date.getFullYear();
|
||||
var m = (date.getMonth() + 1) < 10 ? "0" + (date.getMonth() + 1) : (date.getMonth() +
|
||||
1); //获取当前月份的日期,不足10补0
|
||||
var d = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
||||
let H = date.getHours() > 9 ? date.getHours() : '0' + date.getHours()
|
||||
let Min = date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes()
|
||||
return y + '/' + m + '/' + d + " " + H + ':' + Min
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
uni.addInterceptor({
|
||||
returnValue (res) {
|
||||
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
|
||||
return res;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
|
||||
/* 颜色变量 */
|
||||
|
||||
/* 行为相关颜色 */
|
||||
$uni-color-primary: #007aff;
|
||||
$uni-color-success: #4cd964;
|
||||
$uni-color-warning: #f0ad4e;
|
||||
$uni-color-error: #dd524d;
|
||||
|
||||
/* 文字基本颜色 */
|
||||
$uni-text-color:#333;//基本色
|
||||
$uni-text-color-inverse:#fff;//反色
|
||||
$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
|
||||
$uni-text-color-placeholder: #808080;
|
||||
$uni-text-color-disable:#c0c0c0;
|
||||
|
||||
/* 背景颜色 */
|
||||
$uni-bg-color:#ffffff;
|
||||
$uni-bg-color-grey:#f8f8f8;
|
||||
$uni-bg-color-hover:#f1f1f1;//点击状态颜色
|
||||
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
|
||||
|
||||
/* 边框颜色 */
|
||||
$uni-border-color:#c8c7cc;
|
||||
|
||||
/* 尺寸变量 */
|
||||
|
||||
/* 文字尺寸 */
|
||||
$uni-font-size-sm:12px;
|
||||
$uni-font-size-base:14px;
|
||||
$uni-font-size-lg:16;
|
||||
|
||||
/* 图片尺寸 */
|
||||
$uni-img-size-sm:20px;
|
||||
$uni-img-size-base:26px;
|
||||
$uni-img-size-lg:40px;
|
||||
|
||||
/* Border Radius */
|
||||
$uni-border-radius-sm: 2px;
|
||||
$uni-border-radius-base: 3px;
|
||||
$uni-border-radius-lg: 6px;
|
||||
$uni-border-radius-circle: 50%;
|
||||
|
||||
/* 水平间距 */
|
||||
$uni-spacing-row-sm: 5px;
|
||||
$uni-spacing-row-base: 10px;
|
||||
$uni-spacing-row-lg: 15px;
|
||||
|
||||
/* 垂直间距 */
|
||||
$uni-spacing-col-sm: 4px;
|
||||
$uni-spacing-col-base: 8px;
|
||||
$uni-spacing-col-lg: 12px;
|
||||
|
||||
/* 透明度 */
|
||||
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
|
||||
|
||||
/* 文章场景相关 */
|
||||
$uni-color-title: #2C405A; // 文章标题颜色
|
||||
$uni-font-size-title:20px;
|
||||
$uni-color-subtitle: #555555; // 二级标题颜色
|
||||
$uni-font-size-subtitle:26px;
|
||||
$uni-color-paragraph: #3F536E; // 文章段落颜色
|
||||
$uni-font-size-paragraph:15px;
|
||||
|
||||
$orange:#F7B133;
|
||||
$blue: #345A9B;
|
||||
$red: #E52E27
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
<template>
|
||||
<picker mode="multiSelector" :value="multiIndex" :range="multiArray" @change="handleValueChange"
|
||||
@columnchange="handleColumnChange">
|
||||
<slot></slot>
|
||||
</picker>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const CHINA_REGIONS = require('./regions.json')
|
||||
export default {
|
||||
props: {
|
||||
defaultRegions: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
defaultRegionCode: {
|
||||
type: String
|
||||
},
|
||||
isArea: { //二级联动,市区新增全部
|
||||
type: Boolean,
|
||||
default: ''
|
||||
},
|
||||
defaultRegion: [String, Array]
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cityArr: CHINA_REGIONS[0].childs,
|
||||
districtArr: CHINA_REGIONS[0].childs[0].childs,
|
||||
multiIndex: [0, 0, 0],
|
||||
isInitMultiArray: true,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
defaultRegion: {
|
||||
handler(region, oldRegion) {
|
||||
if (Array.isArray(region)) {
|
||||
// 避免传的是字面量的时候重复触发
|
||||
oldRegion = oldRegion || []
|
||||
if (region.join('') !== oldRegion.join('')) {
|
||||
this.handleDefaultRegion(region)
|
||||
}
|
||||
} else if (region && region.length == 6) {
|
||||
this.handleDefaultRegion(region)
|
||||
} else {
|
||||
console.warn('defaultRegion非有效格式')
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
multiArray() {
|
||||
let that = this
|
||||
return that.pickedArr.map(arr => arr.map(item => item.name))
|
||||
},
|
||||
pickedArrTwo() {
|
||||
// 二级联动进行初始化
|
||||
if (CHINA_REGIONS[0].childs[0].name.indexOf("全部") == -1) {
|
||||
CHINA_REGIONS[0].childs.unshift({
|
||||
name: "全部"
|
||||
})
|
||||
}
|
||||
if (this.isInitMultiArray) {
|
||||
return [CHINA_REGIONS,
|
||||
CHINA_REGIONS[0].childs
|
||||
]
|
||||
}
|
||||
return [CHINA_REGIONS, this.cityArr];
|
||||
},
|
||||
pickedArr() {
|
||||
// 进行初始化
|
||||
let that = this
|
||||
if (that.isArea && CHINA_REGIONS[0].childs[0].name.indexOf("全部") != -1) {
|
||||
CHINA_REGIONS[0].childs.splice(0, 1)
|
||||
}
|
||||
if (!that.isArea && CHINA_REGIONS[0].childs[0].name.indexOf("全部") == -1) {
|
||||
CHINA_REGIONS[0].childs.unshift({
|
||||
name: "全部"
|
||||
})
|
||||
}
|
||||
if (this.isInitMultiArray) {
|
||||
return that.isArea ? [CHINA_REGIONS,
|
||||
CHINA_REGIONS[0].childs,
|
||||
CHINA_REGIONS[0].childs[0].childs
|
||||
] : [CHINA_REGIONS,
|
||||
CHINA_REGIONS[0].childs
|
||||
]
|
||||
}
|
||||
return that.isArea ? [CHINA_REGIONS, this.cityArr, this.districtArr] : [CHINA_REGIONS, this.cityArr];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleColumnChange(e) {
|
||||
this.isInitMultiArray = false;
|
||||
const that = this;
|
||||
let col = e.detail.column;
|
||||
let row = e.detail.value;
|
||||
that.multiIndex[col] = row;
|
||||
try {
|
||||
switch (col) {
|
||||
case 0:
|
||||
if (CHINA_REGIONS[that.multiIndex[0]].childs.length == 0) {
|
||||
that.cityArr = that.districtArr = [CHINA_REGIONS[that.multiIndex[0]]]
|
||||
break;
|
||||
}
|
||||
|
||||
if (!this.isArea && CHINA_REGIONS[that.multiIndex[0]].childs[0].name.indexOf("全部") == -1) {
|
||||
CHINA_REGIONS[that.multiIndex[0]].childs.unshift({
|
||||
name: "全部"
|
||||
})
|
||||
}
|
||||
if (this.isArea && CHINA_REGIONS[that.multiIndex[0]].childs[0].name.indexOf("全部") != -1) {
|
||||
CHINA_REGIONS[that.multiIndex[0]].childs.splice(0, 1)
|
||||
}
|
||||
that.cityArr = CHINA_REGIONS[that.multiIndex[0]].childs
|
||||
that.districtArr = CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs
|
||||
break;
|
||||
case 1:
|
||||
|
||||
that.districtArr = CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
that.districtArr = CHINA_REGIONS[that.multiIndex[0]].childs[0].childs
|
||||
}
|
||||
|
||||
},
|
||||
handleValueChange(e) {
|
||||
// 结构赋值
|
||||
let [index0, index1, index2] = e.detail.value;
|
||||
let [arr0, arr1, arr2] = this.pickedArr;
|
||||
let address = !this.isArea ? [arr0[index0], arr1[index1]] : [arr0[index0], arr1[index1], arr2[index2]];
|
||||
this.$emit('getRegion', address)
|
||||
},
|
||||
handleDefaultRegion(region) {
|
||||
console.log('222', region);
|
||||
const isCode = !Array.isArray(region)
|
||||
this.isInitMultiArray = false;
|
||||
let children = CHINA_REGIONS
|
||||
for (let i = 0; i < 3; i++) {
|
||||
for (let j = 0; j < children.length; j++) {
|
||||
let condition = isCode ? children[j].code == region.slice(0, (i + 1) * 2) : children[j].name
|
||||
.includes(region[i]);
|
||||
if (condition) {
|
||||
// 匹配成功进行赋值
|
||||
// console.log(i,j,children.length-1);
|
||||
children = children[j].childs;
|
||||
if (i == 0) {
|
||||
this.cityArr = children
|
||||
} else if (i == 1) {
|
||||
this.districtArr = children
|
||||
}
|
||||
this.$set(this.multiIndex, i, j)
|
||||
// console.log(this.multiIndex);
|
||||
break;
|
||||
} else {
|
||||
// 首次匹配失败就用默认的初始化
|
||||
// console.log(i,j,children.length-1);
|
||||
if (i == 0 && j == (children.length - 1)) {
|
||||
this.isInitMultiArray = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<template>
|
||||
<!--增加audio标签支持-->
|
||||
<audio
|
||||
:id="node.attr.id"
|
||||
:class="node.classStr"
|
||||
:style="node.styleStr"
|
||||
:src="node.attr.src"
|
||||
:loop="node.attr.loop"
|
||||
:poster="node.attr.poster"
|
||||
:name="node.attr.name"
|
||||
:author="node.attr.author"
|
||||
controls></audio>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'wxParseAudio',
|
||||
props: {
|
||||
node: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<template>
|
||||
<image
|
||||
:mode="node.attr.mode"
|
||||
:lazy-load="node.attr.lazyLoad"
|
||||
:class="node.classStr"
|
||||
:style="newStyleStr || node.styleStr"
|
||||
:data-src="node.attr.src"
|
||||
:src="node.attr.src"
|
||||
@tap="wxParseImgTap"
|
||||
@load="wxParseImgLoad"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'wxParseImg',
|
||||
data() {
|
||||
return {
|
||||
newStyleStr: '',
|
||||
preview: true,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
node: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
wxParseImgTap(e) {
|
||||
if (!this.preview) return;
|
||||
const { src } = e.currentTarget.dataset;
|
||||
if (!src) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {// TODO 遍历获取父节点执行方法
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.preview(src, e);
|
||||
},
|
||||
// 图片视觉宽高计算函数区
|
||||
wxParseImgLoad(e) {
|
||||
const { src } = e.currentTarget.dataset;
|
||||
if (!src) return;
|
||||
const { width, height } = e.mp.detail;
|
||||
const recal = this.wxAutoImageCal(width, height);
|
||||
const { imageheight, imageWidth } = recal;
|
||||
const { padding, mode } = this.node.attr;
|
||||
const { styleStr } = this.node;
|
||||
const imageHeightStyle = mode === 'widthFix' ? '' : `height: ${imageheight}px;`;
|
||||
this.newStyleStr = `${styleStr}; ${imageHeightStyle}; width: ${imageWidth}px; padding: 0 ${+padding}px;`;
|
||||
},
|
||||
// 计算视觉优先的图片宽高
|
||||
wxAutoImageCal(originalWidth, originalHeight) {
|
||||
// 获取图片的原始长宽
|
||||
const { padding } = this.node.attr;
|
||||
// const windowWidth = this.node.$screen.width - (2 * padding);
|
||||
const windowWidth = this.node.$screen.width - 30;
|
||||
const results = {};
|
||||
|
||||
if (originalWidth < 60 || originalHeight < 60) {
|
||||
const { src } = this.node.attr;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.removeImageUrl(src);
|
||||
this.preview = false;
|
||||
}
|
||||
|
||||
// 判断按照那种方式进行缩放
|
||||
if (originalWidth > windowWidth) {
|
||||
// 在图片width大于手机屏幕width时候
|
||||
results.imageWidth = windowWidth;
|
||||
results.imageheight = windowWidth * (originalHeight / originalWidth);
|
||||
} else {
|
||||
// 否则展示原来的数据
|
||||
results.imageWidth = originalWidth;
|
||||
results.imageheight = originalHeight;
|
||||
}
|
||||
|
||||
return results;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--table类型-->
|
||||
<block v-else-if="node.tag == 'table'">
|
||||
<view :class="node.classStr" class="table" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate1';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate0',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;// TODO currentTarget才有dataset
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {// TODO 遍历获取父节点执行方法
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
<template>
|
||||
<view :class="(node.tag == 'li' ? node.classStr : (node.node==='text'?'text':''))">
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<!-- <view :class="node.classStr" :style="node.styleStr"> -->
|
||||
<view :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate2';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate1',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate11';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate10',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<!--button类型-->
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
{{node.text}}
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
{{node.text}}
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
{{node.text}}
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate11',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate3';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate2',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate4';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate3',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate5';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate4',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate6';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate5',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate7';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate6',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate8';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate7',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate9';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate8',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<view>
|
||||
<!--判断是否是标签节点-->
|
||||
<block v-if="node.node == 'element'">
|
||||
<block v-if="node.tag == 'button'">
|
||||
<button type="default" size="mini">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</button>
|
||||
</block>
|
||||
|
||||
<!--li类型-->
|
||||
<block v-else-if="node.tag == 'li'">
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--video类型-->
|
||||
<block v-else-if="node.tag == 'video'">
|
||||
<wx-parse-video :node="node" />
|
||||
</block>
|
||||
|
||||
<!--audio类型-->
|
||||
<block v-else-if="node.tag == 'audio'">
|
||||
<wx-parse-audio :node="node" />
|
||||
</block>
|
||||
|
||||
<!--img类型-->
|
||||
<block v-else-if="node.tag == 'img'">
|
||||
<wx-parse-img :node="node" />
|
||||
</block>
|
||||
|
||||
<!--a类型-->
|
||||
<block v-else-if="node.tag == 'a'">
|
||||
<view @click="wxParseATap" :class="node.classStr" :data-href="node.attr.href" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!--br类型-->
|
||||
<block v-else-if="node.tag == 'br'">
|
||||
<text>\n</text>
|
||||
</block>
|
||||
|
||||
<!--其他标签-->
|
||||
<block v-else>
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<block v-for="(node, index) of node.nodes" :key="index">
|
||||
<wx-parse-template :node="node" />
|
||||
</block>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
</block>
|
||||
|
||||
<!--判断是否是文本节点-->
|
||||
<block v-else-if="node.node == 'text'">{{node.text}}</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wxParseTemplate from './wxParseTemplate10';
|
||||
import wxParseImg from './wxParseImg';
|
||||
import wxParseVideo from './wxParseVideo';
|
||||
import wxParseAudio from './wxParseAudio';
|
||||
|
||||
export default {
|
||||
name: 'wxParseTemplate9',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
wxParseImg,
|
||||
wxParseVideo,
|
||||
wxParseAudio,
|
||||
},
|
||||
methods: {
|
||||
wxParseATap(e) {
|
||||
const {
|
||||
href
|
||||
} = e.currentTarget.dataset;
|
||||
if (!href) return;
|
||||
let parent = this.$parent;
|
||||
while(!parent.preview || typeof parent.preview !== 'function') {
|
||||
parent = parent.$parent;
|
||||
}
|
||||
parent.navigate(href, e);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<template>
|
||||
<!--增加video标签支持,并循环添加-->
|
||||
<view :class="node.classStr" :style="node.styleStr">
|
||||
<video :class="node.classStr" class="video-video" :src="node.attr.src"></video>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'wxParseVideo',
|
||||
props: {
|
||||
node: {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
/**
|
||||
* html2Json 改造来自: https://github.com/Jxck/html2json
|
||||
*
|
||||
*
|
||||
* author: Di (微信小程序开发工程师)
|
||||
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||
* 垂直微信小程序开发交流社区
|
||||
*
|
||||
* github地址: https://github.com/icindy/wxParse
|
||||
*
|
||||
* for: 微信小程序富文本解析
|
||||
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||
*/
|
||||
|
||||
import wxDiscode from './wxDiscode';
|
||||
import HTMLParser from './htmlparser';
|
||||
|
||||
function makeMap(str) {
|
||||
const obj = {};
|
||||
const items = str.split(',');
|
||||
for (let i = 0; i < items.length; i += 1) obj[items[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Block Elements - HTML 5
|
||||
const block = makeMap('br,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video');
|
||||
|
||||
// Inline Elements - HTML 5
|
||||
const inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
|
||||
|
||||
// Elements that you can, intentionally, leave open
|
||||
// (and which close themselves)
|
||||
const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
|
||||
|
||||
function removeDOCTYPE(html) {
|
||||
const isDocument = /<body.*>([^]*)<\/body>/.test(html);
|
||||
return isDocument ? RegExp.$1 : html;
|
||||
}
|
||||
|
||||
function trimHtml(html) {
|
||||
return html
|
||||
.replace(/<!--.*?-->/gi, '')
|
||||
.replace(/\/\*.*?\*\//gi, '')
|
||||
.replace(/[ ]+</gi, '<')
|
||||
.replace(/<script[^]*<\/script>/gi, '')
|
||||
.replace(/<style[^]*<\/style>/gi, '');
|
||||
}
|
||||
|
||||
function getScreenInfo() {
|
||||
const screen = {};
|
||||
wx.getSystemInfo({
|
||||
success: (res) => {
|
||||
screen.width = res.windowWidth;
|
||||
screen.height = res.windowHeight;
|
||||
},
|
||||
});
|
||||
return screen;
|
||||
}
|
||||
|
||||
function html2json(html, customHandler, imageProp, host) {
|
||||
// 处理字符串
|
||||
html = removeDOCTYPE(html);
|
||||
html = trimHtml(html);
|
||||
html = wxDiscode.strDiscode(html);
|
||||
// 生成node节点
|
||||
const bufArray = [];
|
||||
const results = {
|
||||
nodes: [],
|
||||
imageUrls: [],
|
||||
};
|
||||
|
||||
const screen = getScreenInfo();
|
||||
function Node(tag) {
|
||||
this.node = 'element';
|
||||
this.tag = tag;
|
||||
|
||||
this.$screen = screen;
|
||||
}
|
||||
|
||||
HTMLParser(html, {
|
||||
start(tag, attrs, unary) {
|
||||
// node for this element
|
||||
const node = new Node(tag);
|
||||
|
||||
if (bufArray.length !== 0) {
|
||||
const parent = bufArray[0];
|
||||
if (parent.nodes === undefined) {
|
||||
parent.nodes = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (block[tag]) {
|
||||
node.tagType = 'block';
|
||||
} else if (inline[tag]) {
|
||||
node.tagType = 'inline';
|
||||
} else if (closeSelf[tag]) {
|
||||
node.tagType = 'closeSelf';
|
||||
}
|
||||
|
||||
node.attr = attrs.reduce((pre, attr) => {
|
||||
const { name } = attr;
|
||||
let { value } = attr;
|
||||
if (name === 'class') {
|
||||
node.classStr = value;
|
||||
}
|
||||
// has multi attibutes
|
||||
// make it array of attribute
|
||||
if (name === 'style') {
|
||||
node.styleStr = value;
|
||||
}
|
||||
if (value.match(/ /)) {
|
||||
value = value.split(' ');
|
||||
}
|
||||
|
||||
// if attr already exists
|
||||
// merge it
|
||||
if (pre[name]) {
|
||||
if (Array.isArray(pre[name])) {
|
||||
// already array, push to last
|
||||
pre[name].push(value);
|
||||
} else {
|
||||
// single value, make it array
|
||||
pre[name] = [pre[name], value];
|
||||
}
|
||||
} else {
|
||||
// not exist, put it
|
||||
pre[name] = value;
|
||||
}
|
||||
|
||||
return pre;
|
||||
}, {});
|
||||
|
||||
// 优化样式相关属性
|
||||
if (node.classStr) {
|
||||
node.classStr += ` ${node.tag}`;
|
||||
} else {
|
||||
node.classStr = node.tag;
|
||||
}
|
||||
if (node.tagType === 'inline') {
|
||||
node.classStr += ' inline';
|
||||
}
|
||||
|
||||
// 对img添加额外数据
|
||||
if (node.tag === 'img') {
|
||||
let imgUrl = node.attr.src;
|
||||
imgUrl = wxDiscode.urlToHttpUrl(imgUrl, imageProp.domain);
|
||||
Object.assign(node.attr, imageProp, {
|
||||
src: imgUrl || '',
|
||||
});
|
||||
if (imgUrl) {
|
||||
results.imageUrls.push(imgUrl);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理a标签属性
|
||||
if (node.tag === 'a') {
|
||||
node.attr.href = node.attr.href || '';
|
||||
}
|
||||
|
||||
// 处理font标签样式属性
|
||||
if (node.tag === 'font') {
|
||||
const fontSize = [
|
||||
'x-small',
|
||||
'small',
|
||||
'medium',
|
||||
'large',
|
||||
'x-large',
|
||||
'xx-large',
|
||||
'-webkit-xxx-large',
|
||||
];
|
||||
const styleAttrs = {
|
||||
color: 'color',
|
||||
face: 'font-family',
|
||||
size: 'font-size',
|
||||
};
|
||||
if (!node.styleStr) node.styleStr = '';
|
||||
Object.keys(styleAttrs).forEach((key) => {
|
||||
if (node.attr[key]) {
|
||||
const value = key === 'size' ? fontSize[node.attr[key] - 1] : node.attr[key];
|
||||
node.styleStr += `${styleAttrs[key]}: ${value};`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 临时记录source资源
|
||||
if (node.tag === 'source') {
|
||||
results.source = node.attr.src;
|
||||
}
|
||||
|
||||
if (customHandler.start) {
|
||||
customHandler.start(node, results);
|
||||
}
|
||||
|
||||
if (unary) {
|
||||
// if this tag doesn't have end tag
|
||||
// like <img src="hoge.png"/>
|
||||
// add to parents
|
||||
const parent = bufArray[0] || results;
|
||||
if (parent.nodes === undefined) {
|
||||
parent.nodes = [];
|
||||
}
|
||||
parent.nodes.push(node);
|
||||
} else {
|
||||
bufArray.unshift(node);
|
||||
}
|
||||
},
|
||||
end(tag) {
|
||||
// merge into parent tag
|
||||
const node = bufArray.shift();
|
||||
if (node.tag !== tag) {
|
||||
console.error('invalid state: mismatch end tag');
|
||||
}
|
||||
|
||||
// 当有缓存source资源时于于video补上src资源
|
||||
if (node.tag === 'video' && results.source) {
|
||||
node.attr.src = results.source;
|
||||
delete results.source;
|
||||
}
|
||||
|
||||
if (customHandler.end) {
|
||||
customHandler.end(node, results);
|
||||
}
|
||||
|
||||
if (bufArray.length === 0) {
|
||||
results.nodes.push(node);
|
||||
} else {
|
||||
const parent = bufArray[0];
|
||||
if (!parent.nodes) {
|
||||
parent.nodes = [];
|
||||
}
|
||||
parent.nodes.push(node);
|
||||
}
|
||||
},
|
||||
chars(text) {
|
||||
if (!text.trim()) return;
|
||||
|
||||
const node = {
|
||||
node: 'text',
|
||||
text,
|
||||
};
|
||||
|
||||
if (customHandler.chars) {
|
||||
customHandler.chars(node, results);
|
||||
}
|
||||
|
||||
if (bufArray.length === 0) {
|
||||
results.nodes.push(node);
|
||||
} else {
|
||||
const parent = bufArray[0];
|
||||
if (parent.nodes === undefined) {
|
||||
parent.nodes = [];
|
||||
}
|
||||
parent.nodes.push(node);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
export default html2json;
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
/**
|
||||
*
|
||||
* htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
|
||||
*
|
||||
* author: Di (微信小程序开发工程师)
|
||||
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||
* 垂直微信小程序开发交流社区
|
||||
*
|
||||
* github地址: https://github.com/icindy/wxParse
|
||||
*
|
||||
* for: 微信小程序富文本解析
|
||||
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||
*/
|
||||
// Regular Expressions for parsing tags and attributes
|
||||
|
||||
const startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z0-9_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
|
||||
const endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
|
||||
const attr = /([a-zA-Z0-9_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
|
||||
|
||||
function makeMap(str) {
|
||||
const obj = {};
|
||||
const items = str.split(',');
|
||||
for (let i = 0; i < items.length; i += 1) obj[items[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Empty Elements - HTML 5
|
||||
const empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr');
|
||||
|
||||
// Block Elements - HTML 5
|
||||
const block = makeMap('address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video');
|
||||
|
||||
// Inline Elements - HTML 5
|
||||
const inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
|
||||
|
||||
// Elements that you can, intentionally, leave open
|
||||
// (and which close themselves)
|
||||
const closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
|
||||
|
||||
// Attributes that have their values filled in disabled="disabled"
|
||||
const fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected');
|
||||
|
||||
function HTMLParser(html, handler) {
|
||||
let index;
|
||||
let chars;
|
||||
let match;
|
||||
let last = html;
|
||||
const stack = [];
|
||||
|
||||
stack.last = () => stack[stack.length - 1];
|
||||
|
||||
function parseEndTag(tag, tagName) {
|
||||
// If no tag name is provided, clean shop
|
||||
let pos;
|
||||
if (!tagName) {
|
||||
pos = 0;
|
||||
} else {
|
||||
// Find the closest opened tag of the same type
|
||||
tagName = tagName.toLowerCase();
|
||||
for (pos = stack.length - 1; pos >= 0; pos -= 1) {
|
||||
if (stack[pos] === tagName) break;
|
||||
}
|
||||
}
|
||||
if (pos >= 0) {
|
||||
// Close all the open elements, up the stack
|
||||
for (let i = stack.length - 1; i >= pos; i -= 1) {
|
||||
if (handler.end) handler.end(stack[i]);
|
||||
}
|
||||
|
||||
// Remove the open elements from the stack
|
||||
stack.length = pos;
|
||||
}
|
||||
}
|
||||
|
||||
function parseStartTag(tag, tagName, rest, unary) {
|
||||
tagName = tagName.toLowerCase();
|
||||
|
||||
if (block[tagName]) {
|
||||
while (stack.last() && inline[stack.last()]) {
|
||||
parseEndTag('', stack.last());
|
||||
}
|
||||
}
|
||||
|
||||
if (closeSelf[tagName] && stack.last() === tagName) {
|
||||
parseEndTag('', tagName);
|
||||
}
|
||||
|
||||
unary = empty[tagName] || !!unary;
|
||||
|
||||
if (!unary) stack.push(tagName);
|
||||
|
||||
if (handler.start) {
|
||||
const attrs = [];
|
||||
|
||||
rest.replace(attr, function genAttr(matches, name) {
|
||||
const value = arguments[2] || arguments[3] || arguments[4] || (fillAttrs[name] ? name : '');
|
||||
|
||||
attrs.push({
|
||||
name,
|
||||
value,
|
||||
escaped: value.replace(/(^|[^\\])"/g, '$1\\"'), // "
|
||||
});
|
||||
});
|
||||
|
||||
if (handler.start) {
|
||||
handler.start(tagName, attrs, unary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (html) {
|
||||
chars = true;
|
||||
|
||||
if (html.indexOf('</') === 0) {
|
||||
match = html.match(endTag);
|
||||
|
||||
if (match) {
|
||||
html = html.substring(match[0].length);
|
||||
match[0].replace(endTag, parseEndTag);
|
||||
chars = false;
|
||||
}
|
||||
|
||||
// start tag
|
||||
} else if (html.indexOf('<') === 0) {
|
||||
match = html.match(startTag);
|
||||
|
||||
if (match) {
|
||||
html = html.substring(match[0].length);
|
||||
match[0].replace(startTag, parseStartTag);
|
||||
chars = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (chars) {
|
||||
index = html.indexOf('<');
|
||||
let text = '';
|
||||
while (index === 0) {
|
||||
text += '<';
|
||||
html = html.substring(1);
|
||||
index = html.indexOf('<');
|
||||
}
|
||||
text += index < 0 ? html : html.substring(0, index);
|
||||
html = index < 0 ? '' : html.substring(index);
|
||||
|
||||
if (handler.chars) handler.chars(text);
|
||||
}
|
||||
|
||||
if (html === last) throw new Error(`Parse Error: ${html}`);
|
||||
last = html;
|
||||
}
|
||||
|
||||
// Clean up any remaining tags
|
||||
parseEndTag();
|
||||
}
|
||||
|
||||
export default HTMLParser;
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
// HTML 支持的数学符号
|
||||
function strNumDiscode(str) {
|
||||
str = str.replace(/∀/g, '∀');
|
||||
str = str.replace(/∂/g, '∂');
|
||||
str = str.replace(/∃/g, '∃');
|
||||
str = str.replace(/∅/g, '∅');
|
||||
str = str.replace(/∇/g, '∇');
|
||||
str = str.replace(/∈/g, '∈');
|
||||
str = str.replace(/∉/g, '∉');
|
||||
str = str.replace(/∋/g, '∋');
|
||||
str = str.replace(/∏/g, '∏');
|
||||
str = str.replace(/∑/g, '∑');
|
||||
str = str.replace(/−/g, '−');
|
||||
str = str.replace(/∗/g, '∗');
|
||||
str = str.replace(/√/g, '√');
|
||||
str = str.replace(/∝/g, '∝');
|
||||
str = str.replace(/∞/g, '∞');
|
||||
str = str.replace(/∠/g, '∠');
|
||||
str = str.replace(/∧/g, '∧');
|
||||
str = str.replace(/∨/g, '∨');
|
||||
str = str.replace(/∩/g, '∩');
|
||||
str = str.replace(/∪/g, '∪');
|
||||
str = str.replace(/∫/g, '∫');
|
||||
str = str.replace(/∴/g, '∴');
|
||||
str = str.replace(/∼/g, '∼');
|
||||
str = str.replace(/≅/g, '≅');
|
||||
str = str.replace(/≈/g, '≈');
|
||||
str = str.replace(/≠/g, '≠');
|
||||
str = str.replace(/≤/g, '≤');
|
||||
str = str.replace(/≥/g, '≥');
|
||||
str = str.replace(/⊂/g, '⊂');
|
||||
str = str.replace(/⊃/g, '⊃');
|
||||
str = str.replace(/⊄/g, '⊄');
|
||||
str = str.replace(/⊆/g, '⊆');
|
||||
str = str.replace(/⊇/g, '⊇');
|
||||
str = str.replace(/⊕/g, '⊕');
|
||||
str = str.replace(/⊗/g, '⊗');
|
||||
str = str.replace(/⊥/g, '⊥');
|
||||
str = str.replace(/⋅/g, '⋅');
|
||||
return str;
|
||||
}
|
||||
|
||||
// HTML 支持的希腊字母
|
||||
function strGreeceDiscode(str) {
|
||||
str = str.replace(/Α/g, 'Α');
|
||||
str = str.replace(/Β/g, 'Β');
|
||||
str = str.replace(/Γ/g, 'Γ');
|
||||
str = str.replace(/Δ/g, 'Δ');
|
||||
str = str.replace(/Ε/g, 'Ε');
|
||||
str = str.replace(/Ζ/g, 'Ζ');
|
||||
str = str.replace(/Η/g, 'Η');
|
||||
str = str.replace(/Θ/g, 'Θ');
|
||||
str = str.replace(/Ι/g, 'Ι');
|
||||
str = str.replace(/Κ/g, 'Κ');
|
||||
str = str.replace(/Λ/g, 'Λ');
|
||||
str = str.replace(/Μ/g, 'Μ');
|
||||
str = str.replace(/Ν/g, 'Ν');
|
||||
str = str.replace(/Ξ/g, 'Ν');
|
||||
str = str.replace(/Ο/g, 'Ο');
|
||||
str = str.replace(/Π/g, 'Π');
|
||||
str = str.replace(/Ρ/g, 'Ρ');
|
||||
str = str.replace(/Σ/g, 'Σ');
|
||||
str = str.replace(/Τ/g, 'Τ');
|
||||
str = str.replace(/Υ/g, 'Υ');
|
||||
str = str.replace(/Φ/g, 'Φ');
|
||||
str = str.replace(/Χ/g, 'Χ');
|
||||
str = str.replace(/Ψ/g, 'Ψ');
|
||||
str = str.replace(/Ω/g, 'Ω');
|
||||
|
||||
str = str.replace(/α/g, 'α');
|
||||
str = str.replace(/β/g, 'β');
|
||||
str = str.replace(/γ/g, 'γ');
|
||||
str = str.replace(/δ/g, 'δ');
|
||||
str = str.replace(/ε/g, 'ε');
|
||||
str = str.replace(/ζ/g, 'ζ');
|
||||
str = str.replace(/η/g, 'η');
|
||||
str = str.replace(/θ/g, 'θ');
|
||||
str = str.replace(/ι/g, 'ι');
|
||||
str = str.replace(/κ/g, 'κ');
|
||||
str = str.replace(/λ/g, 'λ');
|
||||
str = str.replace(/μ/g, 'μ');
|
||||
str = str.replace(/ν/g, 'ν');
|
||||
str = str.replace(/ξ/g, 'ξ');
|
||||
str = str.replace(/ο/g, 'ο');
|
||||
str = str.replace(/π/g, 'π');
|
||||
str = str.replace(/ρ/g, 'ρ');
|
||||
str = str.replace(/ς/g, 'ς');
|
||||
str = str.replace(/σ/g, 'σ');
|
||||
str = str.replace(/τ/g, 'τ');
|
||||
str = str.replace(/υ/g, 'υ');
|
||||
str = str.replace(/φ/g, 'φ');
|
||||
str = str.replace(/χ/g, 'χ');
|
||||
str = str.replace(/ψ/g, 'ψ');
|
||||
str = str.replace(/ω/g, 'ω');
|
||||
str = str.replace(/ϑ/g, 'ϑ');
|
||||
str = str.replace(/ϒ/g, 'ϒ');
|
||||
str = str.replace(/ϖ/g, 'ϖ');
|
||||
str = str.replace(/·/g, '·');
|
||||
return str;
|
||||
}
|
||||
|
||||
function strcharacterDiscode(str) {
|
||||
// 加入常用解析
|
||||
str = str.replace(/ /g, ' ');
|
||||
str = str.replace(/ /g, ' ');
|
||||
str = str.replace(/ /g, ' ');
|
||||
str = str.replace(/"/g, "'");
|
||||
str = str.replace(/&/g, '&');
|
||||
str = str.replace(/</g, '<');
|
||||
str = str.replace(/>/g, '>');
|
||||
str = str.replace(/•/g, '•');
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// HTML 支持的其他实体
|
||||
function strOtherDiscode(str) {
|
||||
str = str.replace(/Œ/g, 'Œ');
|
||||
str = str.replace(/œ/g, 'œ');
|
||||
str = str.replace(/Š/g, 'Š');
|
||||
str = str.replace(/š/g, 'š');
|
||||
str = str.replace(/Ÿ/g, 'Ÿ');
|
||||
str = str.replace(/ƒ/g, 'ƒ');
|
||||
str = str.replace(/ˆ/g, 'ˆ');
|
||||
str = str.replace(/˜/g, '˜');
|
||||
str = str.replace(/ /g, '');
|
||||
str = str.replace(/ /g, '');
|
||||
str = str.replace(/ /g, '');
|
||||
str = str.replace(/‌/g, '');
|
||||
str = str.replace(/‍/g, '');
|
||||
str = str.replace(/‎/g, '');
|
||||
str = str.replace(/‏/g, '');
|
||||
str = str.replace(/–/g, '–');
|
||||
str = str.replace(/—/g, '—');
|
||||
str = str.replace(/‘/g, '‘');
|
||||
str = str.replace(/’/g, '’');
|
||||
str = str.replace(/‚/g, '‚');
|
||||
str = str.replace(/“/g, '“');
|
||||
str = str.replace(/”/g, '”');
|
||||
str = str.replace(/„/g, '„');
|
||||
str = str.replace(/†/g, '†');
|
||||
str = str.replace(/‡/g, '‡');
|
||||
str = str.replace(/•/g, '•');
|
||||
str = str.replace(/…/g, '…');
|
||||
str = str.replace(/‰/g, '‰');
|
||||
str = str.replace(/′/g, '′');
|
||||
str = str.replace(/″/g, '″');
|
||||
str = str.replace(/‹/g, '‹');
|
||||
str = str.replace(/›/g, '›');
|
||||
str = str.replace(/‾/g, '‾');
|
||||
str = str.replace(/€/g, '€');
|
||||
str = str.replace(/™/g, '™');
|
||||
|
||||
str = str.replace(/←/g, '←');
|
||||
str = str.replace(/↑/g, '↑');
|
||||
str = str.replace(/→/g, '→');
|
||||
str = str.replace(/↓/g, '↓');
|
||||
str = str.replace(/↔/g, '↔');
|
||||
str = str.replace(/↵/g, '↵');
|
||||
str = str.replace(/⌈/g, '⌈');
|
||||
str = str.replace(/⌉/g, '⌉');
|
||||
|
||||
str = str.replace(/⌊/g, '⌊');
|
||||
str = str.replace(/⌋/g, '⌋');
|
||||
str = str.replace(/◊/g, '◊');
|
||||
str = str.replace(/♠/g, '♠');
|
||||
str = str.replace(/♣/g, '♣');
|
||||
str = str.replace(/♥/g, '♥');
|
||||
|
||||
str = str.replace(/♦/g, '♦');
|
||||
str = str.replace(/'/g, "'");
|
||||
return str;
|
||||
}
|
||||
|
||||
function strDiscode(str) {
|
||||
str = strNumDiscode(str);
|
||||
str = strGreeceDiscode(str);
|
||||
str = strcharacterDiscode(str);
|
||||
str = strOtherDiscode(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
function urlToHttpUrl(url, domain) {
|
||||
if (/^\/\//.test(url)) {
|
||||
return `https:${url}`;
|
||||
} else if (/^\//.test(url)) {
|
||||
return `https://${domain}${url}`;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
export default {
|
||||
strDiscode,
|
||||
urlToHttpUrl,
|
||||
};
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
## uParse 适用于 uni-app/mpvue 的富文本解析组件
|
||||
|
||||
> 支持 Html、Markdown 解析,Fork自: [mpvue-wxParse](https://github.com/F-loat/mpvue-wxParse)
|
||||
|
||||
|
||||
## 属性
|
||||
|
||||
| 名称 | 类型 | 默认值 | 描述 |
|
||||
| -----------------|--------------- | ------------- | ---------------- |
|
||||
| loading | Boolean | false | 数据加载状态 |
|
||||
| className | String | — | 自定义 class 名称 |
|
||||
| content | String | — | 渲染内容 |
|
||||
| noData | String | 数据不能为空 | 空数据时的渲染展示 |
|
||||
| startHandler | Function | 见源码 | 自定义 parser 函数 |
|
||||
| endHandler | Function | null | 自定义 parser 函数 |
|
||||
| charsHandler | Function | null | 自定义 parser 函数 |
|
||||
| imageProp | Object | 见下文 | 图片相关参数 |
|
||||
|
||||
### 自定义 parser 函数具体介绍
|
||||
|
||||
* 传入的参数为当前节点 `node` 对象及解析结果 `results` 对象,例如 `startHandler(node, results)`
|
||||
* 无需返回值,通过对传入的参数直接操作来完成需要的改动
|
||||
* 自定义函数会在原解析函数处理之后执行
|
||||
|
||||
### imageProp 对象具体属性
|
||||
|
||||
| 名称 | 类型 | 默认值 | 描述 |
|
||||
| -----------------|--------------- | ------------- | ------------------ |
|
||||
| mode | String | 'aspectFit' | 图片裁剪、缩放的模式 |
|
||||
| padding | Number | 0 | 图片内边距 |
|
||||
| lazyLoad | Boolean | false | 图片懒加载 |
|
||||
| domain | String | '' | 图片服务域名 |
|
||||
|
||||
## 事件
|
||||
|
||||
| 名称 | 参数 | 描述 |
|
||||
| -----------------|----------------- | ---------------- |
|
||||
| preview | 图片地址,原始事件 | 预览图片时触发 |
|
||||
| navigate | 链接地址,原始事件 | 点击链接时触发 |
|
||||
|
||||
## 基本使用方法
|
||||
|
||||
|
||||
``` vue
|
||||
<template>
|
||||
<div>
|
||||
<u-parse :content="article" @preview="preview" @navigate="navigate" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uParse from '@/components/u-parse/u-parse.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
uParse
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
article: '<div>我是HTML代码</div>'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
preview(src, e) {
|
||||
// do something
|
||||
},
|
||||
navigate(href, e) {
|
||||
// do something
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import url("@/components/u-parse/u-parse.css");
|
||||
</style>
|
||||
```
|
||||
|
||||
|
||||
## 渲染 Markdown
|
||||
|
||||
> 先将 markdown 转换为 html 即可
|
||||
|
||||
```
|
||||
npm install marked
|
||||
```
|
||||
|
||||
``` js
|
||||
import marked from 'marked'
|
||||
import uParse from '@/components/u-parse/u-parse.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
uParse
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
article: marked(`#hello, markdown!`)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -0,0 +1,232 @@
|
|||
/**
|
||||
* author: Di (微信小程序开发工程师)
|
||||
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
|
||||
* 垂直微信小程序开发交流社区
|
||||
*
|
||||
* github地址: https://github.com/icindy/wxParse
|
||||
*
|
||||
* for: 微信小程序富文本解析
|
||||
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
|
||||
*/
|
||||
|
||||
.wxParse {
|
||||
width: 100%;
|
||||
font-family: Helvetica, sans-serif;
|
||||
font-size: 30upx;
|
||||
color: #666;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.wxParse view {
|
||||
word-break: hyphenate;
|
||||
}
|
||||
|
||||
.wxParse .inline {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.wxParse .div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.wxParse .h1 .text {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
.wxParse .h2 .text {
|
||||
font-size: 1.5em;
|
||||
margin: 0.83em 0;
|
||||
}
|
||||
.wxParse .h3 .text {
|
||||
font-size: 1.17em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.wxParse .h4 .text {
|
||||
margin: 1.33em 0;
|
||||
}
|
||||
.wxParse .h5 .text {
|
||||
font-size: 0.83em;
|
||||
margin: 1.67em 0;
|
||||
}
|
||||
.wxParse .h6 .text {
|
||||
font-size: 0.67em;
|
||||
margin: 2.33em 0;
|
||||
}
|
||||
|
||||
.wxParse .h1 .text,
|
||||
.wxParse .h2 .text,
|
||||
.wxParse .h3 .text,
|
||||
.wxParse .h4 .text,
|
||||
.wxParse .h5 .text,
|
||||
.wxParse .h6 .text,
|
||||
.wxParse .b,
|
||||
.wxParse .strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
.wxParse .p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.wxParse .i,
|
||||
.wxParse .cite,
|
||||
.wxParse .em,
|
||||
.wxParse .var,
|
||||
.wxParse .address {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.wxParse .pre,
|
||||
.wxParse .tt,
|
||||
.wxParse .code,
|
||||
.wxParse .kbd,
|
||||
.wxParse .samp {
|
||||
font-family: monospace;
|
||||
}
|
||||
.wxParse .pre {
|
||||
overflow: auto;
|
||||
background: #f5f5f5;
|
||||
padding: 16upx;
|
||||
white-space: pre;
|
||||
margin: 1em 0upx;
|
||||
}
|
||||
.wxParse .code {
|
||||
display: inline;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.wxParse .big {
|
||||
font-size: 1.17em;
|
||||
}
|
||||
|
||||
.wxParse .small,
|
||||
.wxParse .sub,
|
||||
.wxParse .sup {
|
||||
font-size: 0.83em;
|
||||
}
|
||||
|
||||
.wxParse .sub {
|
||||
vertical-align: sub;
|
||||
}
|
||||
.wxParse .sup {
|
||||
vertical-align: super;
|
||||
}
|
||||
|
||||
.wxParse .s,
|
||||
.wxParse .strike,
|
||||
.wxParse .del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.wxParse .strong,
|
||||
.wxParse .s {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.wxParse .a {
|
||||
color: deepskyblue;
|
||||
}
|
||||
|
||||
.wxParse .video {
|
||||
text-align: center;
|
||||
margin: 22upx 0;
|
||||
}
|
||||
|
||||
.wxParse .video-video {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wxParse .img {
|
||||
display: inline-block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wxParse .blockquote {
|
||||
margin: 10upx 0;
|
||||
padding: 22upx 0 22upx 22upx;
|
||||
font-family: Courier, Calibri, "宋体";
|
||||
background: #f5f5f5;
|
||||
border-left: 6upx solid #dbdbdb;
|
||||
}
|
||||
.wxParse .blockquote .p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.wxParse .ul, .wxParse .ol {
|
||||
display: block;
|
||||
margin: 1em 0;
|
||||
padding-left: 33upx;
|
||||
}
|
||||
.wxParse .ol {
|
||||
list-style-type: disc;
|
||||
}
|
||||
.wxParse .ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
.wxParse .ol>weixin-parse-template,.wxParse .ul>weixin-parse-template {
|
||||
display: list-item;
|
||||
align-items: baseline;
|
||||
text-align: match-parent;
|
||||
}
|
||||
|
||||
.wxParse .ol>.li,.wxParse .ul>.li {
|
||||
display: list-item;
|
||||
align-items: baseline;
|
||||
text-align: match-parent;
|
||||
}
|
||||
.wxParse .ul .ul, .wxParse .ol .ul {
|
||||
list-style-type: circle;
|
||||
}
|
||||
.wxParse .ol .ol .ul, .wxParse .ol .ul .ul, .wxParse .ul .ol .ul, .wxParse .ul .ul .ul {
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
.wxParse .u {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.wxParse .hide {
|
||||
display: none;
|
||||
}
|
||||
.wxParse .del {
|
||||
display: inline;
|
||||
}
|
||||
.wxParse .figure {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wxParse .table {
|
||||
width: 100%;
|
||||
}
|
||||
.wxParse .thead, .wxParse .tfoot, .wxParse .tr {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.wxParse .tr {
|
||||
width:100%;
|
||||
display: flex;
|
||||
border-right: 2upx solid #e0e0e0;
|
||||
border-bottom: 2upx solid #e0e0e0;
|
||||
}
|
||||
.wxParse .th,
|
||||
.wxParse .td {
|
||||
display: flex;
|
||||
width: 1276upx;
|
||||
overflow: auto;
|
||||
flex: 1;
|
||||
padding: 11upx;
|
||||
border-left: 2upx solid #e0e0e0;
|
||||
}
|
||||
.wxParse .td:last {
|
||||
border-top: 2upx solid #e0e0e0;
|
||||
}
|
||||
.wxParse .th {
|
||||
background: #f0f0f0;
|
||||
border-top: 2upx solid #e0e0e0;
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
<!--**
|
||||
* forked from:https://github.com/F-loat/mpvue-wxParse
|
||||
*
|
||||
* github地址: https://github.com/dcloudio/uParse
|
||||
*
|
||||
* for: uni-app框架下 富文本解析
|
||||
*/-->
|
||||
|
||||
<template>
|
||||
<!--基础元素-->
|
||||
<div class="wxParse" :class="className" v-if="!loading">
|
||||
<block v-for="(node,index) of nodes" :key="index">
|
||||
<wxParseTemplate :node="node" />
|
||||
</block>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HtmlToJson from './libs/html2json';
|
||||
import wxParseTemplate from './components/wxParseTemplate0';
|
||||
|
||||
export default {
|
||||
name: 'wxParse',
|
||||
props: {
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
className: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
noData: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
startHandler: {
|
||||
type: Function,
|
||||
default() {
|
||||
return (node) => {
|
||||
node.attr.class = null;
|
||||
node.attr.style = null;
|
||||
};
|
||||
},
|
||||
},
|
||||
endHandler: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
charsHandler: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
imageProp: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
mode: 'aspectFit',
|
||||
padding: 0,
|
||||
lazyLoad: false,
|
||||
domain: '',
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
components: {
|
||||
wxParseTemplate,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imageUrls: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
nodes() {
|
||||
const {
|
||||
content,
|
||||
noData,
|
||||
imageProp,
|
||||
startHandler,
|
||||
endHandler,
|
||||
charsHandler,
|
||||
} = this;
|
||||
const parseData = content || noData;
|
||||
const customHandler = {
|
||||
start: startHandler,
|
||||
end: endHandler,
|
||||
chars: charsHandler,
|
||||
};
|
||||
const results = HtmlToJson(parseData, customHandler, imageProp, this);
|
||||
this.imageUrls = results.imageUrls;
|
||||
// console.log(results)
|
||||
return results.nodes;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
navigate(href, $event) {
|
||||
this.$emit('navigate', href, $event);
|
||||
},
|
||||
preview(src, $event) {
|
||||
if (!this.imageUrls.length) return;
|
||||
wx.previewImage({
|
||||
current: src,
|
||||
urls: this.imageUrls,
|
||||
});
|
||||
this.$emit('preview', src, $event);
|
||||
},
|
||||
removeImageUrl(src) {
|
||||
const { imageUrls } = this;
|
||||
imageUrls.splice(imageUrls.indexOf(src), 1);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
## 1.0.4(2023-03-29)
|
||||
- 修复 手动上传删除一个文件后不能再上传的bug
|
||||
## 1.0.3(2022-12-19)
|
||||
- 新增 sourceType 属性, 可以自定义图片和视频选择的来源
|
||||
## 1.0.2(2022-07-04)
|
||||
- 修复 在uni-forms下样式不生效的bug
|
||||
## 1.0.1(2021-11-23)
|
||||
- 修复 参数为对象的情况下,url在某些情况显示错误的bug
|
||||
## 1.0.0(2021-11-19)
|
||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-file-picker](https://uniapp.dcloud.io/component/uniui/uni-file-picker)
|
||||
## 0.2.16(2021-11-08)
|
||||
- 修复 传入空对象 ,显示错误的Bug
|
||||
## 0.2.15(2021-08-30)
|
||||
- 修复 return-type="object" 时且存在v-model时,无法删除文件的Bug
|
||||
## 0.2.14(2021-08-23)
|
||||
- 新增 参数中返回 fileID 字段
|
||||
## 0.2.13(2021-08-23)
|
||||
- 修复 腾讯云传入fileID 不能回显的bug
|
||||
- 修复 选择图片后,不能放大的问题
|
||||
## 0.2.12(2021-08-17)
|
||||
- 修复 由于 0.2.11 版本引起的不能回显图片的Bug
|
||||
## 0.2.11(2021-08-16)
|
||||
- 新增 clearFiles(index) 方法,可以手动删除指定文件
|
||||
- 修复 v-model 值设为 null 报错的Bug
|
||||
## 0.2.10(2021-08-13)
|
||||
- 修复 return-type="object" 时,无法删除文件的Bug
|
||||
## 0.2.9(2021-08-03)
|
||||
- 修复 auto-upload 属性失效的Bug
|
||||
## 0.2.8(2021-07-31)
|
||||
- 修复 fileExtname属性不指定值报错的Bug
|
||||
## 0.2.7(2021-07-31)
|
||||
- 修复 在某种场景下图片不回显的Bug
|
||||
## 0.2.6(2021-07-30)
|
||||
- 修复 return-type为object下,返回值不正确的Bug
|
||||
## 0.2.5(2021-07-30)
|
||||
- 修复(重要) H5 平台下如果和uni-forms组件一同使用导致页面卡死的问题
|
||||
## 0.2.3(2021-07-28)
|
||||
- 优化 调整示例代码
|
||||
## 0.2.2(2021-07-27)
|
||||
- 修复 vue3 下赋值错误的Bug
|
||||
- 优化 h5平台下上传文件导致页面卡死的问题
|
||||
## 0.2.0(2021-07-13)
|
||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||
## 0.1.1(2021-07-02)
|
||||
- 修复 sourceType 缺少默认值导致 ios 无法选择文件
|
||||
## 0.1.0(2021-06-30)
|
||||
- 优化 解耦与uniCloud的强绑定关系 ,如不绑定服务空间,默认autoUpload为false且不可更改
|
||||
## 0.0.11(2021-06-30)
|
||||
- 修复 由 0.0.10 版本引发的 returnType 属性失效的问题
|
||||
## 0.0.10(2021-06-29)
|
||||
- 优化 文件上传后进度条消失时机
|
||||
## 0.0.9(2021-06-29)
|
||||
- 修复 在uni-forms 中,删除文件 ,获取的值不对的Bug
|
||||
## 0.0.8(2021-06-15)
|
||||
- 修复 删除文件时无法触发 v-model 的Bug
|
||||
## 0.0.7(2021-05-12)
|
||||
- 新增 组件示例地址
|
||||
## 0.0.6(2021-04-09)
|
||||
- 修复 选择的文件非 file-extname 字段指定的扩展名报错的Bug
|
||||
## 0.0.5(2021-04-09)
|
||||
- 优化 更新组件示例
|
||||
## 0.0.4(2021-04-09)
|
||||
- 优化 file-extname 字段支持字符串写法,多个扩展名需要用逗号分隔
|
||||
## 0.0.3(2021-02-05)
|
||||
- 调整为uni_modules目录规范
|
||||
- 修复 微信小程序不指定 fileExtname 属性选择失败的Bug
|
||||
|
|
@ -0,0 +1,224 @@
|
|||
'use strict';
|
||||
|
||||
const ERR_MSG_OK = 'chooseAndUploadFile:ok';
|
||||
const ERR_MSG_FAIL = 'chooseAndUploadFile:fail';
|
||||
|
||||
function chooseImage(opts) {
|
||||
const {
|
||||
count,
|
||||
sizeType = ['original', 'compressed'],
|
||||
sourceType,
|
||||
extension
|
||||
} = opts
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.chooseImage({
|
||||
count,
|
||||
sizeType,
|
||||
sourceType,
|
||||
extension,
|
||||
success(res) {
|
||||
resolve(normalizeChooseAndUploadFileRes(res, 'image'));
|
||||
},
|
||||
fail(res) {
|
||||
reject({
|
||||
errMsg: res.errMsg.replace('chooseImage:fail', ERR_MSG_FAIL),
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function chooseVideo(opts) {
|
||||
const {
|
||||
camera,
|
||||
compressed,
|
||||
maxDuration,
|
||||
sourceType,
|
||||
extension
|
||||
} = opts;
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.chooseVideo({
|
||||
camera,
|
||||
compressed,
|
||||
maxDuration,
|
||||
sourceType,
|
||||
extension,
|
||||
success(res) {
|
||||
const {
|
||||
tempFilePath,
|
||||
duration,
|
||||
size,
|
||||
height,
|
||||
width
|
||||
} = res;
|
||||
resolve(normalizeChooseAndUploadFileRes({
|
||||
errMsg: 'chooseVideo:ok',
|
||||
tempFilePaths: [tempFilePath],
|
||||
tempFiles: [
|
||||
{
|
||||
name: (res.tempFile && res.tempFile.name) || '',
|
||||
path: tempFilePath,
|
||||
size,
|
||||
type: (res.tempFile && res.tempFile.type) || '',
|
||||
width,
|
||||
height,
|
||||
duration,
|
||||
fileType: 'video',
|
||||
cloudPath: '',
|
||||
}, ],
|
||||
}, 'video'));
|
||||
},
|
||||
fail(res) {
|
||||
reject({
|
||||
errMsg: res.errMsg.replace('chooseVideo:fail', ERR_MSG_FAIL),
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function chooseAll(opts) {
|
||||
const {
|
||||
count,
|
||||
extension
|
||||
} = opts;
|
||||
return new Promise((resolve, reject) => {
|
||||
let chooseFile = uni.chooseFile;
|
||||
if (typeof wx !== 'undefined' &&
|
||||
typeof wx.chooseMessageFile === 'function') {
|
||||
chooseFile = wx.chooseMessageFile;
|
||||
}
|
||||
if (typeof chooseFile !== 'function') {
|
||||
return reject({
|
||||
errMsg: ERR_MSG_FAIL + ' 请指定 type 类型,该平台仅支持选择 image 或 video。',
|
||||
});
|
||||
}
|
||||
chooseFile({
|
||||
type: 'all',
|
||||
count,
|
||||
extension,
|
||||
success(res) {
|
||||
resolve(normalizeChooseAndUploadFileRes(res));
|
||||
},
|
||||
fail(res) {
|
||||
reject({
|
||||
errMsg: res.errMsg.replace('chooseFile:fail', ERR_MSG_FAIL),
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function normalizeChooseAndUploadFileRes(res, fileType) {
|
||||
res.tempFiles.forEach((item, index) => {
|
||||
if (!item.name) {
|
||||
item.name = item.path.substring(item.path.lastIndexOf('/') + 1);
|
||||
}
|
||||
if (fileType) {
|
||||
item.fileType = fileType;
|
||||
}
|
||||
item.cloudPath =
|
||||
Date.now() + '_' + index + item.name.substring(item.name.lastIndexOf('.'));
|
||||
});
|
||||
if (!res.tempFilePaths) {
|
||||
res.tempFilePaths = res.tempFiles.map((file) => file.path);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function uploadCloudFiles(files, max = 5, onUploadProgress) {
|
||||
files = JSON.parse(JSON.stringify(files))
|
||||
const len = files.length
|
||||
let count = 0
|
||||
let self = this
|
||||
return new Promise(resolve => {
|
||||
while (count < max) {
|
||||
next()
|
||||
}
|
||||
|
||||
function next() {
|
||||
let cur = count++
|
||||
if (cur >= len) {
|
||||
!files.find(item => !item.url && !item.errMsg) && resolve(files)
|
||||
return
|
||||
}
|
||||
const fileItem = files[cur]
|
||||
const index = self.files.findIndex(v => v.uuid === fileItem.uuid)
|
||||
fileItem.url = ''
|
||||
delete fileItem.errMsg
|
||||
|
||||
uniCloud
|
||||
.uploadFile({
|
||||
filePath: fileItem.path,
|
||||
cloudPath: fileItem.cloudPath,
|
||||
fileType: fileItem.fileType,
|
||||
onUploadProgress: res => {
|
||||
res.index = index
|
||||
onUploadProgress && onUploadProgress(res)
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
fileItem.url = res.fileID
|
||||
fileItem.index = index
|
||||
if (cur < len) {
|
||||
next()
|
||||
}
|
||||
})
|
||||
.catch(res => {
|
||||
fileItem.errMsg = res.errMsg || res.message
|
||||
fileItem.index = index
|
||||
if (cur < len) {
|
||||
next()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function uploadFiles(choosePromise, {
|
||||
onChooseFile,
|
||||
onUploadProgress
|
||||
}) {
|
||||
return choosePromise
|
||||
.then((res) => {
|
||||
if (onChooseFile) {
|
||||
const customChooseRes = onChooseFile(res);
|
||||
if (typeof customChooseRes !== 'undefined') {
|
||||
return Promise.resolve(customChooseRes).then((chooseRes) => typeof chooseRes === 'undefined' ?
|
||||
res : chooseRes);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
})
|
||||
.then((res) => {
|
||||
if (res === false) {
|
||||
return {
|
||||
errMsg: ERR_MSG_OK,
|
||||
tempFilePaths: [],
|
||||
tempFiles: [],
|
||||
};
|
||||
}
|
||||
return res
|
||||
})
|
||||
}
|
||||
|
||||
function chooseAndUploadFile(opts = {
|
||||
type: 'all'
|
||||
}) {
|
||||
if (opts.type === 'image') {
|
||||
return uploadFiles(chooseImage(opts), opts);
|
||||
}
|
||||
else if (opts.type === 'video') {
|
||||
return uploadFiles(chooseVideo(opts), opts);
|
||||
}
|
||||
return uploadFiles(chooseAll(opts), opts);
|
||||
}
|
||||
|
||||
export {
|
||||
chooseAndUploadFile,
|
||||
uploadCloudFiles
|
||||
};
|
||||
|
|
@ -0,0 +1,667 @@
|
|||
<template>
|
||||
<view class="uni-file-picker">
|
||||
<view v-if="title" class="uni-file-picker__header">
|
||||
<text class="file-title">{{ title }}</text>
|
||||
<text class="file-count">{{ filesList.length }}/{{ limitLength }}</text>
|
||||
</view>
|
||||
<upload-image v-if="fileMediatype === 'image' && showType === 'grid'" :readonly="readonly"
|
||||
:image-styles="imageStyles" :files-list="filesList" :limit="limitLength" :disablePreview="disablePreview"
|
||||
:delIcon="delIcon" @uploadFiles="uploadFiles" @choose="choose" @delFile="delFile">
|
||||
<slot>
|
||||
<view class="is-add">
|
||||
<view class="icon-add"></view>
|
||||
<view class="icon-add rotate"></view>
|
||||
</view>
|
||||
</slot>
|
||||
</upload-image>
|
||||
<upload-file v-if="fileMediatype !== 'image' || showType !== 'grid'" :readonly="readonly"
|
||||
:list-styles="listStyles" :files-list="filesList" :showType="showType" :delIcon="delIcon"
|
||||
@uploadFiles="uploadFiles" @choose="choose" @delFile="delFile">
|
||||
<slot><button type="primary" size="mini">选择文件</button></slot>
|
||||
</upload-file>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
chooseAndUploadFile,
|
||||
uploadCloudFiles
|
||||
} from './choose-and-upload-file.js'
|
||||
import {
|
||||
get_file_ext,
|
||||
get_extname,
|
||||
get_files_and_is_max,
|
||||
get_file_info,
|
||||
get_file_data
|
||||
} from './utils.js'
|
||||
import uploadImage from './upload-image.vue'
|
||||
import uploadFile from './upload-file.vue'
|
||||
let fileInput = null
|
||||
/**
|
||||
* FilePicker 文件选择上传
|
||||
* @description 文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=4079
|
||||
* @property {Object|Array} value 组件数据,通常用来回显 ,类型由return-type属性决定
|
||||
* @property {Boolean} disabled = [true|false] 组件禁用
|
||||
* @value true 禁用
|
||||
* @value false 取消禁用
|
||||
* @property {Boolean} readonly = [true|false] 组件只读,不可选择,不显示进度,不显示删除按钮
|
||||
* @value true 只读
|
||||
* @value false 取消只读
|
||||
* @property {String} return-type = [array|object] 限制 value 格式,当为 object 时 ,组件只能单选,且会覆盖
|
||||
* @value array 规定 value 属性的类型为数组
|
||||
* @value object 规定 value 属性的类型为对象
|
||||
* @property {Boolean} disable-preview = [true|false] 禁用图片预览,仅 mode:grid 时生效
|
||||
* @value true 禁用图片预览
|
||||
* @value false 取消禁用图片预览
|
||||
* @property {Boolean} del-icon = [true|false] 是否显示删除按钮
|
||||
* @value true 显示删除按钮
|
||||
* @value false 不显示删除按钮
|
||||
* @property {Boolean} auto-upload = [true|false] 是否自动上传,值为true则只触发@select,可自行上传
|
||||
* @value true 自动上传
|
||||
* @value false 取消自动上传
|
||||
* @property {Number|String} limit 最大选择个数 ,h5 会自动忽略多选的部分
|
||||
* @property {String} title 组件标题,右侧显示上传计数
|
||||
* @property {String} mode = [list|grid] 选择文件后的文件列表样式
|
||||
* @value list 列表显示
|
||||
* @value grid 宫格显示
|
||||
* @property {String} file-mediatype = [image|video|all] 选择文件类型
|
||||
* @value image 只选择图片
|
||||
* @value video 只选择视频
|
||||
* @value all 选择所有文件
|
||||
* @property {Array} file-extname 选择文件后缀,根据 file-mediatype 属性而不同
|
||||
* @property {Object} list-style mode:list 时的样式
|
||||
* @property {Object} image-styles 选择文件后缀,根据 file-mediatype 属性而不同
|
||||
* @event {Function} select 选择文件后触发
|
||||
* @event {Function} progress 文件上传时触发
|
||||
* @event {Function} success 上传成功触发
|
||||
* @event {Function} fail 上传失败触发
|
||||
* @event {Function} delete 文件从列表移除时触发
|
||||
*/
|
||||
export default {
|
||||
name: 'uniFilePicker',
|
||||
components: {
|
||||
uploadImage,
|
||||
uploadFile
|
||||
},
|
||||
options: {
|
||||
virtualHost: true
|
||||
},
|
||||
emits: ['select', 'success', 'fail', 'progress', 'delete', 'update:modelValue', 'input'],
|
||||
props: {
|
||||
// #ifdef VUE3
|
||||
modelValue: {
|
||||
type: [Array, Object],
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
|
||||
// #ifndef VUE3
|
||||
value: {
|
||||
type: [Array, Object],
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
disablePreview: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
delIcon: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 自动上传
|
||||
autoUpload: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 最大选择个数 ,h5只能限制单选或是多选
|
||||
limit: {
|
||||
type: [Number, String],
|
||||
default: 9
|
||||
},
|
||||
// 列表样式 grid | list | list-card
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'grid'
|
||||
},
|
||||
// 选择文件类型 image/video/all
|
||||
fileMediatype: {
|
||||
type: String,
|
||||
default: 'image'
|
||||
},
|
||||
// 文件类型筛选
|
||||
fileExtname: {
|
||||
type: [Array, String],
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
listStyles: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
// 是否显示边框
|
||||
border: true,
|
||||
// 是否显示分隔线
|
||||
dividline: true,
|
||||
// 线条样式
|
||||
borderStyle: {}
|
||||
}
|
||||
}
|
||||
},
|
||||
imageStyles: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {
|
||||
width: 'auto',
|
||||
height: 'auto'
|
||||
}
|
||||
}
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
returnType: {
|
||||
type: String,
|
||||
default: 'array'
|
||||
},
|
||||
sizeType: {
|
||||
type: Array,
|
||||
default () {
|
||||
return ['original', 'compressed']
|
||||
}
|
||||
},
|
||||
sourceType: {
|
||||
type: Array,
|
||||
default () {
|
||||
return ['album', 'camera']
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
files: [],
|
||||
localValue: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// #ifndef VUE3
|
||||
value: {
|
||||
handler(newVal, oldVal) {
|
||||
this.setValue(newVal, oldVal)
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
modelValue: {
|
||||
handler(newVal, oldVal) {
|
||||
this.setValue(newVal, oldVal)
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
// #endif
|
||||
},
|
||||
computed: {
|
||||
filesList() {
|
||||
let files = []
|
||||
this.files.forEach(v => {
|
||||
files.push(v)
|
||||
})
|
||||
return files
|
||||
},
|
||||
showType() {
|
||||
if (this.fileMediatype === 'image') {
|
||||
return this.mode
|
||||
}
|
||||
return 'list'
|
||||
},
|
||||
limitLength() {
|
||||
if (this.returnType === 'object') {
|
||||
return 1
|
||||
}
|
||||
if (!this.limit) {
|
||||
return 1
|
||||
}
|
||||
if (this.limit >= 9) {
|
||||
return 9
|
||||
}
|
||||
return this.limit
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// TODO 兼容不开通服务空间的情况
|
||||
if (!(uniCloud.config && uniCloud.config.provider)) {
|
||||
this.noSpace = true
|
||||
uniCloud.chooseAndUploadFile = chooseAndUploadFile
|
||||
}
|
||||
this.form = this.getForm('uniForms')
|
||||
this.formItem = this.getForm('uniFormsItem')
|
||||
if (this.form && this.formItem) {
|
||||
if (this.formItem.name) {
|
||||
this.rename = this.formItem.name
|
||||
this.form.inputChildrens.push(this)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 公开用户使用,清空文件
|
||||
* @param {Object} index
|
||||
*/
|
||||
clearFiles(index) {
|
||||
if (index !== 0 && !index) {
|
||||
this.files = []
|
||||
this.$nextTick(() => {
|
||||
this.setEmit()
|
||||
})
|
||||
} else {
|
||||
this.files.splice(index, 1)
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.setEmit()
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 公开用户使用,继续上传
|
||||
*/
|
||||
upload() {
|
||||
let files = []
|
||||
this.files.forEach((v, index) => {
|
||||
if (v.status === 'ready' || v.status === 'error') {
|
||||
files.push(Object.assign({}, v))
|
||||
}
|
||||
})
|
||||
return this.uploadFiles(files)
|
||||
},
|
||||
async setValue(newVal, oldVal) {
|
||||
const newData = async (v) => {
|
||||
const reg = /cloud:\/\/([\w.]+\/?)\S*/
|
||||
let url = ''
|
||||
if(v.fileID){
|
||||
url = v.fileID
|
||||
}else{
|
||||
url = v.url
|
||||
}
|
||||
if (reg.test(url)) {
|
||||
v.fileID = url
|
||||
v.url = await this.getTempFileURL(url)
|
||||
}
|
||||
if(v.url) v.path = v.url
|
||||
return v
|
||||
}
|
||||
if (this.returnType === 'object') {
|
||||
if (newVal) {
|
||||
await newData(newVal)
|
||||
} else {
|
||||
newVal = {}
|
||||
}
|
||||
} else {
|
||||
if (!newVal) newVal = []
|
||||
for(let i =0 ;i < newVal.length ;i++){
|
||||
let v = newVal[i]
|
||||
await newData(v)
|
||||
}
|
||||
}
|
||||
this.localValue = newVal
|
||||
if (this.form && this.formItem &&!this.is_reset) {
|
||||
this.is_reset = false
|
||||
this.formItem.setValue(this.localValue)
|
||||
}
|
||||
let filesData = Object.keys(newVal).length > 0 ? newVal : [];
|
||||
this.files = [].concat(filesData)
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择文件
|
||||
*/
|
||||
choose() {
|
||||
|
||||
if (this.disabled) return
|
||||
if (this.files.length >= Number(this.limitLength) && this.showType !== 'grid' && this.returnType ===
|
||||
'array') {
|
||||
uni.showToast({
|
||||
title: `您最多选择 ${this.limitLength} 个文件`,
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.chooseFiles()
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择文件并上传
|
||||
*/
|
||||
chooseFiles() {
|
||||
const _extname = get_extname(this.fileExtname)
|
||||
// 获取后缀
|
||||
uniCloud
|
||||
.chooseAndUploadFile({
|
||||
type: this.fileMediatype,
|
||||
compressed: false,
|
||||
sizeType: this.sizeType,
|
||||
sourceType: this.sourceType,
|
||||
// TODO 如果为空,video 有问题
|
||||
extension: _extname.length > 0 ? _extname : undefined,
|
||||
count: this.limitLength - this.files.length, //默认9
|
||||
onChooseFile: this.chooseFileCallback,
|
||||
onUploadProgress: progressEvent => {
|
||||
this.setProgress(progressEvent, progressEvent.index)
|
||||
}
|
||||
})
|
||||
.then(result => {
|
||||
this.setSuccessAndError(result.tempFiles)
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('选择失败', err)
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择文件回调
|
||||
* @param {Object} res
|
||||
*/
|
||||
async chooseFileCallback(res) {
|
||||
const _extname = get_extname(this.fileExtname)
|
||||
const is_one = (Number(this.limitLength) === 1 &&
|
||||
this.disablePreview &&
|
||||
!this.disabled) ||
|
||||
this.returnType === 'object'
|
||||
// 如果这有一个文件 ,需要清空本地缓存数据
|
||||
if (is_one) {
|
||||
this.files = []
|
||||
}
|
||||
|
||||
let {
|
||||
filePaths,
|
||||
files
|
||||
} = get_files_and_is_max(res, _extname)
|
||||
if (!(_extname && _extname.length > 0)) {
|
||||
filePaths = res.tempFilePaths
|
||||
files = res.tempFiles
|
||||
}
|
||||
|
||||
let currentData = []
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
if (this.limitLength - this.files.length <= 0) break
|
||||
files[i].uuid = Date.now()
|
||||
let filedata = await get_file_data(files[i], this.fileMediatype)
|
||||
filedata.progress = 0
|
||||
filedata.status = 'ready'
|
||||
this.files.push(filedata)
|
||||
currentData.push({
|
||||
...filedata,
|
||||
file: files[i]
|
||||
})
|
||||
}
|
||||
this.$emit('select', {
|
||||
tempFiles: currentData,
|
||||
tempFilePaths: filePaths
|
||||
})
|
||||
res.tempFiles = files
|
||||
// 停止自动上传
|
||||
if (!this.autoUpload || this.noSpace) {
|
||||
res.tempFiles = []
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 批传
|
||||
* @param {Object} e
|
||||
*/
|
||||
uploadFiles(files) {
|
||||
files = [].concat(files)
|
||||
return uploadCloudFiles.call(this, files, 5, res => {
|
||||
this.setProgress(res, res.index, true)
|
||||
})
|
||||
.then(result => {
|
||||
this.setSuccessAndError(result)
|
||||
return result;
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 成功或失败
|
||||
*/
|
||||
async setSuccessAndError(res, fn) {
|
||||
let successData = []
|
||||
let errorData = []
|
||||
let tempFilePath = []
|
||||
let errorTempFilePath = []
|
||||
for (let i = 0; i < res.length; i++) {
|
||||
const item = res[i]
|
||||
const index = item.uuid ? this.files.findIndex(p => p.uuid === item.uuid) : item.index
|
||||
|
||||
if (index === -1 || !this.files) break
|
||||
if (item.errMsg === 'request:fail') {
|
||||
this.files[index].url = item.path
|
||||
this.files[index].status = 'error'
|
||||
this.files[index].errMsg = item.errMsg
|
||||
// this.files[index].progress = -1
|
||||
errorData.push(this.files[index])
|
||||
errorTempFilePath.push(this.files[index].url)
|
||||
} else {
|
||||
this.files[index].errMsg = ''
|
||||
this.files[index].fileID = item.url
|
||||
const reg = /cloud:\/\/([\w.]+\/?)\S*/
|
||||
if (reg.test(item.url)) {
|
||||
this.files[index].url = await this.getTempFileURL(item.url)
|
||||
}else{
|
||||
this.files[index].url = item.url
|
||||
}
|
||||
|
||||
this.files[index].status = 'success'
|
||||
this.files[index].progress += 1
|
||||
successData.push(this.files[index])
|
||||
tempFilePath.push(this.files[index].fileID)
|
||||
}
|
||||
}
|
||||
|
||||
if (successData.length > 0) {
|
||||
this.setEmit()
|
||||
// 状态改变返回
|
||||
this.$emit('success', {
|
||||
tempFiles: this.backObject(successData),
|
||||
tempFilePaths: tempFilePath
|
||||
})
|
||||
}
|
||||
|
||||
if (errorData.length > 0) {
|
||||
this.$emit('fail', {
|
||||
tempFiles: this.backObject(errorData),
|
||||
tempFilePaths: errorTempFilePath
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取进度
|
||||
* @param {Object} progressEvent
|
||||
* @param {Object} index
|
||||
* @param {Object} type
|
||||
*/
|
||||
setProgress(progressEvent, index, type) {
|
||||
const fileLenth = this.files.length
|
||||
const percentNum = (index / fileLenth) * 100
|
||||
const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
|
||||
let idx = index
|
||||
if (!type) {
|
||||
idx = this.files.findIndex(p => p.uuid === progressEvent.tempFile.uuid)
|
||||
}
|
||||
if (idx === -1 || !this.files[idx]) return
|
||||
// fix by mehaotian 100 就会消失,-1 是为了让进度条消失
|
||||
this.files[idx].progress = percentCompleted - 1
|
||||
// 上传中
|
||||
this.$emit('progress', {
|
||||
index: idx,
|
||||
progress: parseInt(percentCompleted),
|
||||
tempFile: this.files[idx]
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
* @param {Object} index
|
||||
*/
|
||||
delFile(index) {
|
||||
this.$emit('delete', {
|
||||
tempFile: this.files[index],
|
||||
tempFilePath: this.files[index].url
|
||||
})
|
||||
this.files.splice(index, 1)
|
||||
this.$nextTick(() => {
|
||||
this.setEmit()
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取文件名和后缀
|
||||
* @param {Object} name
|
||||
*/
|
||||
getFileExt(name) {
|
||||
const last_len = name.lastIndexOf('.')
|
||||
const len = name.length
|
||||
return {
|
||||
name: name.substring(0, last_len),
|
||||
ext: name.substring(last_len + 1, len)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 处理返回事件
|
||||
*/
|
||||
setEmit() {
|
||||
let data = []
|
||||
if (this.returnType === 'object') {
|
||||
data = this.backObject(this.files)[0]
|
||||
this.localValue = data?data:null
|
||||
} else {
|
||||
data = this.backObject(this.files)
|
||||
if (!this.localValue) {
|
||||
this.localValue = []
|
||||
}
|
||||
this.localValue = [...data]
|
||||
}
|
||||
// #ifdef VUE3
|
||||
this.$emit('update:modelValue', this.localValue)
|
||||
// #endif
|
||||
// #ifndef VUE3
|
||||
this.$emit('input', this.localValue)
|
||||
// #endif
|
||||
},
|
||||
|
||||
/**
|
||||
* 处理返回参数
|
||||
* @param {Object} files
|
||||
*/
|
||||
backObject(files) {
|
||||
let newFilesData = []
|
||||
files.forEach(v => {
|
||||
newFilesData.push({
|
||||
extname: v.extname,
|
||||
fileType: v.fileType,
|
||||
image: v.image,
|
||||
name: v.name,
|
||||
path: v.path,
|
||||
size: v.size,
|
||||
fileID:v.fileID,
|
||||
url: v.url,
|
||||
// 修改删除一个文件后不能再上传的bug, #694
|
||||
uuid: v.uuid,
|
||||
status: v.status,
|
||||
cloudPath: v.cloudPath
|
||||
})
|
||||
})
|
||||
return newFilesData
|
||||
},
|
||||
async getTempFileURL(fileList) {
|
||||
fileList = {
|
||||
fileList: [].concat(fileList)
|
||||
}
|
||||
const urls = await uniCloud.getTempFileURL(fileList)
|
||||
return urls.fileList[0].tempFileURL || ''
|
||||
},
|
||||
/**
|
||||
* 获取父元素实例
|
||||
*/
|
||||
getForm(name = 'uniForms') {
|
||||
let parent = this.$parent;
|
||||
let parentName = parent.$options.name;
|
||||
while (parentName !== name) {
|
||||
parent = parent.$parent;
|
||||
if (!parent) return false;
|
||||
parentName = parent.$options.name;
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.uni-file-picker {
|
||||
/* #ifndef APP-NVUE */
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
/* #endif */
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.uni-file-picker__header {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 10px;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.file-title {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.file-count {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.is-add {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.icon-add {
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
background-color: #f1f1f1;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.rotate {
|
||||
position: absolute;
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
</style>
|
||||