添加环境判断
diff --git a/App.vue b/App.vue
index 3ffa7df..9d1fac8 100644
--- a/App.vue
+++ b/App.vue
@@ -3,7 +3,8 @@
globalData: {
msg: {},
verno:'10',
- vername:'2.2.0'
+ vername:'2.2.0',
+ version:'2.2.0(11)'
},
onLaunch() {
let that = this
diff --git a/manifest.json b/manifest.json
index 1d51cc8..80841d5 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,8 +2,8 @@
"name" : "大理市民卡",
"appid" : "__UNI__6DDB720",
"description" : "大理市民服务app",
- "versionName" : "2.2.0",
- "versionCode" : 11,
+ "versionName" : "2.2.1",
+ "versionCode" : 12,
"transformPx" : false,
"app-plus" : {
// APP-VUE分包,可提APP升启动速度,2.7.12开始支持,兼容微信小程序分包方案,默认关闭
diff --git a/pages/sub_mine/leaveMsg/index.vue b/pages/sub_mine/leaveMsg/index.vue
index 18cab56..261e0a1 100644
--- a/pages/sub_mine/leaveMsg/index.vue
+++ b/pages/sub_mine/leaveMsg/index.vue
@@ -12,6 +12,7 @@
</template>
<script>
+ const app = getApp()
export default {
data() {
return {
@@ -65,20 +66,22 @@
})
return false
}
+ let version = app.globalData.version
let params = {
- title: title,
+ title,
content: value,
- pictures: list
+ pictures: list,
+ version
}
that.$u.post("/v1/feedback/release", params).then(res => {
uni.showToast({
title: "留言成功,我们将尽快给您回复",
- icon:"none",
- duration:1500,
+ icon: "none",
+ duration: 1500,
complete: (res) => {
setTimeout(() => {
uni.navigateBack({
- delta:1
+ delta: 1
})
}, 1500)
}
diff --git a/pages/sub_tabbar/mine.vue b/pages/sub_tabbar/mine.vue
index 25aca57..a3f72e8 100644
--- a/pages/sub_tabbar/mine.vue
+++ b/pages/sub_tabbar/mine.vue
@@ -19,7 +19,7 @@
<!-- 列表 -->
<view class="wrap-list">
<u-cell-group :border="false">
- <u-cell-item :title="v.name" :title-style="titleStyle" :value="i===0?value:''" @click="toPath(v.path)" v-for="(v,i) in list"
+ <u-cell-item :title="v.name" :title-style="titleStyle" :value="v.value" @click="toPath(v.path)" v-for="(v,i) in list"
:key="i">
<u-icon :name="v.icon" custom-prefix="custom-icon" size="40" slot="icon" color="#2FA8E1"></u-icon>
</u-cell-item>
@@ -33,6 +33,7 @@
</template>
<script>
+ const app = getApp()
export default {
data() {
return {
@@ -47,36 +48,41 @@
'fontSize': '28rpx',
'marginLeft': '30rpx'
},
- value: "0积分",
list: [{
name: "我的积分",
path: "/pages/sub_mine/integral/index",
- icon: "integral"
+ icon: "integral",
+ value:'0积分'
},
{
name: "我的足迹",
path: "/pages/sub_mine/cashFlow/index",
- icon: "bills"
+ icon: "bills",
+ value:''
},
{
name: "我的卡券",
path: "/pages/sub_mine/voucher/index",
- icon: "voucher"
+ icon: "voucher",
+ value:''
},
{
name: "账户安全",
path: "/pages/sub_mine/accountSafe/index",
- icon: "safe"
+ icon: "safe",
+ value:''
},
{
name: "我的消息",
path: "/pages/sub_mine/message/index",
- icon: "message"
+ icon: "message",
+ value:''
},
{
name: "留言反馈",
path: "/pages/sub_mine/leaveMsg/index",
- icon: "leaveMsg"
+ icon: "leaveMsg",
+ value:''
},
],
loginOut: {
@@ -85,7 +91,8 @@
marginTop: '100rpx',
color:'#ffffff',
backgroundColor:'#2FA8E1'
- }
+ },
+ version:''
}
},
computed: {
@@ -105,6 +112,7 @@
that.tel = '暂无号码'
that.name = '游客'
}
+ that.list[that.list.length-1].value = 'v' + app.globalData.version
},
methods: {
exit() {
@@ -145,7 +153,7 @@
getIntegral(){
let that = this
that.$u.get("/v1/point/total",{}).then(res=>{
- that.value = res.data + '积分'
+ that.list[0].value = res.data + '积分'
})
}
},
@@ -163,13 +171,11 @@
.status_bar {
background-color: #4EB4E4;
}
-
.loginOut {
width: 600rpx;
padding: 50rpx 0;
margin-top: 100rpx;
}
-
.wrap {
font-family: "PingFang-SC-Medium";
&-mine {
diff --git a/static/js/config.js b/static/js/config.js
new file mode 100644
index 0000000..e6285be
--- /dev/null
+++ b/static/js/config.js
@@ -0,0 +1,22 @@
+let config = {}
+
+if (process.env.NODE_ENV === 'development') {
+ // 开发环境
+ config = {
+ // #ifdef H5
+ base_api: "/api", //测试地址
+ // #endif
+ // base_api: "http://172.28.43.20:8089/portal/mobileapi",//本地地址
+ // #ifndef H5
+ base_api: 'http://yy.dlsmk.cn:8080/portal/mobileapi',
+ // #endif
+ }
+
+} else {
+ // 生产环境
+ config = {
+ base_api: 'https://yy.dlsmk.cn/portal/mobileapi'
+ }
+}
+
+export default config
diff --git a/static/js/http.interceptor.js b/static/js/http.interceptor.js
index 0748b4b..db568be 100644
--- a/static/js/http.interceptor.js
+++ b/static/js/http.interceptor.js
@@ -1,12 +1,10 @@
+import config from './config.js'
+const base_url = config.base_api
+console.log(base_url)
const install = (Vue, vm) => {
// 此为自定义配置参数,具体参数见上方说明
Vue.prototype.$u.http.setConfig({
- // baseUrl: 'https://yy.dlsmk.cn/payapi/mobileapi', // 大理智警域名
- // baseUrl:'https://yy.dlsmk.cn/portal/mobileapi', //正式地址
- // baseUrl:'http://yy.dlsmk.cn:8080/portal/mobileapi', //测试地址
- // baseUrl:'/api',
- baseUrl: "http://172.28.43.20:8089/portal/mobileapi",//本地地址
- // method: 'POST',
+ baseUrl: base_url,
// 设置为json,返回后会对数据进行一次JSON.parse()
dataType: 'json',
// sslVerify:false,
@@ -26,14 +24,14 @@
const tenantid = uni.getStorageSync('tenantid');
if (token) {
config.header['Authorization'] = "Bearer " + token;
- }else{
+ } else {
config.header['Authorization'] = ''
}
//console.log(config.url,config.header['Authorization'])
config.header["X-TENANT-ID"] = tenantid;
- if (config.url == "/i/activity" || config.url == "/v1/feedback/release"
- || config.url == '/medicineapi/medicalcard/add' || config.url == '/medicalapi/pay'
- ||config.url == '/v1/security/save' || config.url == '/i/security/check' || config.url == '/i/security/pwdset') {
+ if (config.url == "/i/activity" || config.url == "/v1/feedback/release" ||
+ config.url == '/medicineapi/medicalcard/add' || config.url == '/medicalapi/pay' ||
+ config.url == '/v1/security/save' || config.url == '/i/security/check' || config.url == '/i/security/pwdset') {
config.header['content-type'] = "application/json";
} else {
config.header['content-type'] = "application/x-www-form-urlencoded";
@@ -49,7 +47,7 @@
// 如果配置了originalData为true,请留意这里的返回值
if (res.data.code == 200) {
return res.data
- } else if(res.data.code == 500){
+ } else if (res.data.code == 500) {
uni.showModal({
title: "提示",
content: res.data.code + ":" + res.data.msg,
@@ -68,7 +66,7 @@
uni.showToast({
title: "登录状态失效,请重新登录",
icon: "none",
- mask:true,
+ mask: true,
duration: 1500,
complete(res) {
setTimeout(() => {
@@ -83,14 +81,14 @@
} else {
// 如果返回false,则会调用Promise的reject回调,
// 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值
- if(res.errMsg.indexOf('fail') == -1){
+ if (res.errMsg.indexOf('fail') == -1) {
uni.showModal({
title: "错误",
content: res.data.status + ":" + res.data.message,
// content: `${res.data.status}:${res.data.message}`,
showCancel: false,
})
- }else{
+ } else {
uni.showModal({
title: "错误",
content: res.errMsg,
@@ -107,4 +105,3 @@
// export default install
module.exports = install
-