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, { ...@@ -82,6 +82,6 @@ module.exports = merge(baseWebpackConfig, {
// inject: true // inject: true
// }), // }),
new FriendlyErrorsPlugin(), new FriendlyErrorsPlugin(),
// new UglifyJsPlugin({ sourceMap: true }) new UglifyJsPlugin({ sourceMap: true })
] ]
}) })
...@@ -17,7 +17,7 @@ module.exports = merge(prodEnv, {//zjgyl ...@@ -17,7 +17,7 @@ module.exports = merge(prodEnv, {//zjgyl
// BASE_URL:"'http://192.168.1.146:3005'", // BASE_URL:"'http://192.168.1.146:3005'",
// BASE_URL:"'http://192.168.1.127:3000'", // BASE_URL:"'http://192.168.1.127:3000'",
BASE_URL:"'https://test-m-shop.mayi888.cn'", 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://test-m-shop.mayi888.cn/innerApi/shopApiService"',
// OLSHOP_URL:'"https://shop.mayi888.com/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.
{ {
"description": "项目配置文件。", "description": "项目配置文件。",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": true, "es6": false,
"enhance": true, "enhance": true,
"postcss": true, "postcss": true,
"minified": true, "minified": true,
"newFeature": true, "newFeature": true,
"coverView": true, "coverView": true,
"nodeModules": true, "nodeModules": true,
"autoAudits": true, "autoAudits": true,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"scopeDataCheck": false, "scopeDataCheck": false,
"uglifyFileName": true, "uglifyFileName": true,
"checkInvalidKey": true, "checkInvalidKey": true,
"checkSiteMap": true, "checkSiteMap": true,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
"babelSetting": { "useMultiFrameRuntime": true,
"ignore": [], "useApiHook": true,
"disablePlugins": [], "useApiHostProcess": true,
"outputPath": "" "babelSetting": {
}, "ignore": [],
"bundle": true, "disablePlugins": [],
"useCompilerModule": true, "outputPath": ""
"userConfirmedUseCompilerModuleSwitch": false },
}, "bundle": false,
"miniprogramRoot": "dist/wx/", "useIsolateContext": true,
"compileType": "miniprogram", "useCompilerModule": true,
"appid": "wx8a509d2f2ac15903", "userConfirmedUseCompilerModuleSwitch": false,
"projectname": "mayi-mp-shop", "userConfirmedBundleSwitch": false,
"simulatorType": "wechat", "packNpmManually": false,
"simulatorPluginLibVersion": {}, "packNpmRelationList": [],
"libVersion": "2.14.3", "minifyWXSS": true
"condition": { },
"search": { "miniprogramRoot": "dist/wx/",
"current": -1, "compileType": "miniprogram",
"list": [] "appid": "wx8a509d2f2ac15903",
}, "projectname": "mayi-mp-shop",
"conversation": { "simulatorType": "wechat",
"current": -1, "simulatorPluginLibVersion": {},
"list": [] "libVersion": "2.15.0",
}, "condition": {
"plugin": { "search": {
"current": -1, "list": []
"list": [] },
}, "conversation": {
"game": { "list": []
"currentL": -1, },
"list": [] "plugin": {
}, "list": []
"gamePlugin": { },
"current": -1, "game": {
"list": [] "currentL": -1,
}, "list": []
"miniprogram": { },
"current": -1, "gamePlugin": {
"list": [ "list": []
{ },
"id": 0, "miniprogram": {
"name": "pages/index/main", "list": [
"pathName": "pages/index/main", {
"query": "", "id": 0,
"scene": null "name": "pages/index/main",
}, "pathName": "pages/index/main",
{ "query": "",
"id": -1, "scene": null
"name": "pages/login/main", },
"pathName": "pages/login/main", {
"query": "", "id": -1,
"scene": null "name": "pages/login/main",
}, "pathName": "pages/login/main",
{ "query": "",
"id": 2, "scene": null
"name": "pages/index/main", },
"pathName": "pages/index/main", {
"query": "scene=pid_6141", "id": 2,
"scene": 1047 "name": "pages/index/main",
} "pathName": "pages/index/main",
] "query": "scene=pid_6141",
} "scene": 1047
} }
]
}
}
} }
\ No newline at end of file
<script> <script>
import shop from "@/api/shop"; import shop from "@/api/shop";
import {themeColor , checkShowConditionIds} from "@/utils/mayi" import { themeColor, checkShowConditionIds } from "@/utils/mayi";
export default { export default {
created() { created() {
// NODE_ENV // NODE_ENV
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
process.env.NODE_ENV == "development" || process.env.NODE_ENV == "development" ||
JSON.stringify(extConfig) == "{}" JSON.stringify(extConfig) == "{}"
) { ) {
extConfig = { mixid: "antgood", shopid:67}; extConfig = { mixid: "antgood", shopid: 67 };
} }
console.log("1444444444", extConfig.mixid); console.log("1444444444", extConfig.mixid);
this.$store.commit("setExtConfig", extConfig.mixid); this.$store.commit("setExtConfig", extConfig.mixid);
...@@ -41,39 +41,87 @@ export default { ...@@ -41,39 +41,87 @@ export default {
// 初始 // 初始
this.getShopInfo(extConfig); this.getShopInfo(extConfig);
console.log(this,'this.mpApp') console.log(this, "this.mpApp");
// 页面配置信息 // 页面配置信息
this.getThemePage(extConfig); this.getThemePage(extConfig);
}, },
methods: { methods: {
async setVisible(pageList){ async setVisible(pageList, cb) {
console.log("51111111");
// 首页显示条件 // 首页显示条件
this.pageInfo = pageList.filter((item) => item.pageCode == 1)[0]; let pageInfo = pageList.filter((item) => item.pageCode == 1)[0];
this.pageData = JSON.parse(this.pageInfo.pageData); let pageData = JSON.parse(pageInfo.pageData);
// 显示条件列表 // 查询显示条件id
let showConditionIds=checkShowConditionIds(this.pageData) let showConditionIds = checkShowConditionIds(pageData);
let ll=await this.checkCondition(showConditionIds) // 查询可显示的条件
console.log(showConditionIds,'--------------5454',ll) let { data: ids } = await this.checkCondition(showConditionIds);
// 设置visible
pageInfo.pageData = this.updateCondition(pageData, ids);
console.log(showConditionIds, "--------------5454", ids, pageInfo);
cb()
}, },
checkCondition({allCondition}) { checkCondition({ allCondition }) {
return new Promise((resolve,reject)=>{ return new Promise((resolve, reject) => {
// 获取 // 获取
let params = { allCondition, region: '' } let params = { showConditionIds:allCondition, region: "" };
shop.checkShowCondition(params).then(res => { shop
if (res.code == 200) { .checkShowCondition(params)
console.log(params, 'check显示条件', res.data) .then((res) => {
// commit('setShowConditionIds', res.data) console.log(params, "check显示条件", res.data);
// commit('updateCondition') if (res.data.code == 200) {
resolve(res.data) resolve(res.data);
} }
}).catch(err => { })
console.log('check显示条件失败', err) .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) => { shop.getShopInfo({ shopMixId: mixid }).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
let mpApp = getApp(); let mpApp = getApp();
...@@ -82,7 +130,7 @@ export default { ...@@ -82,7 +130,7 @@ export default {
let defaultComponentModel = res.data.data.shopThemeData; let defaultComponentModel = res.data.data.shopThemeData;
this.mpApp.globalData.shopThemeData = 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); let val = JSON.parse(defaultComponentModel);
...@@ -100,16 +148,16 @@ export default { ...@@ -100,16 +148,16 @@ export default {
} }
// 设置主题色 // 设置主题色
themeColor['--main-color']=val.themeColor.mainColor themeColor["--main-color"] = val.themeColor.mainColor;
themeColor['--minor-color']=val.themeColor.minorColor themeColor["--minor-color"] = val.themeColor.minorColor;
mpApp.themeColorCallBack(themeColor); mpApp.themeColorCallBack(themeColor);
// //
console.log(this.mpApp,'mmmmm74',themeColor) console.log(this.mpApp, "mmmmm74", themeColor);
} }
}); });
}, },
getThemePage({mixid,shopid}) { async getThemePage({ mixid, shopid }) {
shop await shop
.themePagesInfo({ .themePagesInfo({
shopid, shopid,
shopMixId: mixid, shopMixId: mixid,
...@@ -119,28 +167,29 @@ export default { ...@@ -119,28 +167,29 @@ export default {
let data = response.data.data; let data = response.data.data;
if (Array.isArray(data) && data.length > 0) { if (Array.isArray(data) && data.length > 0) {
console.log("90", data); console.log("90", data);
// 设置显示条件
this.setVisible(data,()=>{
console.log(1711111111);
this.mpApp.globalData.pageList = data;
// app中异步数据回调 底部栏数据
if (this.mpApp.pageCallBack) {
this.mpApp.pageCallBack(data);
}
});
this.mpApp.globalData.pageList = data;
this.setVisible(data)
// app中异步数据回调 底部栏数据
if (this.mpApp.pageCallBack) {
this.mpApp.pageCallBack(data);
}
} }
} }
}) })
.catch((err) => {}); .catch((err) => {});
}, },
// --- // ---
}, },
onError(data) { onError(data) {
console.log(data, "js异常捕获"); console.log(data, "js异常捕获");
this.$mpAnalytics.recordError({ this.$mpAnalytics.recordError({
data, data,
'keyword': data, keyword: data,
extendsInfo: { extendsInfo: {
mixid: this.$store.state.mixid || null, mixid: this.$store.state.mixid || null,
}, },
...@@ -169,5 +218,4 @@ export default { ...@@ -169,5 +218,4 @@ export default {
/* @import url("../static/nicon/iconfont.css"); */ /* @import url("../static/nicon/iconfont.css"); */
@import url("../static/font/iconfont.css"); @import url("../static/font/iconfont.css");
@import url("../static/css/common.scss"); @import url("../static/css/common.scss");
</style> </style>
import { requestPOST, requestGET } from "@/utils/request.js"; import { requestPOST, requestPOST1 } from "@/utils/request.js";
export default { export default {
...@@ -12,9 +12,9 @@ export default { ...@@ -12,9 +12,9 @@ export default {
}, },
// 页面数据 // 页面数据
themePagesInfo(params) { 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) { 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 @@ ...@@ -90,10 +90,10 @@
this.define() this.define()
}, },
define(){ define(){
wx.navigateBack() // wx.navigateBack()
// wx.reLaunch({ wx.reLaunch({
// url:'/pages/home/main' url:'/pages/home/main'
// }) })
}, },
locationStart(type){ locationStart(type){
console.log(wx.getStorageSync('location'),'2222222222222222222222222222') console.log(wx.getStorageSync('location'),'2222222222222222222222222222')
...@@ -174,6 +174,66 @@ ...@@ -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(){ resetPosition(){
......
...@@ -159,6 +159,12 @@ export default { ...@@ -159,6 +159,12 @@ export default {
// }; // };
}, },
onLoad(options) { 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; let that = this;
// 来源 // 来源
if (options.from == "logout") { if (options.from == "logout") {
......
...@@ -21,7 +21,7 @@ export default { ...@@ -21,7 +21,7 @@ export default {
baseUrl: process.env.BASE_URL, baseUrl: process.env.BASE_URL,
link: this.baseUrl, link: this.baseUrl,
page: "/", page: "/",
params: "?mixid=" + this.shopId, params: "?mixid=" + this.shopId+'&native=1',
userInfo: { userInfo: {
nickName: "mpvue", nickName: "mpvue",
...@@ -76,10 +76,10 @@ export default { ...@@ -76,10 +76,10 @@ export default {
} }
}, },
onLoad(options) { onLoad(options) {
this.withoutScene = true;
this.options = options; this.options = options;
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
this.withoutScene = true;
//获取openId //获取openId
wx.login({ wx.login({
success: res => { success: res => {
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
--> -->
<template> <template>
<div> <div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view> <web-view :src="pageUrl" @error="handleError"></web-view>
</div> </div>
</template> </template>
...@@ -19,7 +18,7 @@ export default { ...@@ -19,7 +18,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1", params: "?mixid=" + this.$store.state.mixid + "&tabbar=1&native=1",
index: 1, index: 1,
ss: "", ss: "",
}; };
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
--> -->
<template> <template>
<div> <div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view> <web-view :src="pageUrl" @error="handleError"></web-view>
</div> </div>
</template> </template>
...@@ -19,7 +18,7 @@ export default { ...@@ -19,7 +18,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1", params: "?mixid=" + this.$store.state.mixid + "&tabbar=1&native=1",
index: 2, index: 2,
ss: "", ss: "",
}; };
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
--> -->
<template> <template>
<div> <div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view> <web-view :src="pageUrl" @error="handleError"></web-view>
</div> </div>
</template> </template>
...@@ -19,7 +18,7 @@ export default { ...@@ -19,7 +18,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1", params: "?mixid=" + this.$store.state.mixid + "&tabbar=1&native=1",
index: 3, index: 3,
ss: "", ss: "",
}; };
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
--> -->
<template> <template>
<div> <div>
{{ pageUrl }}
<web-view :src="pageUrl" @error="handleError"></web-view> <web-view :src="pageUrl" @error="handleError"></web-view>
</div> </div>
</template> </template>
...@@ -19,7 +18,7 @@ export default { ...@@ -19,7 +18,7 @@ export default {
return { return {
link: process.env.BASE_URL, link: process.env.BASE_URL,
page: "/", page: "/",
params: "?mixid=" + this.$store.state.mixid + "&tabbar=1", params: "?mixid=" + this.$store.state.mixid + "&tabbar=1&native=1",
index: 4, index: 4,
ss: "", 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