parent
c7323c1900
commit
83d81031e3
|
@ -1,19 +1,19 @@
|
||||||
|
|
||||||
let domain = 'http://apif.java.crmeb.net'
|
// let domain = 'http://apif.java.crmeb.net'
|
||||||
|
let domain = 'http://127.0.0.1:48080'
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// 请求域名 格式: https://您的域名
|
// 请求域名 格式: https://您的域名
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
HTTP_REQUEST_URL: domain,
|
HTTP_REQUEST_URL: domain,
|
||||||
// #endif
|
// #endif
|
||||||
HTTP_ADMIN_URL:'http://apif.java.crmeb.net', //PC后台的API请求地址,上传图片用
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
//H5接口是浏览器地址
|
//H5接口是浏览器地址
|
||||||
// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,
|
// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,
|
||||||
// http://api.java.crmeb.net:20001
|
// http://api.java.crmeb.net:20001
|
||||||
HTTP_REQUEST_URL:domain,
|
HTTP_REQUEST_URL: domain,
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
HEADER:{
|
HEADER:{
|
||||||
'content-type': 'application/json'
|
'content-type': 'application/json'
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,11 +33,11 @@
|
||||||
<view class='textarea'>
|
<view class='textarea'>
|
||||||
<textarea placeholder='商品满足你的期待么?说说你的想法,分享给想买的他们吧~' name="comment" placeholder-class='placeholder'></textarea>
|
<textarea placeholder='商品满足你的期待么?说说你的想法,分享给想买的他们吧~' name="comment" placeholder-class='placeholder'></textarea>
|
||||||
<view class='list acea-row row-middle'>
|
<view class='list acea-row row-middle'>
|
||||||
<view class='pictrue' v-for="(item,index) in picsPath" :key="index">
|
<view class='pictrue' v-for="(item,index) in pics" :key="index">
|
||||||
<image :src='item'></image>
|
<image :src='item' />
|
||||||
<text class='iconfont icon-guanbi1' @click='DelPic(index)'></text>
|
<text class='iconfont icon-guanbi1' @click='DelPic(index)' />
|
||||||
</view>
|
</view>
|
||||||
<view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic' v-if="picsPath.length <= 8">
|
<view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic' v-if="pics.length < 9">
|
||||||
<text class='iconfont icon-icon25201'></text>
|
<text class='iconfont icon-icon25201'></text>
|
||||||
<view>上传图片</view>
|
<view>上传图片</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -59,7 +59,6 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pics: [],
|
pics: [],
|
||||||
picsPath: [],
|
|
||||||
scoreList: [{
|
scoreList: [{
|
||||||
name: "商品质量",
|
name: "商品质量",
|
||||||
stars: ["", "", "", "", ""],
|
stars: ["", "", "", "", ""],
|
||||||
|
@ -119,24 +118,15 @@
|
||||||
* 删除图片
|
* 删除图片
|
||||||
*/
|
*/
|
||||||
DelPic: function(index) {
|
DelPic: function(index) {
|
||||||
this.picsPath.splice(index, 1);
|
|
||||||
this.pics.splice(index, 1);
|
this.pics.splice(index, 1);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 上传文件
|
* 上传文件
|
||||||
*/
|
*/
|
||||||
uploadpic: function() {
|
uploadpic: function() {
|
||||||
let that = this;
|
this.$util.uploadImageOne({}, res => {
|
||||||
that.$util.uploadImageOne({
|
this.pics.push(res.data);
|
||||||
url: 'user/upload/image',
|
this.$set(this, 'pics', this.pics);
|
||||||
name: 'multipart',
|
|
||||||
model: "product",
|
|
||||||
pid: 1
|
|
||||||
}, function(res) {
|
|
||||||
that.pics.push(res.data.url);
|
|
||||||
that.picsPath.push(res.data.localPath);
|
|
||||||
that.$set(that, 'pics', that.pics);
|
|
||||||
that.$set(that, 'picsPath', that.picsPath);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
import {
|
import { TOKENNAME } from '../config/app.js';
|
||||||
TOKENNAME,
|
import { HTTP_REQUEST_URL } from '@/config/app.js';
|
||||||
HTTP_REQUEST_URL
|
|
||||||
} from '../config/app.js';
|
|
||||||
import {HTTP_ADMIN_URL} from '@/config/app.js';
|
|
||||||
import store from '../store';
|
import store from '../store';
|
||||||
import {
|
|
||||||
pathToBase64
|
|
||||||
} from '@/plugin/image-tools/index.js';
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* opt object | string
|
* opt object | string
|
||||||
* to_url object | string
|
* to_url object | string
|
||||||
* 例:
|
* 例:
|
||||||
|
@ -438,10 +434,7 @@ export default {
|
||||||
let count = opt.count || 1,
|
let count = opt.count || 1,
|
||||||
sizeType = opt.sizeType || ['compressed'],
|
sizeType = opt.sizeType || ['compressed'],
|
||||||
sourceType = opt.sourceType || ['album', 'camera'],
|
sourceType = opt.sourceType || ['album', 'camera'],
|
||||||
inputName = opt.name || 'pics',
|
inputName = opt.name || 'file';
|
||||||
pid = opt.pid,
|
|
||||||
model = opt.model;
|
|
||||||
|
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: count, //最多可以选择的图片总数
|
count: count, //最多可以选择的图片总数
|
||||||
sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有
|
sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有
|
||||||
|
@ -451,7 +444,7 @@ export default {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '图片上传中',
|
title: '图片上传中',
|
||||||
});
|
});
|
||||||
let urlPath = HTTP_ADMIN_URL + '/api/admin/upload/image' + "?model=" + model + "&pid=" + pid
|
const urlPath = HTTP_REQUEST_URL + '/app-api/infra/file/upload'
|
||||||
let localPath = res.tempFilePaths[0];
|
let localPath = res.tempFilePaths[0];
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: urlPath,
|
url: urlPath,
|
||||||
|
@ -462,7 +455,10 @@ export default {
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
"Content-Type": "multipart/form-data",
|
"Content-Type": "multipart/form-data",
|
||||||
// #endif
|
// #endif
|
||||||
[TOKENNAME]: store.state.app.token
|
|
||||||
|
// TODO 芋艿:后续改成动态读取,不要写死
|
||||||
|
'tenant-id': 1,
|
||||||
|
'Authorization': 'Bearer test247'
|
||||||
},
|
},
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
@ -472,8 +468,8 @@ export default {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let data = res.data ? JSON.parse(res.data) : {};
|
let data = res.data ? JSON.parse(res.data) : {};
|
||||||
if (data.code === 200) {
|
if (data.code === 200 || data.code === 0) {
|
||||||
data.data.localPath = localPath;
|
// data.data.localPath = localPath;
|
||||||
successCallback && successCallback(data)
|
successCallback && successCallback(data)
|
||||||
} else {
|
} else {
|
||||||
errorCallback && errorCallback(data);
|
errorCallback && errorCallback(data);
|
||||||
|
@ -490,14 +486,6 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// pathToBase64(res.tempFilePaths[0])
|
|
||||||
// .then(imgBase64 => {
|
|
||||||
// console.log(imgBase64);
|
|
||||||
|
|
||||||
// })
|
|
||||||
// .catch(error => {
|
|
||||||
// console.error(error)
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue