Commit 92616af6 by 李嘉林

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

parents 474985d9 69dafaae
......@@ -82,6 +82,6 @@ module.exports = merge(baseWebpackConfig, {
// inject: true
// }),
new FriendlyErrorsPlugin(),
// new UglifyJsPlugin({ sourceMap: true })
new UglifyJsPlugin({ sourceMap: true })
]
})
......@@ -17,7 +17,7 @@ module.exports = merge(prodEnv, {//zjgyl
// BASE_URL:"'http://192.168.1.146:3005'",
// BASE_URL:"'http://192.168.1.127:3000'",
BASE_URL:"'https://test-m-shop.mayi888.cn'",
// BASE_URL:"'http://172.16.1.32:3000'",
// BASE_URL:"'http://172.16.1.61:3004'",
OLSHOP_URL:'"https://test-m-shop.mayi888.cn/innerApi/shopApiService"',
// OLSHOP_URL:'"https://shop.mayi888.com/innerApi/shopApiService"',
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,7 +2,7 @@
"description": "项目配置文件。",
"setting": {
"urlCheck": false,
"es6": true,
"es6": false,
"enhance": true,
"postcss": true,
"minified": true,
......@@ -16,14 +16,22 @@
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"bundle": true,
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
},
"miniprogramRoot": "dist/wx/",
"compileType": "miniprogram",
......@@ -31,18 +39,15 @@
"projectname": "mayi-mp-shop",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"libVersion": "2.14.3",
"libVersion": "2.15.0",
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"plugin": {
"current": -1,
"list": []
},
"game": {
......@@ -50,11 +55,9 @@
"list": []
},
"gamePlugin": {
"current": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": [
{
"id": 0,
......
<script>
import shop from "@/api/shop";
import {themeColor , checkShowConditionIds} from "@/utils/mayi"
import { themeColor, checkShowConditionIds } from "@/utils/mayi";
export default {
created() {
// NODE_ENV
......@@ -11,7 +11,7 @@ export default {
process.env.NODE_ENV == "development" ||
JSON.stringify(extConfig) == "{}"
) {
extConfig = { mixid: "antgood", shopid:67};
extConfig = { mixid: "antgood", shopid: 67 };
}
console.log("1444444444", extConfig.mixid);
this.$store.commit("setExtConfig", extConfig.mixid);
......@@ -41,39 +41,87 @@ export default {
// 初始
this.getShopInfo(extConfig);
console.log(this,'this.mpApp')
console.log(this, "this.mpApp");
// 页面配置信息
this.getThemePage(extConfig);
},
methods: {
async setVisible(pageList){
async setVisible(pageList, cb) {
console.log("51111111");
// 首页显示条件
this.pageInfo = pageList.filter((item) => item.pageCode == 1)[0];
this.pageData = JSON.parse(this.pageInfo.pageData);
// 显示条件列表
let showConditionIds=checkShowConditionIds(this.pageData)
let ll=await this.checkCondition(showConditionIds)
console.log(showConditionIds,'--------------5454',ll)
let pageInfo = pageList.filter((item) => item.pageCode == 1)[0];
let pageData = JSON.parse(pageInfo.pageData);
// 查询显示条件id
let showConditionIds = checkShowConditionIds(pageData);
// 查询可显示的条件
let { data: ids } = await this.checkCondition(showConditionIds);
// 设置visible
pageInfo.pageData = this.updateCondition(pageData, ids);
console.log(showConditionIds, "--------------5454", ids, pageInfo);
cb()
},
checkCondition({allCondition}) {
return new Promise((resolve,reject)=>{
checkCondition({ allCondition }) {
return new Promise((resolve, reject) => {
// 获取
let params = { allCondition, region: '' }
shop.checkShowCondition(params).then(res => {
if (res.code == 200) {
console.log(params, 'check显示条件', res.data)
// commit('setShowConditionIds', res.data)
// commit('updateCondition')
resolve(res.data)
}
}).catch(err => {
console.log('check显示条件失败', err)
let params = { showConditionIds:allCondition, region: "" };
shop
.checkShowCondition(params)
.then((res) => {
console.log(params, "check显示条件", res.data);
if (res.data.code == 200) {
resolve(res.data);
}
})
.catch((err) => {
console.log("check显示条件失败", err);
});
});
},
updateCondition(pageData, ids) {
pageData.forEach((item) => {
pollCondition(item);
});
function pollCondition(data) {
if (Object.prototype.toString.call(data) === "[object Object]") {
if (data.condition != "" && data.condition != undefined) {
data.visible = ids.some((item) => {
return item == data.condition;
})
? 1
: 0;
}
for (const key in data) {
if (data.hasOwnProperty(key)) {
const element = data[key];
if (
Object.prototype.toString.call(element) === "[object Object]"
) {
if (element.condition != "" && element.condition != undefined) {
console.log("979797", element.condition);
element.visible = ids.some((item) => {
return item == element.condition;
})
? 1
: 0;
}
pollCondition(element);
} else if (
Object.prototype.toString.call(element) === "[object Array]" &&
element.length > 0
) {
element.forEach((item) => {
pollCondition(item);
});
}
}
}
}
}
return JSON.stringify(pageData);
},
//商城配置
getShopInfo({mixid}) {
getShopInfo({ mixid }) {
shop.getShopInfo({ shopMixId: mixid }).then((res) => {
if (res.data.code == 200) {
let mpApp = getApp();
......@@ -82,7 +130,7 @@ export default {
let defaultComponentModel = res.data.data.shopThemeData;
this.mpApp.globalData.shopThemeData = res.data.data.shopThemeData;
this.mpApp.globalData.shopInfo=res.data.data;
this.mpApp.globalData.shopInfo = res.data.data;
// 获取底部栏数据
let val = JSON.parse(defaultComponentModel);
......@@ -100,16 +148,16 @@ export default {
}
// 设置主题色
themeColor['--main-color']=val.themeColor.mainColor
themeColor['--minor-color']=val.themeColor.minorColor
themeColor["--main-color"] = val.themeColor.mainColor;
themeColor["--minor-color"] = val.themeColor.minorColor;
mpApp.themeColorCallBack(themeColor);
//
console.log(this.mpApp,'mmmmm74',themeColor)
console.log(this.mpApp, "mmmmm74", themeColor);
}
});
},
getThemePage({mixid,shopid}) {
shop
async getThemePage({ mixid, shopid }) {
await shop
.themePagesInfo({
shopid,
shopMixId: mixid,
......@@ -119,14 +167,16 @@ export default {
let data = response.data.data;
if (Array.isArray(data) && data.length > 0) {
console.log("90", data);
// 设置显示条件
this.setVisible(data,()=>{
console.log(1711111111);
this.mpApp.globalData.pageList = data;
this.setVisible(data)
// app中异步数据回调 底部栏数据
if (this.mpApp.pageCallBack) {
this.mpApp.pageCallBack(data);
}
});
}
}
......@@ -134,13 +184,12 @@ export default {
.catch((err) => {});
},
// ---
},
onError(data) {
console.log(data, "js异常捕获");
this.$mpAnalytics.recordError({
data,
'keyword': data,
keyword: data,
extendsInfo: {
mixid: this.$store.state.mixid || null,
},
......@@ -169,5 +218,4 @@ export default {
/* @import url("../static/nicon/iconfont.css"); */
@import url("../static/font/iconfont.css");
@import url("../static/css/common.scss");
</style>
import { requestPOST, requestGET } from "@/utils/request.js";
import { requestPOST, requestPOST1 } from "@/utils/request.js";
export default {
......@@ -12,9 +12,9 @@ export default {
},
// 页面数据
themePagesInfo(params) {
return requestPOST(`${process.env.OLSHOP_URL}/cms/get_shop_install_pages`, { params })
return requestPOST(`${process.env.OLSHOP_URL}/cms/get_shop_install_pages`, params )
},
checkShowCondition(params) {
return requestPOST(`${process.env.OLSHOP_URL}/cms/check_show_condition`, {params})
return requestPOST(`${process.env.OLSHOP_URL}/cms/check_show_condition`, params)
},
};
......@@ -90,10 +90,10 @@
this.define()
},
define(){
wx.navigateBack()
// wx.reLaunch({
// url:'/pages/home/main'
// })
// wx.navigateBack()
wx.reLaunch({
url:'/pages/home/main'
})
},
locationStart(type){
console.log(wx.getStorageSync('location'),'2222222222222222222222222222')
......@@ -174,6 +174,66 @@
}
})
}else{
wx.getLocation({
type: 'wgs84',
success:function(res){
const latitude = res.latitude
const longitude = res.longitude
console.log('定位成功',res)
changeAdr.query_Location_operating_area_area_list({
location : longitude + ',' + latitude
}).then(res => {
if(res.data.code == '200'){
let city = '';
res.data.data.forEach(item => {
if(item.operatingAreaAreaId){
city = item
}
})
if(city == ''){
_this.positionCity = res.data.data[0];
}else{
_this.positionCity = city;
}
_this.reLocationStatus = false;
_this.locationStatus = true;
}else{
wx.showModal({
title: '提示',
content: '定位失败,请检查是否开启了定位服务',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
_this.reLocationStatus = false;
_this.locationStatus = false;
}
})
},
fail:function(err){
console.log('定位失败',err)
wx.showModal({
title: '提示',
content: '定位失败,请检查是否开启了定位服务',
success (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
_this.reLocationStatus = false;
_this.locationStatus = false;
}
})
}
},
resetPosition(){
......
......@@ -159,6 +159,12 @@ export default {
// };
},
onLoad(options) {
let location=JSON.parse(wx.getStorageSync('location') || '{}')
if (!location.areaGroupId) {
wx.redirectTo({
url: '/pages/changeAdr/main?areaGroupId=' + this.data.designateAreaObj.areaGroupId
})
}
let that = this;
// 来源
if (options.from == "logout") {
......
......@@ -21,7 +21,7 @@ export default {
baseUrl: process.env.BASE_URL,
link: this.baseUrl,
page: "/",
params: "?mixid=" + this.shopId,
params: "?mixid=" + this.shopId+'&native=1',
userInfo: {
nickName: "mpvue",
......@@ -76,10 +76,10 @@ export default {
}
},
onLoad(options) {
this.withoutScene = true;
this.options = options;
Object.assign(this.$data, this.$options.data());
this.withoutScene = true;
//获取openId
wx.login({
success: res => {
......
......@@ -3,7 +3,6 @@
-->
<template>
<div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view>
</div>
</template>
......@@ -19,7 +18,7 @@ export default {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1&native=1",
index: 1,
ss: "",
};
......
......@@ -3,7 +3,6 @@
-->
<template>
<div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view>
</div>
</template>
......@@ -19,7 +18,7 @@ export default {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1&native=1",
index: 2,
ss: "",
};
......
......@@ -3,7 +3,6 @@
-->
<template>
<div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view>
</div>
</template>
......@@ -19,7 +18,7 @@ export default {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1&native=1",
index: 3,
ss: "",
};
......
......@@ -3,7 +3,6 @@
-->
<template>
<div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view>
</div>
</template>
......@@ -19,7 +18,7 @@ export default {
return {
link: process.env.BASE_URL,
page: "/",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1&native=1",
index: 4,
ss: "",
};
......
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