Commit f373826a by 李嘉林

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents 9f20b381 76add0e0
......@@ -16,5 +16,8 @@ console.log(process.env,'-----------------config------')
forward(data) {
return requestPOST(`${process.env.OLSHOP_URL}/article/forward`, data)
},
queryLocation(longitude,latitude){
return requestGET(`${process.env.OLSHOP_URL}/operatingArea/query_Location_operating_area_area_list?location=${longitude},${latitude}`)
}
}
\ No newline at end of file
......@@ -50,6 +50,8 @@ export default {
width:100%;
height: 100%;
position: absolute;
top:0;
z-index: -1;
}
.ThemeDataPlant::before {
content: " ";
......
......@@ -10,9 +10,9 @@
</div>
<div class="bc3">
<!-- 送颂 -->
<p v-if="shopInfo.shopCode=='songsong'" @click="showCookie">送颂科技提供技术支持</p>
<p v-if="shopInfo.shopCode=='songsong'">送颂科技提供技术支持</p>
<!-- 嗨有料 -->
<p v-else-if="shopInfo.shopCode=='HYL' || shopInfo.shopCode=='Id9uwD' " @click="showCookie"></p>
<p v-else-if="shopInfo.shopCode=='HYL' || shopInfo.shopCode=='Id9uwD' "></p>
<!-- <p
v-else-if="Array.isArray(this.$store.state.sceneModule.songCopyright)"
@click="showCookie"
......@@ -42,9 +42,6 @@ export default {
onShow(){
},
methods:{
showCookie(){
}
}
}
</script>
......
......@@ -5,6 +5,7 @@ import "../static/nicon/iconfont.css"
import goodsApi from "./api/goods"
import orderApi from "./api/order"
import promoteApi from "./api/promote";
import indexApi from './api/index'
import { DFSImg } from "@/utils/index";
import { $themeToLink } from "@/utils/mayi"
......@@ -48,4 +49,24 @@ mpApp.$themeToLink = $themeToLink
mpApp.goodsApi = goodsApi;
mpApp.orderApi = orderApi;
mpApp.promoteApi = promoteApi;
mpApp.indexApi = indexApi;
mpApp.DFSImg = DFSImg;
if (!mpApp.globalData.setPopupStorage){
let popUpList = wx.getStorageSync('popUpList') || []
let arr = []
popUpList.forEach(item=> {
arr.push(item)
wx.removeStorageSync(item)
})
arr.forEach(item => {
popUpList.splice(popUpList.indexOf(item),1)
})
wx.setStorageSync('popUpList', popUpList)
}
\ No newline at end of file
......@@ -37,6 +37,15 @@
<float-button :datas="item"></float-button>
</div>
</div>
<div v-if="item.componentCode == 'goods-search'">
<goods-search :datas="item"></goods-search>
</div>
<div v-if="item.componentCode == 'notice'">
<notice :datas="item"></notice>
</div>
<div v-if="item.componentCode == 'pop-up'">
<pop-up :datas="item"></pop-up>
</div>
</div>
<bottomCont></bottomCont>
</scroll-view>
......
......@@ -8,6 +8,9 @@
"area-navigation":"/static/nativeComponents/AreaNavigation/index",
"cube-nav":"/static/nativeComponents/CubeNav/index",
"float-button":"/static/nativeComponents/FloatButton/index",
"goods-search":"/static/nativeComponents/GoodsSearch/index",
"notice":"/static/nativeComponents/Notice/index",
"pop-up":"/static/nativeComponents/PopUp/index",
"share-popup":"/static/nativeComponents/SharePopup/index"
},
"enablePullDownRefresh":true
......
......@@ -46,7 +46,7 @@ export function getQueryVariable(query,variable) {
}
//补全图片路径
export function DFSImg(path, w, h) { //
export function DFSImg(path, w, h,type=0) { //
// if (path == null || path == '') {
// return require('~/static/images/noImg.png');
// }
......@@ -57,8 +57,13 @@ export function DFSImg(path, w, h) { //
if (h) style += ',h_' + h;
if (style.length > 0) {
if(path.indexOf('?x-oss-process') == -1){
if(type == 1){
path += '?x-oss-process=image/resize,limit_0' + style
}else{
path += '?x-oss-process=image/resize,m_pad,limit_0' + style
}
}
}
if (path.indexOf('http') == 0) {
return path;
......
// static/nativeComponents/AreaNavigation/index.js
const app = getApp()
const { indexApi } = app;
Component({
/**
* 组件的属性列表
......@@ -57,14 +58,7 @@ Component({
const latitude = res.latitude
const longitude = res.longitude
console.log('组件2', _this.data.designateAreaObj)
wx.request({
url: `http://test-m-shop.mayi888.cn/test/innerApi/shopApiService/operatingArea/query_Location_operating_area_area_list?location=${longitude},${latitude}`,
header: {
'Shop-Mixid': 'Id9uwD'
},
success(data) {
console.log('组件3', _this.data.designateAreaObj)
indexApi.queryLocation(longitude, latitude).then(data => {
if (data.data.code == '200') {
let city = ''
data.data.data.forEach(item => {
......@@ -84,7 +78,7 @@ Component({
console.log(_this.data.positionCity, '定位城市信息')
console.log(_this.data.designateAreaObj,'组件信息')
console.log(_this.data.designateAreaObj, '组件信息')
let str = JSON.stringify({
id: _this.data.positionCity.operatingAreaAreaId,
regionName: _this.data.positionCity.regionName,
......@@ -93,16 +87,16 @@ Component({
outId: _this.data.positionCity.outId,
areaGroupId: _this.data.positionCity.areaGroupId,
})
console.log(str,'str.......')
console.log(str, 'str.......')
wx.setStorageSync('location', str)
if (_this.data.positionCity.operatingAreaAreaId == _this.data.designateAreaObj.id){
if (_this.data.positionCity.operatingAreaAreaId == _this.data.designateAreaObj.id) {
_this.setData({
positionName: _this.data.positionCity.regionName
})
}else{
} else {
_this.setData({
changeShow : true
changeShow: true
})
}
......@@ -127,8 +121,7 @@ Component({
}
}
}
},
fail(){
}).catch(err => {
console.log('定位')
if (!wx.getStorageSync('location')) {
if (_this.data.designateAreaObj.id) {
......@@ -147,9 +140,7 @@ Component({
})
}
}
}
})
},
fail(error) {
console.log('定位失败')
......
......@@ -36,7 +36,6 @@
show="{{noShow}}"
use-slot
showConfirmButton="{{false}}"
class="change-dialog"
>
<view class="change-dialog">
<view style="line-height:60rpx">您所在的地区暂未开放</view>
......@@ -48,7 +47,6 @@
show="{{changeShow}}"
use-slot
showConfirmButton="{{false}}"
class="change-dialog"
>
<view class="change-dialog">
<view style="line-height:60rpx">
......
......@@ -10,7 +10,7 @@
></i>
<i
wx:else
class="content-img antt iconfont {{datas.componentData.icon.src}}"
class="content-img iconfont {{datas.componentData.icon.src}}"
style="font-size:1.6em;color:{{datas.componentData['contentColor']}}"
>
</i>
......
// static/nativeComponents/GoodsSearch/index.js
let app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
datas: {
type: Object
}
},
/**
* 组件的初始数据
*/
data: {
backgroundColor : '',
borderColor : '',
placeholderValue : ''
},
ready(){
this.setData({
backgroundColor: this.data.datas.componentData["showStyle"] == 1 &&
this.data.datas.componentData["backgroundColorShow"] ? this.data.datas.componentData["backgroundColor"] : "rgba(224, 224, 224, 0)",
})
if (this.data.datas.componentData["showStyle"] == 0){
this.setData({
borderColor : this.data.datas.componentData["borderColorShow"]
? this.data.datas.componentData["borderColor"]
: "rgba(224, 224, 224, 0)"
})
}else{
this.setData({
borderColor: 'transparent'
})
}
this.setData({
placeholderValue: this.data.datas.componentData.placeHolderVal ? this.data.datas.componentData.placeHolderVal : '搜索店铺内商品'
})
},
/**
* 组件的方法列表
*/
methods: {
toSearchPage(){
app.$themeToLink({
type: 1,
link: '/goodsSearch/goodsSearch?placeHolderText=' + (this.data.datas.componentData["placeHolderVal"] || '')
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--static/nativeComponents/GoodsSearch/index.wxml-->
<view class="goods-search flex" style="background:{{datas.componentData.heapBgColor||''}}">
<view class="ipt flex {{datas.componentData.keywordPosition == 1 ? 'textCenter' : ''}} {{datas.componentData.showStyle == 0 ? 'my-hairline--all' :''}}" style="border-radius:{{2*(datas.componentData['radius']/100)*2}}em;border-radius:{{2*(datas.componentData['radius']/100)}}em;background:{{backgroundColor}};border-color:{{borderColor}}" bindtap="toSearchPage">
<i class="iconfont-common common-iconsousuo"></i>
<input style="width:{{placeholderValue.length*40}}rpx" disabled type="text" placeholder="{{placeholderValue}}">
</input>
</view>
</view>
/* static/nativeComponents/GoodsSearch/index.wxss */
@import "/static/font/common_icon.wxss";
.flex{
display: flex;
}
.goods-search{
font-size: 24rpx;
width: 100%;
height: 80rpx;
align-items:center;
}
.goods-search i{
margin: 0 20rpx;
color: #bbb;
}
.goods-search .ipt{
width: 96%;
margin: 0 auto;
height: 60rpx;
align-items: center;
position: relative;
border-width: 1rpx;
border-style: solid;
}
.goods-search .ipt input{
font-size: 28rpx;
color: #bbb;
}
.goods-search .textCenter{
justify-content: center;
}
// static/nativeComponents/Notice/index.js
let app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
datas : {
type : Object
}
},
/**
* 组件的初始数据
*/
data: {
timer:null,
newLeft : 0
},
ready(){
let marqueeWidth = 0;
let screenWidth = 0;
let _this = this
this.createSelectorQuery().select('.marquee').boundingClientRect(function(res){
if (res) {
marqueeWidth = res.width
_this.createSelectorQuery().select('.notice').boundingClientRect(function (res1) {
if (res1) {
screenWidth = res1.width
console.log(marqueeWidth, screenWidth, 'screenWidth')
if (marqueeWidth > screenWidth) {
_this.marqueeMove(marqueeWidth,screenWidth);
}else{
clearInterval(_this.data.timer);
_this.setData({
newLeft : 0
})
}
}
}).exec()
}
}).exec()
},
/**
* 组件的方法列表
*/
methods: {
marqueeMove(marqueeWidth,screenWidth){
clearInterval(this.data.timer);
this.data.timer = setInterval(() => {
this.setData({
newLeft : this.data.newLeft - 1
})
if(Math.abs(this.data.newLeft) >= marqueeWidth + 200){
this.setData({
newLeft: screenWidth
})
}
},10)
},
onclickHandle(){
app.$themeToLink(this.data.datas.componentData.link)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--static/nativeComponents/Notice/index.wxml-->
<view class="notice-wrap" style="background-color:{{datas.componentData.backgroundColor}}">
<view class="notice" style="text-align:left;color:{{datas.componentData.fontColor}}; ">
<view class="marquee" style="left:{{newLeft * 2}}rpx" bindtap="onclickHandle">{{datas.componentData.content}}</view>
</view>
</view>
/* static/nativeComponents/Notice/index.wxss */
.notice{
font-size: 32rpx;
position: relative;
overflow: hidden;
height: 80rpx;
width: calc(100vw - 40rpx);
margin-left: 20rpx;
}
.marquee {
position: absolute;
height: 80rpx;
line-height: 80rpx;
/* width: 100%; */
margin: 0 auto;
white-space: nowrap;
box-sizing: border-box;
}
\ No newline at end of file
// static/nativeComponents/PopUp/index.js
let app = getApp()
Component({
/**
* 组件的属性列表
*/
properties: {
datas:{
type:Object
}
},
/**
* 组件的初始数据
*/
data: {
timeout: null,
domainShow: false,
img : ''
},
detached(){
clearTimeout(this.data.timeout);
},
ready() {
this.setData({
img: app.DFSImg(this.data.datas.componentData.imageUrl,700,null,1)
})
if (this.getPopFlag() == 'true'){
this.setData({
domainShow : false
})
}else{
this.setData({
domainShow: true
})
if (this.data.datas.componentData.columnNum > 0 && this.data.datas.componentData.autoOff){
clearTimeout(this.data.timeout);
this.data.timeout = setTimeout(() => {
this.setData({
domainShow: false
})
this.setPopFlag('true')
}, this.data.datas.componentData.columnNum * 1000)
}
}
},
/**
* 组件的方法列表
*/
methods: {
getPopFlag() {
let routes = getCurrentPages()
let page = routes[routes.length - 1].route
return wx.getStorageSync(`${app.globalData.shopInfo.shopCode}_popFlag_${page}_${this.data.datas.id}`)
},
setPopFlag(value) {
app.globalData.setPopupStorage = 1;
let routes = getCurrentPages()
let page = routes[routes.length - 1].route
wx.setStorageSync(`${app.globalData.shopInfo.shopCode}_popFlag_${page}_${this.data.datas.id}`, value)
let popUpList = wx.getStorageSync('popUpList') || [];
popUpList.push(`${app.globalData.shopInfo.shopCode}_popFlag_${page}_${this.data.datas.id}`)
wx.setStorageSync('popUpList', popUpList)
console.log(app.globalData)
},
backHandle(){
this.setData({
domainShow : false
})
this.setPopFlag("true");
clearTimeout(this.data.timeout);
},
onclickHandle() {
app.$themeToLink(this.data.datas.componentData.link);
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--static/nativeComponents/PopUp/index.wxml-->
<view class="pop-up" wx:if="{{domainShow}}">
<view class="shade"></view>
<view class="content">
<image src="{{img}}" bindtap="onclickHandle"></image>
<view class="back {{datas.componentData.backButtonSite=='bottom'?'back-bottom':'back-top'}}" bindtap="backHandle">
<em></em>
<em></em>
</view>
</view>
</view>
/* static/nativeComponents/PopUp/index.wxss */
.pop-up{
font-size: 20rpx;
position: fixed;
left: 0;
top: 0;
z-index: 5000;
width: 100%;
height: 100%;
}
.shade {
opacity: 0.7;
background-color: #000;
width: 100vw;
height: 100vh;
}
.content{
z-index: 5001;
width: 80%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.content image{
width: 100%
}
.content .back{
width: 48rpx;
height: 48rpx;
}
.content .back em{
display: block;
width: 100%;
height: 4rpx;
background-color: #fff;
margin-top: 20rpx;
box-shadow: 0 0 1rpx #fff;
}
em:nth-child(1) {
transform: translateY(0em) rotate(45deg);
}
em:nth-child(2) {
transform: translateY(-1.2em) rotate(-45deg);
}
.back-bottom {
margin: 40rpx auto 0;
}
.back-top {
position: absolute;
top: 20rpx;
right: 24rpx;
}
\ No newline at end of file
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