feata:微信安全测试
This commit is contained in:
@@ -195,6 +195,18 @@
|
||||
"router" : {
|
||||
"mode" : "hash",
|
||||
"base" : ""
|
||||
},
|
||||
"devServer" : {
|
||||
"port" : 5173,
|
||||
"proxy" : {
|
||||
"/proxy-api" : {
|
||||
"target" : "https://api.o.tbmall.xin",
|
||||
"changeOrigin" : true,
|
||||
"pathRewrite" : {
|
||||
"^/proxy-api" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -772,7 +772,7 @@ export default {
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 4px;
|
||||
background: linear-gradient(270deg, #af39c4 0%, #7732ff 100%);
|
||||
//background: linear-gradient(270deg, #af39c4 0%, #7732ff 100%);
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,14 +216,14 @@
|
||||
{{ selectSpecificationTempl.price }}
|
||||
</text>
|
||||
<view style="font-size: 50rpx" v-else>
|
||||
{{ skuBySpecInfo.supplyPrice }}
|
||||
{{ skuBySpecInfo.originalPrice }}
|
||||
<text v-if="skuBySpecInfo.price">- {{ skuBySpecInfo.price }}</text>
|
||||
</view>
|
||||
<view class="price_content_coupon_warp" v-if="orderInfo.couponPrice && orderInfo.couponPrice !== 0">
|
||||
优惠券{{
|
||||
orderInfo.couponPrice }}</view>
|
||||
</view>
|
||||
<view class="oOrice_content_warp" v-if="!isCoupon">¥{{ skuBySpecInfo.supplyPrice }}</view>
|
||||
<view class="oOrice_content_warp" v-if="!isCoupon">¥{{ skuBySpecInfo.originalPrice }}</view>
|
||||
<view class="coupon_content_warp" v-if="orderInfo.couponPrice && orderInfo.couponPrice !== 0">
|
||||
优惠券已优惠¥{{
|
||||
orderInfo.couponPrice }}</view>
|
||||
@@ -1224,7 +1224,7 @@ export default {
|
||||
const skuBySpecBash = this.getSkuBySpecValueIds(this.selectedSpecValueIds) || {};
|
||||
console.log("----111", skuBySpecBash)
|
||||
|
||||
this.skuBySpecInfo = { ...this.orderInfo, skuImage: skuBySpecBash.skuImage, stock: skuBySpecBash.stock, supplyPrice: skuBySpecBash.supplyPrice, price: skuBySpecBash.price, skuName: skuBySpecBash.skuName }
|
||||
this.skuBySpecInfo = { ...this.orderInfo, skuImage: skuBySpecBash.skuImage, stock: skuBySpecBash.stock, supplyPrice: skuBySpecBash.supplyPrice, price: skuBySpecBash.price, skuName: skuBySpecBash.skuName, originalPrice: skuBySpecBash.originalPrice }
|
||||
console.log("----222", this.orderInfo)
|
||||
|
||||
if (this.selectedSpecValueIds.every((id) => id != null)) {
|
||||
|
||||
@@ -4,25 +4,21 @@
|
||||
<Header title="设置" />
|
||||
<view class="setting-view">
|
||||
<view class="item-list mt-24">
|
||||
<view class="flex-r-lr item-box" @click="onHead(index)"
|
||||
v-for="(item,index) in headList" :key="index"
|
||||
:style="{borderWidth:index == headList.length - 1 ? '0' : '2rpx'}"
|
||||
>
|
||||
<text class="text-gray text-32">{{item.text}}</text>
|
||||
<view class="flex-r-lr item-box" @click="onHead(index)" v-for="(item, index) in headList" :key="index"
|
||||
:style="{ borderWidth: index == headList.length - 1 ? '0' : '2rpx' }">
|
||||
<text class="text-gray text-32">{{ item.text }}</text>
|
||||
<view class="flex-r-e" style="align-items: center;">
|
||||
<image v-if="item.type == 'img'" :src="item.value" class="ava-img"></image>
|
||||
<text class="text-zu text-32" v-if="item.type == 'text'">{{item.value}}</text>
|
||||
<text class="text-zu text-32" v-if="item.type == 'text'">{{ item.value }}</text>
|
||||
<u-icon size="16" name="arrow-right" color="#666" style="margin-left:12rpx"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="item-list mt-24">
|
||||
<view class="flex-r-lr item-box" @click="onBottom(index)"
|
||||
v-for="(item,index) in bottomList" :key="index"
|
||||
:style="{borderWidth:index == bottomList.length - 1 ? '0' : '2rpx'}"
|
||||
>
|
||||
<text class="text-gray text-32">{{item.text}}</text>
|
||||
<view class="flex-r-lr item-box" @click="onBottom(index)" v-for="(item, index) in bottomList"
|
||||
:key="index" :style="{ borderWidth: index == bottomList.length - 1 ? '0' : '2rpx' }">
|
||||
<text class="text-gray text-32">{{ item.text }}</text>
|
||||
<view class="flex-r-e" style="align-items: center;">
|
||||
<u-icon size="16" name="arrow-right" color="#666" style="margin-left:12rpx"></u-icon>
|
||||
</view>
|
||||
@@ -36,34 +32,34 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getUserInfo,uploadAvatar } from '@/api/auth.js';
|
||||
import { getUserInfo, uploadAvatar } from '@/api/auth.js';
|
||||
import { uploadImage, uploadImg } from '@/api/common.js';
|
||||
import { IMG_TYPE } from '@/utils/enumUtils.js';
|
||||
import { BASE_URL, Authorization } from '@/utils/config.js';
|
||||
import { getStorageFun, TOKEN_NAME,clear } from '@/utils/auth.js';
|
||||
import { getStorageFun, TOKEN_NAME, clear } from '@/utils/auth.js';
|
||||
import Header from '@/components/common/header.vue';
|
||||
import TopSafe from '@/components/common/top-safe.nvue'
|
||||
import MyBtn from '@/components/common/my-btn.vue'
|
||||
import func from '@/utils/func.js';
|
||||
|
||||
export default {
|
||||
components: { Header, TopSafe,MyBtn },
|
||||
components: { Header, TopSafe, MyBtn },
|
||||
data() {
|
||||
return {
|
||||
type: false,
|
||||
userInfo: null,
|
||||
headList:[
|
||||
{text:'头像',type:'img',value:''},
|
||||
{text:'用户名称',type:'text',value:''},
|
||||
headList: [
|
||||
{ text: '头像', type: 'img', value: '' },
|
||||
{ text: '用户名称', type: 'text', value: '' },
|
||||
],
|
||||
bottomList:[
|
||||
{text:'账号与安全'},
|
||||
{text:'我的合同'},
|
||||
{text:'资质照片'},
|
||||
{text:'用户协议'},
|
||||
{text:'隐私协议'},
|
||||
{text:'售后保障协议'},
|
||||
{text:'关于我们'},
|
||||
bottomList: [
|
||||
{ text: '账号与安全' },
|
||||
{ text: '我的合同' },
|
||||
{ text: '资质照片' },
|
||||
{ text: '用户协议' },
|
||||
{ text: '隐私协议' },
|
||||
{ text: '售后保障协议' },
|
||||
{ text: '关于我们' },
|
||||
]
|
||||
};
|
||||
},
|
||||
@@ -77,10 +73,10 @@ export default {
|
||||
init() {
|
||||
this.userinfo()
|
||||
},
|
||||
onHead(index){
|
||||
console.log('index',index)
|
||||
onHead(index) {
|
||||
console.log('index', index)
|
||||
let that = this;
|
||||
if(index == 0){
|
||||
if (index == 0) {
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认9,设置图片的数量
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
@@ -91,9 +87,9 @@ export default {
|
||||
that.uploadFile(filePath);
|
||||
}
|
||||
});
|
||||
}else if(index == 1){
|
||||
} else if (index == 1) {
|
||||
uni.navigateTo({
|
||||
url:'/pages/rwa_package/setName/setName'
|
||||
url: '/pages/rwa_package/setName/setName'
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -118,7 +114,13 @@ export default {
|
||||
success: (uploadFileRes) => {
|
||||
const data = JSON.parse(uploadFileRes.data);
|
||||
if (data.bizcode === 100) {
|
||||
that.setUploadAvatar(data.data.accessUrl);
|
||||
const accessUrl = data.data.accessUrl;
|
||||
// #ifdef MP-WEIXIN
|
||||
that.handleWxMediaCheck(accessUrl);
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
that.setUploadAvatar(accessUrl);
|
||||
// #endif
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '图片上传失败',
|
||||
@@ -142,11 +144,109 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
setUploadAvatar(img){
|
||||
let params = {
|
||||
imgUrl:img
|
||||
// #ifdef MP-WEIXIN
|
||||
async handleWxMediaCheck(imgUrl) {
|
||||
uni.showLoading({
|
||||
title: '安全检测中...',
|
||||
});
|
||||
try {
|
||||
const [token, openid] = await Promise.all([
|
||||
this.getWxAccessToken(),
|
||||
this.getWxOpenId()
|
||||
]);
|
||||
uni.request({
|
||||
url: `https://api.weixin.qq.com/wxa/media_check_async?access_token=${token}`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
media_url: imgUrl,
|
||||
media_type: 2,
|
||||
version: 2,
|
||||
scene: 1,
|
||||
openid: openid
|
||||
},
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data && res.data.errcode === 0) {
|
||||
this.setUploadAvatar(imgUrl);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: (res.data && res.data.errmsg) || '图片检测未通过',
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '安全检测失败',
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '获取微信凭证或OpenID失败',
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
});
|
||||
}
|
||||
uploadAvatar(params).then(res=>{
|
||||
},
|
||||
getWxAccessToken() {
|
||||
const appid = 'wx376a16a88befe265';
|
||||
const secret = '0e8fcbf770d72d41b84ea5ebdc427d10';
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${appid}&secret=${secret}`,
|
||||
method: 'GET',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.access_token) {
|
||||
resolve(res.data.access_token);
|
||||
} else {
|
||||
reject(res.data);
|
||||
}
|
||||
},
|
||||
fail: (err) => reject(err)
|
||||
});
|
||||
});
|
||||
},
|
||||
getWxOpenId() {
|
||||
const appid = 'wx376a16a88befe265';
|
||||
const secret = '0e8fcbf770d72d41b84ea5ebdc427d10';
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (loginRes) => {
|
||||
if (loginRes.code) {
|
||||
uni.request({
|
||||
url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${loginRes.code}&grant_type=authorization_code`,
|
||||
method: 'GET',
|
||||
success: (res) => {
|
||||
if (res.data && res.data.openid) {
|
||||
resolve(res.data.openid);
|
||||
} else {
|
||||
reject(res.data);
|
||||
}
|
||||
},
|
||||
fail: (err) => reject(err)
|
||||
});
|
||||
} else {
|
||||
reject(loginRes);
|
||||
}
|
||||
},
|
||||
fail: (err) => reject(err)
|
||||
});
|
||||
});
|
||||
},
|
||||
// #endif
|
||||
setUploadAvatar(img) {
|
||||
let params = {
|
||||
imgUrl: img
|
||||
}
|
||||
console.log("---", params)
|
||||
uploadAvatar(params).then(res => {
|
||||
if (res.bizcode === 100) {
|
||||
this.$refs.uToastRef.show({
|
||||
type: 'success',
|
||||
@@ -161,40 +261,40 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
onOutLogin(){
|
||||
onOutLogin() {
|
||||
clear();
|
||||
uni.navigateTo({
|
||||
url: '/pages/login_package/login/login'
|
||||
})
|
||||
},
|
||||
onBottom(index){
|
||||
onBottom(index) {
|
||||
let url = '';
|
||||
switch(index){
|
||||
switch (index) {
|
||||
case 0:
|
||||
url = '/pages/rwa_package/accountSafe/accountSafe'
|
||||
break;
|
||||
url = '/pages/rwa_package/accountSafe/accountSafe'
|
||||
break;
|
||||
case 1:
|
||||
url = '/pages/rwa_package/dongjian/index'
|
||||
break;
|
||||
url = '/pages/rwa_package/dongjian/index'
|
||||
break;
|
||||
case 2:
|
||||
url = '/pages/rwa_package/zhaopian/zhaopian'
|
||||
break;
|
||||
url = '/pages/rwa_package/zhaopian/zhaopian'
|
||||
break;
|
||||
case 3:
|
||||
url = '/pages/mine_package/mine_user_agreement/mine_user_agreement'
|
||||
break;
|
||||
url = '/pages/mine_package/mine_user_agreement/mine_user_agreement'
|
||||
break;
|
||||
case 4:
|
||||
url = '/pages/mine_package/mine_privacy_agreement/mine_privacy_agreement'
|
||||
break;
|
||||
url = '/pages/mine_package/mine_privacy_agreement/mine_privacy_agreement'
|
||||
break;
|
||||
case 5:
|
||||
url = '/pages/mine_package/mine_product_agreement/mine_product_agreement'
|
||||
break;
|
||||
url = '/pages/mine_package/mine_product_agreement/mine_product_agreement'
|
||||
break;
|
||||
case 6:
|
||||
url = '/pages/mine_package/mine_about_us/mine_about_us'
|
||||
break;
|
||||
url = '/pages/mine_package/mine_about_us/mine_about_us'
|
||||
break;
|
||||
}
|
||||
if(url){
|
||||
if (url) {
|
||||
uni.navigateTo({
|
||||
url:url
|
||||
url: url
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -223,21 +323,24 @@ export default {
|
||||
overflow-y: auto;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
.item-list{
|
||||
width:100%;
|
||||
|
||||
.item-list {
|
||||
width: 100%;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
.item-box{
|
||||
min-height:108rpx;
|
||||
|
||||
.item-box {
|
||||
min-height: 108rpx;
|
||||
padding: 0 32rpx;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
border-bottom:solid #EAEAEA;
|
||||
.ava-img{
|
||||
width:60rpx;
|
||||
height:60rpx;
|
||||
border-bottom: solid #EAEAEA;
|
||||
|
||||
.ava-img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-1
@@ -2,10 +2,20 @@ export const BASE_URL = "https://api.tbmall.xin"; //生产
|
||||
export const MILD_BASE_URL = "https://agent.tbmall.xin/"; //中台生产
|
||||
export const kefuBaseUrl = "https://admin.tbmall.xin/api";
|
||||
|
||||
// export const BASE_URL ='https://api.o.tbmall.xin'; // 本地测试
|
||||
|
||||
// export const BASE_URL = baseUrl; // 本地测试
|
||||
// export const MILD_BASE_URL = "https://agent.o.tbmall.xin/"; //中台测试
|
||||
// export const kefuBaseUrl = "https://admin.o.tbmall.xin/api";
|
||||
|
||||
|
||||
// H5 环境且开发模式下使用 '/proxy-api' 代理解决浏览器跨域(注意不能用 '/api',否则会与本地 /api 源码目录冲突)
|
||||
let baseUrl = 'https://api.o.tbmall.xin';
|
||||
// #ifdef H5
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
baseUrl = '/proxy-api';
|
||||
}
|
||||
// #endif
|
||||
|
||||
// https://h.o.tbmall.xin/#/
|
||||
// 客服接口属于管理后台服务,用户端接口已在后端单独放行。
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import uni from '@dcloudio/vite-plugin-uni';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/proxy-api': {
|
||||
target: 'https://api.o.tbmall.xin',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/proxy-api/, '')
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user