Переглянути джерело

20221129版本更新:新增开发环境配置、请求错误处理

asd123a20 2 роки тому
батько
коміт
fa83927221

+ 4 - 4
api/request.js

@@ -11,18 +11,18 @@ const request = ({ url, method, data, header }) => {
 			},
 			dataType: 'json',
 			success: function(res) {
-				if (res.data.errcode) {
+				if (res.data.errcode && res.data.errcode != 0) {
 					wx.showToast({
-						title: res.data.details,
+						title: res.data.details || '获取失败',
 						icon: 'error'
 					})
 				}
-				if (res.data.code !== 200) {
+				if (res.data.code && res.data.code !== 200) {
 					wx.showToast({
 						title: res.data.msg
 					})
 				}
-				if (res.data.code == 401) {
+				if (res.data.code && res.data.code == 401) {
 					uni.redirectTo({
 						url: '/pages/login/index'
 					});

+ 3 - 5
env.js

@@ -1,10 +1,8 @@
 const ENV_API_URL = {
 	development: {
-		// url: 'https://fuyu.scapp.cn/wx-api/api',
-		url: 'http://192.168.0.71:7070/api',
-		imgUrl: 'https://fuyu.scapp.cn/static/wxa/',
-		fileUrl: 'https://fuyu.scapp.cn'
-		// fileUrl: 'http://192.168.0.71'
+		url: 'https://fuyu.cc-lotus.info/wx-api/api',
+		imgUrl: 'https://fuyu.cc-lotus.info/static/wxa',
+		fileUrl: 'https://fuyu.cc-lotus.info'
 	},
 	production: {
 		url: 'https://fuyu.scapp.cn/wx-api/api',

+ 1 - 1
pages/activity/details.vue

@@ -5,7 +5,7 @@
 			<uni-list>
 				<uni-list-item :show-extra-icon="true" :extra-icon="extraIcon[0]" title="报名时间" :rightText="`${info.regStartTime}至${info.regEndTime}`"></uni-list-item>
 				<uni-list-item :show-extra-icon="true" :extra-icon="extraIcon[0]" title="活动时间" :rightText="`${info.startTime}至${info.endTime}`"></uni-list-item>
-				<uni-list-item :show-extra-icon="true" :extra-icon="extraIcon[1]" title="招募人数" :rightText="info.regMaxCount + '人'"></uni-list-item>
+				<uni-list-item v-if="info.regMaxCount < 999" :show-extra-icon="true" :extra-icon="extraIcon[1]" title="招募人数" :rightText="info.regMaxCount || '不限' + '人'"></uni-list-item>
 				<uni-list-item :show-extra-icon="true" :extra-icon="extraIcon[1]" title="负责人" :rightText="info.sponsorName"></uni-list-item>
 				<uni-list-item :show-extra-icon="true" :extra-icon="extraIcon[2]" title="联系电话" :rightText="info.sponsorPhone"></uni-list-item>
 			</uni-list>

+ 3 - 3
pages/activity/index.vue

@@ -55,10 +55,10 @@
 				const isDateTime = new Date().getTime();
 				res.rows?.map(e => {
 					const endTime = Date.parse(e.endTime);
-					const startTime = Date.parse(e.startTime);
+					const startTime = Date.parse(e.regStartTime);
 					if (e.status == 0 || isDateTime < startTime) e.statusText = '未开始';
-					if (e.status !== 3 && isDateTime < endTime && isDateTime > startTime) e.statusText = '进行中';
-					if (isDateTime > endTime && e.status !== 3) e.statusText = '积分发放中';
+					if (e.status !== 3 && isDateTime > startTime) e.statusText = '进行中';
+					// if (isDateTime > endTime && e.status !== 3) e.statusText = '积分发放中';
 					if (e.status == 3) e.statusText = '已结束';
 					e.image = BASE_URL.fileUrl + e.image;
 					return e;

+ 1 - 2
pages/index/index.vue

@@ -31,7 +31,7 @@
 				</view>
 			</uni-section>
 			<!-- 疫情 -->
-			<uni-section titleFontSize="16px" class="mb-10 sectionBox" title="疫情防控" type="line">
+			<uni-section titleFontSize="16px" class="mb-10 sectionBox" title="便民服务" type="line">
 				<view class="card" v-for="(item, index) in list" :key="index" :border="false" @click="illnessBtn(item)">
 					<image style="width: 50%; height: 55px; margin: 0 auto; display: block;" :src="item.url"></image>
 					<text class="title">{{ item.title }}</text>
@@ -103,7 +103,6 @@
 			},
 			illnessBtn(e) {
 				const role = uni.getStorageSync('role');
-				console.log(role, 'role')
 				if (e.isUser && role && role == 'guest') {
 					uni.navigateTo({
 						url: `/pages/register/index?path=${e.path}`

+ 17 - 0
pages/register/index.vue

@@ -99,7 +99,24 @@
 		methods: {
 			// 获取手机号
 			async decryptPhoneNumber(e) {
+				console.log(e)
 				const res = await requestLogin.getPhone({ code: e.detail.code, appid: appid });
+				if (!res) {
+					uni.showToast({
+						title: '获取失败',
+						icon: 'error',
+						duration: 2000,
+					});
+					return
+				}
+				if (res && res.errcode !== 0) {
+					uni.showToast({
+						title: res.errmsg,
+						icon: 'error',
+						duration: 2000,
+					});
+					return
+				}
 				this.$set(this.formData, 'phone', res.phone_info.phoneNumber);
 			},
 			// 小区选择

+ 16 - 0
pages/user/index.vue

@@ -139,6 +139,22 @@
 			// 获取手机号
 			async decryptPhoneNumber(e) {
 				const res = await requestLogin.getPhone({ code: e.detail.code, appid: appid });
+				if (!res) {
+					uni.showToast({
+						title: '获取失败',
+						icon: 'error',
+						duration: 2000,
+					});
+					return
+				}
+				if (res.errcode !== 0) {
+					uni.showToast({
+						title: res.errMsg,
+						icon: 'error',
+						duration: 2000,
+					});
+					return
+				}
 				this.$set(this.formData, 'phone', res.phone_info.phoneNumber);
 			},
 			// 小区选择

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/activity/details.js.map


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/activity/index.js.map


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/register/index.js.map


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pages/user/index.js.map


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/mp-weixin/common/vendor.js


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/activity/details.wxml


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/activity/index.js


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/index/index.js


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/index/index.wxml


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/register/index.js


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/user/index.js


+ 1 - 1
unpackage/dist/dev/mp-weixin/project.config.json

@@ -20,7 +20,7 @@
   },
   "compileType": "miniprogram",
   "libVersion": "",
-  "appid": "wxfb8ee68c5e9a63e8",
+  "appid": "wx6cc481d94edbe039",
   "projectname": "Applet",
   "condition": {},
   "editorSetting": {