Commit 55758803 by 程默

fix

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