Commit 8f97d51b authored by geruidan's avatar geruidan

增加auth自动注册,到首页并支付

parent 779f5e24
......@@ -10,12 +10,9 @@ export const IMG_URL = 'http://file.shopro.top' //全局网络图片地址变量
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 ="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 MALL_ID ="120939311101327"; //中会汇豪泰
export const COMPANY_ID ="2025030401";
export const APP_ID = "wx60c6530c49c52ff7"; //小程序APPID
export const APP_KEY = "a20511dcfd6b07114afacbb482b2e7e0"; //勿改
......
......@@ -57,9 +57,9 @@
"appid" : "wx60c6530c49c52ff7",
"setting" : {
"urlCheck" : true,
"minified" : true,
"minified" : false,
"es6" : true,
"postcss" : false,
"postcss" : true,
"ignoreDevUnusedFiles" : false,
"ignoreUploadUnusedFiles" : false
},
......
{
"easycom": {
// "^u-(.*)": "uview-ui/components/u-$1/u-$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",
......@@ -16,22 +16,23 @@
}
},
{
"path": "pages/index/cart",
"name": "cart",
"path": "pages/index/category",
"name": "category",
"style": {
"navigationBarTitleText": "购物车",
"navigationBarTitleText": "分类",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/category",
"name": "category",
"path": "pages/index/cart",
"name": "cart",
"style": {
"navigationBarTitleText": "分类",
"navigationBarTitleText": "购物车",
"enablePullDownRefresh": false
}
}
......@@ -44,7 +45,7 @@
"path": "auth",
"name": "auth",
"style": {
"navigationBarTitleText": "首页122",
"navigationBarTitleText": "首页",
"enablePullDownRefresh": false
}
},{
......@@ -73,7 +74,8 @@
"name": "index",
"style": {
"navigationBarTitleText": "首页",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"navigationStyle": "default" // 默认样式,会显示返回图标
}
}]
},
......
<template>
<view class="">
啊急急急急急急
</view>
</template>
......@@ -32,7 +30,9 @@
path:"/pages/h5/index",
appointPage:'personalCenter',
authCode:'',//authCode
h5Url:'https://wx.zhonghuihaotai.com/webpage/wxdist/index.html#/productList?searchFlag=1&goodsName=名字'
h5Url:'https://wx.zhonghuihaotai.com/webpage/wxdist/index.html#/',//传递参数1
backMiniProgram:''//回退到小程序的参数
}
},
computed: {
......@@ -46,9 +46,8 @@
this.butDis = true
if (this.unregistered && !this.loading) {
let h5url = encodeURIComponent(this.h5Url);
console.log('加密'+h5url)
uni.navigateTo({
url: `${this.path}?h5Url=${h5url}`
uni.redirectTo({
url: `${this.path}?h5Url=${h5url}&backMiniProgram=${this.backMiniProgram}`
})
......@@ -212,13 +211,18 @@
this.showPrivacy = false
}
},
onHide() {},
onUnload() {
},
onShow() {
this.butDis = false
this.butTips = "马上进入"
// uni.hideTabBar();
},
onReady() {
onReady() {
// this.authCode = this.$Route.query.authCode;
this.authCode = this.$Route.query.authCode;
// this.backMiniProgram = this.$Route.query.backMiniProgram;
this.backMiniProgram = this.$Route.query.backMiniProgram
wx.clearStorage();
if (COMPANY_ID) { //配置了COMPANY_ID用COMPANY_ID 。否则用router上的COMPANY_ID
this.companyId = COMPANY_ID
......@@ -241,7 +245,8 @@
// }
// },
onLoad(option){
console.log("先走")
}
......
......@@ -19,10 +19,12 @@
appointPage:'',
getMsg:"",
goodsId:'',
h5Url:''
h5Url:'',
backMiniProgram:''//回退到上个页的but
}
} ,
onReady(){
this.backMiniProgram = this.$Route.query.backMiniProgram
// this.webUrl = "https://wx.zhonghuihaotai.com/webpage/wxdist/index.html#/?mallId=134581110000230&companyId=00000310&time="+new Date().getTime()
},
methods:{
......@@ -38,9 +40,9 @@
let time = new Date().getTime();
if(this.h5Url) {
if(this.h5Url.indexOf('?')>-1){
this.webUrl= `${this.h5Url}&mallId=${MALL_ID}&companyId=${COMPANY_ID}&time=${time}&sfCode=${code}`
this.webUrl= `${this.h5Url}&mallId=${MALL_ID}&companyId=${COMPANY_ID}&time=${time}&sfCode=${code}&authMode=force`
}else{
this.webUrl= `${this.h5Url}?mallId=${MALL_ID}&companyId=${COMPANY_ID}&time=${time}&sfCode=${code}`
this.webUrl= `${this.h5Url}?mallId=${MALL_ID}&companyId=${COMPANY_ID}&time=${time}&sfCode=${code}&authMode=force`
}
}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}`
......@@ -51,11 +53,17 @@
}
},
onLoad(option){
this.appointPage = option.appointPage?option.appointPage:"";//指定页面
let h5Url = decodeURIComponent(decodeURIComponent(option.h5Url));
this.h5Url = option.h5Url?h5Url:"";
this.goodsId = option.goodsId
this.saveMiniCode();
console.log("option")
console.log(option)
if(option){
this.appointPage = option.appointPage?option.appointPage:"";//指定页面
let h5Url = decodeURIComponent(decodeURIComponent(option.h5Url));
this.h5Url = option.h5Url?h5Url:"";
this.backMiniProgram = option.backMiniProgram?option.backMiniProgram:'';
this.goodsId = option.goodsId
this.saveMiniCode();
}
},
// onShareAppMessage(res){
// let path = "pages/index/defalutScreen"
......@@ -68,6 +76,13 @@
// },
onLaunch(){
},
onUnload(){
// uni.reLaunch({
// url:'/pages/index/xx'
// })
}
......
<template>
<view>购物车</view>
</template>
\ No newline at end of file
<view class="">
<view @click="handleMsg">跳转小程序{{authCode}}</view>
<!-- <input class="uni-input" style="border:2px solid #ddd;" v-model="authCode" placeholder="自动获得焦点" /> -->
</view>
</template>
<script>
export default {
data() {
return {
authCode:'',
backMiniProgram:'/pages/index/category',
backAppId:''
}
},
methods:{
handleMsg(){
// backMiniProgram:'/pages/index/category'//参考格式
// authCode:'xx',
// appId:'小程序appid'
uni.navigateToMiniProgram({
appId: 'wx60c6530c49c52ff7', // 目标小程序的 appId
path: `/pages/h5/auth?authCode=${this.authCode}&backMiniProgram=${this.backMiniProgram}&backAppId=${this.backAppId}`, // 可选,跳转的目标页面路径
envVersion: 'trial', // 可选,目标小程序的版本:'develop'、'trial'、'release'
success(res) {
console.log('跳转成功', res);
uni.showToast({
title: "跳转成功",
duration: 2000,
icon: 'none'
});
},
fail(err) {
uni.showToast({
title: "跳转失败",
duration: 2000,
icon: 'none'
});
console.error('跳转失败', err);
}
});
}
}
}
</script>
\ No newline at end of file
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