Commit 122875ea authored by jtwu's avatar jtwu

敏感字问题修改

parent c105c1a3
...@@ -49,18 +49,21 @@ const request = (options = {}) => { ...@@ -49,18 +49,21 @@ const request = (options = {}) => {
icon: 'none' icon: 'none'
}); });
reject(data); reject(data);
globalStore.setIsShowLoading(false);
} else if (!data.data?.ok) { } else if (!data.data?.ok) {
uni.showToast({ uni.showToast({
title: data.data?.message, title: data.data?.message,
icon: 'none' icon: 'none'
}); });
reject(data.data); reject(data.data);
globalStore.setIsShowLoading(false);
} else { } else {
resolve(data.data); resolve(data.data);
} }
}) })
.catch((error) => { .catch((error) => {
reject(error); reject(error);
globalStore.setIsShowLoading(false);
}); });
}); });
}; };
......
...@@ -246,7 +246,8 @@ ...@@ -246,7 +246,8 @@
@click="onNaming"> @click="onNaming">
</view> </view>
</view> </view>
<CustomLoading :show="showLoading" :text="'起名中...'" :imgPath="$baseUrl+'aiNaming/loading_icon.png'"> <CustomLoading :show="globalStore.isShowLoading" :text="'起名中...'"
:imgPath="$baseUrl+'aiNaming/loading_icon.png'">
</CustomLoading> </CustomLoading>
</view> </view>
</template> </template>
...@@ -273,8 +274,12 @@ ...@@ -273,8 +274,12 @@
aiNaming aiNaming
} from '../../api/naming.js'; } from '../../api/naming.js';
import CustomLoading from '../../components/CustomLoading.vue'; import CustomLoading from '../../components/CustomLoading.vue';
import {
useGlobalStore
} from "@/stores/global.js";
const globalStore = useGlobalStore();
const showLoading = ref(false)
// 出生状态 // 出生状态
const birthStatus = ref(''); const birthStatus = ref('');
//姓氏 //姓氏
...@@ -487,11 +492,11 @@ ...@@ -487,11 +492,11 @@
// title: '生成中...', // title: '生成中...',
// mask: true // 是否显示透明蒙层(防止触摸穿透) // mask: true // 是否显示透明蒙层(防止触摸穿透)
// }) // })
showLoading.value = true; globalStore.setIsShowLoading(true);
let d = await aiNaming(param); let d = await aiNaming(param);
// 隐藏 // 隐藏
// uni.hideLoading() // uni.hideLoading()
showLoading.value = false; globalStore.setIsShowLoading(false);
if (d) { if (d) {
let nameList = d?.data; let nameList = d?.data;
console.log('取名回调:', nameList) console.log('取名回调:', nameList)
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</view> </view>
</view> </view>
<CustomLoading :show="showLoading" :text="'起名中...'" :imgPath="$baseUrl+'aiNaming/loading_icon.png'"> <CustomLoading :show="globalStore.isShowLoading" :text="'起名中...'" :imgPath="$baseUrl+'aiNaming/loading_icon.png'">
</CustomLoading> </CustomLoading>
</view> </view>
</template> </template>
...@@ -71,7 +71,12 @@ ...@@ -71,7 +71,12 @@
import { import {
onLoad onLoad
} from '@dcloudio/uni-app' } 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 { const {
proxy proxy
...@@ -81,7 +86,6 @@ ...@@ -81,7 +86,6 @@
const param = ref(); const param = ref();
const nameList = ref(null); const nameList = ref(null);
const showLoading = ref(false)
onLoad((options) => { onLoad((options) => {
param.value = JSON.parse(decodeURIComponent(options.param)) param.value = JSON.parse(decodeURIComponent(options.param))
...@@ -99,10 +103,10 @@ ...@@ -99,10 +103,10 @@
// title: '生成中...', // title: '生成中...',
// mask: true // 是否显示透明蒙层(防止触摸穿透) // mask: true // 是否显示透明蒙层(防止触摸穿透)
// }) // })
showLoading.value = true; globalStore.setIsShowLoading(true);
let d = await aiNaming(param.value); let d = await aiNaming(param.value);
// uni.hideLoading(); // uni.hideLoading();
showLoading.value = false; globalStore.setIsShowLoading(false);
if (d) { if (d) {
nameList.value = d?.data; nameList.value = d?.data;
console.log('重新生成:', nameList.value) console.log('重新生成:', nameList.value)
......
...@@ -9,6 +9,8 @@ export const useGlobalStore = defineStore('global', { ...@@ -9,6 +9,8 @@ export const useGlobalStore = defineStore('global', {
return { return {
cuk: cuk, // 用户登录后获取的凭证,调用接口时headers中携带 cuk: cuk, // 用户登录后获取的凭证,调用接口时headers中携带
curTabIndex: 0, // 当前Tab索引 curTabIndex: 0, // 当前Tab索引
isWxFriendCircle:false,
isShowLoading: false
}; };
}, },
actions: { actions: {
...@@ -26,6 +28,19 @@ export const useGlobalStore = defineStore('global', { ...@@ -26,6 +28,19 @@ export const useGlobalStore = defineStore('global', {
*/ */
setCurTabIndex(index) { setCurTabIndex(index) {
this.curTabIndex = index; this.curTabIndex = index;
},
/**
* 设置当前是否是小程序朋友圈单页环境
* @param {boolean} v
*/
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