diff --git a/src/http/apis.js b/src/http/apis.js index 164586bb..c3ad31e3 100644 --- a/src/http/apis.js +++ b/src/http/apis.js @@ -31,6 +31,18 @@ export const historicalTickets = (data) => { data }) } +export const sendCode = (data) => { + return uniReq.post({ + url: '/api/user/send/msg', + data + }) +} +export const reTicket = (data) => { + return uniReq.post({ + url: '/api/smart/appointment/book/ticket', + data + }) +} export const upload = (data) => { return uniReq.upload({ name: data.name, @@ -56,6 +68,7 @@ export const updateInfo = (data) => { export const extractingBlindBoxes= (data) => { return uniReq.post({ url: '/api/smart/appointment/draw/ticket/from/blind/box', - data + data, + isShowMsg:false, }) } diff --git a/src/http/init.js b/src/http/init.js index 116791fc..1a75ebfe 100644 --- a/src/http/init.js +++ b/src/http/init.js @@ -1,9 +1,12 @@ import {uniRequest} from "@/http/main"; const TEST_URL='http://172.16.100.93:9052' +const TY_URL='https://warehouse.szjixun.cn/ticket' +let configV const uniReq=uniRequest.created({ baseUrl: TEST_URL, interceptor: { request(config){ + configV=config config.header.Authorization=uni.getStorageSync('token')??'' if (config.isLoading){ uni.showLoading({ @@ -17,14 +20,19 @@ const uniReq=uniRequest.created({ return config }, response(response) { - uni.hideLoading() - if (response.data.code!==200){ - uni.showToast({ - title: response.data.msg, - icon: 'none', - duration: 50000 - }) + if (configV.isShowMsg){ + if (response.data.code!==200){ + uni.showToast({ + title: response.data.msg, + icon: 'none', + duration: 50000 + }) + } + } + if (configV.isLoading){ + uni.hideLoading() } + return response.data } } diff --git a/src/http/main.ts b/src/http/main.ts index feee0b10..3817d1c8 100644 --- a/src/http/main.ts +++ b/src/http/main.ts @@ -17,6 +17,7 @@ interface RequestOptions { baseUrl?: string; url?: string; isLoading?: boolean; + isShowMsg?: boolean; data?: Record; method?: HttpMethod; header?: Record; @@ -67,11 +68,13 @@ type ResponseInterceptor = (response: any) => any; class uniRequest { baseUrl?: string; isLoading: boolean; + isShowMsg: boolean; defaultHeader: Record; interceptors: { request?: RequestInterceptor; response?: ResponseInterceptor }; constructor(request: RequestOptions) { this.isLoading= request.isLoading??true + this.isShowMsg= request.isShowMsg??true this.baseUrl = request.baseUrl; this.defaultHeader = { "Content-Type": "application/json;charset=UTF-8", @@ -94,6 +97,7 @@ class uniRequest { options = this.buildRequestOptions(options) options = options || {}; options.isLoading ??= this.isLoading; + options.isShowMsg ??= this.isShowMsg; options.baseUrl = options.baseUrl || this.baseUrl; options.url = `${options.baseUrl}${options.url}`; options.data = options.data || {}; diff --git a/src/pages.json b/src/pages.json index 20165b2f..5809ec76 100644 --- a/src/pages.json +++ b/src/pages.json @@ -90,6 +90,7 @@ { "path": "pages/setup/index", "style": { + "navigationStyle": "custom", "navigationBarTitleText": "", "enablePullDownRefresh": false, "app-plus": { diff --git a/src/pages/blind-box/index.vue b/src/pages/blind-box/index.vue index 40848441..7b8310a8 100644 --- a/src/pages/blind-box/index.vue +++ b/src/pages/blind-box/index.vue @@ -27,6 +27,14 @@
*即将跳转实名页面
+ +
+
领取失败
+
失败原因:{{errMsg}}
+
确定
+
**即将返回首页
+
+
@@ -35,28 +43,72 @@ import {ref} from 'vue' import {extractingBlindBoxes} from "@/http/apis"; const imgList=ref([{url:'https://cdns.fontree.cn/fonchain-main/prod/image/1833/avatar/8395f322-b677-4f24-a13d-b79474c09d35.png'},{url:'https://cdns.fontree.cn/fonchain-main/prod/image/1833/avatar/8395f322-b677-4f24-a13d-b79474c09d35.png'}]) const showWin2=ref(false) +const showWin3=ref(false) const userInfo=ref(uni.getStorageSync('userInfo')) +const goHome=()=>{ + uni.navigateTo({ + url: '/pages/index/index' + }) +} const goRealName=()=>{ uni.navigateTo({ url: '/pages/facial/index' }) } +const errMsg=ref('') const goGet=async ()=>{ - if (!userInfo.idNum){ + if (!userInfo.value.idNum){ showWin2.value=true return } const data={ - "userName": "邢雨杨", //用户姓名 - "idCard": "411527200009129056", //用户身份证号 - "phone": "18606216921", //预约电话 + "userName": userInfo.value.realName, //用户姓名 + "idCard": userInfo.value.idNum, //用户身份证号 + "phone": userInfo.value.telNum, //预约电话 "blindBoxName": "博物馆开馆纪念盲盒" //盲盒名称 } const res=await extractingBlindBoxes(data) + if (res.code===0){ + showWin3.value=true + errMsg.value=res.msg + } }