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------') ...@@ -16,5 +16,8 @@ console.log(process.env,'-----------------config------')
forward(data) { forward(data) {
return requestPOST(`${process.env.OLSHOP_URL}/article/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 { ...@@ -50,6 +50,8 @@ export default {
width:100%; width:100%;
height: 100%; height: 100%;
position: absolute; position: absolute;
top:0;
z-index: -1;
} }
.ThemeDataPlant::before { .ThemeDataPlant::before {
content: " "; content: " ";
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
</div> </div>
<div class="bc3"> <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 <!-- <p
v-else-if="Array.isArray(this.$store.state.sceneModule.songCopyright)" v-else-if="Array.isArray(this.$store.state.sceneModule.songCopyright)"
@click="showCookie" @click="showCookie"
...@@ -42,9 +42,6 @@ export default { ...@@ -42,9 +42,6 @@ export default {
onShow(){ onShow(){
}, },
methods:{ methods:{
showCookie(){
}
} }
} }
</script> </script>
......
...@@ -5,6 +5,7 @@ import "../static/nicon/iconfont.css" ...@@ -5,6 +5,7 @@ import "../static/nicon/iconfont.css"
import goodsApi from "./api/goods" import goodsApi from "./api/goods"
import orderApi from "./api/order" import orderApi from "./api/order"
import promoteApi from "./api/promote"; import promoteApi from "./api/promote";
import indexApi from './api/index'
import { DFSImg } from "@/utils/index"; import { DFSImg } from "@/utils/index";
import { $themeToLink } from "@/utils/mayi" import { $themeToLink } from "@/utils/mayi"
...@@ -48,4 +49,24 @@ mpApp.$themeToLink = $themeToLink ...@@ -48,4 +49,24 @@ mpApp.$themeToLink = $themeToLink
mpApp.goodsApi = goodsApi; mpApp.goodsApi = goodsApi;
mpApp.orderApi = orderApi; mpApp.orderApi = orderApi;
mpApp.promoteApi = promoteApi; mpApp.promoteApi = promoteApi;
mpApp.indexApi = indexApi;
mpApp.DFSImg = DFSImg; 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 @@ ...@@ -37,6 +37,15 @@
<float-button :datas="item"></float-button> <float-button :datas="item"></float-button>
</div> </div>
</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> </div>
<bottomCont></bottomCont> <bottomCont></bottomCont>
</scroll-view> </scroll-view>
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
"area-navigation":"/static/nativeComponents/AreaNavigation/index", "area-navigation":"/static/nativeComponents/AreaNavigation/index",
"cube-nav":"/static/nativeComponents/CubeNav/index", "cube-nav":"/static/nativeComponents/CubeNav/index",
"float-button":"/static/nativeComponents/FloatButton/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" "share-popup":"/static/nativeComponents/SharePopup/index"
}, },
"enablePullDownRefresh":true "enablePullDownRefresh":true
......
...@@ -46,7 +46,7 @@ export function getQueryVariable(query,variable) { ...@@ -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 == '') { // if (path == null || path == '') {
// return require('~/static/images/noImg.png'); // return require('~/static/images/noImg.png');
// } // }
...@@ -57,7 +57,12 @@ export function DFSImg(path, w, h) { // ...@@ -57,7 +57,12 @@ export function DFSImg(path, w, h) { //
if (h) style += ',h_' + h; if (h) style += ',h_' + h;
if (style.length > 0) { if (style.length > 0) {
if(path.indexOf('?x-oss-process') == -1){ if(path.indexOf('?x-oss-process') == -1){
path += '?x-oss-process=image/resize,m_pad,limit_0' + style 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) { if (path.indexOf('http') == 0) {
......
// static/nativeComponents/AreaNavigation/index.js // static/nativeComponents/AreaNavigation/index.js
const app = getApp() const app = getApp()
const { indexApi } = app;
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -57,79 +58,51 @@ Component({ ...@@ -57,79 +58,51 @@ Component({
const latitude = res.latitude const latitude = res.latitude
const longitude = res.longitude const longitude = res.longitude
console.log('组件2', _this.data.designateAreaObj) console.log('组件2', _this.data.designateAreaObj)
wx.request({ indexApi.queryLocation(longitude, latitude).then(data => {
url: `http://test-m-shop.mayi888.cn/test/innerApi/shopApiService/operatingArea/query_Location_operating_area_area_list?location=${longitude},${latitude}`, if (data.data.code == '200') {
header: { let city = ''
'Shop-Mixid': 'Id9uwD' data.data.data.forEach(item => {
}, if (item.operatingAreaAreaId) {
success(data) { city = item;
console.log('组件3', _this.data.designateAreaObj)
if (data.data.code == '200') {
let city = ''
data.data.data.forEach(item => {
if (item.operatingAreaAreaId) {
city = item;
}
})
if (city == '') {
_this.setData({
positionCity: data.data.data[0]
})
} else {
_this.setData({
positionCity: city
})
} }
})
if (city == '') {
console.log(_this.data.positionCity, '定位城市信息') _this.setData({
console.log(_this.data.designateAreaObj,'组件信息') positionCity: data.data.data[0]
let str = JSON.stringify({ })
id: _this.data.positionCity.operatingAreaAreaId, } else {
regionName: _this.data.positionCity.regionName, _this.setData({
regionType: _this.data.positionCity.regionType, positionCity: city
systemRegionId: _this.data.positionCity.systemRegionId,
outId: _this.data.positionCity.outId,
areaGroupId: _this.data.positionCity.areaGroupId,
}) })
console.log(str,'str.......') }
wx.setStorageSync('location', str)
if (_this.data.positionCity.operatingAreaAreaId == _this.data.designateAreaObj.id){
_this.setData({
positionName: _this.data.positionCity.regionName
})
}else{
_this.setData({
changeShow : true
})
}
console.log(_this.data.positionCity, '定位城市信息')
console.log(_this.data.designateAreaObj, '组件信息')
let str = JSON.stringify({
id: _this.data.positionCity.operatingAreaAreaId,
regionName: _this.data.positionCity.regionName,
regionType: _this.data.positionCity.regionType,
systemRegionId: _this.data.positionCity.systemRegionId,
outId: _this.data.positionCity.outId,
areaGroupId: _this.data.positionCity.areaGroupId,
})
console.log(str, 'str.......')
wx.setStorageSync('location', str)
if (_this.data.positionCity.operatingAreaAreaId == _this.data.designateAreaObj.id) {
_this.setData({
positionName: _this.data.positionCity.regionName
})
} else { } else {
if (!wx.getStorageSync('location')) { _this.setData({
if (_this.data.designateAreaObj.id) { changeShow: true
})
}
wx.setStorageSync('location', JSON.stringify({
id: _this.data.designateAreaObj.id,
regionName: _this.data.designateAreaObj.regionName,
regionType: _this.data.designateAreaObj.regionType,
systemRegionId: _this.data.designateAreaObj.systemRegionId,
areaGroupId: _this.data.designateAreaObj.areaGroupId,
outId: _this.data.designateAreaObj.outId
}))
_this.setData({
positionName: _this.data.designateAreaObj.regionName } else {
})
}
}
}
},
fail(){
console.log('定位')
if (!wx.getStorageSync('location')) { if (!wx.getStorageSync('location')) {
if (_this.data.designateAreaObj.id) { if (_this.data.designateAreaObj.id) {
...@@ -148,8 +121,26 @@ Component({ ...@@ -148,8 +121,26 @@ Component({
} }
} }
} }
}) }).catch(err => {
console.log('定位')
if (!wx.getStorageSync('location')) {
if (_this.data.designateAreaObj.id) {
wx.setStorageSync('location', JSON.stringify({
id: _this.data.designateAreaObj.id,
regionName: _this.data.designateAreaObj.regionName,
regionType: _this.data.designateAreaObj.regionType,
systemRegionId: _this.data.designateAreaObj.systemRegionId,
areaGroupId: _this.data.designateAreaObj.areaGroupId,
outId: _this.data.designateAreaObj.outId
}))
_this.setData({
positionName: _this.data.designateAreaObj.regionName
})
}
}
})
}, },
fail(error) { fail(error) {
console.log('定位失败') console.log('定位失败')
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
show="{{noShow}}" show="{{noShow}}"
use-slot use-slot
showConfirmButton="{{false}}" showConfirmButton="{{false}}"
class="change-dialog"
> >
<view class="change-dialog"> <view class="change-dialog">
<view style="line-height:60rpx">您所在的地区暂未开放</view> <view style="line-height:60rpx">您所在的地区暂未开放</view>
...@@ -48,7 +47,6 @@ ...@@ -48,7 +47,6 @@
show="{{changeShow}}" show="{{changeShow}}"
use-slot use-slot
showConfirmButton="{{false}}" showConfirmButton="{{false}}"
class="change-dialog"
> >
<view class="change-dialog"> <view class="change-dialog">
<view style="line-height:60rpx"> <view style="line-height:60rpx">
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
></i> ></i>
<i <i
wx:else 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']}}" style="font-size:1.6em;color:{{datas.componentData['contentColor']}}"
> >
</i> </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