Commit 627840de by 莫晓莉

mxl

parent 16f7059d
......@@ -32,7 +32,7 @@ export const applyProject = (data) => {
//意见反馈
export const satisfactionEvaluation = (data) => {
return request('satisfactionEvaluation', data)
return request('satisfactionEvaluation', data,'POST')
}
//获取已审批的项目
......
......@@ -55,7 +55,7 @@
margin-top: 25upx;
border: 1upx solid #ccc;
padding: 15upx;
font-size: 25upx;
font-size: 30upx;
width: 100%;
box-sizing: border-box;
}
......@@ -87,6 +87,8 @@
/* margin-right: 25upx;
margin-bottom: 15upx; */
margin:10upx;
/* border:1upx soild #ccc;
box-sizing: border-box; */
}
.imgs-area .add-box {
......@@ -94,7 +96,7 @@
box-sizing: border-box;
font-size: 25upx;
/* padding-top: 30upx; */
/* border: 1upx solid #ccc; */
border: 1upx solid #ccc;
background: #F4F7F8;
width: 200upx;
height: 200upx;
......@@ -265,4 +267,11 @@
margin:20upx;
font-size:55upx;
}
.trangle{
display:inline-block;
border-top: 15upx solid;
border-right: 8upx solid;
border-left: 8upx solid;
border-color: black transparent transparent transparent;
}
/***************************************** */
......@@ -24,11 +24,21 @@
</view>
</view> -->
<view class="category-title">
反馈项目<text style="color:red;">*</text>
</view>
<picker style="border:1upx solid #ccc;" @change="proChange" :value="projectTypeIndex" :range="projectTypeList" range-key="projectName">
<view class="flex-a-c" style="height:80upx;line-height: 80upx;padding:0 25upx;">
<view class="flex1 picker-content">{{projectTypeIndex>-1?projectTypeList[projectTypeIndex].projectName:'点击选择'}}</view>
<view class="trangle"></view>
</view>
</picker>
<view class="category-title">
反馈内容<text style="color:red;">*</text>
</view>
<textarea v-model="evaluationForm.remark" class="suggest-area" placeholder="请详细描述您的问题或建议" name="content" ></textarea>
<textarea v-model="evaluationForm.remark" class="suggest-area" placeholder="请详细描述您的问题或建议" name="content"></textarea>
<view class="category-title">
上传图片
......@@ -36,9 +46,9 @@
</view>
<view class="imgs-area">
<view class="img-box" v-for="(item,index) in imageList" :key="index">
<image class="pic" :src="item" @tap="previewPictures(item)"/>
<image @click="del(index)" class="delete-icon" src="../../static/comment/delete.png" />
<view class="img-box" v-for="(item,index) in imageUrl" :key="index">
<image class="pic" :src="item" @tap="previewPictures(item)" />
<image @click="del(index)" class="delete-icon" src="../../static/comment/delete.png" />
</view>
<view class="flex-ac-jc add-box" @click="uploadPictures">
<image class="add-btn" style='' src='../../static/comment/add-icon.png'></image>
......@@ -49,18 +59,23 @@
<view>
<view class="btns-area">
<button class="send-btn flex-ac-jc">提交反馈</button>
<button class="cancel-btn flex-ac-jc">取 消</button>
<button @click="satisfactionEvaluation" class="send-btn flex-ac-jc">提交反馈</button>
<button @click="back" class="cancel-btn flex-ac-jc">取 消</button>
</view>
</view>
</view>
</template>
<script>
import {
satisfactionEvaluation
} from "@/api/login"
export default {
data() {
return {
imageList: [],
projectId:0,
evaluationForm: {},
imageUrl: [], //
starsList: [{
id: 1,
content: "★",
......@@ -111,40 +126,41 @@
// }
// ],
starLevel: [
{
level:1,
starLevel: [{
level: 1,
name: "不满意",
face: "../../static/comment/level1.png"
},
{
level:2,
level: 2,
name: "较不满意",
face: "../../static/comment/level2.png"
},
{
level:3,
level: 3,
name: "一般",
face: "../../static/comment/level3.png"
},
{
level:4,
level: 4,
name: "较满意",
face: "../../static/comment/level4.png"
},
{
level:5,
level: 5,
name: "很满意",
face: "../../static/comment/praise.png"
},
],
cur_starLevel:0
cur_starLevel: 0
}
},
methods: {
// uni-app上传图片
uploadPictures() {
var that = this;
uni.chooseImage({
count: 6, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
......@@ -152,22 +168,41 @@
success: res => {
console.log(res)
// 将选择的本地图片赋值给data中定义的images变量
this.imageList =this.imageList.concat(res.tempFilePaths);
console.log(this.imageList)
// Start
var tempFilePaths = res.tempFilePaths;
tempFilePaths.forEach(item => {
this.urlTobase64(item);
});
// end
}
})
},
urlTobase64(url) {
var that=this;
uni.request({
url: url,
method: 'GET',
responseType: 'arraybuffer',
success: res => {
let base64 = uni.arrayBufferToBase64(res.data); //把arraybuffer转成base64
base64 = 'data:image/jpeg;base64,' + base64; //不加上这串字符,在页面无法显示
that.imageUrl = that.imageUrl.concat(base64);
that.evaluationForm.imageUrl=that.imageUrl;
}
});
},
/*
图片预览
*/
previewPictures(item) {
uni.previewImage({
current: item,
urls: this.imageList
urls: this.imageUrl
})
},
del(index){
this.imageList.splice(index, 1)
del(index) {
this.imageUrl.splice(index, 1)
},
selStar(e) {
......@@ -178,27 +213,26 @@
list[i].selected = i < idx ? true : false;
}
this.starsList = list;
this.cur_starLevel=idx-1;
this.cur_starLevel = idx - 1;
},
// 提交反馈
//申请服务
satisfactionEvaluation() {
if (this.evaluationForm.remark==undefined) {
if (this.evaluationForm.remark == undefined) {
uni.showToast({
icon: 'none',
title: '请输入反馈内容'
});
return;
}
if (this.disableLevelIndex==-1) {
if (this.imageUrl.length==0) {
uni.showToast({
icon: 'none',
title: '请上传照片'
});
return;
}
satisfactionEvaluation(this.evaluationForm).then(res => {
satisfactionEvaluation( JSON.stringify(this.evaluationForm)).then(res => {
if (res.code == 200) {
uni.showToast({
icon: 'success',
......@@ -213,8 +247,8 @@
})
},
}
}
}
</script>
<style>
......
......@@ -34,12 +34,39 @@
export default {
onLoad: function() {
const token=uni.getStorageSync('token')
console.log(token);
if(token){
uni.switchTab({
url:'/pages/login/login'
})
const token=uni.getStorageSync('token');
const user=uni.getStorageSync('user');
uni.setStorageSync('token',token);
console.log("token=",token);
console.log("user=",user);
if(!token){
// uni.switchTab({
// url:'/pages/login/login'
// })
uni.showModal({
title: '未登录',
content: '您未登录,需要登录后才能继续',
/**
* 如果需要强制登录,不显示取消按钮
*/
showCancel: !this.forcedLogin,
success: (res) => {
if (res.confirm) {
/**
* 如果需要强制登录,使用reLaunch方式
*/
if (this.forcedLogin) {
uni.reLaunch({
url: '../login/login'
});
} else {
uni.navigateTo({
url: '../login/login'
});
}
}
}
});
}
// getUserByToken().then(res=>{
......
......@@ -116,6 +116,7 @@
},
onShow() {
// this.mylike();
},
methods: {
// ...mapMutations(['logout']),
......
export default {
baseURL:'http://192.168.7.122:9100', //接口请求地址
baseURL:'http://192.168.7.122:9888/API-SERVER', //接口请求地址
fileURL:'http://192.168.7.122:9100' //文件请求地址
}
\ No newline at end of file
......@@ -12,6 +12,9 @@ let req = (method, p, reqMethod) => {
uni.request({
url: etc.baseURL + url,
method: reqMethod || 'GET',
header: {
'Content-Type': reqMethod == "POST" ? 'application/x-www-form-urlencoded' : 'application/json'
},
data: {
p: p ? p : {}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment