From 23b691c539ad551c0ae1304f646185e24e762082 Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Tue, 31 Dec 2024 17:07:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiuyi2/api/durian.js | 4 ++-- jiuyi2/common/js/config.js | 6 +---- jiuyi2/common/js/util.js | 5 +--- jiuyi2/pages/index/myTeam.vue | 2 +- jiuyi2/pages/index/orchard.vue | 28 +++++++++++++++------- jiuyi2/store/index.js | 18 ++++++++++---- jiuyi2/vite.config.js | 43 +++++++++++++++++----------------- 7 files changed, 60 insertions(+), 46 deletions(-) diff --git a/jiuyi2/api/durian.js b/jiuyi2/api/durian.js index e2f5fadb..9c37ecb3 100644 --- a/jiuyi2/api/durian.js +++ b/jiuyi2/api/durian.js @@ -9,7 +9,7 @@ export const durian = { */ durianList(param) { return util.request({ - url: `/duriantreeinfo/tree-list`, + url: `/coreplay/duriantreeinfo/tree-list`, method: 'GET', query: param.query, }) @@ -43,7 +43,7 @@ export const durian = { exchange(param) { return util.request({ url: `/app/durian/exchange`, - method: 'post', + method: 'POST', data: param.data, load: true, }) diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index a46f16db..81e94794 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -1,11 +1,7 @@ // 配置 const config = { // 接口域名 - // host: 'http://1.94.221.165:8101', - // host: 'http://192.168.1.241', - // host: '/duriantreeinfo', - host: '/user', - // host: 'http://192.168.1.236:8080', + host: 'http://localhost:5173', // 上传文件二级路径 uploadFilePath: "/homecommon/file/preview?fileName=", // 上传视频二级路径 diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index 1b7214ac..2e12a72c 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -91,10 +91,7 @@ const util = { // 默认token let token = uni.getStorageSync('token') || '' // 接口地址 - obj.url = obj.url ? obj.url : api[{ - img: 'uploadImg', - video: 'uploadVideo', - } [obj.mode]] + obj.url = obj.url ? obj.url : '/file/upload' console.log('obj.url', obj.url) // 文件 obj.file = obj.file ? obj.file : "" diff --git a/jiuyi2/pages/index/myTeam.vue b/jiuyi2/pages/index/myTeam.vue index 5bced901..c20ec567 100644 --- a/jiuyi2/pages/index/myTeam.vue +++ b/jiuyi2/pages/index/myTeam.vue @@ -205,7 +205,7 @@ // 内容 .content { .style1 { - color: #FF8400; + // color: #FF8400; // 商家标签 .label { diff --git a/jiuyi2/pages/index/orchard.vue b/jiuyi2/pages/index/orchard.vue index bd7fe9c1..0630817a 100644 --- a/jiuyi2/pages/index/orchard.vue +++ b/jiuyi2/pages/index/orchard.vue @@ -29,12 +29,13 @@ const { proxy } = getCurrentInstance() + const store = useStore() + // 榴莲果树列表 const viewData = ref([]) // 当前选择的榴莲果树对象 const selectItem = ref({}) // 规则文章 const rule = reactive({}) - const store = useStore() const userinfo = computed(() => { let result = store.state.userinfo return result @@ -44,7 +45,7 @@ // 获取可以兑换的榴莲果树 buyDurianList() // 获取榴莲果规则文章 - getArticle() + // getArticle() }) onReady(() => { @@ -65,15 +66,25 @@ * @param {Object} type 1榴莲果兑换 2种子兑换 */ function exchange(type) { + const config = { + '1': { + price: selectItem.value.fruitNeed, + name: '榴莲果', + }, + '2': { + price: selectItem.value.seedNeed, + name: '种子', + }, + } [type] util.alert({ - content: `确认消耗${800}种子购买榴莲果`, + content: `确认消耗${config.price}${config.name}购买榴莲果`, }).then(rs => { if (!rs.confirm) return durianlApi.exchange({ data: { - userId: userinfo.value.userId, - treeId: selectItem.value.id, + // userId: userinfo.value.userId, + DurianConfigId: selectItem.value.id, type: type }, }).then(rs => { @@ -83,9 +94,10 @@ util.getUserinfo() return } + util.alert({ content: rs.msg, - value: false, + showCancel: false, }) }) }) @@ -151,7 +163,7 @@ 置换1颗{{item.durianName}} - 置换 + 置换 @@ -165,7 +177,7 @@ 请选择置换方式 - + 种子置换 榴莲果置换 diff --git a/jiuyi2/store/index.js b/jiuyi2/store/index.js index 5594e200..90bb9179 100644 --- a/jiuyi2/store/index.js +++ b/jiuyi2/store/index.js @@ -1,4 +1,6 @@ -import { createStore } from 'vuex' +import { + createStore +} from 'vuex' export default createStore({ state: { @@ -8,6 +10,8 @@ export default createStore({ tabbarMode: 'default', // 闹钟时间 alarmTime: '', + // 资产 + property: {}, }, mutations: { @@ -22,8 +26,8 @@ export default createStore({ state[key] = value }, // 设置用户信息 - setUserInfo(state, payload) { - state.userinfo = payload + setUserInfo(state, value) { + state.userinfo = value }, // 设置 tabbar 模式 setTabbarMode(state, mode) { @@ -41,10 +45,14 @@ export default createStore({ }, actions: { - updateUserInfo({ commit }, payload) { + updateUserInfo({ + commit + }, payload) { commit('setUserInfo', payload) }, - changeTabbarMode({ commit }, mode) { + changeTabbarMode({ + commit + }, mode) { commit('setTabbarMode', mode) }, } diff --git a/jiuyi2/vite.config.js b/jiuyi2/vite.config.js index dfb5a84d..a4476d7c 100644 --- a/jiuyi2/vite.config.js +++ b/jiuyi2/vite.config.js @@ -4,26 +4,27 @@ import { import uni from '@dcloudio/vite-plugin-uni'; export default defineConfig({ - plugins: [uni()], - server: { - host: "localhost", - port: 5173, - proxy: { - "/shopify": { - target: "https://3w823u8516.vicp.fun/shopify", - changeOrigin: true, - rewrite: (path) => path.replace(/^\/shopify/, ""), - }, - "/user": { - target: "http://192.168.1.236:8080", - changeOrigin: true, - rewrite: (path) => path.replace(/^\/user/, ""), - }, - "/duriantreeinfo": { - target: "http://192.168.1.241:9400", - changeOrigin: true, - rewrite: (path) => path.replace(/^\/duriantreeinfo/, ""), - }, - } + plugins: [uni()], + server: { + host: "localhost", + port: 5173, + proxy: { + "/shopify": { + target: "https://3w823u8516.vicp.fun", + changeOrigin: true, + }, + "/user": { + target: "http://192.168.1.236:8080", + changeOrigin: true, + }, + "/coreplay": { + target: "http://192.168.1.241:9400", + changeOrigin: true, + }, + "/file": { + target: "http://192.168.1.241:8080", + changeOrigin: true, + }, } + } }); \ No newline at end of file