config/index.js 区分 dev prod,fixed store.js userpage.js 等
This commit is contained in:
1 parent
ea2267598b
commit
883919244f
8 files changed
+44
-23
No files matched your search
@@ -39,3 +39,6 @@ dev-stats.json
|
||||
.vscode
|
||||
|
||||
.history
|
||||
.cursor/
|
||||
#忽略openspec目录
|
||||
openspec/
|
||||
@@ -17,6 +17,7 @@ import { isWeixin } from '@/utils/util'
|
||||
import { VUE_APP_API_URL } from '@/config'
|
||||
import cookie from '@/utils/cookie'
|
||||
import { replace } from '@/utils/router'
|
||||
import { logger } from '@/utils/logger'
|
||||
|
||||
const fly = new Fly()
|
||||
fly.config.baseURL = VUE_APP_API_URL
|
||||
@@ -51,7 +52,7 @@ const defaultOpt = { login: true }
|
||||
|
||||
function baseRequest(options) {
|
||||
const token = cookie.get('accessToken')
|
||||
console.log('--> % token % token:\n', token)
|
||||
logger.debug('[api] request token present:', !!token)
|
||||
|
||||
options.headers = {
|
||||
...options.headers,
|
||||
@@ -81,7 +82,7 @@ function baseRequest(options) {
|
||||
if (res.data.code == 1004004002) {
|
||||
if(isWeixin()){
|
||||
const url = cookie.get('index_url')
|
||||
console.log('redirect_uri:',url)
|
||||
logger.debug('[api] redirect_uri:', url)
|
||||
//const url = `${location.origin}/h5/#/pages/index/index`
|
||||
location.href = url
|
||||
return
|
||||
@@ -144,7 +145,7 @@ const request = ['post', 'put', 'patch'].reduce((request, method) => {
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
request[method] = (url, data = {}, options = {}) => {
|
||||
console.log(url, data)
|
||||
logger.debug('[api]', method.toUpperCase(), url, data)
|
||||
return baseRequest(Object.assign({ url, data, method }, defaultOpt, options))
|
||||
}
|
||||
return request
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
export const VUE_APP_API_URL = 'http://localhost:48081/app-api'
|
||||
//export const VUE_APP_API_URL = 'https://apidc.yixiang.co/app-api'
|
||||
const DEV_API_URL = 'http://localhost:48081/app-api'
|
||||
const PROD_API_URL = 'https://apidc.yixiang.co/app-api'
|
||||
|
||||
// #ifdef APP-PLUS || H5 || MP-WEIXIN
|
||||
export const VUE_APP_API_URL =
|
||||
process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL
|
||||
// #endif
|
||||
|
||||
export const VUE_APP_RESOURCES_URL = 'https://h5.yixiang.co/static'
|
||||
export const VUE_APP_UPLOAD_URL = VUE_APP_API_URL + '/infra/file/upload'
|
||||
export const APP_ID = 'wxdbdbc123c8c30b45'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// mouse.js
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { onReady, onReachBottom } from '@dcloudio/uni-app'
|
||||
|
||||
export const usePage = getPage => {
|
||||
@@ -33,8 +33,6 @@ export const usePage = getPage => {
|
||||
const dataList = ref([])
|
||||
|
||||
const handleGetDataList = async () => {
|
||||
console.log('--> % handleGetDataList % loading:\n', loading.value)
|
||||
console.log('--> % handleGetDataList % loadend:\n', loadend.value)
|
||||
if (loading.value || loadend.value) return
|
||||
|
||||
loading.value = true
|
||||
@@ -47,7 +45,6 @@ export const usePage = getPage => {
|
||||
news: news.value,
|
||||
isIntegral: isIntegral.value,
|
||||
})
|
||||
console.log('--> % handleGetDataList % products:\n', products)
|
||||
if (products) {
|
||||
if (products.length <= 0) {
|
||||
loadend.value = true
|
||||
@@ -65,13 +62,13 @@ export const usePage = getPage => {
|
||||
}
|
||||
|
||||
onReady(() => {
|
||||
console.log('onReady')
|
||||
// handleGetDataList()
|
||||
})
|
||||
|
||||
onReachBottom(() => {
|
||||
if (loading.value) return
|
||||
if (loading.value || loadend.value) return
|
||||
page.value += 1
|
||||
handleGetDataList()
|
||||
})
|
||||
|
||||
// 通过返回值暴露所管理的状态
|
||||
|
||||
@@ -10,13 +10,9 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@vant/area-data": "^1.5.0",
|
||||
"add": "^2.0.6",
|
||||
"flyio": "^0.6.14",
|
||||
"jweixin-module": "^1.6.0",
|
||||
"openai": "^6.38.0",
|
||||
"pinia": "^2.1.6",
|
||||
"vant": "^4.6.2",
|
||||
"weixin-js-sdk": "^1.6.3",
|
||||
"yarn": "^1.22.19"
|
||||
"weixin-js-sdk": "^1.6.3"
|
||||
}
|
||||
}
|
||||
@@ -806,14 +806,14 @@ $menu-divider-height: 2rpx;
|
||||
@mixin quantity-control($size) {
|
||||
.btn,
|
||||
.number {
|
||||
width: $size;
|
||||
height: $size;
|
||||
//width: $size;
|
||||
//height: $size;
|
||||
line-height: $size;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 0;
|
||||
//padding: 0;
|
||||
border-radius: $border-radius-circle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,10 +92,11 @@ export const useMainStore = defineStore('main', {
|
||||
return null
|
||||
},
|
||||
logout() {
|
||||
this.user = null
|
||||
this.address = []
|
||||
this.areaList = []
|
||||
this.selectAddress = null
|
||||
this.member = {}
|
||||
this.cart = []
|
||||
this.token = ''
|
||||
cookie.remove('accessToken')
|
||||
cookie.remove('userinfo')
|
||||
navigateTo('/pages/login/login')
|
||||
},
|
||||
},
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
export const IS_DEV = process.env.NODE_ENV !== 'production'
|
||||
|
||||
const noop = () => {}
|
||||
|
||||
function createLogMethod(method) {
|
||||
if (IS_DEV) {
|
||||
return (...args) => console[method](...args)
|
||||
}
|
||||
return noop
|
||||
}
|
||||
|
||||
export const logger = {
|
||||
debug: createLogMethod('log'),
|
||||
info: createLogMethod('info'),
|
||||
warn: createLogMethod('warn'),
|
||||
error: createLogMethod('error'),
|
||||
}
|
||||
Reference in new issue
Block a user