Commit 779f5e24 authored by geruidan's avatar geruidan

h5跳转小程序,走自动授权auth

parent 3849d4ed
<template>
<view class="big_out">
<!-- 左上角返回按钮 -->
<!-- 这里为什么要加4px,是因为这个左箭头<的高度为16rpx需要下降一半,就是8rpx=4px,可以自己试一下,我这里没有问题 -->
<!-- <view class="back" :style="'margin-top:'+ (titletop+4)+'px'" @click="back_page">
<view class="back_img">
</view> -->
<!-- <view class="back_text">
<slot>
{{backtext}}
</slot>
</view> -->
<!-- </view> -->
<view class="wx-nav">
<view class="iconf">返回</view>
<text>内容</text>
<view class="iconf">右侧</view>
</view>
</view>
</template>
<script>
export default {
name: "backPages",
props: {
backtext: String,
},
data() {
return {
titleheight: 0,
titletop: 0
};
},
//这里原来使用的onLoad一直有bug(不重新进入页面就会错位),
// 后来使用onShow 更改于2022/09/30 以后再修改
onShow() {
//加载时调用 getHeight
this.getHeight();
},
methods: {
//利用胶囊按钮定位宽高
getHeight() {
let res = uni.getMenuButtonBoundingClientRect();
this.titletop = res.top;
this.titleheight = res.height
},
//直接返回上一级
back_page() {
uni.navigateBack({
delta: 1 // 返回的页面数
})
},
}
}
</script>
<style scoped lang="scss">
.wx-nav{
display: flex;
height: 150rpx;
line-height: 150rpx;
text-align: center;
width: 100%;
justify-content: space-between;
padding: 0 20rpx ;
}
</style>
\ No newline at end of file
<template>
<view class="back">
<view class="lf" @click="goback">
返回
</view>
<view class="title">{{info.title}}</view>
</view>
</template>
<script>
export default {
props:{
info:{
type: Object
}
},
data() {
return {
}
},
methods:{
goback(){
uni.navigateTo({
url: '/pages/h5/index'
})
}
}
}
</script>
<style lang="scss" scoped>
.back{
position: fixed;width:100%;margin-top:50rpx;position: relative; margin-top: 26px; height: 80px;line-height: 80px;
.lf{
position: absolute;width: 40px;text-align: center;padding-left:10rpx;
}
.title{
width: 100%;text-align:center
}
}
</style>
<template>
<view>
<u-modal :show="showPrivacy" title="用户隐私保护提示" :showConfirmButton="false">
<view class="slot-content">
<slot name="default">
<view class="privacyCon">
感谢您使用本应用,您使用本应用的服务之前请仔细阅读并同意
<text class="blue" @click="handleOpenPrivacyContract()">《用户隐私保护指引》</text>
。当您点击同意并开始使用产品服务时,即表示你已理解并同意该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法使用相应服务。
</view>
<view class="privacyBtn">
<button id="agree-btn" type="primary" class="item agree" open-type="agreePrivacyAuthorization"
@agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
<!-- <u-button open-type="agreePrivacyAuthorization" @agreeprivacyauthorization="agreeprivacyauthorization" type="primary" text="同意并继续" color="#00c791"></u-button> -->
<!-- <button id="agree-btn" open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button> -->
<u-button type="default" plain text="不同意" @click="unAgreeAuth" color="#00c791"></u-button>
</view>
</slot>
</view>
</u-modal>
</view>
</template>
<script>
import {
mapActions,
mapGetters
} from 'vuex'
export default {
data() {
return {
}
},
computed: {
...mapGetters(['showPrivacy'])
},
methods: {
// 打开用户隐私保护文件
handleOpenPrivacyContract() {
this.$store.commit('openPrivacyContract');
},
//是否需要授权
handleAgreePrivacyAuthorization() {
this.$store.commit('agreePrivacyAuthorization');
},
// 不同意
unAgreeAuth() {
// this.$u.toast("同意也得同意不同意也得同意。哈哈哈哈");
uni.exitMiniProgram({
success: () => {
console.log('退出小程序成功');
}
})
},
created() {
}
}
}
</script>
<style lang="scss">
.privacyCon {
margin-bottom: 30rpx;
}
.privacyBtn {
button {
margin-bottom: 30rpx;
}
}
#agree-btn{
color:#00c791;
}
</style>
......@@ -3,17 +3,27 @@
*/
// export const BASE_URL = 'http://172.18.0.229:9001' //后台根域名 https://demo.shopro.top
export const BASE_URL = 'https://wxcs.zhonghuihaotai.com' //后台根域名 https://demo.shopro.top
export const BASE_URL = 'https://wx.zhonghuihaotai.com' //后台根域名 https://demo.shopro.top
// export const BASE_URL = 'https://wxcs.zhonghuihaotai.com' //后台根域名 https://demo.shopro.top
export const API_URL = `${BASE_URL}/api/a1/` //后台接口域名
export const IMG_URL = 'http://file.shopro.top' //全局网络图片地址变量,css背景图片地址变量在uni.scss
export const MAP_KEY = '426ebc3f1bbaced***89ee6061a98'; //高德地图开发者Web服务key,逆坐标解析
export const HAS_LIVE = false //后台是否开通直播权限,根据情况在manifest.json中,开启注释相应组件的引入,pages.json中打开直播
// http://172.18.1.66:9001/api/a1/mall/homePage/mp?code={前端传入的code}
export const MALL_ID ="170093123123176";
export const COMPANY_ID ="2023092701";
// export const MALL_ID ="194433411100614";
// export const COMPANY_ID ="00000753";
// export const APP_ID = "wx93aba63d96157302"; //小程序APPID
// export const APP_KEY = "a20511dcfd6b07114afacbb482b2e7e0"; //勿改
export const MALL_ID ="133507311100590";
export const COMPANY_ID ="202203282";
export const APP_ID = "wx60c6530c49c52ff7"; //小程序APPID
export const APP_KEY = "a20511dcfd6b07114afacbb482b2e7e0"; //勿改
// export const MALL_ID ="189099911100589";
// export const COMPANY_ID ="2023062901";
// export const APP_ID = "wx91fa336def077983"; //小程序APPID
// export const APP_KEY = "a20511dcfd6b07114afacbb482b2e7e0"; //勿改
\ No newline at end of file
......@@ -57,9 +57,11 @@
"appid" : "wx60c6530c49c52ff7",
"setting" : {
"urlCheck" : true,
"minified" : false,
"minified" : true,
"es6" : true,
"postcss" : true
"postcss" : false,
"ignoreDevUnusedFiles" : false,
"ignoreUploadUnusedFiles" : false
},
"usingComponents" : true,
"permission" : {
......@@ -76,7 +78,11 @@
},
"embeddedAppIdList" : [ "wx91fa336def077983" ],
"__usePrivacyCheck__" : true,
"libVersion" : "latest"
"libVersion" : "latest",
"optimization" : {
"subPackages" : true
},
"lazyCodeLoading" : "requiredComponents"
},
"mp-alipay" : {
"usingComponents" : true
......
{
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
"^mpShop-(.*)": "@/components/mpShop-$1/mpShop-$1.vue"
// "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
// "^mpShop-(.*)": "@/components/mpShop-$1/mpShop-$1.vue"
},
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/defalutScreen",
"name": "defalutScreen",
......@@ -14,31 +15,6 @@
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/index/aa",
"name": "aa",
"style": {
"navigationBarTitleText": "首页1",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "步数",
"navigationBarTextStyle": "black",
"enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#ffffff"
},
"meta": {
"auth": true,
"async": true,
"title": "步数",
"group": "步数"
},
"name": "index"
},
{
"path": "pages/index/cart",
......@@ -65,6 +41,13 @@
"subPackages": [{
"root": "pages/h5",
"pages": [{
"path": "auth",
"name": "auth",
"style": {
"navigationBarTitleText": "首页122",
"enablePullDownRefresh": false
}
},{
"path": "bindPh",
"name": "bindPh",
"style": {
......@@ -92,13 +75,6 @@
"navigationBarTitleText": "首页",
"enablePullDownRefresh": false
}
}, {
"path": "auth",
"name": "auth",
"style": {
"navigationBarTitleText": "首页",
"enablePullDownRefresh": false
}
}]
},
{
......@@ -165,7 +141,7 @@
},
"preloadRule": {
"pages/index/index": {
"pages/index/defalutScreen": {
"network": "all",
"packages": [
"pages/h5", "pages/user", "pages/public"
......
<template>
<view class="">
jajaj
</view>
</template>
<script>
import http from '@/shopro/request/index';
import store from '@/shopro/store';
import {
COMPANY_ID
} from "@/env";
import {
mapActions,
mapGetters
} from 'vuex'
export default {
components: {
},
data() {
return {
unregistered: false,
checkSessionStatus: false,
loading: true,
showPrivacy:false,
companyId:"" ,
butTips:"马上进入",
butDis:false,
path:"/pages/h5/index",
menc:'',
pay:{
orderId:'',
actuallyPay:''
}
}
},
computed: {
...mapGetters(['userInfo', 'todayNum'])
},
methods: {
...mapActions(['getPhoneNumber', 'registerInfoFn', 'authCheck', 'getUserInfo', 'enterprise']),
async loginSession() {
let token = uni.getStorageSync('token');
let that = this;
// if (this.checkSessionStatus && token) {
// let token = uni.getStorageSync('token');
console.log("token的值====================" + token)
// this.auth();
// } else {
// session 不存在,调用login。userInfo 。更新session
uni.login({
success: function(info) { //调用code
console.log("code000000000000000000000000==========", info.code, that
.companyId)
that.$store.commit('wxCode', info.code); //按钮切换全选。
let userInfo = that.getUserInfo(info.code,this.menc);
userInfo.then(res => {
if(res){
console.log("调用成功")
uni.navigateTo({
url: `/pages/h5/pay?orderId=${this.pay.orderId}&actuallyPay=${this.pay.actuallyPay}`
})
}
})
},
fail: function(err) {
console.log(err)
that.loading = false;
uni.showToast({
title: err,
duration: 2000,
icon: 'none'
});
}
})
// }
},
async getAuth() {
this.loading = true;
let that = this;
uni.checkSession({ //校验session
success(res) { //有效
if (res.errMsg === "checkSession:ok") {
that.checkSessionStatus = true;
// 如果有缓存信息
that.loginSession()
}
},
fail(err) { //无效
console.log("无效session")
that.checkSessionStatus = false;
that.loginSession()
}
})
},
//授权callback
privacyCal(){
this.showPrivacy = false
}
},
onHide() {},
onShow() {
this.butDis = false
this.butTips = "马上进入"
// uni.hideTabBar();
},
onReady() {
wx.clearStorage();
if (COMPANY_ID) { //配置了COMPANY_ID用COMPANY_ID 。否则用router上的COMPANY_ID
this.companyId = COMPANY_ID
}
if (this.$Route.query.companyId) {
this.companyId = this.$Route.query.companyId
}
if (!COMPANY_ID && !this.$Route.query.companyId) {
this.companyId = ""
}
uni.setStorageSync("companyId", this.companyId)
this.getAuth();
},
onShareAppMessage(res) {
return {
path: 'pages/index/defalutScreen'
}
},
onLoad(option){
let {menc,orderId,actuallyPay} = option;
this.menc = menc;//传递的menc
this.pay = {
orderId:orderId,//订单号
actuallyPay:actuallyPay //支付金额
}
}
}
</script>
<style lang="scss" scoped>
.screen-container {
// position: fixed;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
.bg {
width: 100%;
height: 100%;
}
.btn {
position: absolute;
transform: translateX(-50%);
left: 50%;
bottom: 100rpx;
width: 640rpx;
height: 100rpx;
line-height: 100rpx;
background-color: #fff;
color: red;
border-radius: 30rpx;
font-size: 50rpx;
font-weight: 400;
color: #ff6427;
box-shadow: 0 10px 15px 0 rgba(255, 255, 255, 0.2);
}
}
</style>
<template>
<view class="">
jajaj
啊急急急急急急
</view>
</template>
<script>
import http from '@/shopro/request/index';
import store from '@/shopro/store';
import {
defalutBg
} from "@/shopro/utils/config.js";
import {
COMPANY_ID
} from "@/env";
......@@ -13,41 +18,88 @@
mapActions,
mapGetters
} from 'vuex'
import shPrivacy from '@/components/sh-privacy/index.vue';
export default {
components: {
shPrivacy,
},
data() {
return {
unregistered: false,
checkSessionStatus: false,
loading: true,
defalutBg: defalutBg,
showPrivacy:false,
companyId:"" ,
butTips:"马上进入",
butDis:false,
path:"/pages/h5/index",
memId:''
appointPage:'personalCenter',
authCode:'',//authCode
h5Url:'https://wx.zhonghuihaotai.com/webpage/wxdist/index.html#/productList?searchFlag=1&goodsName=名字'
}
},
computed: {
...mapGetters(['userInfo', 'todayNum'])
},
methods: {
...mapActions(['getPhoneNumber', 'registerInfoFn', 'authCheck', 'getUserInfo', 'enterprise']),
// async auth() {
// let auth = await this.authCheck();
// console.log("调用authcheck的值" + auth)
// this.loading = false;
// let that = this;
// if (auth == 0) {
// that.unregistered = true;
// } else if (auth == 2001) {
// that.unregistered = false;
// }
// },
...mapActions(['getPhoneNumber', 'registerInfoFn', 'authCheck', 'getUserInfo', 'enterprise']),
// 马上进入
enter() {
this.butTips="请稍候..."
this.butDis = true
if (this.unregistered && !this.loading) {
let h5url = encodeURIComponent(this.h5Url);
console.log('加密'+h5url)
uni.navigateTo({
url: `${this.path}?h5Url=${h5url}`
})
} else {
uni.showToast({
title: "不允许",
duration: 2000,
icon: 'none'
});
//不能获取手机号,是空白页,需要按钮
// this.getInfoPhoneNumber()
}
},
// 自动注册
async autoRegister(companyId) {
let register = await this.registerInfoFn(companyId);
if (register) { //注册成功
this.unregistered = true;
uni.navigateTo({
url: this.path
})
}else{
this.butDis = false
}
},
// 获取手机号
async getInfoPhoneNumber(e) {
let list = await this.enterprise()
if (list.length == 1) {
this.autoRegister(list[0].companyId)
} else {
uni.navigateTo({
url: '/pages/user/enterprise'
})
}
},
async auth() {
let auth = await this.authCheck(this.authCode);
console.log("调用authcheck的值" + auth)
this.loading = false;
let that = this;
if (auth == 0) {
that.unregistered = true;
that.enter()
} else if (auth == 2001) {
that.unregistered = false;
}
},
async loginSession() {
let token = uni.getStorageSync('token');
let that = this;
/**
......@@ -62,26 +114,44 @@
* *
*/
// if (this.checkSessionStatus && token) {
// let token = uni.getStorageSync('token');
console.log("token的值====================" + token)
// this.auth();
// } else {
console.log('authCode111111'+this.checkSessionStatus,token)
if (this.checkSessionStatus && token) {
let token = uni.getStorageSync('token');
console.log("token存在的值====================" + token)
this.auth();
} else {
// session 不存在,调用login。userInfo 。更新session
uni.login({
success: function(info) { //调用code
success: async function(info) { //调用code
console.log("code000000000000000000000000==========", info.code, that
.companyId)
that.$store.commit('wxCode', info.code); //按钮切换全选。
let userInfo = that.getUserInfo(info.code,this.memId);
userInfo.then(res => {
if(res){
console.log("调用成功")
// uni.navigateTo({
// url: '/pages/h5/pay'
// })
let userInfo =await that.getUserInfo({"code":info.code,"authCode":that.authCode});
console.log("拿到的homePage的值"+userInfo)
if(userInfo) {
let checkCode = await that.authCheck(that.authCode);
that.loading = false;
if(checkCode == 0) {
that.unregistered = true;
that.enter()
}if (checkCode == 2001) {
that.unregistered = false;
}
})
}
// userInfo.then(res => {
// that.authCheck(that.authCode).then(checkCode => {
// that.loading = false;
// if (checkCode == 0) {
// console.log("checkcode拿到了拿到了")
// console.log(checkCode)
// that.unregistered = true;
// that.enter()
// } else if (checkCode == 2001) {
// that.unregistered = false;
// }
// })
// })
},
fail: function(err) {
console.log(err)
......@@ -94,7 +164,7 @@
}
})
// }
}
},
async getAuth() {
......@@ -115,7 +185,28 @@
}
})
},
// // 获取隐私授权
// privacySetting() {
// wx.getPrivacySetting({
// success: res => {
// console.log(
// res) // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
// if (res.needAuthorization) {
// // 需要弹出隐私协议
// this.showPrivacy=true
// } else {
// this.showPrivacy=true
// // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口
// // wx.getUserProfile()
// // wx.chooseMedia()
// // wx.getClipboardData()
// // wx.startRecord()
// }
// },
// fail: () => {},
// complete: () => {}
// })
// },
//授权callback
privacyCal(){
this.showPrivacy = false
......@@ -140,19 +231,18 @@
}
uni.setStorageSync("companyId", this.companyId)
this.getAuth();
},
onShareAppMessage(res) {
return {
path: 'pages/index/defalutScreen'
}
},
// onShareAppMessage(res) {
// return {
// path: 'pages/index/defalutScreen'
// }
// },
onLoad(option){
console.log(option)
console.log("先走")
}
}
......
......@@ -18,7 +18,8 @@
webUrl:'',
appointPage:'',
getMsg:"",
goodsId:''
goodsId:'',
h5Url:''
}
} ,
onReady(){
......@@ -35,18 +36,24 @@
if (!res.code && res.data) {
let code = res.data.sfCode;
let time = new Date().getTime();
this.webUrl= `${BASE_URL}/webpage/wxdist/index.html#/${this.appointPage?this.appointPage:""}?mallId=${MALL_ID}&companyId=${COMPANY_ID}&time=${time}&sfCode=${code}&authMode=force&goodsId=${this.goodsId}`
console.log(this.webUrl)
console.log(this.webUrl)
if(this.h5Url) {
if(this.h5Url.indexOf('?')>-1){
this.webUrl= `${this.h5Url}&mallId=${MALL_ID}&companyId=${COMPANY_ID}&time=${time}&sfCode=${code}`
}else{
this.webUrl= `${this.h5Url}?mallId=${MALL_ID}&companyId=${COMPANY_ID}&time=${time}&sfCode=${code}`
}
}else{
this.webUrl= `${BASE_URL}/webpage/wxdist/index.html#/${this.appointPage?this.appointPage:""}?mallId=${MALL_ID}&companyId=${COMPANY_ID}&time=${time}&sfCode=${code}&authMode=force&goodsId=${this.goodsId}`
}
}
})
}
},
onLoad(option){
console.log("先拿到")
console.log(option)
this.appointPage = option.appointPage?option.appointPage:"";//指定页面
let h5Url = decodeURIComponent(decodeURIComponent(option.h5Url));
this.h5Url = option.h5Url?h5Url:"";
this.goodsId = option.goodsId
this.saveMiniCode();
},
......
......@@ -6,7 +6,7 @@
<text class="info-tips">订单已创建,还需支付</text>
<view class="money-box"><text class="money">{{actuallyPay}}</text></view>
</view>
<u-button @click="pay" shape="circle" type="primary" text="微信支付" color="#61b077"></u-button>
<u-button @click="pay" shape="circle" :disabled="disablePayBtn" type="primary" text="微信支付" color="#61b077"></u-button>
</view>
<view class="payResult" v-else>
<u-icon v-if="payStatus == 'pending'" name="clock" size="60px" color="#61b077"></u-icon>
......@@ -43,7 +43,8 @@
isPay:false,
info:{
title:'支付'
}
},
disablePayBtn:false
}
},
methods: {
......@@ -101,12 +102,28 @@
},
// 掉pay支付接口获取weChatPayParams
paramsPay(){
http('order.pay', {orderId:this.orderId}).then(res => {
let params = {
"orderId":this.orderId,
"wxPayTradeType":"MWEB",
"wxPayAmt":this.actuallyPay*1,
"cardPayAmt":0,
"cardNos":"",
"cashType":32,
"merDiscountAmt":"",
"cardPayType":-1,
"bonusPayAmt":0,
"submitGoodsInfo":[],
"password":"",
}
http('order.pay', params).then(res => {
if(res.code == 0){
// if(res.data.nextStep == 4) {
this.disablePayBtn = false;
this.params = res.data.weChatPayParams;
this.pay()
// }
}else{
this.disablePayBtn = true;
this.$u.toast(res.msg);
}
})
}
......@@ -116,13 +133,18 @@
this.actuallyPay = actuallyPay;
this.orderId = orderId;
if(data) { //有微信支付的参数weChatPayParams
this.disablePayBtn = false;
this.params = JSON.parse(decodeURIComponent(data));
}else{
// 掉接口
this.paramsPay()
}
},
onUnload(){
// console.log('不在当前了')
}
}
......
......@@ -29,11 +29,7 @@
mapActions,
mapGetters
} from 'vuex'
import shPrivacy from '@/components/sh-privacy/index.vue';
export default {
components: {
shPrivacy,
},
data() {
return {
unregistered: false,
......@@ -125,13 +121,11 @@
console.log("code000000000000000000000000==========", info.code, that
.companyId)
that.$store.commit('wxCode', info.code); //按钮切换全选。
let userInfo = that.getUserInfo(info.code);
let userInfo = that.getUserInfo({"code":info.code,"authCode":''});
userInfo.then(res => {
that.authCheck().then(checkCode => {
that.loading = false;
if (checkCode == 0) {
console.log("checkcode拿到了拿到了")
console.log(checkCode)
if (checkCode == 0) {
that.unregistered = true;
} else if (checkCode == 2001) {
that.unregistered = false;
......
<template>
<view class="noticeContainer">
<view class="noticeBox">
<view class="agreeh5">中汇平台用户服务协议V1.0  </view>
......
{
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
"^mpShop-(.*)": "@/components/mpShop-$1/mpShop-$1.vue"
},
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/testHome/testHome",
"style": {
"navigationBarTitleText": "首页测试",
"navigationBarBackgroundColor":"#ffffff"
},
"meta": {
"auth": true,
"async": true,
"title": "",
"group": ""
}
},{
"path": "pages/index/load",
"style": {
"navigationBarTitleText": "",
"navigationBarBackgroundColor":"#ffffff"
},
"meta": {
"auth": true,
"async": true,
"title": "",
"group": ""
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"navigationBarTextStyle": "black",
"enablePullDownRefresh":true,
"navigationBarBackgroundColor":"#ffffff"
},
"meta": {
"auth": true,
"async": true,
"title": "首页",
"group": "用户"
},
"name":"index"
},
{
"path" : "pages/index/cart",
"name" :"cart",
"style" :
{
"navigationBarTitleText": "购物车",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/index/user",
"style" :
{
"navigationBarTitleText": "我的",
"navigationStyle":"custom",
"navigationBarTextStyle":"white",
"enablePullDownRefresh": true
}
}
,{
"path" : "pages/index/category",
"style" :
{
"navigationBarTitleText": "商品分类",
"enablePullDownRefresh": false
}
}
],
"subPackages":[{
"root": "pages/goods",
"pages": [{
"path" : "list",
"name":"goodsList",
"style" :
{
"navigationBarTitleText": "商品列表",
"enablePullDownRefresh": false
}
},{
"path": "detail",
"name": "detail",
"style": {
"navigationBarTitleText": "详情",
"navigationBarTextStyle": "black"
}
}]
},{
"root":"pages/order",
"pages": [
{
"path" : "confirm",
"name" : "confirm",
"style" :
{
"navigationBarTitleText": "下单页",
"enablePullDownRefresh": false
}
},
{
"path" : "payment/cashier",
"style" :
{
"navigationBarTitleText": "收银台",
"enablePullDownRefresh": false
}
},
{
"path": "payment/result",
"style": {
"navigationBarTitleText": "支付结果"
}
},
{
"path": "afterSale/refund",
"style": {
"navigationBarTitleText": "选择售后类型"
}
},
{
"path": "afterSale/detail",
"style": {
"navigationBarTitleText": "申请售后"
}
},
{
"path": "afterSale/sendBack",
"style": {
"navigationBarTitleText": "商品回寄"
}
},
{
"path": "afterSale/refundDetail",
"style": {
"navigationBarTitleText": "退款详情"
}
},
{
"path": "list",
"name": "orderList",
"style": {
"navigationBarTitleText": "订单列表"
}
},
{
"path": "detail",
"name":"orderDetail",
"style": {
"navigationBarTitleText": "订单详情",
"navigationBarBackgroundColor":"#fe4433",
"backgroundColor":"#ffffff",
"navigationBarTextStyle":"white"
}
}
]
},
{
"root": "pages/user",
"pages": [{
"path" : "enterprise",
"name":"enterprise",
"style" :
{
"navigationBarTitleText": "选择企业",
"enablePullDownRefresh": false
},
"meta": {
"auth": true,
"async": true,
"title": "选择企业",
"group": "用户"
}
},{
"path" : "address/edit",
"style" :
{
"navigationBarTitleText": "新建收货地址",
"enablePullDownRefresh": false
}
},{
"path": "address/list",
"style": {
"navigationBarTitleText": "收货地址管理",
"enablePullDownRefresh": false
}
},{
"path": "wallet/detail",
"style": {
"navigationBarTitleText": "余额明细",
"enablePullDownRefresh": false
}
},
{
"path": "favorite/list",
"style": {
"navigationBarTitleText": "我的收藏",
"enablePullDownRefresh": false
}
}]
},
{
"root": "pages/app",
"pages": [{
"path" : "giftCard/list",
"style" :
{
"navigationBarTitleText": "礼品卡",
"enablePullDownRefresh": false
}
},
{
"path" : "coupon/list",
"style" :
{
"navigationBarTitleText": "优惠券",
"enablePullDownRefresh": false
}
}]
},
{
"root": "pages/public",
"pages": [{
"path" : "customerService",
"style" :
{
"navigationBarTitleText": "商城客服",
"enablePullDownRefresh": false
}
}]
}
],
"tabBar": {
"color":"#626262",
"selectedColor": "#f1270c",
"backgroundColor": "#ffffff",
"borderStyle": "black",
"list":[{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/img/tabbar/tabbar_home.png",
"selectedIconPath": "/static/img/tabbar/tabbar_home1.png"
},{
"pagePath": "pages/index/category",
"text": "分类",
"iconPath": "static/img/tabbar/tabbar_category.png",
"selectedIconPath": "/static/img/tabbar/tabbar_category1.png"
},{
"pagePath": "pages/index/cart",
"text": "购物车",
"iconPath": "static/img/tabbar/tabbar_cart.png",
"selectedIconPath": "/static/img/tabbar/tabbar_cart1.png"
},
{
"pagePath": "pages/index/user",
"text": "我的",
"iconPath": "static/img/tabbar/tabbar_personal.png",
"selectedIconPath": "/static/img/tabbar/tabbar_personal1.png"
}
]
},
"preloadRule": {
"pages/index/index": {
"network": "all",
"packages": ["pages/order", "pages/user", "pages/goods", "pages/app"]
}
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"condition" : { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [
{
"name": "goodsList", //模式名称
"path": "/pages/goods/list" //启动页面,必选
}
]
}
}
......@@ -75,7 +75,7 @@ export default {
pay:{
url: "order/pay",
auth: true,
method: "get"
method: "post"
}
}
......
......@@ -46,18 +46,18 @@ const actions = {
dispatch,
commit,
state
}, code,memId) {
}, info) {
let companyId = uni.getStorageSync('companyId')
return new Promise((resolve, reject) => {
console.log("调用的homePage"+info.authCode)
uni.setStorageSync("mallId", state.mallId);
// console.log(state.wxCode)
// let code = state.wxCode;
http('user.getHomePage', {
code: code,
code: info.code,
mallId: state.mallId,
companyId:companyId?companyId:"",
memId:memId?memId:""//传递memId
authCode:info.authCode?info.authCode:""//传递authCode
}).then(res => {
if (res.code == 0) {
let { sessionKey } = res.data;
......@@ -83,7 +83,7 @@ const actions = {
commit,
dispatch,
state
}) {
},authCode) {
return new Promise((resolve, reject) => {
let token = uni.getStorageSync('token');
let mallId = uni.getStorageSync('mallId');
......@@ -95,7 +95,6 @@ const actions = {
mallId: mallId
}).then(res => {
console.log("authcheck状态码=========================")
console.log(res)
let data = res.data;
if (res.code === 0) {
resolve(res.code)
......@@ -103,7 +102,7 @@ const actions = {
uni.login({
success: function(info) { //调用code
state.wxCode == info.code;
dispatch('getUserInfo',info.code);
dispatch('getUserInfo',{"code":info.code,"authCode":authCode});
},
fail:function(info) {
uni.showToast({
......
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