按钮操作更新

master
橙橙楊 5 years ago committed by 潘啟华
parent 30227b541c
commit 88e36bcfe3
  1. 15
      src/common/config.js
  2. 9
      src/pages/waste_sorting/baike.vue
  3. 7
      src/pages/waste_sorting/query.vue

@ -5,8 +5,19 @@ export var config={
// 接口 // 接口
interface:{ interface:{
//图片解析 //图片解析
image_parse:"/api/BaiduImage.php?XDEBUG_SESSION_START=PHPSTORM", image_parse:"/api/BaiduImage.php",
// 文本查询 // 文本查询
text_query:"/api/QueryText.php?XDEBUG_SESSION_START=PHPSTORM" text_query:"/api/QueryText.php"
}
}
export var getInterface=function(url){
if(process.env.NODE_ENV === 'development'){
console.log("开发环境,通过XDEBUG调试接口")
return config.server+url+"?XDEBUG_SESSION_START=PHPSTORM"
}else{
console.log('生产环境')
return config.server+url
} }
} }

@ -55,7 +55,7 @@
</template> </template>
<script> <script>
import {config} from 'common/config' import {config,getInterface} from 'common/config'
export default { export default {
@ -109,6 +109,7 @@
} }
}, },
methods: { methods: {
getInterface:getInterface,
// //
update_status: function () { update_status: function () {
console.info("动画播放完毕") console.info("动画播放完毕")
@ -116,12 +117,12 @@
let that = this let that = this
setTimeout(function () { setTimeout(function () {
that.button_text="自动收缩" that.button_text="自动收缩"
},1000) },500)
setTimeout(function () { setTimeout(function () {
that.disabled_button = true that.disabled_button = true
that.show_button = false that.show_button = false
that.hide_button = true that.hide_button = true
}, 2000) }, 1000)
}else{ }else{
this.button_text="长按返回" this.button_text="长按返回"
} }
@ -136,7 +137,7 @@
console.info("选中" + group.name) console.info("选中" + group.name)
this.current_group = group.name this.current_group = group.name
let that = this let that = this
let url = config.server + config.interface.text_query let url = this.getInterface(config.interface.text_query)
console.info("文本查询接口地址:" + url) console.info("文本查询接口地址:" + url)
uni.showLoading({ uni.showLoading({
title:"加载中" title:"加载中"

@ -43,7 +43,7 @@
</template> </template>
<script> <script>
import {config} from 'common/config' import {config,getInterface} from 'common/config'
export default { export default {
name: "query", name: "query",
@ -56,6 +56,7 @@
} }
}, },
methods: { methods: {
getInterface:getInterface,
getWasteSorting:function(waste_type){ getWasteSorting:function(waste_type){
switch (waste_type) { switch (waste_type) {
case 1:return "可回收垃圾"; case 1:return "可回收垃圾";
@ -72,7 +73,7 @@
console.info("文本查询值:" + this.textValue) console.info("文本查询值:" + this.textValue)
let that=this let that=this
if(this.textValue.length>0){ if(this.textValue.length>0){
let url = config.server + config.interface.text_query let url = this.getInterface(config.interface.text_query)
console.info("文本查询接口地址:"+url) console.info("文本查询接口地址:"+url)
uni.request({ uni.request({
url:url, url:url,
@ -126,7 +127,7 @@
uni.showLoading({ uni.showLoading({
title: "图片解析中" title: "图片解析中"
}) })
let url = config.server + config.interface.image_parse let url = that.getInterface(config.interface.image_parse)
console.info("图片解析接口地址:" + url) console.info("图片解析接口地址:" + url)
uni.uploadFile({ uni.uploadFile({
url: url, url: url,

Loading…
Cancel
Save