mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:43:26 +08:00
1、修复下单界面【添加收货地址】按钮宽度及不居中的问题。
2、去除接口生成海报不需要的字体,只保留思源标准字体。 3、修复弹窗登录报【checkbox未嵌套的问题】 4、移除【Microsoft.IdentityModel.Tokens】组件,防止更新组件导致对jwt token校验的影响。 5、移除【http.interceptor.js】遗留的前端请求拦截器。
This commit is contained in:
@@ -1,93 +0,0 @@
|
||||
import { apiBaseUrl } from '@/common/setting/constVarsHelper.js';
|
||||
import * as db from '@/common/utils/dbHelper.js' //引入common
|
||||
|
||||
|
||||
// 这里的Vue为Vue对象(非创建出来的实例),vm为main.js中“Vue.use(httpInterceptor, app)”这一句的第二个参数,
|
||||
// 为一个Vue的实例,也即每个页面的"this"
|
||||
// 如果需要了解这个install方法是什么,请移步:https://uviewui.com/components/vueUse.html
|
||||
const install = (Vue, vm) => {
|
||||
// 此为自定义配置参数,具体参数见上方说明
|
||||
Vue.prototype.$u.http.setConfig({
|
||||
baseUrl: apiBaseUrl, // 请求的本域名
|
||||
method: 'POST',
|
||||
dataType: 'json',// 设置为json,返回后会对数据进行一次JSON.parse()
|
||||
showLoading: true, // 是否显示请求中的loading
|
||||
loadingText: '请求中...', // 请求loading中的文字提示
|
||||
loadingTime: 800, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
|
||||
originalData: false, // 是否在拦截器中返回服务端的原始数据
|
||||
loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
|
||||
// 配置请求头信息
|
||||
header: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
});
|
||||
|
||||
// 请求拦截部分,如配置,每次请求前都会执行
|
||||
Vue.prototype.$u.http.interceptor.request = (config) => {
|
||||
if (config.header.needToken) {
|
||||
// 获取用户token
|
||||
const userToken = db.get("userToken");
|
||||
if (!userToken) {
|
||||
console.log("开启弹窗");
|
||||
Vue.prototype.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
} else {
|
||||
config.header.Authorization = 'Bearer ' + userToken;
|
||||
}
|
||||
}
|
||||
//额外需求
|
||||
if (config.header.method == 'user.share') {
|
||||
const userToken = db.get("userToken");
|
||||
config.header.Authorization = 'Bearer ' + userToken;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
// 响应拦截,如配置,每次请求结束都会执行本方法
|
||||
Vue.prototype.$u.http.interceptor.response = (result) => {
|
||||
let pages = getCurrentPages();
|
||||
var page = pages[pages.length - 1];
|
||||
|
||||
if (!result.status && page) {
|
||||
//console.log(page.route);
|
||||
// 登录信息过期或者未登录
|
||||
if (result.data === 14007 || result.data === 14006) {
|
||||
// #ifdef H5 || APP-PLUS || APP-PLUS-NVUE
|
||||
if (page.route.indexOf('pages/login/loginBySMS/loginBySMS') < 0) {
|
||||
db.del("userToken");
|
||||
uni.showToast({
|
||||
title: result.msg,
|
||||
icon: 'none',
|
||||
duration: 1000,
|
||||
complete: function () {
|
||||
setTimeout(function () {
|
||||
uni.hideToast();
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/loginBySMS/loginBySMS'
|
||||
});
|
||||
},
|
||||
1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN || MP-ALIPAY || MP-TOUTIAO
|
||||
db.del("userToken");
|
||||
console.log("开启登录弹窗");
|
||||
//Vue.prototype.$store.commit('showLoginTip', true);
|
||||
Vue.prototype.$store.commit('hasLogin', false);
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
// res为服务端返回值,可能有code,result等字段
|
||||
// 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
|
||||
// 如果配置了originalData为true,请留意这里的返回值
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
install
|
||||
}
|
||||
@@ -7,9 +7,9 @@ module.exports = (vm) => {
|
||||
uni.$u.http.setConfig((defaultConfig) => {
|
||||
/* defaultConfig 为默认全局配置 */
|
||||
defaultConfig.baseURL = apiBaseUrl; /* 根域名 */
|
||||
defaultConfig.header = {
|
||||
'Content-type': 'application/json'
|
||||
};
|
||||
//defaultConfig.header = {
|
||||
// 'Content-type': 'application/json'
|
||||
//};
|
||||
defaultConfig.method = 'POST';
|
||||
defaultConfig.dataType = 'json';
|
||||
// #ifndef MP-ALIPAY
|
||||
|
||||
@@ -63,7 +63,11 @@
|
||||
</view>
|
||||
<!--服务协议-->
|
||||
<view class="coreshop-margin-top-15 coreshop-margin-bottom-30 agreement-checked-view">
|
||||
<u-checkbox v-model="agreement" @change="checkboxChange" size="30" active-color="#19be6b"></u-checkbox>
|
||||
<u-checkbox-group>
|
||||
<u-checkbox v-model="agreement" :checked="agreement" @change="checkboxChange" size="20" active-color="#19be6b"></u-checkbox>
|
||||
</u-checkbox-group>
|
||||
|
||||
|
||||
<view class="coreshop-text-black-view">
|
||||
<text class="coreshop-text-black">同意</text>
|
||||
<text class="text-blue" @tap="goUserAgreementPage">《服务协议》</text>
|
||||
@@ -77,7 +81,7 @@
|
||||
<u-button @click="closeAuth">暂不授权</u-button>
|
||||
</view>
|
||||
<view class="coreshop-padding-5">
|
||||
<u-button type="success" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">确定授权</u-button>
|
||||
<u-button type="success" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" :disabled="isDisabled">确定授权</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -100,6 +104,7 @@
|
||||
data() {
|
||||
return {
|
||||
agreement: true,
|
||||
isDisabled: false,
|
||||
maxMobile: 11,
|
||||
mobile: '', // 用户手机号
|
||||
code: '', // 短信验证码
|
||||
@@ -363,7 +368,13 @@
|
||||
},
|
||||
// 勾选版权协议
|
||||
checkboxChange(e) {
|
||||
this.agreement = e.value;
|
||||
this.agreement = e;
|
||||
if (e == true) {
|
||||
this.isDisabled = false;
|
||||
} else {
|
||||
this.isDisabled = true;
|
||||
}
|
||||
console.log(this.agreement);
|
||||
},
|
||||
// 隐藏登录弹窗
|
||||
hideModal() {
|
||||
@@ -425,23 +436,31 @@
|
||||
})
|
||||
},
|
||||
async getPhoneNumber(e) {
|
||||
let _this = this;
|
||||
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
|
||||
var data = {
|
||||
sessionAuthId: _this.sessionAuthIdTool,
|
||||
iv: e.mp.detail.iv,
|
||||
encryptedData: e.mp.detail.encryptedData,
|
||||
}
|
||||
//有推荐码的话,带上
|
||||
var invitecode = _this.$db.get('invitecode')
|
||||
if (invitecode) {
|
||||
data.invitecode = invitecode
|
||||
}
|
||||
_this.toGetPhoneNumber(data);
|
||||
console.log(e);
|
||||
console.log(this.isDisabled);
|
||||
if (this.isDisabled == false) {
|
||||
this.$refs.uToast.show({ message: '请先勾选并同意服务', type: 'error', })
|
||||
return false;
|
||||
} else {
|
||||
_this.$u.toast('如未授权,您可尝试使用手机号+短信验证码登录');
|
||||
let _this = this;
|
||||
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
|
||||
var data = {
|
||||
sessionAuthId: _this.sessionAuthIdTool,
|
||||
iv: e.mp.detail.iv,
|
||||
encryptedData: e.mp.detail.encryptedData,
|
||||
}
|
||||
//有推荐码的话,带上
|
||||
var invitecode = _this.$db.get('invitecode')
|
||||
if (invitecode) {
|
||||
data.invitecode = invitecode
|
||||
}
|
||||
_this.toGetPhoneNumber(data);
|
||||
} else {
|
||||
_this.$u.toast('如未授权,您可尝试使用手机号+短信验证码登录');
|
||||
}
|
||||
_this.showLogin = false;
|
||||
}
|
||||
_this.showLogin = false;
|
||||
|
||||
},
|
||||
//实际的去登陆
|
||||
toGetPhoneNumber: function (data) {
|
||||
|
||||
@@ -42,8 +42,10 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-margin-top-10 coreshop-margin-bottom-10 coreshop-common-view-box" v-else>
|
||||
<view class="coreshop-bg-white coreshop-card address-view coreshop-text-center coreshop-padding-bottom-30">
|
||||
<u-button type="error" size="mini" @click="goAddress()">添加收货地址</u-button>
|
||||
<view class="coreshop-bg-white coreshop-card address-view coreshop-text-center coreshop-padding-bottom-30 coreshop-flex coreshop-justify-center">
|
||||
<view class="coreshop-width-fit-content">
|
||||
<u-button type="error" size="mini" @click="goAddress()">添加收货地址</u-button>
|
||||
</view>
|
||||
<view class="address-line" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user