Commit 56627079 authored by jtwu's avatar jtwu

Merge branch 'dev_ck'

# Conflicts:
#	stores/global.js
parents 8a342fa9 122875ea
......@@ -47,18 +47,21 @@ const request = (options = {}) => {
icon: 'none'
});
reject(data);
globalStore.setIsShowLoading(false);
} else if (!data.data?.ok) {
uni.showToast({
title: data.data?.message,
icon: 'none'
});
reject(data.data);
globalStore.setIsShowLoading(false);
} else {
resolve(data.data);
}
})
.catch((error) => {
reject(error);
globalStore.setIsShowLoading(false);
});
});
};
......
......@@ -246,7 +246,8 @@
@click="onNaming">
</view>
</view>
<CustomLoading :show="showLoading" :text="'起名中...'" :imgPath="$baseUrl+'aiNaming/loading_icon.png'">
<CustomLoading :show="globalStore.isShowLoading" :text="'起名中...'"
:imgPath="$baseUrl+'aiNaming/loading_icon.png'">
</CustomLoading>
</view>
</template>
......@@ -273,8 +274,12 @@
aiNaming
} from '../../api/naming.js';
import CustomLoading from '../../components/CustomLoading.vue';
import {
useGlobalStore
} from "@/stores/global.js";
const globalStore = useGlobalStore();
const showLoading = ref(false)
// 出生状态
const birthStatus = ref('');
//姓氏
......@@ -487,11 +492,11 @@
// title: '生成中...',
// mask: true // 是否显示透明蒙层(防止触摸穿透)
// })
showLoading.value = true;
globalStore.setIsShowLoading(true);
let d = await aiNaming(param);
// 隐藏
// uni.hideLoading()
showLoading.value = false;
globalStore.setIsShowLoading(false);
if (d) {
let nameList = d?.data;
console.log('取名回调:', nameList)
......
......@@ -48,7 +48,7 @@
</view>
</view>
<CustomLoading :show="showLoading" :text="'起名中...'" :imgPath="$baseUrl+'aiNaming/loading_icon.png'">
<CustomLoading :show="globalStore.isShowLoading" :text="'起名中...'" :imgPath="$baseUrl+'aiNaming/loading_icon.png'">
</CustomLoading>
</view>
</template>
......@@ -71,7 +71,12 @@
import {
onLoad
} from '@dcloudio/uni-app'
import CustomLoading from '../../components/CustomLoading.vue';
import CustomLoading from '../../components/CustomLoading.vue';
import {
useGlobalStore
} from "@/stores/global.js";
const globalStore = useGlobalStore();
const {
proxy
......@@ -81,7 +86,6 @@
const param = ref();
const nameList = ref(null);
const showLoading = ref(false)
onLoad((options) => {
param.value = JSON.parse(decodeURIComponent(options.param))
......@@ -99,10 +103,10 @@
// title: '生成中...',
// mask: true // 是否显示透明蒙层(防止触摸穿透)
// })
showLoading.value = true;
globalStore.setIsShowLoading(true);
let d = await aiNaming(param.value);
// uni.hideLoading();
showLoading.value = false;
globalStore.setIsShowLoading(false);
if (d) {
nameList.value = d?.data;
console.log('重新生成:', nameList.value)
......
......@@ -9,7 +9,8 @@ export const useGlobalStore = defineStore('global', {
return {
cuk: cuk, // 用户登录后获取的凭证,调用接口时headers中携带
curTabIndex: 0, // 当前Tab索引
isWxFriendCircle:false
isWxFriendCircle:false,
isShowLoading: false
};
},
actions: {
......@@ -35,7 +36,10 @@ export const useGlobalStore = defineStore('global', {
*/
setIsWxFriendCircle(v){
this.isWxFriendCircle = v
},
setIsShowLoading(v){
this.isShowLoading = v
}
},
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment