调整公共常用方法

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'; import request from './requst.js';
// 共用图片上传接口
export function uploadImg(data) { export function uploadImg(data) {
return request.upload("/universal/api.upload/upload", 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 footTabOne from '@/components/foot-tabs/foot-tab-one.vue';
import arprogress from '@/components/ar-circle-progress/index.vue' import arprogress from '@/components/ar-circle-progress/index.vue'
import { uploadImg } from '@/jsFile/public-api.js';
export default { export default {
components: { components: {
statusNavSlot, statusNavSlot,
@ -186,6 +187,12 @@
sourceType:['album','camera'], sourceType:['album','camera'],
success: (res) => { success: (res) => {
this.userInfo.avatar = res.tempFilePaths[0]; 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 noticeOne from '@/components/notices/notice-one/notice-one.vue';
import footTabOne from '@/components/foot-tabs/foot-tab-one.vue'; import footTabOne from '@/components/foot-tabs/foot-tab-one.vue';
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue'; import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
import {getPlanType} from '@/jsFile/public-api.js';
const app = getApp(); const app = getApp();
export default { export default {
components:{ components:{
@ -322,7 +323,7 @@
// url // url
this.$toolAll.tools.obtainUrl(); this.$toolAll.tools.obtainUrl();
// //
this.getPlanType(); this.getPlanTypeEv();
// //
this.getIncrementServiceType(); this.getIncrementServiceType();
// //
@ -365,23 +366,6 @@
url:`/pages/dataQuery/queryFunction?index=${index}` 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){ goFaultRepair(index){
if(index!=2) { if(index!=2) {
@ -396,6 +380,27 @@
this.$toolAll.tools.showToast('已催单成功') 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(){ getFaultsList(){
this.$requst.post('/universal/api.question/question').then(res=>{ this.$requst.post('/universal/api.question/question').then(res=>{
@ -404,7 +409,7 @@
let obj = { let obj = {
id:item.id, id:item.id,
title:item.title, title:item.title,
imgsrc: app.globalData.hostapi + '/' + item.cover_img, imgsrc: item.cover_img,
content:item.summary, content:item.summary,
views:item.reading 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) { otherEv(index) {
let otherUrls = [ let otherUrls = [
@ -424,21 +441,6 @@
url:otherUrls[index] 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(){ goMessage(){
uni.navigateTo({ uni.navigateTo({

View File

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

View File

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