Commit 2d30c69f authored by 郑秀明's avatar 郑秀明

Merge branch 'zxm_home_dev' into develop

parents e0e5420a fab3f3c7
// php测试环境
// export const php = 'http://test.pet-dbc.cn/mobile/index.php?'
export const php = 'http://test.pet-dbc.cn/mobile/index.php?'
// php镜像
// export const php = 'https://jingxiang.pet-dbc.cn/mobile/index.php?'
// php正式环境
export const php = 'https://shop.pet-dbc.cn/mobile/index.php?'
// export const php = 'https://shop.pet-dbc.cn/mobile/index.php?'
// go测试环境
// export const go = 'https://tm.pet-dbc.cn'
export const go = 'https://tm.pet-dbc.cn'
// go镜像环境
// export const go = 'https://jxm.pet-dbc.cn'
// go正式环境
export const go = 'https://m.pet-dbc.cn';
\ No newline at end of file
// export const go = 'https://m.pet-dbc.cn';
\ No newline at end of file
......@@ -3,3 +3,30 @@ import { php } from './host.js';
export function login() {
location.href = php + 'app=member&act=login';
}
export function getNavigationBarTitle() {
let page = getCurrentPages();
if (page && page[0]) {
let view = page[0].$holder;
if (view) {
// h5
return view.navigationBar.titleText;
} else {
// app-plus
try {
view = page.$getAppWebview();
if (view) {
const style = view.getStyle()
if (style && style.titleNView) {
return style.titleNView.titleText;
}
}
} catch (e) {
if (process.env.NODE_ENV !== 'production') {
console.log('getCurrentPages is not ready')
}
}
}
}
return undefined;
}
\ No newline at end of file
// 微信分享 公共方法
var jweixin = require('jweixin-module');
export default {
// 是否在微信中
isWechat: function() {
const ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/micromessenger/i) == 'micromessenger') {
return true;
} else {
return false;
}
},
//初始化sdk配置
initJssdkShare: function(callback, url) {
uni.request({
url: '/uni/api/weixin/get_wx_sign',
method: 'POST',
data: {url: url},
dataType: 'json',
success: (res) => {
const { data } = res;
if(data.code === 0){
jweixin.config({
debug: false,
appId: data.data.appId,
timestamp: data.data.timestamp,
nonceStr: data.data.noncestr,
signature: data.data.signature,
jsApiList: [
'checkJsApi',
//分享到朋友圈
'onMenuShareTimeline',
// 'updateAppMessageShareData',
//分享给朋友
'onMenuShareAppMessage',
// 'updateTimelineShareData',
//分享到QQ空间
'onMenuShareQZone',
//分享到腾讯微博
'onMenuShareWeibo',
'getLocation'
]
});
//配置完成后,再执行分享等功能
if (callback) {
callback();
}
}
}
});
},
// 自定义分享页面调用方法
share: function(data, url) {
url = url ? url : window.location.href;
if (!this.isWechat()) {
return;
}
//每次都需要重新初始化配置,才可以进行分享
this.initJssdkShare(function(){
jweixin.ready(function() {
var shareData = {
title: data && data.title ? data.title : '谛宝多多商城',
desc: data && data.desc ? data.desc : '宠物行业一站式B2B采购平台',
link: url,
imgUrl: data && data.img ? data.img : 'https://dbc-static.oss-cn-beijing.aliyuncs.com/credit_shop/global/logo.jpg',
success: function(res) {
//用户点击分享后的回调,这里可以进行统计,例如分享送金币之类的
// post('/api/member/share');
},
cancel: function(res) {}
};
//分享给朋友接口
jweixin.onMenuShareAppMessage(shareData);
//分享到朋友圈接口
jweixin.onMenuShareTimeline(shareData);
// 分享到QQ
jweixin.onMenuShareQQ(shareData);
// 分享到微博
jweixin.onMenuShareWeibo(shareData);
});
}, url);
}
}
\ No newline at end of file
This diff is collapsed.
<template>
<view class='draggable is-pointer-down is-dragging draggable_dom' id='qidian_dom'>
<text class="icon-service"></text>
</view>
</template>
<script>
export default{
data() {
return {
name: ''
}
},
mounted(){
var elem = document.querySelector('.draggable');
this.$draggable = new Draggabilly(elem, {
containment: true
});
// this.$draggable.$on('staticClick', function( event, pointer ) {
// // elem.click();
// })
}
}
</script>
<style lang="less">
.draggable_dom{
line-height: 1;
width: 84rpx;
height: 84rpx;
border-radius: 50%;
cursor: pointer;
text-align: center;
background: #ff9232;
position: fixed;
bottom: 180rpx;
right: 10rpx;
z-index:2000000000
}
.icon-service{
display: inline-block;
position: relative;
top: 20rpx;
width: 40rpx;
height: 40rpx;
vertical-align: middle;
background: url(https://bqq.gtimg.com/qidian/src/wpa/dist/4.1.0/images/icon-im-44-white-2x.png) no-repeat;
background-size: 40rpx 40rpx;
opacity: 1;
cursor: pointer;
}
</style>
<template>
<view class="uni-load-more">
<view class="uni-load-more__img" v-show="status === 'loading' && showIcon">
<view class="load1">
<view :style="{background:color}"></view>
<view :style="{background:color}"></view>
<view :style="{background:color}"></view>
<view :style="{background:color}"></view>
</view>
<view class="load2">
<view :style="{background:color}"></view>
<view :style="{background:color}"></view>
<view :style="{background:color}"></view>
<view :style="{background:color}"></view>
</view>
<view class="load3">
<view :style="{background:color}"></view>
<view :style="{background:color}"></view>
<view :style="{background:color}"></view>
<view :style="{background:color}"></view>
</view>
</view>
<text class="uni-load-more__text" :style="{color:color}">{{status === 'more' ? contentText.contentdown : (status === 'loading' ? contentText.contentrefresh : contentText.contentnomore)}}</text>
</view>
</template>
<script>
export default {
name: "uni-load-more",
props: {
status: {
//上拉的状态:more-loading前;loading-loading中;noMore-没有更多了
type: String,
default: 'more'
},
showIcon: {
type: Boolean,
default: true
},
color: {
type: String,
default: "#777777"
},
contentText: {
type: Object,
default () {
return {
contentdown: "上拉显示更多",
contentrefresh: "正在加载...",
contentnomore: "没有更多数据了"
};
}
}
},
data() {
return {}
}
}
</script>
<style>
@charset "UTF-8";
.uni-load-more {
display: flex;
flex-direction: row;
height: 80upx;
align-items: center;
justify-content: center
}
.uni-load-more__text {
font-size: 28upx;
color: #999
}
.uni-load-more__img {
height: 24px;
width: 24px;
margin-right: 10px
}
.uni-load-more__img>view {
position: absolute
}
.uni-load-more__img>view view {
width: 6px;
height: 2px;
border-top-left-radius: 1px;
border-bottom-left-radius: 1px;
background: #999;
position: absolute;
opacity: .2;
transform-origin: 50%;
animation: load 1.56s ease infinite
}
.uni-load-more__img>view view:nth-child(1) {
transform: rotate(90deg);
top: 2px;
left: 9px
}
.uni-load-more__img>view view:nth-child(2) {
transform: rotate(180deg);
top: 11px;
right: 0
}
.uni-load-more__img>view view:nth-child(3) {
transform: rotate(270deg);
bottom: 2px;
left: 9px
}
.uni-load-more__img>view view:nth-child(4) {
top: 11px;
left: 0
}
.load1,
.load2,
.load3 {
height: 24px;
width: 24px
}
.load2 {
transform: rotate(30deg)
}
.load3 {
transform: rotate(60deg)
}
.load1 view:nth-child(1) {
animation-delay: 0s
}
.load2 view:nth-child(1) {
animation-delay: .13s
}
.load3 view:nth-child(1) {
animation-delay: .26s
}
.load1 view:nth-child(2) {
animation-delay: .39s
}
.load2 view:nth-child(2) {
animation-delay: .52s
}
.load3 view:nth-child(2) {
animation-delay: .65s
}
.load1 view:nth-child(3) {
animation-delay: .78s
}
.load2 view:nth-child(3) {
animation-delay: .91s
}
.load3 view:nth-child(3) {
animation-delay: 1.04s
}
.load1 view:nth-child(4) {
animation-delay: 1.17s
}
.load2 view:nth-child(4) {
animation-delay: 1.3s
}
.load3 view:nth-child(4) {
animation-delay: 1.43s
}
@-webkit-keyframes load {
0% {
opacity: 1
}
100% {
opacity: .2
}
}
</style>
\ No newline at end of file
......@@ -16,6 +16,10 @@
})
</script>
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
<script src="https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/lib/draggabilly.min.js"></script>
<!-- WPA start -->
<script id="qd28857712162361a518c852fc82fde1e5eab730ba68" src="https://wp.qiye.qq.com/qidian/2885771216/2361a518c852fc82fde1e5eab730ba68" charset="utf-8" defer></script>
<!-- WPA end -->
</head>
<body>
<noscript>
......
......@@ -2,14 +2,23 @@ import Vue from 'vue'
import App from './App'
import store from './store/store.js';
import { php, gp } from './common/host.js';
import { getNavigationBarTitle } from './common/util.js';
Vue.config.productionTip = false
// 微信分享公共接口
// #ifdef H5
import wechat from './common/wechat.js';
if(wechat.isWechat()){
Vue.prototype.$wechat = wechat;
}
// #endif
Vue.config.productionTip = false;
// 加入购物车
function addCart(spec_id, quantity, isLogin) {
if(!isLogin) {
uni.showToast({
title: '请先登录',
title: '请登录后加入购物车',
duration: 2000,
icon: 'none'
});
......@@ -41,6 +50,10 @@ function addCart(spec_id, quantity, isLogin) {
}
})
}
// 默认图片加载失败的情况
function __reloadResource(_this){
_this._source.default_image = 'https://dbc-static.oss-cn-beijing.aliyuncs.com/credit_shop/20190605/goods/5cf78b96601be.png?x-oss-process=image/resize,m_lfit,w_300,h_300/auto-orient,0/quality,Q_85/format,jpg';
}
// 跳转商品详情页,只传一个商品ID,方便以后全局修改
......@@ -66,7 +79,9 @@ function jump(url) {
Vue.prototype.$jumpGoodDetail = jumpGoodDetail;
Vue.prototype.$jump = jump;
Vue.prototype.$addCart = addCart;
Vue.prototype.$noGoodsImg = 'https://dbc-static.oss-cn-beijing.aliyuncs.com/credit/shangpinmorentu%402x.png';
Vue.prototype.$__reloadResource = __reloadResource;
Vue.prototype.$getNavigationBarTitle = getNavigationBarTitle;
Vue.prototype.$noGoodsImg = 'https://dbc-static.oss-cn-beijing.aliyuncs.com/credit_shop/20190605/goods/5cf78b96601be.png?x-oss-process=image/resize,m_lfit,w_300,h_300/auto-orient,0/quality,Q_85/format,jpg';
Vue.prototype.$defaultPortrait = 'https://dbc-static.oss-cn-beijing.aliyuncs.com/credit/default_user_portrait.gif';
Vue.prototype.$defaultClassImg = 'https://dbc-static.oss-cn-beijing.aliyuncs.com/credit_shop/20190520/img/5ce2636edf912.png';
......
......@@ -28,9 +28,13 @@
"mp-weixin": {
"appid": "",
"setting": {
"urlCheck": false
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true
},
"usingComponents": true
"usingComponents": true,
"permission": {}
},
"mp-alipay": {
"usingComponents": true
......@@ -47,7 +51,7 @@
"mode": "history",
"base": "/uni"
},
"publicPath": "https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/uni/prod/1.0.1/",
"publicPath": "https://dbc-static.oss-cn-beijing.aliyuncs.com/dbc-shop/uni/test/1.0.1/",
"optimization": {
"treeShaking": {
"enable": true
......
This diff is collapsed.
{
"name": "shop_mobile_uni",
"version": "1.0.0",
"description": "商城多端统一系统",
"description": "谛宝多多商城",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gulp:test": "gulp --env test",
......@@ -23,5 +23,8 @@
"gulp-oss-publish": "^1.0.4",
"js-beautify": "^1.10.3",
"minimist": "^1.2.0"
},
"dependencies": {
"jweixin-module": "^1.6.0"
}
}
......@@ -3,7 +3,7 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "白条专区"
"navigationBarTitleText": "白条专区-谛宝多多商城"
}
},
{
......@@ -12,19 +12,38 @@
{
"path": "pages/category/category",
"style": {
"enablePullDownRefresh": true
"enablePullDownRefresh": true,
"navigationBarTitleText": "白条分类-谛宝多多商城"
}
},
{
"path": "pages/web/web"
"path": "pages/web/web",
"style": {
"navigationBarTitleText": "白条专区-谛宝多多商城"
}
},
{
"path": "pages/detail/detail",
"style": {
"navigationBarTitleText": "白条详情-谛宝多多商城"
}
},
{
"path": "pages/detail/detail"
"path": "pages/searchhistory/searchhistory",
"style": {
"navigationBarTitleText": "搜索历史-谛宝多多商城"
}
},
{
"path": "pages/search/search",
"style": {
"navigationBarTitleText": "商品搜索-谛宝多多商城"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "白条专区",
"navigationBarTitleText": "谛宝多多商城",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#fbfbfb",
"app-plus": {"titleNView": false}
......
......@@ -66,7 +66,13 @@
option.current = Number(option.current);
option.page_size = Number(option.page_size);
this.params = option;
this.getData(option)
this.getData(option);
// #ifdef H5
//默认请求微信分享
if (this.$wechat && this.$wechat.isWechat()) {
this.$wechat.share({titie: this.$getNavigationBarTitle()});
}
// #endif
},
onPullDownRefresh() {
if(this.keyword) {
......
......@@ -67,6 +67,12 @@
current: 1,
page_size: 10
});
// #ifdef H5
//默认请求微信分享
if (this.$wechat && this.$wechat.isWechat()) {
this.$wechat.share({titie: this.$getNavigationBarTitle()});
}
// #endif
},
onPullDownRefresh() {
if(this.keyword) {
......
......@@ -114,6 +114,12 @@
},
onLoad() {
this.getData();
// #ifdef H5
//默认请求微信分享
if (this.$wechat && this.$wechat.isWechat()) {
this.$wechat.share({titie: this.$getNavigationBarTitle()});
}
// #endif
},
components: {
uniIcons,
......
This diff is collapsed.
<template>
<view>
<view class="search-content">
<uni-icons color="#212121" class="search-icon-arrowleft" size="24" type="arrowleft" @click="goBack" />
<view class="search-input_box" :class="{active: active}">
<uni-icons color="#999999" class="uni-searchbar__box-icon-search" size="20" type="search" />
<input type="text" :focus="showSync" class="search-input" v-model="searchVal" confirm-type="search" @focus="handlefocus" @confirm="handleSearch"/>
<uni-icons v-if="searchVal!==''" @click="clear" color="#AEAEAE" class="search-close" size="20" type="clear" />
</view>
<text v-if="show" class="cancel-button" @click="cancel">取消</text>
</view>
<view class="search-container">
<view v-if="searchVal!=='' && goods_names.length > 0" class="search-list">
<view class="search-item" v-for="(item, index) in goods_names" :key="index" @click="jumpPage(item._source.goods_name)">
{{item._source.goods_name}}
</view>
</view>
<view v-if="searchVal==='' || goods_names.length === 0" class="search-history">
<view class="search-record">
<text class="search-record_title">历史搜索</text>
<view class="history-list">
<view v-for="(item,index) in search_list" :key="index" @click="jumpPage(item)" class="history-item">
{{item}}
</view>
</view>
<uni-icons color="#6E6E6E" class="history-trash" @click="trash" size="20" type="trash" />
</view>
<view class="search-hot">
<text class="search-hot_title">热门搜索</text>
<view class="record-list">
<view class="record-item" v-for="(item, index) in hot_list" :key="index" @click="jumpPage(item.hot_word)" :class="{active: item.is_special === '1'}">
{{item.hot_word}}
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import uniIcons from "@/components/uni-icons/uni-icons.vue";
export default{
components: {
uniIcons
},
data() {
return {
searchVal: '',
show: false,
showSync: false,
active: false,
search_list: [],
hot_list: [],
goods_names: [
{
_source: {
goods_name: ''
}
}
]
}
},
onLoad(option){
this.searchVal = option.keyword || '';
this.$nextTick(() => {
this.showSync = true;
});
this.getLocalStorage();
this.loadData();
// #ifdef H5
//默认请求微信分享
if (this.$wechat && this.$wechat.isWechat()) {
this.$wechat.share({titie: this.$getNavigationBarTitle()});
}
// #endif
},
watch: {
searchVal() {
// this.$emit("input", {
// value: this.searchVal
// });
const params = {keyword: this.searchVal};
uni.request({
url: '/uni/api/search_goods/search_goods_name',
method: 'POST',
data: params,
dataType: 'json',
success: (res) => {
const {data} = res;
if(data.code == 0){
this.goods_names = data.data;
}
}
});
}
},
methods: {
goBack() {
history.back();
},
jumpPage(goods_name) {
uni.navigateTo({
url: `/pages/search/search?keyword=${goods_name}`
})
},
async loadData() {
uni.request({
url: '/uni/api/search_goods/get_hot_word',
method: 'GET',
dataType: 'json',
success: (res) => {
const {data} = res;
if(data.code == 0){
this.hot_list = data.data || [];
}
}
})
},
clear() {
this.searchVal = '';
// this.showSync = true;
this.$nextTick(() => {
this.showSync = true;
})
},
handlefocus() {
this.show = true;
this.active = true;
},
cancel(){
this.searchVal = '';
this.showSync = false;
this.show = false;
this.active = false;
// #ifndef APP-PLUS
uni.hideKeyboard()
// #endif
// #ifdef APP-PLUS
plus.key.hideSoftKeybord()
// #endif
},
handleSearch(e) {
// #ifndef APP-PLUS
uni.hideKeyboard()
// #endif
// #ifdef APP-PLUS
plus.key.hideSoftKeybord()
// #endif
const {value} = e.target;
this.setLocalStorage(value);
// 跳转商品搜索页面
uni.navigateTo({
url: `/pages/search/search?keyword=${value}`
})
},
// 本地保存搜索历史
setLocalStorage(val) {
if(!val){
return;
}
var list = this.search_list;
if(list.length > 18){
this.search_list.pop();
}
for(var i=0; i<list.length;i++){
if(list[i] === val){
this.search_list.splice(i, 1);
}
}
this.search_list.unshift(val);
try {
uni.setStorageSync('history', JSON.stringify(this.search_list));
} catch (e) {
// error
}
},
getLocalStorage(){
try {
const value = uni.getStorageSync('history');
if (value) {
this.search_list = JSON.parse(value);
}
} catch (e) {
// error
}
},
trash(){
if(this.search_list.length < 1){
return;
}
var _this = this;
uni.showModal({
content: '确认要删除搜索历史吗?',
success: function (res) {
if (res.confirm) {
_this.search_list = [];
uni.setStorageSync('history', JSON.stringify([]));
}
}
});
}
}
}
</script>
<style lang="less" scoped>
.search-content{
display: flex;
justify-content: start;
align-items: center;
height: 100rpx;
padding: 0 20rpx;
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: #fff;
box-sizing: border-box;
z-index: 99999;
.search-icon-arrowleft{
margin-right: 20rpx;
width: 40rpx;
}
.search-input_box{
flex: 1;
height: 60rpx;
line-height: 60rpx;
position: relative;
border: 3rpx solid #D0D0D0;
border-radius: 60rpx;
display: flex;
justify-content: start;
align-items: center;
.uni-searchbar__box-icon-search{
width: 56rpx;
height: 56rpx;
position: absolute;
top: 0rpx;
left: 10rpx;
}
.search-input{
height: 60rpx;
line-height: 60rpx;
flex: 1;
padding-left: 75rpx;
padding-right: 25px;
font-size: 26rpx;
color: #212121;
}
.search-close{
position: absolute;
right: 20rpx;
top: 0rpx;
}
}
.active{
border: 3rpx solid #FFCD00;
}
.cancel-button{
height: 40rpx;
line-height: 40rpx;
padding-left: 20rpx;
font-size: 28rpx;
color: #212121;
}
}
.search-container{
background-color: #fff;
padding: 0 24rpx;
margin-top: 4rpx;
margin-top: 100rpx;
.search-item{
height: 96rpx;
line-height: 96rpx;
text-align: left;
font-size: 28rpx;
color: #212121;
border-bottom: 2rpx solid #dcdcdc;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.search-history{
position: relative;
padding: 36rpx 10rpx;
.search-record{
position: relative;
min-height: 100rpx;
.history-trash{
position: absolute;
top: 0rpx;
right: 0rpx;
}
.history-list{
overflow: hidden;
text-align: center;
padding-top: 56rpx;
.history-item{
height: 60rpx;
line-height: 60rpx;
padding: 0 20rpx;
text-align: center;
font-size: 26rpx;
color: #464646;
margin-bottom: 20rpx;
margin-right: 16rpx;
float: left;
background-color: #F5F5F5;
border-radius: 30rpx;
font-family:PingFangSC-Light,PingFang SC;
}
}
.search-record_title{
height: 24rpx;
line-height: 26rpx;
border-left: 6rpx solid #FFCD00;
padding-left: 8rpx;
font-size: 30rpx;
color: #212121;
font-weight: 500;
position: absolute;
top: 0rpx;
left: 0;
}
}
.search-hot{
position: relative;
height: 300rpx;
margin-top: 30rpx;
.record-list{
overflow: hidden;
text-align: center;
padding-top: 56rpx;
.record-item{
height: 60rpx;
line-height: 60rpx;
padding: 0 20rpx;
text-align: center;
font-size: 26rpx;
color: #464646;
margin-bottom: 20rpx;
margin-right: 16rpx;
float: left;
background-color: #F5F5F5;
border-radius: 30rpx;
font-family:PingFangSC-Light,PingFang SC;
}
.active{
color: red;
}
}
.search-hot_title{
height: 24rpx;
line-height: 26rpx;
border-left: 6rpx solid #FFCD00;
padding-left: 8rpx;
font-size: 30rpx;
color: #212121;
font-weight: 500;
position: absolute;
top: 0rpx;
left: 0;
}
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment