Browse Source

调选股策略接口

dongqian/feature-20251022181325-deepmate简版
dongqian 4 weeks ago
parent
commit
8c67bea900
  1. 8
      .hbuilderx/launch.json
  2. 21
      App.vue
  3. 9
      api/deepExploration/deepExploration.js
  4. 27
      pages/deepExploration/deepExploration.vue
  5. 4
      utils/http.js

8
.hbuilderx/launch.json

@ -2,11 +2,13 @@
"version" : "1.0",
"configurations" : [
{
"customPlaygroundType" : "local",
"customPlaygroundType" : "device",
"packageName" : "io.dcloud.HBuilder",
"playground" : "custom",
"type" : "uni-app:app-android"
// "playground" : "standard",
// "type" : "uni-app:app-ios"
}
]
}
// "playground" : "standard",
// "type" : "uni-app:app-ios"

21
App.vue

@ -1,8 +1,25 @@
<script>
export default {
import { useDeviceStore } from './stores/modules/deviceInfo'
export default {
onLaunch: function() {
console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
console.log('App Launch')
//
// const deviceStore = useDeviceStore()
// try {
// const sys = uni.getSystemInfoSync()
// let deviceId = ''
// // #ifdef APP-PLUS
// try { deviceId = plus?.device?.uuid || '' } catch(e) {}
// // #endif
// if (!deviceId) deviceId = uni.getStorageSync('device_id')
// if (!deviceId) {
// deviceId = `web_${Date.now()}_${Math.random().toString(36).slice(2,10)}`
// uni.setStorageSync('device_id', deviceId)
// }
// deviceStore.setDeviceInfo({ deviceId, platform: sys.platform, model: sys.model })
// console.log('Device init:', deviceStore.deviceInfo)
// } catch(e) { console.warn('Init device info failed:', e) }
},
onShow: function() {
console.log('App Show')
@ -10,7 +27,7 @@
onHide: function() {
console.log('App Hide')
}
}
}
</script>
<style lang="scss">

9
api/deepExploration/deepExploration.js

@ -19,5 +19,12 @@ export const RecordListApi = (data) => {
data:data
})
}
// 选股策略
export const stocSelectApi = (data) => {
return http({
method: 'POST',
url: '/api/deep/getStrategy',
data:data
})
}

27
pages/deepExploration/deepExploration.vue

@ -114,6 +114,7 @@
} from 'vue'
import footerBar from '@/components/footerBar.vue'
import deepExploration_header from '@/components/deepExploration_header.vue'
import { stocSelectApi } from '@/api/deepExploration/deepExploration.js'
const type = ref('deepExploration')
const iSMT = ref(0)
@ -172,9 +173,35 @@
select: "$13.180"
}
];
//
const loadStockSelection = async () => {
try {
const res = await stocSelectApi({
language: 'cn'
})
console.log('选股策略接口响应:', res)
const list = Array.isArray(res?.data?.list) ? res.data.list : (Array.isArray(res?.data) ? res.data : [])
if (Array.isArray(list) && list.length) {
stockData.value = list.map(item => ({
name: item.name || item.stockName || item.code || '',
close: item.close || item.lastClose || item.closePrice || '',
select: item.select || item.selectPrice || item.price || ''
}))
} else {
console.warn('选股策略接口返回空列表或结构不匹配')
}
} catch (e) {
console.error('选股策略接口调用失败', e)
uni.showToast({ title: '选股策略加载失败', icon: 'none' })
}
}
onMounted(() => {
//
iSMT.value = uni.getSystemInfoSync().statusBarHeight;
//
loadStockSelection()
})
</script>

4
utils/http.js

@ -43,8 +43,8 @@ const httpInterceptor = {
}
//4 添加token,优先用store,没有则回退到body中的token,保持与Apifox一致
const memberStore = useUserStore()
const token = memberStore.userInfo?.token || options.data?.token
// const token = '1b3a58424c5324e40d4bf4d085e18047'
// const token = memberStore.userInfo?.token || options.data?.token
const token = '1b3a58424c5324e40d4bf4d085e18047'
if (token) {
options.header.token = token
}

Loading…
Cancel
Save