Commit 55758803 by 程默

fix

parent ef146d95
...@@ -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 })
] ]
}) })
{ {
"description": "项目配置文件。", "description": "项目配置文件。",
"setting": { "setting": {
"urlCheck": false, "urlCheck": true,
"es6": false, "es6": false,
"postcss": true, "postcss": true,
"minified": true, "minified": true,
"newFeature": true, "newFeature": true,
"coverView": true, "coverView": true,
"nodeModules": false, "nodeModules": false,
"autoAudits": false, "autoAudits": true,
"checkInvalidKey": true, "checkInvalidKey": true,
"checkSiteMap": true, "checkSiteMap": true,
"uploadWithSourceMap": true, "uploadWithSourceMap": true,
......
...@@ -11,5 +11,10 @@ ...@@ -11,5 +11,10 @@
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于获取附近的门店"
}
} }
} }
<template> <template>
<div> <div class="domain">
<p>获取微信地址</p> 获取微信地址
</div> </div>
</template> </template>
...@@ -103,12 +103,12 @@ export default { ...@@ -103,12 +103,12 @@ export default {
} }
addres.addOrEditAddress(this.userAddressReq).then(res => { addres.addOrEditAddress(this.userAddressReq).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.options.back += encodeURIComponent("&mpAddress=1");
console.log("!!!!!!!!!!!!!",this.options.back); console.log("!!!!!!!!!!!!!",this.options.back);
setTimeout(() => {
wx.reLaunch({ wx.reLaunch({
url: `../index/main?from=address&backpath=${this.options.back}` url: `../index/main?from=address&backpath=${this.options.back}`
}); });
}, 200);
} else { } else {
} }
}); });
...@@ -121,4 +121,8 @@ export default { ...@@ -121,4 +121,8 @@ export default {
</script> </script>
<style> <style>
.domain {
text-align: center;
padding-top: 50%;
}
</style> </style>
\ No newline at end of file
<template> <template>
<div @click="clickHandle"> <div>
<web-view :src="link+page+params" @message="getMessage"></web-view> <web-view :src="link+page+params" @message="getMessage"></web-view>
</div> </div>
</template> </template>
<script> <script>
import spokesman from "@/api/spokesman.js"; import spokesman from "@/api/spokesman.js";
import { serialize, getQueryVariable } from "@/utils/index"; import { serialize, getQueryVariable, DFSImg } from "@/utils/index";
export default { export default {
data() { data() {
return { return {
shopId: "antgood",
options: {}, options: {},
session_key: "", session_key: "",
link: "https://test-m-shop.mayi888.cn", baseUrl:"https://test-m-shop.mayi888.cn",
// link: "http://localhost:3000", // baseUrl: "https://shop.mayi888.com",
link: this.baseUrl,
page: "/", page: "/",
params: "?mixid=antgood", params: "?mixid=" + this.shopId,
motto: "Hello miniprograme",
userInfo: { userInfo: {
nickName: "mpvue", nickName: "mpvue",
avatarUrl: "http://mpvue.com/assets/logo.png" avatarUrl: "http://mpvue.com/assets/logo.png"
...@@ -28,15 +29,16 @@ export default { ...@@ -28,15 +29,16 @@ export default {
spokesmanGroupId: "", // 代言人的集团id spokesmanGroupId: "", // 代言人的集团id
spokesmanShopId: "", // 代言人的门店id spokesmanShopId: "", // 代言人的门店id
spokesmanRelId: "", //代言人的id spokesmanRelId: "", //代言人的id
spokesmanBindId: "", //代言人街道id
hasInvitationStatus: 0, // 邀请资格:0-不能够邀请下级,1-能够邀请下级 hasInvitationStatus: 0, // 邀请资格:0-不能够邀请下级,1-能够邀请下级
newHref: "", newHref: "",
shopName: "", shareShopName: "",
logoUrl: "" shareLogoUrl: "",
sharePathStr: "goods/"
}; };
}, },
onLoad(options) { onLoad(options) {
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
console.log(options, "index"); console.log(options, "index");
this.options = options; this.options = options;
if (options.share) { if (options.share) {
...@@ -47,15 +49,12 @@ export default { ...@@ -47,15 +49,12 @@ export default {
this.spokesmanShopId = this.spokesmanShopId =
getQueryVariable(this.link, "spokesmanShopId") || ""; getQueryVariable(this.link, "spokesmanShopId") || "";
this.spokesmanRelId = getQueryVariable(this.link, "spokesmanRelId") || ""; this.spokesmanRelId = getQueryVariable(this.link, "spokesmanRelId") || "";
this.spokesmanBindId =
getQueryVariable(this.link, "spokesmanBindId") || "";
if (this.spokesmanGroupId != "") { if (this.spokesmanGroupId != "") {
//分销员分享 //分销员分享
this.$store.commit("setSpokesman", { this.$store.commit("setSpokesman", {
spokesmanGroupId: this.spokesmanGroupId, spokesmanGroupId: this.spokesmanGroupId,
spokesmanShopId: this.spokesmanShopId, spokesmanShopId: this.spokesmanShopId,
spokesmanRelId: this.spokesmanRelId, spokesmanRelId: this.spokesmanRelId
spokesmanBindId: this.spokesmanBindId
}); });
} }
this.page = ""; this.page = "";
...@@ -72,6 +71,7 @@ export default { ...@@ -72,6 +71,7 @@ export default {
this.page = decodeURIComponent(options.backpath); this.page = decodeURIComponent(options.backpath);
this.params += "&" + decodeURIComponent(options.params); this.params += "&" + decodeURIComponent(options.params);
} else if (options.from && options.from == "logout") { } else if (options.from && options.from == "logout") {
console.log("退出-------------");
//来自用户登出 //来自用户登出
wx.removeStorage({ wx.removeStorage({
key: "sessionid" key: "sessionid"
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
}); });
} else if (options.from && options.from == "address") { } else if (options.from && options.from == "address") {
this.link = decodeURIComponent(options.backpath); this.link = decodeURIComponent(options.backpath);
console.log('???',this.link) console.log("???", this.link);
this.page = ""; this.page = "";
this.params = ""; this.params = "";
} else if (options.from == "wxPay") { } else if (options.from == "wxPay") {
...@@ -101,6 +101,41 @@ export default { ...@@ -101,6 +101,41 @@ export default {
// card // card
}, },
methods: { methods: {
init() {
let that = this;
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
wx.getSetting({
success(res) {
console.log(res, "sdf1233");
if (!res.authSetting["scope.userLocation"]) {
wx.authorize({
scope: "scope.userLocation",
success() {
// 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
that.getLocationHandle();
}
});
} else {
that.getLocationHandle();
}
}
});
},
getLocationHandle() {
wx.getLocation({
type: "wgs84",
success: res => {
var latitude = res.latitude;
var longitude = res.longitude;
var speed = res.speed;
var accuracy = res.accuracy;
console.log("~~~~~~~~~1~~~~~~~", res);
},
fail: res => {
console.log("++++++++++2++++++", res);
}
});
},
async getSpokesman() { async getSpokesman() {
await spokesman.getSpokesmanidByShare().then(res => { await spokesman.getSpokesmanidByShare().then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -109,27 +144,12 @@ export default { ...@@ -109,27 +144,12 @@ export default {
this.spokesmanGroupId = res.data.data.groupId; this.spokesmanGroupId = res.data.data.groupId;
this.spokesmanShopId = res.data.data.shopId; this.spokesmanShopId = res.data.data.shopId;
this.spokesmanRelId = res.data.data.spokesmanId; this.spokesmanRelId = res.data.data.spokesmanId;
if (
res.data.data.spokesmanBindId || this.newHref = `&spokesmanGroupId=${
(res.data.data.spokesmanBindId != null || this.spokesmanGroupId
res.data.data.belongToShopId != 0 || }&spokesmanShopId=${this.spokesmanShopId}&spokesmanRelId=${
res.data.data.belongToShopId != "") this.spokesmanRelId
) { }`;
this.spokesmanBindId = res.data.data.belongToShopId;
}
if (this.spokesmanBindId) {
this.newHref = `&spokesmanGroupId=${
this.spokesmanGroupId
}&spokesmanShopId=${this.spokesmanShopId}&spokesmanRelId=${
this.spokesmanRelId
}&spokesmanBindId=${this.spokesmanBindId}`;
} else {
this.newHref = `&spokesmanGroupId=${
this.spokesmanGroupId
}&spokesmanShopId=${this.spokesmanShopId}&spokesmanRelId=${
this.spokesmanRelId
}`;
}
} }
console.log(this.newHref, "this.newHrefthis.newHrefthis.newHref"); console.log(this.newHref, "this.newHrefthis.newHrefthis.newHref");
} }
...@@ -143,42 +163,35 @@ export default { ...@@ -143,42 +163,35 @@ export default {
mpvue.navigateTo({ url }); mpvue.navigateTo({ url });
} }
}, },
clickHandle(ev) {
// console.log("clickHandle:", ev);
// throw {message: 'custom test'}
},
getMessage(res) { getMessage(res) {
console.log("h5消息", res); let len = res.target.data.length - 1;
if (res.target.data[0].code == 200) { console.log(res, "h5消息", res.target.data[len]);
this.shopName = res.target.data[0].data.shopName;
this.logoUrl = process.env.IMG_DOMAIN + res.target.data[0].data.logoUrl; this.shareShopName = res.target.data[len].shareShopName || "";
} this.shareLogoUrl = DFSImg(res.target.data[len].shareLogoUrl, 500, 400);
} }
}, },
onUnload() { onUnload() {
console.log("卸载----------------", this.options); console.log("卸载----------------", this.options);
//控制返回按钮
// if (this.options.backpath) {
// switch (this.options.backpath) {
// case "/login/accountLogin":
// wx.redirectTo({
// url: `../login/main`
// });
// break;
// default:
// break;
// }
// }
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
this.shareUrl = res.webViewUrl + this.newHref; console.log(this.shareShopName, "share", res.webViewUrl);
console.log("share", res, this.shareUrl); let url = res.webViewUrl;
//分享页面去掉登录态
if (url.indexOf("sessionid") > -1) {
url = url.split("?")[0] + "?mixid=" + this.shopId;
}
//分享页面为分类页,商品详情页外 跳转首页
console.log(url.indexOf(this.sharePathStr) == -1,'good?')
if (url.indexOf(this.sharePathStr) == -1) {
url = this.baseUrl + "?mixid=" + this.shopId;
}
this.shareUrl = url + this.newHref;
console.log(this.shareUrl, "index12");
return { return {
title: this.shopName, // 默认是小程序的名称 title: this.shareShopName, // 默认是小程序的名称
path: `/pages/index/main?share=${encodeURIComponent(this.shareUrl)}`, // 默认是当前页面 path: `/pages/index/main?share=${encodeURIComponent(this.shareUrl)}`, // 默认是当前页面
imageUrl: this.logoUrl, imageUrl: this.shareLogoUrl,
// "http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/png/026da85e-d78d-4260-bbe1-4ca5e1fed10d.png", //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
success: function(res) { success: function(res) {
// 转发成功之后的回调 // 转发成功之后的回调
if (res.errMsg == "shareAppMessage:ok") { if (res.errMsg == "shareAppMessage:ok") {
...@@ -220,10 +233,6 @@ export default { ...@@ -220,10 +233,6 @@ export default {
color: #aaa; color: #aaa;
} }
.usermotto {
margin-top: 150px;
}
.form-control { .form-control {
display: block; display: block;
padding: 0 12px; padding: 0 12px;
......
<template> <template>
<div class="domain"> <div class="domain">
<div class="toCLogin"> <div class="toCLogin">
<image class="img" mode="aspectFit" :src="logoUrl"></image>
<p class="shopName" v-if="shopName">{{shopName}}</p> <p class="shopName" v-if="shopName">{{shopName}}</p>
<div class="btn_info"> <div class="btn_info">
<button class="btn" lang="zh_CN" open-type="getUserInfo" @getuserinfo="getUserInfo">微信登录</button> <button class="btn" lang="zh_CN" open-type="getUserInfo" @getuserinfo="getUserInfo">微信一键登录</button>
</div> </div>
<div class="enterpriseLogin" @click="eLogin">企业员工登录</div> <!-- <div class="enterpriseLogin" @click="eLogin">账号登录</div> -->
</div> </div>
<div class="toCLogin toCLogin1" v-if="isShowPhone"> <div class="toCLogin1" v-if="isShowPhone">
<div class="btn_info1"> <div class="btn_info1">
<h1>绑定手机号</h1> <h1>绑定手机号</h1>
<span class="hint">检测到您的账号还未绑定手机号,请绑定手机号</span> <span class="hint">检测到您的账号还未绑定手机号,请绑定手机号</span>
...@@ -16,16 +17,6 @@ ...@@ -16,16 +17,6 @@
</div> </div>
<div class="layer" @click="isShowPhone=false"></div> <div class="layer" @click="isShowPhone=false"></div>
</div> </div>
<!-- <div v-else>
<mp-loading
:duration="900"
ext-class="demo0"
type="dot-gray"
:show="show"
:animated="animated"
>加载中</mp-loading>
</div>-->
</div> </div>
</template> </template>
...@@ -43,6 +34,7 @@ export default { ...@@ -43,6 +34,7 @@ export default {
return { return {
session_key: "", session_key: "",
shopName: "", shopName: "",
logoUrl:"",
isShow: false, isShow: false,
isShowPhone: false, isShowPhone: false,
getPhone: false, getPhone: false,
...@@ -84,6 +76,8 @@ export default { ...@@ -84,6 +76,8 @@ export default {
console.log(res, "shop"); console.log(res, "shop");
if (res.data.code == 200) { if (res.data.code == 200) {
this.shopName = res.data.data.shopName; this.shopName = res.data.data.shopName;
this.logoUrl=process.env.IMG_DOMAIN + res.data.data.logoUrl;
console.log(this.logoUrl)
} }
}); });
}, },
...@@ -116,6 +110,8 @@ export default { ...@@ -116,6 +110,8 @@ export default {
this.session_key = res.data.data.session_key; this.session_key = res.data.data.session_key;
this.openid = res.data.data.openid; this.openid = res.data.data.openid;
this.isShow = true; this.isShow = true;
}else{
wx.showToast({title: res.data.msg})
} }
}) })
.catch(err => {}); .catch(err => {});
...@@ -142,6 +138,8 @@ export default { ...@@ -142,6 +138,8 @@ export default {
this.unionId = data.unionId || ""; this.unionId = data.unionId || "";
this.userInfo = JSON.parse(e.target.rawData); this.userInfo = JSON.parse(e.target.rawData);
console.log(this.userInfo, "this.userInfo"); console.log(this.userInfo, "this.userInfo");
// return
if (this.unionId) { if (this.unionId) {
login login
.checkUnionid({ unionId: this.unionId, openId: this.openid }) .checkUnionid({ unionId: this.unionId, openId: this.openid })
...@@ -212,8 +210,7 @@ export default { ...@@ -212,8 +210,7 @@ export default {
if (this.$store.state.spokesmanGroupId != "") { if (this.$store.state.spokesmanGroupId != "") {
query.spokesmanRelId=this.$store.state.spokesmanRelId; query.spokesmanRelId=this.$store.state.spokesmanRelId;
query.spokesmanGroupId=this.$store.state.spokesmanGroupId; query.spokesmanGroupId=this.$store.state.spokesmanGroupId;
query.spokesmanShopId=this.$store.state.spokesmanShopId; query.spokesmanShopId=this.$store.state.spokesmanShopId;
query.spokesmanBindId=this.$store.state.spokesmanBindId;
} }
console.log(query,'query') console.log(query,'query')
...@@ -276,7 +273,7 @@ export default { ...@@ -276,7 +273,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.domain { .domain {
// position: relative; position: relative;
.toCLogin { .toCLogin {
display: flex; display: flex;
width: 100%; width: 100%;
...@@ -290,15 +287,16 @@ export default { ...@@ -290,15 +287,16 @@ export default {
font-weight: bold; font-weight: bold;
color: #333; color: #333;
} }
.img{
width: 100px;
height: 100px;
}
.btn_info { .btn_info {
margin: 0 auto; margin-top: 75px;
color: #000; color: #000;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
.btn { .btn {
margin-top: 180px;
background-color: #01d10c; background-color: #01d10c;
color: #fff; color: #fff;
height: 45px; height: 45px;
...@@ -306,6 +304,20 @@ export default { ...@@ -306,6 +304,20 @@ export default {
border-radius: 5px; border-radius: 5px;
} }
} }
.enterpriseLogin {
position: absolute;
bottom: -100px;
left: 50%;
transform: translateX(-50%);
color: #333;
text-decoration: underline;
font-size: 15px;
}
}
.toCLogin1 {
position: absolute;
top: 0;
left: 0;
.btn_info1 { .btn_info1 {
margin: 80px 10px; margin: 80px 10px;
color: #000; color: #000;
...@@ -323,18 +335,16 @@ export default { ...@@ -323,18 +335,16 @@ export default {
font-weight: 700; font-weight: 700;
} }
.btn { .btn {
margin-top: 10px; margin-top: 25px;
background-color: #01d10c; background-color: #01d10c;
color: #fff; color: #fff;
height: 45px; height: 45px;
// width: 90%;
border-radius: 5px; border-radius: 5px;
font-size: 16px; font-size: 16px;
} }
.btn2 { .btn2 {
border: 1px solid #000; border: 1px solid #000;
height: 45px; height: 45px;
// width: 90%;
border-radius: 5px; border-radius: 5px;
margin: 10px auto; margin: 10px auto;
text-align: center; text-align: center;
...@@ -348,23 +358,9 @@ export default { ...@@ -348,23 +358,9 @@ export default {
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.4);
z-index: 0; z-index: -1;
} }
.enterpriseLogin {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
color: #333;
text-decoration: underline;
font-size: 15px;
}
}
.toCLogin1 {
position: absolute;
top: 0;
left: 0;
} }
} }
</style> </style>
...@@ -9,7 +9,6 @@ export default { ...@@ -9,7 +9,6 @@ export default {
components: { components: {
// card // card
}, },
data() { data() {
return { return {
message: "正在支付中", message: "正在支付中",
...@@ -19,15 +18,16 @@ export default { ...@@ -19,15 +18,16 @@ export default {
}; };
}, },
onLoad(options) { onLoad(options) {
wx.showLoading({
title: "加载中"
});
Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化 Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化
console.log("onload//"); console.log("onload//");
this.options = JSON.parse(options.ordercode); this.options = JSON.parse(options.ordercode);
console.log(this.options, "pages/wxPay/main");
let that = this; let that = this;
wx.getStorage({ wx.getStorage({
key: "openid", key: "openid",
success(res) { success(res) {
// this.openId=res;
console.log(that.options, "++++"); console.log(that.options, "++++");
console.log(res, "openid"); console.log(res, "openid");
that.options.openId = res.data; that.options.openId = res.data;
...@@ -36,42 +36,47 @@ export default { ...@@ -36,42 +36,47 @@ export default {
that.toPay(); that.toPay();
} }
}); });
// this.options.openId = "ohUOewfkbVbxHLLledEGGNUu1XgY";
}, },
methods: { methods: {
toPay() { toPay() {
wxPay wxPay
.to_wx_pay(this.options) .to_wx_pay(this.options)
.then(res => { .then(res => {
let payData = JSON.parse(res.data.data); wx.hideLoading();
payData.success = res => { if (res.data.code == 200) {
console.log("支付成功", res, this.options); let payData = JSON.parse(res.data.data);
this.message = "支付成功"; payData.success = res => {
let query = { console.log("支付成功", res, this.options);
orderSn: this.options.orderSn this.message = "支付成功";
let query = {
orderSn: this.options.orderSn
};
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${JSON.stringify(
query
)}`
});
}; };
wx.redirectTo({ payData.fail = res => {
url: `../index/main?from=wxPay&backpath=/pay/paySuccess&params=${JSON.stringify( console.log("支付失败", res, this.options.orderSn);
query this.message = "支付失败";
)}`
});
};
payData.fail = res => {
console.log("支付失败", res, this.options.orderSn);
this.message = "支付失败";
this.toPage();
};
payData.complete = res => {
if (res.errMsg == "chooseWXPay:cancel") {
console.log("支付取消", this.options);
this.message = "支付取消";
this.toPage(); this.toPage();
} };
}; payData.complete = res => {
if (res.errMsg == "chooseWXPay:cancel") {
wx.requestPayment(payData); console.log("支付取消", this.options);
this.message = "支付取消";
this.toPage();
}
};
wx.requestPayment(payData);
} else {
// wx.showToast({ title: res.data.msg });
}
}) })
.catch(err => {}); .catch(err => {
// wx.showToast({ title: err });
});
}, },
toPage() { toPage() {
let query = { let query = {
......
const state={ const state={
spokesmanGroupId:"", spokesmanGroupId:"",
spokesmanShopId:"", spokesmanShopId:"",
spokesmanRelId:"", spokesmanRelId:""
spokesmanBindId:""
} }
export default state export default state
\ No newline at end of file
...@@ -43,4 +43,35 @@ export function getQueryVariable(query,variable) { ...@@ -43,4 +43,35 @@ export function getQueryVariable(query,variable) {
if (pair[0] == variable) { return pair[1]; } if (pair[0] == variable) { return pair[1]; }
} }
return (false); return (false);
}
//补全图片路径
export function DFSImg(path, w, h) { //
// if (path == null || path == '') {
// return require('~/static/images/noImg.png');
// }
let baseImg = process.env.IMG_DOMAIN ;
if (!Array.isArray(baseImg) && (baseImg.indexOf('aliyun') >= 0 || baseImg.indexOf('cdn') >= 0 )) {
var style = '';
if (w) style += ',w_' + w;
if (h) style += ',h_' + h;
if (style.length > 0) {
path += '?x-oss-process=image/resize,m_pad,limit_0' + style
}
if (path.indexOf('http') == 0) {
return path;
}
return baseImg + path;
} else {
if (path.indexOf('http') == 0) {
return path;
}
if (path.indexOf('/') != 0) {
path = '/' + path;
}
if (w && h) {
path += '.' + w + 'x' + h + '.jpg';
}
return baseImg[Math.floor(Math.random() * 100) % baseImg.length] + path;
}
} }
\ No newline at end of file
let shopMixid = "antgood"; let shopMixid = "antgood";
// wx.getStore // wx.getStore
export async function requestGET(url, options) { export async function requestGET(url, options) {
......
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