调整公共常用方法

master
chen 2022-04-08 18:43:32 +08:00
parent 6629e9b4d5
commit 8dc9047a3b
5 changed files with 63 additions and 43 deletions

View File

@ -1,4 +1,9 @@
import request from './requst.js';
// 共用图片上传接口
export function uploadImg(data) {
return request.upload("/universal/api.upload/upload", data);
}
// 解决方案列表接口
export function getPlanType(data) {
return request.get("/universal/api.solution/solution_list", data);
}

View File

@ -92,6 +92,7 @@
//
import footTabOne from '@/components/foot-tabs/foot-tab-one.vue';
import arprogress from '@/components/ar-circle-progress/index.vue'
import { uploadImg } from '@/jsFile/public-api.js';
export default {
components: {
statusNavSlot,
@ -186,6 +187,12 @@
sourceType:['album','camera'],
success: (res) => {
this.userInfo.avatar = res.tempFilePaths[0];
// this.$requst.upload('/universal/api.user/avatar',{path:this.userInfo.avatar}).then(res=>{
// if(res.code) {
// //
// this.checkInfo();
// }
// })
}
})
},

View File

@ -233,6 +233,7 @@
import noticeOne from '@/components/notices/notice-one/notice-one.vue';
import footTabOne from '@/components/foot-tabs/foot-tab-one.vue';
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
import {getPlanType} from '@/jsFile/public-api.js';
const app = getApp();
export default {
components:{
@ -322,7 +323,7 @@
// url
this.$toolAll.tools.obtainUrl();
//
this.getPlanType();
this.getPlanTypeEv();
//
this.getIncrementServiceType();
//
@ -365,23 +366,6 @@
url:`/pages/dataQuery/queryFunction?index=${index}`
})
},
//
getPlanType(){
this.$requst.get('/universal/api.solution/solution',{page:1,list_rows:20}).then(res=>{
if(res.code) {
this.solutionList = [];
res.data.data.forEach(item=>{
let obj = {
id:item.id,
title:item.name,
imgsrc: app.globalData.hostapi + '/' + item.cover_img,
}
this.solutionList.push(obj);
})
// console.log(this.solutionList,340);
}
})
},
//
goFaultRepair(index){
if(index!=2) {
@ -396,6 +380,27 @@
this.$toolAll.tools.showToast('已催单成功')
}
},
//
getPlanTypeEv(){
let params = {
is_recommend:1,
list_rows:200,
page:1
}
getPlanType(params).then(res=>{
if(res.code) {
this.solutionList = [];
res.data.data.forEach(item=>{
let obj = {
id:item.id,
title:item.title,
imgsrc: item.cover_img,
}
this.solutionList.push(obj);
})
}
})
},
//
getFaultsList(){
this.$requst.post('/universal/api.question/question').then(res=>{
@ -404,7 +409,7 @@
let obj = {
id:item.id,
title:item.title,
imgsrc: app.globalData.hostapi + '/' + item.cover_img,
imgsrc: item.cover_img,
content:item.summary,
views:item.reading
}
@ -413,6 +418,18 @@
}
})
},
//
goPlant(index){
uni.navigateTo({
url:`/pagesB/plan-fault/plan-fault?index=${index}`
})
},
//
goDetail(index,id) {
uni.navigateTo({
url:`/pagesB/plan-fault-product-detail/detail?index=${index}&id=${id}`
})
},
//
otherEv(index) {
let otherUrls = [
@ -424,21 +441,6 @@
url:otherUrls[index]
})
},
//
goPlant(index){
uni.navigateTo({
url:`/pagesB/plan-fault/plan-fault?index=${index}`
})
},
//
goDetail(index,id) {
// uni.navigateTo({
// url:`/pagesB/plan-fault-product-detail/detail?index=${index}&id=${id}`
// })
uni.navigateTo({
url:`/pagesB/plan-fault/plan-fault?index=${index}&type_id=${id}`
})
},
//
goMessage(){
uni.navigateTo({

View File

@ -21,7 +21,6 @@
</template>
<script>
const app = getApp();
export default {
data() {
return {
@ -55,7 +54,7 @@
//
this.dataObj.create_time = this.$toolAll.tools.timestampToTime(this.dataObj.create_time);
//
this.dataObj.cover_img = app.globalData.hostapi + '/' + this.dataObj.cover_img,
this.dataObj.cover_img = this.dataObj.cover_img,
this.rich_text = this.$toolAll.tools.escape2Html(this.dataObj.content);
}
})

View File

@ -3,7 +3,7 @@
<status-nav :navBarTitle="ifPlanFault" returnColor="#c2c2c2"></status-nav>
<container-subgroup>
<view slot="content" style="margin: 0 -16rpx;" class="fon28">
<view @tap="goDetail(item.id)" class="bacf radius10 pad-s30 mar-x10 pad-x10" v-for="(item,index) in dataList" :key="index">
<view @tap="goDetail(item.id)" class="bacf radius10 pad-s30 mar-x10 pad-x10 animated fadeIn" v-for="(item,index) in dataList" :key="index">
<view class=" pad-zy10 disjbac">
<image :src="item.cover_img" mode="aspectFill" lazy-load class="flexs mar-y20" style="width: 240rpx;height: 174rpx;border-radius: 6rpx;"></image>
<view style="height: 174rpx;" class="width100 disjb fc fon24 posir">
@ -22,6 +22,7 @@
</view>
<view class="bbot mar-s20"></view>
</view>
<pitera v-if="total==dataList.length && dataList.length" textStr="暂无更多列表数据"></pitera>
</view>
</container-subgroup>
<nothing-page v-if="dataList.length==0" content="暂无更多列表数据"></nothing-page>
@ -30,23 +31,30 @@
<script>
import rate from '@/components/rate.vue';
const app = getApp();
import pitera from '@/components/nothing/pitera.vue';
export default {
components:{
rate
rate,
pitera
},
data() {
return {
rateNum:5,
ifPlanFault:'',
current:'',
size:10,
size:20,
page:1,
total:0,
type_id:'',//id
dataList:[]
}
},
onReachBottom() {
if(this.total != this.dataList.length) {
this.page++;
this.getPlanFault();
}
},
onLoad(op) {
this.ifPlanFault = `${['解决方案','常见故障'][op.index*1]}`;
this.current = op.index*1;
@ -68,7 +76,7 @@
];
let params = [
{
type_id:this.type_id,
is_recommend:0,
list_rows:this.size,
page:this.page
},
@ -84,7 +92,7 @@
res.data.data.forEach(item=>{
let obj = {
id:item.id,
cover_img: app.globalData.hostapi + '/' + item.cover_img,
cover_img: item.cover_img,
title:item.title,//
summary:item.summary,//
hot:item.hot,//
@ -92,7 +100,6 @@
}
this.dataList.push(obj);
})
console.log(this.dataList);
}
})
}