Commit 97e9fd9a authored by 18224442217's avatar 18224442217

加密

parent 56233e2f
<template> <template>
<div class="auth-page"> <div class="auth-page" v-if="false">
<u-popup v-model="showDialog" mode="center" :mask-close-able="false" custom-style="padding:0;background:none;"> <u-popup v-model="showDialog" mode="center" :mask-close-able="false" custom-style="padding:0;background:none;">
<img :src="pageinfo.pic_url" mode="widthFix" /> <img :src="pageinfo.pic_url" mode="widthFix" />
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<script> <script>
import coupon from "@/components/coupons/coupons"; import coupon from "@/components/coupons/coupons";
export default { export default {
components: { components: {
coupon, coupon,
...@@ -36,18 +37,19 @@ ...@@ -36,18 +37,19 @@
}; };
}, },
created() { created() {
this.pageinfo = uni.getStorageSync("basedata") ? // this.pageinfo = uni.getStorageSync("basedata") ?
uni.getStorageSync("basedata").auth_page : {}; // uni.getStorageSync("basedata").auth_page : {};
if (wx.getUserProfile) { // if (wx.getUserProfile) {
this.canIUseGetUserProfile = true; // this.canIUseGetUserProfile = true;
} // }
// #ifdef MP-ALIPAY // // #ifdef MP-ALIPAY
this.canIUseGetUserProfile = true; // this.canIUseGetUserProfile = true;
// #endif // // #endif
let x = this.pageinfo.hotspot; // let x = this.pageinfo.hotspot;
let y = this.pageinfo.hotspot_cancel; // let y = this.pageinfo.hotspot_cancel;
this.sureStyle = `height:${x.height}rpx;width:${x.width}rpx;left:${x.left}rpx;top:${x.top}rpx;`; // this.sureStyle = `height:${x.height}rpx;width:${x.width}rpx;left:${x.left}rpx;top:${x.top}rpx;`;
this.cancelStyle = `height:${y.height}rpx;width:${y.width}rpx;left:${y.left}rpx;top:${y.top}rpx;`; // this.cancelStyle = `height:${y.height}rpx;width:${y.width}rpx;left:${y.left}rpx;top:${y.top}rpx;`;
this.getUserInfo()
}, },
methods: { methods: {
getoldUser() { getoldUser() {
...@@ -94,44 +96,66 @@ ...@@ -94,44 +96,66 @@
}, },
}); });
}, },
getUserInfo(info) { getUserInfo() {
var that = this; var that = this;
that.showDialog = true; that.showDialog = true;
uni.getProvider({ wx.login({
service: "oauth",
success: function(res) {
if (~res.provider.indexOf("weixin")) {
uni.login({
provider: "weixin",
success: (res) => { success: (res) => {
//这里请求接口 //console.log(res)
let obj = { let obj = {
Source: 1, Source: 1,
OpenId: "", OpenId: "",
Name: info.userInfo.nickName, Name: '微信小程序用户',
Photo: info.userInfo.avatarUrl, Photo: 'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1695262844000_280.png',
Gender: info.userInfo.gender, Gender: 0,
Moblie: "", Moblie: "",
SuperiorId: 0, SuperiorId: 0,
code: res.code, code: res.code,
}; };
that.getCode(obj); that.getCode(obj);
}, },
fail: () => { fail() {
uni.showToast({ that.showDialog=false
title: "微信登录授权失败",
icon: "none",
});
},
});
} else {
uni.showToast({ uni.showToast({
title: "请先安装微信或升级版本", title:'微信登录失败'
icon: "none", })
});
} }
}, })
}); // uni.getProvider({
// service: "oauth",
// success: function(res) {
// if (~res.provider.indexOf("weixin")) {
// uni.login({
// provider: "weixin",
// success: (res) => {
// //这里请求接口
// let obj = {
// Source: 1,
// OpenId: "",
// Name: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// Gender: info.userInfo.gender,
// Moblie: "",
// SuperiorId: 0,
// code: res.code,
// };
// that.getCode(obj);
// },
// fail: () => {
// uni.showToast({
// title: "微信登录授权失败",
// icon: "none",
// });
// },
// });
// } else {
// uni.showToast({
// title: "请先安装微信或升级版本",
// icon: "none",
// });
// }
// },
// });
}, },
close() { close() {
this.showDialog = false; this.showDialog = false;
......
...@@ -69,9 +69,9 @@ ...@@ -69,9 +69,9 @@
"quickapp" : {}, "quickapp" : {},
/* 小程序特有相关 */ /* 小程序特有相关 */
"mp-weixin" : { "mp-weixin" : {
"appid" : "wx5564525562e92ddb", "appid" : "wxcf0727a7c78b501e",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : true,
"minified" : false "minified" : false
}, },
"usingComponents" : true, "usingComponents" : true,
......
import Md5 from "js-md5" import Md5 from "js-md5"
import { get_xs } from '@/static/xhs.js'
const resolveRVHandler =(response)=>{
if(response.header && response.header['r-v']){
uni.setStorageSync("r-v",response.header['r-v'])
}
}
const getRVHandler = (payload,token)=>{
if(uni.getStorageSync("r-v")){
let a1 =uni.getStorageSync("r-v")
let xs = get_xs(payload, a1,token)
if(xs && xs !=''){
console.log(xs)
return xs
}
}
return ''
}
export default { export default {
install(Vue, options) { install(Vue, options) {
Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285" Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
...@@ -31,14 +51,7 @@ export default { ...@@ -31,14 +51,7 @@ export default {
}); });
} }
Vue.prototype.request2 = function(param, success, failed) { Vue.prototype.request2 = function(param, success, failed) {
//网络请求 let data = {
uni.request({
url: this.host2 + param.url,
method: param.method || "Post",
header: param.header || {
'content-type': "application/json"
},
data: {
MallBaseId: this.GetMiniAppId().MallBaseId, MallBaseId: this.GetMiniAppId().MallBaseId,
TenantId: this.GetMiniAppId().TenantId, TenantId: this.GetMiniAppId().TenantId,
OpenId: this.GetOpenId().OpenId, OpenId: this.GetOpenId().OpenId,
...@@ -47,8 +60,21 @@ export default { ...@@ -47,8 +60,21 @@ export default {
MiniAppId: this.GetMiniAppId().AppId, MiniAppId: this.GetMiniAppId().AppId,
msg: param.data, msg: param.data,
token: this.GetOpenId().token token: this.GetOpenId().token
}
//['X-s']
const sign = getRVHandler(data,this.GetOpenId().token)
//网络请求
uni.request({
url: this.host2 + param.url,
method: param.method || "Post",
header: param.header || {
'content-type': "application/json",
'x-sign':sign["X-s"],
'x-ts':sign["X-t"]
}, },
data,
success: res => { success: res => {
resolveRVHandler(res)
if (res.data.resultCode == 10000) { if (res.data.resultCode == 10000) {
let u = uni.getStorageSync("mall_UserInfo"); let u = uni.getStorageSync("mall_UserInfo");
if (u) { if (u) {
...@@ -79,15 +105,19 @@ export default { ...@@ -79,15 +105,19 @@ export default {
//请求app接口 //请求app接口
Vue.prototype.apipost = function(cmd, msg, success, failed) { Vue.prototype.apipost = function(cmd, msg, success, failed) {
var postData = this.GetPostData(cmd, msg, ""); var data = this.GetPostData(cmd, msg, "");
//['X-s']
const sign = getRVHandler(data,data.token)
uni.request({ uni.request({
url: this.host3 + '/api/common/post', url: this.host3 + '/api/common/post',
method: "Post", method: "Post",
header: { header: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
'x-sign':sign["X-s"], 'x-ts':sign["X-t"]
}, },
data: postData, data,
success: res => { success: res => {
resolveRVHandler(res)
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) { if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
uni.removeStorageSync('b2b_user') uni.removeStorageSync('b2b_user')
uni.removeStorageSync('mall_UserInfo') uni.removeStorageSync('mall_UserInfo')
...@@ -300,9 +330,9 @@ export default { ...@@ -300,9 +330,9 @@ export default {
//wx5564525562e92ddb //wx5564525562e92ddb
//wxcf0727a7c78b501e //wxcf0727a7c78b501e
appObj = { appObj = {
AppId: 'wx5564525562e92ddb', AppId: 'wxcf0727a7c78b501e',
TenantId: 29, TenantId: 12,
MallBaseId: 19, MallBaseId: 2,
}; };
break; break;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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