Merge branch 'master' of http://192.168.1.26:3000/dianliang/dl_uniapp
# Conflicts: # pages/components/my-notice-item-tg.vue
This commit is contained in:
commit
1f5db03144
@ -160,4 +160,12 @@ export function queryListByUserId(params) {
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export function evaluateAdd(data) {
|
||||
return request({
|
||||
url: '/busi/evaluate',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
@ -7,9 +7,9 @@
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view>
|
||||
<!-- <view>
|
||||
<input class="input-tag" v-model="inputzy" type="text" :placeholder="placeholder" @confirm="confirm">
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@ -138,4 +138,4 @@
|
||||
line-height: 50upx;
|
||||
font-size: 28upx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"cos-js-sdk-v5": "^1.8.7",
|
||||
"html2canvas": "^1.4.1",
|
||||
"rich-text-parser": "^1.0.2"
|
||||
},
|
||||
|
@ -154,4 +154,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -12,6 +12,7 @@
|
||||
</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="opt-button-box">
|
||||
<view class="opt-item" v-if="item.signStatus=='已通过'" @click="evaluate(item)">评价</view>
|
||||
<view class="opt-item" @click="goDetail(item)">查看详情</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -86,6 +87,9 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
evaluate(item) {
|
||||
this.$tab.navigateTo('/pages/mine/set/evaluate?userType=01&toUserId=' + item.userId)
|
||||
},
|
||||
/**
|
||||
* 查看通告详情
|
||||
* @param {Object} item
|
||||
|
@ -213,4 +213,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -80,11 +80,11 @@
|
||||
limit="9"></uni-file-picker>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 提示窗示例 -->
|
||||
<uni-popup ref="alertDialog" type="dialog">
|
||||
<uni-popup-dialog cancelText="取消" confirmText="创建" iconPath="/static/detail/card.png"
|
||||
content="没有可选择的收货地址,请先创建" @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
<!-- 提示窗示例 -->
|
||||
<uni-popup ref="alertDialog" type="dialog">
|
||||
<uni-popup-dialog cancelText="取消" confirmText="创建" iconPath="/static/detail/card.png"
|
||||
content="没有可选择的收货地址,请先创建" @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
<view class="item-field" style="align-items: center;">
|
||||
<view class="submit-box" @click="submitForm">提交</view>
|
||||
</view>
|
||||
@ -113,14 +113,14 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
uploadUrl: config.baseUrl+'/common/upload',
|
||||
headers: {},
|
||||
uploadUrl: config.baseUrl + '/common/upload',
|
||||
headers: {},
|
||||
//所有可选的平台
|
||||
range: [],
|
||||
sizeType: ['compressed'],
|
||||
//图片数组
|
||||
fileList: [],
|
||||
imageUrl:[],
|
||||
imageUrl: [],
|
||||
//地址集合
|
||||
addressList: [],
|
||||
//名片数据对象
|
||||
@ -146,33 +146,33 @@
|
||||
},
|
||||
|
||||
methods: {
|
||||
dialogConfirm(){
|
||||
this.$tab.navigateTo('/pages/mine/addr/addr-list')
|
||||
},
|
||||
dialogConfirm() {
|
||||
this.$tab.navigateTo('/pages/mine/addr/addr-list')
|
||||
},
|
||||
|
||||
dialogClose(){
|
||||
dialogClose() {
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
/**初始化数据*/
|
||||
initData(id) {
|
||||
this.fileList = []
|
||||
this.imageUrl = []
|
||||
this.fileList = []
|
||||
this.imageUrl = []
|
||||
if (id) {
|
||||
getBusiCardById({
|
||||
id: id
|
||||
}).then(res => {
|
||||
console.log(res.data, 133)
|
||||
this.dataObj = res.data
|
||||
if (this.dataObj.image != null && this.dataObj.image != ''){
|
||||
console.log(this.dataObj.image,'this.dataObj.image')
|
||||
this.imageUrl = this.dataObj.image.split(',')
|
||||
this.imageUrl.map((item)=>{
|
||||
this.fileList.push({
|
||||
url:config.baseUrl + item
|
||||
})
|
||||
})
|
||||
}
|
||||
if (this.dataObj.image != null && this.dataObj.image != '') {
|
||||
console.log(this.dataObj.image, 'this.dataObj.image')
|
||||
this.imageUrl = this.dataObj.image.split(',')
|
||||
this.imageUrl.map((item) => {
|
||||
this.fileList.push({
|
||||
url: item
|
||||
})
|
||||
})
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
@ -213,9 +213,9 @@
|
||||
initAddress() {
|
||||
uniSelectList().then(res => {
|
||||
this.addressList = res.data
|
||||
if (this.addressList.length == 0){
|
||||
this.$refs.alertDialog.open()
|
||||
}
|
||||
if (this.addressList.length == 0) {
|
||||
this.$refs.alertDialog.open()
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
@ -259,11 +259,11 @@
|
||||
toast("收货地址不能为空")
|
||||
return
|
||||
}
|
||||
if (this.fileList.length == 0) {
|
||||
toast("证明材料不能为空")
|
||||
return
|
||||
}
|
||||
this.dataObj.image = this.imageUrl.join(',');
|
||||
if (this.fileList.length == 0) {
|
||||
toast("证明材料不能为空")
|
||||
return
|
||||
}
|
||||
this.dataObj.image = this.imageUrl.join(',');
|
||||
applyBusiCard(this.dataObj).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
@ -288,10 +288,11 @@
|
||||
url: '',
|
||||
filePath: file.tempFilePaths[i]
|
||||
}).then((res) => {
|
||||
console.log('上传图片', res);
|
||||
this.fileList.push({
|
||||
url: res.url
|
||||
})
|
||||
this.imageUrl.push(res.fileName)
|
||||
this.imageUrl.push(res.fileName)
|
||||
})
|
||||
}
|
||||
},
|
||||
@ -300,12 +301,12 @@
|
||||
this.fileList.splice(index, 1);
|
||||
this.imageUrl.splice(index, 1);
|
||||
},
|
||||
uploadSuccess(res, file) {
|
||||
console.log('上传成功', res);
|
||||
},
|
||||
uploadFail(error, file) {
|
||||
console.log('上传失败', error);
|
||||
},
|
||||
uploadSuccess(res, file) {
|
||||
console.log('上传成功', res);
|
||||
},
|
||||
uploadFail(error, file) {
|
||||
console.log('上传失败', error);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -244,9 +244,14 @@
|
||||
methods: {
|
||||
toggle(type, key) {
|
||||
this.type = type
|
||||
this.popupImgUrl = getStrData(key)
|
||||
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
|
||||
this.$refs.popup.open(type)
|
||||
if (type == 'center') {
|
||||
//公众号跳转
|
||||
wx.openOfficialAccountProfile({
|
||||
username: 'tonggaokuaijie', // 此处填写公众号的微信号
|
||||
success: res => {},
|
||||
fail: res => {}
|
||||
})
|
||||
}
|
||||
},
|
||||
getDetail() {
|
||||
queryDetail({
|
||||
|
@ -8,7 +8,7 @@
|
||||
你觉得参与本次通告体验如何?<text>(1-10分)</text>
|
||||
</view>
|
||||
<view class="item-value">
|
||||
<uni-rate :max="10" :value="dataObj.rate" />
|
||||
<uni-rate :max="10" :value="dataObj.score" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-field">
|
||||
@ -19,17 +19,18 @@
|
||||
<biner-input-tags @change="change" :selectlist='selectlist' :disabled='disabled'
|
||||
:placeholder='placeholder'></biner-input-tags>
|
||||
<view class="item-dom-box">
|
||||
<view class="item-dom" v-for="(item,index) in tips" @click="chooseObj(item)">{{item}}</view>
|
||||
<view class="item-dom" v-for="(item,index) in tips" @click="chooseObj(item)">{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="line-row-bottom">
|
||||
<uni-data-checkbox @change="chooseBoxFun($event,'isRead')" multiple :localdata="readBookList" />
|
||||
<uni-data-checkbox @change="changeAnonymous" multiple :localdata="readBookList" />
|
||||
<text class="text-red">你的头像和昵称将在评价中隐藏</text>
|
||||
</view>
|
||||
<view class="item-field" style="align-items: center;">
|
||||
<view class="submit-box" @click="submitForm">提交</view>
|
||||
<view class="submit-box" @click="evaluateAddFun">提交</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -40,6 +41,12 @@
|
||||
import navigationBarVue from '@/components/navigation/navigationBar.vue';
|
||||
// 引入biner-input-tags
|
||||
import binerInputTags from '@/components/biner-input-tags/biner-input-tags'
|
||||
import {
|
||||
evaluateAdd
|
||||
} from '@/api/business/notice';
|
||||
import {
|
||||
getCatgByCode
|
||||
} from '@/api/system/config.js'
|
||||
export default {
|
||||
components: {
|
||||
navigationBarVue,
|
||||
@ -49,28 +56,91 @@
|
||||
return {
|
||||
disabled: false, //不禁用
|
||||
// 默认的数组 不填默认的是空数组
|
||||
selectlist: [{
|
||||
title: '专业'
|
||||
}],
|
||||
selectlist: [],
|
||||
// 默认提示
|
||||
placeholder: '请输入评价',
|
||||
dataObj: {
|
||||
rate: 0,
|
||||
score: 0,
|
||||
toUserId: null,
|
||||
userType: null,
|
||||
isAnonymous: '0'
|
||||
},
|
||||
tips: ["定人快", "审稿快", "提现快"],
|
||||
tips: [],
|
||||
readBookList: [{
|
||||
text: '匿名评价',
|
||||
value: true
|
||||
value: '1'
|
||||
}],
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.dataObj.toUserId = option.toUserId
|
||||
this.dataObj.userType = option.userType
|
||||
this.dataObj.userType = option.userType
|
||||
if (option.userType == '01') {
|
||||
option.toUserType = '02'
|
||||
} else {
|
||||
option.toUserType = '01'
|
||||
}
|
||||
this.initData("plfl", "tips")
|
||||
},
|
||||
methods: {
|
||||
|
||||
changeAnonymous(data) {
|
||||
console.log(data, 82);
|
||||
if (data.detail.data && data.detail.data.length > 0) {
|
||||
this.dataObj.isAnonymous = '1'
|
||||
} else {
|
||||
this.dataObj.isAnonymous = '0'
|
||||
}
|
||||
|
||||
},
|
||||
/**
|
||||
* 初始化数据
|
||||
* @param {Object} code
|
||||
* @param {Object} dataObj
|
||||
*/
|
||||
initData(code, dataObj) {
|
||||
let that = this
|
||||
getCatgByCode({
|
||||
code: code
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
this[dataObj] = res.data
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
evaluateAddFun() {
|
||||
this.dataObj.evaluate = ''
|
||||
if (this.selectlist && this.selectlist.length > 0) {
|
||||
this.selectlist.forEach(it => {
|
||||
this.dataObj.evaluate = this.dataObj.evaluate + it.title + ','
|
||||
})
|
||||
this.dataObj.evaluate = this.dataObj.evaluate.slice(0, -1);
|
||||
}
|
||||
|
||||
|
||||
evaluateAdd(this.dataObj).then(res => {
|
||||
uni.showToast({
|
||||
title: '评价成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
|
||||
})
|
||||
},
|
||||
// 监听变化的数据
|
||||
change(arr) {
|
||||
this.selectlist = arr
|
||||
},
|
||||
/**提交*/
|
||||
submitForm() {},
|
||||
/**
|
||||
* 去我的建议列表
|
||||
*/
|
||||
@ -79,7 +149,8 @@
|
||||
},
|
||||
chooseObj(item) {
|
||||
this.selectlist.push({
|
||||
title: item
|
||||
title: item.title,
|
||||
code: item.code
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,7 @@
|
||||
<text v-else-if="0==item.approvalStatus" style="color:#FC1F3E ;">审核中</text>
|
||||
<text v-else>未通过</text>
|
||||
</view> -->
|
||||
<view class="edit-text">
|
||||
<text v-if="!item.ifChecked" style="color:#F97A35;">待定</text>
|
||||
<text v-else style="color:#5986F2 ;" @click="chooseOk(item)">合适</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="card-content">
|
||||
<view class="card-person-info">
|
||||
@ -42,6 +39,8 @@
|
||||
</view>
|
||||
<view v-if="status==0" :class="['edit-dom']" @click="chooseCardVal(item.id)">{{"合适"}}
|
||||
</view>
|
||||
<view v-else :class="['edit-dom']" @click="evaluate(item)">{{"评价"}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -77,6 +76,9 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
evaluate(item) {
|
||||
this.$tab.navigateTo('/pages/mine/set/evaluate?userType=02&toUserId=' + item.userId)
|
||||
},
|
||||
chooseItem() {
|
||||
console.log(this.dataList, "dataList")
|
||||
this.$emit("updateList", this.dataList)
|
||||
@ -91,7 +93,23 @@
|
||||
* 去名片所有者主页
|
||||
*/
|
||||
goIndex(item) {
|
||||
this.$emit("goIndex", item)
|
||||
uni.setClipboardData({
|
||||
data: item.indexUrl,
|
||||
success: function() {
|
||||
uni.showToast({
|
||||
title: '主页链接复制成功,请到应用中访问',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
},
|
||||
fail: function() {
|
||||
uni.showToast({
|
||||
title: '复制失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 将名片置为合适或不合适
|
||||
@ -243,4 +261,4 @@
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
@ -253,7 +253,7 @@
|
||||
viewMy: false,
|
||||
//通告ID
|
||||
noticeId: null,
|
||||
imageUrl: config.baseUrl,
|
||||
imageUrl: '',
|
||||
//是否显示下方操作按钮--刚开始不显示
|
||||
showBottom: false,
|
||||
//当前用户
|
||||
|
11083
utils/cos-wx-sdk-v5.js
Normal file
11083
utils/cos-wx-sdk-v5.js
Normal file
File diff suppressed because one or more lines are too long
42
utils/cos.js
Normal file
42
utils/cos.js
Normal file
@ -0,0 +1,42 @@
|
||||
import config from '@/config'
|
||||
const COS = require('./cos-wx-sdk-v5.js'); // 开发时使用
|
||||
// const COS = require('./lib/cos-wx-sdk-v5.min.js'); // 上线时使用压缩包
|
||||
|
||||
const baseUrl = config.baseUrl
|
||||
|
||||
const cos = new COS({
|
||||
SimpleUploadMethod: 'putObject', // 强烈建议,高级上传、批量上传内部对小文件做简单上传时使用putObject,sdk版本至少需要v1.3.0
|
||||
getAuthorization: function(options, callback) {
|
||||
// 初始化时不会调用,只有调用 cos 方法(例如 cos.putObject)时才会进入
|
||||
// 异步获取临时密钥
|
||||
// 服务端 JS 示例:https://github.com/tencentyun/cos-js-sdk-v5/blob/master/server/
|
||||
// 服务端其他语言参考 COS STS SDK :https://github.com/tencentyun/qcloud-cos-sts-sdk
|
||||
// STS 详细文档指引看:https://cloud.tencent.com/document/product/436/14048
|
||||
const stsUrl = baseUrl + '/cos/sts'; // stsUrl 替换成您自己的后端服务
|
||||
wx.request({
|
||||
url: stsUrl,
|
||||
data: {
|
||||
bucket: options.Bucket,
|
||||
region: options.Region,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
const data = result.data;
|
||||
const credentials = data && data.credentials;
|
||||
if (!data || !credentials) return console.error('credentials invalid');
|
||||
// 检查 credentials 格式
|
||||
console.log(credentials);
|
||||
callback({
|
||||
TmpSecretId: credentials.tmpSecretId,
|
||||
TmpSecretKey: credentials.tmpSecretKey,
|
||||
// v1.2.0之前版本的 SDK 使用 XCosSecurityToken 而不是 SecurityToken
|
||||
SecurityToken: credentials.sessionToken,
|
||||
// 建议返回服务器时间作为签名的开始时间,避免用户浏览器本地时间偏差过大导致签名错误
|
||||
StartTime: data.startTime, // 时间戳,单位秒,如:1580000000
|
||||
ExpiredTime: data.expiredTime, // 时间戳,单位秒,如:1580000900
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
export default cos;
|
105
utils/upload.js
105
utils/upload.js
@ -1,70 +1,41 @@
|
||||
import store from '@/store'
|
||||
import config from '@/config'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
import { toast, showConfirm, tansParams } from '@/utils/common'
|
||||
import cos from '@/utils/cos' // 您已有的COS实例
|
||||
import {
|
||||
getToken
|
||||
} from '@/utils/auth'
|
||||
import {
|
||||
toast
|
||||
} from '@/utils/common'
|
||||
|
||||
let timeout = 10000
|
||||
const baseUrl = config.baseUrl
|
||||
|
||||
const upload = config => {
|
||||
// 是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
config.header = config.header || {}
|
||||
if (getToken() && !isToken) {
|
||||
config.header['Authorization'] = 'Bearer ' + getToken()
|
||||
}
|
||||
// get请求映射params参数
|
||||
if (config.params) {
|
||||
let url = config.url + '?' + tansParams(config.params)
|
||||
url = url.slice(0, -1)
|
||||
config.url = url
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
timeout: config.timeout || timeout,
|
||||
url: baseUrl + '/common/upload' + config.url,
|
||||
filePath: config.filePath,
|
||||
name: config.name || 'file',
|
||||
header: config.header,
|
||||
formData: config.formData,
|
||||
success: (res) => {
|
||||
let result = JSON.parse(res.data)
|
||||
const code = result.code || 200
|
||||
const msg = errorCode[code] || result.msg || errorCode['default']
|
||||
if (code === 200) {
|
||||
resolve(result)
|
||||
} else if (code == 401) {
|
||||
showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => {
|
||||
if (res.confirm) {
|
||||
store.dispatch('LogOut').then(res => {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
})
|
||||
}
|
||||
})
|
||||
reject('无效的会话,或者会话已过期,请重新登录。')
|
||||
} else if (code === 500) {
|
||||
toast(msg)
|
||||
reject('500')
|
||||
} else if (code !== 200) {
|
||||
toast(msg)
|
||||
reject(code)
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
let { message } = error
|
||||
if (message == 'Network Error') {
|
||||
message = '后端接口连接异常'
|
||||
} else if (message.includes('timeout')) {
|
||||
message = '系统接口请求超时'
|
||||
} else if (message.includes('Request failed with status code')) {
|
||||
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||
}
|
||||
toast(message)
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
const upload = async (config) => {
|
||||
try {
|
||||
console.log('config', config);
|
||||
// 生成文件名(避免中文乱码)
|
||||
const fileName = '/images/' + config.filePath.split('/').pop(); // 提取最后一段路径
|
||||
const data = await cos.uploadFile({
|
||||
Bucket: 'notice-1348525010', // 填写自己的 bucket,必须字段
|
||||
Region: 'ap-beijing', // 存储桶所在地域,必须字段
|
||||
Key: fileName,
|
||||
FilePath: config.filePath,
|
||||
/* v1.4.3之前的版本必须,v1.4.3及以后的版本非必须 */
|
||||
SliceSize: 1024 * 1024 * 5, // 触发分块上传的阈值,超过5MB 使用分块上传,小于5MB使用简单上传。可自行设置,非必须
|
||||
onProgress: function(progressData) {
|
||||
console.log('上传进度:', progressData);
|
||||
},
|
||||
// onTaskReady: function(id) { // 非必须
|
||||
// taskId = id;
|
||||
// },
|
||||
});
|
||||
console.log('上传成功', data);
|
||||
// 上传成功
|
||||
const fileUrl = `https://${data.Location}`;
|
||||
return {
|
||||
url: fileUrl,
|
||||
fileName: fileUrl
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('上传失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
export default upload
|
||||
// 明确导出类型
|
||||
export default upload
|
Loading…
Reference in New Issue
Block a user