合并代码

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) { durianList(param) {
return util.request({ return util.request({
url: `/duriantreeinfo/tree-list`, url: `/coreplay/duriantreeinfo/tree-list`,
method: 'GET', method: 'GET',
query: param.query, query: param.query,
}) })
@ -43,7 +43,7 @@ export const durian = {
exchange(param) { exchange(param) {
return util.request({ return util.request({
url: `/app/durian/exchange`, url: `/app/durian/exchange`,
method: 'post', method: 'POST',
data: param.data, data: param.data,
load: true, load: true,
}) })

View File

@ -1,11 +1,7 @@
// 配置 // 配置
const config = { const config = {
// 接口域名 // 接口域名
// host: 'http://1.94.221.165:8101', host: 'http://localhost:5173',
// host: 'http://192.168.1.241',
// host: '/duriantreeinfo',
host: '/user',
// host: 'http://192.168.1.236:8080',
// 上传文件二级路径 // 上传文件二级路径
uploadFilePath: "/homecommon/file/preview?fileName=", uploadFilePath: "/homecommon/file/preview?fileName=",
// 上传视频二级路径 // 上传视频二级路径

View File

@ -91,10 +91,7 @@ const util = {
// 默认token // 默认token
let token = uni.getStorageSync('token') || '' let token = uni.getStorageSync('token') || ''
// 接口地址 // 接口地址
obj.url = obj.url ? obj.url : api[{ obj.url = obj.url ? obj.url : '/file/upload'
img: 'uploadImg',
video: 'uploadVideo',
} [obj.mode]]
console.log('obj.url', obj.url) console.log('obj.url', obj.url)
// 文件 // 文件
obj.file = obj.file ? obj.file : "" obj.file = obj.file ? obj.file : ""

View File

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

View File

@ -29,12 +29,13 @@
const { const {
proxy proxy
} = getCurrentInstance() } = getCurrentInstance()
const store = useStore()
//
const viewData = ref([]) const viewData = ref([])
// //
const selectItem = ref({}) const selectItem = ref({})
// //
const rule = reactive({}) const rule = reactive({})
const store = useStore()
const userinfo = computed(() => { const userinfo = computed(() => {
let result = store.state.userinfo let result = store.state.userinfo
return result return result
@ -44,7 +45,7 @@
// //
buyDurianList() buyDurianList()
// //
getArticle() // getArticle()
}) })
onReady(() => { onReady(() => {
@ -65,15 +66,25 @@
* @param {Object} type 1榴莲果兑换 2种子兑换 * @param {Object} type 1榴莲果兑换 2种子兑换
*/ */
function exchange(type) { function exchange(type) {
const config = {
'1': {
price: selectItem.value.fruitNeed,
name: '榴莲果',
},
'2': {
price: selectItem.value.seedNeed,
name: '种子',
},
} [type]
util.alert({ util.alert({
content: `确认消耗${800}种子购买榴莲果`, content: `确认消耗${config.price}${config.name}购买榴莲果`,
}).then(rs => { }).then(rs => {
if (!rs.confirm) return if (!rs.confirm) return
durianlApi.exchange({ durianlApi.exchange({
data: { data: {
userId: userinfo.value.userId, // userId: userinfo.value.userId,
treeId: selectItem.value.id, DurianConfigId: selectItem.value.id,
type: type type: type
}, },
}).then(rs => { }).then(rs => {
@ -83,9 +94,10 @@
util.getUserinfo() util.getUserinfo()
return return
} }
util.alert({ util.alert({
content: rs.msg, content: rs.msg,
value: false, showCancel: false,
}) })
}) })
}) })
@ -151,7 +163,7 @@
<text>置换1颗{{item.durianName}}</text> <text>置换1颗{{item.durianName}}</text>
</view> </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>
</view> </view>
@ -165,7 +177,7 @@
<image class="wh350" src="/static/tree.png" mode="aspectFit" /> <image class="wh350" src="/static/tree.png" mode="aspectFit" />
<view class="title c333 f48">请选择置换方式</view> <view class="title c333 f48">请选择置换方式</view>
<view class="btns fmid mtb40"> <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('2')">种子置换</view>
<view class="btn lg black w200" @click="exchange('1')">榴莲果置换</view> <view class="btn lg black w200" @click="exchange('1')">榴莲果置换</view>
</view> </view>

View File

@ -1,4 +1,6 @@
import { createStore } from 'vuex' import {
createStore
} from 'vuex'
export default createStore({ export default createStore({
state: { state: {
@ -8,6 +10,8 @@ export default createStore({
tabbarMode: 'default', tabbarMode: 'default',
// 闹钟时间 // 闹钟时间
alarmTime: '', alarmTime: '',
// 资产
property: {},
}, },
mutations: { mutations: {
@ -22,8 +26,8 @@ export default createStore({
state[key] = value state[key] = value
}, },
// 设置用户信息 // 设置用户信息
setUserInfo(state, payload) { setUserInfo(state, value) {
state.userinfo = payload state.userinfo = value
}, },
// 设置 tabbar 模式 // 设置 tabbar 模式
setTabbarMode(state, mode) { setTabbarMode(state, mode) {
@ -41,10 +45,14 @@ export default createStore({
}, },
actions: { actions: {
updateUserInfo({ commit }, payload) { updateUserInfo({
commit
}, payload) {
commit('setUserInfo', payload) commit('setUserInfo', payload)
}, },
changeTabbarMode({ commit }, mode) { changeTabbarMode({
commit
}, mode) {
commit('setTabbarMode', mode) commit('setTabbarMode', mode)
}, },
} }

View File

@ -4,26 +4,27 @@ import {
import uni from '@dcloudio/vite-plugin-uni'; import uni from '@dcloudio/vite-plugin-uni';
export default defineConfig({ export default defineConfig({
plugins: [uni()], plugins: [uni()],
server: { server: {
host: "localhost", host: "localhost",
port: 5173, port: 5173,
proxy: { proxy: {
"/shopify": { "/shopify": {
target: "https://3w823u8516.vicp.fun/shopify", target: "https://3w823u8516.vicp.fun",
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/shopify/, ""), },
}, "/user": {
"/user": { target: "http://192.168.1.236:8080",
target: "http://192.168.1.236:8080", changeOrigin: true,
changeOrigin: true, },
rewrite: (path) => path.replace(/^\/user/, ""), "/coreplay": {
}, target: "http://192.168.1.241:9400",
"/duriantreeinfo": { changeOrigin: true,
target: "http://192.168.1.241:9400", },
changeOrigin: true, "/file": {
rewrite: (path) => path.replace(/^\/duriantreeinfo/, ""), target: "http://192.168.1.241:8080",
}, changeOrigin: true,
} },
} }
}
}); });