去除token

This commit is contained in:
2025-05-13 17:26:48 +08:00
parent 8452fb9479
commit 53fbee0ca9
4 changed files with 47 additions and 22 deletions

View File

@ -55,10 +55,6 @@
value: { value: {
type: Boolean, type: Boolean,
required: true required: true
},
token: {
type: String,
default: ''
} }
}, },
data() { data() {
@ -79,7 +75,7 @@
mask: true, mask: true,
}); });
uploadFile(avatarUrl, this.token).then((res) => { uploadFile(avatarUrl).then((res) => {
uni.hideLoading(); uni.hideLoading();
this.avatar = res.url; this.avatar = res.url;
}).catch(() => { }).catch(() => {

View File

@ -42,7 +42,7 @@
</view> </view>
</view> </view>
<mplogin v-model="mpLoginPopup" :token="token" @close="mpLoginPopup = false" @update="handleSubmitInfo"/> <mplogin v-model="mpLoginPopup" @close="mpLoginPopup = false" @update="handleSubmitInfo"/>
<mobile-login v-model="mobilePopup" @close="mobilePopup = false" @update="handleSubmitMobile"/> <mobile-login v-model="mobilePopup" @close="mobilePopup = false" @update="handleSubmitMobile"/>
</view> </view>
</template> </template>
@ -69,8 +69,7 @@
}, },
loginData: {}, loginData: {},
mpLoginPopup: false, mpLoginPopup: false,
mobilePopup: false, mobilePopup: false
token: ''
} }
}, },
@ -110,10 +109,7 @@
if (code == 1) { if (code == 1) {
if (data.is_new_user) { if (data.is_new_user) {
uni.hideLoading() uni.hideLoading()
this.token = data.token this.mpLoginPopup = true
this.$nextTick(() => {
this.mpLoginPopup = true
})
this.loginData = data this.loginData = data
} else { } else {
this.loginHandle(data) this.loginHandle(data)

View File

@ -199,6 +199,8 @@
<script> <script>
import { orderBuy, getOrderCoupon, getDelivery } from '@/api/order' import { orderBuy, getOrderCoupon, getDelivery } from '@/api/order'
import { prepay, getPayway } from '@/api/app'
import { wxpay, alipay } from '@/utils/pay'
export default { export default {
data() { data() {
return { return {
@ -250,8 +252,18 @@ export default {
this.pay.alipay = 1 this.pay.alipay = 1
//#endif //#endif
// 配送方式 this.initDelivery()
getDelivery() },
onUnload() {
// 取消全局监听
uni.$off(['selectaddress', 'store'])
},
methods: {
// 初始化配送方式
initDelivery(){
getDelivery()
.then(({ code, data, msg }) => { .then(({ code, data, msg }) => {
// 请求结果判断 // 请求结果判断
if (code != 1) throw new Error(msg) if (code != 1) throw new Error(msg)
@ -306,14 +318,13 @@ export default {
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
}) })
}, },
onUnload() { // 初始化支付方式
// 取消全局监听 initPay() {
uni.$off(['selectaddress', 'store'])
}, },
methods: {
appointmentTime() { appointmentTime() {
this.timePopup = true this.timePopup = true
}, },
@ -422,7 +433,29 @@ export default {
}) })
}, },
// 订单提交
async handleOrderSubmit(from) {
this.showLoading = true
from.remark = this.userRemark
try {
const { code, data, msg } = await orderBuy(from)
if (code == 1) {
uni.redirectTo({
url: `/pages/payment/payment?from=${data.type}&order_id=${data.order_id}`
})
} else {
throw new Error(msg)
}
} catch (err) {
console.log(err)
// this.$toast({ title: '下单异常,请重新操作' })
} finally {
this.showLoading = false
}
},
// 订单处理 // 订单处理
// handleOrderMethods(action) { // handleOrderMethods(action) {

View File

@ -269,14 +269,14 @@ export function menuJump(item) {
} }
} }
export function uploadFile(path, token = '') { export function uploadFile(path) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
url: `${baseURL}/api/file/formimage`, url: `${baseURL}/api/file/formimage`,
filePath: path, filePath: path,
name: "file", name: "file",
header: { header: {
token: store.getters.token || token, token: store.getters.token,
}, },
fileType: "image", fileType: "image",
cloudPath: "", cloudPath: "",