合并代码

This commit is contained in:
sx 2024-12-31 17:07:01 +08:00
parent 22212de146
commit 23b691c539
7 changed files with 60 additions and 46 deletions

View File

@ -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,
})

View File

@ -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=",
// 上传视频二级路径

View File

@ -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 : ""

View File

@ -205,7 +205,7 @@
//
.content {
.style1 {
color: #FF8400;
// color: #FF8400;
//
.label {

View File

@ -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 @@
<text>置换1颗{{item.durianName}}</text>
</view>
<view class="button fmid mlr40 wh110 c333 f20 bfff cir" @click="openExchange(item)">置换</view>
<view class="button fmid mlr40 wh110 c333 f24 bfff cir" @click="openExchange(item)">置换</view>
</view>
</view>
@ -165,7 +177,7 @@
<image class="wh350" src="/static/tree.png" mode="aspectFit" />
<view class="title c333 f48">请选择置换方式</view>
<view class="btns fmid mtb40">
<!-- 1榴莲果兑换 2种子兑换 -->
<!-- 1榴莲果兑换 2种子兑换 -->
<view class="btn lg black w200" @click="exchange('2')">种子置换</view>
<view class="btn lg black w200" @click="exchange('1')">榴莲果置换</view>
</view>

View File

@ -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)
},
}

View File

@ -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,
},
}
}
});